Imported Upstream version 2.3.3 30/239430/1 upstream/2.3.3
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 24 Jul 2020 11:21:08 +0000 (13:21 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 24 Jul 2020 12:41:45 +0000 (14:41 +0200)
Change-Id: I3af4bf459d2b73bed419873693a905a2606332b9

403 files changed:
ABOUT-NLS
AUTHORS
ChangeLog
FAQ
INSTALL
Makefile.am
Makefile.in
TODO
aclocal.m4
compile
config.h.in
config.rpath
config.sub
configure
configure.ac
depcomp
docs/ChangeLog.old
docs/Keyring.txt [new file with mode: 0644]
docs/LUKS2-locking.txt [new file with mode: 0644]
docs/doxyfile
docs/doxygen_index.h [moved from docs/doxygen_index with 91% similarity]
docs/examples/crypt_log_usage.c
docs/examples/crypt_luks_usage.c
docs/on-disk-format-luks2.pdf [new file with mode: 0644]
docs/on-disk-format.pdf
docs/v1.3.0-ReleaseNotes
docs/v1.4.0-ReleaseNotes
docs/v1.5.0-ReleaseNotes
docs/v1.6.8-ReleaseNotes [new file with mode: 0644]
docs/v1.7.0-ReleaseNotes [new file with mode: 0644]
docs/v1.7.1-ReleaseNotes [new file with mode: 0644]
docs/v1.7.2-ReleaseNotes [new file with mode: 0644]
docs/v1.7.3-ReleaseNotes [new file with mode: 0644]
docs/v1.7.4-ReleaseNotes [new file with mode: 0644]
docs/v1.7.5-ReleaseNotes [new file with mode: 0644]
docs/v2.0.0-ReleaseNotes [new file with mode: 0644]
docs/v2.0.1-ReleaseNotes [new file with mode: 0644]
docs/v2.0.2-ReleaseNotes [new file with mode: 0644]
docs/v2.0.3-ReleaseNotes [new file with mode: 0644]
docs/v2.0.4-ReleaseNotes [new file with mode: 0644]
docs/v2.0.5-ReleaseNotes [new file with mode: 0644]
docs/v2.0.6-ReleaseNotes [new file with mode: 0644]
docs/v2.1.0-ReleaseNotes [new file with mode: 0644]
docs/v2.2.0-ReleaseNotes [new file with mode: 0644]
docs/v2.2.1-ReleaseNotes [new file with mode: 0644]
docs/v2.2.2-ReleaseNotes [new file with mode: 0644]
docs/v2.3.0-ReleaseNotes [new file with mode: 0644]
docs/v2.3.1-ReleaseNotes [new file with mode: 0644]
docs/v2.3.2-ReleaseNotes [new file with mode: 0644]
docs/v2.3.3-ReleaseNotes [new file with mode: 0644]
lib/Makefile.am [deleted file]
lib/Makefile.in [deleted file]
lib/Makemodule.am [new file with mode: 0644]
lib/base64.c [new file with mode: 0644]
lib/base64.h [new file with mode: 0644]
lib/bitlk/bitlk.c [new file with mode: 0644]
lib/bitlk/bitlk.h [new file with mode: 0644]
lib/crypt_plain.c
lib/crypto_backend/Makefile.am [deleted file]
lib/crypto_backend/Makefile.in [deleted file]
lib/crypto_backend/Makemodule.am [new file with mode: 0644]
lib/crypto_backend/argon2/LICENSE [new file with mode: 0644]
lib/crypto_backend/argon2/Makemodule.am [new file with mode: 0644]
lib/crypto_backend/argon2/README [new file with mode: 0644]
lib/crypto_backend/argon2/argon2.c [new file with mode: 0644]
lib/crypto_backend/argon2/argon2.h [new file with mode: 0644]
lib/crypto_backend/argon2/blake2/blake2-impl.h [new file with mode: 0644]
lib/crypto_backend/argon2/blake2/blake2.h [new file with mode: 0644]
lib/crypto_backend/argon2/blake2/blake2b.c [new file with mode: 0644]
lib/crypto_backend/argon2/blake2/blamka-round-opt.h [new file with mode: 0644]
lib/crypto_backend/argon2/blake2/blamka-round-ref.h [new file with mode: 0644]
lib/crypto_backend/argon2/core.c [new file with mode: 0644]
lib/crypto_backend/argon2/core.h [new file with mode: 0644]
lib/crypto_backend/argon2/encoding.c [new file with mode: 0644]
lib/crypto_backend/argon2/encoding.h [new file with mode: 0644]
lib/crypto_backend/argon2/opt.c [new file with mode: 0644]
lib/crypto_backend/argon2/ref.c [new file with mode: 0644]
lib/crypto_backend/argon2/thread.c [new file with mode: 0644]
lib/crypto_backend/argon2/thread.h [new file with mode: 0644]
lib/crypto_backend/argon2_generic.c [new file with mode: 0644]
lib/crypto_backend/cipher_check.c [new file with mode: 0644]
lib/crypto_backend/cipher_generic.c [new file with mode: 0644]
lib/crypto_backend/crc32.c
lib/crypto_backend/crypto_backend.h
lib/crypto_backend/crypto_backend_internal.h [new file with mode: 0644]
lib/crypto_backend/crypto_cipher_kernel.c
lib/crypto_backend/crypto_gcrypt.c
lib/crypto_backend/crypto_kernel.c
lib/crypto_backend/crypto_nettle.c
lib/crypto_backend/crypto_nss.c
lib/crypto_backend/crypto_openssl.c
lib/crypto_backend/crypto_storage.c
lib/crypto_backend/pbkdf2_generic.c
lib/crypto_backend/pbkdf_check.c
lib/integrity/integrity.c [new file with mode: 0644]
lib/integrity/integrity.h [new file with mode: 0644]
lib/internal.h
lib/libcryptsetup.h
lib/libcryptsetup.sym
lib/libdevmapper.c
lib/loopaes/Makefile.am [deleted file]
lib/loopaes/Makefile.in [deleted file]
lib/loopaes/loopaes.c
lib/loopaes/loopaes.h
lib/luks1/Makefile.am [deleted file]
lib/luks1/Makefile.in [deleted file]
lib/luks1/af.c
lib/luks1/af.h
lib/luks1/keyencryption.c
lib/luks1/keymanage.c
lib/luks1/luks.h
lib/luks2/luks2.h [new file with mode: 0644]
lib/luks2/luks2_digest.c [new file with mode: 0644]
lib/luks2/luks2_digest_pbkdf2.c [new file with mode: 0644]
lib/luks2/luks2_disk_metadata.c [new file with mode: 0644]
lib/luks2/luks2_internal.h [new file with mode: 0644]
lib/luks2/luks2_json_format.c [new file with mode: 0644]
lib/luks2/luks2_json_metadata.c [new file with mode: 0644]
lib/luks2/luks2_keyslot.c [new file with mode: 0644]
lib/luks2/luks2_keyslot_luks2.c [new file with mode: 0644]
lib/luks2/luks2_keyslot_reenc.c [new file with mode: 0644]
lib/luks2/luks2_luks1_convert.c [new file with mode: 0644]
lib/luks2/luks2_reencrypt.c [new file with mode: 0644]
lib/luks2/luks2_segment.c [new file with mode: 0644]
lib/luks2/luks2_token.c [new file with mode: 0644]
lib/luks2/luks2_token_keyring.c [new file with mode: 0644]
lib/random.c
lib/setup.c
lib/tcrypt/Makefile.am [deleted file]
lib/tcrypt/Makefile.in [deleted file]
lib/tcrypt/tcrypt.c
lib/tcrypt/tcrypt.h
lib/utils.c
lib/utils_benchmark.c
lib/utils_blkid.c [new file with mode: 0644]
lib/utils_blkid.h [new file with mode: 0644]
lib/utils_crypt.c
lib/utils_crypt.h
lib/utils_device.c
lib/utils_device_locking.c [new file with mode: 0644]
lib/utils_device_locking.h [new file with mode: 0644]
lib/utils_devpath.c
lib/utils_dm.h
lib/utils_fips.c
lib/utils_fips.h
lib/utils_io.c [new file with mode: 0644]
lib/utils_io.h [new file with mode: 0644]
lib/utils_keyring.c [new file with mode: 0644]
lib/utils_keyring.h [new file with mode: 0644]
lib/utils_loop.c
lib/utils_loop.h
lib/utils_pbkdf.c [new file with mode: 0644]
lib/utils_safe_memory.c [new file with mode: 0644]
lib/utils_storage_wrappers.c [new file with mode: 0644]
lib/utils_storage_wrappers.h [new file with mode: 0644]
lib/utils_wipe.c
lib/verity/Makefile.am [deleted file]
lib/verity/Makefile.in [deleted file]
lib/verity/rs.h [new file with mode: 0644]
lib/verity/rs_decode_char.c [new file with mode: 0644]
lib/verity/rs_encode_char.c [new file with mode: 0644]
lib/verity/verity.c
lib/verity/verity.h
lib/verity/verity_fec.c [new file with mode: 0644]
lib/verity/verity_hash.c
lib/volumekey.c
ltmain.sh
m4/gettext.m4
m4/iconv.m4
m4/intlmacosx.m4 [new file with mode: 0644]
m4/lib-ld.m4
m4/lib-link.m4
m4/lib-prefix.m4
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
m4/nls.m4
m4/po.m4
m4/progtest.m4
man/Makefile.am [deleted file]
man/Makefile.in [deleted file]
man/Makemodule.am [new file with mode: 0644]
man/cryptsetup-reencrypt.8
man/cryptsetup.8
man/integritysetup.8 [new file with mode: 0644]
man/veritysetup.8
misc/dict_search/README
misc/dict_search/crypt_dict.c
misc/dracut_90reencrypt/README
misc/dracut_90reencrypt/module-setup.sh
misc/dracut_90reencrypt/parse-reencrypt.sh
misc/dracut_90reencrypt/reencrypt-verbose.sh [new file with mode: 0755]
misc/dracut_90reencrypt/reencrypt.sh
misc/keyslot_checker/chk_luks_keyslots.c
misc/luks2_keyslot_example/Makefile [new file with mode: 0644]
misc/luks2_keyslot_example/README [new file with mode: 0644]
misc/luks2_keyslot_example/keyslot_test.c [new file with mode: 0644]
misc/luks2_keyslot_example/keyslot_test_remote_pass.c [new file with mode: 0644]
missing
po/LINGUAS
po/Makefile.in.in
po/Makevars
po/POTFILES.in
po/Rules-quot
po/cryptsetup.pot
po/cs.gmo
po/cs.po
po/da.gmo [new file with mode: 0644]
po/da.po [new file with mode: 0644]
po/de.gmo
po/de.po
po/es.gmo
po/es.po
po/fi.gmo
po/fi.po
po/fr.gmo
po/fr.po
po/id.gmo
po/id.po
po/it.gmo
po/it.po
po/ja.gmo [new file with mode: 0644]
po/ja.po [new file with mode: 0644]
po/nl.gmo
po/nl.po
po/pl.gmo
po/pl.po
po/pt_BR.gmo [new file with mode: 0644]
po/pt_BR.po [new file with mode: 0644]
po/ru.gmo [new file with mode: 0644]
po/ru.po [new file with mode: 0644]
po/sr.gmo [new file with mode: 0644]
po/sr.po [new file with mode: 0644]
po/sv.gmo
po/sv.po
po/uk.gmo
po/uk.po
po/vi.gmo
po/vi.po
po/zh_CN.gmo [new file with mode: 0644]
po/zh_CN.po [new file with mode: 0644]
python/Makefile.am [deleted file]
python/Makefile.in [deleted file]
python/pycryptsetup-test.py [deleted file]
python/pycryptsetup.c [deleted file]
scripts/Makemodule.am [new file with mode: 0644]
scripts/cryptsetup.conf.in [new file with mode: 0644]
src/Makefile.am [deleted file]
src/Makefile.in [deleted file]
src/Makemodule.am [new file with mode: 0644]
src/cryptsetup.c
src/cryptsetup.h
src/cryptsetup_reencrypt.c
src/integritysetup.c [new file with mode: 0644]
src/utils_blockdev.c [new file with mode: 0644]
src/utils_luks2.c [new file with mode: 0644]
src/utils_password.c
src/utils_tools.c
src/veritysetup.c
tests/00modules-test [new file with mode: 0755]
tests/Makefile.am
tests/Makefile.in
tests/Makefile.localtest [new file with mode: 0644]
tests/align-test
tests/align-test2 [new file with mode: 0755]
tests/api-test-2.c [new file with mode: 0644]
tests/api-test.c
tests/api_test.h [new file with mode: 0644]
tests/bitlk-compat-test [new file with mode: 0755]
tests/bitlk-images.tar.xz [new file with mode: 0644]
tests/blkid-luks2-pv.img.xz [new file with mode: 0644]
tests/blockwise-compat [new file with mode: 0755]
tests/compat-test
tests/compat-test2 [new file with mode: 0755]
tests/compatimage.img.bz2 [deleted file]
tests/compatimage.img.xz [new file with mode: 0644]
tests/compatimage2.img.xz [new file with mode: 0644]
tests/compatv10image.img.bz2 [deleted file]
tests/compatv10image.img.xz [new file with mode: 0644]
tests/conversion_imgs.tar.xz [new file with mode: 0644]
tests/crypto-vectors.c [new file with mode: 0644]
tests/cryptsetup-valg-supps
tests/device-test
tests/differ.c
tests/discards-test
tests/evil_hdr-keyslot_overlap.xz [new file with mode: 0644]
tests/evil_hdr-luks_hdr_damage.bz2 [deleted file]
tests/evil_hdr-luks_hdr_damage.xz [new file with mode: 0644]
tests/evil_hdr-payload_overwrite.bz2 [deleted file]
tests/evil_hdr-payload_overwrite.xz [new file with mode: 0644]
tests/evil_hdr-small_luks_device.bz2 [deleted file]
tests/evil_hdr-small_luks_device.xz [new file with mode: 0644]
tests/evil_hdr-stripes_payload_dmg.bz2 [deleted file]
tests/evil_hdr-stripes_payload_dmg.xz [new file with mode: 0644]
tests/generators/generate-luks2-area-in-json-hdr-space-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-argon2-leftover-params.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-correct-full-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-corrupted-hdr0-with-correct-chks.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-corrupted-hdr1-with-correct-chks.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-checksum-both-hdrs.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-checksum-hdr0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-checksum-hdr1.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-json-size-c0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-json-size-c1.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-json-size-c2.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-keyslots-size-c0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-keyslots-size-c1.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-keyslots-size-c2.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-object-type-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-invalid-opening-char-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-keyslot-missing-digest.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-keyslot-too-many-digests.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-128k-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-128k.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-16k-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-1m-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-1m.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-256k-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-256k.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-2m-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-2m.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-32k-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-32k.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-4m-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-4m.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-512k-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-512k.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-64k-inv-area-c0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-64k-inv-area-c1.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-64k-inv-keyslots-size-c0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-64k-secondary.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-metadata-size-64k.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-missing-keyslot-referenced-in-digest.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-missing-keyslot-referenced-in-token.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-missing-segment-referenced-in-digest.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-missing-trailing-null-byte-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-non-null-byte-beyond-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-non-null-bytes-beyond-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-overlapping-areas-c0-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-overlapping-areas-c1-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-overlapping-areas-c2-json0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-pbkdf2-leftover-params-0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-pbkdf2-leftover-params-1.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-missing-encryption.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-missing-ivoffset.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-missing-sectorsize.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-wrong-encryption.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-wrong-ivoffset.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-1.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-2.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-missing-offset.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-missing-size.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-missing-type.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-two.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-unknown-type.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-wrong-flags-element.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-wrong-flags.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-wrong-offset.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-wrong-size-0.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-wrong-size-1.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-wrong-size-2.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-segment-wrong-type.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-uint64-max-segment-size.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-uint64-overflow-segment-size.img.sh [new file with mode: 0755]
tests/generators/generate-luks2-uint64-signed-segment-size.img.sh [new file with mode: 0755]
tests/generators/lib.sh [new file with mode: 0644]
tests/img_fs_ext4.img.bz2 [deleted file]
tests/img_fs_ext4.img.xz [new file with mode: 0644]
tests/img_fs_vfat.img.bz2 [deleted file]
tests/img_fs_vfat.img.xz [new file with mode: 0644]
tests/img_fs_xfs.img.bz2 [deleted file]
tests/img_fs_xfs.img.xz [new file with mode: 0644]
tests/integrity-compat-test [new file with mode: 0755]
tests/keyring-compat-test [new file with mode: 0755]
tests/keyring-test [new file with mode: 0755]
tests/loopaes-test
tests/luks1-compat-test
tests/luks1-images.tar.bz2 [deleted file]
tests/luks1-images.tar.xz [new file with mode: 0644]
tests/luks2-integrity-test [new file with mode: 0755]
tests/luks2-reencryption-test [new file with mode: 0755]
tests/luks2-validation-test [new file with mode: 0755]
tests/luks2_header_requirements.xz [new file with mode: 0644]
tests/luks2_header_requirements_free.xz [new file with mode: 0644]
tests/luks2_keyslot_unassigned.img.xz [new file with mode: 0644]
tests/luks2_mda_images.tar.xz [new file with mode: 0644]
tests/luks2_valid_hdr.img.xz [new file with mode: 0644]
tests/mode-test
tests/password-hash-test
tests/reencryption-compat-test
tests/reencryption-compat-test2 [new file with mode: 0755]
tests/tcrypt-compat-test
tests/tcrypt-images.tar.bz2 [deleted file]
tests/tcrypt-images.tar.xz [new file with mode: 0644]
tests/test_utils.c [new file with mode: 0644]
tests/unit-utils-io.c [new file with mode: 0644]
tests/valg.sh
tests/valid_header_file.bz2 [deleted file]
tests/valid_header_file.xz [new file with mode: 0644]
tests/verity-compat-test

index 3575535..b1de1b6 100644 (file)
--- a/ABOUT-NLS
+++ b/ABOUT-NLS
@@ -18,35 +18,7 @@ explain how users should proceed for getting the programs to use the
 available translations.  They tell how people wanting to contribute and
 work on translations can contact the appropriate team.
 
-   When reporting bugs in the `intl/' directory or bugs which may be
-related to internationalization, you should tell about the version of
-`gettext' which is used.  The information can be found in the
-`intl/VERSION' file, in internationalized packages.
-
-1.1 Quick configuration advice
-==============================
-
-If you want to exploit the full power of internationalization, you
-should configure it using
-
-     ./configure --with-included-gettext
-
-to force usage of internationalizing routines provided within this
-package, despite the existence of internationalizing capabilities in the
-operating system where this package is being installed.  So far, only
-the `gettext' implementation in the GNU C library version 2 provides as
-many features (such as locale alias, message inheritance, automatic
-charset conversion or plural form handling) as the implementation here.
-It is also not possible to offer this additional functionality on top
-of a `catgets' implementation.  Future versions of GNU `gettext' will
-very likely convey even more functionality.  So it might be a good idea
-to change to GNU `gettext' as soon as possible.
-
-   So you need _not_ provide this option if you are using GNU libc 2 or
-you have installed a recent copy of the GNU gettext package with the
-included `libintl'.
-
-1.2 INSTALL Matters
+1.1 INSTALL Matters
 ===================
 
 Some packages are "localizable" when properly installed; the programs
@@ -56,36 +28,19 @@ internationalization, predating GNU `gettext'.
 
    By default, this package will be installed to allow translation of
 messages.  It will automatically detect whether the system already
-provides the GNU `gettext' functions.  If not, the included GNU
-`gettext' library will be used.  This library is wholly contained
-within this package, usually in the `intl/' subdirectory, so prior
-installation of the GNU `gettext' package is _not_ required.
-Installers may use special options at configuration time for changing
-the default behaviour.  The commands:
+provides the GNU `gettext' functions.  Installers may use special
+options at configuration time for changing the default behaviour.  The
+command:
 
-     ./configure --with-included-gettext
      ./configure --disable-nls
 
-will, respectively, bypass any pre-existing `gettext' to use the
-internationalizing routines provided within this package, or else,
-_totally_ disable translation of messages.
+will _totally_ disable translation of messages.
 
    When you already have GNU `gettext' installed on your system and run
 configure without an option for your new package, `configure' will
-probably detect the previously built and installed `libintl.a' file and
-will decide to use this.  This might not be desirable.  You should use
-the more recent version of the GNU `gettext' library.  I.e. if the file
-`intl/VERSION' shows that the library which comes with this package is
-more recent, you should use
-
-     ./configure --with-included-gettext
-
-to prevent auto-detection.
-
-   The configuration process will not test for the `catgets' function
-and therefore it will not be used.  The reason is that even an
-emulation of `gettext' on top of `catgets' could not provide all the
-extensions of the GNU `gettext' library.
+probably detect the previously built and installed `libintl' library
+and will decide to use it.  If not, you may have to to use the
+`--with-libintl-prefix' option to tell `configure' where to look for it.
 
    Internationalized packages usually have many `po/LL.po' files, where
 LL gives an ISO 639 two-letter code identifying the language.  Unless
@@ -96,13 +51,16 @@ may be set, prior to configuration, to limit the installed set.
 `LINGUAS' should then contain a space separated list of two-letter
 codes, stating which languages are allowed.
 
-1.3 Using This Package
+1.2 Using This Package
 ======================
 
 As a user, if your language has been installed for this package, you
 only have to set the `LANG' environment variable to the appropriate
-`LL_CC' combination.  Here `LL' is an ISO 639 two-letter language code,
-and `CC' is an ISO 3166 two-letter country code.  For example, let's
+`LL_CC' combination.  If you happen to have the `LC_ALL' or some other
+`LC_xxx' environment variables set, you should unset them before
+setting `LANG', otherwise the setting of `LANG' will not have the
+desired effect.  Here `LL' is an ISO 639 two-letter language code, and
+`CC' is an ISO 3166 two-letter country code.  For example, let's
 suppose that you speak German and live in Germany.  At the shell
 prompt, merely execute `setenv LANG de_DE' (in `csh'),
 `export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
@@ -145,7 +103,7 @@ to denote the language's main dialect.  For example, `de' is equivalent
 to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
 (Portuguese as spoken in Portugal) in this context.
 
-1.4 Translating Teams
+1.3 Translating Teams
 =====================
 
 For the Free Translation Project to be a success, we need interested
@@ -153,8 +111,7 @@ people who like their own language and write it well, and who are also
 able to synergize with other translators speaking the same language.
 Each translation team has its own mailing list.  The up-to-date list of
 teams can be found at the Free Translation Project's homepage,
-`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
-area.
+`http://translationproject.org/', in the "Teams" area.
 
    If you'd like to volunteer to _work_ at translating messages, you
 should become a member of the translating team for your own language.
@@ -168,911 +125,1125 @@ message to `sv-request@li.org', having this message body:
 _actively_ in translations, or at solving translational difficulties,
 rather than merely lurking around.  If your team does not exist yet and
 you want to start one, or if you are unsure about what to do or how to
-get started, please write to `translation@iro.umontreal.ca' to reach the
-coordinator for all translator teams.
+get started, please write to `coordinator@translationproject.org' to
+reach the coordinator for all translator teams.
 
    The English team is special.  It works at improving and uniformizing
-the terminology in use.  Proven linguistic skill are praised more than
-programming skill, here.
+the terminology in use.  Proven linguistic skills are praised more than
+programming skills, here.
 
-1.5 Available Packages
+1.4 Available Packages
 ======================
 
 Languages are not equally supported in all packages.  The following
-matrix shows the current state of internationalization, as of July
-2006.  The matrix shows, in regard of each package, for which languages
+matrix shows the current state of internationalization, as of June
+2010.  The matrix shows, in regard of each package, for which languages
 PO files have been submitted to translation coordination, with a
 translation percentage of at least 50%.
 
-     Ready PO files       af am ar az be bg bs ca cs cy da de el en en_GB eo
-                        +----------------------------------------------------+
-     GNUnet             |                                  []                |
-     a2ps               |             []                [] [] []     []      |
-     aegis              |                                  ()                |
-     ant-phone          |                                  ()                |
-     anubis             |                                  []                |
-     ap-utils           |                                                    |
-     aspell             |                         []    [] []        []      |
-     bash               |                      []          []             [] |
-     batchelor          |                                  []                |
-     bfd                |                                                    |
-     bibshelf           |                                  []                |
-     binutils           |                               []                   |
-     bison              |                               [] []                |
-     bison-runtime      |                                  []                |
-     bluez-pin          | []                      []       [] []          [] |
-     cflow              |                               []                   |
-     clisp              |                                  []    []          |
-     console-tools      |                         []       []                |
-     coreutils          |                []    []       [] []                |
-     cpio               |                                                    |
-     cpplib             |                      []       [] []                |
-     cryptonit          |                                  []                |
-     darkstat           |                []             () []                |
-     dialog             |                      [] [] [] [] [] []             |
-     diffutils          |                      [] []    [] [] []          [] |
-     doodle             |                                  []                |
-     e2fsprogs          |                         []       []                |
-     enscript           |                      []       [] []        []      |
-     error              |                      []       [] []        []      |
-     fetchmail          |                      []       [] () []             |
-     fileutils          |                               [] []                |
-     findutils          |                []    []       []                   |
-     flex               |                      []       [] []                |
-     fslint             |                                  []                |
-     gas                |                                                    |
-     gawk               |                      []       [] []                |
-     gbiff              |                                  []                |
-     gcal               |                      []                            |
-     gcc                |                                  []                |
-     gettext-examples   | []                   []          [] []          [] |
-     gettext-runtime    |             []       []       [] []             [] |
-     gettext-tools      |                      []          []                |
-     gimp-print         |                         []    [] []        []      |
-     gip                |                []                                  |
-     gliv               |                                  []                |
-     glunarclock        |                []                                  |
-     gmult              | []                               []                |
-     gnubiff            |                                  ()                |
-     gnucash            |                                  () ()     []      |
-     gnucash-glossary   |                               [] ()                |
-     gnuedu             |                                                    |
-     gnulib             | []          [] []    []       [] []                |
-     gnunet-gtk         |                                                    |
-     gnutls             |                                                    |
-     gpe-aerial         |                         []       []                |
-     gpe-beam           |                         []       []                |
-     gpe-calendar       |                         []       []                |
-     gpe-clock          |                         []       []                |
-     gpe-conf           |                         []       []                |
-     gpe-contacts       |                                                    |
-     gpe-edit           |                         []                         |
-     gpe-filemanager    |                                                    |
-     gpe-go             |                         []                         |
-     gpe-login          |                         []       []                |
-     gpe-ownerinfo      |                         []       []                |
-     gpe-package        |                                                    |
-     gpe-sketchbook     |                         []       []                |
-     gpe-su             |                         []       []                |
-     gpe-taskmanager    |                         []       []                |
-     gpe-timesheet      |                         []                         |
-     gpe-today          |                         []       []                |
-     gpe-todo           |                                                    |
-     gphoto2            |                         []    [] []        []      |
-     gprof              |                               [] []                |
-     gpsdrive           |                                  ()    ()          |
-     gramadoir          | []                               []                |
-     grep               | []          [] []    []          [] []             |
-     gretl              |                                                    |
-     gsasl              |                                                    |
-     gss                |                                                    |
-     gst-plugins        | []                   [] []    []                   |
-     gst-plugins-base   |                []    []       []                   |
-     gst-plugins-good   | []       []    []    [] []    []           []      |
-     gstreamer          | []             []    [] []    [] []        []      |
-     gtick              | []                               ()                |
-     gtkam              |                         []    [] []                |
-     gtkorphan          |                []                []                |
-     gtkspell           |             []                   [] []          [] |
-     gutenprint         |                               []                   |
-     hello              |                      []       [] [] []          [] |
-     id-utils           |                               [] []                |
-     impost             |                                                    |
-     indent             |                      []          []             [] |
-     iso_3166           |                                  []             [] |
-     iso_3166_1         |                      [] []    [] [] []             |
-     iso_3166_2         |                                                    |
-     iso_3166_3         |                                  []                |
-     iso_4217           |                                  []                |
-     iso_639            |                                  []             [] |
-     jpilot             |                         []                         |
-     jtag               |                                                    |
-     jwhois             |                                                    |
-     kbd                |                         []    [] [] []             |
-     keytouch           |                                                    |
-     keytouch-editor    |                                                    |
-     keytouch-keyboa... |                                                    |
-     latrine            |                                  ()                |
-     ld                 |                               []                   |
-     leafpad            |                []    [] []       [] []             |
-     libc               |                      [] []    [] [] []             |
-     libexif            |                                  []                |
-     libextractor       |                                  []                |
-     libgpewidget       |                         []    [] []                |
-     libgpg-error       |                                  []                |
-     libgphoto2         |                               [] []                |
-     libgphoto2_port    |                               [] []                |
-     libgsasl           |                                                    |
-     libiconv           |                                  []             [] |
-     libidn             |                               []                [] |
-     lifelines          |                               [] ()                |
-     lilypond           |                                  []                |
-     lingoteach         |                                                    |
-     lynx               |                      [] []    [] []                |
-     m4                 |                         []    [] [] []             |
-     mailutils          |                      []                            |
-     make               |                               [] []                |
-     man-db             |                      [] ()    [] []                |
-     minicom            |                         []    [] []                |
-     mysecretdiary      |                               [] []                |
-     nano               |                []    [] ()       []                |
-     nano_1_0           |                      [] ()    [] []                |
-     opcodes            |                                  []                |
-     parted             |                                                    |
-     pilot-qof          |                                            []      |
-     psmisc             |                []                                  |
-     pwdutils           |                                                    |
-     python             |                                                    |
-     qof                |                                                    |
-     radius             |                      []                            |
-     recode             |             []       []       [] [] []          [] |
-     rpm                |                         []    []                   |
-     screem             |                                                    |
-     scrollkeeper       |          [] []       [] [] [] [] []        []      |
-     sed                |                      []          []             [] |
-     sh-utils           |                               [] []                |
-     shared-mime-info   |                []       []                      [] |
-     sharutils          |                []    [] []    [] [] []             |
-     shishi             |                                                    |
-     silky              |                                                    |
-     skencil            |                               [] ()                |
-     sketch             |                               [] ()                |
-     solfege            |                                                    |
-     soundtracker       |                               [] []                |
-     sp                 |                                  []                |
-     stardict           |                         []                         |
-     system-tools-ba... |       []       [] [] [] []    [] [] []     []      |
-     tar                |                []                                  |
-     texinfo            |                               [] []             [] |
-     textutils          |                      []       [] []                |
-     tin                |                                  ()        ()      |
-     tp-robot           |                                  []                |
-     tuxpaint           | []             []             [] []        []      |
-     unicode-han-tra... |                                                    |
-     unicode-transla... |                                                    |
-     util-linux         |                      [] []    [] []                |
-     vorbis-tools       |             []          []    []           []      |
-     wastesedge         |                                  ()                |
-     wdiff              |                      []       [] []        []      |
-     wget               |                      []          []                |
-     xchat              |                []    []          [] []     []      |
-     xkeyboard-config   |                                                    |
-     xpad               |                []             []                   |
-                        +----------------------------------------------------+
-                          af am ar az be bg bs ca cs cy da de el en en_GB eo
-                          11  0  1  2  8 21  1 42 43  2 62 99 18  1  16   16
-
-                          es et eu fa fi fr  ga gl gu he hi hr hu id is it
+     Ready PO files       af am an ar as ast az be be@latin bg bn_IN bs ca
                         +--------------------------------------------------+
-     GNUnet             |                                                  |
-     a2ps               |    []       [] []                             () |
+     a2ps               |                       []                      [] |
      aegis              |                                                  |
-     ant-phone          |                []                                |
-     anubis             |                []                                |
-     ap-utils           |             [] []                                |
-     aspell             |                []  []                         [] |
-     bash               | []             []                    []          |
-     batchelor          |                []  []                            |
-     bfd                | []                                               |
-     bibshelf           | []                 []                         [] |
-     binutils           | []          [] []                                |
-     bison              | [] []          []  []                   []    [] |
-     bison-runtime      |    []          []  []                   []    [] |
-     bluez-pin          |             [] []  []                [] []       |
-     cflow              |                                                  |
-     clisp              | []             []                                |
-     console-tools      |                                                  |
-     coreutils          | [] []       [] []  []                []          |
-     cpio               | []             []  []                            |
-     cpplib             | []             []                                |
-     cryptonit          |                []                                |
-     darkstat           | []             ()  []                [] []       |
-     dialog             | [] [] []    [] []  []                []       [] |
-     diffutils          | []          [] []  [] []    []       [] []    [] |
-     doodle             |                    []                         [] |
-     e2fsprogs          | []             []                             [] |
-     enscript           |                []  []             []             |
-     error              | []          [] []  []                []          |
-     fetchmail          | []                                               |
-     fileutils          | [] []          []  []                []       [] |
-     findutils          |    []          []  []                []          |
-     flex               | []             []  []                            |
-     fslint             |                []                                |
-     gas                | []             []                                |
-     gawk               | []             []  []       []                   |
-     gbiff              |                []                                |
-     gcal               | []             []                                |
-     gcc                | []                                               |
-     gettext-examples   | []             []  []                []       [] |
-     gettext-runtime    | []          [] []  []                   []    [] |
-     gettext-tools      | []             []                             [] |
-     gimp-print         | []             []                                |
-     gip                | []    []       []                                |
-     gliv               |                ()                                |
-     glunarclock        |             []     []                []          |
-     gmult              |       []       []                             [] |
-     gnubiff            |                ()                             () |
-     gnucash            | ()             ()                    ()          |
-     gnucash-glossary   | []                                            [] |
-     gnuedu             | []                                               |
-     gnulib             | [] [] []    [] []  [] []             []          |
-     gnunet-gtk         |                                                  |
-     gnutls             |                                                  |
-     gpe-aerial         | []             []                                |
-     gpe-beam           | []             []                                |
-     gpe-calendar       | []             []                    [] []       |
-     gpe-clock          | []          [] []                    []          |
-     gpe-conf           |                []                                |
-     gpe-contacts       | []             []                                |
-     gpe-edit           | []             []                    [] []       |
-     gpe-filemanager    | []                                               |
-     gpe-go             | []             []                    []          |
-     gpe-login          | []             []                    []          |
-     gpe-ownerinfo      | []          [] []                    [] []       |
-     gpe-package        | []                                               |
-     gpe-sketchbook     | []             []                                |
-     gpe-su             | []          [] []                    []          |
-     gpe-taskmanager    | []          [] []                                |
-     gpe-timesheet      | []             []  []                   []       |
-     gpe-today          | []          [] []  []                            |
-     gpe-todo           | []                                               |
-     gphoto2            | []          [] []                    []       [] |
-     gprof              | []             []  []                   []       |
-     gpsdrive           | ()             ()                    []       () |
-     gramadoir          |                []  []                            |
-     grep               | [] [] []    [] []  [] []    []    [] [] []    [] |
-     gretl              | []             []                             [] |
-     gsasl              |                    []                            |
-     gss                |                []                                |
-     gst-plugins        |                []                    []       [] |
-     gst-plugins-base   |                                      []       [] |
-     gst-plugins-good   |       []                             []       [] |
-     gstreamer          |             []                       []       [] |
-     gtick              |       []    [] []  []                         [] |
-     gtkam              | []             []                    []       [] |
-     gtkorphan          |                []                             [] |
-     gtkspell           | []    []    [] []  []                         [] |
-     gutenprint         |                                      []          |
-     hello              | [] [] [] [] [] []  [] []    []    [] [] []    [] |
-     id-utils           |                []  []                [] []    [] |
-     impost             |                []  []                            |
-     indent             | [] [] []    [] []  [] []             [] []    [] |
-     iso_3166           |             [] []                    []          |
-     iso_3166_1         | []    []    [] []  []                [] []       |
-     iso_3166_2         |                []                                |
-     iso_3166_3         |                []                                |
-     iso_4217           |    []       []        []             []          |
-     iso_639            |          [] [] []  []                []          |
-     jpilot             | []             []                                |
-     jtag               |                []                                |
-     jwhois             | []             []                    [] []    [] |
-     kbd                | []             []                                |
-     keytouch           |                    []                            |
-     keytouch-editor    |                    []                            |
-     keytouch-keyboa... |                    []                            |
-     latrine            |                []  []                         [] |
-     ld                 | []             []                                |
-     leafpad            | []             []  []       []       []       [] |
-     libc               | []          [] []     []             []          |
-     libexif            | []                                               |
-     libextractor       |                    []                            |
-     libgpewidget       | []             []  []                [] []       |
-     libgpg-error       |                                                  |
-     libgphoto2         | []             []                             [] |
-     libgphoto2_port    |                []                             [] |
-     libgsasl           |                []  []                            |
-     libiconv           |                    []                            |
-     libidn             |                []                             [] |
-     lifelines          |                ()                                |
-     lilypond           |                []                                |
-     lingoteach         |                []                       []    [] |
-     lynx               |    []                                []       [] |
-     m4                 |                []  [] []                []       |
-     mailutils          | []             []                                |
-     make               | []          [] []  [] []    []    []    []       |
-     man-db             | ()                                               |
-     minicom            | []          [] []                    []          |
-     mysecretdiary      | []             []                       []       |
-     nano               |       []    () []  []                []       [] |
-     nano_1_0           | []             []     []                []    [] |
-     opcodes            | []          [] []  []                            |
-     parted             | []             []                       []    [] |
-     pilot-qof          |                                                  |
-     psmisc             |       []                             []       [] |
-     pwdutils           |                                                  |
-     python             |                                                  |
-     qof                |                                                  |
-     radius             | []             []                                |
-     recode             | []             []  [] []    []       [] []    [] |
-     rpm                |                []                       []       |
-     screem             |                                                  |
-     scrollkeeper       | []          []                       []          |
-     sed                | [] []          []  []                []          |
-     sh-utils           | [] []       [] []  []                []       [] |
-     shared-mime-info   | []    []    [] []                    []       [] |
-     sharutils          | [] []       [] []  [] []             []       [] |
-     shishi             |                                                  |
-     silky              |                []                                |
-     skencil            | []             []                                |
-     sketch             | []             []                                |
-     solfege            |                                               [] |
-     soundtracker       | []             []                             [] |
-     sp                 |                []                                |
-     stardict           |                                      []          |
-     system-tools-ba... | []    []    [] []                 [] [] []    [] |
-     tar                | [] []          []  []                []       [] |
-     texinfo            |                []           []                   |
-     textutils          | []             []  [] []             []          |
-     tin                |    []          ()                                |
-     tp-robot           |             [] []  []                []          |
-     tuxpaint           |                    []                []          |
-     unicode-han-tra... |                                                  |
-     unicode-transla... |                []  []                            |
-     util-linux         | [] []       [] []                    [] []    [] |
-     vorbis-tools       | []             []                                |
-     wastesedge         |                ()                                |
-     wdiff              | [] []          []  [] []             [] []    [] |
-     wget               |    []       [] []  []             [] [] []    [] |
-     xchat              | []    []    [] []        []    []    []       [] |
-     xkeyboard-config   |             [] []                    []       [] |
-     xpad               | []                 []                []          |
-                        +--------------------------------------------------+
-                          es et eu fa fi fr  ga gl gu he hi hr hu id is it
-                          89 21 16  2 41 119 61 14  1  8  1  6 61 30  0 53
-
-                          ja ko ku ky lg lt lv mk mn ms mt nb ne nl  nn no
-                        +--------------------------------------------------+
-     GNUnet             |                                                  |
-     a2ps               |    ()                      []          []     () |
-     aegis              |                                        ()        |
-     ant-phone          |                                        []        |
-     anubis             |                            []    []    []        |
-     ap-utils           |                            []                    |
-     aspell             |                         []             []        |
-     bash               |                                        []        |
-     batchelor          |                            []          []        |
+     ant-phone          |                                                  |
+     anubis             |                                                  |
+     aspell             |                []                             [] |
+     bash               |                                                  |
      bfd                |                                                  |
-     bibshelf           |                            []                    |
+     bibshelf           |                []                                |
      binutils           |                                                  |
-     bison              |                            []    []    []        |
-     bison-runtime      |                            []    []    []        |
-     bluez-pin          |       []                   []          []        |
+     bison              |                                                  |
+     bison-runtime      |                []                                |
+     bluez-pin          | []             []                                |
+     bombono-dvd        |                                                  |
+     buzztard           |                                                  |
      cflow              |                                                  |
-     clisp              |                                        []        |
-     console-tools      |                                                  |
-     coreutils          |                                        []        |
+     clisp              |                                                  |
+     coreutils          |                                   []          [] |
      cpio               |                                                  |
-     cpplib             |                                        []        |
-     cryptonit          |                                        []        |
-     darkstat           |                            []          []        |
-     dialog             |                            []          []        |
-     diffutils          | []                         []          []        |
+     cppi               |                                                  |
+     cpplib             |                                               [] |
+     cryptsetup         |                                                  |
+     dfarc              |                                                  |
+     dialog             |                             []                [] |
+     dico               |                                                  |
+     diffutils          |                                               [] |
+     dink               |                                                  |
      doodle             |                                                  |
-     e2fsprogs          |                                        []        |
-     enscript           |                                        []        |
-     error              |                                        []        |
-     fetchmail          | []                                     []        |
-     fileutils          | []          []                                   |
-     findutils          |                                        []        |
-     flex               |    []                                  []        |
-     fslint             |                            []          []        |
+     e2fsprogs          |                                               [] |
+     enscript           |                                               [] |
+     exif               |                                                  |
+     fetchmail          |                                               [] |
+     findutils          |                                   []             |
+     flex               |                                               [] |
+     freedink           |                                                  |
      gas                |                                                  |
-     gawk               | []                                     []        |
-     gbiff              |                                        []        |
-     gcal               |                                                  |
+     gawk               |                []                             [] |
+     gcal               |                                               [] |
      gcc                |                                                  |
-     gettext-examples   | []                                     []        |
-     gettext-runtime    | [] []                                  []        |
-     gettext-tools      | [] []                                            |
-     gimp-print         | []                                     []        |
-     gip                |                            []          []        |
-     gliv               |                                        []        |
-     glunarclock        |                            []          []        |
-     gmult              | []                         []                    |
+     gettext-examples   | []             []                 []          [] |
+     gettext-runtime    |                                   []          [] |
+     gettext-tools      |                                   []          [] |
+     gip                |                                   []             |
+     gjay               |                                                  |
+     gliv               |                                   []             |
+     glunarclock        |                []                 []             |
      gnubiff            |                                                  |
-     gnucash            | ()                               ()              |
-     gnucash-glossary   |                                        []        |
+     gnucash            |                                               [] |
      gnuedu             |                                                  |
-     gnulib             | [] []                      []          []        |
+     gnulib             |                                                  |
+     gnunet             |                                                  |
      gnunet-gtk         |                                                  |
      gnutls             |                                                  |
-     gpe-aerial         |                                        []        |
-     gpe-beam           |                                        []        |
-     gpe-calendar       |                                        []        |
-     gpe-clock          |    []                                  []        |
-     gpe-conf           |    []                                  []        |
-     gpe-contacts       |    []                                            |
-     gpe-edit           |    []                                  []        |
-     gpe-filemanager    |    []                                            |
-     gpe-go             |    []                                  []        |
-     gpe-login          |    []                                  []        |
-     gpe-ownerinfo      |                                        []        |
-     gpe-package        |    []                                            |
-     gpe-sketchbook     |    []                                  []        |
-     gpe-su             |    []                                  []        |
-     gpe-taskmanager    |    [] []                               []        |
-     gpe-timesheet      |                                        []        |
-     gpe-today          |                                        []        |
+     gold               |                                                  |
+     gpe-aerial         |                                                  |
+     gpe-beam           |                                                  |
+     gpe-bluetooth      |                                                  |
+     gpe-calendar       |                                                  |
+     gpe-clock          |                []                                |
+     gpe-conf           |                                                  |
+     gpe-contacts       |                                                  |
+     gpe-edit           |                                                  |
+     gpe-filemanager    |                                                  |
+     gpe-go             |                                                  |
+     gpe-login          |                                                  |
+     gpe-ownerinfo      |                []                                |
+     gpe-package        |                                                  |
+     gpe-sketchbook     |                                                  |
+     gpe-su             |                []                                |
+     gpe-taskmanager    |                []                                |
+     gpe-timesheet      |                []                                |
+     gpe-today          |                []                                |
      gpe-todo           |                                                  |
-     gphoto2            | []                                     []        |
-     gprof              |                                                  |
-     gpsdrive           | ()                                     ()     () |
-     gramadoir          |                                        ()        |
-     grep               | []                               []    []        |
-     gretl              |                                                  |
-     gsasl              |                                        []        |
+     gphoto2            |                                                  |
+     gprof              |                                   []             |
+     gpsdrive           |                                                  |
+     gramadoir          |                                                  |
+     grep               |                                                  |
+     grub               |                []                             [] |
+     gsasl              |                                                  |
      gss                |                                                  |
-     gst-plugins        |                                        []        |
-     gst-plugins-base   |                                                  |
-     gst-plugins-good   |                                        []        |
-     gstreamer          |                                        []        |
-     gtick              |                                        []        |
-     gtkam              | []                                               |
-     gtkorphan          |                                        []        |
-     gtkspell           |                         []             []        |
+     gst-plugins-bad    |                                   []             |
+     gst-plugins-base   |                                   []             |
+     gst-plugins-good   |                                   []             |
+     gst-plugins-ugly   |                                   []             |
+     gstreamer          | []                                []          [] |
+     gtick              |                                                  |
+     gtkam              |                       []                         |
+     gtkorphan          |                                   []             |
+     gtkspell           | []             []     []                         |
      gutenprint         |                                                  |
-     hello              | [] []             []       []    []    []  [] [] |
-     id-utils           |                                        []        |
-     impost             |                                                  |
-     indent             | []                                     []        |
-     iso_3166           |                                        []        |
-     iso_3166_1         |                                        []     [] |
-     iso_3166_2         |                                        []        |
-     iso_3166_3         |                                        []        |
-     iso_4217           | []                      []             []        |
-     iso_639            | []                                     []        |
-     jpilot             | ()                                     ()     () |
-     jtag               |                                                  |
-     jwhois             |                                        []        |
-     kbd                |                                        []        |
-     keytouch           |                                        []        |
+     hello              |                                   []             |
+     help2man           |                                                  |
+     hylafax            |                                                  |
+     idutils            |                                                  |
+     indent             |                                   []          [] |
+     iso_15924          |                                                  |
+     iso_3166           | []          []        []          []  []   [] [] |
+     iso_3166_2         |                                                  |
+     iso_4217           |                                                  |
+     iso_639            |             [] []     []              []         |
+     iso_639_3          |                                                  |
+     jwhois             |                                                  |
+     kbd                |                                                  |
+     keytouch           |                                               [] |
      keytouch-editor    |                                                  |
-     keytouch-keyboa... |                                                  |
-     latrine            |                                        []        |
-     ld                 |                                                  |
-     leafpad            | []             []                                |
-     libc               | [] []                            []    []     [] |
-     libexif            |                                                  |
+     keytouch-keyboa... |                                               [] |
+     klavaro            |          []                                      |
+     latrine            |                                                  |
+     ld                 |                                   []             |
+     leafpad            |                                   []          [] |
+     libc               |                                   []          [] |
+     libexif            |                       ()                         |
      libextractor       |                                                  |
-     libgpewidget       |                                        []        |
+     libgnutls          |                                                  |
+     libgpewidget       |                                                  |
      libgpg-error       |                                                  |
-     libgphoto2         | []                                               |
-     libgphoto2_port    | []                                               |
-     libgsasl           |                                        []        |
-     libiconv           |                                                  |
-     libidn             | []                                     []        |
-     lifelines          |                                        []        |
+     libgphoto2         |                                                  |
+     libgphoto2_port    |                                                  |
+     libgsasl           |                                                  |
+     libiconv           |                                   []             |
+     libidn             |                                                  |
+     lifelines          |                                                  |
+     liferea            |                             []                [] |
      lilypond           |                                                  |
-     lingoteach         |                                        []        |
-     lynx               | []                                     []        |
-     m4                 | []                                     []        |
+     linkdr             |          []                                      |
+     lordsawar          |                                                  |
+     lprng              |                                                  |
+     lynx               |                                               [] |
+     m4                 |                                                  |
+     mailfromd          |                                                  |
      mailutils          |                                                  |
-     make               | [] []                                  []        |
-     man-db             | ()                                               |
-     minicom            | []                                               |
-     mysecretdiary      |                                        []        |
-     nano               |                            []    []    []        |
-     nano_1_0           |                            []    []        []    |
-     opcodes            |                                        []        |
-     parted             | []                                     []        |
-     pilot-qof          |                                                  |
-     psmisc             | []                               []    []        |
+     make               |                                                  |
+     man-db             |                                                  |
+     man-db-manpages    |                                                  |
+     minicom            |                                                  |
+     mkisofs            |                                                  |
+     myserver           |                                                  |
+     nano               |                                   []          [] |
+     opcodes            |                                                  |
+     parted             |                                                  |
+     pies               |                                                  |
+     popt               |                                                  |
+     psmisc             |                                                  |
+     pspp               |                                               [] |
      pwdutils           |                                                  |
-     python             |                                                  |
-     qof                |                                                  |
-     radius             |                                                  |
-     recode             |                                        []        |
-     rpm                | [] []                                            |
-     screem             | []                                               |
-     scrollkeeper       |                                  [] [] []  []    |
-     sed                | []                                     []        |
-     sh-utils           | []                               []              |
-     shared-mime-info   |    []          []                []    []  []    |
-     sharutils          | []                                     []        |
+     radius             |                                               [] |
+     recode             |                       []                      [] |
+     rosegarden         |                                                  |
+     rpm                |                                                  |
+     rush               |                                                  |
+     sarg               |                                                  |
+     screem             |                                                  |
+     scrollkeeper       |                    [] []                      [] |
+     sed                |                []                             [] |
+     sharutils          |                                   []          [] |
      shishi             |                                                  |
-     silky              |                                        []        |
      skencil            |                                                  |
-     sketch             |                                                  |
      solfege            |                                                  |
+     solfege-manual     |                                                  |
      soundtracker       |                                                  |
-     sp                 | ()                                               |
-     stardict           |                      []                []        |
-     system-tools-ba... | [] []          []                      []        |
-     tar                | []       []                            []        |
-     texinfo            | []                               []    []        |
-     textutils          | [] []                            []              |
+     sp                 |                                                  |
+     sysstat            |                                                  |
+     tar                |                                   []             |
+     texinfo            |                                                  |
      tin                |                                                  |
-     tp-robot           |                                        []        |
-     tuxpaint           |                                            []    |
      unicode-han-tra... |                                                  |
      unicode-transla... |                                                  |
-     util-linux         | []                                     []        |
-     vorbis-tools       |                                        []        |
-     wastesedge         |                                        []        |
-     wdiff              |                            []    []              |
-     wget               | []                                     []        |
-     xchat              | [] []                []                []        |
-     xkeyboard-config   |                                        []        |
-     xpad               |    []                      []          []        |
+     util-linux-ng      |                                               [] |
+     vice               |                                                  |
+     vmm                |                                                  |
+     vorbis-tools       |                                                  |
+     wastesedge         |                                                  |
+     wdiff              |                                                  |
+     wget               |                       []                      [] |
+     wyslij-po          |                                                  |
+     xchat              |                []     []          []          [] |
+     xdg-user-dirs      | []    []    [] []     []    []    []  []      [] |
+     xkeyboard-config   |                                   []          [] |
                         +--------------------------------------------------+
-                          ja ko ku ky lg lt lv mk mn ms mt nb ne nl  nn no
-                          40 24  2  1  1  3  1  2  3 21  0 15  1 101  5  3
+                          af am an ar as ast az be be@latin bg bn_IN bs ca
+                           6  0  1  2  3 19   1 10     3    28   3    1 38
 
-                          nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv  ta
-                        +------------------------------------------------------+
-     GNUnet             |                                                      |
-     a2ps               |           ()     []      [] []       []    [] []     |
-     aegis              |                          () ()                       |
-     ant-phone          |                          []                   []     |
-     anubis             |           []             [] []                       |
-     ap-utils           |           ()                                         |
-     aspell             |                          [] []                       |
-     bash               |                  []      [] []                       |
-     batchelor          |                          []                   []     |
-     bfd                |                                                      |
-     bibshelf           |                                               []     |
-     binutils           |                             []                []     |
-     bison              |           []     []      [] []                []     |
-     bison-runtime      |           []             []          []       []     |
-     bluez-pin          |           []     []   [] [] []    [] []    [] []     |
-     cflow              |           []                                         |
-     clisp              |                             []                       |
-     console-tools      |                             []                       |
-     coreutils          |           []                []       []       []     |
-     cpio               |           []                []                []     |
-     cpplib             |                                               []     |
-     cryptonit          |                  []                           []     |
-     darkstat           |           []     []      []       []       [] []     |
-     dialog             |           [] []  []   [] [] [] []          [] []     |
-     diffutils          |           []     []      [] []             [] []     |
-     doodle             |                                         []    []     |
-     e2fsprogs          |           []                                  []     |
-     enscript           |                  []      [] []       []       []     |
-     error              |                  []      []       []          []     |
-     fetchmail          |           []                []          []           |
-     fileutils          |           []             [] []       []       []     |
-     findutils          |           [] []          []       [] []       []     |
-     flex               |           []     []      [] []                []     |
-     fslint             |                  []      []                [] []     |
-     gas                |                                                      |
-     gawk               |           []     []      []                   []     |
-     gbiff              |                          []                          |
-     gcal               |                                               []     |
-     gcc                |                                               []     |
-     gettext-examples   |           [] []          [] []    [] []    [] []     |
-     gettext-runtime    |           [] []          [] []    [] []    [] []     |
-     gettext-tools      |           []             [] []    [] []    [] []     |
-     gimp-print         |                                   []          []     |
-     gip                |                       []          []       [] []     |
-     gliv               |                  []      []       []          []     |
-     glunarclock        |                  []      [] []    []       [] []     |
-     gmult              |                       [] []                [] []     |
-     gnubiff            |                          ()                          |
-     gnucash            |           ()                                  []     |
-     gnucash-glossary   |              []                   []          []     |
-     gnuedu             |                                                      |
-     gnulib             |           []             [] []       []       []     |
-     gnunet-gtk         |                                               []     |
-     gnutls             |           []                                  []     |
-     gpe-aerial         |              []  []      [] []       []    [] []     |
-     gpe-beam           |              []  []      [] []       []    [] []     |
-     gpe-calendar       |              []  []      [] []    [] []    [] []     |
-     gpe-clock          |              []  []      [] []    [] []    [] []     |
-     gpe-conf           |              []  []      [] []    [] []       []     |
-     gpe-contacts       |                          [] []       []    [] []     |
-     gpe-edit           |              []  []      [] []    [] []    [] []     |
-     gpe-filemanager    |                                      []       []     |
-     gpe-go             |                  []      [] []       []    [] []     |
-     gpe-login          |              []  []      [] []    [] []    [] []     |
-     gpe-ownerinfo      |              []  []      [] []    [] []    [] []     |
-     gpe-package        |                                      []       []     |
-     gpe-sketchbook     |              []  []      [] []    [] []    [] []     |
-     gpe-su             |              []  []      [] []    [] []    [] []     |
-     gpe-taskmanager    |              []  []      [] []    [] []    [] []     |
-     gpe-timesheet      |              []  []      [] []    [] []    [] []     |
-     gpe-today          |              []  []      [] []    [] []    [] []     |
-     gpe-todo           |                             []       []    [] []     |
-     gphoto2            |           []             []       []       [] []     |
-     gprof              |                  []      []                   []     |
-     gpsdrive           |        []                []                   []     |
-     gramadoir          |                                   []          []     |
-     grep               |           [] []  []      [] []       []    [] []     |
-     gretl              |           []                                         |
-     gsasl              |           []                                  []     |
-     gss                |           []             []                   []     |
-     gst-plugins        |     []                                  [] [] []     |
-     gst-plugins-base   |                                               []     |
-     gst-plugins-good   |     []                                  [] [] []     |
-     gstreamer          |                                         [] [] []     |
-     gtick              |                          [] []                []     |
-     gtkam              |           []     []         []                []     |
-     gtkorphan          |                                               []     |
-     gtkspell           |                  []   [] [] []    [] []    [] []     |
-     gutenprint         |                                               []     |
-     hello              |           []     []      [] []    [] []    [] []     |
-     id-utils           |                  []      [] []                []     |
-     impost             |                                               []     |
-     indent             |                  []      [] []    []       [] []     |
-     iso_3166           |              []                []    [] [] [] []     |
-     iso_3166_1         |                                   [] [] [] []        |
-     iso_3166_2         |                                                      |
-     iso_3166_3         |                          []    []    []    []        |
-     iso_4217           |                                []    []    [] []     |
-     iso_639            |                                []    []    [] []     |
-     jpilot             |                                                      |
-     jtag               |                                   []                 |
-     jwhois             |           []     []      []                   []     |
-     kbd                |           []             []                   []     |
-     keytouch           |                                               []     |
-     keytouch-editor    |                                               []     |
-     keytouch-keyboa... |                                               []     |
-     latrine            |                          []                   []     |
-     ld                 |                                               []     |
-     leafpad            |           [] []             []    []          []  [] |
-     libc               |           []     []         []    []          []     |
-     libexif            |           []                                         |
-     libextractor       |                          []                   []     |
-     libgpewidget       |              []  []      []       [] []    [] []     |
-     libgpg-error       |           []             []                          |
-     libgphoto2         |           []                                         |
-     libgphoto2_port    |           []                []                []     |
-     libgsasl           |           []             []                [] []     |
-     libiconv           |                                                      |
-     libidn             |           []                               [] ()     |
-     lifelines          |           []                                  []     |
-     lilypond           |                                                      |
-     lingoteach         |                  []                                  |
-     lynx               |                  []         []                []     |
-     m4                 |           []     []      [] []                []     |
-     mailutils          |           []             [] []                []     |
-     make               |           []     []         []                []     |
-     man-db             |                          []                   []     |
-     minicom            |           []     []      [] []                []     |
-     mysecretdiary      |                  []      [] []                []     |
-     nano               |                          []                   []     |
-     nano_1_0           |           []             [] []                []     |
-     opcodes            |                          []                   []     |
-     parted             |           []                                         |
-     pilot-qof          |                                               []     |
-     psmisc             |           []                                  []     |
-     pwdutils           |           []                                  []     |
-     python             |                                                      |
-     qof                |                                               []     |
-     radius             |           []                []                       |
-     recode             |           [] []  []      [] []       []       []     |
-     rpm                |           [] []             []                []     |
-     screem             |                                                      |
-     scrollkeeper       |           []             [] []    []    [] [] []     |
-     sed                |           [] []  []      [] []    [] []    [] []     |
-     sh-utils           |                             []       []    []        |
-     shared-mime-info   |              []  []                     [] [] []     |
-     sharutils          |           []                []             [] []     |
-     shishi             |           []                                         |
-     silky              |                                   []                 |
-     skencil            |              []  []                           []     |
-     sketch             |              []  []                           []     |
-     solfege            |                                               []     |
-     soundtracker       |                                   []          []     |
-     sp                 |                                                      |
-     stardict           |                             []    []          []     |
-     system-tools-ba... |        [] [] []  []      []             [] [] []  [] |
-     tar                |           []             [] []       []       []     |
-     texinfo            |           []             [] []                []     |
-     textutils          |                             []       []       []     |
-     tin                |                             ()                       |
-     tp-robot           |                             []                       |
-     tuxpaint           |              []                      [] [] [] []     |
-     unicode-han-tra... |                                                      |
-     unicode-transla... |                                                      |
-     util-linux         |                  []         []       []       []     |
-     vorbis-tools       |                          [] []                       |
-     wastesedge         |                                                      |
-     wdiff              |           []     []      [] []    []          []     |
-     wget               |              []             []    []          []     |
-     xchat              |        []                   []    [] [] [] [] []     |
-     xkeyboard-config   |                                      []       []     |
-     xpad               |                                   [] []       []     |
-                        +------------------------------------------------------+
-                          nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv  ta
-                           0   2  3 58 31  53    5 76 72  5 42 48 12 51 130  2
+                          crh cs da  de  el en en_GB en_ZA eo es et eu fa
+                        +-------------------------------------------------+
+     a2ps               |     [] []  []  []     []            [] []       |
+     aegis              |        []  []                       []          |
+     ant-phone          |        []  ()                                   |
+     anubis             |        []  []                                   |
+     aspell             |     [] []  []         []            []          |
+     bash               |     []                           [] []          |
+     bfd                |                                     []          |
+     bibshelf           |        []  []                       []          |
+     binutils           |                                     []          |
+     bison              |            []  []                               |
+     bison-runtime      |        []  []  []                      []       |
+     bluez-pin          |     [] []  []  []                [] []          |
+     bombono-dvd        |        []                                       |
+     buzztard           |     [] []  []                                   |
+     cflow              |        []  []                                   |
+     clisp              |        []  []     []                []          |
+     coreutils          |     [] []  []                          []       |
+     cpio               |                                                 |
+     cppi               |                                                 |
+     cpplib             |        []  []                       []          |
+     cryptsetup         |            []                                   |
+     dfarc              |        []  []                       []          |
+     dialog             |        []  []                    [] []    []    |
+     dico               |                                                 |
+     diffutils          |     [] []  []  []                [] []          |
+     dink               |        []  []                       []          |
+     doodle             |            []                                   |
+     e2fsprogs          |     []     []                       []          |
+     enscript           |        []  []         []                        |
+     exif               |     () []  []                                   |
+     fetchmail          |     [] []  ()  []     []            []          |
+     findutils          |     [] []  []                                   |
+     flex               |            []                       []          |
+     freedink           |        []  []                       []          |
+     gas                |                                     []          |
+     gawk               |        []  []                       []          |
+     gcal               |                                     []          |
+     gcc                |            []                       []          |
+     gettext-examples   |            []  []                [] []          |
+     gettext-runtime    |        []  []                    [] []          |
+     gettext-tools      |            []                       []    []    |
+     gip                |        []  []                       []    []    |
+     gjay               |            []                                   |
+     gliv               |     [] []  []                                   |
+     glunarclock        |        []  []                                   |
+     gnubiff            |            ()                                   |
+     gnucash            |     []     ()  ()     ()            ()          |
+     gnuedu             |        []                           []          |
+     gnulib             |            []                       []          |
+     gnunet             |                                                 |
+     gnunet-gtk         |        []                                       |
+     gnutls             |     []     []                                   |
+     gold               |                                     []          |
+     gpe-aerial         |     [] []  []                       []          |
+     gpe-beam           |     [] []  []                       []          |
+     gpe-bluetooth      |        []  []                                   |
+     gpe-calendar       |        []                                       |
+     gpe-clock          |     [] []  []                       []          |
+     gpe-conf           |     [] []  []                                   |
+     gpe-contacts       |        []  []                       []          |
+     gpe-edit           |        []  []                                   |
+     gpe-filemanager    |        []  []                       []          |
+     gpe-go             |     [] []  []                       []          |
+     gpe-login          |        []  []                                   |
+     gpe-ownerinfo      |     [] []  []                       []          |
+     gpe-package        |        []  []                       []          |
+     gpe-sketchbook     |     [] []  []                       []          |
+     gpe-su             |     [] []  []                       []          |
+     gpe-taskmanager    |     [] []  []                       []          |
+     gpe-timesheet      |     [] []  []                       []          |
+     gpe-today          |     [] []  []                       []          |
+     gpe-todo           |        []  []                       []          |
+     gphoto2            |     [] []  ()         []            []    []    |
+     gprof              |        []  []                       []          |
+     gpsdrive           |        []                           [] []       |
+     gramadoir          |        []  []                    []             |
+     grep               |     []                                          |
+     grub               |        []  []                                   |
+     gsasl              |            []                                   |
+     gss                |                                                 |
+     gst-plugins-bad    |     [] []  []                       []    []    |
+     gst-plugins-base   |     [] []  []                       []    []    |
+     gst-plugins-good   |     [] []  []  []                   []    []    |
+     gst-plugins-ugly   |     [] []  []  []                   []    []    |
+     gstreamer          |     [] []  []                       []    []    |
+     gtick              |        []  ()                    []             |
+     gtkam              |     [] []  ()                    [] []          |
+     gtkorphan          |     [] []  []                    []             |
+     gtkspell           |     [] []  []  []                [] []    []    |
+     gutenprint         |        []  []         []                        |
+     hello              |        []  []                    [] []          |
+     help2man           |            []                                   |
+     hylafax            |            []                       []          |
+     idutils            |        []  []                                   |
+     indent             |     [] []  []                    [] [] [] []    |
+     iso_15924          |        []      ()                [] []          |
+     iso_3166           | []  [] []  []  ()                [] [] [] ()    |
+     iso_3166_2         |                ()                               |
+     iso_4217           |     [] []  []  ()                   [] []       |
+     iso_639            | []  [] []  []  ()                [] []          |
+     iso_639_3          | []                                              |
+     jwhois             |                                     []          |
+     kbd                |     [] []  []  []                   []          |
+     keytouch           |        []  []                                   |
+     keytouch-editor    |        []  []                                   |
+     keytouch-keyboa... |        []                                       |
+     klavaro            |     [] []  []                    []             |
+     latrine            |        []  ()                                   |
+     ld                 |        []                           []          |
+     leafpad            |     [] []  []  []                   []    []    |
+     libc               |     [] []  []                       []          |
+     libexif            |        []  []         ()                        |
+     libextractor       |                                                 |
+     libgnutls          |     []                                          |
+     libgpewidget       |        []  []                                   |
+     libgpg-error       |     []     []                                   |
+     libgphoto2         |        []  ()                                   |
+     libgphoto2_port    |        []  ()                             []    |
+     libgsasl           |                                                 |
+     libiconv           |     [] []  []                    []    []       |
+     libidn             |     []     []                    []             |
+     lifelines          |        []  ()                                   |
+     liferea            |     []     []  []                   []    []    |
+     lilypond           |     []     []                       []          |
+     linkdr             |        []  []                       []          |
+     lordsawar          |        []                                       |
+     lprng              |                                                 |
+     lynx               |     [] []  []                          []       |
+     m4                 |     [] []  []  []                               |
+     mailfromd          |                                                 |
+     mailutils          |                                     []          |
+     make               |        []  []                       []          |
+     man-db             |                                                 |
+     man-db-manpages    |                                                 |
+     minicom            |     [] []  []                       []          |
+     mkisofs            |                                                 |
+     myserver           |                                                 |
+     nano               |            []                       []    []    |
+     opcodes            |            []                       []          |
+     parted             |     []     []                                   |
+     pies               |                                                 |
+     popt               |     [] []  []                    [] []          |
+     psmisc             |     []     []                             []    |
+     pspp               |                                     []          |
+     pwdutils           |        []                                       |
+     radius             |                                     []          |
+     recode             |     [] []  []  []                [] []          |
+     rosegarden         |     ()     ()                       ()          |
+     rpm                |        []  []                       []          |
+     rush               |                                                 |
+     sarg               |                                                 |
+     screem             |                                                 |
+     scrollkeeper       |     [] []  []         []            []          |
+     sed                |     []     []  []                [] [] []       |
+     sharutils          |        []  []                       [] []       |
+     shishi             |                                                 |
+     skencil            |        []  ()                       []          |
+     solfege            |            []                    []    []       |
+     solfege-manual     |                                  []    []       |
+     soundtracker       |        []  []                       []          |
+     sp                 |            []                                   |
+     sysstat            |        []  []                             []    |
+     tar                |     []     []                          [] []    |
+     texinfo            |            []                    [] []          |
+     tin                |            []                          []       |
+     unicode-han-tra... |                                                 |
+     unicode-transla... |                                                 |
+     util-linux-ng      |     [] []  []                       []          |
+     vice               |        ()  ()                                   |
+     vmm                |            []                                   |
+     vorbis-tools       |     []                           []             |
+     wastesedge         |        []                                       |
+     wdiff              |            []                       []          |
+     wget               |     []     []                          []       |
+     wyslij-po          |                                                 |
+     xchat              |     []     []  []                   [] []       |
+     xdg-user-dirs      | []  [] []  []  []                [] [] [] []    |
+     xkeyboard-config   | []  [] []  []                    [] []          |
+                        +-------------------------------------------------+
+                          crh cs da  de  el en en_GB en_ZA eo es et eu fa
+                           5  64 105 117 18  1   8     0   28 89 18 19  0
+
+                          fi  fr  ga gl gu he hi hr hu hy id  is it ja ka kn
+                        +----------------------------------------------------+
+     a2ps               | []  []                          []        []       |
+     aegis              |     []                                 []          |
+     ant-phone          |     []                                 []          |
+     anubis             | []  []                          []     []          |
+     aspell             |     []  []                      []     []          |
+     bash               | []  []                          []        []       |
+     bfd                | []  []                          []                 |
+     bibshelf           | []  []  []                      []     []          |
+     binutils           | []  []                          []                 |
+     bison              | []  []  []                      []                 |
+     bison-runtime      | []  []  []                      []     [] []       |
+     bluez-pin          | []  []  []                [] [] []  []    []       |
+     bombono-dvd        | []                                                 |
+     buzztard           |                                 []                 |
+     cflow              | []      []                      []                 |
+     clisp              |     []                                             |
+     coreutils          |     []  []                []    []     []          |
+     cpio               | []  []  []                      []                 |
+     cppi               | []  []                                             |
+     cpplib             | []  []                          []                 |
+     cryptsetup         |     []                          []     []          |
+     dfarc              | []  []                                 []          |
+     dialog             |     []  [] []                   []  [] [] []       |
+     dico               |                                                    |
+     diffutils          | []  []  [] []    []       []    []     [] []       |
+     dink               |     []                                             |
+     doodle             |         []                             []          |
+     e2fsprogs          |     []                          []                 |
+     enscript           |     []  []             []       []                 |
+     exif               | []  []                          []  [] [] []       |
+     fetchmail          |     []                          []     [] []       |
+     findutils          | []  []  []                []    []     []          |
+     flex               | []  []  []                                         |
+     freedink           | []  []                          []                 |
+     gas                |     []                          []                 |
+     gawk               |     []  []       []             []     () []       |
+     gcal               |     []                                             |
+     gcc                |                                 []                 |
+     gettext-examples   | []  []  []                []    []     [] []       |
+     gettext-runtime    | []  []  []                      []     [] []       |
+     gettext-tools      |     []                          []     [] []       |
+     gip                | []  []  [] []                   []        []       |
+     gjay               | []                                                 |
+     gliv               | []  ()                                             |
+     glunarclock        | []      []                []    []                 |
+     gnubiff            |     ()                          []     ()          |
+     gnucash            | ()  ()           ()       ()           () []       |
+     gnuedu             |     []                                 []          |
+     gnulib             | []  []  []                []           [] []       |
+     gnunet             |                                                    |
+     gnunet-gtk         |     []                                             |
+     gnutls             |     []                                 []          |
+     gold               | []                              []                 |
+     gpe-aerial         | []  []                          []                 |
+     gpe-beam           | []  []                          []        []       |
+     gpe-bluetooth      | []                              []     [] []       |
+     gpe-calendar       | []                                        []       |
+     gpe-clock          | []  []                    []    []        []       |
+     gpe-conf           | []  []                          []        []       |
+     gpe-contacts       | []  []                          []        []       |
+     gpe-edit           | []                              []        []       |
+     gpe-filemanager    | []                        []    []        []       |
+     gpe-go             | []  []                    []    []        []       |
+     gpe-login          | []                              []        []       |
+     gpe-ownerinfo      | []  []                    []    []        []       |
+     gpe-package        | []                              []        []       |
+     gpe-sketchbook     | []  []                          []        []       |
+     gpe-su             | []  []     []             []    []        []       |
+     gpe-taskmanager    | []  []                    []    []        []       |
+     gpe-timesheet      | []  []  []                      []        []       |
+     gpe-today          | []  []  [] []             []    []        []       |
+     gpe-todo           | []                              []        []       |
+     gphoto2            | []  []                    []    []     [] []       |
+     gprof              | []  []  []                      []                 |
+     gpsdrive           |            []                   []     []          |
+     gramadoir          |     []  []                      []                 |
+     grep               | []                                     []          |
+     grub               | []                        []    []     []          |
+     gsasl              | []  []  []                      []     []          |
+     gss                | []  []  []                      []     []          |
+     gst-plugins-bad    | []  []                    []    []     [] []       |
+     gst-plugins-base   | []  []                    []    []     [] []       |
+     gst-plugins-good   | []  []                    []    []     [] []       |
+     gst-plugins-ugly   | []  []                    []    []     [] []       |
+     gstreamer          | []  []                    []    []     []          |
+     gtick              | []  []  []                      []     []          |
+     gtkam              |     []                    []    []     [] []       |
+     gtkorphan          |     []                          []     []          |
+     gtkspell           | []  []  [] []             [] [] []     [] []       |
+     gutenprint         | []  []                    []           []          |
+     hello              | []      []                      []                 |
+     help2man           | []  []                                             |
+     hylafax            |                                 []                 |
+     idutils            | []  []  []                []    []     []          |
+     indent             | []  []  [] []             []    []     [] []       |
+     iso_15924          | []  ()                          []     []          |
+     iso_3166           | []  ()  [] [] [] [] [] [] []    []     [] []       |
+     iso_3166_2         |     ()                    []    []     []          |
+     iso_4217           | []  ()                    []    []     [] []       |
+     iso_639            | []  ()  []    []          []    []     [] []    [] |
+     iso_639_3          |     ()                                 []       [] |
+     jwhois             | []  []                    []    []     []          |
+     kbd                |     []                          []                 |
+     keytouch           | []  []  []                []    []     []          |
+     keytouch-editor    | []      []                []    []     []          |
+     keytouch-keyboa... | []      []                []    []     []          |
+     klavaro            |            []             []                       |
+     latrine            | []                              []     []          |
+     ld                 | []  []  []                      []                 |
+     leafpad            | []  []  []       []       []    []     [] ()       |
+     libc               | []  []     []                   []        []       |
+     libexif            |                                        []          |
+     libextractor       |                                                    |
+     libgnutls          |     []                                 []          |
+     libgpewidget       | []      []                      []        []       |
+     libgpg-error       |     []                                 []          |
+     libgphoto2         |     []                                 [] []       |
+     libgphoto2_port    |     []                                 [] []       |
+     libgsasl           | []  []  []                      []     []          |
+     libiconv           | []  []  []                      []     [] []       |
+     libidn             | []  []                          []     []          |
+     lifelines          |     ()                                             |
+     liferea            |     []                    []           [] []       |
+     lilypond           | []  []                                             |
+     linkdr             | []               []    [] []           []          |
+     lordsawar          |                                                    |
+     lprng              |                                 []                 |
+     lynx               |     []                    []    []     [] []       |
+     m4                 | []  []  [] []                   []        []       |
+     mailfromd          |                                                    |
+     mailutils          |     []                          []                 |
+     make               | []  []  [] []    []    []       []     [] []       |
+     man-db             |                                 []     []          |
+     man-db-manpages    |                                 []                 |
+     minicom            | []  []                    []    []        []       |
+     mkisofs            | []  []                          []     []          |
+     myserver           |                                                    |
+     nano               | []  []  [] []             []           []          |
+     opcodes            | []  []  []                      []                 |
+     parted             |     []                          []     [] []       |
+     pies               |                                                    |
+     popt               | []  []  [] []             []    []  [] [] []       |
+     psmisc             | []  []                          []                 |
+     pspp               |                                                    |
+     pwdutils           |     []                          []                 |
+     radius             |     []                          []                 |
+     recode             | []  []  [] []    []       []    []     []          |
+     rosegarden         | ()  ()                          ()     () ()       |
+     rpm                |                                 []        []       |
+     rush               |                                                    |
+     sarg               |     []                                             |
+     screem             |                                        [] []       |
+     scrollkeeper       | []                        []    []     []          |
+     sed                | []  []  [] []             []    []     [] []       |
+     sharutils          | []  []  []                []    []     [] []       |
+     shishi             |     []                                             |
+     skencil            |     []                                             |
+     solfege            | []  []     []                          []          |
+     solfege-manual     |     []     []                                      |
+     soundtracker       |     []                                 []          |
+     sp                 |     []                                    ()       |
+     sysstat            | []  []                          []     [] []       |
+     tar                | []  []  []                []    []     [] []       |
+     texinfo            |     []                          []     [] []       |
+     tin                |     []                                             |
+     unicode-han-tra... |                                                    |
+     unicode-transla... |     []  []                                         |
+     util-linux-ng      | []  []                    []    []     [] []       |
+     vice               |     ()                    ()           ()          |
+     vmm                |     []                                             |
+     vorbis-tools       |                                 []                 |
+     wastesedge         |     ()                                 ()          |
+     wdiff              | []                                                 |
+     wget               | []  []  []             [] []    []     [] []       |
+     wyslij-po          | []  []                          []                 |
+     xchat              | []  []        []    []    []    []     [] []    [] |
+     xdg-user-dirs      | []  []  [] [] [] [] []    []    []  [] [] []    [] |
+     xkeyboard-config   | []  []                    []    []     []          |
+                        +----------------------------------------------------+
+                          fi  fr  ga gl gu he hi hr hu hy id  is it ja ka kn
+                          105 121 53 20  4  8  3  5 53  2 120  5 84 67  0  4
+
+                          ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne
+                        +-----------------------------------------------+
+     a2ps               |                               []              |
+     aegis              |                                               |
+     ant-phone          |                                               |
+     anubis             |                               []    []        |
+     aspell             |                         []                    |
+     bash               |                                               |
+     bfd                |                                               |
+     bibshelf           |                []             []              |
+     binutils           |                                               |
+     bison              |                               []              |
+     bison-runtime      |       []    [] []             []    []        |
+     bluez-pin          |    [] []    [] []             []              |
+     bombono-dvd        |                                               |
+     buzztard           |                                               |
+     cflow              |                                               |
+     clisp              |                                               |
+     coreutils          |          []                                   |
+     cpio               |                                               |
+     cppi               |                                               |
+     cpplib             |                                               |
+     cryptsetup         |                                               |
+     dfarc              |                   []                          |
+     dialog             |    []       [] []             []    []        |
+     dico               |                                               |
+     diffutils          |                []             []              |
+     dink               |                                               |
+     doodle             |                                               |
+     e2fsprogs          |                                               |
+     enscript           |                                               |
+     exif               |                []                             |
+     fetchmail          |                                               |
+     findutils          |                                               |
+     flex               |                                               |
+     freedink           |                                     []        |
+     gas                |                                               |
+     gawk               |                                               |
+     gcal               |                                               |
+     gcc                |                                               |
+     gettext-examples   |       []       []             [] []           |
+     gettext-runtime    | []                                            |
+     gettext-tools      | []                                            |
+     gip                |                []             []              |
+     gjay               |                                               |
+     gliv               |                                               |
+     glunarclock        |                []                             |
+     gnubiff            |                                               |
+     gnucash            | ()          ()                      ()     () |
+     gnuedu             |                                               |
+     gnulib             |                                               |
+     gnunet             |                                               |
+     gnunet-gtk         |                                               |
+     gnutls             |                               []              |
+     gold               |                                               |
+     gpe-aerial         |                []                             |
+     gpe-beam           |                []                             |
+     gpe-bluetooth      |                []                []           |
+     gpe-calendar       |                []                             |
+     gpe-clock          | []    []       []             [] []           |
+     gpe-conf           | []             []                             |
+     gpe-contacts       | []             []                             |
+     gpe-edit           |                []                             |
+     gpe-filemanager    | []             []                             |
+     gpe-go             | []             []                []           |
+     gpe-login          |                []                             |
+     gpe-ownerinfo      |                []             []              |
+     gpe-package        | []             []                             |
+     gpe-sketchbook     | []             []                             |
+     gpe-su             | []    []       []             [] [] []        |
+     gpe-taskmanager    | [] [] []       []             [] []           |
+     gpe-timesheet      |                []             []              |
+     gpe-today          |       []       []             [] []           |
+     gpe-todo           |                []                   []        |
+     gphoto2            |                                               |
+     gprof              |                               []              |
+     gpsdrive           |                                               |
+     gramadoir          |                                               |
+     grep               |                                               |
+     grub               |                                               |
+     gsasl              |                                               |
+     gss                |                                               |
+     gst-plugins-bad    |             [] []                [] []        |
+     gst-plugins-base   |             [] []                             |
+     gst-plugins-good   |                []                []           |
+     gst-plugins-ugly   |             [] []             [] [] []        |
+     gstreamer          |                                               |
+     gtick              |                                               |
+     gtkam              |                                     []        |
+     gtkorphan          |                []                      []     |
+     gtkspell           |       []    [] []       []    []    [] []     |
+     gutenprint         |                                               |
+     hello              | []             []             []              |
+     help2man           |                                               |
+     hylafax            |                                               |
+     idutils            |                                               |
+     indent             |                                               |
+     iso_15924          |             [] []                             |
+     iso_3166           | [] []       () [] [] []    []       []        |
+     iso_3166_2         |                                               |
+     iso_4217           |             []                      []        |
+     iso_639            |                      []    []                 |
+     iso_639_3          |                            []                 |
+     jwhois             |                []                             |
+     kbd                |                                               |
+     keytouch           |                []                             |
+     keytouch-editor    |                []                             |
+     keytouch-keyboa... |                []                             |
+     klavaro            |                                     []        |
+     latrine            |                []                             |
+     ld                 |                                               |
+     leafpad            | []          [] []                             |
+     libc               | []                                            |
+     libexif            |                                               |
+     libextractor       |                                               |
+     libgnutls          |                               []              |
+     libgpewidget       |                []             []              |
+     libgpg-error       |                                               |
+     libgphoto2         |                                               |
+     libgphoto2_port    |                                               |
+     libgsasl           |                                               |
+     libiconv           |                                               |
+     libidn             |                                               |
+     lifelines          |                                               |
+     liferea            |                                               |
+     lilypond           |                                               |
+     linkdr             |                                               |
+     lordsawar          |                                               |
+     lprng              |                                               |
+     lynx               |                                               |
+     m4                 |                                               |
+     mailfromd          |                                               |
+     mailutils          |                                               |
+     make               | []                                            |
+     man-db             |                                               |
+     man-db-manpages    |                                               |
+     minicom            |                                     []        |
+     mkisofs            |                                               |
+     myserver           |                                               |
+     nano               |                               []    []        |
+     opcodes            |                                               |
+     parted             |                                               |
+     pies               |                                               |
+     popt               | []             []                   []        |
+     psmisc             |                                               |
+     pspp               |                                               |
+     pwdutils           |                                               |
+     radius             |                                               |
+     recode             |                                               |
+     rosegarden         |                                               |
+     rpm                |                                               |
+     rush               |                                               |
+     sarg               |                                               |
+     screem             |                                               |
+     scrollkeeper       |                                     []     [] |
+     sed                |                                               |
+     sharutils          |                                               |
+     shishi             |                                               |
+     skencil            |                                               |
+     solfege            |                                     []        |
+     solfege-manual     |                                               |
+     soundtracker       |                                               |
+     sp                 |                                               |
+     sysstat            |                []                             |
+     tar                |       []                                      |
+     texinfo            |                                     []        |
+     tin                |                                               |
+     unicode-han-tra... |                                               |
+     unicode-transla... |                                               |
+     util-linux-ng      |                                               |
+     vice               |                                               |
+     vmm                |                                               |
+     vorbis-tools       |                                               |
+     wastesedge         |                                               |
+     wdiff              |                                               |
+     wget               |             []                                |
+     wyslij-po          |                                               |
+     xchat              | []             [] []                          |
+     xdg-user-dirs      | [] []       [] [] []       []       [] []     |
+     xkeyboard-config   | []    []    []                                |
+                        +-----------------------------------------------+
+                          ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne
+                          20  5 10  1 13 48  4  2  2  4 24 10 20  3   1
+
+                          nl  nn or pa pl  ps pt pt_BR ro ru rw sk sl sq sr
+                        +---------------------------------------------------+
+     a2ps               | []           []     []  []   [] []       []    [] |
+     aegis              | []                      []      []                |
+     ant-phone          |                         []   []                   |
+     anubis             | []           []                 []                |
+     aspell             | []                           [] []    [] []       |
+     bash               | []                                    []          |
+     bfd                |                                 []                |
+     bibshelf           | []  []                                            |
+     binutils           |                                 []    []          |
+     bison              | []           []                 []                |
+     bison-runtime      | []           []     []  []   [] []       []       |
+     bluez-pin          | []           []         []   [] []    [] []    [] |
+     bombono-dvd        |     []                          ()                |
+     buzztard           | []  []                                            |
+     cflow              |              []                                   |
+     clisp              | []                              []                |
+     coreutils          | []           []     []  []      []       []       |
+     cpio               | []           []                 []                |
+     cppi               |              []                                   |
+     cpplib             | []                                                |
+     cryptsetup         | []                                                |
+     dfarc              |              []                                   |
+     dialog             | []           []         []      []                |
+     dico               |              []                                   |
+     diffutils          | []           []         []   [] []             [] |
+     dink               | ()                                                |
+     doodle             | []                                          []    |
+     e2fsprogs          | []           []                                   |
+     enscript           | []                      []   [] []       []       |
+     exif               | []           []              [] ()    []          |
+     fetchmail          | []           []                 []          []    |
+     findutils          | []           []     []          []       []       |
+     flex               | []           []         []   [] []                |
+     freedink           | []           []                                   |
+     gas                |                                                   |
+     gawk               | []           []         []   []                   |
+     gcal               |                                                   |
+     gcc                |                                                [] |
+     gettext-examples   | []           []     []       [] []    [] []    [] |
+     gettext-runtime    | []  []       []     []       [] []    [] []    [] |
+     gettext-tools      |              []              [] []    [] []    [] |
+     gip                | []           []                 []    []       [] |
+     gjay               |                                                   |
+     gliv               | []           []         []   [] []    []          |
+     glunarclock        | []                      []   []       []       [] |
+     gnubiff            | []                           ()                   |
+     gnucash            | []           ()         ()      ()                |
+     gnuedu             | []                                                |
+     gnulib             | []           []                 []       []       |
+     gnunet             |                                                   |
+     gnunet-gtk         |                                                   |
+     gnutls             | []           []                                   |
+     gold               |                                                   |
+     gpe-aerial         | []                  []  []   [] []       []    [] |
+     gpe-beam           | []                  []  []   [] []       []    [] |
+     gpe-bluetooth      | []                      []                        |
+     gpe-calendar       |                         []      []       []    [] |
+     gpe-clock          | []                  []  []   [] []    [] []    [] |
+     gpe-conf           | []                  []  []   [] []    [] []       |
+     gpe-contacts       |                         []   [] []       []    [] |
+     gpe-edit           | []           []                          []       |
+     gpe-filemanager    | []                              []       []       |
+     gpe-go             | []           []         []   [] []    [] []    [] |
+     gpe-login          | []                      []                        |
+     gpe-ownerinfo      | []                  []  []   [] []    [] []    [] |
+     gpe-package        | []                                       []       |
+     gpe-sketchbook     | []                  []  []   [] []       []    [] |
+     gpe-su             | []                  []  []   [] []    [] []    [] |
+     gpe-taskmanager    | []                  []  []   [] []    [] []    [] |
+     gpe-timesheet      | []                  []  []   [] []    [] []    [] |
+     gpe-today          | []                  []  []   [] []    [] []    [] |
+     gpe-todo           | []                      []      []       []    [] |
+     gphoto2            | []        [] []         []   [] []    []       [] |
+     gprof              | []                      []   []                   |
+     gpsdrive           | []                              []                |
+     gramadoir          | []                                    []          |
+     grep               | []           []                 []    []          |
+     grub               | []           []                 []                |
+     gsasl              | []           []                       []       [] |
+     gss                |              []              []       []          |
+     gst-plugins-bad    | []           []         []      []    []    []    |
+     gst-plugins-base   | []           []         []      []    []          |
+     gst-plugins-good   | []           []         []      []    []          |
+     gst-plugins-ugly   | []           []         []      []    [] []       |
+     gstreamer          | []           []         []      []    []          |
+     gtick              | []                              []    []          |
+     gtkam              | []        [] []         []      []    []          |
+     gtkorphan          | []                                                |
+     gtkspell           | []           []     []  []   [] []    [] [] [] [] |
+     gutenprint         | []                              []                |
+     hello              | []           []                       [] []       |
+     help2man           |              []                 []                |
+     hylafax            | []                                                |
+     idutils            | []           []         []   [] []                |
+     indent             | []           []         []   [] []    []       [] |
+     iso_15924          | []           []                 []       []       |
+     iso_3166           | []  [] [] [] []     ()  []   [] [] [] [] [] [] [] |
+     iso_3166_2         | []           []                          []       |
+     iso_4217           | []  []       []     []          [] []    []    [] |
+     iso_639            | []     [] [] []                 [] [] [] []    [] |
+     iso_639_3          |        [] []                                      |
+     jwhois             | []           []         []   []                   |
+     kbd                | []           []              []                   |
+     keytouch           | []           []                       []          |
+     keytouch-editor    | []           []                       []          |
+     keytouch-keyboa... | []           []                       []          |
+     klavaro            | []                      []                        |
+     latrine            |              []                 []                |
+     ld                 |                                                   |
+     leafpad            | []  []       []     []  []      []    [] []    [] |
+     libc               | []           []                 []    []          |
+     libexif            | []           []         ()            []          |
+     libextractor       |                                                   |
+     libgnutls          | []           []                                   |
+     libgpewidget       | []           []                          []       |
+     libgpg-error       |              []              []                   |
+     libgphoto2         | []           []                                   |
+     libgphoto2_port    | []           []         []      []    []          |
+     libgsasl           | []           []              []       []       [] |
+     libiconv           | []           []                       [] []    [] |
+     libidn             | []           []                                   |
+     lifelines          | []           []                                   |
+     liferea            | []           []     []  []   [] ()    ()    []    |
+     lilypond           | []                                                |
+     linkdr             | []                  []          []                |
+     lordsawar          |                                                   |
+     lprng              |              []                                   |
+     lynx               | []                      []      []                |
+     m4                 | []           []         []   [] []                |
+     mailfromd          |              []                                   |
+     mailutils          |              []                                   |
+     make               | []           []         []      []                |
+     man-db             | []           []                 []                |
+     man-db-manpages    | []           []                 []                |
+     minicom            |              []         []   [] []                |
+     mkisofs            | []           []                 []                |
+     myserver           |                                                   |
+     nano               | []           []         []      []                |
+     opcodes            | []                           []                   |
+     parted             | []           []                 []    []          |
+     pies               |              []                                   |
+     popt               | []           []     []          []                |
+     psmisc             | []           []                 []                |
+     pspp               | []                      []                        |
+     pwdutils           |              []                                   |
+     radius             | []           []                 []                |
+     recode             | []           []     []  []   [] []    [] []       |
+     rosegarden         |              ()                 ()                |
+     rpm                | []           []     []                            |
+     rush               | []           []                                   |
+     sarg               |                                                   |
+     screem             |                                                   |
+     scrollkeeper       | []  []       []              [] []    []    [] [] |
+     sed                | []           []     []  []   [] []    [] []    [] |
+     sharutils          | []           []                 []             [] |
+     shishi             |              []                                   |
+     skencil            |                     []  []                        |
+     solfege            | []           []         []      []                |
+     solfege-manual     | []           []         []                        |
+     soundtracker       |                                       []          |
+     sp                 |                                                   |
+     sysstat            | []           []         []      []                |
+     tar                | []           []                 []       []       |
+     texinfo            | []           []              [] []                |
+     tin                |                                 []                |
+     unicode-han-tra... |                                                   |
+     unicode-transla... |                                                   |
+     util-linux-ng      | []           []         []      []       []       |
+     vice               | []                                                |
+     vmm                | []                                                |
+     vorbis-tools       | []           []                                   |
+     wastesedge         | []                                                |
+     wdiff              | []           []                                   |
+     wget               | []           []     []  []      []    [] []       |
+     wyslij-po          | []  []       []                                   |
+     xchat              | []        [] []     []          []    [] [] [] [] |
+     xdg-user-dirs      | []  [] [] [] []  [] []  []   [] []    [] [] [] [] |
+     xkeyboard-config   | []           []                 []                |
+                        +---------------------------------------------------+
+                          nl  nn or pa pl  ps pt pt_BR ro ru rw sk sl sq sr
+                          135 10  4  7 105  1 29  62   47 91  3 54 46  9 37
 
-                          tg th tk tr uk ven vi  wa xh zh_CN zh_HK zh_TW zu
+                          sv  sw ta te tg th tr uk vi  wa zh_CN zh_HK zh_TW
                         +---------------------------------------------------+
-     GNUnet             |                    []                             |  2
-     a2ps               |          [] []     []                             | 19
-     aegis              |                                                   |  0
-     ant-phone          |          []        []                             |  6
-     anubis             |          [] []     []                             | 11
-     ap-utils           |             ()     []                             |  4
-     aspell             |             []     []  []                         | 14
-     bash               |                    []                             | 11
-     batchelor          |          []        []                             |  9
-     bfd                |                                                   |  1
-     bibshelf           |                    []                             |  7
-     binutils           |          []        []                     []      |  9
-     bison              |          []        []                     []      | 19
-     bison-runtime      |                    []         []          []      | 16
-     bluez-pin          |          [] []     []  []     []          []      | 28
-     cflow              |             []     []                             |  4
-     clisp              |                                                   |  6
-     console-tools      |          []        []                             |  5
-     coreutils          |          []        []                             | 17
-     cpio               |          [] []     []                             |  9
-     cpplib             |          []        []         []          []      | 11
-     cryptonit          |                                                   |  5
-     darkstat           |                    []         ()          ()      | 15
-     dialog             |          [] []     []         []          []      | 30
-     diffutils          |          []        []         []          []      | 28
-     doodle             |                    []                             |  6
-     e2fsprogs          |          []        []                             | 10
-     enscript           |          [] []     []                             | 16
-     error              |          []        []         []          []      | 18
-     fetchmail          |          []        []                             | 12
-     fileutils          |          []                   []          []      | 18
-     findutils          |          []        []                     []      | 17
-     flex               |          []        []                             | 15
-     fslint             |                    []                             |  9
-     gas                |          []                                       |  3
-     gawk               |          []        []                             | 15
-     gbiff              |                    []                             |  5
-     gcal               |          []                                       |  5
-     gcc                |          []                   []          []      |  6
-     gettext-examples   |          [] []     []         []    []    []      | 26
-     gettext-runtime    |          [] []     []         []    []    []      | 28
-     gettext-tools      |          [] []     []         []          []      | 19
-     gimp-print         |             []     []                             | 12
-     gip                |                    []                     []      | 12
-     gliv               |          []        []                             |  8
-     glunarclock        |                    []  []                 []      | 15
-     gmult              |          []        []         []          []      | 15
-     gnubiff            |                    []                             |  1
-     gnucash            |          ()                                       |  2
-     gnucash-glossary   |                    []                     []      |  9
-     gnuedu             |                    []                             |  2
-     gnulib             |          [] []     []         []          []      | 28
-     gnunet-gtk         |                                                   |  1
-     gnutls             |                                                   |  2
-     gpe-aerial         |                    []         []                  | 14
-     gpe-beam           |                    []         []                  | 14
-     gpe-calendar       |                    []  []     []          []      | 19
-     gpe-clock          |          []        []  []     []                  | 20
-     gpe-conf           |                    []         []                  | 14
-     gpe-contacts       |                    []         []                  | 10
-     gpe-edit           |          []        []  []                 []      | 19
-     gpe-filemanager    |                    []                             |  5
-     gpe-go             |          []        []                             | 14
-     gpe-login          |          []        []  []     []          []      | 20
-     gpe-ownerinfo      |          []        []         []          []      | 20
-     gpe-package        |                    []                             |  5
-     gpe-sketchbook     |          []        []                             | 16
-     gpe-su             |          []        []         []                  | 19
-     gpe-taskmanager    |          []        []         []                  | 19
-     gpe-timesheet      |          []        []         []          []      | 18
-     gpe-today          |          []        []  []     []          []      | 20
-     gpe-todo           |                    []                             |  6
-     gphoto2            |             []     []         []          []      | 20
-     gprof              |          []        []                             | 11
-     gpsdrive           |                                                   |  4
-     gramadoir          |                    []                             |  7
-     grep               |          [] []     []                     []      | 33
-     gretl              |                                                   |  4
-     gsasl              |                    []         []                  |  6
-     gss                |                    []                             |  5
-     gst-plugins        |             []     []                     []      | 15
-     gst-plugins-base   |             []     []         []                  |  9
-     gst-plugins-good   |             []     []         []                  | 18
-     gstreamer          |          [] []     []                             | 17
-     gtick              |                    []                             | 11
-     gtkam              |                    []                             | 13
-     gtkorphan          |                    []                             |  7
-     gtkspell           |             []     []  []     []    []    []      | 26
-     gutenprint         |                                                   |  3
-     hello              |          [] []     []         []          []      | 39
-     id-utils           |          []        []                             | 14
-     impost             |                    []                             |  4
-     indent             |          []        []         []          []      | 25
-     iso_3166           |       [] []        []                             | 15
-     iso_3166_1         |          []            []                         | 20
-     iso_3166_2         |                                                   |  2
-     iso_3166_3         |                        []     []                  |  9
-     iso_4217           |          []        []                             | 14
-     iso_639            |                    []                             | 14
-     jpilot             |          [] []     []         []                  |  7
-     jtag               |                    []                             |  3
-     jwhois             |          []        []                     []      | 13
-     kbd                |          []        []                             | 12
-     keytouch           |                    []                             |  4
-     keytouch-editor    |                                                   |  2
-     keytouch-keyboa... |                                                   |  2
-     latrine            |          []        []                             |  8
-     ld                 |          []        []         []          []      |  8
-     leafpad            |          []        []         []          []      | 23
-     libc               |          []                   []          []      | 23
-     libexif            |                    []                             |  4
-     libextractor       |                    []                             |  5
-     libgpewidget       |                    []  []     []                  | 19
-     libgpg-error       |                    []                             |  4
-     libgphoto2         |             []                                    |  8
-     libgphoto2_port    |             []     []                     []      | 11
-     libgsasl           |                    []                             |  8
-     libiconv           |                    []                             |  4
-     libidn             |                    []         []                  | 10
-     lifelines          |                                                   |  4
-     lilypond           |                                                   |  2
-     lingoteach         |                    []                             |  6
-     lynx               |          [] []     []                             | 15
-     m4                 |                    []         []          []      | 18
-     mailutils          |             []                                    |  8
-     make               |          []        []         []                  | 20
-     man-db             |                    []                             |  6
-     minicom            |                    []                             | 14
-     mysecretdiary      |          []        []                             | 12
-     nano               |                    []                     []      | 15
-     nano_1_0           |          [] []     []                             | 18
-     opcodes            |          []        []                             | 10
-     parted             |          [] []                            []      | 10
-     pilot-qof          |                    []                             |  3
-     psmisc             |                    []                             | 10
-     pwdutils           |                    []                             |  3
-     python             |                                                   |  0
-     qof                |                    []                             |  2
-     radius             |             []                                    |  6
-     recode             |          []        []         []                  | 25
-     rpm                |          [] []     []                     []      | 14
-     screem             |                    []                             |  2
-     scrollkeeper       |          [] []     []                     []      | 26
-     sed                |          []        []                     []      | 22
-     sh-utils           |          []                                       | 15
-     shared-mime-info   |             []     []         []          []      | 23
-     sharutils          |          []        []                     []      | 23
-     shishi             |                                                   |  1
-     silky              |                    []                             |  4
-     skencil            |                    []                             |  7
-     sketch             |                                                   |  6
-     solfege            |                                                   |  2
-     soundtracker       |          []        []                             |  9
-     sp                 |          []                                       |  3
-     stardict           |             []     []         []          []      | 11
-     system-tools-ba... |    []    [] []     []     []  []          []      | 37
-     tar                |          [] []     []                     []      | 19
-     texinfo            |          []        []         []                  | 15
-     textutils          |          []                   []          []      | 17
-     tin                |                                                   |  1
-     tp-robot           |                    []         []          []      | 10
-     tuxpaint           |                    []  []                 []      | 16
+     a2ps               | []              [] [] [] []                       | 27
+     aegis              |                          []                       |  9
+     ant-phone          | []                 []    []      []               |  9
+     anubis             | []                 [] [] []                       | 15
+     aspell             |                       [] []  []                   | 20
+     bash               | []                    [] []                       | 12
+     bfd                |                          []                       |  6
+     bibshelf           | []                       []      []               | 16
+     binutils           |                       [] []                       |  8
+     bison              | []                       []                       | 12
+     bison-runtime      | []              []    [] []      []          []   | 29
+     bluez-pin          | []              [] [] [] []  []  []          []   | 37
+     bombono-dvd        |                          []                       |  4
+     buzztard           |                          []                       |  7
+     cflow              |                       [] []      []               |  9
+     clisp              |                                                   | 10
+     coreutils          | []                    [] []      []               | 22
+     cpio               | []                 [] [] []      []          []   | 13
+     cppi               |                       [] []                       |  5
+     cpplib             | []                 [] [] []      []          []   | 14
+     cryptsetup         | []                       []                       |  7
+     dfarc              |                          []                       |  9
+     dialog             | []  []          []       []  []  []          []   | 30
+     dico               |                       []                          |  2
+     diffutils          | []                 [] [] []      []          []   | 30
+     dink               |                                                   |  4
+     doodle             | []                       []                       |  7
+     e2fsprogs          | []                 []    []                       | 11
+     enscript           | []                 [] [] []                       | 17
+     exif               | []                       []      []               | 16
+     fetchmail          |                    []    []      []               | 17
+     findutils          | []                 [] [] []      []               | 20
+     flex               | []                 []    []                  []   | 15
+     freedink           |                          []                       | 10
+     gas                |                    []                             |  4
+     gawk               | []                 []    []      []               | 18
+     gcal               | []                 []                             |  5
+     gcc                | []                 []            []               |  7
+     gettext-examples   | []                 [] [] []      []    []    []   | 34
+     gettext-runtime    | []                 [] [] []      []    []    []   | 29
+     gettext-tools      | []                 [] [] []      []          []   | 22
+     gip                | []                       []      []          []   | 22
+     gjay               |                          []                       |  3
+     gliv               | []                 []    []                       | 14
+     glunarclock        | []                       []  []  []          []   | 19
+     gnubiff            | []                       []                       |  4
+     gnucash            |                    () [] ()      []          ()   | 10
+     gnuedu             |                          []                  []   |  7
+     gnulib             | []                    [] []      []               | 16
+     gnunet             |                          []                       |  1
+     gnunet-gtk         | []                 []    []                       |  5
+     gnutls             | []                       []      []               | 10
+     gold               |                          []                       |  4
+     gpe-aerial         | []                       []      []               | 18
+     gpe-beam           | []                       []      []               | 19
+     gpe-bluetooth      | []                       []      []               | 13
+     gpe-calendar       | []                       []  []  []               | 12
+     gpe-clock          | []                 []    []  []  []               | 28
+     gpe-conf           | []                       []  []  []               | 20
+     gpe-contacts       | []                       []      []               | 17
+     gpe-edit           | []                       []      []               | 12
+     gpe-filemanager    | []                       []  []  []               | 16
+     gpe-go             | []                 []    []  []  []               | 25
+     gpe-login          | []                       []      []               | 11
+     gpe-ownerinfo      | []                 []    []      []          []   | 25
+     gpe-package        | []                       []      []               | 13
+     gpe-sketchbook     | []                       []      []               | 20
+     gpe-su             | []                 []    []  []  []               | 30
+     gpe-taskmanager    | []                 []    []  []  []               | 29
+     gpe-timesheet      | []                 []    []      []          []   | 25
+     gpe-today          | []                 []    []  []  []          []   | 30
+     gpe-todo           | []                       []  []  []               | 17
+     gphoto2            | []                    [] []      []          []   | 24
+     gprof              | []                 []    []                       | 15
+     gpsdrive           | []                       []      []               | 11
+     gramadoir          | []                       []      []               | 11
+     grep               |                 []       []      []               | 10
+     grub               | []                       []      []               | 14
+     gsasl              | []                       []      []          []   | 14
+     gss                | []                       []      []               | 11
+     gst-plugins-bad    | []                 []    []      []               | 26
+     gst-plugins-base   | []                 [] [] []      []               | 24
+     gst-plugins-good   | []                 []    []      []               | 24
+     gst-plugins-ugly   | []                 [] [] []      []               | 29
+     gstreamer          | []                    [] []      []               | 22
+     gtick              |                       [] []      []               | 13
+     gtkam              | []                       []      []               | 20
+     gtkorphan          | []                       []      []               | 14
+     gtkspell           | []              [] [] [] []  []  []    []    []   | 45
+     gutenprint         | []                                                | 10
+     hello              | []              [] []    []      []          []   | 21
+     help2man           | []                       []                       |  7
+     hylafax            |                          []                       |  5
+     idutils            | []                 []    []      []               | 17
+     indent             | []                 [] [] []      []          []   | 30
+     iso_15924          |                 ()    [] ()      []          []   | 16
+     iso_3166           | []        []    () [] [] ()  []  []    []    ()   | 53
+     iso_3166_2         |                 ()    [] ()      []               |  9
+     iso_4217           | []              () [] [] ()      []    []         | 26
+     iso_639            | []     [] []    ()    [] ()  []  []    []    []   | 38
+     iso_639_3          |        []                ()                       |  8
+     jwhois             | []                 []    []      []          []   | 16
+     kbd                | []                 [] [] []      []               | 15
+     keytouch           | []                       []      []               | 16
+     keytouch-editor    | []                       []      []               | 14
+     keytouch-keyboa... | []                       []      []               | 14
+     klavaro            |                          []                       | 11
+     latrine            |                    []    []      []               | 10
+     ld                 | []                 []    []                  []   | 11
+     leafpad            | []                 [] [] []      []          []   | 33
+     libc               | []                 []    []      []          []   | 21
+     libexif            |                          []      ()               |  7
+     libextractor       |                          []                       |  1
+     libgnutls          | []                       []      []               |  9
+     libgpewidget       | []                       []      []               | 14
+     libgpg-error       | []                       []      []               |  9
+     libgphoto2         |                       [] []                       |  8
+     libgphoto2_port    | []                    [] []                  []   | 14
+     libgsasl           | []                       []      []               | 13
+     libiconv           | []                       []  []  []               | 21
+     libidn             | ()                       []      []               | 11
+     lifelines          | []                                                |  4
+     liferea            | []                 []            []               | 21
+     lilypond           |                          []                       |  7
+     linkdr             | []                 []    []      []          []   | 17
+     lordsawar          |                                                   |  1
+     lprng              |                          []                       |  3
+     lynx               | []                 [] [] []                       | 17
+     m4                 | []                       []      []          []   | 19
+     mailfromd          |                       [] []                       |  3
+     mailutils          |                          []                       |  5
+     make               | []                 []    []      []               | 21
+     man-db             | []                       []      []               |  8
+     man-db-manpages    |                                                   |  4
+     minicom            | []                       []                       | 16
+     mkisofs            |                          []      []               |  9
+     myserver           |                                                   |  0
+     nano               | []                       []      []          []   | 21
+     opcodes            | []                 []    []                       | 11
+     parted             | []                 [] [] []                  []   | 15
+     pies               |                       [] []                       |  3
+     popt               | []              [] []    []      []          []   | 27
+     psmisc             | []                       []                       | 11
+     pspp               |                                                   |  4
+     pwdutils           | []                       []                       |  6
+     radius             |                       [] []                       |  9
+     recode             | []                 []    []      []               | 28
+     rosegarden         | ()                                                |  0
+     rpm                | []                       []                  []   | 11
+     rush               |                       [] []                       |  4
+     sarg               |                                                   |  1
+     screem             |                          []                       |  3
+     scrollkeeper       | []                 [] [] []                  []   | 27
+     sed                | []                 []    []      []          []   | 30
+     sharutils          | []                 []    []      []          []   | 22
+     shishi             |                          []                       |  3
+     skencil            | []                       []                       |  7
+     solfege            | []                 []    []      []               | 16
+     solfege-manual     |                    []                             |  8
+     soundtracker       | []                 []    []                       |  9
+     sp                 |                    []                             |  3
+     sysstat            |                          []      []               | 15
+     tar                | []                 [] [] []      []          []   | 23
+     texinfo            | []                 [] [] []      []               | 17
+     tin                |                                                   |  4
      unicode-han-tra... |                                                   |  0
      unicode-transla... |                                                   |  2
-     util-linux         |          [] []     []                             | 20
-     vorbis-tools       |             []     []                             | 11
-     wastesedge         |                                                   |  1
-     wdiff              |          []        []                             | 22
-     wget               |          []        []                     []      | 19
-     xchat              |             []     []         []          []      | 28
-     xkeyboard-config   |          [] []     []                     []      | 11
-     xpad               |                    []         []          []      | 14
+     util-linux-ng      | []                 [] [] []                       | 20
+     vice               | ()                 ()                             |  1
+     vmm                |                          []                       |  4
+     vorbis-tools       |                          []                       |  6
+     wastesedge         |                                                   |  2
+     wdiff              | []                       []                       |  7
+     wget               | []                 []    []      []          []   | 26
+     wyslij-po          |                       [] []                       |  8
+     xchat              | []              []    [] []      []          []   | 36
+     xdg-user-dirs      | []     [] []    [] [] [] []      []    []    []   | 63
+     xkeyboard-config   | []                    [] []                       | 22
                         +---------------------------------------------------+
-       77 teams           tg th tk tr uk ven vi  wa xh zh_CN zh_HK zh_TW zu
-      172 domains          0  1  1 78 39  0  135 13  1  50     3    54    0  2054
+       85 teams           sv  sw ta te tg th tr uk vi  wa zh_CN zh_HK zh_TW
+      178 domains         119  1  3  3  0 10 65 51 155 17  98     7    41    2618
 
    Some counters in the preceding matrix are higher than the number of
 visible blocks let us expect.  This is because a few extra PO files are
@@ -1085,12 +1256,12 @@ distributed as such by its maintainer.  There might be an observable
 lag between the mere existence a PO file and its wide availability in a
 distribution.
 
-   If July 2006 seems to be old, you may fetch a more recent copy of
+   If June 2010 seems to be old, you may fetch a more recent copy of
 this `ABOUT-NLS' file on most GNU archive sites.  The most up-to-date
 matrix with full percentage details can be found at
-`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
+`http://translationproject.org/extra/matrix.html'.
 
-1.6 Using `gettext' in new packages
+1.5 Using `gettext' in new packages
 ===================================
 
 If you are writing a freely available program and want to
@@ -1106,6 +1277,6 @@ the use of `gettext' the only thing missing are the translations.  The
 Free Translation Project is also available for packages which are not
 developed inside the GNU project.  Therefore the information given above
 applies also for every other Free Software Project.  Contact
-`translation@iro.umontreal.ca' to make the `.pot' files available to
-the translation teams.
+`coordinator@translationproject.org' to make the `.pot' files available
+to the translation teams.
 
diff --git a/AUTHORS b/AUTHORS
index 38c73fc..f4e5175 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,4 @@
 Jana Saout <jana@saout.de>
 Clemens Fruhwirth <clemens@endorphin.org>
 Milan Broz <gmazyland@gmail.com>
+Ondrej Kozina <okozina@redhat.com>
index e056c5c..b6c11ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,4 +3,4 @@ Since version 1.6 this file is no longer maintained.
 See docs/*ReleaseNotes for release changes documentation.
 
 See version control history for full commit messages.
-  http://code.google.com/p/cryptsetup/source/list
+  https://gitlab.com/cryptsetup/cryptsetup/commits/master
diff --git a/FAQ b/FAQ
index 08b52ad..31060dd 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -1,5 +1,6 @@
-Sections 
+Frequently Asked Questions Cryptsetup/LUKS
 
+Sections
 1. General Questions
 2. Setup
 3. Common Problems
@@ -8,134 +9,145 @@ Sections
 6. Backup and Data Recovery
 7. Interoperability with other Disk Encryption Tools
 8. Issues with Specific Versions of cryptsetup
-9. References and Further Reading
+9. The Initrd question
+10. LUKS2 Questions
+11. References and Further Reading
 A. Contributors
 
-
-1. General Questions 
+1. General Questions
 
 
- * 1.1 What is this?
 * 1.1 What is this?
 
-  This is the FAQ (Frequently Asked Questions) for cryptsetup. It
-  covers Linux disk encryption with plain dm-crypt (one passphrase,
-  no management, no metadata on disk) and LUKS (multiple user keys
-  with one master key, anti-forensic features, metadata block at
-  start of device, ...). The latest version of this FAQ should
-  usually be available at
+  This is the FAQ (Frequently Asked Questions) for cryptsetup.  It covers
+  Linux disk encryption with plain dm-crypt (one passphrase, no
+  management, no metadata on disk) and LUKS (multiple user keys with one
+  master key, anti-forensic features, metadata block at start of device,
+  ...).  The latest version of this FAQ should usually be available at
   https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions
 
 
- * 1.2 WARNINGS
-
-  ATTENTION: If you are going to read just one thing, make it the
-  section on Backup and Data Recovery. By far the most questions on
-  the cryptsetup mailing list are from people that managed to damage
-  the start of their LUKS partitions, i.e. the LUKS header. In
-  most cases, there is nothing that can be done to help these poor
-  souls recover their data. Make sure you understand the problem and
-  limitations imposed by the LUKS security model BEFORE you face
-  such a disaster! In particular, make sure you have a current header
-  backup before doing any potentially dangerous operations.
-
-  SSDs/FLASH DRIVES: SSDs and Flash are different. Currently it is
-  unclear how to get LUKS or plain dm-crypt to run on them with the
-  full set of security features intact. This may or may not be a
-  problem, depending on the attacker model. See Section 5.19.
-
-  BACKUP: Yes, encrypted disks die, just as normal ones do. A full
-  backup is mandatory, see Section "6. Backup and Data Recovery" on
-  options for doing encrypted backup.
-
-  CLONING/IMAGING: If you clone or image a LUKS container, you make a
-  copy of the LUKS header and the master key will stay the same!
-  That means that if you distribute an image to several machines, the
-  same master key will be used on all of them, regardless of whether
-  you change the passphrases. Do NOT do this! If you do, a root-user
-  on any of the machines with a mapped (decrypted) container or a
-  passphrase on that machine can decrypt all other copies, breaking
-  security. See also Item 6.15.
-
-  DISTRIBUTION INSTALLERS: Some distribution installers offer to
-  create LUKS containers in a way that can be mistaken as activation
-  of an existing container. Creating a new LUKS container on top of
-  an existing one leads to permanent, complete and irreversible data
-  loss. It is strongly recommended to only use distribution
-  installers after a complete backup of all LUKS containers has been
-  made.
-
-  UBUNTU INSTALLER: In particular the Ubuntu installer seems to be
-  quite willing to kill LUKS containers in several different ways.
-  Those responsible at Ubuntu seem not to care very much (it is very
-  easy to recognize a LUKS container), so treat the process of
-  installing Ubuntu as a severe hazard to any LUKS container you may
-  have.
-
-  NO WARNING ON NON-INTERACTIVE FORMAT: If you feed cryptsetup from
-  STDIN (e.g. via GnuPG) on LUKS format, it does not give you the
-  warning that you are about to format (and e.g. will lose any
-  pre-existing LUKS container on the target), as it assumes it is
-  used from a script. In this scenario, the responsibility for
-  warning the user and possibly checking for an existing LUKS header
-  is shifted to the script. This is a more general form of the
-  previous item.
-
-  LUKS PASSPHRASE IS NOT THE MASTER KEY: The LUKS passphrase is not
-  used in deriving the master key. It is used in decrypting a master
-  key that is randomly selected on header creation. This means that
-  if you create a new LUKS header on top of an old one with
-  exactly the same parameters and exactly the same passphrase as the
-  old one, it will still have a different master key and your data
-  will be permanently lost.
-
-  PASSPHRASE CHARACTER SET: Some people have had difficulties with
-  this when upgrading distributions. It is highly advisable to only
-  use the 95 printable characters from the first 128 characters of
-  the ASCII table, as they will always have the same binary
-  representation. Other characters may have different encoding
-  depending on system configuration and your passphrase will not
-  work with a different encoding. A table of the standardized first
-  128 ASCII characters can, e.g. be found on
+  * 1.2 WARNINGS
+
+  LUKS2 COMPATIBILITY: This FAQ was originally written for LUKS1, not
+  LUKS2.  Hence regarding LUKS2, some of the answers found here may not
+  apply.  Updates for LUKS2 have been done and anything not applying to
+  LUKS2 should clearly say LUKS1.  However, this is a Frequently Asked
+  Questions, and questions for LUKS2 are limited at this time or at least
+  those that have reached me are.  In the following, "LUKS" refers to both
+  LUKS1 and LUKS2.
+  The LUKS1 on-disk format specification is at  
+  https://www.kernel.org/pub/linux/utils/cryptsetup/LUKS_docs/on-disk-format.pdf  
+  The LUKS2 on-disk format specification is at  
+  https://gitlab.com/cryptsetup/LUKS2-docs
+
+  ATTENTION: If you are going to read just one thing, make it the section
+  on Backup and Data Recovery.  By far the most questions on the
+  cryptsetup mailing list are from people that managed to damage the start
+  of their LUKS partitions, i.e.  the LUKS header.  In most cases, there
+  is nothing that can be done to help these poor souls recover their data. 
+  Make sure you understand the problem and limitations imposed by the LUKS
+  security model BEFORE you face such a disaster!  In particular, make
+  sure you have a current header backup before doing any potentially
+  dangerous operations.  The LUKS2 header should be a bit more resilient
+  as critical data starts later and is stored twice, but you can decidely
+  still destroy it or a keyslot permanently by accident.
+
+  DEBUG COMMANDS: While the --debug and --debug-json options should not
+  leak secret data, "strace" and the like can leak your full passphrase. 
+  Do not post an strace output with the correct passphrase to a
+  mailing-list or online!  See Item 4.5 for more explanation.
+
+  SSDs/FLASH DRIVES: SSDs and Flash are different.  Currently it is
+  unclear how to get LUKS or plain dm-crypt to run on them with the full
+  set of security assurances intact.  This may or may not be a problem,
+  depending on the attacker model.  See Section 5.19.
+
+  BACKUP: Yes, encrypted disks die, just as normal ones do.  A full backup
+  is mandatory, see Section "6.  Backup and Data Recovery" on options for
+  doing encrypted backup.
+
+  CLONING/IMAGING: If you clone or image a LUKS container, you make a copy
+  of the LUKS header and the master key will stay the same!  That means
+  that if you distribute an image to several machines, the same master key
+  will be used on all of them, regardless of whether you change the
+  passphrases.  Do NOT do this!  If you do, a root-user on any of the
+  machines with a mapped (decrypted) container or a passphrase on that
+  machine can decrypt all other copies, breaking security.  See also Item
+  6.15.
+
+  DISTRIBUTION INSTALLERS: Some distribution installers offer to create
+  LUKS containers in a way that can be mistaken as activation of an
+  existing container.  Creating a new LUKS container on top of an existing
+  one leads to permanent, complete and irreversible data loss.  It is
+  strongly recommended to only use distribution installers after a
+  complete backup of all LUKS containers has been made.
+
+  UBUNTU INSTALLER: In particular the Ubuntu installer seems to be quite
+  willing to kill LUKS containers in several different ways.  Those
+  responsible at Ubuntu seem not to care very much (it is very easy to
+  recognize a LUKS container), so treat the process of installing Ubuntu
+  as a severe hazard to any LUKS container you may have.
+
+  NO WARNING ON NON-INTERACTIVE FORMAT: If you feed cryptsetup from STDIN
+  (e.g.  via GnuPG) on LUKS format, it does not give you the warning that
+  you are about to format (and e.g.  will lose any pre-existing LUKS
+  container on the target), as it assumes it is used from a script.  In
+  this scenario, the responsibility for warning the user and possibly
+  checking for an existing LUKS header is shifted to the script.  This is
+  a more general form of the previous item.
+
+  LUKS PASSPHRASE IS NOT THE MASTER KEY: The LUKS passphrase is not used
+  in deriving the master key.  It is used in decrypting a master key that
+  is randomly selected on header creation.  This means that if you create
+  a new LUKS header on top of an old one with exactly the same parameters
+  and exactly the same passphrase as the old one, it will still have a
+  different master key and your data will be permanently lost.
+
+  PASSPHRASE CHARACTER SET: Some people have had difficulties with this
+  when upgrading distributions.  It is highly advisable to only use the 95
+  printable characters from the first 128 characters of the ASCII table,
+  as they will always have the same binary representation.  Other
+  characters may have different encoding depending on system configuration
+  and your passphrase will not work with a different encoding.  A table of
+  the standardized first 128 ASCII characters can, e.g.  be found on
   http://en.wikipedia.org/wiki/ASCII
 
+  KEYBOARD NUM-PAD: Apparently some pre-boot authentication environments
+  (these are done by the distro, not by cryptsetup, so complain there)
+  treat digits entered on the num-pad and ones entered regularly
+  different.  This may be because the BIOS USB keyboard driver is used and
+  that one may have bugs on some computers.  If you cannot open your
+  device in pre-boot, try entering the digits over the regular digit keys.
 
- * 1.3 System specific warnings
-
-  - Ubuntu as of 4/2011: It seems the installer offers to create
-  LUKS partitions in a way that several people mistook for an offer
-  to activate their existing LUKS partition. The installer gives no
-  or an inadequate warning and will destroy your old LUKS header,
-  causing permanent data loss. See also the section on Backup and
-  Data Recovery.
 
-  This issue has been acknowledged by the Ubuntu dev team, see here:
-  http://launchpad.net/bugs/420080
+  * 1.3 System specific warnings
 
-  Update 4/2013: I am still unsure whether this has been fixed by
-  now, best be careful. They also seem to have added even more LUKS
-  killer functionality to the Ubuntu installer. I can only strongly
-  recommended to not install Ubuntu on a system with existing LUKS
-  containers without complete backups.
+  - The Ubuntu Natty uinstaller has a "won't fix" defect that may destroy
+  LUKS containers.  This is quite old an not relevant for most people. 
+  Reference:
+  https://bugs.launchpad.net/ubuntu/+source/partman-crypto/+bug/420080
 
 
- * 1.4 My LUKS-device is broken! Help!
 * 1.4 My LUKS-device is broken! Help!
 
   First: Do not panic! In many cases the data is still recoverable.
   Do not do anything hasty! Steps:
 
-  - Take some deep breaths. Maybe add some relaxing music. This may
-  sound funny, but I am completely serious. Often, critical damage is
+  - Take some deep breaths. Maybe add some relaxing music.  This may
+  sound funny, but I am completely serious.  Often, critical damage is
   done only after the initial problem.
 
-  - Do not reboot. The keys mays still be in the kernel if the device
-  is mapped.
+  - Do not reboot. The keys may still be in the kernel if the device is
+  mapped.
 
   - Make sure others do not reboot the system.
 
-  - Do not write to your disk without a clear understanding why this
-  will not make matters worse. Do a sector-level backup before any
-  writes. Often you do not need to write at all to get enough access
-  to make a backup of the data.
+  - Do not write to your disk without a clear understanding why this will
+  not make matters worse.  Do a sector-level backup before any writes. 
+  Often you do not need to write at all to get enough access to make a
+  backup of the data.
 
   - Relax some more.
 
@@ -144,1962 +156,2113 @@ A. Contributors
   - Ask on the mailing-list if you need more help.
 
 
- * 1.5 Who wrote this?
 * 1.5 Who wrote this?
 
-  Current FAQ maintainer is Arno Wagner <arno@wagner.name>. If you
-  want to send me encrypted email, my current PGP key is DSA key
-  CB5D9718, fingerprint 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D
-  9718.
+  Current FAQ maintainer is Arno Wagner <arno@wagner.name>.  If you want
+  to send me encrypted email, my current PGP key is DSA key CB5D9718,
+  fingerprint 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718.
 
-  Other contributors are listed at the end. If you want to contribute,
-  send your article, including a descriptive headline, to the
-  maintainer, or the dm-crypt mailing list with something like "FAQ
-  ..." in the subject. You can also send more raw information and
-  have me write the section. Please note that by contributing to this
-  FAQ, you accept the license described below.
+  Other contributors are listed at the end.  If you want to contribute,
+  send your article, including a descriptive headline, to the maintainer,
+  or the dm-crypt mailing list with something like "FAQ ..." 
+  in the subject.  You can also send more raw information and have
+  me write the section.  Please note that by contributing to this FAQ,
+  you accept the license described below.
 
-  This work is under the "Attribution-Share Alike 3.0 Unported"
-  license, which means distribution is unlimited, you may create
-  derived works, but attributions to original authors and this
-  license statement must be retained and the derived work must be
-  under the same license. See
-  http://creativecommons.org/licenses/by-sa/3.0/ for more details of
-  the license.
+  This work is under the "Attribution-Share Alike 3.0 Unported" license,
+  which means distribution is unlimited, you may create derived works, but
+  attributions to original authors and this license statement must be
+  retained and the derived work must be under the same license.  See
+  http://creativecommons.org/licenses/by-sa/3.0/ for more details of the
+  license.
 
-  Side note: I did text license research some time ago and I think
-  this license is best suited for the purpose at hand and creates the
-  least problems.
+  Side note: I did text license research some time ago and I think this
+  license is best suited for the purpose at hand and creates the least
+  problems.
 
 
- * 1.6 Where is the project website?
 * 1.6 Where is the project website?
 
-  There is the project website at https://gitlab.com/cryptsetup/cryptsetup/
-  Please do not post questions there, nobody will read them. Use
-  the mailing-list instead.
+  There is the project website at
+  https://gitlab.com/cryptsetup/cryptsetup/ Please do not post
+  questions there, nobody will read them.  Use the mailing-list
+  instead.
 
 
- * 1.7 Is there a mailing-list?
 * 1.7 Is there a mailing-list?
 
   Instructions on how to subscribe to the mailing-list are at on the
-  project website. People are generally helpful and friendly on the
+  project website.  People are generally helpful and friendly on the
   list.
 
-  The question of how to unsubscribe from the list does crop up
-  sometimes. For this you need your list management URL, which is
-  sent to you initially and once at the start of each month. Go to
-  the URL mentioned in the email and select "unsubscribe". This page
-  also allows you to request a password reminder.
+  The question of how to unsubscribe from the list does crop up sometimes. 
+  For this you need your list management URL, which is sent to you
+  initially and once at the start of each month.  Go to the URL mentioned
+  in the email and select "unsubscribe".  This page also allows you to
+  request a password reminder.
 
-  Alternatively, you can send an Email to dm-crypt-request@saout.de
-  with just the word "help" in the subject or message body. Make sure
-  to send it from your list address.
+  Alternatively, you can send an Email to dm-crypt-request@saout.de with
+  just the word "help" in the subject or message body.  Make sure to send
+  it from your list address.
 
   The mailing list archive is here:
-  http://dir.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt
+  https://marc.info/?l=dm-crypt
 
 
- * 1.8 Unsubscribe from the mailing-list
 * 1.8 Unsubscribe from the mailing-list
 
-  Send mail to dm-crypt-unsubscribe@saout.de from the subscribed
-  account. You will get an email with instructions.
+  Send mail to dm-crypt-unsubscribe@saout.de from the subscribed account. 
+  You will get an email with instructions.
 
   Basically, you just have to respond to it unmodified to get
-  unsubscribed. The listserver admin functions are not very fast. It
-  can take 15 minutes or longer for a reply to arrive (I suspect
-  greylisting is in use), so be patient.
+  unsubscribed.  The listserver admin functions are not very fast.  It can
+  take 15 minutes or longer for a reply to arrive (I suspect greylisting
+  is in use), so be patient.
 
-  Also note that nobody on the list can unsubscribe you, sending
-  demands to be unsubscribed to the list just annoys people that are
-  entirely blameless for you being subscribed.
+  Also note that nobody on the list can unsubscribe you, sending demands
+  to be unsubscribed to the list just annoys people that are entirely
+  blameless for you being subscribed.
 
-  If you are subscribed, a subscription confirmation email was sent
-  to your email account and it had to be answered before the
-  subscription went active. The confirmation emails from the
-  listserver have subjects like these (with other numbers):
+  If you are subscribed, a subscription confirmation email was sent to
+  your email account and it had to be answered before the subscription
+  went active.  The confirmation emails from the listserver have subjects
+  like these (with other numbers):
 
-  Subject: confirm 9964cf10.....
-  
-  and are sent from dm-crypt-request@saout.de. You should check
-  whether you have anything like it in your sent email folder. If
-  you find nothing and are sure you did not confirm, then you should
-  look into a possible compromise of your email account.
+    Subject: confirm 9964cf10.....
 
+  and are sent from dm-crypt-request@saout.de.  You should check whether
+  you have anything like it in your sent email folder.  If you find
+  nothing and are sure you did not confirm, then you should look into a
+  possible compromise of your email account.
 
-2. Setup 
 
+2. Setup
 
- * 2.1 LUKS Container Setup mini-HOWTO
 * 2.1 LUKS Container Setup mini-HOWTO
 
   This item tries to give you a very brief list of all the steps you
-  should go though when creating a new LUKS encrypted container, i.e.
+  should go though when creating a new LUKS encrypted container, i.e. 
   encrypted disk, partition or loop-file.
 
-  01) All data will be lost, if there is data on the target, make a 
+  01) All data will be lost, if there is data on the target, make a
   backup.
 
-  02) Make very sure you have the right target disk, partition or
+  02) Make very sure you use the right target disk, partition or
   loop-file.
 
-  03) If the target was in use previously, it is a good idea to
-  wipe it before creating the LUKS container in order to remove any
-  trace of old file systems and data. For example, some users have
-  managed to run e2fsck on a partition containing a LUKS container,
-  possibly because of residual ext2 superblocks from an earlier use.
-  This can do arbitrary damage up to complete and permanent loss of
-  all data in the LUKS container.
+  03) If the target was in use previously, it is a good idea to wipe it
+  before creating the LUKS container in order to remove any trace of old
+  file systems and data.  For example, some users have managed to run
+  e2fsck on a partition containing a LUKS container, possibly because of
+  residual ext2 superblocks from an earlier use.  This can do arbitrary
+  damage up to complete and permanent loss of all data in the LUKS
+  container.
 
   To just quickly wipe file systems (old data may remain), use
 
-     wipefs -a <target device>
+    wipefs -a <target device>
+
   To wipe file system and data, use something like
 
-     cat /dev/zero > <target device>
-  This can take a while. To get a progress indicator, you can use
-  the tool dd_rescue (->google) instead or use my stream meter "wcs"
-  (source here: http://www.tansi.org/tools/index.html) in the
-  following fashion:
+    cat /dev/zero > <target device>
+
+  This can take a while.  To get a progress indicator, you can use the
+  tool dd_rescue (->google) instead or use my stream meter "wcs" (source
+  here: http://www.tansi.org/tools/index.html) in the following fashion:
+
+    cat /dev/zero | wcs > <target device>
+
+  Plain "dd" also gives you the progress on a SIGUSR1, see its man-page.
 
-     cat /dev/zero | wcs > <target device>
   Be very sure you have the right target, all data will be lost!
 
-  Note that automatic wiping is on the TODO list for cryptsetup, so
-  at some time in the future this will become unnecessary.
+  Note that automatic wiping is on the TODO list for cryptsetup, so at
+  some time in the future this will become unnecessary.
 
-  Alternatively, plain cm-crypt can be used for a very fast wipe with
+  Alternatively, plain dm-crypt can be used for a very fast wipe with
   crypto-grade randomness, see Item 2.19
 
-  04) Create the LUKS container:
-     cryptsetup luksFormat <target device>
-  Just follow the on-screen instructions.
+  04) Create the LUKS container.  
 
-  Note: Passphrase iteration is determined by cryptsetup depending on
-  CPU power. On a slow device, this may be lower than you want. I
-  recently benchmarked this on a Raspberry Pi and it came out at
-  about 1/15 of the iteration count for a typical PC. If security is
-  paramount, you may want to increase the time spent in iteration, at
-  the cost of a slower unlock later. For the Raspberry Pi, using
+  LUKS1:
 
-   cryptsetup luksFormat -i 15000 <target device>
-  gives you an iteration count and security level equal to an average
-  PC for passphrase iteration and master-key iteration. If in doubt,
-  check the iteration counts with
+    cryptsetup luksFormat --type luks1 <target device>
 
-   cryptsetup luksDump <target device>
-  and adjust the iteration count accordingly by creating the container
-  again with a different iteration time (the number after '-i' is the
-  iteration time in milicesonds) until your requirements are met.
+  LUKS2:
+
+    cryptsetup luksFormat --type luks2 <target device>
+
+
+  Just follow the on-screen instructions.
+
+  Note: Passprase iteration count is based on time and hence security
+  level depends on CPU power of the system the LUKS container is created
+  on.  For example on a Raspberry Pi and LUKS1, I found some time ago that
+  the iteration count is 15 times lower than for a regular PC (well, for
+  my old one).  Depending on security requirements, this may need
+  adjustment.  For LUKS1, you can just look at the iteration count on
+  different systems and select one you like.  You can also change the
+  benchmark time with the -i parameter to create a header for a slower
+  system.
+
+  For LUKS2, the parameters are more complex.  ARGON2 has iteration,
+  parallelism and memory parameter.  cryptsetup actually may adjust the
+  memory parameter for time scaling.  Hence to use -i is the easiest way
+  to get slower or faster opening (default: 2000 = 2sec).  Just make sure
+  to not drop this too low or you may get a memory parameter that is to
+  small to be secure.  The luksDump command lists the memory parameter of
+  a created LUKS2 keyslot in kB.  That parameter should probably be not
+  much lower than 100000, i.e.  100MB, but don't take my word for it.
 
   05) Map the container. Here it will be mapped to /dev/mapper/c1:
-     cryptsetup luksOpen <target device> c1 
-  06) (Optionally) wipe the container (make sure you have the right target!):
-     cat /dev/zero > /dev/mapper/c1
-      
-  Note that this creates a small information leak, as an attacker can
-  determine whether a 512 byte block is zero if the attacker has
-  access to the encrypted container multiple times. Typically a
-  competent attacker that has access multiple times can install a
-  passphrase sniffer anyways, so this leakage is not very
-  significant. For getting a progress indicator, see step 03.
-
-  Note that at some time in the future, cryptsetup will do this for
-  you, but currently it is a TODO list item.
-
-  07) Create a file system in the mapped container, for example an 
+
+    cryptsetup luksOpen <target device> c1
+
+  06) (Optionally) wipe the container (make sure you have the right
+      target!): 
+
+    cat /dev/zero > /dev/mapper/c1
+
+  This will take a while.  Note that this creates a small information
+  leak, as an attacker can determine whether a 512 byte block is zero if
+  the attacker has access to the encrypted container multiple times. 
+  Typically a competent attacker that has access multiple times can
+  install a passphrase sniffer anyways, so this leakage is not very
+  significant.  For getting a progress indicator, see step 03.
+
+  07) Create a file system in the mapped container, for example an
   ext3 file system (any other file system is possible):
 
-     mke2fs -j /dev/mapper/c1
+    mke2fs -j /dev/mapper/c1
+
   08) Mount your encrypted file system, here on /mnt:
-     mount /dev/mapper/c1 /mnt 
-  Done. You can now use the encrypted file system to store data. Be
-  sure to read though the rest of the FAQ, these are just the very
-  basics. In particular, there are a number of mistakes that are
-  easy to make, but will compromise your security.
 
+    mount /dev/mapper/c1 /mnt
 
- * 2.2 LUKS on partitions or raw disks?
+  09) Make a LUKS header backup and plan for a container backup.
+      See Section 6 for details.
 
-  This is a complicated question, and made more so by the availability
-  of RAID and LVM. I will try to give some scenarios and discuss
-  advantages and disadvantages. Note that I say LUKS for simplicity,
-  but you can do all the things described with plain dm-crypt as well.
-  Also note that your specific scenario may be so special that most
-  or even all things I say below do not apply.
+  Done.  You can now use the encrypted file system to store data.  Be sure
+  to read though the rest of the FAQ, these are just the very basics.  In
+  particular, there are a number of mistakes that are easy to make, but
+  will compromise your security.
+
+
+  * 2.2 LUKS on partitions or raw disks? What about RAID?
+
+  Also see Item 2.8.  
+  This is a complicated question, and made more so by the availability of
+  RAID and LVM.  I will try to give some scenarios and discuss advantages
+  and disadvantages.  Note that I say LUKS for simplicity, but you can do
+  all the things described with plain dm-crypt as well.  Also note that
+  your specific scenario may be so special that most or even all things I
+  say below do not apply.
 
   Be aware that if you add LVM into the mix, things can get very
-  complicated. Same with RAID but less so. In particular, data
-  recovery can get exceedingly difficult. Only do so if you have a
-  really good reason and always remember KISS is what separates an
-  engineer from an amateur. Of course, if you really need the added
-  complexity, KISS is satisfied. But be very sure as there is a price
-  to pay for it. In engineering, complexity is always the enemy and
-  needs to be fought without mercy when encountered.
+  complicated.  Same with RAID but less so.  In particular, data recovery
+  can get exceedingly difficult.  Only add LVM if you have a really good
+  reason and always remember KISS is what separates an engineer from an
+  amateur.  Of course, if you really need the added complexity, KISS is
+  satisfied.  But be very sure as there is a price to pay for it.  In
+  engineering, complexity is always the enemy and needs to be fought
+  without mercy when encountered.
 
   Also consider using RAID instead of LVM, as at least with the old
-  superblock format 0.90, the RAID superblock is in the place (end
-  of disk) where the risk of it permanently damaging the LUKS header
-  is smallest and you can have your array assembled by the RAID
-  controller (i.e. the kernel), as it should be. Use partition type
-  0xfd for that. I recommend staying away from superblock formats
-  1.0, 1.1 and 1.2 unless you really need them. Be aware that you
-  lose autodetection with them and have to fall back to some
-  user-space script to do it.
+  superblock format 0.90, the RAID superblock is in the place (end of
+  disk) where the risk of it damaging the LUKS header is smallest and you
+  can have your array assembled by the RAID controller (i.e.  the kernel),
+  as it should be.  Use partition type 0xfd for that.  I recommend staying
+  away from superblock formats 1.0, 1.1 and 1.2 unless you really need
+  them.
 
   Scenarios:
 
-  (1) Encrypted partition: Just make a partition to your liking,
-  and put LUKS on top of it and a filesystem into the LUKS container.
-  This gives you isolation of differently-tasked data areas, just as
-  ordinary partitioning does. You can have confidential data,
-  non-confidential data, data for some specific applications,
-  user-homes, root, etc. Advantages are simplicity as there is a 1:1
-  mapping between partitions and filesystems, clear security
-  functionality and the ability to separate data into different,
-  independent (!) containers.
+  (1) Encrypted partition: Just make a partition to your liking, and put
+  LUKS on top of it and a filesystem into the LUKS container.  This gives
+  you isolation of differently-tasked data areas, just as ordinary
+  partitioning does.  You can have confidential data, non-confidential
+  data, data for some specific applications, user-homes, root, etc. 
+  Advantages are simplicity as there is a 1:1 mapping between partitions
+  and filesystems, clear security functionality and the ability to
+  separate data into different, independent (!) containers.
 
   Note that you cannot do this for encrypted root, that requires an
-  initrd. On the other hand, an initrd is about as vulnerable to a
+  initrd.  On the other hand, an initrd is about as vulnerable to a
   competent attacker as a non-encrypted root, so there really is no
-  security advantage to doing it that way. An attacker that wants to
-  compromise your system will just compromise the initrd or the
-  kernel itself. The better way to deal with this is to make sure the
-  root partition does not store any critical data and move that to
-  additional encrypted partitions. If you really are concerned your
-  root partition may be sabotaged by somebody with physical access
-  (that would however strangely not, say, sabotage your BIOS,
-  keyboard, etc.), protect it in some other way. The PC is just not
-  set-up for a really secure boot-chain (whatever some people may
-  claim).
-
-  (2) Fully encrypted raw block device: For this, put LUKS on the
-  raw device (e.g. /dev/sdb) and put a filesystem into the LUKS
-  container, no partitioning whatsoever involved. This is very
-  suitable for things like external USB disks used for backups or
-  offline data-storage.
+  security advantage to doing it that way.  An attacker that wants to
+  compromise your system will just compromise the initrd or the kernel
+  itself.  The better way to deal with this is to make sure the root
+  partition does not store any critical data and to move that to
+  additional encrypted partitions.  If you really are concerned your root
+  partition may be sabotaged by somebody with physical access (who would
+  however strangely not, say, sabotage your BIOS, keyboard, etc.), protect
+  it in some other way.  The PC is just not set-up for a really secure
+  boot-chain (whatever some people may claim).
+
+  (2) Fully encrypted raw block device: For this, put LUKS on the raw
+  device (e.g.  /dev/sdb) and put a filesystem into the LUKS container, no
+  partitioning whatsoever involved.  This is very suitable for things like
+  external USB disks used for backups or offline data-storage.
 
   (3) Encrypted RAID: Create your RAID from partitions and/or full
-  devices. Put LUKS on top of the RAID device, just if it were an
-  ordinary block device. Applications are just the same as above, but
-  you get redundancy. (Side note as many people seem to be unaware of
-  it: You can do RAID1 with an arbitrary number of components in
-  Linux.) See also Item 2.8.
-
-  (4) Now, some people advocate doing the encryption below the RAID
-  layer. That has several serious problems. One is that suddenly
-  debugging RAID issues becomes much harder. You cannot do automatic
-  RAID assembly anymore. You need to keep the encryption keys for the
-  components in sync or manage them somehow. The only possible
-  advantage is that things may run a little faster as more CPUs do
-  the encryption, but if speed is a priority over security and
-  simplicity, you are doing this wrong anyways. A good way to
-  mitigate a speed issue is to get a CPU that does hardware AES.
-
-
- * 2.3 How do I set up encrypted swap?
-
-  As things that are confidential can end up in swap (keys,
-  passphrases, etc. are usually protected against being swapped to
-  disk, but other things may not be), it may be advisable to do
-  something about the issue. One option is to run without swap, which
-  generally works well in a desktop-context. It may cause problems
-  in a server-setting or under special circumstances. The solution to
-  that is to encrypt swap with a random key at boot-time.
+  devices.  Put LUKS on top of the RAID device, just if it were an
+  ordinary block device.  Applications are just the same as above, but you
+  get redundancy.  (Side note as many people seem to be unaware of it: You
+  can do RAID1 with an arbitrary number of components in Linux.) See also
+  Item 2.8.
+
+  (4) Now, some people advocate doing the encryption below the RAID layer. 
+  That has several serious problems.  One is that suddenly debugging RAID
+  issues becomes much harder.  You cannot do automatic RAID assembly
+  anymore.  You need to keep the encryption keys for the different RAID
+  components in sync or manage them somehow.  The only possible advantage
+  is that things may run a little faster as more CPUs do the encryption,
+  but if speed is a priority over security and simplicity, you are doing
+  this wrong anyways.  A good way to mitigate a speed issue is to get a
+  CPU that does hardware AES as most do today.
+
+
 * 2.3 How do I set up encrypted swap?
+
+  As things that are confidential can end up in swap (keys, passphrases,
+  etc.  are usually protected against being swapped to disk, but other
+  things may not be), it may be advisable to do something about the issue. 
+  One option is to run without swap, which generally works well in a
+  desktop-context.  It may cause problems in a server-setting or under
+  special circumstances.  The solution to that is to encrypt swap with a
+  random key at boot-time.
 
   NOTE: This is for Debian, and should work for Debian-derived
-  distributions. For others you may have to write your own startup
-  script or use other mechanisms.
-
-  01) Add the swap partition to /etc/crypttab. A line like the following
-  should do it:
-
-      swap  /dev/<partition>  /dev/urandom   swap,noearly
-  Warning: While Debian refuses to overwrite partitions with a
-  filesystem or RAID signature on it, if your disk IDs may change
-  (adding or removing disks, failure of disk during boot, etc.), you
-  may want to take additional precautions. Yes, this means that your
-  kernel device names like sda, sdb, ... can change between reboots!
-  This is not a concern if you have only one disk. One possibility is
-  to make sure the partition number is not present on additional
-  disks or also swap there. Another is to encapsulate the swap
-  partition (by making it a 1-disk RAID1 or by using LVM), so that it
-  gets a persistent identifier. Specifying it directly by UUID does
-  not work, unfortunately, as the UUID is part of the swap signature
-  and that is not visible from the outside due to the encryption and
-  in addition changes on each reboot with this setup.
-
-  Note: Use /dev/random if you are paranoid or in a potential
-  low-entropy situation (embedded system, etc.). This may cause the
-  operation to take a long time during boot. If you are in a "no
-  entropy" situation, you cannot encrypt swap securely. In this
-  situation you should find some entropy, also because nothing else
-  using crypto will be secure, like ssh, ssl or GnuPG.
-
-  Note: The "noearly" option makes sure things like LVM, RAID, etc.
-  are running. As swap is non-critical for boot, it is fine to start
-  it late.
+  distributions.  For others you may have to write your own startup script
+  or use other mechanisms.
+
+  01) Add the swap partition to /etc/crypttab. A line like the
+  following should do it:
+
+    swap  /dev/<partition>  /dev/urandom   swap,noearly
+
+  Warning: While Debian refuses to overwrite partitions with a filesystem
+  or RAID signature on it, as your disk IDs may change (adding or removing
+  disks, failure of disk during boot, etc.), you may want to take
+  additional precautions.  Yes, this means that your kernel device names
+  like sda, sdb, ...  can change between reboots!  This is not a concern
+  if you have only one disk.  One possibility is to make sure the
+  partition number is not present on additional disks or also swap there. 
+  Another is to encapsulate the swap partition (by making it a 1-partition
+  RAID1 or by using LVM), as that gets a persistent identifier. 
+  Specifying it directly by UUID does not work, unfortunately, as the UUID
+  is part of the swap signature and that is not visible from the outside
+  due to the encryption and in addition changes on each reboot with this
+  setup.
+
+  Note: Use /dev/random if you are paranoid or in a potential low-entropy
+  situation (embedded system, etc.).  This may cause the operation to take
+  a long time during boot however.  If you are in a "no entropy"
+  situation, you cannot encrypt swap securely.  In this situation you
+  should find some entropy, also because nothing else using crypto will be
+  secure, like ssh, ssl or GnuPG.
+
+  Note: The "noearly" option makes sure things like LVM, RAID, etc.  are
+  running.  As swap is non-critical for boot, it is fine to start it late.
 
   02) Add the swap partition to /etc/fstab. A line like the following
   should do it:
 
-      /dev/mapper/swap none swap sw 0 0
-  That is it. Reboot or start it manually to activate encrypted swap.
+    /dev/mapper/swap none swap sw 0 0
+
+  That is it. Reboot or start it manually to activate encrypted swap. 
   Manual start would look like this:
 
-      /etc/init.d/crypdisks start
-      swapon /dev/mapper/swap
+    /etc/init.d/crypdisks start
+    swapon /dev/mapper/swap
+
 
- * 2.4 What is the difference between "plain" and LUKS format?
 * 2.4 What is the difference between "plain" and LUKS format?
 
   First, unless you happen to understand the cryptographic background
-  well, you should use LUKS. It does protect the user from a lot of
-  common mistakes. Plain dm-crypt is for experts.
+  well, you should use LUKS.  It does protect the user from a lot of
+  common mistakes.  Plain dm-crypt is for experts.
 
   Plain format is just that: It has no metadata on disk, reads all
-  parameters from the commandline (or the defaults), derives a
-  master-key from the passphrase and then uses that to de-/encrypt
-  the sectors of the device, with a direct 1:1 mapping between
-  encrypted and decrypted sectors.
-
-  Primary advantage is high resilience to damage, as one damaged
-  encrypted sector results in exactly one damaged decrypted sector.
-  Also, it is not readily apparent that there even is encrypted data
-  on the device, as an overwrite with crypto-grade randomness (e.g.
-  from /dev/urandom) looks exactly the same on disk.
-
-  Side-note: That has limited value against the authorities. In
-  civilized countries, they cannot force you to give up a crypto-key
-  anyways. In quite a few countries around the world, they can force
-  you to give up the keys (using imprisonment or worse to pressure
-  you, sometimes without due process), and in the worst case, they
-  only need a nebulous "suspicion" about the presence of encrypted
-  data. Sometimes this applies to everybody, sometimes only when you
-  are suspected of having "illicit data" (definition subject to
-  change) and sometimes specifically when crossing a border. Note
-  that this is going on in countries like the US and the UK, to
-  different degrees and sometimes with courts restricting what the
-  authorities can actually demand.
+  parameters from the commandline (or the defaults), derives a master-key
+  from the passphrase and then uses that to de-/encrypt the sectors of the
+  device, with a direct 1:1 mapping between encrypted and decrypted
+  sectors.
+
+  Primary advantage is high resilience to damage, as one damaged encrypted
+  sector results in exactly one damaged decrypted sector.  Also, it is not
+  readily apparent that there even is encrypted data on the device, as an
+  overwrite with crypto-grade randomness (e.g.  from
+  /dev/urandom) looks exactly the same on disk.
+
+  Side-note: That has limited value against the authorities.  In civilized
+  countries, they cannot force you to give up a crypto-key anyways.  In
+  quite a few countries around the world, they can force you to give up
+  the keys (using imprisonment or worse to pressure you, sometimes without
+  due process), and in the worst case, they only need a nebulous
+  "suspicion" about the presence of encrypted data.  Sometimes this
+  applies to everybody, sometimes only when you are suspected of having
+  "illicit data" (definition subject to change) and sometimes specifically
+  when crossing a border.  Note that this is going on in countries like
+  the US and the UK to different degrees and sometimes with courts
+  restricting what the authorities can actually demand.
 
   My advice is to either be ready to give up the keys or to not have
   encrypted data when traveling to those countries, especially when
-  crossing the borders. The latter also means not having any
-  high-entropy (random) data areas on your disk, unless you can
-  explain them and demonstrate that explanation. Hence doing a
-  zero-wipe of all free space, including unused space, may be a good
-  idea.
-
-  Disadvantages are that you do not have all the nice features that
-  the LUKS metadata offers, like multiple passphrases that can be
-  changed, the cipher being stored in the metadata, anti-forensic
-  properties like key-slot diffusion and salts, etc..
-
-  LUKS format uses a metadata header and 8 key-slot areas that are
-  being placed at the beginning of the disk, see below under "What
-  does the LUKS on-disk format looks like?". The passphrases are used
-  to decrypt a single master key that is stored in the anti-forensic
-  stripes.
+  crossing the borders.  The latter also means not having any high-entropy
+  (random) data areas on your disk, unless you can explain them and
+  demonstrate that explanation.  Hence doing a zero-wipe of all free
+  space, including unused space, may be a good idea.
+
+  Disadvantages are that you do not have all the nice features that the
+  LUKS metadata offers, like multiple passphrases that can be changed, the
+  cipher being stored in the metadata, anti-forensic properties like
+  key-slot diffusion and salts, etc..
+
+  LUKS format uses a metadata header and 8 key-slot areas that are being
+  placed at the beginning of the disk, see below under "What does the LUKS
+  on-disk format looks like?".  The passphrases are used to decrypt a
+  single master key that is stored in the anti-forensic stripes.  LUKS2
+  adds some more flexibility.
 
   Advantages are a higher usability, automatic configuration of
-  non-default crypto parameters, defenses against low-entropy
-  passphrases like salting and iterated PBKDF2 passphrase hashing,
-  the ability to change passphrases, and others.
+  non-default crypto parameters, defenses against low-entropy passphrases
+  like salting and iterated PBKDF2 or ARGON 2 passphrase hashing, the
+  ability to change passphrases, and others.
 
-  Disadvantages are that it is readily obvious there is encrypted
-  data on disk (but see side note above) and that damage to the
-  header or key-slots usually results in permanent data-loss. See
-  below under "6. Backup and Data Recovery" on how to reduce that
-  risk. Also the sector numbers get shifted by the length of the
-  header and key-slots and there is a loss of that size in capacity
-  (1MB+4096B for defaults and 2MB for the most commonly used
-  non-default XTS mode).
+  Disadvantages are that it is readily obvious there is encrypted data on
+  disk (but see side note above) and that damage to the header or
+  key-slots usually results in permanent data-loss.  See below under "6. 
+  Backup and Data Recovery" on how to reduce that risk.  Also the sector
+  numbers get shifted by the length of the header and key-slots and there
+  is a loss of that size in capacity.  Unless you have a specific need,
+  use LUKS2.
 
 
- * 2.5 Can I encrypt an already existing, non-empty partition to use
-   LUKS?
+  * 2.5 Can I encrypt an existing, non-empty partition to use LUKS?
 
-  There is no converter, and it is not really needed. The way to do
-  this is to make a backup of the device in question, securely wipe
-  the device (as LUKS device initialization does not clear away old
-  data), do a luksFormat, optionally overwrite the encrypted device,
-  create a new filesystem and restore your backup on the now
-  encrypted device. Also refer to sections "Security Aspects" and
-  "Backup and Data Recovery".
+  There is no converter, and it is not really needed.  The way to do this
+  is to make a backup of the device in question, securely wipe the device
+  (as LUKS device initialization does not clear away old data), do a
+  luksFormat, optionally overwrite the encrypted device, create a new
+  filesystem and restore your backup on the now encrypted device.  Also
+  refer to sections "Security Aspects" and "Backup and Data Recovery".
 
-  For backup, plain GNU tar works well and backs up anything likely
-  to be in a filesystem.
+  For backup, plain GNU tar works well and backs up anything likely to be
+  in a filesystem.
 
 
- * 2.6 How do I use LUKS with a loop-device?
 * 2.6 How do I use LUKS with a loop-device?
 
-  This can be very handy for experiments. Setup is just the same as
-  with any block device. If you want, for example, to use a 100MiB
-  file as LUKS container, do something like this:
+  This can be very handy for experiments.  Setup is just the same as with
+  any block device.  If you want, for example, to use a 100MiB file as
+  LUKS container, do something like this:
+
+    head -c 100M /dev/zero > luksfile               # create empty file
+    losetup /dev/loop0 luksfile                     # map file to /dev/loop0
+    cryptsetup luksFormat --type luks2 /dev/loop0   # create LUKS2 container
 
-      head -c 100M /dev/zero > luksfile  # create empty file
-      losetup /dev/loop0 luksfile        # map luksfile to /dev/loop0
-      cryptsetup luksFormat /dev/loop0   # create LUKS on loop device
   Afterwards just use /dev/loop0 as a you would use a LUKS partition.
   To unmap the file when done, use "losetup -d /dev/loop0".
 
 
- * 2.7 When I add a new key-slot to LUKS, it asks for a passphrase but
-   then complains about there not being a key-slot with that
-   passphrase?
+  * 2.7 When I add a new key-slot to LUKS, it asks for a passphrase
+    but then complains about there not being a key-slot with that
+    passphrase?
 
-  That is as intended. You are asked a passphrase of an existing
-  key-slot first, before you can enter the passphrase for the new
-  key-slot. Otherwise you could break the encryption by just adding a
-  new key-slot. This way, you have to know the passphrase of one of
-  the already configured key-slots in order to be able to configure a
-  new key-slot.
+  That is as intended.  You are asked a passphrase of an existing key-slot
+  first, before you can enter the passphrase for the new key-slot. 
+  Otherwise you could break the encryption by just adding a new key-slot. 
+  This way, you have to know the passphrase of one of the already
+  configured key-slots in order to be able to configure a new key-slot.
 
 
- * 2.8 Encryption on top of RAID or the other way round?
 * 2.8 Encryption on top of RAID or the other way round?
 
+  Also see Item 2.2.  
   Unless you have special needs, place encryption between RAID and
-  filesystem, i.e. encryption on top of RAID. You can do it the other
+  filesystem, i.e.  encryption on top of RAID.  You can do it the other
   way round, but you have to be aware that you then need to give the
-  passphrase for each individual disk and RAID autodetection will
-  not work anymore. Therefore it is better to encrypt the RAID
-  device, e.g. /dev/dm0 .
+  passphrase for each individual disk and RAID auto-detection will not
+  work anymore.  Therefore it is better to encrypt the RAID device, e.g. 
+  /dev/dm0 .
 
   This means that the typical layering looks like this:
 
   Filesystem     <- top
   |
-  Encryption
+  Encryption (LUKS)
   |
   RAID
   |
-  Raw partitions
+  Raw partitions (optional)
   |
   Raw disks      <- bottom
-  The big advantage is that you can manage the RAID container just
-  like any RAID container, it does not care that what is in it is
-  encrypted.
+
+  The big advantage of this is that you can manage the RAID container just
+  like any other regular RAID container, it does not care that its content
+  is encrypted.  This strongly cuts down on complexity, something very
+  valuable with storage encryption.
 
 
- * 2.9 How do I read a dm-crypt key from file?
 * 2.9 How do I read a dm-crypt key from file?
 
   Use the --key-file option, like this:
 
-      cryptsetup create --key-file keyfile e1 /dev/loop0
-  This will read the binary key from file, i.e. no hashing or
-  transformation will be applied to the keyfile before its bits are
-  used as key. Extra bits (beyond the length of the key) at the end
-  are ignored. Note that if you read from STDIN, the data will still
-  be hashed, just as a key read interactively from the terminal. See
-  the man-page sections "NOTES ON PASSPHRASE PROCESSING..." for more
-  detail.
+    cryptsetup create --key-file keyfile e1 /dev/loop0
 
+  This will read the binary key from file, i.e.  no hashing or
+  transformation will be applied to the keyfile before its bits are used
+  as key.  Extra bits (beyond the length of the key) at the end are
+  ignored.  Note that if you read from STDIN, the data will be hashed,
+  just as a key read interactively from the terminal.  See the man-page
+  sections "NOTES ON PASSPHRASE PROCESSING..." for more detail.
 
- * 2.10 How do I read a LUKS slot key from file?
 
-  What you really do here is to read a passphrase from file, just as
-  you would with manual entry of a passphrase for a key-slot. You can
-  add a new passphrase to a free key-slot, set the passphrase of an
-  specific key-slot or put an already configured passphrase into a
-  file. In the last case make sure no trailing newline (0x0a) is
-  contained in the key file, or the passphrase will not work because
-  the whole file is used as input.
+  * 2.10 How do I read a LUKS slot key from file?
+
+  What you really do here is to read a passphrase from file, just as you
+  would with manual entry of a passphrase for a key-slot.  You can add a
+  new passphrase to a free key-slot, set the passphrase of an specific
+  key-slot or put an already configured passphrase into a file.  Make sure
+  no trailing newline (0x0a) is contained in the input key file, or the
+  passphrase will not work because the whole file is used as input.
 
   To add a new passphrase to a free key slot from file, use something
   like this:
 
-      cryptsetup luksAddKey /dev/loop0 keyfile
-  To add a new passphrase to a specific key-slot, use something like
-  this:
+    cryptsetup luksAddKey /dev/loop0 keyfile
+
+  To add a new passphrase to a specific key-slot, use something
+  like this:
+
+    cryptsetup luksAddKey --key-slot 7 /dev/loop0 keyfile
 
-      cryptsetup luksAddKey --key-slot 7 /dev/loop0 keyfile
   To supply a key from file to any LUKS command, use the --key-file
   option, e.g. like this:
 
-      cryptsetup luksOpen --key-file keyfile /dev/loop0 e1
+    cryptsetup luksOpen --key-file keyfile /dev/loop0 e1
 
- * 2.11 How do I read the LUKS master key from file?
 
-  The question you should ask yourself first is why you would want to
-  do this. The only legitimate reason I can think of is if you want
-  to have two LUKS devices with the same master key. Even then, I
-  think it would be preferable to just use key-slots with the same
-  passphrase, or to use plain dm-crypt instead. If you really have a
-  good reason, please tell me. If I am convinced, I will add how to
-  do this here.
 
+  * 2.11 How do I read the LUKS master key from file?
 
- * 2.12 What are the security requirements for a key read from file?
+  The question you should ask yourself first is why you would want to do
+  this.  The only legitimate reason I can think of is if you want to have
+  two LUKS devices with the same master key.  Even then, I think it would
+  be preferable to just use key-slots with the same passphrase, or to use
+  plain dm-crypt instead.  If you really have a good reason, please tell
+  me.  If I am convinced, I will add how to do this here.
 
-  A file-stored key or passphrase has the same security requirements
-  as one entered interactively, however you can use random bytes and
-  thereby use bytes you cannot type on the keyboard. You can use any
-  file you like as key file, for example a plain text file with a
-  human readable passphrase. To generate a file with random bytes,
-  use something like this:
 
-      head -c 256 /dev/random > keyfile
+  * 2.12 What are the security requirements for a key read from file?
+
+  A file-stored key or passphrase has the same security requirements as
+  one entered interactively, however you can use random bytes and thereby
+  use bytes you cannot type on the keyboard.  You can use any file you
+  like as key file, for example a plain text file with a human readable
+  passphrase.  To generate a file with random bytes, use something like
+  this:
 
- * 2.13 If I map a journaled file system using dm-crypt/LUKS, does it
-   still provide its usual transactional guarantees?
+    head -c 256 /dev/random > keyfile
 
-  Yes, it does, unless a very old kernel is used. The required flags
-  come from the filesystem layer and are processed and passed onwards
-  by dm-crypt. A bit more information on the process by which
-  transactional guarantees are implemented can be found here:
+
+
+  * 2.13 If I map a journaled file system using dm-crypt/LUKS, does
+    it still provide its usual transactional guarantees?
+
+  Yes, it does, unless a very old kernel is used.  The required flags come
+  from the filesystem layer and are processed and passed onward by
+  dm-crypt (regardless of direct key management or LUKS key management). 
+  A bit more information on the process by which transactional guarantees
+  are implemented can be found here:
 
   http://lwn.net/Articles/400541/
 
-  Please note that these "guarantees" are weaker than they appear to
-  be. One problem is that quite a few disks lie to the OS about
-  having flushed their buffers. Some other things can go wrong as
-  well. The filesystem developers are aware of these problems and
-  typically can make it work anyways. That said, dm-crypt/LUKS will
-  not make things worse.
-
-  One specific problem you can run into though is that you can get
-  short freezes and other slowdowns due to the encryption layer.
-  Encryption takes time and forced flushes will block for that time.
-  For example, I did run into frequent small freezes (1-2 sec) when
-  putting a vmware image on ext3 over dm-crypt. When I went back to
-  ext2, the problem went away. This seems to have gotten better with
-  kernel 2.6.36 and the reworking of filesystem flush locking
-  mechanism (less blocking of CPU activity during flushes). It
-  should improve further and eventually the problem should go away.
-
-
- * 2.14 Can I use LUKS or cryptsetup with a more secure (external)
-   medium for key storage, e.g. TPM or a smartcard?
-
-  Yes, see the answers on using a file-supplied key. You do have to
-  write the glue-logic yourself though. Basically you can have
-  cryptsetup read the key from STDIN and write it there with your
-  own tool that in turn gets the key from the more secure key
-  storage.
+  Please note that these "guarantees" are weaker than they appear to be. 
+  One problem is that quite a few disks lie to the OS about having flushed
+  their buffers.  This is likely still true with SSDs.  Some other things
+  can go wrong as well.  The filesystem developers are aware of these
+  problems and typically can make it work anyways.  That said,
+  dm-crypt/LUKS will not make things worse.
+
+  One specific problem you can run into is that you can get short freezes
+  and other slowdowns due to the encryption layer.  Encryption takes time
+  and forced flushes will block for that time.  For example, I did run
+  into frequent small freezes (1-2 sec) when putting a vmware image on
+  ext3 over dm-crypt.  When I went back to ext2, the problem went away. 
+  This seems to have gotten better with kernel 2.6.36 and the reworking of
+  filesystem flush locking mechanism (less blocking of CPU activity during
+  flushes).  This should improve further and eventually the problem should
+  go away.
+
+
+  * 2.14 Can I use LUKS or cryptsetup with a more secure (external)
+    medium for key storage, e.g. TPM or a smartcard?
+
+  Yes, see the answers on using a file-supplied key.  You do have to write
+  the glue-logic yourself though.  Basically you can have cryptsetup read
+  the key from STDIN and write it there with your own tool that in turn
+  gets the key from the more secure key storage.
 
   For TPM support, you may want to have a look at tpm-luks at
-  https://github.com/shpedoikal/tpm-luks. Note that tpm-luks is not
+  https://github.com/shpedoikal/tpm-luks.  Note that tpm-luks is not
   related to the cryptsetup project.
 
 
- * 2.15 Can I resize a dm-crypt or LUKS partition?
+  * 2.15 Can I resize a dm-crypt or LUKS container?
+
+  Yes, you can, as neither dm-crypt nor LUKS1 stores partition size and
+  LUKS2 uses a generic "whole device" size as default.  Note that LUKS2
+  can use specified data-area sizes as a non-standard case and that these
+  may cause issues when resizing a LUKS2 container if set to a specific
+  value.
 
-  Yes, you can, as neither dm-crypt nor LUKS stores partition size.
-  Whether you should is a different question. Personally I recommend
-  backup, recreation of the encrypted partition with new size,
-  recreation of the filesystem and restore. This gets around the
-  tricky business of resizing the filesystem. Resizing a dm-crypt or
-  LUKS container does not resize the filesystem in it. The backup is
-  really non-optional here, as a lot can go wrong, resulting in
-  partial or complete data loss. Using something like gparted to
-  resize an encrypted partition is slow, but typically works. This
-  will not change the size of the filesystem hidden under the
-  encryption though.
+  Whether you should do this is a different question.  Personally I
+  recommend backup, recreation of the dm-crypt or LUKS container with new
+  size, recreation of the filesystem and restore.  This gets around the
+  tricky business of resizing the filesystem.  Resizing a dm-crypt or LUKS
+  container does not resize the filesystem in it.  A backup is really
+  non-optional here, as a lot can go wrong, resulting in partial or
+  complete data loss.  But if you have that backup, you can also just
+  recreate everything.
 
-  You also need to be aware of size-based limitations. The one
-  currently relevant is that aes-xts-plain should not be used for
-  encrypted container sizes larger than 2TiB. Use aes-xts-plain64
-  for that.
+  You also need to be aware of size-based limitations.  The one currently
+  relevant is that aes-xts-plain should not be used for encrypted
+  container sizes larger than 2TiB.  Use aes-xts-plain64 for that.
 
 
- * 2.16 How do I Benchmark the Ciphers, Hashes and Modes?
 * 2.16 How do I Benchmark the Ciphers, Hashes and Modes?
 
-  Since version 1.60 cryptsetup supports the "benchmark" command.
+  Since version 1.60 cryptsetup supports the "benchmark" command. 
   Simply run as root:
 
-   cryptsetup benchmark
-  It will output first iterations/second for the key-derivation
-  function PBKDF2 parameterized with different hash-functions, and
-  then the raw encryption speed of ciphers with different modes and
-  key-sizes. You can get more than the default benchmarks, see the
-  man-page for the relevant parameters. Note that XTS mode takes two
-  keys, hence the listed key sizes are double that for other modes
-  and half of it is the cipher key, the other half is the XTS key.
-
-
- * 2.17 How do I Verify I have an Authentic cryptsetup Source Package?
-
-  Current maintainer is Milan Broz and he signs the release packages
-  with his PGP key. The key he currently uses is the "RSA key ID
-  D93E98FC", fingerprint 2A29 1824 3FDE 4664 8D06 86F9 D9B0 577B
-  D93E 98FC. While I have every confidence this really is his key and
-  that he is who he claims to be, don't depend on it if your life is
-  at stake. For that matter, if your life is at stake, don't depend
-  on me being who I claim to be either.
-
-  That said, as cryptsetup is under good version control, a malicious
-  change should be noticed sooner or later, but it may take a while.
-  Also, the attacker model makes compromising the sources in a
-  non-obvious way pretty hard. Sure, you could put the master-key
-  somewhere on disk, but that is rather obvious as soon as somebody
-  looks as there would be data in an empty LUKS container in a place
-  it should not be. Doing this in a more nefarious way, for example
-  hiding the master-key in the salts, would need a look at the
-  sources to be discovered, but I think that somebody would find that
-  sooner or later as well.
-
-  That said, this discussion is really a lot more complicated and
-  longer as an FAQ can sustain. If in doubt, ask on the mailing list.
-
-
- * 2.18 Is there a concern with 4k Sectors?
-
-  Not from dm-crypt itself. Encryption will be done in 512B blocks,
-  but if the partition and filesystem are aligned correctly and the
-  filesystem uses multiples of 4kiB as block size, the dm-crypt layer
-  will just process 8 x 512B = 4096B at a time with negligible
-  overhead. LUKS does place data at an offset, which is 2MiB per
-  default and will not break alignment. See also Item 6.12 of this
-  FAQ for more details. Note that if your partition or filesystem is
-  misaligned, dm-crypt can make the effect worse though.
-
-
- * 2.19 How can I wipe a device with crypto-grade randomness?
-
-  The conventional recommendation if you want to not just do a
+    cryptsetup benchmark
+
+  You can get more than the default benchmarks, see the man-page for the
+  relevant parameters.  Note that XTS mode takes two keys, hence the
+  listed key sizes are double that for other modes and half of it is the
+  cipher key, the other half is the XTS key.
+
+
+  * 2.17 How do I Verify I have an Authentic cryptsetup Source Package?
+
+  Current maintainer is Milan Broz and he signs the release packages with
+  his PGP key.  The key he currently uses is the "RSA key ID D93E98FC",
+  fingerprint 2A29 1824 3FDE 4664 8D06 86F9 D9B0 577B D93E 98FC.  While I
+  have every confidence this really is his key and that he is who he
+  claims to be, don't depend on it if your life is at stake.  For that
+  matter, if your life is at stake, don't depend on me being who I claim
+  to be either.
+
+  That said, as cryptsetup is under good version control and a malicious
+  change should be noticed sooner or later, but it may take a while. 
+  Also, the attacker model makes compromising the sources in a non-obvious
+  way pretty hard.  Sure, you could put the master-key somewhere on disk,
+  but that is rather obvious as soon as somebody looks as there would be
+  data in an empty LUKS container in a place it should not be.  Doing this
+  in a more nefarious way, for example hiding the master-key in the salts,
+  would need a look at the sources to be discovered, but I think that
+  somebody would find that sooner or later as well.
+
+  That said, this discussion is really a lot more complicated and longer
+  as an FAQ can sustain.  If in doubt, ask on the mailing list.
+
+
+  * 2.18 Is there a concern with 4k Sectors?
+
+  Not from dm-crypt itself.  Encryption will be done in 512B blocks, but
+  if the partition and filesystem are aligned correctly and the filesystem
+  uses multiples of 4kiB as block size, the dm-crypt layer will just
+  process 8 x 512B = 4096B at a time with negligible overhead.  LUKS does
+  place data at an offset, which is 2MiB per default and will not break
+  alignment.  See also Item 6.12 of this FAQ for more details.  Note that
+  if your partition or filesystem is misaligned, dm-crypt can make the
+  effect worse though.  Also note that SSDs typically have much larger
+  blocks internally (e.g.  128kB or even larger).
+
+
+  * 2.19 How can I wipe a device with crypto-grade randomness?
+
+  The conventional recommendation if you want to do more than just a
   zero-wipe is to use something like
 
-  cat /dev/urandom >  <taget-device>
-  That is very slow and painful at 10-20MB/s on a fast computer.
-  Using cryptsetup and a plain dm-crypt device with a random key, it
-  is much faster and gives you the same level of security. The
+    cat /dev/urandom >  <taget-device>
+
+  That used to very slow and painful at 10-20MB/s on a fast computer, but
+  newer kernels can give you > 200MB/s (depending on hardware).  An
+  alternative is using cryptsetup and a plain dm-crypt device with a
+  random key, which is fast and on the same level of security.  The
   defaults are quite enough.
 
   For device set-up, do the following:
 
-  cryptsetup open --type plain -d /dev/urandom /dev/<block-device>  to_be_wiped
-  Then you have several options. Simple wipe without
-  progress-indicator:
+    cryptsetup open --type plain -d /dev/urandom /dev/<device> target
+
+  This maps the container as plain under /dev/mapper/target with a random
+  password.  For the actual wipe you have several options.  Basically, you
+  pipe zeroes into the opened container that then get encrypted.  Simple
+  wipe without progress-indicator:
+
+    cat /dev/zero > /dev/mapper/to_be_wiped
 
-  cat /dev/zero > /dev/mapper/to_be_wiped
   Progress-indicator by dd_rescue:
 
-  dd_rescue -w /dev/zero /dev/mapper/to_be_wiped
+    dd_rescue -w /dev/zero /dev/mapper/to_be_wiped
+
   Progress-indicator by my "wcs" stream meter (available from
   http://www.tansi.org/tools/index.html ):
 
-  cat /dev/zero | wcs > /dev/mapper/to_be_wiped
+    cat /dev/zero | wcs > /dev/mapper/to_be_wiped
+
+  Or use plain "dd", which gives you the progress when sent a SIGUSR1, see
+  the dd man page.
+
   Remove the mapping at the end and you are done.
 
 
-3. Common Problems 
+  * 2.20 How to I wipe only the LUKS header?
+
+  This does _not_ describe an emergency wipe procedure, see Item 5.4 for
+  that.  This procedure here is intended to be used when the data should
+  stay intact, e.g.  when you change your LUKS container to use a detached
+  header and want to remove the old one.  Please only do this if you have
+  a current backup.
+
+  LUKS1:  
+  01) Determine header size in 512 Byte sectors with luksDump:
+
+     cryptsetup luksDump <device with LUKS container>
+
+->   ...
+     Payload offset: <number>
+     ...
+
+  02) Take the result number, multiply by 512 zeros and write to 
+      the start of the device, e.g. like this:
+
+     dd bs=512 count=<number> if=/dev/zero of=<device>
+
 
+  LUKS2:  (warning, untested!  Remember that backup?) This assumes the
+  LUKS2 container uses the defaults, in particular there is only one data
+  segment.  01) Determine the data-segment offset using luksDump, same
+      as above for LUKS1:
 
- * 3.1 My dm-crypt/LUKS mapping does not work! What general steps are
-   there to investigate the problem?
+->   ...  
+     Data segments:
+        0: crypt
+           offset: <number> [bytes]
+     ...
 
-  If you get a specific error message, investigate what it claims
-  first. If not, you may want to check the following things.
+  02) Overwrite the stated number of bytes from the start of the device.
+      Just to give yet another way to get a defined number of zeros:
 
-  - Check that "/dev", including "/dev/mapper/control" is there. If it
-  is missing, you may have a problem with the "/dev" tree itself or
-  you may have broken udev rules.
+    head -c /dev/zero > /dev/<device>
+
+
+3. Common Problems
+
+
+  * 3.1 My dm-crypt/LUKS mapping does not work! What general steps
+    are there to investigate the problem?
+
+  If you get a specific error message, investigate what it claims first. 
+  If not, you may want to check the following things.
+
+  - Check that "/dev", including "/dev/mapper/control" is there.  If it is
+  missing, you may have a problem with the "/dev" tree itself or you may
+  have broken udev rules.
 
   - Check that you have the device mapper and the crypt target in your
-  kernel. The output of "dmsetup targets" should list a "crypt"
-  target. If it is not there or the command fails, add device mapper
-  and crypt-target to the kernel.
+  kernel.  The output of "dmsetup targets" should list a "crypt" target. 
+  If it is not there or the command fails, add device mapper and
+  crypt-target to the kernel.
 
-  - Check that the hash-functions and ciphers you want to use are in
-  the kernel. The output of "cat /proc/crypto" needs to list them.
+  - Check that the hash-functions and ciphers you want to use are in the
+  kernel.  The output of "cat /proc/crypto" needs to list them.
 
 
- * 3.2 My dm-crypt mapping suddenly stopped when upgrading cryptsetup.
 * 3.2 My dm-crypt mapping suddenly stopped when upgrading cryptsetup.
 
-  The default cipher, hash or mode may have changed (the mode changed
-  from 1.0.x to 1.1.x). See under "Issues With Specific Versions of
+  The default cipher, hash or mode may have changed (the mode changed from
+  1.0.x to 1.1.x).  See under "Issues With Specific Versions of
   cryptsetup".
 
 
- * 3.3 When I call cryptsetup from cron/CGI, I get errors about
-   unknown features?
 * 3.3 When I call cryptsetup from cron/CGI, I get errors about
+    unknown features?
 
   If you get errors about unknown parameters or the like that are not
-  present when cryptsetup is called from the shell, make sure you
-  have no older version of cryptsetup on your system that then gets
-  called by cron/CGI. For example some distributions install
-  cryptsetup into /usr/sbin, while a manual install could go to
-  /usr/local/sbin. As a debugging aid, call "cryptsetup --version"
-  from cron/CGI or the non-shell mechanism to be sure the right
-  version gets called.
-
-
- * 3.4 Unlocking a LUKS device takes very long. Why?
-
-  The iteration time for a key-slot (see Section 5 for an explanation
-  what iteration does) is calculated when setting a passphrase. By
-  default it is 1 second on the machine where the passphrase is set.
-  If you set a passphrase on a fast machine and then unlock it on a
-  slow machine, the unlocking time can be much longer. Also take into
-  account that up to 8 key-slots have to be tried in order to find the
-  right one.
-
-  If this is problem, you can add another key-slot using the slow
-  machine with the same passphrase and then remove the old key-slot.
-  The new key-slot will have an iteration count adjusted to 1 second
-  on the slow machine. Use luksKeyAdd and then luksKillSlot or
-  luksRemoveKey.
-
-  However, this operation will not change volume key iteration count
-  (MK iterations in output of "cryptsetup luksDump"). In order to
-  change that, you will have to backup the data in the LUKS
-  container (i.e. your encrypted data), luksFormat on the slow
-  machine and restore the data. Note that in the original LUKS
-  specification this value was fixed to 10, but it is now derived
-  from the PBKDF2 benchmark as well and set to iterations in 0.125
-  sec or 1000, whichever is larger. Also note that MK iterations
-  are not very security relevant. But as each key-slot already takes
-  1 second, spending the additional 0.125 seconds really does not
-  matter.
-
-
- * 3.5 "blkid" sees a LUKS UUID and an ext2/swap UUID on the same
-   device. What is wrong?
-
-  Some old versions of cryptsetup have a bug where the header does
-  not get completely wiped during LUKS format and an older ext2/swap
-  signature remains on the device. This confuses blkid.
+  present when cryptsetup is called from the shell, make sure you have no
+  older version of cryptsetup on your system that then gets called by
+  cron/CGI.  For example some distributions install cryptsetup into
+  /usr/sbin, while a manual install could go to /usr/local/sbin.  As a
+  debugging aid, call "cryptsetup --version" from cron/CGI or the
+  non-shell mechanism to be sure the right version gets called.
+
+
+  * 3.4 Unlocking a LUKS device takes very long. Why?
+
+  The unlock time for a key-slot (see Section 5 for an explanation what
+  iteration does) is calculated when setting a passphrase.  By default it
+  is 1 second (2 seconds for LUKS2).  If you set a passphrase on a fast
+  machine and then unlock it on a slow machine, the unlocking time can be
+  much longer.  Also take into account that up to 8 key-slots (LUKS2: up
+  to 32 key-slots) have to be tried in order to find the right one.
+
+  If this is problem, you can add another key-slot using the slow machine
+  with the same passphrase and then remove the old key-slot.  The new
+  key-slot will have the unlock time adjusted to the slow machine.  Use
+  luksKeyAdd and then luksKillSlot or luksRemoveKey.  You can also use 
+  the -i option to reduce iteration time (and security level) when setting 
+  a passphrase.  Default is 1000 (1 sec) for LUKS1 and 2000 (2sec) for
+  LUKS2.
+
+  However, this operation will not change volume key iteration count ("MK
+  iterations" for LUKS1, "Iterations" under "Digests" for LUKS2).  In
+  order to change that, you will have to backup the data in the LUKS
+  container (i.e.  your encrypted data), luksFormat on the slow machine
+  and restore the data.  Note that MK iterations are not very security
+  relevant.
+
+
+  * 3.5 "blkid" sees a LUKS UUID and an ext2/swap UUID on the same
+    device. What is wrong?
+
+  Some old versions of cryptsetup have a bug where the header does not get
+  completely wiped during LUKS format and an older ext2/swap signature
+  remains on the device.  This confuses blkid.
 
   Fix: Wipe the unused header areas by doing a backup and restore of
-  the header with cryptsetup 1.1.x:
+  the header with cryptsetup 1.1.x or later:
 
-      cryptsetup luksHeaderBackup --header-backup-file <file> <device>
-      cryptsetup luksHeaderRestore --header-backup-file <file> <device>
+    cryptsetup luksHeaderBackup --header-backup-file <file> <device>
+    cryptsetup luksHeaderRestore --header-backup-file <file> <device>
 
- * 3.6 cryptsetup segfaults on Gentoo amd64 hardened ...
 
-  There seems to be some interference between the hardening and and
-  the way cryptsetup benchmarks PBKDF2. The solution to this is
-  currently not quite clear for an encrypted root filesystem.     For
-  other uses, you can apparently specify USE="dynamic" as compile
-  flag, see http://bugs.gentoo.org/show_bug.cgi?id=283470
 
-
-4. Troubleshooting 
+4. Troubleshooting
 
 
- * 4.1 I get the error "LUKS keyslot x is invalid." What does that
-   mean?
+  * 4.1 I get the error "LUKS keyslot x is invalid." What does that mean?
 
-  This means that the given keyslot has an offset that points
-  outside the valid keyslot area. Typically, the reason is a
-  corrupted LUKS header because something was written to the start of
-  the device the LUKS container is on. Refer to Section "Backup and
-  Data Recovery" and ask on the mailing list if you have trouble
-  diagnosing and (if still possible) repairing this.
+  For LUKS1, this means that the given keyslot has an offset that points
+  outside the valid keyslot area.  Typically, the reason is a corrupted
+  LUKS1 header because something was written to the start of the device
+  the LUKS1 container is on.  For LUKS2, I do not know when this error can
+  happen, but I expect it will be something similar.  Refer to Section
+  "Backup and Data Recovery" and ask on the mailing list if you have
+  trouble diagnosing and (if still possible) repairing this.
 
 
- * 4.2 I cannot unlock my LUKS container! What could be the problem?
 * 4.2 I cannot unlock my LUKS container! What could be the problem?
 
-  First, make sure you have a correct passphrase. Then make sure you
-  have the correct key-map and correct keyboard. And then make sure
-  you have the correct character set and encoding, see also
-  "PASSPHRASE CHARACTER SET" under Section 1.2.
+  First, make sure you have a correct passphrase.  Then make sure you have
+  the correct key-map and correct keyboard.  And then make sure you have
+  the correct character set and encoding, see also "PASSPHRASE CHARACTER
+  SET" under Section 1.2.
 
   If you are sure you are entering the passphrase right, there is the
-  possibility that the respective key-slot has been damaged. There
-  is no way to recover a damaged key-slot, except from a header
-  backup (see Section 6). For security reasons, there is also no
-  checksum in the key-slots that could tell you whether a key-slot has
-  been damaged. The only checksum present allows recognition of a
-  correct passphrase, but that only works if the passphrase is
-  correct and the respective key-slot is intact.
-
-  In order to find out whether a key-slot is damaged one has to look
-  for "non-random looking" data in it. There is a tool that
-  automatizes this in the cryptsetup distribution from version 1.6.0
-  onwards. It is located in misc/keyslot_checker/. Instructions how
-  to use and how to interpret results are in the README file. Note
-  that this tool requires a libcryptsetup from cryptsetup 1.6.0 or
-  later (which means libcryptsetup.so.4.5.0 or later). If the tool
-  complains about missing functions in libcryptsetup, you likely
-  have an earlier version from your distribution still installed. You
-  can either point the symbolic link(s) from libcryptsetup.so.4 to
-  the new version manually, or you can uninstall the distribution
-  version of cryptsetup and re-install that from cryptsetup >= 1.6.0
-  again to fix this.
-
-
- * 4.3 Can a bad RAM module cause problems?
+  possibility that the respective key-slot has been damaged.  There is no
+  way to recover a damaged key-slot, except from a header backup (see
+  Section 6).  For security reasons, there is also no checksum in the
+  key-slots that could tell you whether a key-slot has been damaged.  The
+  only checksum present allows recognition of a correct passphrase, but
+  that only works with that correct passphrase and a respective key-slot
+  that is intact.
+
+  In order to find out whether a key-slot is damaged one has to look for
+  "non-random looking" data in it.  There is a tool that automatizes this
+  for LUKS1 in the cryptsetup distribution from version 1.6.0 onwards.  It
+  is located in misc/keyslot_checker/.  Instructions how to use and how to
+  interpret results are in the README file.  Note that this tool requires
+  a libcryptsetup from cryptsetup 1.6.0 or later (which means
+  libcryptsetup.so.4.5.0 or later).  If the tool complains about missing
+  functions in libcryptsetup, you likely have an earlier version from your
+  distribution still installed.  You can either point the symbolic link(s)
+  from libcryptsetup.so.4 to the new version manually, or you can
+  uninstall the distribution version of cryptsetup and re-install that
+  from cryptsetup >= 1.6.0 again to fix this.
+
+
+  * 4.3 Can a bad RAM module cause problems?
 
   LUKS and dm-crypt can give the RAM quite a workout, especially when
-  combined with software RAID. In particular the combination RAID5 +
-  LUKS + XFS seems to uncover RAM problems that never caused obvious
-  problems before. Symptoms vary, but often the problem manifest
+  combined with software RAID.  In particular the combination RAID5 +
+  LUKS1 + XFS seems to uncover RAM problems that do not cause obvious
+  problems otherwise.  Symptoms vary, but often the problem manifest
   itself when copying large amounts of data, typically several times
   larger than your main memory.
 
-  Side note: One thing you should always do on large data
-  copy/movements is to run a verify, for example with the "-d"
-  option of "tar" or by doing a set of MD5 checksums on the source
-  or target with
+  Note: One thing you should always do on large data copying or movements
+  is to run a verify, for example with the "-d" option of "tar" or by
+  doing a set of MD5 checksums on the source or target with
 
-      find . -type f -exec md5sum \{\} \; > checksum-file
-  and then a "md5sum -c checksum-file" on the other side. If you get
-  mismatches here, RAM is the primary suspect. A lesser suspect is
-  an overclocked CPU. I have found countless hardware problems in
-  verify runs after copying or making backups. Bit errors are much
-  more common than most people think.
+    find . -type f -exec md5sum \{\} \; > checksum-file
+
+  and then a "md5sum -c checksum-file" on the other side.  If you get
+  mismatches here, RAM is the primary suspect.  A lesser suspect is an
+  overclocked CPU.  I have found countless hardware problems in verify
+  runs after copying data or making backups.  Bit errors are much more
+  common than most people think.
 
   Some RAM issues are even worse and corrupt structures in one of the
-  layers. This typically results in lockups, CPU state dumps in the
-  system logs, kernel panic or other things. It is quite possible to
-  have the problem with an encrypted device, but not with an
-  otherwise the same unencrypted device. The reason for that is that
-  encryption has an error amplification property: You flip one bit
-  in an encrypted data block, and the decrypted version has half of
-  its bits flipped. This is an important security property for modern
-  ciphers. With the usual modes in cryptsetup (CBC, ESSIV, XTS), you
-  get up to a completely changed 512 byte block per bit error. A
-  corrupt block causes a lot more havoc than the occasionally
-  flipped single bit and can result in various obscure errors.
-
-  Note, that a verify run on copying between encrypted or
-  unencrypted devices will reliably detect corruption, even when the
-  copying itself did not report any problems. If you find defect
-  RAM, assume all backups and copied data to be suspect, unless you
-  did a verify.
-
-
- * 4.4 How do I test RAM?
-
-  First you should know that overclocking often makes memory
-  problems worse. So if you overclock (which I strongly recommend
-  against in a system holding data that has some worth), run the
-  tests with the overclocking active.
-
-  There are two good options. One is Memtest86+ and the other is
-  "memtester" by Charles Cazabon. Memtest86+ requires a reboot and
-  then takes over the machine, while memtester runs from a
-  root-shell. Both use different testing methods and I have found
-  problems fast with each one that the other needed long to find. I
-  recommend running the following procedure until the first error is
-  found:
+  layers.  This typically results in lockups, CPU state dumps in the
+  system logs, kernel panic or other things.  It is quite possible to have
+  a problem with an encrypted device, but not with an otherwise the same
+  unencrypted device.  The reason for that is that encryption has an error
+  amplification property: If you flip one bit in an encrypted data block,
+  the decrypted version has half of its bits flipped.  This is actually an
+  important security property for modern ciphers.  With the usual modes in
+  cryptsetup (CBC, ESSIV, XTS), you can get a completely changed 512 byte
+  block for a bit error.  A corrupt block causes a lot more havoc than the
+  occasionally flipped single bit and can result in various obscure
+  errors.
+
+  Note that a verify run on copying between encrypted or unencrypted
+  devices will reliably detect corruption, even when the copying itself
+  did not report any problems.  If you find defect RAM, assume all backups
+  and copied data to be suspect, unless you did a verify.
+
+
+  * 4.4 How do I test RAM?
+
+  First you should know that overclocking often makes memory problems
+  worse.  So if you overclock (which I strongly recommend against in a
+  system holding data that has any worth), run the tests with the
+  overclocking active.
+
+  There are two good options.  One is Memtest86+ and the other is
+  "memtester" by Charles Cazabon.  Memtest86+ requires a reboot and then
+  takes over the machine, while memtester runs from a root-shell.  Both
+  use different testing methods and I have found problems fast with either
+  one that the other needed long to find.  I recommend running the
+  following procedure until the first error is found:
 
   - Run Memtest86+ for one cycle
 
   - Run memtester for one cycle (shut down as many other applications
-  as possible)
+    as possible and use the largest memory area you can get)
 
   - Run Memtest86+ for 24h or more
 
   - Run memtester for 24h or more
 
   If all that does not produce error messages, your RAM may be sound,
-  but I have had one weak bit that Memtest86+ needed around 60 hours
-  to find. If you can reproduce the original problem reliably, a good
-  additional test may be to remove half of the RAM (if you have more
-  than one module) and try whether the problem is still there and if
-  so, try with the other half. If you just have one module, get a
-  different one and try with that. If you do overclocking, reduce
-  the settings to the most conservative ones available and try with
-  that.
+  but I have had one weak bit in the past that Memtest86+ needed around 
+  60 hours to find.  If you can reproduce the original problem reliably, 
+  a good additional test may be to remove half of the RAM (if you have 
+  more than one module) and try whether the problem is still there and if
+  so, try with the other half.  If you just have one module, get a
+  different one and try with that.  If you do overclocking, reduce the
+  settings to the most conservative ones available and try with that.
 
 
-5. Security Aspects 
+  * 4.5 Is there a risk using debugging tools like strace?
 
+  There most definitely is. A dump from strace and friends can contain
+  all data entered, including the full passphrase.  Example with strace
+  and passphrase "test":
 
- * 5.1 How long is a secure passphrase ?
+    > strace cryptsetup luksOpen /dev/sda10 c1
+    ...
+    read(6, "test\n", 512)                  = 5
+    ...
 
-  This is just the short answer. For more info and explanation of
-  some of the terms used in this item, read the rest of Section 5.
-  The actual recommendation is at the end of this item.
+  Depending on different factors and the tool used, the passphrase may
+  also be encoded and not plainly visible.  Hence it is never a good idea
+  to give such a trace from a live container to anybody.  Recreate the
+  problem with a test container or set a temporary passphrase like "test"
+  and use that for the trace generation.  Item 2.6 explains how to create
+  a loop-file backed LUKS container that may come in handy for this
+  purpose.
 
-  First, passphrase length is not really the right measure,
-  passphrase entropy is. For example, a random lowercase letter (a-z)
-  gives you 4.7 bit of entropy, one element of a-z0-9 gives you 5.2
-  bits of entropy, an element of a-zA-Z0-9 gives you 5.9 bits and
-  a-zA-Z0-9!@#$%^&:-+ gives you 6.2 bits. On the other hand, a random
-  English word only gives you 0.6...1.3 bits of entropy per
-  character. Using sentences that make sense gives lower entropy,
-  series of random words gives higher entropy. Do not use sentences
-  that can be tied to you or found on your computer. This type of
-  attack is done routinely today.
+  See also Item 6.10 for another set of data you should not give to
+  others.
 
-  That said, it does not matter too much what scheme you use, but it
-  does matter how much entropy your passphrase contains, because an
-  attacker has to try on average
 
-      1/2 * 2^(bits of entropy in passphrase)    
+5. Security Aspects
+
+
+  * 5.1 How long is a secure passphrase ?
+
+  This is just the short answer.  For more info and explanation of some of
+  the terms used in this item, read the rest of Section 5.  The actual
+  recommendation is at the end of this item.
+
+  First, passphrase length is not really the right measure, passphrase
+  entropy is.  If your passphrase is 200 times the letter "a", it is long
+  but has very low entropy and is pretty insecure.
+
+  For example, a random lowercase letter (a-z) gives you 4.7 bit of
+  entropy, one element of a-z0-9 gives you 5.2 bits of entropy, an element
+  of a-zA-Z0-9 gives you 5.9 bits and a-zA-Z0-9!@#$%\^&:-+ gives you 6.2
+  bits.  On the other hand, a random English word only gives you 0.6...1.3
+  bits of entropy per character.  Using sentences that make sense gives
+  lower entropy, series of random words gives higher entropy.  Do not use
+  sentences that can be tied to you or found on your computer.  This type
+  of attack is done routinely today.
+
+  That said, it does not matter too much what scheme you use, but it does
+  matter how much entropy your passphrase contains, because an attacker
+  has to try on average
+
+    1/2 * 2^(bits of entropy in passphrase)
+
   different passphrases to guess correctly.
 
-  Historically, estimations tended to use computing time estimates,
-  but more modern approaches try to estimate cost of guessing a
-  passphrase.
+  Historically, estimations tended to use computing time estimates, but
+  more modern approaches try to estimate cost of guessing a passphrase.
 
   As an example, I will try to get an estimate from the numbers in
-  http://it.slashdot.org/story/12/12/05/0623215/new-25-gpu-monster-devours-strong-passwords-in-minutes
-  More references can be found a the end of this document. Note that
-  these are estimates from the defender side, so assuming something
-  is easier than it actually is is fine. An attacker may still have
-  vastly higher cost than estimated here.
-
-  LUKS uses SHA1 for hashing per default. The claim in the reference
-  is 63 billion tries/second for SHA1. We will leave aside the check
-  whether a try actually decrypts a key-slot. Now, the machine has 25
-  GPUs, which I will estimate at an overall lifetime cost of USD/EUR
-  1000 each, and an useful lifetime of 2 years. (This is on the low
-  side.) Disregarding downtime, the machine can then break
-
-     N = 63*10^9 * 3600 * 24 * 365 * 2 ~ 4*10^18     
-   
-  passphrases for EUR/USD 25k. That is one 62 bit passphrase hashed
-  once with SHA1 for EUR/USD 25k. Note that as this can be
-  parallelized, it can be done faster than 2 years with several of
-  these machines.
-
-  For plain dm-crypt (no hash iteration) this is it. This gives (with
-  SHA1, plain dm-crypt default is ripemd160 which seems to be
-  slightly slower than SHA1):
-
-    Passphrase entropy  Cost to break  
-    60 bit              EUR/USD     6k  
+  https://gist.github.com/epixoip/a83d38f412b4737e99bbef804a270c40 This
+  thing costs 23kUSD and does 68Ghashes/sec for SHA1.  This is in 2017.
+  Incidentally, my older calculation for a machine around 1000 times
+  slower was off by a factor of about 1000, but in the right direction,
+  i.e.  I estimated the attack to be too easy.  Nobody noticed ;-) On the
+  plus side, the tables are now (2017) pretty much accurate.
+
+  More references can be found a the end of this document.  Note that
+  these are estimates from the defender side, so assuming something is
+  easier than it actually is is fine.  An attacker may still have
+  significantly higher cost than estimated here.
+
+  LUKS1 used SHA1 (since version 1.7.0 it uses SHA256) for hashing per
+  default.  We will leave aside the check whether a try actually decrypts 
+  a key-slot.  I will assume a useful lifetime of the hardware of 2 years. 
+  (This is on the low side.) Disregarding downtime, the machine can then
+  break
+
+     N = 68*10^9 * 3600 * 24 * 365 * 2 ~ 4*10^18
+
+  passphrases for EUR/USD 23k.  That is one 62 bit passphrase hashed once
+  with SHA1 for EUR/USD 23k.  This can be parallelized, it can be done
+  faster than 2 years with several of these machines.
+
+  For LUKS2, things look a bit better, as the advantage of using graphics
+  cards is massively reduced.  Using the recommendations below should
+  hence be fine for LUKS2 as well and give a better security margin.
+
+  For plain dm-crypt (no hash iteration) this is it.  This gives (with
+  SHA1, plain dm-crypt default is ripemd160 which seems to be slightly
+  slower than SHA1):
+
+    Passphrase entropy  Cost to break
+    60 bit              EUR/USD     6k
     65 bit              EUR/USD   200K
     70 bit              EUR/USD     6M
     75 bit              EUR/USD   200M
     80 bit              EUR/USD     6B
     85 bit              EUR/USD   200B
-    ...                      ...    
-  For LUKS, you have to take into account hash iteration in PBKDF2.
-  For a current CPU, there are about 100k iterations (as can be
-  queried with ''cryptsetup luksDump''.
+    ...                      ...
+
+
+  For LUKS1, you have to take into account hash iteration in PBKDF2. 
+  For a current CPU, there are about 100k iterations (as can be queried
+  with ''cryptsetup luksDump''. 
 
   The table above then becomes:
 
-    Passphrase entropy  Cost to break 
-    50 bit              EUR/USD   600k 
+    Passphrase entropy  Cost to break
+    50 bit              EUR/USD   600k
     55 bit              EUR/USD    20M
-    60 bit              EUR/USD   600M  
+    60 bit              EUR/USD   600M
     65 bit              EUR/USD    20B
     70 bit              EUR/USD   600B
     75 bit              EUR/USD    20T
-    ...                      ...    
+    ...                      ...
+
+
   Recommendation:
 
-  To get reasonable security for the next 10 years, it is a good idea
+  To get reasonable security for the  next 10 years, it is a good idea
   to overestimate by a factor of at least 1000.
 
-  Then there is the question of how much the attacker is willing to
-  spend. That is up to your own security evaluation. For general use,
-  I will assume the attacker is willing to spend up to 1 million
-  EUR/USD. Then we get the following recommendations:
+  Then there is the question of how much the attacker is willing to spend. 
+  That is up to your own security evaluation.  For general use, I will
+  assume the attacker is willing to spend up to 1 million EUR/USD.  Then
+  we get the following recommendations:
 
   Plain dm-crypt: Use > 80 bit. That is e.g. 17 random chars from a-z
   or a random English sentence of > 135 characters length.
 
-  LUKS: Use > 65 bit. That is e.g. 14 random chars from a-z or a
-  random English sentence of > 108 characters length.
+  LUKS1 and LUKS2: Use > 65 bit. That is e.g. 14 random chars from a-z 
+  or a random English sentence of > 108 characters length.
 
   If paranoid, add at least 20 bit. That is roughly four additional
   characters for random passphrases and roughly 32 characters for a
-  random English sentence.
-
-
- * 5.2 Is LUKS insecure? Everybody can see I have encrypted data!
-
-  In practice it does not really matter. In most civilized countries
-  you can just refuse to hand over the keys, no harm done. In some
-  countries they can force you to hand over the keys, if they suspect
-  encryption. However the suspicion is enough, they do not have to
-  prove anything. This is for practical reasons, as even the presence
-  of a header (like the LUKS header) is not enough to prove that you
-  have any keys. It might have been an experiment, for example. Or it
-  was used as encrypted swap with a key from /dev/random. So they
-  make you prove you do not have encrypted data. Of course that is
-  just as impossible as the other way round.
-
-  This means that if you have a large set of random-looking data,
-  they can already lock you up. Hidden containers (encryption hidden
-  within encryption), as possible with Truecrypt, do not help
-  either. They will just assume the hidden container is there and
-  unless you hand over the key, you will stay locked up. Don't have
-  a hidden container? Though luck. Anybody could claim that.
-
-  Still, if you are concerned about the LUKS header, use plain
-  dm-crypt with a good passphrase. See also Section 2, "What is the
-  difference between "plain" and LUKS format?"
-
-
- * 5.3 Should I initialize (overwrite) a new LUKS/dm-crypt partition?
-
-  If you just create a filesystem on it, most of the old data will
-  still be there. If the old data is sensitive, you should overwrite
-  it before encrypting. In any case, not initializing will leave the
-  old data there until the specific sector gets written. That may
-  enable an attacker to determine how much and where on the
-  partition data was written. If you think this is a risk, you can
-  prevent this by overwriting the encrypted device (here assumed to
-  be named "e1") with zeros like this:
-
-      dd_rescue -w /dev/zero /dev/mapper/e1
+  random English sentence. 
+
+
+  * 5.2 Is LUKS insecure? Everybody can see I have encrypted data!
+
+  In practice it does not really matter.  In most civilized countries you
+  can just refuse to hand over the keys, no harm done.  In some countries
+  they can force you to hand over the keys if they suspect encryption. 
+  The suspicion is enough, they do not have to prove anything.  This is
+  for practical reasons, as even the presence of a header (like the LUKS
+  header) is not enough to prove that you have any keys.  It might have
+  been an experiment, for example.  Or it was used as encrypted swap with
+  a key from /dev/random.  So they make you prove you do not have
+  encrypted data.  Of course, if true, that is impossible and hence the
+  whole idea is not compatible with fair laws.  Note that in this context,
+  countries like the US or the UK are not civilized and do not have fair
+  laws.
+
+  This means that if you have a large set of random-looking data, they can
+  already lock you up.  Hidden containers (encryption hidden within
+  encryption), as possible with Truecrypt, do not help either.  They will
+  just assume the hidden container is there and unless you hand over the
+  key, you will stay locked up.  Don't have a hidden container?  Though
+  luck.  Anybody could claim that.
+
+  Still, if you are concerned about the LUKS header, use plain dm-crypt
+  with a good passphrase.  See also Section 2, "What is the difference
+  between "plain" and LUKS format?"
+
+
+  * 5.3 Should I initialize (overwrite) a new LUKS/dm-crypt partition?
+
+  If you just create a filesystem on it, most of the old data will still
+  be there.  If the old data is sensitive, you should overwrite it before
+  encrypting.  In any case, not initializing will leave the old data there
+  until the specific sector gets written.  That may enable an attacker to
+  determine how much and where on the partition data was written.  If you
+  think this is a risk, you can prevent this by overwriting the encrypted
+  device (here assumed to be named "e1") with zeros like this:
+
+    dd_rescue -w /dev/zero /dev/mapper/e1
+
   or alternatively with one of the following more standard commands:
 
-      cat /dev/zero > /dev/mapper/e1
-      dd if=/dev/zero of=/dev/mapper/e1
-       
-
- * 5.4 How do I securely erase a LUKS (or other) partition?
-
-  For LUKS, if you are in a desperate hurry, overwrite the LUKS
-  header and key-slot area. This means overwriting the first
-  (keyslots x stripes x keysize) + offset bytes. For the default
-  parameters, this is the 1'052'672 bytes, i.e. 1MiB + 4096 of the
-  LUKS partition. For 512 bit key length (e.g. for aes-xts-plain with
-  512 bit key) this is 2MiB. (The different offset stems from
-  differences in the sector alignment of the key-slots.) If in doubt,
-  just be generous and overwrite the first 10MB or so, it will likely
-  still be fast enough. A single overwrite with zeros should be
-  enough. If you anticipate being in a desperate hurry, prepare the
-  command beforehand. Example with /dev/sde1 as the LUKS partition
-  and default parameters:
-
-      head -c 1052672 /dev/zero > /dev/sde1; sync
-  A LUKS header backup or full backup will still grant access to
-  most or all data, so make sure that an attacker does not have
-  access to backups or destroy them as well.
-
-  If you have time, overwrite the whole LUKS partition with a single
-  pass of zeros. This is enough for current HDDs. For SSDs or FLASH
-  (USB sticks) you may want to overwrite the whole drive several
-  times to be sure data is not retained by wear leveling. This is
-  possibly still insecure as SSD technology is not fully understood
-  in this regard. Still, due to the anti-forensic properties of the
-  LUKS key-slots, a single overwrite of an SSD or FLASH drive could
-  be enough. If in doubt, use physical destruction in addition. Here
-  is a link to some current research results on erasing SSDs and
-  FLASH drives:
+    cat /dev/zero > /dev/mapper/e1
+    dd if=/dev/zero of=/dev/mapper/e1
+
+
+
+  * 5.4 How do I securely erase a LUKS container?
+
+  For LUKS, if you are in a desperate hurry, overwrite the LUKS header and
+  key-slot area.  For LUKS1 and LUKS2, just be generous and overwrite the
+  first 100MB.  A single overwrite with zeros should be enough.  If you
+  anticipate being in a desperate hurry, prepare the command beforehand. 
+  Example with /dev/sde1 as the LUKS partition and default parameters:
+
+    head -c 100000000 /dev/zero > /dev/sde1; sync
+
+  A LUKS header backup or full backup will still grant access to most or
+  all data, so make sure that an attacker does not have access to backups
+  or destroy them as well.
+
+  Also note that SSDs and also some HDDs (SMR and hybrid HDDs, for
+  example) may not actually overwrite the header and only do that an
+  unspecified and possibly very long time later.  The only way to be sure
+  there is physical destruction.  If the situation permits, do both
+  overwrite and physical destruction.
+
+  If you have time, overwrite the whole drive with a single pass of random
+  data.  This is enough for most HDDs.  For SSDs or FLASH (USB sticks) or
+  SMR or hybrid drives, you may want to overwrite the whole drive several
+  times to be sure data is not retained.  This is possibly still insecure
+  as the respective technologies are not fully understood in this regard. 
+  Still, due to the anti-forensic properties of the LUKS key-slots, a
+  single overwrite could be enough.  If in doubt, use physical destruction
+  in addition.  Here is a link to some current research results on erasing
+  SSDs and FLASH drives:
   http://www.usenix.org/events/fast11/tech/full_papers/Wei.pdf
 
   Keep in mind to also erase all backups.
 
-  Example for a zero-overwrite erase of partition sde1 done with
+  Example for a random-overwrite erase of partition sde1 done with
   dd_rescue:
 
-      dd_rescue -w /dev/zero /dev/sde1   
+    dd_rescue -w /dev/urandom /dev/sde1
 
- * 5.5 How do I securely erase a backup of a LUKS partition or header?
 
-  That depends on the medium it is stored on. For HDD and SSD, use
-  overwrite with zeros. For an SSD or FLASH drive (USB stick), you
-  may want to overwrite the complete SSD several times and use
-  physical destruction in addition, see last item. For re-writable
-  CD/DVD, a single overwrite should also be enough, due to the
-  anti-forensic properties of the LUKS keyslots. For write-once
-  media, use physical destruction. For low security requirements,
-  just cut the CD/DVD into several parts. For high security needs,
-  shred or burn the medium. If your backup is on magnetic tape, I
-  advise physical destruction by shredding or burning, after
-  overwriting . The problem with magnetic tape is that it has a
-  higher dynamic range than HDDs and older data may well be
-  recoverable after overwrites. Also write-head alignment issues can
-  lead to data not actually being deleted at all during overwrites.
 
+  * 5.5 How do I securely erase a backup of a LUKS partition or header?
 
- * 5.6 What about backup? Does it compromise security?
+  That depends on the medium it is stored on.  For HDD and SSD, use
+  overwrite with random data.  For an SSD, FLASH drive (USB stick) hybrid
+  HDD or SMR HDD, you may want to overwrite the complete drive several
+  times and use physical destruction in addition, see last item.  For
+  re-writable CD/DVD, a single overwrite should be enough, due to the
+  anti-forensic properties of the LUKS keyslots.  For write-once media,
+  use physical destruction.  For low security requirements, just cut the
+  CD/DVD into several parts.  For high security needs, shred or burn the
+  medium.
+
+  If your backup is on magnetic tape, I advise physical destruction by
+  shredding or burning, after (!) overwriting .  The problem with magnetic
+  tape is that it has a higher dynamic range than HDDs and older data may
+  well be recoverable after overwrites.  Also write-head alignment issues
+  can lead to data not actually being deleted during overwrites.
+
+  The best option is to actually encrypt the backup, for example with
+  PGP/GnuPG and then just destroy all copies of the encryption key if
+  needed.  Best keep them on paper, as that has excellent durability and
+  secure destruction is easy, for example by burning and then crushing the
+  ashes to a fine powder.  A blender and water also works nicely.
+
+
+  * 5.6 What about backup? Does it compromise security?
 
   That depends. See item 6.7.
 
 
- * 5.7 Why is all my data permanently gone if I overwrite the LUKS
-   header?
+  * 5.7 Why is all my data permanently gone if I overwrite the LUKS header?
 
-  Overwriting the LUKS header in part or in full is the most common
-  reason why access to LUKS containers is lost permanently.
-  Overwriting can be done in a number of fashions, like creating a
-  new filesystem on the raw LUKS partition, making the raw partition
-  part of a raid array and just writing to the raw partition.
+  Overwriting the LUKS header in part or in full is the most common reason
+  why access to LUKS containers is lost permanently.  Overwriting can be
+  done in a number of fashions, like creating a new filesystem on the raw
+  LUKS partition, making the raw partition part of a raid array and just
+  writing to the raw partition.
 
-  The LUKS header contains a 256 bit "salt" per key-slot and without
-  that no decryption is possible. While the salts are not secret,
-  they are key-grade material and cannot be reconstructed. This is a
-  cryptographically strong "cannot". From observations on the
-  cryptsetup mailing-list, people typically go though the usual
-  stages of grief (Denial, Anger, Bargaining, Depression, Acceptance)
-  when this happens to them. Observed times vary between 1 day and 2
-  weeks to complete the cycle. Seeking help on the mailing-list is
-  fine. Even if we usually cannot help with getting back your data,
-  most people found the feedback comforting.
+  The LUKS1 header contains a 256 bit "salt" per key-slot and without that
+  no decryption is possible.  While the salts are not secret, they are
+  key-grade material and cannot be reconstructed.  This is a
+  cryptographically strong "cannot".  From observations on the cryptsetup
+  mailing-list, people typically go though the usual stages of grief
+  (Denial, Anger, Bargaining, Depression, Acceptance) when this happens to
+  them.  Observed times vary between 1 day and 2 weeks to complete the
+  cycle.  Seeking help on the mailing-list is fine.  Even if we usually
+  cannot help with getting back your data, most people found the feedback
+  comforting.
 
   If your header does not contain an intact key-slot salt, best go
-  directly to the last stage ("Acceptance") and think about what to
-  do now. There is one exception that I know of: If your LUKS
-  container is still open, then it may be possible to extract the
-  master key from the running system. See Item "How do I recover the
-  master key from a mapped LUKS container?" in Section "Backup and
-  Data Recovery".
-
-
- * 5.8 What is a "salt"?
-
-  A salt is a random key-grade value added to the passphrase before
-  it is processed. It is not kept secret. The reason for using salts
-  is as follows: If an attacker wants to crack the password for a
-  single LUKS container, then every possible passphrase has to be
-  tried. Typically an attacker will not try every binary value, but
-  will try words and sentences from a dictionary.
-
-  If an attacker wants to attack several LUKS containers with the
-  same dictionary, then a different approach makes sense: Compute the
-  resulting slot-key for each dictionary element and store it on
-  disk. Then the test for each entry is just the slow unlocking with
-  the slot key (say 0.00001 sec) instead of calculating the slot-key
-  first (1 sec). For a single attack, this does not help. But if you
-  have more than one container to attack, this helps tremendously,
-  also because you can prepare your table before you even have the
-  container to attack! The calculation is also very simple to
-  parallelize. You could, for example, use the night-time unused CPU
-  power of your desktop PCs for this.
-
-  This is where the salt comes in. If the salt is combined with the
-  passphrase (in the simplest form, just appended to it), you
-  suddenly need a separate table for each salt value. With a
-  reasonably-sized salt value (256 bit, e.g.) this is quite
-  infeasible.
-
-
- * 5.9 Is LUKS secure with a low-entropy (bad) passphrase?
-
-  Note: You should only use the 94 printable characters from 7 bit
-  ASCII code to prevent your passphrase from failing when the
-  character encoding changes, e.g. because of a system upgrade, see
-  also the note at the very start of this FAQ under "WARNINGS".
-
-  This needs a bit of theory. The quality of your passphrase is
-  directly related to its entropy (information theoretic, not
-  thermodynamic). The entropy says how many bits of "uncertainty" or
-  "randomness" are in you passphrase. In other words, that is how
-  difficult guessing the passphrase is.
+  directly to the last stage ("Acceptance") and think about what to do
+  now.  There is one exception that I know of: If your LUKS1 container is
+  still open, then it may be possible to extract the master key from the
+  running system.  See Item "How do I recover the master key from a mapped
+  LUKS1 container?" in Section "Backup and Data Recovery".
+
+  For LUKS2, things are both better and worse.  First, the salts are in a
+  less vulnerable position now.  But, on the other hand, the keys of a
+  mapped (open) container are now stored in the kernel key-store, and
+  while there probably is some way to get them out of there, I am not sure
+  how much effort that needs.
+
+
+  * 5.8 What is a "salt"?
+
+  A salt is a random key-grade value added to the passphrase before it is
+  processed.  It is not kept secret.  The reason for using salts is as
+  follows: If an attacker wants to crack the password for a single LUKS
+  container, then every possible passphrase has to be tried.  Typically an
+  attacker will not try every binary value, but will try words and
+  sentences from a dictionary.
+
+  If an attacker wants to attack several LUKS containers with the same
+  dictionary, then a different approach makes sense: Compute the resulting
+  slot-key for each dictionary element and store it on disk.  Then the
+  test for each entry is just the slow unlocking with the slot key (say
+  0.00001 sec) instead of calculating the slot-key first (1 sec).  For a
+  single attack, this does not help.  But if you have more than one
+  container to attack, this helps tremendously, also because you can
+  prepare your table before you even have the container to attack!  The
+  calculation is also very simple to parallelize.  You could, for example,
+  use the night-time unused CPU power of your desktop PCs for this.
+
+  This is where the salt comes in.  If the salt is combined with the
+  passphrase (in the simplest form, just appended to it), you suddenly
+  need a separate table for each salt value.  With a reasonably-sized salt
+  value (256 bit, e.g.) this is quite infeasible.
+
+
+  * 5.9 Is LUKS secure with a low-entropy (bad) passphrase?
+
+  Short answer: yes. Do not use a low-entropy passphrase.
+
+  Note: For LUKS2, protection for bad passphrases is a bit better
+  due to the use of Argon2, but that is only a gradual improvement.
+
+  Longer answer:  
+  This needs a bit of theory.  The quality of your passphrase is directly
+  related to its entropy (information theoretic, not thermodynamic).  The
+  entropy says how many bits of "uncertainty" or "randomness" are in you
+  passphrase.  In other words, that is how difficult guessing the
+  passphrase is.
 
   Example: A random English sentence has about 1 bit of entropy per
-  character. A random lowercase (or uppercase) character has about
-  4.7 bit of entropy.
+  character.  A random lowercase (or uppercase) character has about 4.7
+  bit of entropy.
 
   Now, if n is the number of bits of entropy in your passphrase and t
   is the time it takes to process a passphrase in order to open the
   LUKS container, then an attacker has to spend at maximum
 
-      attack_time_max = 2^n * t 
-  time for a successful attack and on average half that. There is no
-  way getting around that relationship. However, there is one thing
-  that does help, namely increasing t, the time it takes to use a
-  passphrase, see next FAQ item.
-
-  Still, if you want good security, a high-entropy passphrase is the
-  only option. For example, a low-entropy passphrase can never be
-  considered secure against a TLA-level (Three Letter Agency level,
-  i.e. government-level) attacker, no matter what tricks are used in
-  the key-derivation function. Use at least 64 bits for secret stuff.
-  That is 64 characters of English text (but only if randomly chosen)
-  or a combination of 12 truly random letters and digits.
-
-  For passphrase generation, do not use lines from very well-known
-  texts (religious texts, Harry potter, etc.) as they are to easy to
-  guess. For example, the total Harry Potter has about 1'500'000
-  words (my estimation). Trying every 64 character sequence starting
-  and ending at a word boundary would take only something like 20
-  days on a single CPU and is entirely feasible. To put that into
-  perspective, using a number of Amazon EC2 High-CPU Extra Large
-  instances (each gives about 8 real cores), this test costs
-  currently about 50USD/EUR, but can be made to run arbitrarily fast.
-
-  On the other hand, choosing 1.5 lines from, say, the Wheel of Time
-  is in itself not more secure, but the book selection adds quite a
-  bit of entropy. (Now that I have mentioned it here, don't use tWoT
-  either!) If you add 2 or 3 typos or switch some words around, then
-  this is good passphrase material.
-
-
- * 5.10 What is "iteration count" and why is decreasing it a bad idea?
-
-  Iteration count is the number of PBKDF2 iterations a passphrase is
-  put through before it is used to unlock a key-slot. Iterations are
-  done with the explicit purpose to increase the time that it takes
-  to unlock a key-slot. This provides some protection against use of
-  low-entropy passphrases.
-
-  The idea is that an attacker has to try all possible passphrases.
-  Even if the attacker knows the passphrase is low-entropy (see last
-  item), it is possible to make each individual try take longer. The
-  way to do this is to repeatedly hash the passphrase for a certain
-  time. The attacker then has to spend the same time (given the same
-  computing power) as the user per try. With LUKS, the default is 1
-  second of PBKDF2 hashing.
-
-  Example 1: Lets assume we have a really bad passphrase (e.g. a
-  girlfriends name) with 10 bits of entropy. With the same CPU, an
-  attacker would need to spend around 500 seconds on average to
-  break that passphrase. Without iteration, it would be more like
-  0.0001 seconds on a modern CPU.
-
-  Example 2: The user did a bit better and has 32 chars of English
-  text. That would be about 32 bits of entropy. With 1 second
-  iteration, that means an attacker on the same CPU needs around 136
-  years. That is pretty impressive for such a weak passphrase.
-  Without the iterations, it would be more like 50 days on a modern
-  CPU, and possibly far less.
-
-  In addition, the attacker can both parallelize and use special
-  hardware like GPUs or FPGAs to speed up the attack. The attack can
-  also happen quite some time after the luksFormat operation and CPUs
-  can have become faster and cheaper. For that reason you want a
-  bit of extra security. Anyways, in Example 1 your are screwed.
-  In example 2, not necessarily. Even if the attack is faster, it
-  still has a certain cost associated with it, say 10000 EUR/USD
-  with iteration and 1 EUR/USD without iteration. The first can be
-  prohibitively expensive, while the second is something you try
-  even without solid proof that the decryption will yield something
-  useful.
-
-  The numbers above are mostly made up, but show the idea. Of course
-  the best thing is to have a high-entropy passphrase.
-
-  Would a 100 sec iteration time be even better? Yes and no.
-  Cryptographically it would be a lot better, namely 100 times better.
-  However, usability is a very important factor for security
-  technology and one that gets overlooked surprisingly often. For
-  LUKS, if you have to wait 2 minutes to unlock the LUKS container,
-  most people will not bother and use less secure storage instead. It
-  is better to have less protection against low-entropy passphrases
-  and people actually use LUKS, than having them do without
-  encryption altogether.
-
-  Now, what about decreasing the iteration time? This is generally a
-  very bad idea, unless you know and can enforce that the users only
-  use high-entropy passphrases. If you decrease the iteration time
-  without ensuring that, then you put your users at increased risk,
-  and considering how rarely LUKS containers are unlocked in a
-  typical work-flow, you do so without a good reason. Don't do it.
-  The iteration time is already low enough that users with entropy
-  low passphrases are vulnerable. Lowering it even further increases
-  this danger significantly.
-
-
- * 5.11 Some people say PBKDF2 is insecure?
+    attack_time_max = 2^n * t
+
+  time for a successful attack and on average half that.  There is no way
+  getting around that relationship.  However, there is one thing that does
+  help, namely increasing t, the time it takes to use a passphrase, see
+  next FAQ item.
+
+  Still, if you want good security, a high-entropy passphrase is the only
+  option.  For example, a low-entropy passphrase can never be considered
+  secure against a TLA-level (Three Letter Agency level, i.e. 
+  government-level) attacker, no matter what tricks are used in the
+  key-derivation function.  Use at least 64 bits for secret stuff.  That
+  is 64 characters of English text (but only if randomly chosen) or a
+  combination of 12 truly random letters and digits.
+
+  For passphrase generation, do not use lines from very well-known texts
+  (religious texts, Harry potter, etc.) as they are too easy to guess. 
+  For example, the total Harry Potter has about 1'500'000 words (my
+  estimation).  Trying every 64 character sequence starting and ending at
+  a word boundary would take only something like 20 days on a single CPU
+  and is entirely feasible.  To put that into perspective, using a number
+  of Amazon EC2 High-CPU Extra Large instances (each gives about 8 real
+  cores), this test costs currently about 50USD/EUR, but can be made to
+  run arbitrarily fast.
+
+  On the other hand, choosing 1.5 lines from, say, the Wheel of Time, is
+  in itself not more secure, but the book selection adds quite a bit of
+  entropy.  (Now that I have mentioned it here, don't use tWoT either!) If
+  you add 2 or 3 typos and switch some words around, then this is good
+  passphrase material.
+
+
+  * 5.10 What is "iteration count" and why is decreasing it a bad idea?
+
+  LUKS1:  
+  Iteration count is the number of PBKDF2 iterations a passphrase is put
+  through before it is used to unlock a key-slot.  Iterations are done
+  with the explicit purpose to increase the time that it takes to unlock a
+  key-slot.  This provides some protection against use of low-entropy
+  passphrases.
+
+  The idea is that an attacker has to try all possible passphrases.  Even
+  if the attacker knows the passphrase is low-entropy (see last item), it
+  is possible to make each individual try take longer.  The way to do this
+  is to repeatedly hash the passphrase for a certain time.  The attacker
+  then has to spend the same time (given the same computing power) as the
+  user per try.  With LUKS1, the default is 1 second of PBKDF2 hashing.
+
+  Example 1: Lets assume we have a really bad passphrase (e.g.  a
+  girlfriends name) with 10 bits of entropy.  With the same CPU, an
+  attacker would need to spend around 500 seconds on average to break that
+  passphrase.  Without iteration, it would be more like 0.0001 seconds on
+  a modern CPU.
+
+  Example 2: The user did a bit better and has 32 chars of English text. 
+  That would be about 32 bits of entropy.  With 1 second iteration, that
+  means an attacker on the same CPU needs around 136 years.  That is
+  pretty impressive for such a weak passphrase.  Without the iterations,
+  it would be more like 50 days on a modern CPU, and possibly far less.
+
+  In addition, the attacker can both parallelize and use special hardware
+  like GPUs or FPGAs to speed up the attack.  The attack can also happen
+  quite some time after the luksFormat operation and CPUs can have become
+  faster and cheaper.  For that reason you want a bit of extra security. 
+  Anyways, in Example 1 your are screwed.  In example 2, not necessarily. 
+  Even if the attack is faster, it still has a certain cost associated
+  with it, say 10000 EUR/USD with iteration and 1 EUR/USD without
+  iteration.  The first can be prohibitively expensive, while the second
+  is something you try even without solid proof that the decryption will
+  yield something useful.
+
+  The numbers above are mostly made up, but show the idea.  Of course the
+  best thing is to have a high-entropy passphrase.
+
+  Would a 100 sec iteration time be even better?  Yes and no. 
+  Cryptographically it would be a lot better, namely 100 times better. 
+  However, usability is a very important factor for security technology
+  and one that gets overlooked surprisingly often.  For LUKS, if you have
+  to wait 2 minutes to unlock the LUKS container, most people will not
+  bother and use less secure storage instead.  It is better to have less
+  protection against low-entropy passphrases and people actually use LUKS,
+  than having them do without encryption altogether.
+
+  Now, what about decreasing the iteration time?  This is generally a very
+  bad idea, unless you know and can enforce that the users only use
+  high-entropy passphrases.  If you decrease the iteration time without
+  ensuring that, then you put your users at increased risk, and
+  considering how rarely LUKS containers are unlocked in a typical
+  work-flow, you do so without a good reason.  Don't do it.  The iteration
+  time is already low enough that users with low entropy passphrases are
+  vulnerable.  Lowering it even further increases this danger
+  significantly.
+
+  LUKS2: Pretty much the same reasoning applies. The advantages of using
+  GPUs or FPGAs in an attack have been significantly reduced, but that 
+  is the only main difference.
+
+
+  * 5.11 Some people say PBKDF2 is insecure?
 
   There is some discussion that a hash-function should have a "large
-  memory" property, i.e. that it should require a lot of memory to be
-  computed. This serves to prevent attacks using special programmable
-  circuits, like FPGAs, and attacks using graphics cards. PBKDF2
-  does not need a lot of memory and is vulnerable to these attacks.
-  However, the publication usually referred in these discussions is
-  not very convincing in proving that the presented hash really is
-  "large memory" (that may change, email the FAQ maintainer when it
-  does) and it is of limited usefulness anyways. Attackers that use
-  clusters of normal PCs will not be affected at all by a "large
-  memory" property. For example the US Secret Service is known to
-  use the off-hour time of all the office PCs of the Treasury for
-  password breaking. The Treasury has about 110'000 employees.
-  Assuming every one has an office PC, that is significant computing
-  power, all of it with plenty of memory for computing "large
-  memory" hashes. Bot-net operators also have all the memory they
-  want. The only protection against a resourceful attacker is a
-  high-entropy passphrase, see items 5.9 and 5.10.
-
-
- * 5.12 What about iteration count with plain dm-crypt?
-
-  Simple: There is none. There is also no salting. If you use plain
-  dm-crypt, the only way to be secure is to use a high entropy
-  passphrase. If in doubt, use LUKS instead.
-
-
- * 5.13 Is LUKS with default parameters less secure on a slow CPU?
-
-  Unfortunately, yes. However the only aspect affected is the
-  protection for low-entropy passphrase or master-key. All other
-  security aspects are independent of CPU speed.
-
-  The master key is less critical, as you really have to work at it
-  to give it low entropy. One possibility is to supply the master key
-  yourself. If that key is low-entropy, then you get what you
-  deserve. The other known possibility is to use /dev/urandom for
-  key generation in an entropy-starved situation (e.g. automatic
-  installation on an embedded device without network and other entropy
-  sources).
-
-  For the passphrase, don't use a low-entropy passphrase. If your
-  passphrase is good, then a slow CPU will not matter. If you insist
-  on a low-entropy passphrase on a slow CPU, use something like
-  "--iter-time=10" or higher and wait a long time on each LUKS unlock
-  and pray that the attacker does not find out in which way exactly
-  your passphrase is low entropy. This also applies to low-entropy
-  passphrases on fast CPUs. Technology can do only so much to
-  compensate for problems in front of the keyboard.
-
-
- * 5.14 Why was the default aes-cbc-plain replaced with aes-cbc-essiv?
+  memory" property, i.e.  that it should require a lot of memory to be
+  computed.  This serves to prevent attacks using special programmable
+  circuits, like FPGAs, and attacks using graphics cards.  PBKDF2 does not
+  need a lot of memory and is vulnerable to these attacks.  However, the
+  publication usually referred in these discussions is not very convincing
+  in proving that the presented hash really is "large memory" (that may
+  change, email the FAQ maintainer when it does) and it is of limited
+  usefulness anyways.  Attackers that use clusters of normal PCs will not
+  be affected at all by a "large memory" property.  For example the US
+  Secret Service is known to use the off-hour time of all the office PCs
+  of the Treasury for password breaking.  The Treasury has about 110'000
+  employees.  Assuming every one has an office PC, that is significant
+  computing power, all of it with plenty of memory for computing "large
+  memory" hashes.  Bot-net operators also have all the memory they want. 
+  The only protection against a resourceful attacker is a high-entropy
+  passphrase, see items 5.9 and 5.10.
+
+  That said, LUKS2 defaults to Argon2, which has a large-memory property
+  and massively reduces the advantages of GPUs and FPGAs.
+
+
+  * 5.12 What about iteration count with plain dm-crypt?
+
+  Simple: There is none.  There is also no salting.  If you use plain
+  dm-crypt, the only way to be secure is to use a high entropy passphrase. 
+  If in doubt, use LUKS instead.
+
+
+  * 5.13 Is LUKS with default parameters less secure on a slow CPU?
+
+  Unfortunately, yes.  However the only aspect affected is the protection
+  for low-entropy passphrase or master-key.  All other security aspects
+  are independent of CPU speed.
+
+  The master key is less critical, as you really have to work at it to
+  give it low entropy.  One possibility to mess this up is to supply the
+  master key yourself.  If that key is low-entropy, then you get what you
+  deserve.  The other known possibility to create a LUKS container with a
+  bad master key is to use /dev/urandom for key generation in an
+  entropy-starved situation (e.g.  automatic installation on an embedded
+  device without network and other entropy sources or installation in a VM
+  under certain circumstances).
+
+  For the passphrase, don't use a low-entropy passphrase.  If your
+  passphrase is good, then a slow CPU will not matter.  If you insist on a
+  low-entropy passphrase on a slow CPU, use something like
+  "--iter-time=10000" or higher and wait a long time on each LUKS unlock
+  and pray that the attacker does not find out in which way exactly your
+  passphrase is low entropy.  This also applies to low-entropy passphrases
+  on fast CPUs.  Technology can do only so much to compensate for problems
+  in front of the keyboard.
+
+  Also note that power-saving modes will make your CPU slower.  This will
+  reduce iteration count on LUKS container creation.  It will keep unlock
+  times at the expected values though at this CPU speed.
+
+
+  * 5.14 Why was the default aes-cbc-plain replaced with aes-cbc-essiv?
 
   Note: This item applies both to plain dm-crypt and to LUKS
 
-  The problem is that cbc-plain has a fingerprint vulnerability, where
-  a specially crafted file placed into the crypto-container can be
-  recognized from the outside. The issue here is that for cbc-plain
-  the initialization vector (IV) is the sector number. The IV gets
-  XORed to the first data chunk of the sector to be encrypted. If you
-  make sure that the first data block to be stored in a sector
-  contains the sector number as well, the first data block to be
-  encrypted is all zeros and always encrypted to the same ciphertext.
-  This also works if the first data chunk just has a constant XOR
-  with the sector number. By having several shifted patterns you can
-  take care of the case of a non-power-of-two start sector number of
-  the file.
-
-  This mechanism allows you to create a pattern of sectors that have
-  the same first ciphertext block and signal one bit per sector to the
-  outside, allowing you to e.g. mark media files that way for
-  recognition without decryption. For large files this is a
-  practical attack. For small ones, you do not have enough blocks to
-  signal and take care of different file starting offsets.
-
-  In order to prevent this attack, the default was changed to
-  cbc-essiv. ESSIV uses a keyed hash of the sector number, with the
-  encryption key as key. This makes the IV unpredictable without
-  knowing the encryption key and the watermarking attack fails.
-
-
- * 5.15 Are there any problems with "plain" IV? What is "plain64"?
-
-  First, "plain" and "plain64" are both not secure to use with CBC,
-  see previous FAQ item.
-
-  However there are modes, like XTS, that are secure with "plain" IV.
-  The next limit is that "plain" is 64 bit, with the upper 32 bit set
-  to zero. This means that on volumes larger than 2TiB, the IV
-  repeats, creating a vulnerability that potentially leaks some
-  data. To avoid this, use "plain64", which uses the full sector
-  number up to 64 bit. Note that "plain64" requires a kernel >=
-  2.6.33. Also note that "plain64" is backwards compatible for
-  volume sizes <= 2TiB, but not for those > 2TiB. Finally, "plain64"
-  does not cause any performance penalty compared to "plain".
-
-
- * 5.16 What about XTS mode?
+  The problem is that cbc-plain has a fingerprint vulnerability, where a
+  specially crafted file placed into the crypto-container can be
+  recognized from the outside.  The issue here is that for cbc-plain the
+  initialization vector (IV) is the sector number.  The IV gets XORed to
+  the first data chunk of the sector to be encrypted.  If you make sure
+  that the first data block to be stored in a sector contains the sector
+  number as well, the first data block to be encrypted is all zeros and
+  always encrypted to the same ciphertext.  This also works if the first
+  data chunk just has a constant XOR with the sector number.  By having
+  several shifted patterns you can take care of the case of a
+  non-power-of-two start sector number of the file.
+
+  This mechanism allows you to create a pattern of sectors that have the
+  same first ciphertext block and signal one bit per sector to the
+  outside, allowing you to e.g.  mark media files that way for recognition
+  without decryption.  For large files this is a practical attack.  For
+  small ones, you do not have enough blocks to signal and take care of
+  different file starting offsets.
+
+  In order to prevent this attack, the default was changed to cbc-essiv. 
+  ESSIV uses a keyed hash of the sector number, with the encryption key as
+  key.  This makes the IV unpredictable without knowing the encryption key
+  and the watermarking attack fails.
+
+
+  * 5.15 Are there any problems with "plain" IV? What is "plain64"?
+
+  First, "plain" and "plain64" are both not secure to use with CBC, see
+  previous FAQ item.
+
+  However there are modes, like XTS, that are secure with "plain" IV.  The
+  next limit is that "plain" is 64 bit, with the upper 32 bit set to zero. 
+  This means that on volumes larger than 2TiB, the IV repeats, creating a
+  vulnerability that potentially leaks some data.  To avoid this, use
+  "plain64", which uses the full sector number up to 64 bit.  Note that
+  "plain64" requires a kernel 2.6.33 or more recent.  Also note that
+  "plain64" is backwards compatible for volume sizes of maximum size 2TiB,
+  but not for those > 2TiB.  Finally, "plain64" does not cause any
+  performance penalty compared to "plain".
+
+
+  * 5.16 What about XTS mode?
 
   XTS mode is potentially even more secure than cbc-essiv (but only if
-  cbc-essiv is insecure in your scenario). It is a NIST standard and
-  used, e.g. in Truecrypt. From version 1.6.0 of cryptsetup onwards,
-  aes-xts-plain64 is the default for LUKS. If you want to use it
-  with a cryptsetup before version 1.6.0 or with plain dm-crypt, you
-  have to specify it manually as "aes-xts-plain", i.e.
+  cbc-essiv is insecure in your scenario).  It is a NIST standard and
+  used, e.g.  in Truecrypt.  From version 1.6.0 of cryptsetup onwards,
+  aes-xts-plain64 is the default for LUKS.  If you want to use it with a
+  cryptsetup before version 1.6.0 or with plain dm-crypt, you have to
+  specify it manually as "aes-xts-plain", i.e.
 
-      cryptsetup -c aes-xts-plain luksFormat <device>
-  For volumes >2TiB and kernels >= 2.6.33 use "plain64" (see FAQ
-  item on "plain" and "plain64"):
+    cryptsetup -c aes-xts-plain luksFormat <device>
 
-      cryptsetup -c aes-xts-plain64 luksFormat <device>
-  There is a potential security issue with XTS mode and large blocks.
-  LUKS and dm-crypt always use 512B blocks and the issue does not
-  apply.
+  For volumes >2TiB and kernels >= 2.6.33 use "plain64" (see FAQ item
+  on "plain" and "plain64"):
+
+    cryptsetup -c aes-xts-plain64 luksFormat <device>
 
+  There is a potential security issue with XTS mode and large blocks. 
+  LUKS and dm-crypt always use 512B blocks and the issue does not apply.
 
- * 5.17 Is LUKS FIPS-140-2 certified?
 
-  No. But that is more a problem of FIPS-140-2 than of LUKS. From a
+  * 5.17 Is LUKS FIPS-140-2 certified?
+
+  No.  But that is more a problem of FIPS-140-2 than of LUKS.  From a
   technical point-of-view, LUKS with the right parameters would be
-  FIPS-140-2 compliant, but in order to make it certified, somebody
-  has to pay real money for that. And then, whenever cryptsetup is
-  changed or extended, the certification lapses and has to be
-  obtained again.
-
-  From the aspect of actual security, LUKS with default parameters
-  should be as good as most things that are FIPS-140-2 certified,
-  although you may want to make sure to use /dev/random (by
-  specifying --use-random on luksFormat) as randomness source for
-  the master key to avoid being potentially insecure in an
-  entropy-starved situation.
-
-
- * 5.18 What about Plausible Deniability?
-
-  First let me attempt a definition for the case of encrypted
-  filesystems: Plausible deniability is when you hide encrypted data
-  inside an encrypted container and it is not possible to prove it is
-  there. The idea is compelling and on first glance it seems
-  possible to do it. And from a cryptographic point of view, it
-  actually is possible.
-
-  So, does it work in practice? No, unfortunately. The reasoning used
-  by its proponents is fundamentally flawed in several ways and the
+  FIPS-140-2 compliant, but in order to make it certified, somebody has to
+  pay real money for that.  And then, whenever cryptsetup is changed or
+  extended, the certification lapses and has to be obtained again.
+
+  From the aspect of actual security, LUKS with default parameters should
+  be as good as most things that are FIPS-140-2 certified, although you
+  may want to make sure to use /dev/random (by specifying --use-random on
+  luksFormat) as randomness source for the master key to avoid being
+  potentially insecure in an entropy-starved situation.
+
+
+  * 5.18 What about Plausible Deniability?
+
+  First let me attempt a definition for the case of encrypted filesystems:
+  Plausible deniability is when you store data inside an encrypted
+  container and it is not possible to prove it is there without having a
+  special passphrase.  And at the same time it must be "plausible" that
+  there actually is no hidden data there.
+
+  As a simple entropy-analysis will show that here may be data there, the
+  second part is what makes it tricky.
+
+  There seem to  be a lot of misunderstandings about this idea, so let me
+  make it clear that this refers to the situation where the attackers can
+  prove that there is data that either may be random or may be part of a
+  plausible-deniability scheme, they just cannot prove which one it is. 
+  Hence a plausible-deniability scheme must hold up when the attackers
+  know there is something potentially fishy.  If you just hide data and
+  rely on it not being found, that is just simple deniability, not
+  "plausible" deniability and I am not talking about that in the
+  following.  Simple deniability against a low-competence attacker may be
+  as simple as renaming a file or putting data into an unused part of a
+  disk.  Simple deniability against a high-skill attacker with time to
+  invest is usually pointless unless you go for advanced steganographic
+  techniques, which have their own drawbacks, such as low data capacity.
+
+  Now, the idea of plausible deniability is compelling and on a first
+  glance it seems possible to do it.  And from a cryptographic point of
+  view, it actually is possible.
+
+  So, does the idea work in practice?  No, unfortunately.  The reasoning
+  used by its proponents is fundamentally flawed in several ways and the
   cryptographic properties fail fatally when colliding with the real
   world.
 
   First, why should "I do not have a hidden partition" be any more
-  plausible than "I forgot my crypto key" or "I wiped that partition
-  with random data, nothing in there"? I do not see any reason.
-
-  Second, there are two types of situations: Either they cannot force
-  you to give them the key (then you simply do not) or the can. In
-  the second case, they can always do bad things to you, because they
-  cannot prove that you have the key in the first place! This means
-  they do not have to prove you have the key, or that this random
-  looking data on your disk is actually encrypted data. So the
-  situation will allow them to waterboard/lock-up/deport you
-  anyways, regardless of how "plausible" your deniability is. Do not
-  have a hidden partition you could show to them, but there are
-  indications you may? Too bad for you. Unfortunately "plausible
-  deniability" also means you cannot prove there is no hidden data.
-
-  Third, hidden partitions are not that hidden. There are basically
-  just two possibilities: a) Make a large crypto container, but put a
-  smaller filesystem in there and put the hidden partition into the
-  free space. Unfortunately this is glaringly obvious and can be
-  detected in an automated fashion. This means that the initial
-  suspicion to put you under duress in order to make you reveal you
-  hidden data is given. b) Make a filesystem that spans the whole
-  encrypted partition, and put the hidden partition into space not
-  currently used by that filesystem. Unfortunately that is also
-  glaringly obvious, as you then cannot write to the filesystem
-  without a high risk of destroying data in the hidden container.
-  Have not written anything to the encrypted filesystem  in a while?
-  Too bad, they have the suspicion they need to do unpleasant things
-  to you.
-
-  To be fair, if you prepare option b) carefully and directly before
-  going into danger, it may work. But then, the mere presence of
-  encrypted data may already be enough to get you into trouble in
-  those places were they can demand encryption keys.
+  plausible than "I forgot my crypto key" or "I wiped that partition with
+  random data, nothing in there"?  I do not see any reason.
+
+  Second, there are two types of situations: Either they cannot force you
+  to give them the key (then you simply do not) or they can.  In the
+  second case, they can always do bad things to you, because they cannot
+  prove that you have the key in the first place!  This means they do not
+  have to prove you have the key, or that this random looking data on your
+  disk is actually encrypted data.  So the situation will allow them to
+  waterboard/lock-up/deport you anyways, regardless of how "plausible"
+  your deniability is.  Do not have a hidden partition you could show to
+  them, but there are indications you may?  Too bad for you. 
+  Unfortunately "plausible deniability" also means you cannot prove there
+  is no hidden data.
+
+  Third, hidden partitions are not that hidden.  There are basically just
+  two possibilities: a) Make a large crypto container, but put a smaller
+  filesystem in there and put the hidden partition into the free space. 
+  Unfortunately this is glaringly obvious and can be detected in an
+  automated fashion.  This means that the initial suspicion to put you
+  under duress in order to make you reveal your hidden data is given.  b)
+  Make a filesystem that spans the whole encrypted partition, and put the
+  hidden partition into space not currently used by that filesystem. 
+  Unfortunately that is also glaringly obvious, as you then cannot write
+  to the filesystem without a high risk of destroying data in the hidden
+  container.  Have not written anything to the encrypted filesystem in a
+  while?  Too bad, they have the suspicion they need to do unpleasant
+  things to you.
+
+  To be fair, if you prepare option b) carefully and directly before going
+  into danger, it may work.  But then, the mere presence of encrypted data
+  may already be enough to get you into trouble in those places were they
+  can demand encryption keys.
 
   Here is an additional reference for some problems with plausible
-  deniability: http://www.schneier.com/paper-truecrypt-dfs.pdf I
-  strongly suggest you read it.
-
-  So, no, I will not provide any instructions on how to do it with
-  plain dm-crypt or LUKS. If you insist on shooting yourself in the
-  foot, you can figure out how to do it yourself.
-
-
- * 5.19 What about SSDs, Flash and Hybrid Drives?
-
-  The problem is that you cannot reliably erase parts of these
-  devices, mainly due to wear-leveling and possibly defect
-  management.
-
-  Basically, when overwriting a sector (of 512B), what the device
-  does is to move an internal sector (may be 128kB or even larger) to
-  some pool of discarded, not-yet erased unused sectors, take a
-  fresh empty sector from the empty-sector pool and copy the old
-  sector over with the changes to the small part you wrote. This is
-  done in some fashion so that larger writes do not cause a lot of
-  small internal updates.
-
-  The thing is that the mappings between outside-addressable sectors
-  and inside sectors is arbitrary (and the vendors are not talking).
-  Also the discarded sectors are not necessarily erased immediately.
-  They may linger a long time.
-
-  For plain dm-crypt, the consequences are that older encrypted data
-  may be lying around in some internal pools of the device. Thus may
-  or may not be a problem and depends on the application. Remember
-  the same can happen with a filesystem if consecutive writes to the
-  same area of a file can go to different sectors.
-
-  However, for LUKS, the worst case is that key-slots and LUKS
-  header may end up in these internal pools. This means that password
-  management functionality is compromised (the old passwords may
-  still be around, potentially for a very long time) and that fast
-  erase by overwriting the header and key-slot area is insecure.
-
-  Also keep in mind that the discarded/used pool may be large. For
-  example, a 240GB SSD has about 16GB of spare area in the chips that
-  it is free to do with as it likes. You would need to make each
-  individual key-slot larger than that to allow reliable overwriting.
-  And that assumes the disk thinks all other space is in use.
-  Reading the internal pools using forensic tools is not that hard,
-  but may involve some soldering.
+  deniability: http://www.schneier.com/paper-truecrypt-dfs.pdf I strongly
+  suggest you read it.
+
+  So, no, I will not provide any instructions on how to do it with plain
+  dm-crypt or LUKS.  If you insist on shooting yourself in the foot, you
+  can figure out how to do it yourself.
+
+
+ * 5.19 What about SSDs, Flash, Hybrid and SMR Drives?
+
+  The problem is that you cannot reliably erase parts of these devices,
+  mainly due to wear-leveling and possibly defect management and delayed
+  writes to the main data area.
+
+  For example for SSDs, when overwriting a sector, what the device does is
+  to move an internal sector (may be 128kB or even larger) to some pool of
+  discarded, not-yet erased unused sectors, take a fresh empty sector from
+  the empty-sector pool and copy the old sector over with the changes to
+  the small part you wrote.  This is done in some fashion so that larger
+  writes do not cause a lot of small internal updates.
+
+  The thing is that the mappings between outside-addressable sectors and
+  inside sectors is arbitrary (and the vendors are not talking).  Also the
+  discarded sectors are not necessarily erased immediately.  They may
+  linger a long time.
+
+  For plain dm-crypt, the consequences are that older encrypted data may
+  be lying around in some internal pools of the device.  Thus may or may
+  not be a problem and depends on the application.  Remember the same can
+  happen with a filesystem if consecutive writes to the same area of a
+  file can go to different sectors.
+
+  However, for LUKS, the worst case is that key-slots and LUKS header may
+  end up in these internal pools.  This means that password management
+  functionality is compromised (the old passwords may still be around,
+  potentially for a very long time) and that fast erase by overwriting the
+  header and key-slot area is insecure.
+
+  Also keep in mind that the discarded/used pool may be large.  For
+  example, a 240GB SSD has about 16GB of spare area in the chips that it
+  is free to do with as it likes.  You would need to make each individual
+  key-slot larger than that to allow reliable overwriting.  And that
+  assumes the disk thinks all other space is in use.  Reading the internal
+  pools using forensic tools is not that hard, but may involve some
+  soldering.
 
   What to do?
 
-  If you trust the device vendor (you probably should not...) you can
-  try an ATA "secure erase" command for SSDs. That does not work for
-  USB keys though and may or may not be secure for a hybrid drive. If
-  it finishes on an SSD after a few seconds, it was possibly faked.
-  Unfortunately, for hybrid drives that indicator does not work, as
-  the drive may well take the time to truly erase the magnetic part,
-  but only mark the SSD/Flash part as erased while data is still in
-  there.
+  If you trust the device vendor (you probably should not...) you can try
+  an ATA "secure erase" command.  That is not present in USB keys though
+  and may or may not be secure for a hybrid drive.
 
   If you can do without password management and are fine with doing
-  physical destruction for permanently deleting data (always after
-  one or several full overwrites!), you can use plain dm-crypt or
-  LUKS.
-
-  If you want or need all the original LUKS security features to work,
-  you can use a detached LUKS header and put that on a conventional,
-  magnetic disk. That leaves potentially old encrypted data in the
-  pools on the disk, but otherwise you get LUKS with the same
-  security as on a magnetic disk.
-
-  If you are concerned about your laptop being stolen, you are likely
-  fine using LUKS on an SSD or hybrid drive. An attacker would need
-  to have access to an old passphrase (and the key-slot for this old
-  passphrase would actually need to still be somewhere in the SSD)
-  for your data to be at risk. So unless you pasted your old
-  passphrase all over the Internet or the attacker has knowledge of
-  it from some other source and does a targeted laptop theft to get
-  at your data, you should be fine.
-
-
- * 5.20 LUKS is broken! It uses SHA-1!
-
-  No, it is not. SHA-1 is (academically) broken for finding
-  collisions, but not for using it in a key-derivation function. And
-  that collision vulnerability is for non-iterated use only. And you
-  need the hash-value in verbatim.
-
-  This basically means that if you already have a slot-key, and you
-  have set the PBKDF2 iteration count to 1 (it is > 10'000 normally),
-  you could (maybe) derive a different passphrase that gives you the
-  the same slot-key. But if you have the slot-key, you can already
-  unlock the key-slot and get the master key, breaking everything. So
-  basically, this SHA-1 vulnerability allows you to open a LUKS
-  container with high effort when you already have it open.
-
-  The real problem here is people that do not understand crypto and
-  claim things are broken just because some mechanism is used that
-  has been broken for a specific different use. The way the mechanism
-  is used matters very much. A hash that is broken for one use can be
-  completely secure for other uses and here it is.
+  physical destruction for permanently deleting data (always after one or
+  several full overwrites!), you can use plain dm-crypt.
+
+  If you want or need all the original LUKS security features to work, you
+  can use a detached LUKS header and put that on a conventional, magnetic
+  disk.  That leaves potentially old encrypted data in the pools on the
+  main disk, but otherwise you get LUKS with the same security as on a
+  traditional magnetic disk.  Note however that storage vendors are prone
+  to lying to their customers.  For example, it recently came out that
+  HDDs sold without any warning or mentioning in the data-sheets were
+  actually using SMR and that will write data first to a faster area and
+  only overwrite the original data area some time later when things are
+  quiet.
+
+  If you are concerned about your laptop being stolen, you are likely fine
+  using LUKS on an SSD or hybrid drive.  An attacker would need to have
+  access to an old passphrase (and the key-slot for this old passphrase
+  would actually need to still be somewhere in the SSD) for your data to
+  be at risk.  So unless you pasted your old passphrase all over the
+  Internet or the attacker has knowledge of it from some other source and
+  does a targeted laptop theft to get at your data, you should be fine.
+
+
+ * 5.20 LUKS1 is broken! It uses SHA-1!
+
+  No, it is not.  SHA-1 is (academically) broken for finding collisions,
+  but not for using it in a key-derivation function.  And that collision
+  vulnerability is for non-iterated use only.  And you need the hash-value
+  in verbatim.
+
+  This basically means that if you already have a slot-key, and you have
+  set the PBKDF2 iteration count to 1 (it is > 10'000 normally), you could
+  (maybe) derive a different passphrase that gives you the the same
+  slot-key.  But if you have the slot-key, you can already unlock the
+  key-slot and get the master key, breaking everything.  So basically,
+  this SHA-1 vulnerability allows you to open a LUKS1 container with high
+  effort when you already have it open.
+
+  The real problem here is people that do not understand crypto and claim
+  things are broken just because some mechanism is used that has been
+  broken for a specific different use.  The way the mechanism is used
+  matters very much.  A hash that is broken for one use can be completely
+  secure for other uses and here it is.
+
+  Since version 1.7.0, cryptsetup uses SHA-256 as default to ensure that
+  it will be compatible in the future. There are already some systems 
+  where SHA-1 is completely phased out or disabled by a security policy.
 
 
  * 5.21 Why is there no "Nuke-Option"?
 
-  A "Nuke-Option" or "Kill-switch" is a password that when entered
-  upon unlocking instead wipes the header and all passwords. So when
-  somebody forces you to enter your password, you can destroy the
-  data instead.
+  A "Nuke-Option" or "Kill-switch" is a password that when entered upon
+  unlocking instead wipes the header and all passwords.  So when somebody
+  forces you to enter your password, you can destroy the data instead.
 
   While this sounds attractive at first glance, it does not make sense
-  once a real security analysis is done. One problem is that you have
-  to have some kind of HSM (Hardware Security Module) in order to
-  implement it securely. In the movies, a HSM starts to smoke and
-  melt once the Nuke-Option has been activated. In reality, it just
-  wipes some battery-backed RAM cells. A proper HSM costs something
-  like 20'000...100'000 EUR/USD and there a Nuke-Option may make some
-  sense. BTW, a chipcard or a TPM is not a HSM, although some
-  vendors are promoting that myth.
-
-  Now, a proper HSMs will have a wipe option but not a Nuke-Option,
-  i.e. you can explicitly wipe the HSM, but by a different process
-  than unlocking it takes. Why is that? Simple: If somebody can force
-  you to reveal passwords, then they can also do bad things to you if
-  you do not or if you enter a nuke password instead. Think locking
-  you up for a few years for "destroying evidence" or for far longer
-  and without trial for being a "terrorist suspect". No HSM maker
-  will want to expose its customers to that risk.
-
-  Now think of the typical LUKS application scenario, i.e. disk
-  encryption. Usually the ones forcing you to hand over your password
+  once a real security analysis is done.  One problem is that you have to
+  have some kind of HSM (Hardware Security Module) in order to implement
+  it securely.  In the movies, a HSM starts to smoke and melt once the
+  Nuke-Option has been activated.  In actual reality, it just wipes some
+  battery-backed RAM cells.  A proper HSM costs something like
+  20'000...100'000 EUR/USD and there a Nuke-Option may make some sense. 
+  BTW, a chipcard or a TPM is not a HSM, although some vendors are
+  promoting that myth.
+
+  Now, a proper HSMs will have a wipe option but not a Nuke-Option, i.e. 
+  you can explicitly wipe the HSM, but by a different process than
+  unlocking it takes.  Why is that?  Simple: If somebody can force you to
+  reveal passwords, then they can also do bad things to you if you do not
+  or if you enter a nuke password instead.  Think locking you up for a few
+  years for "destroying evidence" or for far longer and without trial for
+  being a "terrorist suspect".  No HSM maker will want to expose its
+  customers to that risk.
+
+  Now think of the typical LUKS application scenario, i.e.  disk
+  encryption.  Usually the ones forcing you to hand over your password
   will have access to the disk as well, and, if they have any real
-  suspicion, they will mirror your disk before entering anything
-  supplied by you. This neatly negates any Nuke-Option. If they have
-  no suspicion (just harassing people that cross some border for
-  example), the Nuke-Option would work, but see above about likely
-  negative consequences and remember that a Nuke-Option may not work
-  reliably on SSD and hybrid drives anyways.
+  suspicion, they will mirror your disk before entering anything supplied
+  by you.  This neatly negates any Nuke-Option.  If they have no suspicion
+  (just harassing people that cross some border for example), the
+  Nuke-Option would work, but see above about likely negative consequences
+  and remember that a Nuke-Option may not work reliably on SSD and hybrid
+  drives anyways.
 
   Hence my advice is to never take data that you do not want to reveal
-  into any such situation in the first place. There is no need to
-  transfer data on physical carriers today. The Internet makes it
-  quite possible to transfer data between arbitrary places and modern
-  encryption makes it secure. If you do it right, nobody will even be
-  able to identify source or destination. (How to do that is out of
-  scope of this document. It does require advanced skills in this age
-  of pervasive surveillance.)
-
-  Hence, LUKS has not kill option because it would do much more harm
-  than good.
-
-  Still, if you have a good use-case (i.e. non-abstract real-world
-  situation) where a Nuke-Option would actually be beneficial, please
-  let me know.
+  into any such situation in the first place.  There is no need to
+  transfer data on physical carriers today.  The Internet makes it quite
+  possible to transfer data between arbitrary places and modern encryption
+  makes it secure.  If you do it right, nobody will even be able to
+  identify source or destination.  (How to do that is out of scope of this
+  document.  It does require advanced skills in this age of pervasive
+  surveillance.)
 
+  Hence, LUKS has not kill option because it would do much more harm than
+  good.
 
-6. Backup and Data Recovery 
+  Still, if you have a good use-case (i.e.  non-abstract real-world
+  situation) where a Nuke-Option would actually be beneficial, please let
+  me know.
+
+
+ * 5.22 Does cryptsetup open network connections to websites, etc. ?
+
+  This question seems not to make much sense at first glance, but here is
+  an example form the real world: The TrueCrypt GUI has a "Donation"
+  button.  Press it, and a web-connection to the TrueCrypt website is
+  opened via the default browser, telling everybody that listens that you
+  use TrueCrypt.  In the worst case, things like this can get people
+  tortured or killed.
+
+  So: Cryptsetup will never open any network connections except the
+  local netlink socket it needs to talk to the kernel crypto API.
+
+  In addition, the installation package should contain all documentation,
+  including this FAQ, so that you do not have to go to a web-site to read
+  it.  (If your distro cuts the docu, please complain to them.) In
+  security software, any connection initiated to anywhere outside your
+  machine should always be the result of an explicit request for such a
+  connection by the user and cryptsetup will stay true to that principle.
+
+
+6. Backup and Data Recovery
 
 
  * 6.1 Why do I need Backup?
 
-  First, disks die. The rate for well-treated (!) disk is about 5%
-  per year, which is high enough to worry about. There is some
-  indication that this may be even worse for some SSDs. This applies
-  both to LUKS and plain dm-crypt partitions.
+  First, disks die.  The rate for well-treated (!) disk is about 5% per
+  year, which is high enough to worry about.  There is some indication
+  that this may be even worse for some SSDs.  This applies both to LUKS
+  and plain dm-crypt partitions.
 
-  Second, for LUKS, if anything damages the LUKS header or the
-  key-stripe area then decrypting the LUKS device can become
-  impossible. This is a frequent occurrence. For example an
-  accidental format as FAT or some software overwriting the first
-  sector where it suspects a partition boot sector typically makes a
-  LUKS partition permanently inaccessible. See more below on LUKS
-  header damage.
+  Second, for LUKS, if anything damages the LUKS header or the key-stripe
+  area then decrypting the LUKS device can become impossible.  This is a
+  frequent occurrence.  For example an accidental format as FAT or some
+  software overwriting the first sector where it suspects a partition boot
+  sector typically makes a LUKS1 partition permanently inaccessible.  See
+  more below on LUKS header damage.
 
-  So, data-backup in some form is non-optional. For LUKS, you may
-  also want to store a header backup in some secure location. This
-  only needs an update if you change passphrases.
+  So, data-backup in some form is non-optional.  For LUKS, you may also
+  want to store a header backup in some secure location.  This only needs
+  an update if you change passphrases.
 
 
  * 6.2 How do I backup a LUKS header?
 
-  While you could just copy the appropriate number of bytes from the
-  start of the LUKS partition, the best way is to use command option
-  "luksHeaderBackup" of cryptsetup. This protects also against
-  errors when non-standard parameters have been used in LUKS
-  partition creation. Example:
+  While you could just copy the appropriate number of bytes from the start
+  of the LUKS partition, the best way is to use command option
+  "luksHeaderBackup" of cryptsetup.  This protects also against errors
+  when non-standard parameters have been used in LUKS partition creation.  
+  Example:
+
+    cryptsetup luksHeaderBackup --header-backup-file <file> <device>
 
-     cryptsetup luksHeaderBackup --header-backup-file <file> <device>
   To restore, use the inverse command, i.e.
 
-     cryptsetup luksHeaderRestore --header-backup-file <file> <device>
-  If you are unsure about a header to be restored, make a backup of
-  the current one first! You can also test the header-file without
-  restoring it by using the --header option for a detached header
-  like this:
+    cryptsetup luksHeaderRestore --header-backup-file <file> <device>
+
+  If you are unsure about a header to be restored, make a backup of the
+  current one first!  You can also test the header-file without restoring
+  it by using the --header option for a detached header like this:
+
+    cryptsetup --header <file> luksOpen <device> </dev/mapper/name>
 
-     cryptsetup --header <file> luksOpen <device> </dev/mapper/ -name>
   If that unlocks your keys-lot, you are good. Do not forget to close
   the device again.
 
+  Under some circumstances (damaged header), this fails.  Then use the
+  following steps in case it is LUKS1:
+
+  First determine the master-key size:
+
+    cryptsetup luksDump <device>
+
+  gives a line of the form
+
+    MK bits:        <bits>
+
+  with bits equal to 256 for the old defaults and 512 for the new
+  defaults.  256 bits equals a total header size of 1'052'672 Bytes and
+  512 bits one of 2MiB.  (See also Item 6.12) If luksDump fails, assume
+  2MiB, but be aware that if you restore that, you may also restore the
+  first 1M or so of the filesystem.  Do not change the filesystem if you
+  were unable to determine the header size!  With that, restoring a
+  too-large header backup is still safe.
+
+  Second, dump the header to file. There are many ways to do it, I
+  prefer the following:
+
+    head -c 1052672 <device>  >  header_backup.dmp
+
+  or
+
+    head -c 2M <device>  >  header_backup.dmp
+
+  for a 2MiB header. Verify the size of the dump-file to be sure.
+
+  To restore such a backup, you can try luksHeaderRestore or do a more
+  basic
+
+    cat header_backup.dmp  >  <device>
+
 
- * 6.3 How do I test a LUKS header?
+
+  * 6.3 How do I test for a LUKS header?
 
   Use
 
-     cryptsetup -v isLuks <device>
-  on the device. Without the "-v" it just signals its result via
-  exit-status. You can also use the more general test
+    cryptsetup -v isLuks <device>
 
-      blkid -p <device>
-  which will also detect other types and give some more info. Omit
+  on the device.  Without the "-v" it just signals its result via
+  exit-status.  You can also use the more general test
+
+    blkid -p <device>
+
+  which will also detect other types and give some more info.  Omit
   "-p" for old versions of blkid that do not support it.
 
 
- * 6.4 How do I backup a LUKS or dm-crypt partition?
 * 6.4 How do I backup a LUKS or dm-crypt partition?
 
-  There are two options, a sector-image and a plain file or
-  filesystem backup of the contents of the partition. The sector
-  image is already encrypted, but cannot be compressed and contains
-  all empty space. The filesystem backup can be compressed, can
-  contain only part of the encrypted device, but needs to be
-  encrypted separately if so desired.
+  There are two options, a sector-image and a plain file or filesystem
+  backup of the contents of the partition.  The sector image is already
+  encrypted, but cannot be compressed and contains all empty space.  The
+  filesystem backup can be compressed, can contain only part of the
+  encrypted device, but needs to be encrypted separately if so desired.
 
-  A sector-image will contain the whole partition in encrypted form,
-  for LUKS the LUKS header, the keys-slots and the data area. It can
-  be done under Linux e.g. with dd_rescue (for a direct image copy)
-  and with "cat" or "dd". Example:
+  A sector-image will contain the whole partition in encrypted form, for
+  LUKS the LUKS header, the keys-slots and the data area.  It can be done
+  under Linux e.g.  with dd_rescue (for a direct image copy) and with
+  "cat" or "dd".  Examples:
+
+    cat /dev/sda10 > sda10.img
+    dd_rescue /dev/sda10 sda10.img
+
+  You can also use any other backup software that is capable of making a
+  sector image of a partition.  Note that compression is ineffective for
+  encrypted data, hence it does not make sense to use it.
+
+  For a filesystem backup, you decrypt and mount the encrypted partition
+  and back it up as you would a normal filesystem.  In this case the
+  backup is not encrypted, unless your encryption method does that.  For
+  example you can encrypt a backup with "tar" as follows with GnuPG:
+
+    tar cjf - <path> | gpg --cipher-algo AES -c - > backup.tbz2.gpg
 
-      cat /dev/sda10 > sda10.img
-      dd_rescue /dev/sda10 sda10.img 
-  You can also use any other backup software that is capable of making
-  a sector image of a partition. Note that compression is
-  ineffective for encrypted data, hence it does not make sense to
-  use it.
-
-  For a filesystem backup, you decrypt and mount the encrypted
-  partition and back it up as you would a normal filesystem. In this
-  case the backup is not encrypted, unless your encryption method
-  does that. For example you can encrypt a backup with "tar" as
-  follows with GnuPG:
-
-      tar cjf - <path> | gpg --cipher-algo AES -c - > backup.tbz2.gpg
   And verify the backup like this if you are at "path":
 
-      cat backup.tbz2.gpg | gpg - | tar djf - 
+    cat backup.tbz2.gpg | gpg - | tar djf -
+
   Note: Always verify backups, especially encrypted ones!
 
-  There is one problem with verifying like this: The kernel may still
-  have some files cached and in fact verify them against RAM or may
-  even verify RAM against RAM, which defeats the purpose of the
-  exercise. The following command empties the kernel caches:
+  There is one problem with verifying like this: The kernel may still have
+  some files cached and in fact verify them against RAM or may even verify
+  RAM against RAM, which defeats the purpose of the exercise.  The
+  following command empties the kernel caches:
+
+    echo 3 > /proc/sys/vm/drop_caches
 
-      echo 3 > /proc/sys/vm/drop_caches
   Run it after backup and before verify.
 
-  In both cases GnuPG will ask you interactively for your symmetric
-  key. The verify will only output errors. Use "tar dvjf -" to get
-  all comparison results. To make sure no data is written to disk
+  In both cases GnuPG will ask you interactively for your symmetric key. 
+  The verify will only output errors.  Use "tar dvjf -" to get all
+  comparison results.  To make sure no data is written to disk
   unencrypted, turn off swap if it is not encrypted before doing the
   backup.
 
-  Restore works like certification with the 'd' ('difference')
-  replaced by 'x' ('eXtract'). Refer to the man-page of tar for more
-  explanations and instructions. Note that with default options tar
-  will overwrite already existing files without warning. If you are
-  unsure about how to use tar, experiment with it in a location
-  where you cannot do damage.
+  Restore works like certification with the 'd' ('difference') replaced 
+  by 'x' ('eXtract').  Refer to the man-page of tar for more explanations 
+  and instructions.  Note that with default options tar will overwrite 
+  already existing files without warning.  If you are unsure about how 
+  to use tar, experiment with it in a location where you cannot do damage.
 
-  You can of course use different or no compression and you can use
-  an asymmetric key if you have one and have a backup of the secret
-  key that belongs to it.
+  You can of course use different or no compression and you can use an
+  asymmetric key if you have one and have a backup of the secret key that
+  belongs to it.
 
-  A second option for a filesystem-level backup that can be used when
-  the backup is also on local disk (e.g. an external USB drive) is
-  to use a LUKS container there and copy the files to be backed up
-  between both mounted containers. Also see next item.
+  A second option for a filesystem-level backup that can be used when the
+  backup is also on local disk (e.g.  an external USB drive) is to use a
+  LUKS container there and copy the files to be backed up between both
+  mounted containers.  Also see next item.
 
 
- * 6.5 Do I need a backup of the full partition? Would the header and
-   key-slots not be enough?
+  * 6.5 Do I need a backup of the full partition? Would the header
+    and  key-slots not be enough?
 
-  Backup protects you against two things: Disk loss or corruption
-  and user error. By far the most questions on the dm-crypt mailing
-  list about how to recover a damaged LUKS partition are related
-  to user error. For example, if you create a new filesystem on a
-  LUKS partition, chances are good that all data is lost
-  permanently.
+  Backup protects you against two things: Disk loss or corruption and user
+  error.  By far the most questions on the dm-crypt mailing list about how
+  to recover a damaged LUKS partition are related to user error.  For
+  example, if you create a new filesystem on a non-mapped LUKS container,
+  chances are good that all data is lost permanently.
 
-  For this case, a header+key-slot backup would often be enough. But
-  keep in mind that a well-treated (!) HDD has roughly a failure
-  risk of 5% per year. It is highly advisable to have a complete
-  backup to protect against this case.
+  For this case, a header+key-slot backup would often be enough.  But keep
+  in mind that a well-treated (!) HDD has roughly a failure risk of 5% per
+  year.  It is highly advisable to have a complete backup to protect
+  against this case.
 
 
-  * *6.6 What do I need to backup if I use "decrypt_derived"?
+  * 6.6 What do I need to backup if I use "decrypt_derived"?
 
-  This is a script in Debian, intended for mounting /tmp or swap with
-  a key derived from the master key of an already decrypted device.
-  If you use this for an device with data that should be persistent,
-  you need to make sure you either do not lose access to that master
-  key or have a backup of the data. If you derive from a LUKS
-  device, a header backup of that device would cover backing up the
-  master key. Keep in mind that this does not protect against disk
-  loss.
+  This is a script in Debian, intended for mounting /tmp or swap with a
+  key derived from the master key of an already decrypted device.  If you
+  use this for an device with data that should be persistent, you need to
+  make sure you either do not lose access to that master key or have a
+  backup of the data.  If you derive from a LUKS device, a header backup
+  of that device would cover backing up the master key.  Keep in mind that
+  this does not protect against disk loss.
 
   Note: If you recreate the LUKS header of the device you derive from
   (using luksFormat), the master key changes even if you use the same
-  passphrase(s) and you will not be able to decrypt the derived
-  device with the new LUKS header.
+  passphrase(s) and you will not be able to decrypt the derived device
+  with the new LUKS header.
 
 
- * 6.7 Does a backup compromise security?
 * 6.7 Does a backup compromise security?
 
-  Depends on how you do it. However if you do not have one, you are
-  going to eventually lose your encrypted data.
+  Depends on how you do it.  However if you do not have one, you are going
+  to eventually lose your encrypted data.
 
-  There are risks introduced by backups. For example if you
-  change/disable a key-slot in LUKS, a binary backup of the partition
-  will still have the old key-slot. To deal with this, you have to
-  be able to change the key-slot on the backup as well, securely
-  erase the backup or do a filesystem-level backup instead of a binary
-  one.
+  There are risks introduced by backups.  For example if you
+  change/disable a key-slot in LUKS, a binary backup of the partition will
+  still have the old key-slot.  To deal with this, you have to be able to
+  change the key-slot on the backup as well, securely erase the backup or
+  do a filesystem-level backup instead of a binary one.
 
-  If you use dm-crypt, backup is simpler: As there is no key
-  management, the main risk is that you cannot wipe the backup when
-  wiping the original. However wiping the original for dm-crypt
-  should consist of forgetting the passphrase and that you can do
-  without actual access to the backup.
+  If you use dm-crypt, backup is simpler: As there is no key management,
+  the main risk is that you cannot wipe the backup when wiping the
+  original.  However wiping the original for dm-crypt should consist of
+  forgetting the passphrase and that you can do without actual access to
+  the backup.
 
-  In both cases, there is an additional (usually small) risk with
-  binary backups: An attacker can see how many sectors and which
-  ones have been changed since the backup. To prevent this, use a
-  filesystem level backup method that encrypts the whole backup in
-  one go, e.g. as described above with tar and GnuPG.
+  In both cases, there is an additional (usually small) risk with binary
+  backups: An attacker can see how many sectors and which ones have been
+  changed since the backup.  To prevent this, use a filesystem level
+  backup method that encrypts the whole backup in one go, e.g.  as
+  described above with tar and GnuPG.
 
-  My personal advice is to use one USB disk (low value data) or
-  three disks (high value data) in rotating order for backups, and
-  either use independent LUKS partitions on them, or use encrypted
-  backup with tar and GnuPG.
+  My personal advice is to use one USB disk (low value data) or three
+  disks (high value data) in rotating order for backups, and either use
+  independent LUKS partitions on them, or use encrypted backup with tar
+  and GnuPG.
 
-  If you do network-backup or tape-backup, I strongly recommend to
-  go the filesystem backup path with independent encryption, as you
-  typically cannot reliably delete data in these scenarios,
-  especially in a cloud setting. (Well, you can burn the tape if it
-  is under your control...)
+  If you do network-backup or tape-backup, I strongly recommend to go
+  the filesystem backup path with independent encryption, as you
+  typically cannot reliably delete data in these scenarios, especially
+  in a cloud setting.  (Well, you can burn the tape if it is under your
+  control...)
 
 
- * 6.8 What happens if I overwrite the start of a LUKS partition or
-   damage the LUKS header or key-slots?
 * 6.8 What happens if I overwrite the start of a LUKS partition or
+    damage the LUKS header or key-slots?
 
-  There are two critical components for decryption: The salt values
-  in the key-slot descriptors of the header and the key-slots. If the
-  salt values are overwritten or changed, nothing (in the
-  cryptographically strong sense) can be done to access the data,
-  unless there is a backup of the LUKS header. If a key-slot is
-  damaged, the data can still be read with a different key-slot, if
-  there is a remaining undamaged and used key-slot. Note that in
-  order to make a key-slot unrecoverable in a cryptographically
-  strong sense, changing about 4-6 bits in random locations of its
-  128kiB size is quite enough.
+  There are two critical components for decryption: The salt values in the
+  key-slot descriptors of the header and the key-slots.  For LUKS2 they
+  are a bit better protected.  but for LUKS1, these are right in the first
+  sector.  If the salt values are overwritten or changed, nothing (in the
+  cryptographically strong sense) can be done to access the data, unless
+  there is a backup of the LUKS header.  If a key-slot is damaged, the
+  data can still be read with a different key-slot, if there is a
+  remaining undamaged and used key-slot.  Note that in order to make a
+  key-slot completely unrecoverable, changing about 4-6 bits in random
+  locations of its 128kiB size is quite enough.
 
 
- * 6.9 What happens if I (quick) format a LUKS partition?
 * 6.9 What happens if I (quick) format a LUKS partition?
 
-  I have not tried the different ways to do this, but very likely you
-  will have written a new boot-sector, which in turn overwrites the
-  LUKS header, including the salts, making your data permanently
-  irretrievable, unless you have a LUKS header backup. You may also
-  damage the key-slots in part or in full. See also last item.
+  I have not tried the different ways to do this, but very likely you will
+  have written a new boot-sector, which in turn overwrites the LUKS
+  header, including the salts, making your data permanently irretrievable,
+  unless you have a LUKS header backup.  For LUKS2 this may still be
+  recoverable without that header backup, for LUKS1 it is not.  You may
+  also damage the key-slots in part or in full.  See also last item.
 
 
* 6.10 How do I recover the master key from a mapped LUKS container?
 * 6.10 How do I recover the master key from a mapped LUKS1 container?
 
-  This is typically only needed if you managed to damage your LUKS
-  header, but the container is still mapped, i.e. "luksOpen"ed. It
-  also helps if you have a mapped container that you forgot or do not
-  know a passphrase for (e.g. on a long running server.)
+  Note: LUKS2 uses the kernel keyring to store keys and hence this
+  procedure does not work unless you have explicitly disabled the use of
+  the keyring with "--disable-keyring" on opening.
+  This is typically only needed if you managed to damage your LUKS1
+  header, but the container is still mapped, i.e.  "luksOpen"ed.  It also
+  helps if you have a mapped container that you forgot or do not know a
+  passphrase for (e.g.  on a long running server.)
 
   WARNING: Things go wrong, do a full backup before trying this!
 
-  WARNING: This exposes the master key of the LUKS container. Note
-  that both ways to recreate a LUKS header with the old master key
-  described below will write the master key to disk. Unless you are
-  sure you have securely erased it afterwards, e.g. by writing it to
-  an encrypted partition, RAM disk or by erasing the filesystem you
-  wrote it to by a complete overwrite, you should change the master
-  key afterwards.    Changing the master key requires a full data
-  backup, luksFormat and then restore of the backup.
-
-  First, there is a script by Milan that automates    the whole
-  process, except generating a new LUKS header with the old master
-  key (it prints the command for that though):
+  WARNING: This exposes the master key of the LUKS1 container.  Note that
+  both ways to recreate a LUKS header with the old master key described
+  below will write the master key to disk.  Unless you are sure you have
+  securely erased it afterwards, e.g.  by writing it to an encrypted
+  partition, RAM disk or by erasing the filesystem you wrote it to by a
+  complete overwrite, you should change the master key afterwards. 
+  Changing the master key requires a full data backup, luksFormat and then
+  restore of the backup.  Alternatively the tool cryptsetup-reencrypt from
+  the cryptsetup package can be used to change the master key (see its
+  man-page), but a full backup is still highly recommended.
+
+  First, there is a script by Milan that automates the whole process,
+  except generating a new LUKS1 header with the old master key (it prints
+  the command for that though):
 
   https://gitlab.com/cryptsetup/cryptsetup/blob/master/misc/luks-header-from-active
 
   You can also do this manually. Here is how:
 
-  - Get the master key from the device mapper. This is done by the
-  following command. Substitute c5 for whatever you mapped to:
+  - Get the master key from the device mapper.  This is done by the
+  following command.  Substitute c5 for whatever you mapped to:
 
-      # dmsetup table --target crypt --showkey /dev/mapper/c5
-      Result:
-      0 200704 crypt aes-cbc-essiv:sha256 
-      a1704d9715f73a1bb4db581dcacadaf405e700d591e93e2eaade13ba653d0d09 
-      0 7:0 4096
-  The result is actually one line, wrapped here for clarity. The long
+    # dmsetup table --target crypt --showkey /dev/mapper/c5
+
+    Result:
+    0 200704 crypt aes-cbc-essiv:sha256
+    a1704d9715f73a1bb4db581dcacadaf405e700d591e93e2eaade13ba653d0d09
+    0 7:0 4096
+
+  The result is actually one line, wrapped here for clarity.  The long
   hex string is the master key.
 
-  - Convert the master key to a binary file representation. You can
-  do this manually, e.g. with hexedit. You can also use the tool
-  "xxd" from vim like this:
+  - Convert the master key to a binary file representation.  You can do
+  this manually, e.g.  with hexedit.  You can also use the tool "xxd"
+  from vim like this:
+
+    echo "a1704d9....53d0d09" | xxd -r -p > <master-key-file>
 
-      echo "a1704d9....53d0d09" | xxd -r -p > <master-key-file>
-  - Do a luksFormat to create a new LUKS header.
 
-    NOTE: If your header is intact and you just forgot the
-  passphrase, you can just set a new passphrase, see next
-  sub-item.
+  - Do a luksFormat to create a new LUKS1 header.
+
+    NOTE: If your header is intact and you just forgot the passphrase,
+    you can just set a new passphrase, see next sub-item.
 
   Unmap the device before you do that (luksClose). Then do
 
-      cryptsetup luksFormat --master-key-file=<master-key-file> <luks device>
+    cryptsetup luksFormat --master-key-file=<master-key-file> <luks device>
+
   Note that if the container was created with other than the default
   settings of the cryptsetup version you are using, you need to give
-  additional parameters specifying the deviations. If in doubt, try
-  the script by Milan. It does recover the other parameters as well.
+  additional parameters specifying the deviations.  If in doubt, try the
+  script by Milan.  It does recover the other parameters as well.
 
-  Side note: This is the way the decrypt_derived script gets at the
-  master key. It just omits the conversion and hashes the master key
-  string.
+  Side note: This is the way the decrypt_derived script gets at the master
+  key.  It just omits the conversion and hashes the master key string.
 
   - If the header is intact and you just forgot the passphrase, just
   set a new passphrase like this:
 
       cryptsetup luksAddKey --master-key-file=<master-key-file> <luks device>
+
   You may want to disable the old one afterwards.
 
 
- * 6.11 What does the on-disk structure of dm-crypt look like?
-
-  There is none. dm-crypt takes a block device and gives encrypted
-  access to each of its blocks with a key derived from the passphrase
-  given. If you use a cipher different than the default, you have to
-  specify that as a parameter to cryptsetup too. If you want to
-  change the password, you basically have to create a second
-  encrypted device with the new passphrase and copy your data over.
-  On the plus side, if you accidentally overwrite any part of a
-  dm-crypt device, the damage will be limited to the area you
-  overwrote.
-
-
- * 6.12 What does the on-disk structure of LUKS look like?
-
-  A LUKS partition consists of a header, followed by 8 key-slot
-  descriptors, followed by 8 key slots, followed by the encrypted
-  data area.
-
-  Header and key-slot descriptors fill the first 592 bytes. The
-  key-slot size depends on the creation parameters, namely on the
-  number of anti-forensic stripes, key material offset and master
-  key size.
-
-  With the default parameters, each key-slot is a bit less than
-  128kiB in size. Due to sector alignment of the key-slot start,
-  that means the key block 0 is at offset 0x1000-0x20400, key
-  block 1 at offset 0x21000-0x40400, and key block 7 at offset
-  0xc1000-0xe0400. The space to the next full sector address is
-  padded with zeros. Never used key-slots are filled with what the
-  disk originally contained there, a key-slot removed with
-  "luksRemoveKey" or "luksKillSlot" gets filled with 0xff. Due to
-  2MiB default alignment, start of the data area for cryptsetup 1.3
-  and later is at 2MiB, i.e. at 0x200000. For older versions, it is
-  at 0x101000, i.e. at 1'052'672 bytes, i.e. at 1MiB + 4096 bytes
-  from the start of the partition. Incidentally, "luksHeaderBackup"
-  for a LUKS container created with default parameters dumps exactly
-  the first 2MiB (or 1'052'672 bytes for   headers created with
-  cryptsetup versions < 1.3) to file and "luksHeaderRestore" restores
+  * 6.11 What does the on-disk structure of dm-crypt look like?
+
+  There is none.  dm-crypt takes a block device and gives encrypted access
+  to each of its blocks with a key derived from the passphrase given.  If
+  you use a cipher different than the default, you have to specify that as
+  a parameter to cryptsetup too.  If you want to change the password, you
+  basically have to create a second encrypted device with the new
+  passphrase and copy your data over.  On the plus side, if you
+  accidentally overwrite any part of a dm-crypt device, the damage will be
+  limited to the area you overwrote.
+
+
+  * 6.12 What does the on-disk structure of LUKS1 look like?
+
+  Note: For LUKS2, refer to the LUKS2 document referenced in Item 1.2
+
+  A LUKS1 partition consists of a header, followed by 8 key-slot
+  descriptors, followed by 8 key slots, followed by the encrypted data
+  area.
+
+  Header and key-slot descriptors fill the first 592 bytes.  The key-slot
+  size depends on the creation parameters, namely on the number of
+  anti-forensic stripes, key material offset and master key size.
+
+  With the default parameters, each key-slot is a bit less than 128kiB in
+  size.  Due to sector alignment of the key-slot start, that means the key
+  block 0 is at offset 0x1000-0x20400, key block 1 at offset
+  0x21000-0x40400, and key block 7 at offset 0xc1000-0xe0400.  The space
+  to the next full sector address is padded with zeros.  Never used
+  key-slots are filled with what the disk originally contained there, a
+  key-slot removed with "luksRemoveKey" or "luksKillSlot" gets filled with
+  0xff.  Due to 2MiB default alignment, start of the data area for
+  cryptsetup 1.3 and later is at 2MiB, i.e.  at 0x200000.  For older
+  versions, it is at 0x101000, i.e.  at 1'052'672 bytes, i.e.  at 1MiB +
+  4096 bytes from the start of the partition.  Incidentally,
+  "luksHeaderBackup" for a LUKS container created with default parameters
+  dumps exactly the first 2MiB (or 1'052'672 bytes for headers created
+  with cryptsetup versions < 1.3) to file and "luksHeaderRestore" restores
   them.
 
-  For non-default parameters, you have to figure out placement
-  yourself. "luksDump" helps. See also next item. For the most common
-  non-default settings, namely aes-xts-plain with 512 bit key, the
-  offsets are: 1st keyslot 0x1000-0x3f800, 2nd keyslot
-  0x40000-0x7e000, 3rd keyslot 0x7e000-0xbd800, ..., and start of
-  bulk data at 0x200000.
+  For non-default parameters, you have to figure out placement yourself. 
+  "luksDump" helps.  See also next item.  For the most common non-default
+  settings, namely aes-xts-plain with 512 bit key, the offsets are: 1st
+  keyslot 0x1000-0x3f800, 2nd keyslot 0x40000-0x7e000, 3rd keyslot
+  0x7e000-0xbd800, ..., and start of bulk data at 0x200000.
 
   The exact specification of the format is here:
-  https://gitlab.com/cryptsetup/cryptsetup/wikis/Specification
+     https://gitlab.com/cryptsetup/cryptsetup/wikis/Specification
+
+  For your convenience, here is the LUKS1 header with hex offsets.  
+  NOTE:
+  The spec counts key-slots from 1 to 8, but the cryptsetup tool counts
+  from 0 to 7.  The numbers here refer to the cryptsetup numbers.
+
 
-  For your convenience, here is the LUKS header with hex offsets.
-  NOTE: The spec counts key-slots from 1 to 8, but the cryptsetup
-  tool counts from 0 to 7. The numbers here refer to the cryptsetup
-  numbers.
+Refers to LUKS1 On-Disk Format Specification Version 1.2.3
+
+LUKS1 header:
 
-Refers to LUKS On-Disk Format Specification Version 1.2.1
-LUKS header:
 offset  length  name             data type  description
 -----------------------------------------------------------------------
 0x0000   0x06   magic            byte[]     'L','U','K','S', 0xba, 0xbe
@@ -2140,7 +2303,10 @@ offset  length  name             data type  description
    496     48
 0x0220   0x30   key-slot-7       key slot   key slot 7
    544     48
+
+
 Key slot:
+
 offset  length  name                  data type  description
 -------------------------------------------------------------------------
 0x0000   0x04   active                uint32_t   key slot enabled/disabled
@@ -2153,114 +2319,113 @@ offset  length  name                  data type  description
     40      4                                    (512 bytes/sector)
 0x002c   0x04   stripes               uint32_t   number of anti-forensic
     44      4                                    stripes
 
- * 6.13 What is the smallest possible LUKS container?
 
-  Note: From cryptsetup 1.3 onwards, alignment is set to 1MB. With
-  modern Linux partitioning tools that also align to 1MB, this will
-  result in alignment to 2k sectors and typical Flash/SSD sectors,
-  which is highly desirable for a number of reasons. Changing the
-  alignment is not recommended.
 
-  That said, with default parameters, the data area starts at
-  exactly 2MB offset (at 0x101000 for cryptsetup versions before
-  1.3). The smallest data area you can have is one sector of 512
-  bytes. Data areas of 0 bytes can be created, but fail on mapping.
+  * 6.13 What is the smallest possible LUKS1 container?
+
+  Note: From cryptsetup 1.3 onwards, alignment is set to 1MB.  With modern
+  Linux partitioning tools that also align to 1MB, this will result in
+  alignment to 2k sectors and typical Flash/SSD sectors, which is highly
+  desirable for a number of reasons.  Changing the alignment is not
+  recommended.
+
+  That said, with default parameters, the data area starts at exactly 2MB
+  offset (at 0x101000 for cryptsetup versions before 1.3).  The smallest
+  data area you can have is one sector of 512 bytes.  Data areas of 0
+  bytes can be created, but fail on mapping.
 
   While you cannot put a filesystem into something this small, it may
-  still be used to contain, for example, key. Note that with current
-  formatting tools, a partition for a container this size will be
-  3MiB anyways. If you put the LUKS container into a file (via
-  losetup and a loopback device), the file needs to be 2097664 bytes
-  in size, i.e. 2MiB + 512B.
-
-  There two ways to influence the start of the data area are key-size
-  and alignment.
-
-  For alignment, you can go down to 1 on the parameter. This will
-  still leave you with a data-area starting at 0x101000, i.e.
-  1MiB+4096B (default parameters) as alignment will be rounded up to
-  the next multiple of 8 (i.e. 4096 bytes) If in doubt, do a dry-run
-  on a larger file and dump the LUKS header to get actual
-  information.
-
-  For key-size, you can use 128 bit (e.g. AES-128 with CBC), 256 bit
-  (e.g. AES-256 with CBC) or 512 bit (e.g. AES-256 with XTS mode).
-  You can do 64 bit (e.g. blowfish-64 with CBC), but anything below
-  128 bit has to be considered insecure today.
+  still be used to contain, for example, key.  Note that with current
+  formatting tools, a partition for a container this size will be 3MiB
+  anyways.  If you put the LUKS container into a file (via losetup and a
+  loopback device), the file needs to be 2097664 bytes in size, i.e.  2MiB
+  + 512B.
+
+  The two ways to influence the start of the data area are key-size and
+  alignment.
+
+  For alignment, you can go down to 1 on the parameter.  This will still
+  leave you with a data-area starting at 0x101000, i.e.  1MiB+4096B
+  (default parameters) as alignment will be rounded up to the next
+  multiple of 8 (i.e.  4096 bytes) If in doubt, do a dry-run on a larger
+  file and dump the LUKS header to get actual information.
+
+  For key-size, you can use 128 bit (e.g.  AES-128 with CBC), 256 bit
+  (e.g.  AES-256 with CBC) or 512 bit (e.g.  AES-256 with XTS mode).  You
+  can do 64 bit (e.g.  blowfish-64 with CBC), but anything below 128 bit
+  has to be considered insecure today.
 
   Example 1 - AES 128 bit with CBC:
 
       cryptsetup luksFormat -s 128 --align-payload=8 <device>
+
   This results in a data offset of 0x81000, i.e. 516KiB or 528384
-  bytes. Add one 512 byte sector and the smallest LUKS container size
+  bytes.  Add one 512 byte sector and the smallest LUKS container size
   with these parameters is 516KiB + 512B or 528896 bytes.
 
   Example 2 - Blowfish 64 bit with CBC (WARNING: insecure):
 
       cryptsetup luksFormat -c blowfish -s 64 --align-payload=8 /dev/loop0
+
   This results in a data offset of 0x41000, i.e. 260kiB or 266240
-  bytes, with a minimal LUKS container size of 260kiB + 512B or
-  266752 bytes.
+  bytes, with a minimal LUKS1 container size of 260kiB + 512B or 266752
+  bytes.
 
 
- * 6.14 I think this is overly complicated. Is there an alternative?
 * 6.14 I think this is overly complicated. Is there an alternative?
 
-  Not really. Encryption comes at a price. You can use plain
-  dm-crypt to simplify things a bit. It does not allow multiple
-  passphrases, but on the plus side, it has zero on disk description
-  and if you overwrite some part of a plain dm-crypt partition,
-  exactly the overwritten parts are lost (rounded up to sector
-  borders).
+  Not really.  Encryption comes at a price.  You can use plain dm-crypt to
+  simplify things a bit.  It does not allow multiple passphrases, but on
+  the plus side, it has zero on disk description and if you overwrite some
+  part of a plain dm-crypt partition, exactly the overwritten parts are
+  lost (rounded up to full sectors).
 
+  * 6.15 Can I clone a LUKS container?
 
- * 6.15 Can I clone a LUKS container?
+  You can, but it breaks security, because the cloned container has the
+  same header and hence the same master key.  Even if you change the 
+  passphrase(s), the master key stays the same.  That means whoever has 
+  access to one of the clones can decrypt them all, completely bypassing 
+  the passphrases. 
 
-  You can, but it breaks security, because the cloned container has
-  the same header and hence the same master key. You cannot change
-  the master key on a LUKS container, even if you change the
-  passphrase(s), the master key stays the same. That means whoever
-  has access to one of the clones can decrypt them all, completely
-  bypassing the passphrases.
+  While you can use cryptsetup-reencrypt to change the master key, 
+  this is probably more effort than to create separate LUKS containers
+  in the first place.
 
-  The right way to do this is to first luksFormat the target
-  container, then to clone the contents of the source container, with
-  both containers mapped, i.e. decrypted. You can clone the decrypted
-  contents of a LUKS container in binary mode, although you may run
-  into secondary issues with GUIDs in filesystems, partition tables,
-  RAID-components and the like. These are just the normal problems
-  binary cloning causes.
+  The right way to do this is to first luksFormat the target container,
+  then to clone the contents of the source container, with both containers
+  mapped, i.e.  decrypted.  You can clone the decrypted contents of a LUKS
+  container in binary mode, although you may run into secondary issues
+  with GUIDs in filesystems, partition tables, RAID-components and the
+  like.  These are just the normal problems binary cloning causes.
 
   Note that if you need to ship (e.g.) cloned LUKS containers with a
   default passphrase, that is fine as long as each container was
-  individually created (and hence has its own master key). In this
-  case, changing the default passphrase will make it secure again.
+  individually created (and hence has its own master key).  In this case,
+  changing the default passphrase will make it secure again.
 
 
-7. Interoperability with other Disk Encryption Tools  
+7. Interoperability with other Disk Encryption Tools
 
 
- * 7.1 What is this section about?
 * 7.1 What is this section about?
 
-  Cryptsetup for plain dm-crypt can be used to access a number of
-  on-disk formats created by tools like loop-aes patched into
-  losetup. This sometimes works and sometimes does not.    This
-  section collects insights into what works, what does not and where
-  more information is required.
+  Cryptsetup for plain dm-crypt can be used to access a number of on-disk
+  formats created by tools like loop-aes patched into losetup.  This
+  sometimes works and sometimes does not.  This section collects insights
+  into what works, what does not and where more information is required.
 
   Additional information may be found in the mailing-list archives,
-  mentioned at the start of this FAQ document. If you have a
-  solution working that is not yet documented here and think a wider
-  audience may be interested, please email the FAQ maintainer.
+  mentioned at the start of this FAQ document.  If you have a solution
+  working that is not yet documented here and think a wider audience may
+  be interested, please email the FAQ maintainer.
 
 
- * 7.2 loop-aes: General observations.
 * 7.2 loop-aes: General observations.
 
-  One problem is that there are different versions of losetup around.
-  loop-aes is a patch for losetup. Possible problems and deviations
+  One problem is that there are different versions of losetup around. 
+  loop-aes is a patch for losetup.  Possible problems and deviations
   from cryptsetup option syntax include:
 
   - Offsets specified in bytes (cryptsetup: 512 byte sectors)
@@ -2273,49 +2438,53 @@ offset  length  name                  data type  description
 
   - Passphrase hash algorithm needs specifying
 
-  Also note that because plain dm-crypt and loop-aes format does not
-  have metadata, and while the loopAES extension for cryptsetup tries
-  autodetection (see command loopaesOpen), it may not always work.
-  If you still have the old set-up, using a verbosity option (-v)
-  on mapping with the old tool or having a look into the system logs
-  after setup could give you the information you need. Below, there
-  are also some things that worked for somebody.
+  Also note that because plain dm-crypt and loop-aes format does not have
+  metadata, and while the loopAES extension for cryptsetup tries
+  autodetection (see command loopaesOpen), it may not always work.  If you
+  still have the old set-up, using a verbosity option (-v) on mapping with
+  the old tool or having a look into the system logs after setup could
+  give you the information you need.  Below, there are also some things
+  that worked for somebody.
 
 
- * 7.3 loop-aes patched into losetup on Debian 5.x, kernel 2.6.32
 * 7.3 loop-aes patched into losetup on Debian 5.x, kernel 2.6.32
 
   In this case, the main problem seems to be that this variant of
-  losetup takes the offset (-o option) in bytes, while cryptsetup
-  takes it in sectors of 512 bytes each. Example: The losetup command
+  losetup takes the offset (-o option) in bytes, while cryptsetup takes
+  it in sectors of 512 bytes each.  
+
+  Example: The losetup command
+
+    losetup -e twofish -o 2560 /dev/loop0 /dev/sdb1
+    mount /dev/loop0 mount-point
 
-  losetup -e twofish -o 2560 /dev/loop0 /dev/sdb1 
-  mount /dev/loop0 mount-point
   translates to
 
-  cryptsetup create -c twofish -o 5 --skip 5 e1 /dev/sdb1
-  mount /dev/mapper/e1 mount-point
+    cryptsetup create -c twofish -o 5 --skip 5 e1 /dev/sdb1
+    mount /dev/mapper/e1 mount-point
 
- * 7.4 loop-aes with 160 bit key
 
-  This seems to be sometimes used with twofish and blowfish and
-  represents a 160 bit ripemed160 hash output padded to 196 bit key
-  length. It seems the corresponding options for cryptsetup are
 
-  --cipher twofish-cbc-null -s 192 -h ripemd160:20
+  * 7.4 loop-aes with 160 bit key
 
- * 7.5 loop-aes v1 format OpenSUSE
+  This seems to be sometimes used with twofish and blowfish and represents
+  a 160 bit ripemed160 hash output padded to 196 bit key length.  It seems
+  the corresponding options for cryptsetup are
+
+    --cipher twofish-cbc-null -s 192 -h ripemd160:20
 
-  Apparently this is done by older OpenSUSE distros and stopped
-  working from OpenSUSE 12.1 to 12.2. One user had success with the
-  following:
 
-  cryptsetup create <target> <device> -c aes -s 128 -h sha256
 
- * 7.6 Kernel encrypted loop device (cryptoloop)
+  * 7.5 loop-aes v1 format OpenSUSE
+
+  Apparently this is done by older OpenSUSE distros and stopped working
+  from OpenSUSE 12.1 to 12.2.  One user had success with the following:
+
+    cryptsetup create <target> <device> -c aes -s 128 -h sha256
+
+
+
+  * 7.6 Kernel encrypted loop device (cryptoloop)
 
   There are a number of different losetup implementations for using
   encrypted loop devices so getting this to work may need a bit of
@@ -2327,176 +2496,526 @@ offset  length  name                  data type  description
   Example for a compatible mapping:
 
     losetup -e twofish -N /dev/loop0 /image.img
+
   translates to
 
     cryptsetup create image_plain /image.img -c twofish-cbc-plain -H plain
+
   with the mapping being done to /dev/mapper/image_plain instead of
   to /dev/loop0.
 
   More details:
 
-  Cipher, mode and pasword hash (or no hash):
+  Cipher, mode and password hash (or no hash):
 
   -e cipher [-N]        => -c cipher-cbc-plain -H plain [-s 256]
   -e cipher             => -c cipher-cbc-plain -H ripemd160 [-s 256]
-  Key size and offsets (losetup: bytes, cryptsetuop: sectors of 512
-  bytes):
+
+
+  Key size and offsets (losetup: bytes, cryptsetuop: sectors of 512 bytes):
 
   -k 128                 => -s 128
   -o 2560                => -o 5 -p 5       # 2560/512 = 5
+
+
   There is no replacement for --pass-fd, it has to be emulated using
   keyfiles, see the cryptsetup man-page.
 
 
-8. Issues with Specific Versions of cryptsetup 
+8. Issues with Specific Versions of cryptsetup
 
 
- * 8.1 When using the create command for plain dm-crypt with
-   cryptsetup 1.1.x, the mapping is incompatible and my data is not
-   accessible anymore!
 * 8.1 When using the create command for plain dm-crypt with
+    cryptsetup 1.1.x, the mapping is incompatible and my data is not
+    accessible anymore!
 
   With cryptsetup 1.1.x, the distro maintainer can define different
-  default encryption modes. You can check the compiled-in defaults
-  using "cryptsetup --help". Moreover, the plain device default
-  changed because the old IV mode was vulnerable to a watermarking
-  attack.
+  default encryption modes.  You can check the compiled-in defaults using
+  "cryptsetup --help".  Moreover, the plain device default changed because
+  the old IV mode was vulnerable to a watermarking attack.
 
   If you are using a plain device and you need a compatible mode, just
-  specify cipher, key size and hash algorithm explicitly. For
-  compatibility with cryptsetup 1.0.x defaults, simple use the
-  following:
+  specify cipher, key size and hash algorithm explicitly.  For
+  compatibility with cryptsetup 1.0.x defaults, simple use the following:
 
     cryptsetup create -c aes-cbc-plain -s 256 -h ripemd160 <name> <dev>
+
   LUKS stores cipher and mode in the metadata on disk, avoiding this
   problem.
 
 
- * 8.2 cryptsetup on SLED 10 has problems...
 * 8.2 cryptsetup on SLED 10 has problems...
 
-  SLED 10 is missing an essential kernel patch for dm-crypt, which
-  is broken in its kernel as a result. There may be a very old
-  version of cryptsetup (1.0.x) provided by SLED, which should also
-  not be used anymore as well. My advice would be to drop SLED 10.
+  SLED 10 is missing an essential kernel patch for dm-crypt, which is
+  broken in its kernel as a result.  There may be a very old version of
+  cryptsetup (1.0.x) provided by SLED, which should also not be used
+  anymore as well.  My advice would be to drop SLED 10.
 
 
* 8.3 Gcrypt after 1.5.3 breaks Whirlpool
 * 8.3 Gcrypt 1.6.x and later break Whirlpool
 
-  It is the other way round: In gcrypt 1.5.3 and before Whirlpool is
-  broken and it was fixed in the next version. If you selected
-  whirlpool as hash on creation of a LUKS container, it does not work
-  anymore with the fixed library. This shows one serious risk of
-  using rarely used settings.
+  It is the other way round: In gcrypt 1.5.x, Whirlpool is broken and it
+  was fixed in 1.6.0 and later.  If you selected whirlpool as hash on
+  creation of a LUKS container, it does not work anymore with the fixed
+  library.  This shows one serious risk of using rarely used settings.
 
-  The only two ways to deal with this are either to decrypt with an
-  old gcrypt version that has the flaw or to use a compatibility
-  feature introduced in cryptsetup 1.6.4 and gcrypt 1.6.1 or later.
-  Versions of gcrypt between 1.5.4 and 1.6.0 cannot be used.
+  Note that at the time this FAQ item was written, 1.5.4 was the latest
+  1.5.x version and it has the flaw, i.e.  works with the old Whirlpool
+  version.  Possibly later 1.5.x versions will work as well.  If not,
+  please let me know.
+
+  The only two ways to access older LUKS containers created with Whirlpool
+  are to either decrypt with an old gcrypt version that has the flaw or to
+  use a compatibility feature introduced in cryptsetup 1.6.4 and gcrypt
+  1.6.1 or later.  Version 1.6.0 cannot be used.
 
   Steps:
 
-  - Make a least a header backup or better, refresh your full
-  backup. (You have a full backup, right? See Item 6.1 and
-  following.)
+  - Make at least a header backup or better, refresh your full backup. 
+  (You have a full backup, right?  See Item 6.1 and following.)
 
   - Make sure you have cryptsetup 1.6.4 or later and check the gcrypt
-  version:
+    version:
 
      cryptsetup luksDump <your luks device> --debug | grep backend
-  If gcrypt is at version 1.5.3 or before:
 
-  - Reencrypt the LUKS header with a different hash. (Requires
-  entering all keyslot passphrases. If you do not have all, remove
-  the ones you do not have before.):
+  If gcrypt is at version 1.5.x or before:
+
+  - Reencrypt the LUKS header with a different hash. (Requires entering
+  all keyslot passphrases.  If you do not have all, remove the ones you
+  do not have before.):
 
      cryptsetup-reencrypt --keep-key --hash sha256 <your luks device>
+
   If gcrypt is at version 1.6.1 or later:
 
   - Patch the hash name in the LUKS header from "whirlpool" to
-  "whirlpool_gcryptbug". This activates the broken implementation.
+  "whirlpool_gcryptbug".  This activates the broken implementation. 
   The detailed header layout is in Item 6.12 of this FAQ and in the
-  LUKS on-disk format specification. One way to change the hash is
+  LUKS on-disk format specification.  One way to change the hash is
   with the following command:
 
      echo -n -e 'whirlpool_gcryptbug\0' | dd of=<luks device> bs=1 seek=72 conv=notrunc
+
+  - You can now open the device again. It is highly advisable to change
+  the hash now with cryptsetup-reencrypt as described above.  While you
+  can reencrypt to use the fixed whirlpool, that may not be a good idea
+  as almost nobody seems to use it and hence the long time until the
+  bug was discovered.
+
+
+9. The Initrd question
+
+
+  * 9.1 My initrd is broken with cryptsetup
+
+  That is not nice!  However the initrd is supplied by your distribution,
+  not by the cryptsetup project and hence you should complain to them.  We
+  cannot really do anything about it.
+
+
+  * 9.2 CVE-2016-4484 says cryptsetup is broken!
+
+  Not really. It says the initrd in some Debian versions have a behavior 
+  that under some very special and unusual conditions may be considered
+  a vulnerability. 
+
+  What happens is that you can trick the initrd to go to a rescue-shell if
+  you enter the LUKS password wrongly in a specific way.  But falling back
+  to a rescue shell on initrd errors is a sensible default behavior in the
+  first place.  It gives you about as much access as booting a rescue
+  system from CD or USB-Stick or as removing the disk would give you.  So
+  this only applies when an attacker has physical access, but cannot boot
+  anything else or remove the disk.  These will be rare circumstances
+  indeed, and if you rely on the default distribution initrd to keep you
+  safe under these circumstances, then you have bigger problems than this
+  somewhat expected behavior.
+
+  The CVE was exagerrated and should not be assigned to upstream
+  cryptsetup in the first place (it is a distro specific initrd issue). 
+  It was driven more by a try to make a splash for self-aggrandizement,
+  than by any actual security concerns.  Ignore it.
+
+
+  * 9.3 How do I do my own initrd with cryptsetup?
+
+  Note: The instructions here apply to an initrd in initramfs format, not
+  to an initrd in initrd format.  The latter is a filesystem image, not a
+  cpio-archive, and seems to not be widely used anymore.
  
-  - You can now open the device again. It is highly advisable to
-  change the hash now with cryptsetup-reencrypt as described above.
-  While you can reencrypt to use the fixed whirlpool, that may not
-  be a good idea as almost nobody seems to use it and hence the long
-  time until the bug was discovered.
+  It depends on the distribution.  Below, I give a very simple example and
+  step-by-step instructions for Debian.  With a bit of work, it should be
+  possible to adapt this to other distributions.  Note that the
+  description is pretty general, so if you want to do other things with an
+  initrd it provides a useful starting point for that too.
 
+  01) Unpacking an existing initrd to use as template
 
-9. References and Further Reading 
+  A Linux initrd is in gzip'ed cpio format. To unpack it, use something
+  like this: 
 
+     md tmp; cd tmp; cat ../initrd | gunzip | cpio -id
 
- * Purpose of this Section
+  After this, you have the full initrd content in tmp/
 
-  The purpose of this section is to collect references to all
-  materials that do not fit the FAQ but are relevant in some fashion.
-  This can be core topics like the LUKS spec or disk encryption, but
-  it can also be more tangential, like secure storage management or
-  cryptography used in LUKS. It should still have relevance to
-  cryptsetup and its applications.
+  02) Inspecting the init-script
 
-  If you wan to see something added here, send email to the
-  maintainer (or the cryptsetup mailing list) giving an URL, a
-  description (1-3 lines preferred) and a section to put it in. You
-  can also propose new sections.
+  The init-script is the only thing the kernel cares about.  All activity
+  starts there.  Its traditional location is /sbin/init on disk, but /init
+  in an initrd.  In an initrd unpacked as above it is tmp/init.
 
-  At this time I would like to limit the references to things that
-  are available on the web.
+  While init can be a binary despite usually being called "init script",
+  in Debian the main init on the root partition is a binary, but the init
+  in the initrd (and only that one is called by the kernel) is a script
+  and starts like this:
 
+    #!/bin/sh
+    ....
 
- * Specifications
+  The "sh" used here is in tmp/bin/sh as just unpacked, and in Debian it
+  currently is a busybox.
 
-  - LUKS on-disk format spec:
-  https://gitlab.com/cryptsetup/cryptsetup/wikis/Specification
+  03) Creating your own initrd
 
- * Code Examples
+  The two examples below should give you most of what is needed.  This is
+  tested with LUKS1 and should work with LUKS2 as well.  If not, please
+  let me know.
 
-  - Some code examples are in the source package under docs/examples
+  Here is a really minimal example.  It does nothing but set up some
+  things and then drop to an interactive shell.  It is perfect to try out
+  things that you want to go into the init-script.
+
+   #!/bin/sh
+   export PATH=/sbin:/bin  
+   [ -d /sys ] || mkdir /sys
+   [ -d /proc ] || mkdir /proc
+   [ -d /tmp ] || mkdir /tmp
+   mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
+   mount -t proc -o nodev,noexec,nosuid proc /proc
+   echo "initrd is running, starting BusyBox..."
+   exec /bin/sh --login
+
+
+  Here is an example that opens the first LUKS-partition it finds with the
+  hard-coded password "test2" and then mounts it as root-filesystem.  This
+  is intended to be used on an USB-stick that after boot goes into a safe,
+  as it contains the LUKS-passphrase in plain text and is not secure to be
+  left in the system.  The script contains debug-output that should make it
+  easier to see what is going on.  Note that the final hand-over to the init
+  on the encrypted root-partition is done by "exec switch_root /mnt/root
+  /sbin/init", after mounting the decrypted LUKS container with "mount
+  /dev/mapper/c1 /mnt/root".  The second argument of switch_root is relative
+  to the first argument, i.e.  the init started with this command is really
+  /mnt/sbin/init before switch_root runs.
+
+   #!/bin/sh
+   export PATH=/sbin:/bin
+   [ -d /sys ] || mkdir /sys
+   [ -d /proc ] || mkdir /proc
+   [ -d /tmp ] || mkdir /tmp
+   mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
+   mount -t proc -o nodev,noexec,nosuid proc /proc
+   echo "detecting LUKS containers in sda1-10, sdb1-10"; sleep 1
+   for i in a b
+   do
+     for j in 1 2 3 4 5 6 7 8 9 10
+     do
+       sleep 0.5
+       d="/dev/sd"$i""$j
+       echo -n $d
+       cryptsetup isLuks $d >/dev/null 2>&1
+       r=$?
+       echo -n "  result: "$r""
+       # 0 = is LUKS, 1 = is not LUKS, 4 = other error
+       if expr $r = 0 > /dev/null
+       then
+         echo "  is LUKS, attempting unlock"
+         echo -n "test2" | cryptsetup luksOpen --key-file=- $d c1
+         r=$?
+         echo "  result of unlock attempt: "$r""
+         sleep 2
+         if expr $r = 0 > /dev/null
+         then
+           echo "*** LUKS partition unlocked, switching root *** 
+           echo "    (waiting 30 seconds before doing that)"
+           mount /dev/mapper/c1 /mnt/root
+           sleep 30
+           exec switch_root /mnt/root /sbin/init
+         fi
+       else
+         echo "  is not LUKS"
+       fi
+     done
+   done
+   echo "FAIL finding root on LUKS, loading BusyBox..."; sleep 5
+   exec /bin/sh --login
+
+
+  04) What if I want a binary in the initrd, but libraries are missing?
+
+  That is a bit tricky.  One option is to compile statically, but that
+  does not work for everything.  Debian puts some libraries into lib/ and
+  lib64/ which are usually enough.  If you need more, you can add the
+  libraries you need there.  That may or may not need a configuration
+  change for the dynamic linker "ld" as well.  Refer to standard Linux
+  documentation on how to add a library to a Linux system.  A running
+  initrd is just a running Linux system after all, it is not special in
+  any way.
+
+  05) How do I repack the initrd?
+
+  Simply repack the changed directory. While in tmp/, do
+  the following:
+  ```
+  find . | cpio --create --format='newc' | gzip > ../new_initrd
+  ```
+  Rename "new_initrd" to however you want it called (the name of
+  the initrd is a kernel-parameter) and move to /boot. That is it.
+
+
+10. LUKS2 Questions
+
+
+  * 10.1 Is the cryptography of LUKS2 different?
+
+  Mostly not.  The header has changed in its structure, but the
+  crytpgraphy is the same.  The one exception is that PBKDF2 has been
+  replaced by Argon2 to give better resilience against attacks attacks by
+  graphics cards and other hardware with lots of computing power but
+  limited local memory per computing element.
+
+
+  * 10.2 What new features does LUKS2 have?
+  
+  There are quite a few.  I recommend reading the man-page and the on-disk
+  format specification, see Item 1.2.
+
+  To list just some:
+  - A lot of the metadata is JSON, allowing for easier extension
+  - Max 32 key-slots per default
+  - Better protection for bad passphrases now available with Argon2
+  - Authenticated encryption 
+  - The LUKS2 header is less vulnerable to corruption and has a 2nd copy
+  
+  
+  * 10.3 Why does LUKS2 need so much memory?
+
+  LUKS2 uses Argon2 instead of PBKDF2.  That causes the increase in memory. 
+  See next item.
+
+
+  * 10.4  Why use Argon2 in LUKS 2 instead of PBKDF2?
+
+  LUKS tries to be secure with not-so-good passwords.  Bad passwords need to
+  be protected in some way against an attacker that just tries all possible
+  combinations.  (For good passwords, you can just wait for the attacker to
+  die of old age...) The situation with LUKS is not quite the same as with a
+  password stored in a database, but there are similarities.
+
+  LUKS does not store passwords on disk.  Instead, the passwords are used to
+  decrypt the master-key with it and that one is stored on disk in encrypted
+  form.  If you have a good password, with, say, more than 80 bits of
+  entropy, you could just put the password through a single crypto-hash (to
+  turn it into something that can be used as a key) and that would be secure. 
+  This is what plain dm-crypt does.
+
+  If the password has lower entropy, you want to make this process cost some
+  effort, so that each try takes time and resources and slows the attacker
+  down.  LUKS1 uses PBKDF2 for that, adding an iteration count and a salt. 
+  The iteration count is per default set to that it takes 1 second per try on
+  the CPU of the device where the respective passphrase was set.  The salt is
+  there to prevent precomputation.
+
+  The problem with that is that if you use a graphics card, you can massively
+  speed up these computations as PBKDF2 needs very little memeory to compute
+  it.  A graphics card is (grossly simplified) a mass of small CPUs with some
+  small very fast local memory per CPU and a large slow memory (the 4/6/8 GB
+  a current card may have).  If you can keep a computation in the small,
+  CPU-local memory, you can gain a speed factor of 1000 or more when trying
+  passwords with PBKDF2.
+
+  Argon2 was created to address this problem.  It adds a "large memory
+  property" where computing the result with less memory than the memory
+  parameter requires is massively (exponentially) slowed down.  That means,
+  if you set, for example, 4GB of memory, computing Argon2 on a graphics card
+  with around 100kB of memory per "CPU" makes no sense at all because it is
+  far too slow.  An attacker has hence to use real CPUs and furthermore is
+  limited by main memory bandwith.
+
+  Hence the large amount of memory used is a security feature and should not
+  be turned off or reduced.  If you really (!) understand what you are doing
+  and can assure good passwords, you can either go back to PBKDF2 or set a
+  low amount of memory used for Argon2 when creating the header.
+
+
+  * 10.5 LUKS2 is insecure! It uses less memory than the Argon2 RFC say!
+
+  Well, not really.  The RFC recommends 6GiB of memory for use with disk
+  encryption.  That is a bit insane and something clearly went wrong in the
+  standardization process here.  First, that makes Argon2 unusable on any 32
+  bit Linux and that is clearly a bad thing.  Second, there are many small
+  Linux devices around that do not have 6GiB of RAM in the first place.  For
+  example, the current Raspberry Pi has 1GB, 2GB or 4GB of RAM, and with the
+  RFC recommendations, none of these could compute Argon2 hashes.
+
+  Hence LUKS2 uses a more real-world approach.  Iteration is set to a
+  minimum of 4 because there are some theoretical attacks that work up to an
+  iteration count of 3.  The thread parameter is set to 4.  To achieve 2
+  second/slot unlock time, LUKS2 adjusts the memory parameter down if
+  needed.  In the other direction, it will respect available memory and not
+  exceed it.  On a current PC, the memory parameter will be somewhere around
+  1GB, which should quite generous.  The minimum I was able to set in an
+  experiment with "-i 1" was 400kB of memory and that is too low to be
+  secure.  A Raspberry Pi would probably end up somewhere around 50MB (have
+  not tried it) and that should still be plenty.
+
+  That said, if you have a good, high-entropy passphrase, LUKS2 is secure
+  with any memory parameter.
+
+
+  * 10.6 How does re-encryption store data while it is running?
+
+  All metadata necessary to perform a recovery of said segment (in case of 
+  crash) is stored in the LUKS2 metadata area. No matter if the LUKS2 
+  reencryption was run in online or offline mode.
+
+  
+  * 10.7 What do I do if re-encryption crashes?
+  
+  In case of a reencryption application crash, try to close the original
+  device via following command first: 
+
+    cryptsetup close <my_crypt_device>. 
+
+  Cryptsetup assesses if it's safe to teardown the reencryption device stack
+  or not.  It will also cut off I/O (via dm-error mapping) to current
+  hotzone segment (to make later recovery possible).  If it can't be torn
+  down, i.e.  due to a mounted fs, you must unmount the filesystem first. 
+  Never try to tear down reencryption dm devices manually using e.g. 
+  dmsetup tool, at least not unless cryptsetup says it's safe to do so.  It
+  could damage the data beyond repair.
 
 
- * Brute-forcing passphrases
+  * 10.8 Do I need to enter two passphrases to recover a crashed
+    re-encryption? 
 
-  -
-  http://news.electricalchemy.net/2009/10/password-cracking-in-cloud-part-5.html
+  Cryptsetup (command line utility) expects the passphrases to be identical
+  for the keyslot containing old volume key and for the keyslot containing
+  new one.  So the recovery happens during normal the "cryptsetup open" 
+  operation or the equivalent during boot.
 
-  -
-  http://it.slashdot.org/story/12/12/05/0623215/new-25-gpu-monster-devours-strong-passwords-in-minutes
+  Re-encryption recovery can be also performed in offline mode by 
+  the "cryptsetup repair" command.
 
 
- * Tools
+  * 10.9 What is an unbound keyslot and what is it used for?
 
+  Quite simply, an 'unbound key' is an independent 'key' stored in a luks2 
+  keyslot that cannot be used to unlock a LUKS2 data device. More specifically, 
+  an 'unbound key' or 'unbound luks2 keyslot' contains a secret that is not
+  currently associated with any data/crypt segment (encrypted area) in the 
+  LUKS2 'Segments' section (displayed by luksDump).
 
- * SSD and Flash Disk Related
+  This is a bit of a more general idea. It basically allows to use a keyslot
+  as a container for a key to be used in other things than decrypting a 
+  data segment.
 
+  As of April 2020, the following uses are defined:
 
- * Disk Encryption
+  1) LUKS2 re-encryption. The new volume key is stored in an unbound keyslot 
+     which becomes a regular LUKS2 keyslot later when re-encryption is 
+     finished.
+  
+  2) Somewhat similar is the use with a wrapped key scheme (e.g. with the 
+     paes cipher). In this case, the VK (Volume Key) stored in a keyslot 
+     is an encrypted binary binary blob. The KEK (Key Encryption Key) for 
+     that blob may be refreshed (Note that this KEK is not managed by 
+     cryptsetup!) and the binary blob gets changed. The KEK refresh process 
+     uses an 'unbound keyslot'. First the future effective VK is placed 
+     in the unbound keyslot and later it gets turned into the new real VK 
+     (and bound to the respective crypt segment).
+
+
+  * 10.10 What about the size of the LUKS2 header?
+
+  While the LUKS1 header has a fixed size that is determined by the cipher
+  spec (see Item 6.12), LUKS2 is more variable. The default size is 16MB,
+  but it can be adjusted on creation by using the --luks2-metadata-size 
+  and --luks2-keyslots-size options. Refer to the man-page for details.
+  While adjusting the size in an existing LUKS2 container is possible,
+  it is somewhat complicated and risky. My advice is to do a backup, 
+  recreate the container with changed parameters and restore that backup.
+
+
+  * 10.11 Does LUKS2 store metadata anywhere except in the header?
+  It does not. But note that if you use the experimental integrity support,
+  there will be an integrity header as well at the start of the data area 
+  and things  get a bit more complicated. All metadata will still be at the 
+  start of the device, nothing gets stored somewhere in the middle or at 
+  the end. 
+  
+
+11. References and Further Reading
+
+  * Purpose of this Section
+
+  The purpose of this section is to collect references to all materials
+  that do not fit the FAQ but are relevant in some fashion.  This can be
+  core topics like the LUKS spec or disk encryption, but it can also be
+  more tangential, like secure storage management or cryptography used in
+  LUKS.  It should still have relevance to cryptsetup and its
+  applications.
 
+  If you want to see something added here, send email to the maintainer
+  (or the cryptsetup mailing list) giving an URL, a description (1-3 lines
+  preferred) and a section to put it in.  You can also propose new
+  sections.
 
- * Attacks Against Disk Encryption
+  At this time I would like to limit the references to things that are
+  available on the web.
 
+  * Specifications
 
- * Risk Management as Relevant for Disk Encryption
+  - LUKS on-disk format spec: See Item 1.2
+
+  * Other Documentation
+  
+  - Arch Linux on LUKS, LVM and full-disk encryption: 
+    https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system
+
+  * Code Examples
+
+  - Some code examples are in the source package under docs/examples
 
+  - LUKS AF Splitter in Ruby by John Lane: https://rubygems.org/gems/afsplitter
 
- * Cryptography
+  * Brute-forcing passphrases
 
+  - http://news.electricalchemy.net/2009/10/password-cracking-in-cloud-part-5.html
 
- * Secure Storage
+  - http://it.slashdot.org/story/12/12/05/0623215/new-25-gpu-monster-devours-strong-passwords-in-minutes
 
- A. Contributors In no particular order:
+  * Tools
+
+  * SSD and Flash Disk Related
+
+  * Disk Encryption
+
+  * Attacks Against Disk Encryption
+
+  * Risk Management as Relevant for Disk Encryption
+
+  * Cryptography
+
+  * Secure Storage
+
+
+A. Contributors
+In no particular order:
 
   - Arno Wagner
 
   - Milan Broz
 
+___
diff --git a/INSTALL b/INSTALL
index a4b3414..45ff9bb 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -44,7 +44,7 @@ The simplest way to compile this package is:
      `sh ./configure' instead to prevent `csh' from trying to execute
      `configure' itself.
 
-     Running `configure' takes awhile.  While running, it prints some
+     Running `configure' takes a while.  While running, it prints some
      messages telling which features it is checking for.
 
   2. Type `make' to compile the package.
index d6a4c43..de0d2a2 100644 (file)
@@ -1,13 +1,50 @@
 EXTRA_DIST = COPYING.LGPL FAQ docs misc
-SUBDIRS = \
-       lib \
-       src \
-       man \
-       python \
-       tests \
-       po
+SUBDIRS = po tests
+CLEANFILES =
+DISTCLEAN_TARGETS =
+
+AM_CPPFLAGS = \
+       -include config.h \
+       -I$(top_srcdir)/lib \
+        -DDATADIR=\""$(datadir)"\"              \
+        -DLOCALEDIR=\""$(datadir)/locale"\"     \
+        -DLIBDIR=\""$(libdir)"\"                \
+        -DPREFIX=\""$(prefix)"\"                \
+        -DSYSCONFDIR=\""$(sysconfdir)"\"        \
+        -DVERSION=\""$(VERSION)"\"
+AM_CFLAGS = -Wall
+AM_LDFLAGS =
+
+LDADD = $(LTLIBINTL) -lm
+
+tmpfilesddir = @DEFAULT_TMPFILESDIR@
+
+noinst_LTLIBRARIES =
+sbin_PROGRAMS =
+man8_MANS =
+tmpfilesd_DATA =
+
+include man/Makemodule.am
+
+include scripts/Makemodule.am
+
+if CRYPTO_INTERNAL_ARGON2
+include lib/crypto_backend/argon2/Makemodule.am
+endif
+include lib/crypto_backend/Makemodule.am
+include lib/Makemodule.am
+
+include src/Makemodule.am
 
 ACLOCAL_AMFLAGS = -I m4
 
+DISTCHECK_CONFIGURE_FLAGS =    \
+       --with-tmpfilesdir=$$dc_install_base/usr/lib/tmpfiles.d \
+       --enable-internal-argon2 --enable-internal-sse-argon2
+
+distclean-local:
+       -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
+       rm -rf autom4te.cache
+
 clean-local:
-       -rm -rf docs/doxygen_api_docs
+       -rm -rf docs/doxygen_api_docs libargon2.la
index 64d2b0c..ab032a7 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
+
+
+
+
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -77,30 +91,371 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
+sbin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+       $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
+       $(am__EXEEXT_7) $(am__EXEEXT_8)
+@VERITYSETUP_TRUE@am__append_1 = man/veritysetup.8
+@REENCRYPT_TRUE@am__append_2 = man/cryptsetup-reencrypt.8
+@INTEGRITYSETUP_TRUE@am__append_3 = man/integritysetup.8
+@CRYPTSETUP_TMPFILE_TRUE@am__append_4 = scripts/cryptsetup.conf
+@CRYPTO_INTERNAL_ARGON2_TRUE@am__append_5 = libargon2.la
+@CRYPTO_INTERNAL_ARGON2_TRUE@@CRYPTO_INTERNAL_SSE_ARGON2_TRUE@am__append_6 = lib/crypto_backend/argon2/blake2/blamka-round-opt.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@@CRYPTO_INTERNAL_SSE_ARGON2_TRUE@                 lib/crypto_backend/argon2/opt.c
+
+@CRYPTO_INTERNAL_ARGON2_TRUE@@CRYPTO_INTERNAL_SSE_ARGON2_FALSE@am__append_7 = lib/crypto_backend/argon2/blake2/blamka-round-ref.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@@CRYPTO_INTERNAL_SSE_ARGON2_FALSE@                        lib/crypto_backend/argon2/ref.c
+
+@CRYPTO_INTERNAL_ARGON2_TRUE@am__append_8 = lib/crypto_backend/argon2/LICENSE \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/README
+@CRYPTO_BACKEND_GCRYPT_TRUE@am__append_9 = lib/crypto_backend/crypto_gcrypt.c
+@CRYPTO_BACKEND_OPENSSL_TRUE@am__append_10 = lib/crypto_backend/crypto_openssl.c
+@CRYPTO_BACKEND_NSS_TRUE@am__append_11 = lib/crypto_backend/crypto_nss.c
+@CRYPTO_BACKEND_KERNEL_TRUE@am__append_12 = lib/crypto_backend/crypto_kernel.c
+@CRYPTO_BACKEND_NETTLE_TRUE@am__append_13 = lib/crypto_backend/crypto_nettle.c
+@CRYPTO_INTERNAL_PBKDF2_TRUE@am__append_14 = lib/crypto_backend/pbkdf2_generic.c
+@CRYPTSETUP_TRUE@am__append_15 = cryptsetup
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@am__append_16 = cryptsetup.static
+@VERITYSETUP_TRUE@am__append_17 = veritysetup
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@am__append_18 = veritysetup.static
+@INTEGRITYSETUP_TRUE@am__append_19 = integritysetup
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@am__append_20 = integritysetup.static
+@REENCRYPT_TRUE@am__append_21 = cryptsetup-reencrypt
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@am__append_22 = cryptsetup-reencrypt.static
 subdir = .
-DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
-       $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/configure $(am__configure_deps) \
-       $(srcdir)/config.h.in ABOUT-NLS COPYING TODO compile \
-       config.guess config.rpath config.sub depcomp install-sh \
-       missing ltmain.sh
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+       $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+       $(am__configure_deps) $(include_HEADERS) $(am__DIST_COMMON)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = lib/libcryptsetup.pc scripts/cryptsetup.conf
 CONFIG_CLEAN_VPATH_FILES =
+@CRYPTSETUP_TRUE@am__EXEEXT_1 = cryptsetup$(EXEEXT)
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@am__EXEEXT_2 = cryptsetup.static$(EXEEXT)
+@VERITYSETUP_TRUE@am__EXEEXT_3 = veritysetup$(EXEEXT)
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@am__EXEEXT_4 = veritysetup.static$(EXEEXT)
+@INTEGRITYSETUP_TRUE@am__EXEEXT_5 = integritysetup$(EXEEXT)
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@am__EXEEXT_6 = integritysetup.static$(EXEEXT)
+@REENCRYPT_TRUE@am__EXEEXT_7 = cryptsetup-reencrypt$(EXEEXT)
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@am__EXEEXT_8 = cryptsetup-reencrypt.static$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(libdir)" \
+       "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(pkgconfigdir)" \
+       "$(DESTDIR)$(tmpfilesddir)" "$(DESTDIR)$(includedir)"
+PROGRAMS = $(sbin_PROGRAMS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
+libargon2_la_LIBADD =
+am__libargon2_la_SOURCES_DIST =  \
+       lib/crypto_backend/argon2/blake2/blake2b.c \
+       lib/crypto_backend/argon2/blake2/blake2.h \
+       lib/crypto_backend/argon2/blake2/blake2-impl.h \
+       lib/crypto_backend/argon2/argon2.c \
+       lib/crypto_backend/argon2/argon2.h \
+       lib/crypto_backend/argon2/core.c \
+       lib/crypto_backend/argon2/core.h \
+       lib/crypto_backend/argon2/encoding.c \
+       lib/crypto_backend/argon2/encoding.h \
+       lib/crypto_backend/argon2/thread.c \
+       lib/crypto_backend/argon2/thread.h \
+       lib/crypto_backend/argon2/blake2/blamka-round-opt.h \
+       lib/crypto_backend/argon2/opt.c \
+       lib/crypto_backend/argon2/blake2/blamka-round-ref.h \
+       lib/crypto_backend/argon2/ref.c
+am__dirstamp = $(am__leading_dot)dirstamp
+@CRYPTO_INTERNAL_ARGON2_TRUE@@CRYPTO_INTERNAL_SSE_ARGON2_TRUE@am__objects_1 = lib/crypto_backend/argon2/libargon2_la-opt.lo
+@CRYPTO_INTERNAL_ARGON2_TRUE@@CRYPTO_INTERNAL_SSE_ARGON2_FALSE@am__objects_2 = lib/crypto_backend/argon2/libargon2_la-ref.lo
+@CRYPTO_INTERNAL_ARGON2_TRUE@am_libargon2_la_OBJECTS = lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/libargon2_la-argon2.lo \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/libargon2_la-core.lo \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/libargon2_la-encoding.lo \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/libargon2_la-thread.lo \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  $(am__objects_1) $(am__objects_2)
+libargon2_la_OBJECTS = $(am_libargon2_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
+libargon2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libargon2_la_CFLAGS) \
+       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+@CRYPTO_INTERNAL_ARGON2_TRUE@am_libargon2_la_rpath =
+am__libcrypto_backend_la_SOURCES_DIST =  \
+       lib/crypto_backend/crypto_backend.h \
+       lib/crypto_backend/crypto_backend_internal.h \
+       lib/crypto_backend/crypto_cipher_kernel.c \
+       lib/crypto_backend/crypto_storage.c \
+       lib/crypto_backend/pbkdf_check.c lib/crypto_backend/crc32.c \
+       lib/crypto_backend/argon2_generic.c \
+       lib/crypto_backend/cipher_generic.c \
+       lib/crypto_backend/cipher_check.c \
+       lib/crypto_backend/crypto_gcrypt.c \
+       lib/crypto_backend/crypto_openssl.c \
+       lib/crypto_backend/crypto_nss.c \
+       lib/crypto_backend/crypto_kernel.c \
+       lib/crypto_backend/crypto_nettle.c \
+       lib/crypto_backend/pbkdf2_generic.c
+@CRYPTO_BACKEND_GCRYPT_TRUE@am__objects_3 = lib/crypto_backend/libcrypto_backend_la-crypto_gcrypt.lo
+@CRYPTO_BACKEND_OPENSSL_TRUE@am__objects_4 = lib/crypto_backend/libcrypto_backend_la-crypto_openssl.lo
+@CRYPTO_BACKEND_NSS_TRUE@am__objects_5 = lib/crypto_backend/libcrypto_backend_la-crypto_nss.lo
+@CRYPTO_BACKEND_KERNEL_TRUE@am__objects_6 = lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo
+@CRYPTO_BACKEND_NETTLE_TRUE@am__objects_7 = lib/crypto_backend/libcrypto_backend_la-crypto_nettle.lo
+@CRYPTO_INTERNAL_PBKDF2_TRUE@am__objects_8 = lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo
+am_libcrypto_backend_la_OBJECTS = lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo \
+       lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo \
+       lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo \
+       lib/crypto_backend/libcrypto_backend_la-crc32.lo \
+       lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo \
+       lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo \
+       lib/crypto_backend/libcrypto_backend_la-cipher_check.lo \
+       $(am__objects_3) $(am__objects_4) $(am__objects_5) \
+       $(am__objects_6) $(am__objects_7) $(am__objects_8)
+libcrypto_backend_la_OBJECTS = $(am_libcrypto_backend_la_OBJECTS)
+libcrypto_backend_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(libcrypto_backend_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am__DEPENDENCIES_1 =
+am_libcryptsetup_la_OBJECTS = lib/libcryptsetup_la-setup.lo \
+       lib/libcryptsetup_la-utils.lo \
+       lib/libcryptsetup_la-utils_benchmark.lo \
+       lib/libcryptsetup_la-utils_crypt.lo \
+       lib/libcryptsetup_la-utils_loop.lo \
+       lib/libcryptsetup_la-utils_devpath.lo \
+       lib/libcryptsetup_la-utils_wipe.lo \
+       lib/libcryptsetup_la-utils_fips.lo \
+       lib/libcryptsetup_la-utils_device.lo \
+       lib/libcryptsetup_la-utils_keyring.lo \
+       lib/libcryptsetup_la-utils_device_locking.lo \
+       lib/libcryptsetup_la-utils_pbkdf.lo \
+       lib/libcryptsetup_la-utils_safe_memory.lo \
+       lib/libcryptsetup_la-utils_storage_wrappers.lo \
+       lib/libcryptsetup_la-libdevmapper.lo \
+       lib/libcryptsetup_la-volumekey.lo \
+       lib/libcryptsetup_la-random.lo \
+       lib/libcryptsetup_la-crypt_plain.lo \
+       lib/libcryptsetup_la-base64.lo \
+       lib/integrity/libcryptsetup_la-integrity.lo \
+       lib/loopaes/libcryptsetup_la-loopaes.lo \
+       lib/tcrypt/libcryptsetup_la-tcrypt.lo \
+       lib/luks1/libcryptsetup_la-af.lo \
+       lib/luks1/libcryptsetup_la-keyencryption.lo \
+       lib/luks1/libcryptsetup_la-keymanage.lo \
+       lib/verity/libcryptsetup_la-verity_hash.lo \
+       lib/verity/libcryptsetup_la-verity_fec.lo \
+       lib/verity/libcryptsetup_la-verity.lo \
+       lib/verity/libcryptsetup_la-rs_encode_char.lo \
+       lib/verity/libcryptsetup_la-rs_decode_char.lo \
+       lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo \
+       lib/luks2/libcryptsetup_la-luks2_json_format.lo \
+       lib/luks2/libcryptsetup_la-luks2_json_metadata.lo \
+       lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo \
+       lib/luks2/libcryptsetup_la-luks2_digest.lo \
+       lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo \
+       lib/luks2/libcryptsetup_la-luks2_keyslot.lo \
+       lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo \
+       lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo \
+       lib/luks2/libcryptsetup_la-luks2_reencrypt.lo \
+       lib/luks2/libcryptsetup_la-luks2_segment.lo \
+       lib/luks2/libcryptsetup_la-luks2_token_keyring.lo \
+       lib/luks2/libcryptsetup_la-luks2_token.lo \
+       lib/libcryptsetup_la-utils_blkid.lo \
+       lib/bitlk/libcryptsetup_la-bitlk.lo
+libcryptsetup_la_OBJECTS = $(am_libcryptsetup_la_OBJECTS)
+libcryptsetup_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(libcryptsetup_la_CFLAGS) $(CFLAGS) \
+       $(libcryptsetup_la_LDFLAGS) $(LDFLAGS) -o $@
+libutils_io_la_LIBADD =
+am_libutils_io_la_OBJECTS = lib/libutils_io_la-utils_io.lo
+libutils_io_la_OBJECTS = $(am_libutils_io_la_OBJECTS)
+libutils_io_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(libutils_io_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
+       $@
+am__cryptsetup_SOURCES_DIST = lib/utils_crypt.c lib/utils_loop.c \
+       lib/utils_io.c lib/utils_blkid.c src/utils_tools.c \
+       src/utils_password.c src/utils_luks2.c src/utils_blockdev.c \
+       src/cryptsetup.c src/cryptsetup.h
+@CRYPTSETUP_TRUE@am_cryptsetup_OBJECTS = lib/utils_crypt.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      lib/utils_loop.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      lib/utils_io.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      lib/utils_blkid.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_tools.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_password.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_luks2.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_blockdev.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/cryptsetup.$(OBJEXT)
+cryptsetup_OBJECTS = $(am_cryptsetup_OBJECTS)
+am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+@CRYPTSETUP_TRUE@cryptsetup_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+@CRYPTSETUP_TRUE@      libcryptsetup.la
+am__cryptsetup_reencrypt_SOURCES_DIST = lib/utils_crypt.c \
+       lib/utils_io.c lib/utils_blkid.c src/utils_tools.c \
+       lib/utils_loop.c src/utils_password.c \
+       src/cryptsetup_reencrypt.c src/cryptsetup.h
+@REENCRYPT_TRUE@am_cryptsetup_reencrypt_OBJECTS =  \
+@REENCRYPT_TRUE@       lib/utils_crypt.$(OBJEXT) \
+@REENCRYPT_TRUE@       lib/utils_io.$(OBJEXT) \
+@REENCRYPT_TRUE@       lib/utils_blkid.$(OBJEXT) \
+@REENCRYPT_TRUE@       src/utils_tools.$(OBJEXT) \
+@REENCRYPT_TRUE@       lib/utils_loop.$(OBJEXT) \
+@REENCRYPT_TRUE@       src/utils_password.$(OBJEXT) \
+@REENCRYPT_TRUE@       src/cryptsetup_reencrypt.$(OBJEXT)
+cryptsetup_reencrypt_OBJECTS = $(am_cryptsetup_reencrypt_OBJECTS)
+@REENCRYPT_TRUE@cryptsetup_reencrypt_DEPENDENCIES =  \
+@REENCRYPT_TRUE@       $(am__DEPENDENCIES_2) libcryptsetup.la
+am__cryptsetup_reencrypt_static_SOURCES_DIST = lib/utils_crypt.c \
+       lib/utils_io.c lib/utils_blkid.c src/utils_tools.c \
+       lib/utils_loop.c src/utils_password.c \
+       src/cryptsetup_reencrypt.c src/cryptsetup.h
+@REENCRYPT_TRUE@am__objects_9 = lib/utils_crypt.$(OBJEXT) \
+@REENCRYPT_TRUE@       lib/utils_io.$(OBJEXT) \
+@REENCRYPT_TRUE@       lib/utils_blkid.$(OBJEXT) \
+@REENCRYPT_TRUE@       src/utils_tools.$(OBJEXT) \
+@REENCRYPT_TRUE@       lib/utils_loop.$(OBJEXT) \
+@REENCRYPT_TRUE@       src/utils_password.$(OBJEXT) \
+@REENCRYPT_TRUE@       src/cryptsetup_reencrypt.$(OBJEXT)
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@am_cryptsetup_reencrypt_static_OBJECTS =  \
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    $(am__objects_9)
+cryptsetup_reencrypt_static_OBJECTS =  \
+       $(am_cryptsetup_reencrypt_static_OBJECTS)
+@REENCRYPT_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) \
+@REENCRYPT_TRUE@       libcryptsetup.la
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_DEPENDENCIES =  \
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    $(am__DEPENDENCIES_3)
+cryptsetup_reencrypt_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(AM_CFLAGS) $(CFLAGS) $(cryptsetup_reencrypt_static_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am__cryptsetup_static_SOURCES_DIST = lib/utils_crypt.c \
+       lib/utils_loop.c lib/utils_io.c lib/utils_blkid.c \
+       src/utils_tools.c src/utils_password.c src/utils_luks2.c \
+       src/utils_blockdev.c src/cryptsetup.c src/cryptsetup.h
+@CRYPTSETUP_TRUE@am__objects_10 = lib/utils_crypt.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      lib/utils_loop.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      lib/utils_io.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      lib/utils_blkid.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_tools.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_password.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_luks2.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/utils_blockdev.$(OBJEXT) \
+@CRYPTSETUP_TRUE@      src/cryptsetup.$(OBJEXT)
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@am_cryptsetup_static_OBJECTS =  \
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@   $(am__objects_10)
+cryptsetup_static_OBJECTS = $(am_cryptsetup_static_OBJECTS)
+@CRYPTSETUP_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2) \
+@CRYPTSETUP_TRUE@      libcryptsetup.la
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_static_DEPENDENCIES =  \
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@   $(am__DEPENDENCIES_4)
+cryptsetup_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(AM_CFLAGS) $(CFLAGS) $(cryptsetup_static_LDFLAGS) $(LDFLAGS) \
+       -o $@
+am__integritysetup_SOURCES_DIST = lib/utils_crypt.c lib/utils_loop.c \
+       lib/utils_io.c lib/utils_blkid.c src/utils_tools.c \
+       src/integritysetup.c src/cryptsetup.h
+@INTEGRITYSETUP_TRUE@am_integritysetup_OBJECTS =  \
+@INTEGRITYSETUP_TRUE@  lib/utils_crypt.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  lib/utils_loop.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  lib/utils_io.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  lib/utils_blkid.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  src/utils_tools.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  src/integritysetup.$(OBJEXT)
+integritysetup_OBJECTS = $(am_integritysetup_OBJECTS)
+@INTEGRITYSETUP_TRUE@integritysetup_DEPENDENCIES =  \
+@INTEGRITYSETUP_TRUE@  $(am__DEPENDENCIES_2) libcryptsetup.la
+am__integritysetup_static_SOURCES_DIST = lib/utils_crypt.c \
+       lib/utils_loop.c lib/utils_io.c lib/utils_blkid.c \
+       src/utils_tools.c src/integritysetup.c src/cryptsetup.h
+@INTEGRITYSETUP_TRUE@am__objects_11 = lib/utils_crypt.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  lib/utils_loop.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  lib/utils_io.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  lib/utils_blkid.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  src/utils_tools.$(OBJEXT) \
+@INTEGRITYSETUP_TRUE@  src/integritysetup.$(OBJEXT)
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@am_integritysetup_static_OBJECTS =  \
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@       $(am__objects_11)
+integritysetup_static_OBJECTS = $(am_integritysetup_static_OBJECTS)
+@INTEGRITYSETUP_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_2) \
+@INTEGRITYSETUP_TRUE@  libcryptsetup.la
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_DEPENDENCIES =  \
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@       $(am__DEPENDENCIES_5)
+integritysetup_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(AM_CFLAGS) $(CFLAGS) $(integritysetup_static_LDFLAGS) \
+       $(LDFLAGS) -o $@
+am__veritysetup_SOURCES_DIST = lib/utils_crypt.c lib/utils_loop.c \
+       lib/utils_io.c lib/utils_blkid.c src/utils_tools.c \
+       src/utils_password.c src/veritysetup.c src/cryptsetup.h
+@VERITYSETUP_TRUE@am_veritysetup_OBJECTS = lib/utils_crypt.$(OBJEXT) \
+@VERITYSETUP_TRUE@     lib/utils_loop.$(OBJEXT) \
+@VERITYSETUP_TRUE@     lib/utils_io.$(OBJEXT) \
+@VERITYSETUP_TRUE@     lib/utils_blkid.$(OBJEXT) \
+@VERITYSETUP_TRUE@     src/utils_tools.$(OBJEXT) \
+@VERITYSETUP_TRUE@     src/utils_password.$(OBJEXT) \
+@VERITYSETUP_TRUE@     src/veritysetup.$(OBJEXT)
+veritysetup_OBJECTS = $(am_veritysetup_OBJECTS)
+@VERITYSETUP_TRUE@veritysetup_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+@VERITYSETUP_TRUE@     libcryptsetup.la
+am__veritysetup_static_SOURCES_DIST = lib/utils_crypt.c \
+       lib/utils_loop.c lib/utils_io.c lib/utils_blkid.c \
+       src/utils_tools.c src/utils_password.c src/veritysetup.c \
+       src/cryptsetup.h
+@VERITYSETUP_TRUE@am__objects_12 = lib/utils_crypt.$(OBJEXT) \
+@VERITYSETUP_TRUE@     lib/utils_loop.$(OBJEXT) \
+@VERITYSETUP_TRUE@     lib/utils_io.$(OBJEXT) \
+@VERITYSETUP_TRUE@     lib/utils_blkid.$(OBJEXT) \
+@VERITYSETUP_TRUE@     src/utils_tools.$(OBJEXT) \
+@VERITYSETUP_TRUE@     src/utils_password.$(OBJEXT) \
+@VERITYSETUP_TRUE@     src/veritysetup.$(OBJEXT)
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@am_veritysetup_static_OBJECTS =  \
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  $(am__objects_12)
+veritysetup_static_OBJECTS = $(am_veritysetup_static_OBJECTS)
+@VERITYSETUP_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_2) \
+@VERITYSETUP_TRUE@     libcryptsetup.la
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_DEPENDENCIES =  \
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  $(am__DEPENDENCIES_6)
+veritysetup_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+       $(AM_CFLAGS) $(CFLAGS) $(veritysetup_static_LDFLAGS) \
+       $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -113,8 +468,120 @@ AM_V_at = $(am__v_at_@AM_V@)
 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
 am__v_at_0 = @
 am__v_at_1 = 
-SOURCES =
-DIST_SOURCES =
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = lib/$(DEPDIR)/libcryptsetup_la-base64.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-crypt_plain.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-libdevmapper.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-random.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-setup.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_benchmark.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_blkid.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_crypt.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_device.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_device_locking.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_devpath.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_fips.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_keyring.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_loop.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_pbkdf.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_safe_memory.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_storage_wrappers.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-utils_wipe.Plo \
+       lib/$(DEPDIR)/libcryptsetup_la-volumekey.Plo \
+       lib/$(DEPDIR)/libutils_io_la-utils_io.Plo \
+       lib/$(DEPDIR)/utils_blkid.Po lib/$(DEPDIR)/utils_crypt.Po \
+       lib/$(DEPDIR)/utils_io.Po lib/$(DEPDIR)/utils_loop.Po \
+       lib/bitlk/$(DEPDIR)/libcryptsetup_la-bitlk.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-argon2_generic.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_check.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_generic.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crc32.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nss.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_storage.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Plo \
+       lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Plo \
+       lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-argon2.Plo \
+       lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-core.Plo \
+       lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-encoding.Plo \
+       lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-opt.Plo \
+       lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-ref.Plo \
+       lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-thread.Plo \
+       lib/crypto_backend/argon2/blake2/$(DEPDIR)/libargon2_la-blake2b.Plo \
+       lib/integrity/$(DEPDIR)/libcryptsetup_la-integrity.Plo \
+       lib/loopaes/$(DEPDIR)/libcryptsetup_la-loopaes.Plo \
+       lib/luks1/$(DEPDIR)/libcryptsetup_la-af.Plo \
+       lib/luks1/$(DEPDIR)/libcryptsetup_la-keyencryption.Plo \
+       lib/luks1/$(DEPDIR)/libcryptsetup_la-keymanage.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest_pbkdf2.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_disk_metadata.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_format.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_metadata.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_luks2.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_reenc.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_luks1_convert.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_reencrypt.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_segment.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token.Plo \
+       lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token_keyring.Plo \
+       lib/tcrypt/$(DEPDIR)/libcryptsetup_la-tcrypt.Plo \
+       lib/verity/$(DEPDIR)/libcryptsetup_la-rs_decode_char.Plo \
+       lib/verity/$(DEPDIR)/libcryptsetup_la-rs_encode_char.Plo \
+       lib/verity/$(DEPDIR)/libcryptsetup_la-verity.Plo \
+       lib/verity/$(DEPDIR)/libcryptsetup_la-verity_fec.Plo \
+       lib/verity/$(DEPDIR)/libcryptsetup_la-verity_hash.Plo \
+       src/$(DEPDIR)/cryptsetup.Po \
+       src/$(DEPDIR)/cryptsetup_reencrypt.Po \
+       src/$(DEPDIR)/integritysetup.Po \
+       src/$(DEPDIR)/utils_blockdev.Po src/$(DEPDIR)/utils_luks2.Po \
+       src/$(DEPDIR)/utils_password.Po src/$(DEPDIR)/utils_tools.Po \
+       src/$(DEPDIR)/veritysetup.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
+SOURCES = $(libargon2_la_SOURCES) $(libcrypto_backend_la_SOURCES) \
+       $(libcryptsetup_la_SOURCES) $(libutils_io_la_SOURCES) \
+       $(cryptsetup_SOURCES) $(cryptsetup_reencrypt_SOURCES) \
+       $(cryptsetup_reencrypt_static_SOURCES) \
+       $(cryptsetup_static_SOURCES) $(integritysetup_SOURCES) \
+       $(integritysetup_static_SOURCES) $(veritysetup_SOURCES) \
+       $(veritysetup_static_SOURCES)
+DIST_SOURCES = $(am__libargon2_la_SOURCES_DIST) \
+       $(am__libcrypto_backend_la_SOURCES_DIST) \
+       $(libcryptsetup_la_SOURCES) $(libutils_io_la_SOURCES) \
+       $(am__cryptsetup_SOURCES_DIST) \
+       $(am__cryptsetup_reencrypt_SOURCES_DIST) \
+       $(am__cryptsetup_reencrypt_static_SOURCES_DIST) \
+       $(am__cryptsetup_static_SOURCES_DIST) \
+       $(am__integritysetup_SOURCES_DIST) \
+       $(am__integritysetup_static_SOURCES_DIST) \
+       $(am__veritysetup_SOURCES_DIST) \
+       $(am__veritysetup_static_SOURCES_DIST)
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
        ctags-recursive dvi-recursive html-recursive info-recursive \
        install-data-recursive install-dvi-recursive \
@@ -128,6 +595,11 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+man8dir = $(mandir)/man8
+NROFF = nroff
+MANS = $(man8_MANS)
+DATA = $(pkgconfig_DATA) $(tmpfilesd_DATA)
+HEADERS = $(include_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
   distclean-recursive maintainer-clean-recursive
 am__recursive_targets = \
@@ -135,9 +607,9 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-       cscope distdir dist dist-all distcheck
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
-       $(LISP)config.h.in
+       cscope distdir distdir-am dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
+       config.h.in
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
 # *not* preserved.
@@ -158,6 +630,17 @@ ETAGS = etags
 CTAGS = ctags
 CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+       $(srcdir)/lib/Makemodule.am \
+       $(srcdir)/lib/crypto_backend/Makemodule.am \
+       $(srcdir)/lib/crypto_backend/argon2/Makemodule.am \
+       $(srcdir)/man/Makemodule.am $(srcdir)/scripts/Makemodule.am \
+       $(srcdir)/src/Makemodule.am \
+       $(top_srcdir)/lib/libcryptsetup.pc.in \
+       $(top_srcdir)/scripts/cryptsetup.conf.in ABOUT-NLS AUTHORS \
+       COPYING ChangeLog INSTALL NEWS README TODO compile \
+       config.guess config.rpath config.sub depcomp install-sh \
+       ltmain.sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -208,6 +691,8 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BLKID_CFLAGS = @BLKID_CFLAGS@
+BLKID_LIBS = @BLKID_LIBS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -217,6 +702,9 @@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
 CRYPTO_LIBS = @CRYPTO_LIBS@
 CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
 CYGPATH_W = @CYGPATH_W@
+DEFAULT_LUKS2_LOCK_DIR_PERMS = @DEFAULT_LUKS2_LOCK_DIR_PERMS@
+DEFAULT_LUKS2_LOCK_PATH = @DEFAULT_LUKS2_LOCK_PATH@
+DEFAULT_TMPFILESDIR = @DEFAULT_TMPFILESDIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
@@ -232,6 +720,7 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
 GREP = @GREP@
@@ -242,8 +731,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+JSON_C_CFLAGS = @JSON_C_CFLAGS@
+JSON_C_LIBS = @JSON_C_LIBS@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
+LIBARGON2_CFLAGS = @LIBARGON2_CFLAGS@
+LIBARGON2_LIBS = @LIBARGON2_LIBS@
 LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
 LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
@@ -259,6 +752,7 @@ LN_S = @LN_S@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
@@ -284,6 +778,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
+PASSWDQC_LIBS = @PASSWDQC_LIBS@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
@@ -293,13 +788,6 @@ POSUB = @POSUB@
 PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
 PWQUALITY_LIBS = @PWQUALITY_LIBS@
 PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -310,6 +798,7 @@ UUID_LIBS = @UUID_LIBS@
 VERSION = @VERSION@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -351,38 +840,304 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
+systemd_tmpfilesdir = @systemd_tmpfilesdir@
 target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXTRA_DIST = COPYING.LGPL FAQ docs misc
-SUBDIRS = \
-       lib \
-       src \
-       man \
-       python \
-       tests \
-       po
+EXTRA_DIST = COPYING.LGPL FAQ docs misc man/cryptsetup.8 \
+       man/integritysetup.8 man/veritysetup.8 \
+       man/cryptsetup-reencrypt.8 $(am__append_8) \
+       lib/libcryptsetup.pc.in lib/libcryptsetup.sym
+SUBDIRS = po tests
+CLEANFILES = 
+DISTCLEAN_TARGETS = scripts/cryptsetup.conf
+AM_CPPFLAGS = \
+       -include config.h \
+       -I$(top_srcdir)/lib \
+        -DDATADIR=\""$(datadir)"\"              \
+        -DLOCALEDIR=\""$(datadir)/locale"\"     \
+        -DLIBDIR=\""$(libdir)"\"                \
+        -DPREFIX=\""$(prefix)"\"                \
+        -DSYSCONFDIR=\""$(sysconfdir)"\"        \
+        -DVERSION=\""$(VERSION)"\"
+
+AM_CFLAGS = -Wall
+AM_LDFLAGS = 
+LDADD = $(LTLIBINTL) -lm
+tmpfilesddir = @DEFAULT_TMPFILESDIR@
+noinst_LTLIBRARIES = $(am__append_5) libcrypto_backend.la \
+       libutils_io.la
+man8_MANS = man/cryptsetup.8 $(am__append_1) $(am__append_2) \
+       $(am__append_3)
+tmpfilesd_DATA = $(am__append_4)
+@CRYPTO_INTERNAL_ARGON2_TRUE@libargon2_la_CFLAGS = $(AM_CFLAGS) -std=c89 -pthread -O3
+@CRYPTO_INTERNAL_ARGON2_TRUE@libargon2_la_CPPFLAGS = $(AM_CPPFLAGS) \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  -I lib/crypto_backend/argon2 \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  -I lib/crypto_backend/argon2/blake2
+
+@CRYPTO_INTERNAL_ARGON2_TRUE@libargon2_la_SOURCES = lib/crypto_backend/argon2/blake2/blake2b.c \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/blake2/blake2.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/blake2/blake2-impl.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/argon2.c \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/argon2.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/core.c \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/core.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/encoding.c \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/encoding.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/thread.c \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  lib/crypto_backend/argon2/thread.h \
+@CRYPTO_INTERNAL_ARGON2_TRUE@  $(am__append_6) $(am__append_7)
+libcrypto_backend_la_CFLAGS = $(AM_CFLAGS) @CRYPTO_CFLAGS@
+libcrypto_backend_la_SOURCES = lib/crypto_backend/crypto_backend.h \
+       lib/crypto_backend/crypto_backend_internal.h \
+       lib/crypto_backend/crypto_cipher_kernel.c \
+       lib/crypto_backend/crypto_storage.c \
+       lib/crypto_backend/pbkdf_check.c lib/crypto_backend/crc32.c \
+       lib/crypto_backend/argon2_generic.c \
+       lib/crypto_backend/cipher_generic.c \
+       lib/crypto_backend/cipher_check.c $(am__append_9) \
+       $(am__append_10) $(am__append_11) $(am__append_12) \
+       $(am__append_13) $(am__append_14)
+@CRYPTO_INTERNAL_ARGON2_TRUE@libcrypto_backend_la_DEPENDENCIES = libargon2.la
+@CRYPTO_INTERNAL_ARGON2_TRUE@libcrypto_backend_la_LIBADD = libargon2.la
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lib/libcryptsetup.pc
+lib_LTLIBRARIES = libcryptsetup.la
+include_HEADERS = lib/libcryptsetup.h
+libutils_io_la_CFLAGS = $(AM_CFLAGS)
+libutils_io_la_SOURCES = \
+       lib/utils_io.c                  \
+       lib/utils_io.h
+
+libcryptsetup_la_CPPFLAGS = $(AM_CPPFLAGS) \
+       -I $(top_srcdir)/lib/crypto_backend     \
+       -I $(top_srcdir)/lib/luks1              \
+       -I $(top_srcdir)/lib/luks2              \
+       -I $(top_srcdir)/lib/loopaes            \
+       -I $(top_srcdir)/lib/verity             \
+       -I $(top_srcdir)/lib/tcrypt             \
+       -I $(top_srcdir)/lib/integrity          \
+       -I $(top_srcdir)/lib/bitlk
+
+libcryptsetup_la_DEPENDENCIES = libutils_io.la libcrypto_backend.la lib/libcryptsetup.sym
+libcryptsetup_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
+       -Wl,--version-script=$(top_srcdir)/lib/libcryptsetup.sym \
+       -version-info @LIBCRYPTSETUP_VERSION_INFO@
+
+libcryptsetup_la_CFLAGS = $(AM_CFLAGS) @CRYPTO_CFLAGS@
+libcryptsetup_la_LIBADD = \
+       @UUID_LIBS@             \
+       @DEVMAPPER_LIBS@        \
+       @CRYPTO_LIBS@           \
+       @LIBARGON2_LIBS@        \
+       @JSON_C_LIBS@           \
+       @BLKID_LIBS@            \
+       $(LTLIBICONV)           \
+       libcrypto_backend.la    \
+       libutils_io.la
+
+libcryptsetup_la_SOURCES = \
+       lib/setup.c                     \
+       lib/internal.h                  \
+       lib/bitops.h                    \
+       lib/nls.h                       \
+       lib/libcryptsetup.h             \
+       lib/utils.c                     \
+       lib/utils_benchmark.c           \
+       lib/utils_crypt.c               \
+       lib/utils_crypt.h               \
+       lib/utils_loop.c                \
+       lib/utils_loop.h                \
+       lib/utils_devpath.c             \
+       lib/utils_wipe.c                \
+       lib/utils_fips.c                \
+       lib/utils_fips.h                \
+       lib/utils_device.c              \
+       lib/utils_keyring.c             \
+       lib/utils_keyring.h             \
+       lib/utils_device_locking.c      \
+       lib/utils_device_locking.h      \
+       lib/utils_pbkdf.c               \
+       lib/utils_safe_memory.c         \
+       lib/utils_storage_wrappers.c    \
+       lib/utils_storage_wrappers.h    \
+       lib/libdevmapper.c              \
+       lib/utils_dm.h                  \
+       lib/volumekey.c                 \
+       lib/random.c                    \
+       lib/crypt_plain.c               \
+       lib/base64.h                    \
+       lib/base64.c                    \
+       lib/integrity/integrity.h       \
+       lib/integrity/integrity.c       \
+       lib/loopaes/loopaes.h           \
+       lib/loopaes/loopaes.c           \
+       lib/tcrypt/tcrypt.h             \
+       lib/tcrypt/tcrypt.c             \
+       lib/luks1/af.h                  \
+       lib/luks1/af.c                  \
+       lib/luks1/keyencryption.c       \
+       lib/luks1/keymanage.c           \
+       lib/luks1/luks.h                \
+       lib/verity/verity_hash.c        \
+       lib/verity/verity_fec.c         \
+       lib/verity/verity.c             \
+       lib/verity/verity.h             \
+       lib/verity/rs_encode_char.c     \
+       lib/verity/rs_decode_char.c     \
+       lib/verity/rs.h         \
+       lib/luks2/luks2_disk_metadata.c \
+       lib/luks2/luks2_json_format.c   \
+       lib/luks2/luks2_json_metadata.c \
+       lib/luks2/luks2_luks1_convert.c \
+       lib/luks2/luks2_digest.c        \
+       lib/luks2/luks2_digest_pbkdf2.c \
+       lib/luks2/luks2_keyslot.c       \
+       lib/luks2/luks2_keyslot_luks2.c \
+       lib/luks2/luks2_keyslot_reenc.c \
+       lib/luks2/luks2_reencrypt.c     \
+       lib/luks2/luks2_segment.c       \
+       lib/luks2/luks2_token_keyring.c \
+       lib/luks2/luks2_token.c         \
+       lib/luks2/luks2_internal.h      \
+       lib/luks2/luks2.h               \
+       lib/utils_blkid.c               \
+       lib/utils_blkid.h               \
+       lib/bitlk/bitlk.h               \
+       lib/bitlk/bitlk.c
+
+
+# cryptsetup
+@CRYPTSETUP_TRUE@cryptsetup_SOURCES = \
+@CRYPTSETUP_TRUE@      lib/utils_crypt.c       \
+@CRYPTSETUP_TRUE@      lib/utils_loop.c        \
+@CRYPTSETUP_TRUE@      lib/utils_io.c          \
+@CRYPTSETUP_TRUE@      lib/utils_blkid.c       \
+@CRYPTSETUP_TRUE@      src/utils_tools.c       \
+@CRYPTSETUP_TRUE@      src/utils_password.c    \
+@CRYPTSETUP_TRUE@      src/utils_luks2.c       \
+@CRYPTSETUP_TRUE@      src/utils_blockdev.c    \
+@CRYPTSETUP_TRUE@      src/cryptsetup.c        \
+@CRYPTSETUP_TRUE@      src/cryptsetup.h
+
+@CRYPTSETUP_TRUE@cryptsetup_LDADD = $(LDADD)   \
+@CRYPTSETUP_TRUE@      libcryptsetup.la        \
+@CRYPTSETUP_TRUE@      @POPT_LIBS@             \
+@CRYPTSETUP_TRUE@      @PWQUALITY_LIBS@        \
+@CRYPTSETUP_TRUE@      @PASSWDQC_LIBS@         \
+@CRYPTSETUP_TRUE@      @UUID_LIBS@             \
+@CRYPTSETUP_TRUE@      @BLKID_LIBS@
+
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_static_SOURCES = $(cryptsetup_SOURCES)
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_static_LDADD = \
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@   $(cryptsetup_LDADD)     \
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@   @CRYPTO_STATIC_LIBS@    \
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@   @PWQUALITY_STATIC_LIBS@ \
+@CRYPTSETUP_TRUE@@STATIC_TOOLS_TRUE@   @DEVMAPPER_STATIC_LIBS@
+
+
+# veritysetup
+@VERITYSETUP_TRUE@veritysetup_SOURCES = \
+@VERITYSETUP_TRUE@     lib/utils_crypt.c       \
+@VERITYSETUP_TRUE@     lib/utils_loop.c        \
+@VERITYSETUP_TRUE@     lib/utils_io.c          \
+@VERITYSETUP_TRUE@     lib/utils_blkid.c       \
+@VERITYSETUP_TRUE@     src/utils_tools.c       \
+@VERITYSETUP_TRUE@     src/utils_password.c    \
+@VERITYSETUP_TRUE@     src/veritysetup.c       \
+@VERITYSETUP_TRUE@     src/cryptsetup.h
+
+@VERITYSETUP_TRUE@veritysetup_LDADD = $(LDADD) \
+@VERITYSETUP_TRUE@     libcryptsetup.la        \
+@VERITYSETUP_TRUE@     @POPT_LIBS@             \
+@VERITYSETUP_TRUE@     @PWQUALITY_LIBS@        \
+@VERITYSETUP_TRUE@     @PASSWDQC_LIBS@         \
+@VERITYSETUP_TRUE@     @BLKID_LIBS@
+
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_SOURCES = $(veritysetup_SOURCES)
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_LDADD = \
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  $(veritysetup_LDADD)    \
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  @CRYPTO_STATIC_LIBS@    \
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  @DEVMAPPER_STATIC_LIBS@ \
+@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  @UUID_LIBS@
+
+
+# integritysetup
+@INTEGRITYSETUP_TRUE@integritysetup_SOURCES = \
+@INTEGRITYSETUP_TRUE@  lib/utils_crypt.c       \
+@INTEGRITYSETUP_TRUE@  lib/utils_loop.c        \
+@INTEGRITYSETUP_TRUE@  lib/utils_io.c          \
+@INTEGRITYSETUP_TRUE@  lib/utils_blkid.c       \
+@INTEGRITYSETUP_TRUE@  src/utils_tools.c       \
+@INTEGRITYSETUP_TRUE@  src/integritysetup.c    \
+@INTEGRITYSETUP_TRUE@  src/cryptsetup.h
+
+@INTEGRITYSETUP_TRUE@integritysetup_LDADD = $(LDADD)   \
+@INTEGRITYSETUP_TRUE@  libcryptsetup.la        \
+@INTEGRITYSETUP_TRUE@  @POPT_LIBS@             \
+@INTEGRITYSETUP_TRUE@  @UUID_LIBS@             \
+@INTEGRITYSETUP_TRUE@  @BLKID_LIBS@
+
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_SOURCES = $(integritysetup_SOURCES)
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_LDADD = \
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@       $(integritysetup_LDADD) \
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@       @CRYPTO_STATIC_LIBS@    \
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@       @DEVMAPPER_STATIC_LIBS@ \
+@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@       @UUID_LIBS@
+
+
+# reencrypt
+@REENCRYPT_TRUE@cryptsetup_reencrypt_SOURCES = \
+@REENCRYPT_TRUE@       lib/utils_crypt.c               \
+@REENCRYPT_TRUE@       lib/utils_io.c                  \
+@REENCRYPT_TRUE@       lib/utils_blkid.c               \
+@REENCRYPT_TRUE@       src/utils_tools.c               \
+@REENCRYPT_TRUE@       lib/utils_loop.c                \
+@REENCRYPT_TRUE@       src/utils_password.c            \
+@REENCRYPT_TRUE@       src/cryptsetup_reencrypt.c      \
+@REENCRYPT_TRUE@       src/cryptsetup.h
+
+@REENCRYPT_TRUE@cryptsetup_reencrypt_LDADD = $(LDADD)  \
+@REENCRYPT_TRUE@       libcryptsetup.la                \
+@REENCRYPT_TRUE@       @POPT_LIBS@                     \
+@REENCRYPT_TRUE@       @PWQUALITY_LIBS@                \
+@REENCRYPT_TRUE@       @PASSWDQC_LIBS@                 \
+@REENCRYPT_TRUE@       @UUID_LIBS@                     \
+@REENCRYPT_TRUE@       @BLKID_LIBS@
+
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_SOURCES = $(cryptsetup_reencrypt_SOURCES)
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_LDADD = \
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    $(cryptsetup_reencrypt_LDADD)   \
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    @CRYPTO_STATIC_LIBS@            \
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    @PWQUALITY_STATIC_LIBS@         \
+@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    @DEVMAPPER_STATIC_LIBS@
 
 ACLOCAL_AMFLAGS = -I m4
+DISTCHECK_CONFIGURE_FLAGS = \
+       --with-tmpfilesdir=$$dc_install_base/usr/lib/tmpfiles.d \
+       --enable-internal-argon2 --enable-internal-sse-argon2
+
 all: config.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
 am--refresh: Makefile
        @:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/man/Makemodule.am $(srcdir)/scripts/Makemodule.am $(srcdir)/lib/crypto_backend/argon2/Makemodule.am $(srcdir)/lib/crypto_backend/Makemodule.am $(srcdir)/lib/Makemodule.am $(srcdir)/src/Makemodule.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -395,16 +1150,16 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
        $(am__cd) $(top_srcdir) && \
          $(AUTOMAKE) --gnu Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
          *config.status*) \
            echo ' $(SHELL) ./config.status'; \
            $(SHELL) ./config.status;; \
          *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
        esac;
+$(srcdir)/man/Makemodule.am $(srcdir)/scripts/Makemodule.am $(srcdir)/lib/crypto_backend/argon2/Makemodule.am $(srcdir)/lib/crypto_backend/Makemodule.am $(srcdir)/lib/Makemodule.am $(srcdir)/src/Makemodule.am $(am__empty):
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
        $(SHELL) ./config.status --recheck
@@ -429,15 +1184,1125 @@ $(srcdir)/config.h.in:  $(am__configure_deps)
 
 distclean-hdr:
        -rm -f config.h stamp-h1
+lib/libcryptsetup.pc: $(top_builddir)/config.status $(top_srcdir)/lib/libcryptsetup.pc.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+scripts/cryptsetup.conf: $(top_builddir)/config.status $(top_srcdir)/scripts/cryptsetup.conf.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
+       fi; \
+       for p in $$list; do echo "$$p $$p"; done | \
+       sed 's/$(EXEEXT)$$//' | \
+       while read p p1; do if test -f $$p \
+        || test -f $$p1 \
+         ; then echo "$$p"; echo "$$p"; else :; fi; \
+       done | \
+       sed -e 'p;s,.*/,,;n;h' \
+           -e 's|.*|.|' \
+           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+       sed 'N;N;N;s,\n, ,g' | \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+           if ($$2 == $$4) files[d] = files[d] " " $$1; \
+           else { print "f", $$3 "/" $$4, $$1; } } \
+         END { for (d in files) print "f", d, files[d] }' | \
+       while read type dir files; do \
+           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+           test -z "$$files" || { \
+           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+           } \
+       ; done
+
+uninstall-sbinPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+       files=`for p in $$list; do echo "$$p"; done | \
+         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+             -e 's/$$/$(EXEEXT)/' \
+       `; \
+       test -n "$$list" || exit 0; \
+       echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+
+clean-sbinPROGRAMS:
+       @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+       echo " rm -f" $$list; \
+       rm -f $$list || exit $$?; \
+       test -n "$(EXEEXT)" || exit 0; \
+       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+       echo " rm -f" $$list; \
+       rm -f $$list
+
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+       }
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; \
+       locs=`for p in $$list; do echo $$p; done | \
+             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+             sort -u`; \
+       test -z "$$locs" || { \
+         echo rm -f $${locs}; \
+         rm -f $${locs}; \
+       }
+
+clean-noinstLTLIBRARIES:
+       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+       @list='$(noinst_LTLIBRARIES)'; \
+       locs=`for p in $$list; do echo $$p; done | \
+             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+             sort -u`; \
+       test -z "$$locs" || { \
+         echo rm -f $${locs}; \
+         rm -f $${locs}; \
+       }
+lib/crypto_backend/argon2/blake2/$(am__dirstamp):
+       @$(MKDIR_P) lib/crypto_backend/argon2/blake2
+       @: > lib/crypto_backend/argon2/blake2/$(am__dirstamp)
+lib/crypto_backend/argon2/blake2/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/crypto_backend/argon2/blake2/$(DEPDIR)
+       @: > lib/crypto_backend/argon2/blake2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo:  \
+       lib/crypto_backend/argon2/blake2/$(am__dirstamp) \
+       lib/crypto_backend/argon2/blake2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/$(am__dirstamp):
+       @$(MKDIR_P) lib/crypto_backend/argon2
+       @: > lib/crypto_backend/argon2/$(am__dirstamp)
+lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/crypto_backend/argon2/$(DEPDIR)
+       @: > lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/libargon2_la-argon2.lo:  \
+       lib/crypto_backend/argon2/$(am__dirstamp) \
+       lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/libargon2_la-core.lo:  \
+       lib/crypto_backend/argon2/$(am__dirstamp) \
+       lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/libargon2_la-encoding.lo:  \
+       lib/crypto_backend/argon2/$(am__dirstamp) \
+       lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/libargon2_la-thread.lo:  \
+       lib/crypto_backend/argon2/$(am__dirstamp) \
+       lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/libargon2_la-opt.lo:  \
+       lib/crypto_backend/argon2/$(am__dirstamp) \
+       lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/argon2/libargon2_la-ref.lo:  \
+       lib/crypto_backend/argon2/$(am__dirstamp) \
+       lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+
+libargon2.la: $(libargon2_la_OBJECTS) $(libargon2_la_DEPENDENCIES) $(EXTRA_libargon2_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libargon2_la_LINK) $(am_libargon2_la_rpath) $(libargon2_la_OBJECTS) $(libargon2_la_LIBADD) $(LIBS)
+lib/crypto_backend/$(am__dirstamp):
+       @$(MKDIR_P) lib/crypto_backend
+       @: > lib/crypto_backend/$(am__dirstamp)
+lib/crypto_backend/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/crypto_backend/$(DEPDIR)
+       @: > lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crc32.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-cipher_check.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crypto_gcrypt.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crypto_openssl.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crypto_nss.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-crypto_nettle.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo:  \
+       lib/crypto_backend/$(am__dirstamp) \
+       lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+
+libcrypto_backend.la: $(libcrypto_backend_la_OBJECTS) $(libcrypto_backend_la_DEPENDENCIES) $(EXTRA_libcrypto_backend_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libcrypto_backend_la_LINK)  $(libcrypto_backend_la_OBJECTS) $(libcrypto_backend_la_LIBADD) $(LIBS)
+lib/$(am__dirstamp):
+       @$(MKDIR_P) lib
+       @: > lib/$(am__dirstamp)
+lib/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/$(DEPDIR)
+       @: > lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-setup.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_benchmark.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_crypt.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_loop.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_devpath.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_wipe.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_fips.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_device.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_keyring.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_device_locking.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_pbkdf.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_safe_memory.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_storage_wrappers.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-libdevmapper.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-volumekey.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-random.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-crypt_plain.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-base64.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/integrity/$(am__dirstamp):
+       @$(MKDIR_P) lib/integrity
+       @: > lib/integrity/$(am__dirstamp)
+lib/integrity/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/integrity/$(DEPDIR)
+       @: > lib/integrity/$(DEPDIR)/$(am__dirstamp)
+lib/integrity/libcryptsetup_la-integrity.lo:  \
+       lib/integrity/$(am__dirstamp) \
+       lib/integrity/$(DEPDIR)/$(am__dirstamp)
+lib/loopaes/$(am__dirstamp):
+       @$(MKDIR_P) lib/loopaes
+       @: > lib/loopaes/$(am__dirstamp)
+lib/loopaes/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/loopaes/$(DEPDIR)
+       @: > lib/loopaes/$(DEPDIR)/$(am__dirstamp)
+lib/loopaes/libcryptsetup_la-loopaes.lo: lib/loopaes/$(am__dirstamp) \
+       lib/loopaes/$(DEPDIR)/$(am__dirstamp)
+lib/tcrypt/$(am__dirstamp):
+       @$(MKDIR_P) lib/tcrypt
+       @: > lib/tcrypt/$(am__dirstamp)
+lib/tcrypt/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/tcrypt/$(DEPDIR)
+       @: > lib/tcrypt/$(DEPDIR)/$(am__dirstamp)
+lib/tcrypt/libcryptsetup_la-tcrypt.lo: lib/tcrypt/$(am__dirstamp) \
+       lib/tcrypt/$(DEPDIR)/$(am__dirstamp)
+lib/luks1/$(am__dirstamp):
+       @$(MKDIR_P) lib/luks1
+       @: > lib/luks1/$(am__dirstamp)
+lib/luks1/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/luks1/$(DEPDIR)
+       @: > lib/luks1/$(DEPDIR)/$(am__dirstamp)
+lib/luks1/libcryptsetup_la-af.lo: lib/luks1/$(am__dirstamp) \
+       lib/luks1/$(DEPDIR)/$(am__dirstamp)
+lib/luks1/libcryptsetup_la-keyencryption.lo:  \
+       lib/luks1/$(am__dirstamp) lib/luks1/$(DEPDIR)/$(am__dirstamp)
+lib/luks1/libcryptsetup_la-keymanage.lo: lib/luks1/$(am__dirstamp) \
+       lib/luks1/$(DEPDIR)/$(am__dirstamp)
+lib/verity/$(am__dirstamp):
+       @$(MKDIR_P) lib/verity
+       @: > lib/verity/$(am__dirstamp)
+lib/verity/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/verity/$(DEPDIR)
+       @: > lib/verity/$(DEPDIR)/$(am__dirstamp)
+lib/verity/libcryptsetup_la-verity_hash.lo:  \
+       lib/verity/$(am__dirstamp) \
+       lib/verity/$(DEPDIR)/$(am__dirstamp)
+lib/verity/libcryptsetup_la-verity_fec.lo: lib/verity/$(am__dirstamp) \
+       lib/verity/$(DEPDIR)/$(am__dirstamp)
+lib/verity/libcryptsetup_la-verity.lo: lib/verity/$(am__dirstamp) \
+       lib/verity/$(DEPDIR)/$(am__dirstamp)
+lib/verity/libcryptsetup_la-rs_encode_char.lo:  \
+       lib/verity/$(am__dirstamp) \
+       lib/verity/$(DEPDIR)/$(am__dirstamp)
+lib/verity/libcryptsetup_la-rs_decode_char.lo:  \
+       lib/verity/$(am__dirstamp) \
+       lib/verity/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/$(am__dirstamp):
+       @$(MKDIR_P) lib/luks2
+       @: > lib/luks2/$(am__dirstamp)
+lib/luks2/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/luks2/$(DEPDIR)
+       @: > lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_json_format.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_json_metadata.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_digest.lo: lib/luks2/$(am__dirstamp) \
+       lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_keyslot.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_reencrypt.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_segment.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_token_keyring.lo:  \
+       lib/luks2/$(am__dirstamp) lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/luks2/libcryptsetup_la-luks2_token.lo: lib/luks2/$(am__dirstamp) \
+       lib/luks2/$(DEPDIR)/$(am__dirstamp)
+lib/libcryptsetup_la-utils_blkid.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/bitlk/$(am__dirstamp):
+       @$(MKDIR_P) lib/bitlk
+       @: > lib/bitlk/$(am__dirstamp)
+lib/bitlk/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) lib/bitlk/$(DEPDIR)
+       @: > lib/bitlk/$(DEPDIR)/$(am__dirstamp)
+lib/bitlk/libcryptsetup_la-bitlk.lo: lib/bitlk/$(am__dirstamp) \
+       lib/bitlk/$(DEPDIR)/$(am__dirstamp)
+
+libcryptsetup.la: $(libcryptsetup_la_OBJECTS) $(libcryptsetup_la_DEPENDENCIES) $(EXTRA_libcryptsetup_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libcryptsetup_la_LINK) -rpath $(libdir) $(libcryptsetup_la_OBJECTS) $(libcryptsetup_la_LIBADD) $(LIBS)
+lib/libutils_io_la-utils_io.lo: lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+
+libutils_io.la: $(libutils_io_la_OBJECTS) $(libutils_io_la_DEPENDENCIES) $(EXTRA_libutils_io_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libutils_io_la_LINK)  $(libutils_io_la_OBJECTS) $(libutils_io_la_LIBADD) $(LIBS)
+lib/utils_crypt.$(OBJEXT): lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/utils_loop.$(OBJEXT): lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/utils_io.$(OBJEXT): lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+lib/utils_blkid.$(OBJEXT): lib/$(am__dirstamp) \
+       lib/$(DEPDIR)/$(am__dirstamp)
+src/$(am__dirstamp):
+       @$(MKDIR_P) src
+       @: > src/$(am__dirstamp)
+src/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) src/$(DEPDIR)
+       @: > src/$(DEPDIR)/$(am__dirstamp)
+src/utils_tools.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/utils_password.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/utils_luks2.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/utils_blockdev.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+src/cryptsetup.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+
+cryptsetup$(EXEEXT): $(cryptsetup_OBJECTS) $(cryptsetup_DEPENDENCIES) $(EXTRA_cryptsetup_DEPENDENCIES) 
+       @rm -f cryptsetup$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(cryptsetup_OBJECTS) $(cryptsetup_LDADD) $(LIBS)
+src/cryptsetup_reencrypt.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+
+cryptsetup-reencrypt$(EXEEXT): $(cryptsetup_reencrypt_OBJECTS) $(cryptsetup_reencrypt_DEPENDENCIES) $(EXTRA_cryptsetup_reencrypt_DEPENDENCIES) 
+       @rm -f cryptsetup-reencrypt$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(cryptsetup_reencrypt_OBJECTS) $(cryptsetup_reencrypt_LDADD) $(LIBS)
+
+cryptsetup-reencrypt.static$(EXEEXT): $(cryptsetup_reencrypt_static_OBJECTS) $(cryptsetup_reencrypt_static_DEPENDENCIES) $(EXTRA_cryptsetup_reencrypt_static_DEPENDENCIES) 
+       @rm -f cryptsetup-reencrypt.static$(EXEEXT)
+       $(AM_V_CCLD)$(cryptsetup_reencrypt_static_LINK) $(cryptsetup_reencrypt_static_OBJECTS) $(cryptsetup_reencrypt_static_LDADD) $(LIBS)
+
+cryptsetup.static$(EXEEXT): $(cryptsetup_static_OBJECTS) $(cryptsetup_static_DEPENDENCIES) $(EXTRA_cryptsetup_static_DEPENDENCIES) 
+       @rm -f cryptsetup.static$(EXEEXT)
+       $(AM_V_CCLD)$(cryptsetup_static_LINK) $(cryptsetup_static_OBJECTS) $(cryptsetup_static_LDADD) $(LIBS)
+src/integritysetup.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+
+integritysetup$(EXEEXT): $(integritysetup_OBJECTS) $(integritysetup_DEPENDENCIES) $(EXTRA_integritysetup_DEPENDENCIES) 
+       @rm -f integritysetup$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(integritysetup_OBJECTS) $(integritysetup_LDADD) $(LIBS)
+
+integritysetup.static$(EXEEXT): $(integritysetup_static_OBJECTS) $(integritysetup_static_DEPENDENCIES) $(EXTRA_integritysetup_static_DEPENDENCIES) 
+       @rm -f integritysetup.static$(EXEEXT)
+       $(AM_V_CCLD)$(integritysetup_static_LINK) $(integritysetup_static_OBJECTS) $(integritysetup_static_LDADD) $(LIBS)
+src/veritysetup.$(OBJEXT): src/$(am__dirstamp) \
+       src/$(DEPDIR)/$(am__dirstamp)
+
+veritysetup$(EXEEXT): $(veritysetup_OBJECTS) $(veritysetup_DEPENDENCIES) $(EXTRA_veritysetup_DEPENDENCIES) 
+       @rm -f veritysetup$(EXEEXT)
+       $(AM_V_CCLD)$(LINK) $(veritysetup_OBJECTS) $(veritysetup_LDADD) $(LIBS)
+
+veritysetup.static$(EXEEXT): $(veritysetup_static_OBJECTS) $(veritysetup_static_DEPENDENCIES) $(EXTRA_veritysetup_static_DEPENDENCIES) 
+       @rm -f veritysetup.static$(EXEEXT)
+       $(AM_V_CCLD)$(veritysetup_static_LINK) $(veritysetup_static_OBJECTS) $(veritysetup_static_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+       -rm -f lib/*.$(OBJEXT)
+       -rm -f lib/*.lo
+       -rm -f lib/bitlk/*.$(OBJEXT)
+       -rm -f lib/bitlk/*.lo
+       -rm -f lib/crypto_backend/*.$(OBJEXT)
+       -rm -f lib/crypto_backend/*.lo
+       -rm -f lib/crypto_backend/argon2/*.$(OBJEXT)
+       -rm -f lib/crypto_backend/argon2/*.lo
+       -rm -f lib/crypto_backend/argon2/blake2/*.$(OBJEXT)
+       -rm -f lib/crypto_backend/argon2/blake2/*.lo
+       -rm -f lib/integrity/*.$(OBJEXT)
+       -rm -f lib/integrity/*.lo
+       -rm -f lib/loopaes/*.$(OBJEXT)
+       -rm -f lib/loopaes/*.lo
+       -rm -f lib/luks1/*.$(OBJEXT)
+       -rm -f lib/luks1/*.lo
+       -rm -f lib/luks2/*.$(OBJEXT)
+       -rm -f lib/luks2/*.lo
+       -rm -f lib/tcrypt/*.$(OBJEXT)
+       -rm -f lib/tcrypt/*.lo
+       -rm -f lib/verity/*.$(OBJEXT)
+       -rm -f lib/verity/*.lo
+       -rm -f src/*.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-base64.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-crypt_plain.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-libdevmapper.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-random.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-setup.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_benchmark.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_blkid.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_crypt.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_device.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_device_locking.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_devpath.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_fips.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_keyring.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_loop.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_pbkdf.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_safe_memory.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_storage_wrappers.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-utils_wipe.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libcryptsetup_la-volumekey.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/libutils_io_la-utils_io.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/utils_blkid.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/utils_crypt.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/utils_io.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/$(DEPDIR)/utils_loop.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/bitlk/$(DEPDIR)/libcryptsetup_la-bitlk.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-argon2_generic.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_check.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_generic.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crc32.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nss.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_storage.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-argon2.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-core.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-encoding.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-opt.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-ref.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-thread.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/crypto_backend/argon2/blake2/$(DEPDIR)/libargon2_la-blake2b.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/integrity/$(DEPDIR)/libcryptsetup_la-integrity.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/loopaes/$(DEPDIR)/libcryptsetup_la-loopaes.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks1/$(DEPDIR)/libcryptsetup_la-af.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks1/$(DEPDIR)/libcryptsetup_la-keyencryption.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks1/$(DEPDIR)/libcryptsetup_la-keymanage.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest_pbkdf2.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_disk_metadata.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_format.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_metadata.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_luks2.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_reenc.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_luks1_convert.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_reencrypt.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_segment.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token_keyring.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/tcrypt/$(DEPDIR)/libcryptsetup_la-tcrypt.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/verity/$(DEPDIR)/libcryptsetup_la-rs_decode_char.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/verity/$(DEPDIR)/libcryptsetup_la-rs_encode_char.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/verity/$(DEPDIR)/libcryptsetup_la-verity.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/verity/$(DEPDIR)/libcryptsetup_la-verity_fec.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@lib/verity/$(DEPDIR)/libcryptsetup_la-verity_hash.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cryptsetup.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cryptsetup_reencrypt.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/integritysetup.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/utils_blockdev.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/utils_luks2.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/utils_password.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/utils_tools.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/veritysetup.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+       @$(MKDIR_P) $(@D)
+       @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo: lib/crypto_backend/argon2/blake2/blake2b.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo -MD -MP -MF lib/crypto_backend/argon2/blake2/$(DEPDIR)/libargon2_la-blake2b.Tpo -c -o lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo `test -f 'lib/crypto_backend/argon2/blake2/blake2b.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/blake2/blake2b.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/argon2/blake2/$(DEPDIR)/libargon2_la-blake2b.Tpo lib/crypto_backend/argon2/blake2/$(DEPDIR)/libargon2_la-blake2b.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2/blake2/blake2b.c' object='lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo `test -f 'lib/crypto_backend/argon2/blake2/blake2b.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/blake2/blake2b.c
+
+lib/crypto_backend/argon2/libargon2_la-argon2.lo: lib/crypto_backend/argon2/argon2.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/argon2/libargon2_la-argon2.lo -MD -MP -MF lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-argon2.Tpo -c -o lib/crypto_backend/argon2/libargon2_la-argon2.lo `test -f 'lib/crypto_backend/argon2/argon2.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/argon2.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-argon2.Tpo lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-argon2.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2/argon2.c' object='lib/crypto_backend/argon2/libargon2_la-argon2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/argon2/libargon2_la-argon2.lo `test -f 'lib/crypto_backend/argon2/argon2.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/argon2.c
+
+lib/crypto_backend/argon2/libargon2_la-core.lo: lib/crypto_backend/argon2/core.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/argon2/libargon2_la-core.lo -MD -MP -MF lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-core.Tpo -c -o lib/crypto_backend/argon2/libargon2_la-core.lo `test -f 'lib/crypto_backend/argon2/core.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/core.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-core.Tpo lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-core.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2/core.c' object='lib/crypto_backend/argon2/libargon2_la-core.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/argon2/libargon2_la-core.lo `test -f 'lib/crypto_backend/argon2/core.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/core.c
+
+lib/crypto_backend/argon2/libargon2_la-encoding.lo: lib/crypto_backend/argon2/encoding.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/argon2/libargon2_la-encoding.lo -MD -MP -MF lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-encoding.Tpo -c -o lib/crypto_backend/argon2/libargon2_la-encoding.lo `test -f 'lib/crypto_backend/argon2/encoding.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/encoding.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-encoding.Tpo lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-encoding.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2/encoding.c' object='lib/crypto_backend/argon2/libargon2_la-encoding.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/argon2/libargon2_la-encoding.lo `test -f 'lib/crypto_backend/argon2/encoding.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/encoding.c
+
+lib/crypto_backend/argon2/libargon2_la-thread.lo: lib/crypto_backend/argon2/thread.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/argon2/libargon2_la-thread.lo -MD -MP -MF lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-thread.Tpo -c -o lib/crypto_backend/argon2/libargon2_la-thread.lo `test -f 'lib/crypto_backend/argon2/thread.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/thread.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-thread.Tpo lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-thread.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2/thread.c' object='lib/crypto_backend/argon2/libargon2_la-thread.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/argon2/libargon2_la-thread.lo `test -f 'lib/crypto_backend/argon2/thread.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/thread.c
+
+lib/crypto_backend/argon2/libargon2_la-opt.lo: lib/crypto_backend/argon2/opt.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/argon2/libargon2_la-opt.lo -MD -MP -MF lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-opt.Tpo -c -o lib/crypto_backend/argon2/libargon2_la-opt.lo `test -f 'lib/crypto_backend/argon2/opt.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/opt.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-opt.Tpo lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-opt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2/opt.c' object='lib/crypto_backend/argon2/libargon2_la-opt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/argon2/libargon2_la-opt.lo `test -f 'lib/crypto_backend/argon2/opt.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/opt.c
+
+lib/crypto_backend/argon2/libargon2_la-ref.lo: lib/crypto_backend/argon2/ref.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/argon2/libargon2_la-ref.lo -MD -MP -MF lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-ref.Tpo -c -o lib/crypto_backend/argon2/libargon2_la-ref.lo `test -f 'lib/crypto_backend/argon2/ref.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/ref.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-ref.Tpo lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-ref.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2/ref.c' object='lib/crypto_backend/argon2/libargon2_la-ref.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libargon2_la_CPPFLAGS) $(CPPFLAGS) $(libargon2_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/argon2/libargon2_la-ref.lo `test -f 'lib/crypto_backend/argon2/ref.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2/ref.c
+
+lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo: lib/crypto_backend/crypto_cipher_kernel.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo `test -f 'lib/crypto_backend/crypto_cipher_kernel.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_cipher_kernel.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crypto_cipher_kernel.c' object='lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo `test -f 'lib/crypto_backend/crypto_cipher_kernel.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_cipher_kernel.c
+
+lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo: lib/crypto_backend/crypto_storage.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_storage.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo `test -f 'lib/crypto_backend/crypto_storage.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_storage.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_storage.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_storage.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crypto_storage.c' object='lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo `test -f 'lib/crypto_backend/crypto_storage.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_storage.c
+
+lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo: lib/crypto_backend/pbkdf_check.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo `test -f 'lib/crypto_backend/pbkdf_check.c' || echo '$(srcdir)/'`lib/crypto_backend/pbkdf_check.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/pbkdf_check.c' object='lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo `test -f 'lib/crypto_backend/pbkdf_check.c' || echo '$(srcdir)/'`lib/crypto_backend/pbkdf_check.c
+
+lib/crypto_backend/libcrypto_backend_la-crc32.lo: lib/crypto_backend/crc32.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crc32.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crc32.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crc32.lo `test -f 'lib/crypto_backend/crc32.c' || echo '$(srcdir)/'`lib/crypto_backend/crc32.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crc32.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crc32.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crc32.c' object='lib/crypto_backend/libcrypto_backend_la-crc32.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crc32.lo `test -f 'lib/crypto_backend/crc32.c' || echo '$(srcdir)/'`lib/crypto_backend/crc32.c
+
+lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo: lib/crypto_backend/argon2_generic.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-argon2_generic.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo `test -f 'lib/crypto_backend/argon2_generic.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2_generic.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-argon2_generic.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-argon2_generic.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/argon2_generic.c' object='lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo `test -f 'lib/crypto_backend/argon2_generic.c' || echo '$(srcdir)/'`lib/crypto_backend/argon2_generic.c
+
+lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo: lib/crypto_backend/cipher_generic.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_generic.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo `test -f 'lib/crypto_backend/cipher_generic.c' || echo '$(srcdir)/'`lib/crypto_backend/cipher_generic.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_generic.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_generic.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/cipher_generic.c' object='lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo `test -f 'lib/crypto_backend/cipher_generic.c' || echo '$(srcdir)/'`lib/crypto_backend/cipher_generic.c
+
+lib/crypto_backend/libcrypto_backend_la-cipher_check.lo: lib/crypto_backend/cipher_check.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-cipher_check.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_check.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-cipher_check.lo `test -f 'lib/crypto_backend/cipher_check.c' || echo '$(srcdir)/'`lib/crypto_backend/cipher_check.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_check.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_check.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/cipher_check.c' object='lib/crypto_backend/libcrypto_backend_la-cipher_check.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-cipher_check.lo `test -f 'lib/crypto_backend/cipher_check.c' || echo '$(srcdir)/'`lib/crypto_backend/cipher_check.c
+
+lib/crypto_backend/libcrypto_backend_la-crypto_gcrypt.lo: lib/crypto_backend/crypto_gcrypt.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crypto_gcrypt.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crypto_gcrypt.lo `test -f 'lib/crypto_backend/crypto_gcrypt.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_gcrypt.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crypto_gcrypt.c' object='lib/crypto_backend/libcrypto_backend_la-crypto_gcrypt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crypto_gcrypt.lo `test -f 'lib/crypto_backend/crypto_gcrypt.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_gcrypt.c
+
+lib/crypto_backend/libcrypto_backend_la-crypto_openssl.lo: lib/crypto_backend/crypto_openssl.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crypto_openssl.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crypto_openssl.lo `test -f 'lib/crypto_backend/crypto_openssl.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_openssl.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crypto_openssl.c' object='lib/crypto_backend/libcrypto_backend_la-crypto_openssl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crypto_openssl.lo `test -f 'lib/crypto_backend/crypto_openssl.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_openssl.c
+
+lib/crypto_backend/libcrypto_backend_la-crypto_nss.lo: lib/crypto_backend/crypto_nss.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crypto_nss.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nss.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crypto_nss.lo `test -f 'lib/crypto_backend/crypto_nss.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_nss.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nss.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nss.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crypto_nss.c' object='lib/crypto_backend/libcrypto_backend_la-crypto_nss.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crypto_nss.lo `test -f 'lib/crypto_backend/crypto_nss.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_nss.c
+
+lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo: lib/crypto_backend/crypto_kernel.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo `test -f 'lib/crypto_backend/crypto_kernel.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_kernel.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crypto_kernel.c' object='lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo `test -f 'lib/crypto_backend/crypto_kernel.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_kernel.c
+
+lib/crypto_backend/libcrypto_backend_la-crypto_nettle.lo: lib/crypto_backend/crypto_nettle.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-crypto_nettle.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-crypto_nettle.lo `test -f 'lib/crypto_backend/crypto_nettle.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_nettle.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/crypto_nettle.c' object='lib/crypto_backend/libcrypto_backend_la-crypto_nettle.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-crypto_nettle.lo `test -f 'lib/crypto_backend/crypto_nettle.c' || echo '$(srcdir)/'`lib/crypto_backend/crypto_nettle.c
+
+lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo: lib/crypto_backend/pbkdf2_generic.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo -MD -MP -MF lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Tpo -c -o lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo `test -f 'lib/crypto_backend/pbkdf2_generic.c' || echo '$(srcdir)/'`lib/crypto_backend/pbkdf2_generic.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Tpo lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypto_backend/pbkdf2_generic.c' object='lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo `test -f 'lib/crypto_backend/pbkdf2_generic.c' || echo '$(srcdir)/'`lib/crypto_backend/pbkdf2_generic.c
+
+lib/libcryptsetup_la-setup.lo: lib/setup.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-setup.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-setup.Tpo -c -o lib/libcryptsetup_la-setup.lo `test -f 'lib/setup.c' || echo '$(srcdir)/'`lib/setup.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-setup.Tpo lib/$(DEPDIR)/libcryptsetup_la-setup.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/setup.c' object='lib/libcryptsetup_la-setup.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-setup.lo `test -f 'lib/setup.c' || echo '$(srcdir)/'`lib/setup.c
+
+lib/libcryptsetup_la-utils.lo: lib/utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils.Tpo -c -o lib/libcryptsetup_la-utils.lo `test -f 'lib/utils.c' || echo '$(srcdir)/'`lib/utils.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils.c' object='lib/libcryptsetup_la-utils.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils.lo `test -f 'lib/utils.c' || echo '$(srcdir)/'`lib/utils.c
+
+lib/libcryptsetup_la-utils_benchmark.lo: lib/utils_benchmark.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_benchmark.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_benchmark.Tpo -c -o lib/libcryptsetup_la-utils_benchmark.lo `test -f 'lib/utils_benchmark.c' || echo '$(srcdir)/'`lib/utils_benchmark.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_benchmark.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_benchmark.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_benchmark.c' object='lib/libcryptsetup_la-utils_benchmark.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_benchmark.lo `test -f 'lib/utils_benchmark.c' || echo '$(srcdir)/'`lib/utils_benchmark.c
+
+lib/libcryptsetup_la-utils_crypt.lo: lib/utils_crypt.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_crypt.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_crypt.Tpo -c -o lib/libcryptsetup_la-utils_crypt.lo `test -f 'lib/utils_crypt.c' || echo '$(srcdir)/'`lib/utils_crypt.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_crypt.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_crypt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_crypt.c' object='lib/libcryptsetup_la-utils_crypt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_crypt.lo `test -f 'lib/utils_crypt.c' || echo '$(srcdir)/'`lib/utils_crypt.c
+
+lib/libcryptsetup_la-utils_loop.lo: lib/utils_loop.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_loop.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_loop.Tpo -c -o lib/libcryptsetup_la-utils_loop.lo `test -f 'lib/utils_loop.c' || echo '$(srcdir)/'`lib/utils_loop.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_loop.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_loop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_loop.c' object='lib/libcryptsetup_la-utils_loop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_loop.lo `test -f 'lib/utils_loop.c' || echo '$(srcdir)/'`lib/utils_loop.c
+
+lib/libcryptsetup_la-utils_devpath.lo: lib/utils_devpath.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_devpath.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_devpath.Tpo -c -o lib/libcryptsetup_la-utils_devpath.lo `test -f 'lib/utils_devpath.c' || echo '$(srcdir)/'`lib/utils_devpath.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_devpath.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_devpath.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_devpath.c' object='lib/libcryptsetup_la-utils_devpath.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_devpath.lo `test -f 'lib/utils_devpath.c' || echo '$(srcdir)/'`lib/utils_devpath.c
+
+lib/libcryptsetup_la-utils_wipe.lo: lib/utils_wipe.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_wipe.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_wipe.Tpo -c -o lib/libcryptsetup_la-utils_wipe.lo `test -f 'lib/utils_wipe.c' || echo '$(srcdir)/'`lib/utils_wipe.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_wipe.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_wipe.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_wipe.c' object='lib/libcryptsetup_la-utils_wipe.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_wipe.lo `test -f 'lib/utils_wipe.c' || echo '$(srcdir)/'`lib/utils_wipe.c
+
+lib/libcryptsetup_la-utils_fips.lo: lib/utils_fips.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_fips.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_fips.Tpo -c -o lib/libcryptsetup_la-utils_fips.lo `test -f 'lib/utils_fips.c' || echo '$(srcdir)/'`lib/utils_fips.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_fips.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_fips.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_fips.c' object='lib/libcryptsetup_la-utils_fips.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_fips.lo `test -f 'lib/utils_fips.c' || echo '$(srcdir)/'`lib/utils_fips.c
+
+lib/libcryptsetup_la-utils_device.lo: lib/utils_device.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_device.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_device.Tpo -c -o lib/libcryptsetup_la-utils_device.lo `test -f 'lib/utils_device.c' || echo '$(srcdir)/'`lib/utils_device.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_device.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_device.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_device.c' object='lib/libcryptsetup_la-utils_device.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_device.lo `test -f 'lib/utils_device.c' || echo '$(srcdir)/'`lib/utils_device.c
+
+lib/libcryptsetup_la-utils_keyring.lo: lib/utils_keyring.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_keyring.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_keyring.Tpo -c -o lib/libcryptsetup_la-utils_keyring.lo `test -f 'lib/utils_keyring.c' || echo '$(srcdir)/'`lib/utils_keyring.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_keyring.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_keyring.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_keyring.c' object='lib/libcryptsetup_la-utils_keyring.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_keyring.lo `test -f 'lib/utils_keyring.c' || echo '$(srcdir)/'`lib/utils_keyring.c
+
+lib/libcryptsetup_la-utils_device_locking.lo: lib/utils_device_locking.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_device_locking.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_device_locking.Tpo -c -o lib/libcryptsetup_la-utils_device_locking.lo `test -f 'lib/utils_device_locking.c' || echo '$(srcdir)/'`lib/utils_device_locking.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_device_locking.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_device_locking.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_device_locking.c' object='lib/libcryptsetup_la-utils_device_locking.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_device_locking.lo `test -f 'lib/utils_device_locking.c' || echo '$(srcdir)/'`lib/utils_device_locking.c
+
+lib/libcryptsetup_la-utils_pbkdf.lo: lib/utils_pbkdf.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_pbkdf.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_pbkdf.Tpo -c -o lib/libcryptsetup_la-utils_pbkdf.lo `test -f 'lib/utils_pbkdf.c' || echo '$(srcdir)/'`lib/utils_pbkdf.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_pbkdf.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_pbkdf.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_pbkdf.c' object='lib/libcryptsetup_la-utils_pbkdf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_pbkdf.lo `test -f 'lib/utils_pbkdf.c' || echo '$(srcdir)/'`lib/utils_pbkdf.c
+
+lib/libcryptsetup_la-utils_safe_memory.lo: lib/utils_safe_memory.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_safe_memory.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_safe_memory.Tpo -c -o lib/libcryptsetup_la-utils_safe_memory.lo `test -f 'lib/utils_safe_memory.c' || echo '$(srcdir)/'`lib/utils_safe_memory.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_safe_memory.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_safe_memory.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_safe_memory.c' object='lib/libcryptsetup_la-utils_safe_memory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_safe_memory.lo `test -f 'lib/utils_safe_memory.c' || echo '$(srcdir)/'`lib/utils_safe_memory.c
+
+lib/libcryptsetup_la-utils_storage_wrappers.lo: lib/utils_storage_wrappers.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_storage_wrappers.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_storage_wrappers.Tpo -c -o lib/libcryptsetup_la-utils_storage_wrappers.lo `test -f 'lib/utils_storage_wrappers.c' || echo '$(srcdir)/'`lib/utils_storage_wrappers.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_storage_wrappers.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_storage_wrappers.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_storage_wrappers.c' object='lib/libcryptsetup_la-utils_storage_wrappers.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_storage_wrappers.lo `test -f 'lib/utils_storage_wrappers.c' || echo '$(srcdir)/'`lib/utils_storage_wrappers.c
+
+lib/libcryptsetup_la-libdevmapper.lo: lib/libdevmapper.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-libdevmapper.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-libdevmapper.Tpo -c -o lib/libcryptsetup_la-libdevmapper.lo `test -f 'lib/libdevmapper.c' || echo '$(srcdir)/'`lib/libdevmapper.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-libdevmapper.Tpo lib/$(DEPDIR)/libcryptsetup_la-libdevmapper.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/libdevmapper.c' object='lib/libcryptsetup_la-libdevmapper.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-libdevmapper.lo `test -f 'lib/libdevmapper.c' || echo '$(srcdir)/'`lib/libdevmapper.c
+
+lib/libcryptsetup_la-volumekey.lo: lib/volumekey.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-volumekey.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-volumekey.Tpo -c -o lib/libcryptsetup_la-volumekey.lo `test -f 'lib/volumekey.c' || echo '$(srcdir)/'`lib/volumekey.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-volumekey.Tpo lib/$(DEPDIR)/libcryptsetup_la-volumekey.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/volumekey.c' object='lib/libcryptsetup_la-volumekey.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-volumekey.lo `test -f 'lib/volumekey.c' || echo '$(srcdir)/'`lib/volumekey.c
+
+lib/libcryptsetup_la-random.lo: lib/random.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-random.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-random.Tpo -c -o lib/libcryptsetup_la-random.lo `test -f 'lib/random.c' || echo '$(srcdir)/'`lib/random.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-random.Tpo lib/$(DEPDIR)/libcryptsetup_la-random.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/random.c' object='lib/libcryptsetup_la-random.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-random.lo `test -f 'lib/random.c' || echo '$(srcdir)/'`lib/random.c
+
+lib/libcryptsetup_la-crypt_plain.lo: lib/crypt_plain.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-crypt_plain.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-crypt_plain.Tpo -c -o lib/libcryptsetup_la-crypt_plain.lo `test -f 'lib/crypt_plain.c' || echo '$(srcdir)/'`lib/crypt_plain.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-crypt_plain.Tpo lib/$(DEPDIR)/libcryptsetup_la-crypt_plain.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/crypt_plain.c' object='lib/libcryptsetup_la-crypt_plain.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-crypt_plain.lo `test -f 'lib/crypt_plain.c' || echo '$(srcdir)/'`lib/crypt_plain.c
+
+lib/libcryptsetup_la-base64.lo: lib/base64.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-base64.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-base64.Tpo -c -o lib/libcryptsetup_la-base64.lo `test -f 'lib/base64.c' || echo '$(srcdir)/'`lib/base64.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-base64.Tpo lib/$(DEPDIR)/libcryptsetup_la-base64.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/base64.c' object='lib/libcryptsetup_la-base64.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-base64.lo `test -f 'lib/base64.c' || echo '$(srcdir)/'`lib/base64.c
+
+lib/integrity/libcryptsetup_la-integrity.lo: lib/integrity/integrity.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/integrity/libcryptsetup_la-integrity.lo -MD -MP -MF lib/integrity/$(DEPDIR)/libcryptsetup_la-integrity.Tpo -c -o lib/integrity/libcryptsetup_la-integrity.lo `test -f 'lib/integrity/integrity.c' || echo '$(srcdir)/'`lib/integrity/integrity.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/integrity/$(DEPDIR)/libcryptsetup_la-integrity.Tpo lib/integrity/$(DEPDIR)/libcryptsetup_la-integrity.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/integrity/integrity.c' object='lib/integrity/libcryptsetup_la-integrity.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/integrity/libcryptsetup_la-integrity.lo `test -f 'lib/integrity/integrity.c' || echo '$(srcdir)/'`lib/integrity/integrity.c
+
+lib/loopaes/libcryptsetup_la-loopaes.lo: lib/loopaes/loopaes.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/loopaes/libcryptsetup_la-loopaes.lo -MD -MP -MF lib/loopaes/$(DEPDIR)/libcryptsetup_la-loopaes.Tpo -c -o lib/loopaes/libcryptsetup_la-loopaes.lo `test -f 'lib/loopaes/loopaes.c' || echo '$(srcdir)/'`lib/loopaes/loopaes.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/loopaes/$(DEPDIR)/libcryptsetup_la-loopaes.Tpo lib/loopaes/$(DEPDIR)/libcryptsetup_la-loopaes.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/loopaes/loopaes.c' object='lib/loopaes/libcryptsetup_la-loopaes.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/loopaes/libcryptsetup_la-loopaes.lo `test -f 'lib/loopaes/loopaes.c' || echo '$(srcdir)/'`lib/loopaes/loopaes.c
+
+lib/tcrypt/libcryptsetup_la-tcrypt.lo: lib/tcrypt/tcrypt.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/tcrypt/libcryptsetup_la-tcrypt.lo -MD -MP -MF lib/tcrypt/$(DEPDIR)/libcryptsetup_la-tcrypt.Tpo -c -o lib/tcrypt/libcryptsetup_la-tcrypt.lo `test -f 'lib/tcrypt/tcrypt.c' || echo '$(srcdir)/'`lib/tcrypt/tcrypt.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/tcrypt/$(DEPDIR)/libcryptsetup_la-tcrypt.Tpo lib/tcrypt/$(DEPDIR)/libcryptsetup_la-tcrypt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/tcrypt/tcrypt.c' object='lib/tcrypt/libcryptsetup_la-tcrypt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/tcrypt/libcryptsetup_la-tcrypt.lo `test -f 'lib/tcrypt/tcrypt.c' || echo '$(srcdir)/'`lib/tcrypt/tcrypt.c
+
+lib/luks1/libcryptsetup_la-af.lo: lib/luks1/af.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks1/libcryptsetup_la-af.lo -MD -MP -MF lib/luks1/$(DEPDIR)/libcryptsetup_la-af.Tpo -c -o lib/luks1/libcryptsetup_la-af.lo `test -f 'lib/luks1/af.c' || echo '$(srcdir)/'`lib/luks1/af.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks1/$(DEPDIR)/libcryptsetup_la-af.Tpo lib/luks1/$(DEPDIR)/libcryptsetup_la-af.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks1/af.c' object='lib/luks1/libcryptsetup_la-af.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks1/libcryptsetup_la-af.lo `test -f 'lib/luks1/af.c' || echo '$(srcdir)/'`lib/luks1/af.c
+
+lib/luks1/libcryptsetup_la-keyencryption.lo: lib/luks1/keyencryption.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks1/libcryptsetup_la-keyencryption.lo -MD -MP -MF lib/luks1/$(DEPDIR)/libcryptsetup_la-keyencryption.Tpo -c -o lib/luks1/libcryptsetup_la-keyencryption.lo `test -f 'lib/luks1/keyencryption.c' || echo '$(srcdir)/'`lib/luks1/keyencryption.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks1/$(DEPDIR)/libcryptsetup_la-keyencryption.Tpo lib/luks1/$(DEPDIR)/libcryptsetup_la-keyencryption.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks1/keyencryption.c' object='lib/luks1/libcryptsetup_la-keyencryption.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks1/libcryptsetup_la-keyencryption.lo `test -f 'lib/luks1/keyencryption.c' || echo '$(srcdir)/'`lib/luks1/keyencryption.c
+
+lib/luks1/libcryptsetup_la-keymanage.lo: lib/luks1/keymanage.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks1/libcryptsetup_la-keymanage.lo -MD -MP -MF lib/luks1/$(DEPDIR)/libcryptsetup_la-keymanage.Tpo -c -o lib/luks1/libcryptsetup_la-keymanage.lo `test -f 'lib/luks1/keymanage.c' || echo '$(srcdir)/'`lib/luks1/keymanage.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks1/$(DEPDIR)/libcryptsetup_la-keymanage.Tpo lib/luks1/$(DEPDIR)/libcryptsetup_la-keymanage.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks1/keymanage.c' object='lib/luks1/libcryptsetup_la-keymanage.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks1/libcryptsetup_la-keymanage.lo `test -f 'lib/luks1/keymanage.c' || echo '$(srcdir)/'`lib/luks1/keymanage.c
+
+lib/verity/libcryptsetup_la-verity_hash.lo: lib/verity/verity_hash.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/verity/libcryptsetup_la-verity_hash.lo -MD -MP -MF lib/verity/$(DEPDIR)/libcryptsetup_la-verity_hash.Tpo -c -o lib/verity/libcryptsetup_la-verity_hash.lo `test -f 'lib/verity/verity_hash.c' || echo '$(srcdir)/'`lib/verity/verity_hash.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/verity/$(DEPDIR)/libcryptsetup_la-verity_hash.Tpo lib/verity/$(DEPDIR)/libcryptsetup_la-verity_hash.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/verity/verity_hash.c' object='lib/verity/libcryptsetup_la-verity_hash.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/verity/libcryptsetup_la-verity_hash.lo `test -f 'lib/verity/verity_hash.c' || echo '$(srcdir)/'`lib/verity/verity_hash.c
+
+lib/verity/libcryptsetup_la-verity_fec.lo: lib/verity/verity_fec.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/verity/libcryptsetup_la-verity_fec.lo -MD -MP -MF lib/verity/$(DEPDIR)/libcryptsetup_la-verity_fec.Tpo -c -o lib/verity/libcryptsetup_la-verity_fec.lo `test -f 'lib/verity/verity_fec.c' || echo '$(srcdir)/'`lib/verity/verity_fec.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/verity/$(DEPDIR)/libcryptsetup_la-verity_fec.Tpo lib/verity/$(DEPDIR)/libcryptsetup_la-verity_fec.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/verity/verity_fec.c' object='lib/verity/libcryptsetup_la-verity_fec.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/verity/libcryptsetup_la-verity_fec.lo `test -f 'lib/verity/verity_fec.c' || echo '$(srcdir)/'`lib/verity/verity_fec.c
+
+lib/verity/libcryptsetup_la-verity.lo: lib/verity/verity.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/verity/libcryptsetup_la-verity.lo -MD -MP -MF lib/verity/$(DEPDIR)/libcryptsetup_la-verity.Tpo -c -o lib/verity/libcryptsetup_la-verity.lo `test -f 'lib/verity/verity.c' || echo '$(srcdir)/'`lib/verity/verity.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/verity/$(DEPDIR)/libcryptsetup_la-verity.Tpo lib/verity/$(DEPDIR)/libcryptsetup_la-verity.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/verity/verity.c' object='lib/verity/libcryptsetup_la-verity.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/verity/libcryptsetup_la-verity.lo `test -f 'lib/verity/verity.c' || echo '$(srcdir)/'`lib/verity/verity.c
+
+lib/verity/libcryptsetup_la-rs_encode_char.lo: lib/verity/rs_encode_char.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/verity/libcryptsetup_la-rs_encode_char.lo -MD -MP -MF lib/verity/$(DEPDIR)/libcryptsetup_la-rs_encode_char.Tpo -c -o lib/verity/libcryptsetup_la-rs_encode_char.lo `test -f 'lib/verity/rs_encode_char.c' || echo '$(srcdir)/'`lib/verity/rs_encode_char.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/verity/$(DEPDIR)/libcryptsetup_la-rs_encode_char.Tpo lib/verity/$(DEPDIR)/libcryptsetup_la-rs_encode_char.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/verity/rs_encode_char.c' object='lib/verity/libcryptsetup_la-rs_encode_char.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/verity/libcryptsetup_la-rs_encode_char.lo `test -f 'lib/verity/rs_encode_char.c' || echo '$(srcdir)/'`lib/verity/rs_encode_char.c
+
+lib/verity/libcryptsetup_la-rs_decode_char.lo: lib/verity/rs_decode_char.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/verity/libcryptsetup_la-rs_decode_char.lo -MD -MP -MF lib/verity/$(DEPDIR)/libcryptsetup_la-rs_decode_char.Tpo -c -o lib/verity/libcryptsetup_la-rs_decode_char.lo `test -f 'lib/verity/rs_decode_char.c' || echo '$(srcdir)/'`lib/verity/rs_decode_char.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/verity/$(DEPDIR)/libcryptsetup_la-rs_decode_char.Tpo lib/verity/$(DEPDIR)/libcryptsetup_la-rs_decode_char.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/verity/rs_decode_char.c' object='lib/verity/libcryptsetup_la-rs_decode_char.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/verity/libcryptsetup_la-rs_decode_char.lo `test -f 'lib/verity/rs_decode_char.c' || echo '$(srcdir)/'`lib/verity/rs_decode_char.c
+
+lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo: lib/luks2/luks2_disk_metadata.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_disk_metadata.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo `test -f 'lib/luks2/luks2_disk_metadata.c' || echo '$(srcdir)/'`lib/luks2/luks2_disk_metadata.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_disk_metadata.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_disk_metadata.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_disk_metadata.c' object='lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo `test -f 'lib/luks2/luks2_disk_metadata.c' || echo '$(srcdir)/'`lib/luks2/luks2_disk_metadata.c
+
+lib/luks2/libcryptsetup_la-luks2_json_format.lo: lib/luks2/luks2_json_format.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_json_format.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_format.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_json_format.lo `test -f 'lib/luks2/luks2_json_format.c' || echo '$(srcdir)/'`lib/luks2/luks2_json_format.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_format.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_format.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_json_format.c' object='lib/luks2/libcryptsetup_la-luks2_json_format.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_json_format.lo `test -f 'lib/luks2/luks2_json_format.c' || echo '$(srcdir)/'`lib/luks2/luks2_json_format.c
+
+lib/luks2/libcryptsetup_la-luks2_json_metadata.lo: lib/luks2/luks2_json_metadata.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_json_metadata.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_metadata.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_json_metadata.lo `test -f 'lib/luks2/luks2_json_metadata.c' || echo '$(srcdir)/'`lib/luks2/luks2_json_metadata.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_metadata.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_metadata.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_json_metadata.c' object='lib/luks2/libcryptsetup_la-luks2_json_metadata.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_json_metadata.lo `test -f 'lib/luks2/luks2_json_metadata.c' || echo '$(srcdir)/'`lib/luks2/luks2_json_metadata.c
+
+lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo: lib/luks2/luks2_luks1_convert.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_luks1_convert.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo `test -f 'lib/luks2/luks2_luks1_convert.c' || echo '$(srcdir)/'`lib/luks2/luks2_luks1_convert.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_luks1_convert.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_luks1_convert.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_luks1_convert.c' object='lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo `test -f 'lib/luks2/luks2_luks1_convert.c' || echo '$(srcdir)/'`lib/luks2/luks2_luks1_convert.c
+
+lib/luks2/libcryptsetup_la-luks2_digest.lo: lib/luks2/luks2_digest.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_digest.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_digest.lo `test -f 'lib/luks2/luks2_digest.c' || echo '$(srcdir)/'`lib/luks2/luks2_digest.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_digest.c' object='lib/luks2/libcryptsetup_la-luks2_digest.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_digest.lo `test -f 'lib/luks2/luks2_digest.c' || echo '$(srcdir)/'`lib/luks2/luks2_digest.c
+
+lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo: lib/luks2/luks2_digest_pbkdf2.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest_pbkdf2.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo `test -f 'lib/luks2/luks2_digest_pbkdf2.c' || echo '$(srcdir)/'`lib/luks2/luks2_digest_pbkdf2.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest_pbkdf2.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest_pbkdf2.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_digest_pbkdf2.c' object='lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo `test -f 'lib/luks2/luks2_digest_pbkdf2.c' || echo '$(srcdir)/'`lib/luks2/luks2_digest_pbkdf2.c
+
+lib/luks2/libcryptsetup_la-luks2_keyslot.lo: lib/luks2/luks2_keyslot.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_keyslot.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_keyslot.lo `test -f 'lib/luks2/luks2_keyslot.c' || echo '$(srcdir)/'`lib/luks2/luks2_keyslot.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_keyslot.c' object='lib/luks2/libcryptsetup_la-luks2_keyslot.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_keyslot.lo `test -f 'lib/luks2/luks2_keyslot.c' || echo '$(srcdir)/'`lib/luks2/luks2_keyslot.c
+
+lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo: lib/luks2/luks2_keyslot_luks2.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_luks2.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo `test -f 'lib/luks2/luks2_keyslot_luks2.c' || echo '$(srcdir)/'`lib/luks2/luks2_keyslot_luks2.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_luks2.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_luks2.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_keyslot_luks2.c' object='lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo `test -f 'lib/luks2/luks2_keyslot_luks2.c' || echo '$(srcdir)/'`lib/luks2/luks2_keyslot_luks2.c
+
+lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo: lib/luks2/luks2_keyslot_reenc.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_reenc.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo `test -f 'lib/luks2/luks2_keyslot_reenc.c' || echo '$(srcdir)/'`lib/luks2/luks2_keyslot_reenc.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_reenc.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_reenc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_keyslot_reenc.c' object='lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo `test -f 'lib/luks2/luks2_keyslot_reenc.c' || echo '$(srcdir)/'`lib/luks2/luks2_keyslot_reenc.c
+
+lib/luks2/libcryptsetup_la-luks2_reencrypt.lo: lib/luks2/luks2_reencrypt.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_reencrypt.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_reencrypt.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_reencrypt.lo `test -f 'lib/luks2/luks2_reencrypt.c' || echo '$(srcdir)/'`lib/luks2/luks2_reencrypt.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_reencrypt.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_reencrypt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_reencrypt.c' object='lib/luks2/libcryptsetup_la-luks2_reencrypt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_reencrypt.lo `test -f 'lib/luks2/luks2_reencrypt.c' || echo '$(srcdir)/'`lib/luks2/luks2_reencrypt.c
+
+lib/luks2/libcryptsetup_la-luks2_segment.lo: lib/luks2/luks2_segment.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_segment.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_segment.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_segment.lo `test -f 'lib/luks2/luks2_segment.c' || echo '$(srcdir)/'`lib/luks2/luks2_segment.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_segment.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_segment.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_segment.c' object='lib/luks2/libcryptsetup_la-luks2_segment.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_segment.lo `test -f 'lib/luks2/luks2_segment.c' || echo '$(srcdir)/'`lib/luks2/luks2_segment.c
+
+lib/luks2/libcryptsetup_la-luks2_token_keyring.lo: lib/luks2/luks2_token_keyring.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_token_keyring.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token_keyring.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_token_keyring.lo `test -f 'lib/luks2/luks2_token_keyring.c' || echo '$(srcdir)/'`lib/luks2/luks2_token_keyring.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token_keyring.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token_keyring.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_token_keyring.c' object='lib/luks2/libcryptsetup_la-luks2_token_keyring.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_token_keyring.lo `test -f 'lib/luks2/luks2_token_keyring.c' || echo '$(srcdir)/'`lib/luks2/luks2_token_keyring.c
+
+lib/luks2/libcryptsetup_la-luks2_token.lo: lib/luks2/luks2_token.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/luks2/libcryptsetup_la-luks2_token.lo -MD -MP -MF lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token.Tpo -c -o lib/luks2/libcryptsetup_la-luks2_token.lo `test -f 'lib/luks2/luks2_token.c' || echo '$(srcdir)/'`lib/luks2/luks2_token.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token.Tpo lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/luks2/luks2_token.c' object='lib/luks2/libcryptsetup_la-luks2_token.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/luks2/libcryptsetup_la-luks2_token.lo `test -f 'lib/luks2/luks2_token.c' || echo '$(srcdir)/'`lib/luks2/luks2_token.c
+
+lib/libcryptsetup_la-utils_blkid.lo: lib/utils_blkid.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/libcryptsetup_la-utils_blkid.lo -MD -MP -MF lib/$(DEPDIR)/libcryptsetup_la-utils_blkid.Tpo -c -o lib/libcryptsetup_la-utils_blkid.lo `test -f 'lib/utils_blkid.c' || echo '$(srcdir)/'`lib/utils_blkid.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libcryptsetup_la-utils_blkid.Tpo lib/$(DEPDIR)/libcryptsetup_la-utils_blkid.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_blkid.c' object='lib/libcryptsetup_la-utils_blkid.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/libcryptsetup_la-utils_blkid.lo `test -f 'lib/utils_blkid.c' || echo '$(srcdir)/'`lib/utils_blkid.c
+
+lib/bitlk/libcryptsetup_la-bitlk.lo: lib/bitlk/bitlk.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT lib/bitlk/libcryptsetup_la-bitlk.lo -MD -MP -MF lib/bitlk/$(DEPDIR)/libcryptsetup_la-bitlk.Tpo -c -o lib/bitlk/libcryptsetup_la-bitlk.lo `test -f 'lib/bitlk/bitlk.c' || echo '$(srcdir)/'`lib/bitlk/bitlk.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/bitlk/$(DEPDIR)/libcryptsetup_la-bitlk.Tpo lib/bitlk/$(DEPDIR)/libcryptsetup_la-bitlk.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/bitlk/bitlk.c' object='lib/bitlk/libcryptsetup_la-bitlk.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o lib/bitlk/libcryptsetup_la-bitlk.lo `test -f 'lib/bitlk/bitlk.c' || echo '$(srcdir)/'`lib/bitlk/bitlk.c
+
+lib/libutils_io_la-utils_io.lo: lib/utils_io.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutils_io_la_CFLAGS) $(CFLAGS) -MT lib/libutils_io_la-utils_io.lo -MD -MP -MF lib/$(DEPDIR)/libutils_io_la-utils_io.Tpo -c -o lib/libutils_io_la-utils_io.lo `test -f 'lib/utils_io.c' || echo '$(srcdir)/'`lib/utils_io.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) lib/$(DEPDIR)/libutils_io_la-utils_io.Tpo lib/$(DEPDIR)/libutils_io_la-utils_io.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='lib/utils_io.c' object='lib/libutils_io_la-utils_io.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libutils_io_la_CFLAGS) $(CFLAGS) -c -o lib/libutils_io_la-utils_io.lo `test -f 'lib/utils_io.c' || echo '$(srcdir)/'`lib/utils_io.c
 
 mostlyclean-libtool:
        -rm -f *.lo
 
 clean-libtool:
        -rm -rf .libs _libs
+       -rm -rf lib/.libs lib/_libs
+       -rm -rf lib/bitlk/.libs lib/bitlk/_libs
+       -rm -rf lib/crypto_backend/.libs lib/crypto_backend/_libs
+       -rm -rf lib/crypto_backend/argon2/.libs lib/crypto_backend/argon2/_libs
+       -rm -rf lib/crypto_backend/argon2/blake2/.libs lib/crypto_backend/argon2/blake2/_libs
+       -rm -rf lib/integrity/.libs lib/integrity/_libs
+       -rm -rf lib/loopaes/.libs lib/loopaes/_libs
+       -rm -rf lib/luks1/.libs lib/luks1/_libs
+       -rm -rf lib/luks2/.libs lib/luks2/_libs
+       -rm -rf lib/tcrypt/.libs lib/tcrypt/_libs
+       -rm -rf lib/verity/.libs lib/verity/_libs
 
 distclean-libtool:
        -rm -f libtool config.lt
+install-man8: $(man8_MANS)
+       @$(NORMAL_INSTALL)
+       @list1='$(man8_MANS)'; \
+       list2=''; \
+       test -n "$(man8dir)" \
+         && test -n "`echo $$list1$$list2`" \
+         || exit 0; \
+       echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \
+       $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \
+       { for i in $$list1; do echo "$$i"; done;  \
+       if test -n "$$list2"; then \
+         for i in $$list2; do echo "$$i"; done \
+           | sed -n '/\.8[a-z]*$$/p'; \
+       fi; \
+       } | while read p; do \
+         if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; echo "$$p"; \
+       done | \
+       sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+       sed 'N;N;s,\n, ,g' | { \
+       list=; while read file base inst; do \
+         if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+           echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+           $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
+         fi; \
+       done; \
+       for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+       while read files; do \
+         test -z "$$files" || { \
+           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
+           $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
+       done; }
+
+uninstall-man8:
+       @$(NORMAL_UNINSTALL)
+       @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
+       files=`{ for i in $$list; do echo "$$i"; done; \
+       } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+       dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
+install-pkgconfigDATA: $(pkgconfig_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+       done
+
+uninstall-pkgconfigDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
+install-tmpfilesdDATA: $(tmpfilesd_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(tmpfilesd_DATA)'; test -n "$(tmpfilesddir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(tmpfilesddir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(tmpfilesddir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(tmpfilesddir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(tmpfilesddir)" || exit $$?; \
+       done
+
+uninstall-tmpfilesdDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(tmpfilesd_DATA)'; test -n "$(tmpfilesddir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(tmpfilesddir)'; $(am__uninstall_files_from_dir)
+install-includeHEADERS: $(include_HEADERS)
+       @$(NORMAL_INSTALL)
+       @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+         $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+       done
+
+uninstall-includeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
@@ -545,7 +2410,10 @@ distclean-tags:
        -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
        -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
        $(am__remove_distdir)
        test -d "$(distdir)" || mkdir "$(distdir)"
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -610,7 +2478,7 @@ distdir: $(DISTFILES)
          ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
        || chmod -R a+r "$(distdir)"
 dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
        $(am__post_remove_distdir)
 
 dist-bzip2: distdir
@@ -624,18 +2492,22 @@ dist-xz: distdir
        tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
        $(am__post_remove_distdir)
 
+dist-zstd: distdir
+       tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
+       $(am__post_remove_distdir)
+
 dist-tarZ: distdir
-       @echo WARNING: "Support for shar distribution archives is" \
-                      "deprecated." >&2
+       @echo WARNING: "Support for distribution archives compressed with" \
+                      "legacy program 'compress' is deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
        tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
        $(am__post_remove_distdir)
 
 dist-shar: distdir
-       @echo WARNING: "Support for distribution archives compressed with" \
-                      "legacy program 'compress' is deprecated." >&2
+       @echo WARNING: "Support for shar distribution archives is" \
+                      "deprecated." >&2
        @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
        $(am__post_remove_distdir)
 
 dist-zip: distdir
@@ -653,7 +2525,7 @@ dist dist-all:
 distcheck: dist
        case '$(DIST_ARCHIVES)' in \
        *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
        *.tar.lz*) \
@@ -663,23 +2535,25 @@ distcheck: dist
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+         eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
+       *.tar.zst*) \
+         zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
        esac
        chmod -R a-w $(distdir)
        chmod u+w $(distdir)
-       mkdir $(distdir)/_build $(distdir)/_inst
+       mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
        chmod a-w $(distdir)
        test -d $(distdir)/_build || exit 0; \
        dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
          && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
          && am__cwd=`pwd` \
-         && $(am__cd) $(distdir)/_build \
-         && ../configure \
+         && $(am__cd) $(distdir)/_build/sub \
+         && ../../configure \
            $(AM_DISTCHECK_CONFIGURE_FLAGS) \
            $(DISTCHECK_CONFIGURE_FLAGS) \
-           --srcdir=.. --prefix="$$dc_install_base" \
+           --srcdir=../.. --prefix="$$dc_install_base" \
          && $(MAKE) $(AM_MAKEFLAGS) \
          && $(MAKE) $(AM_MAKEFLAGS) dvi \
          && $(MAKE) $(AM_MAKEFLAGS) check \
@@ -734,9 +2608,13 @@ distcleancheck: distclean
               exit 1; } >&2
 check-am: all-am
 check: check-recursive
-all-am: Makefile config.h
+all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(MANS) $(DATA) $(HEADERS) \
+               config.h
 installdirs: installdirs-recursive
 installdirs-am:
+       for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(tmpfilesddir)" "$(DESTDIR)$(includedir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -759,23 +2637,127 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+       -rm -f lib/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/$(am__dirstamp)
+       -rm -f lib/bitlk/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/bitlk/$(am__dirstamp)
+       -rm -f lib/crypto_backend/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/crypto_backend/$(am__dirstamp)
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/crypto_backend/argon2/$(am__dirstamp)
+       -rm -f lib/crypto_backend/argon2/blake2/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/crypto_backend/argon2/blake2/$(am__dirstamp)
+       -rm -f lib/integrity/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/integrity/$(am__dirstamp)
+       -rm -f lib/loopaes/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/loopaes/$(am__dirstamp)
+       -rm -f lib/luks1/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/luks1/$(am__dirstamp)
+       -rm -f lib/luks2/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/luks2/$(am__dirstamp)
+       -rm -f lib/tcrypt/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/tcrypt/$(am__dirstamp)
+       -rm -f lib/verity/$(DEPDIR)/$(am__dirstamp)
+       -rm -f lib/verity/$(am__dirstamp)
+       -rm -f src/$(DEPDIR)/$(am__dirstamp)
+       -rm -f src/$(am__dirstamp)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
 clean: clean-recursive
 
-clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+       clean-noinstLTLIBRARIES clean-sbinPROGRAMS mostlyclean-am
 
 distclean: distclean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+               -rm -f lib/$(DEPDIR)/libcryptsetup_la-base64.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-crypt_plain.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-libdevmapper.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-random.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-setup.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_benchmark.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_blkid.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_crypt.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_device.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_device_locking.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_devpath.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_fips.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_keyring.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_loop.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_pbkdf.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_safe_memory.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_storage_wrappers.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_wipe.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-volumekey.Plo
+       -rm -f lib/$(DEPDIR)/libutils_io_la-utils_io.Plo
+       -rm -f lib/$(DEPDIR)/utils_blkid.Po
+       -rm -f lib/$(DEPDIR)/utils_crypt.Po
+       -rm -f lib/$(DEPDIR)/utils_io.Po
+       -rm -f lib/$(DEPDIR)/utils_loop.Po
+       -rm -f lib/bitlk/$(DEPDIR)/libcryptsetup_la-bitlk.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-argon2_generic.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_check.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_generic.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crc32.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nss.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_storage.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-argon2.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-core.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-encoding.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-opt.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-ref.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-thread.Plo
+       -rm -f lib/crypto_backend/argon2/blake2/$(DEPDIR)/libargon2_la-blake2b.Plo
+       -rm -f lib/integrity/$(DEPDIR)/libcryptsetup_la-integrity.Plo
+       -rm -f lib/loopaes/$(DEPDIR)/libcryptsetup_la-loopaes.Plo
+       -rm -f lib/luks1/$(DEPDIR)/libcryptsetup_la-af.Plo
+       -rm -f lib/luks1/$(DEPDIR)/libcryptsetup_la-keyencryption.Plo
+       -rm -f lib/luks1/$(DEPDIR)/libcryptsetup_la-keymanage.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest_pbkdf2.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_disk_metadata.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_format.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_metadata.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_luks2.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_reenc.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_luks1_convert.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_reencrypt.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_segment.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token_keyring.Plo
+       -rm -f lib/tcrypt/$(DEPDIR)/libcryptsetup_la-tcrypt.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-rs_decode_char.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-rs_encode_char.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-verity.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-verity_fec.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-verity_hash.Plo
+       -rm -f src/$(DEPDIR)/cryptsetup.Po
+       -rm -f src/$(DEPDIR)/cryptsetup_reencrypt.Po
+       -rm -f src/$(DEPDIR)/integritysetup.Po
+       -rm -f src/$(DEPDIR)/utils_blockdev.Po
+       -rm -f src/$(DEPDIR)/utils_luks2.Po
+       -rm -f src/$(DEPDIR)/utils_password.Po
+       -rm -f src/$(DEPDIR)/utils_tools.Po
+       -rm -f src/$(DEPDIR)/veritysetup.Po
        -rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-hdr \
-       distclean-libtool distclean-tags
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-hdr distclean-libtool distclean-local distclean-tags
 
 dvi: dvi-recursive
 
@@ -789,13 +2771,14 @@ info: info-recursive
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS install-man \
+       install-pkgconfigDATA install-tmpfilesdDATA
 
 install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
-install-exec-am:
+install-exec-am: install-libLTLIBRARIES install-sbinPROGRAMS
 
 install-html: install-html-recursive
 
@@ -805,7 +2788,7 @@ install-info: install-info-recursive
 
 install-info-am:
 
-install-man:
+install-man: install-man8
 
 install-pdf: install-pdf-recursive
 
@@ -820,12 +2803,91 @@ installcheck-am:
 maintainer-clean: maintainer-clean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
        -rm -rf $(top_srcdir)/autom4te.cache
+               -rm -f lib/$(DEPDIR)/libcryptsetup_la-base64.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-crypt_plain.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-libdevmapper.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-random.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-setup.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_benchmark.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_blkid.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_crypt.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_device.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_device_locking.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_devpath.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_fips.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_keyring.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_loop.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_pbkdf.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_safe_memory.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_storage_wrappers.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-utils_wipe.Plo
+       -rm -f lib/$(DEPDIR)/libcryptsetup_la-volumekey.Plo
+       -rm -f lib/$(DEPDIR)/libutils_io_la-utils_io.Plo
+       -rm -f lib/$(DEPDIR)/utils_blkid.Po
+       -rm -f lib/$(DEPDIR)/utils_crypt.Po
+       -rm -f lib/$(DEPDIR)/utils_io.Po
+       -rm -f lib/$(DEPDIR)/utils_loop.Po
+       -rm -f lib/bitlk/$(DEPDIR)/libcryptsetup_la-bitlk.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-argon2_generic.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_check.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-cipher_generic.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crc32.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_nss.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-crypto_storage.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Plo
+       -rm -f lib/crypto_backend/$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-argon2.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-core.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-encoding.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-opt.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-ref.Plo
+       -rm -f lib/crypto_backend/argon2/$(DEPDIR)/libargon2_la-thread.Plo
+       -rm -f lib/crypto_backend/argon2/blake2/$(DEPDIR)/libargon2_la-blake2b.Plo
+       -rm -f lib/integrity/$(DEPDIR)/libcryptsetup_la-integrity.Plo
+       -rm -f lib/loopaes/$(DEPDIR)/libcryptsetup_la-loopaes.Plo
+       -rm -f lib/luks1/$(DEPDIR)/libcryptsetup_la-af.Plo
+       -rm -f lib/luks1/$(DEPDIR)/libcryptsetup_la-keyencryption.Plo
+       -rm -f lib/luks1/$(DEPDIR)/libcryptsetup_la-keymanage.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_digest_pbkdf2.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_disk_metadata.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_format.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_json_metadata.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_luks2.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_keyslot_reenc.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_luks1_convert.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_reencrypt.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_segment.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token.Plo
+       -rm -f lib/luks2/$(DEPDIR)/libcryptsetup_la-luks2_token_keyring.Plo
+       -rm -f lib/tcrypt/$(DEPDIR)/libcryptsetup_la-tcrypt.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-rs_decode_char.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-rs_encode_char.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-verity.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-verity_fec.Plo
+       -rm -f lib/verity/$(DEPDIR)/libcryptsetup_la-verity_hash.Plo
+       -rm -f src/$(DEPDIR)/cryptsetup.Po
+       -rm -f src/$(DEPDIR)/cryptsetup_reencrypt.Po
+       -rm -f src/$(DEPDIR)/integritysetup.Po
+       -rm -f src/$(DEPDIR)/utils_blockdev.Po
+       -rm -f src/$(DEPDIR)/utils_luks2.Po
+       -rm -f src/$(DEPDIR)/utils_password.Po
+       -rm -f src/$(DEPDIR)/utils_tools.Po
+       -rm -f src/$(DEPDIR)/veritysetup.Po
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-recursive
 
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
 
 pdf: pdf-recursive
 
@@ -835,30 +2897,47 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
+       uninstall-man uninstall-pkgconfigDATA uninstall-sbinPROGRAMS \
+       uninstall-tmpfilesdDATA
+
+uninstall-man: uninstall-man8
 
 .MAKE: $(am__recursive_targets) all install-am install-strip
 
 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
-       am--refresh check check-am clean clean-cscope clean-generic \
-       clean-libtool clean-local cscope cscopelist-am ctags ctags-am \
-       dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \
-       dist-tarZ dist-xz dist-zip distcheck distclean \
+       am--depfiles am--refresh check check-am clean clean-cscope \
+       clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+       clean-noinstLTLIBRARIES clean-sbinPROGRAMS cscope \
+       cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+       dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
+       dist-zstd distcheck distclean distclean-compile \
        distclean-generic distclean-hdr distclean-libtool \
-       distclean-tags distcleancheck distdir distuninstallcheck dvi \
-       dvi-am html html-am info info-am install install-am \
-       install-data install-data-am install-dvi install-dvi-am \
-       install-exec install-exec-am install-html install-html-am \
-       install-info install-info-am install-man install-pdf \
-       install-pdf-am install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs installdirs-am \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am
+       distclean-local distclean-tags distcleancheck distdir \
+       distuninstallcheck dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-includeHEADERS install-info \
+       install-info-am install-libLTLIBRARIES install-man \
+       install-man8 install-pdf install-pdf-am install-pkgconfigDATA \
+       install-ps install-ps-am install-sbinPROGRAMS install-strip \
+       install-tmpfilesdDATA installcheck installcheck-am installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+       uninstall-am uninstall-includeHEADERS uninstall-libLTLIBRARIES \
+       uninstall-man uninstall-man8 uninstall-pkgconfigDATA \
+       uninstall-sbinPROGRAMS uninstall-tmpfilesdDATA
+
+.PRECIOUS: Makefile
+
 
+distclean-local:
+       -find . -name \*~ -o -name \*.orig -o -name \*.rej | xargs rm -f
+       rm -rf autom4te.cache
 
 clean-local:
-       -rm -rf docs/doxygen_api_docs
+       -rm -rf docs/doxygen_api_docs libargon2.la
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/TODO b/TODO
index b5a66e1..58e5cc9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,8 +1 @@
-Version 1.7:
-- Export wipe device functions
-- Support K/M suffixes for align payload (new switch?).
-- TRIM for keyslots
-- Do we need crypt_data_path() - path to data device (if differs)?
-- Resync ETA time is not accurate, calculate it better (last minute window?).
-- Extend existing LUKS header to use another KDF? (https://password-hashing.net/)
-- Fix all crazy automake warnings (or switch to Cmake).
+Please see issues tracked at https://gitlab.com/cryptsetup/cryptsetup/issues.
index 5185896..b5fedd0 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,16 +20,18 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-dnl Autoconf macros for libgcrypt
-dnl       Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc.
-dnl
-dnl This file is free software; as a special exception the author gives
-dnl unlimited permission to copy and/or distribute it, with or without
-dnl modifications, as long as this notice is preserved.
-dnl
-dnl This file is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
-dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# libgcrypt.m4 - Autoconf macros to detect libgcrypt
+# Copyright (C) 2002, 2003, 2004, 2011, 2014, 2018 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Last-changed: 2018-11-13
 
 
 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
@@ -42,19 +44,49 @@ dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1.  Using
 dnl this features allows to prevent build against newer versions of libgcrypt
 dnl with a changed API.
 dnl
+dnl If a prefix option is not used, the config script is first
+dnl searched in $SYSROOT/bin and then along $PATH.  If the used
+dnl config script does not match the host specification the script
+dnl is added to the gpg_config_script_warn variable.
+dnl
 AC_DEFUN([AM_PATH_LIBGCRYPT],
 [ AC_REQUIRE([AC_CANONICAL_HOST])
   AC_ARG_WITH(libgcrypt-prefix,
             AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
                            [prefix where LIBGCRYPT is installed (optional)]),
      libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
-  if test x$libgcrypt_config_prefix != x ; then
-     if test x${LIBGCRYPT_CONFIG+set} != xset ; then
-        LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
+  if test x"${LIBGCRYPT_CONFIG}" = x ; then
+     if test x"${libgcrypt_config_prefix}" != x ; then
+        LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config"
      fi
   fi
 
-  AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
+  use_gpgrt_config=""
+  if test x"${LIBGCRYPT_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+    if $GPGRT_CONFIG libgcrypt --exists; then
+      LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt"
+      AC_MSG_NOTICE([Use gpgrt-config as libgcrypt-config])
+      use_gpgrt_config=yes
+    fi
+  fi
+  if test -z "$use_gpgrt_config"; then
+    if test x"${LIBGCRYPT_CONFIG}" = x ; then
+      case "${SYSROOT}" in
+         /*)
+           if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
+             LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
+           fi
+           ;;
+         '')
+           ;;
+          *)
+           AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
+           ;;
+      esac
+    fi
+    AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
+  fi
+
   tmp=ifelse([$1], ,1:1.2.0,$1)
   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
      req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
@@ -73,7 +105,11 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
     req_micro=`echo $min_libgcrypt_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
-    libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
+    if test -z "$use_gpgrt_config"; then
+      libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
+    else
+      libgcrypt_config_version=`$LIBGCRYPT_CONFIG --modversion`
+    fi
     major=`echo $libgcrypt_config_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
     minor=`echo $libgcrypt_config_version | \
@@ -105,7 +141,11 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
      # If we have a recent libgcrypt, we should also check that the
      # API is compatible
      if test "$req_libgcrypt_api" -gt 0 ; then
-        tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+        if test -z "$use_gpgrt_config"; then
+           tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+       else
+           tmp=`$LIBGCRYPT_CONFIG --variable=api_version 2>/dev/null || echo 0`
+       fi
         if test "$tmp" -gt 0 ; then
            AC_MSG_CHECKING([LIBGCRYPT API version])
            if test "$req_libgcrypt_api" -eq "$tmp" ; then
@@ -121,17 +161,22 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
     LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
     LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
     ifelse([$2], , :, [$2])
-    libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
+    if test -z "$use_gpgrt_config"; then
+      libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
+    else
+      libgcrypt_config_host=`$LIBGCRYPT_CONFIG --variable=host 2>/dev/null || echo none`
+    fi
     if test x"$libgcrypt_config_host" != xnone ; then
       if test x"$libgcrypt_config_host" != x"$host" ; then
   AC_MSG_WARN([[
 ***
-*** The config script $LIBGCRYPT_CONFIG was
+*** The config script "$LIBGCRYPT_CONFIG" was
 *** built for $libgcrypt_config_host and thus may not match the
 *** used host $host.
 *** You may want to use the configure option --with-libgcrypt-prefix
-*** to specify a matching config script.
+*** to specify a matching config script or use \$SYSROOT.
 ***]])
+        gpg_config_script_warn="$gpg_config_script_warn libgcrypt"
       fi
     fi
   else
@@ -143,32 +188,63 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
   AC_SUBST(LIBGCRYPT_LIBS)
 ])
 
-# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-# serial 1 (pkg-config-0.24)
-# 
-# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
 
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
+dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
 AC_DEFUN([PKG_PROG_PKG_CONFIG],
 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
@@ -190,18 +266,19 @@ if test -n "$PKG_CONFIG"; then
                PKG_CONFIG=""
        fi
 fi[]dnl
-])# PKG_PROG_PKG_CONFIG
+])dnl PKG_PROG_PKG_CONFIG
 
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists.  Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-# only at the first occurence in configure.ac, so if the first place
-# it's called might be skipped (such as if it is within an "if", you
-# have to call PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
 AC_DEFUN([PKG_CHECK_EXISTS],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 if test -n "$PKG_CONFIG" && \
@@ -211,8 +288,10 @@ m4_ifvaln([$3], [else
   $3])dnl
 fi])
 
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
 m4_define([_PKG_CONFIG],
 [if test -n "$$1"; then
     pkg_cv_[]$1="$$1"
@@ -224,10 +303,11 @@ m4_define([_PKG_CONFIG],
  else
     pkg_failed=untried
 fi[]dnl
-])# _PKG_CONFIG
+])dnl _PKG_CONFIG
 
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -235,26 +315,24 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 else
         _pkg_short_errors_supported=no
 fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
 
 
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 AC_DEFUN([PKG_CHECK_MODULES],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
 pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
 
 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -264,11 +342,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.])
 
 if test $pkg_failed = yes; then
-       AC_MSG_RESULT([no])
+        AC_MSG_RESULT([no])
         _PKG_SHORT_ERRORS_SUPPORTED
         if test $_pkg_short_errors_supported = yes; then
                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
-        else 
+        else
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
@@ -285,7 +363,7 @@ installed software in a non-standard prefix.
 _PKG_TEXT])[]dnl
         ])
 elif test $pkg_failed = untried; then
-       AC_MSG_RESULT([no])
+        AC_MSG_RESULT([no])
        m4_default([$4], [AC_MSG_FAILURE(
 [The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -301,16 +379,40 @@ else
         AC_MSG_RESULT([yes])
        $3
 fi[]dnl
-])# PKG_CHECK_MODULES
+])dnl PKG_CHECK_MODULES
+
 
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
 
-# PKG_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable pkgconfigdir as the location where a module
-# should install pkg-config .pc files. By default the directory is
-# $libdir/pkgconfig, but the default can be changed by passing
-# DIRECTORY. The user can override through the --with-pkgconfigdir
-# parameter.
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
 AC_DEFUN([PKG_INSTALLDIR],
 [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
 m4_pushdef([pkg_description],
@@ -321,16 +423,18 @@ AC_ARG_WITH([pkgconfigdir],
 AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
 m4_popdef([pkg_default])
 m4_popdef([pkg_description])
-]) dnl PKG_INSTALLDIR
+])dnl PKG_INSTALLDIR
 
 
-# PKG_NOARCH_INSTALLDIR(DIRECTORY)
-# -------------------------
-# Substitutes the variable noarch_pkgconfigdir as the location where a
-# module should install arch-independent pkg-config .pc files. By
-# default the directory is $datadir/pkgconfig, but the default can be
-# changed by passing DIRECTORY. The user can override through the
-# --with-noarch-pkgconfigdir parameter.
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
 AC_DEFUN([PKG_NOARCH_INSTALLDIR],
 [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
 m4_pushdef([pkg_description],
@@ -341,13 +445,15 @@ AC_ARG_WITH([noarch-pkgconfigdir],
 AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
 m4_popdef([pkg_default])
 m4_popdef([pkg_description])
-]) dnl PKG_NOARCH_INSTALLDIR
+])dnl PKG_NOARCH_INSTALLDIR
 
 
-# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# -------------------------------------------
-# Retrieves the value of the pkg-config variable for the given module.
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
 AC_DEFUN([PKG_CHECK_VAR],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
@@ -356,9 +462,9 @@ _PKG_CONFIG([$1], [variable="][$3]["], [$2])
 AS_VAR_COPY([$1], [pkg_cv_][$1])
 
 AS_VAR_IF([$1], [""], [$5], [$4])dnl
-])# PKG_CHECK_VAR
+])dnl PKG_CHECK_VAR
 
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -370,10 +476,10 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.14'
+[am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.14.1], [],
+m4_if([$1], [1.16.2], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -389,14 +495,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.14.1])dnl
+[AM_AUTOMAKE_VERSION([1.16.2])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -448,7 +554,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -479,7 +585,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -670,13 +776,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@@ -684,49 +789,43 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  AS_CASE([$CONFIG_FILES],
+          [*\'*], [eval set x "$CONFIG_FILES"],
+          [*], [set x $CONFIG_FILES])
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`AS_DIRNAME("$mf")`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "$am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`AS_DIRNAME(["$file"])`
-      AS_MKDIR_P([$dirpart/$fdir])
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`AS_DIRNAME(["$am_mf"])`
+    am_filepart=`AS_BASENAME(["$am_mf"])`
+    AM_RUN_LOG([cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles]) || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  If GNU make was not used, consider
+    re-running the configure script with MAKE="gmake" (or whatever is
+    necessary).  You can also try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).])
+  fi
+  AS_UNSET([am_dirpart])
+  AS_UNSET([am_filepart])
+  AS_UNSET([am_mf])
+  AS_UNSET([am_rc])
+  rm -f conftest-deps.mk
 }
 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
 
@@ -735,18 +834,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # -----------------------------
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each '.P' file that we will
-# need in order to bootstrap the dependency handling code.
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
+     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -833,11 +931,11 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
 # For better backward compatibility.  To be removed once Automake 1.9.x
 # dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
@@ -901,7 +999,7 @@ END
 Aborting the configuration process, to ensure you take notice of the issue.
 
 You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
 
 If you want to complete the configuration process using your problematic
 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -911,6 +1009,9 @@ END
     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
   fi
 fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
 ])
 
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
@@ -940,7 +1041,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -951,7 +1052,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
 # Define $install_sh.
 AC_DEFUN([AM_PROG_INSTALL_SH],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
   case $am_aux_dir in
   *\ * | *\    *)
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -961,7 +1062,7 @@ if test x"${install_sh}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -982,7 +1083,7 @@ AC_SUBST([am__leading_dot])])
 
 # Check to see how 'make' treats includes.                 -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -990,49 +1091,42 @@ AC_SUBST([am__leading_dot])])
 
 # AM_MAKE_INCLUDE()
 # -----------------
-# Check to see how make treats includes.
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
 AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
 am__doit:
-       @echo this is the am__doit target
+       @echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+      ['0:this is the am__doit target'],
+      [AS_CASE([$s],
+          [BSD], [am__include='.include' am__quote='"'],
+          [am__include='include' am__quote=''])])
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1069,41 +1163,9 @@ else
 fi
 ])
 
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for 'mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl FIXME we are no longer going to remove this! adjust warning
-dnl FIXME message accordingly.
-AC_DIAGNOSE([obsolete],
-[$0: this macro is deprecated, and will soon be removed.
-You should use the Autoconf-provided 'AC][_PROG_MKDIR_P' macro instead,
-and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.])
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1132,7 +1194,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1179,242 +1241,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-
-# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# ---------------------------------------------------------------------------
-# Adds support for distributing Python modules and packages.  To
-# install modules, copy them to $(pythondir), using the python_PYTHON
-# automake variable.  To install a package with the same name as the
-# automake package, install to $(pkgpythondir), or use the
-# pkgpython_PYTHON automake variable.
-#
-# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
-# locations to install python extension modules (shared libraries).
-# Another macro is required to find the appropriate flags to compile
-# extension modules.
-#
-# If your package is configured with a different prefix to python,
-# users will have to add the install directory to the PYTHONPATH
-# environment variable, or create a .pth file (see the python
-# documentation for details).
-#
-# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
-# cause an error if the version of python installed on the system
-# doesn't meet the requirement.  MINIMUM-VERSION should consist of
-# numbers and dots only.
-AC_DEFUN([AM_PATH_PYTHON],
- [
-  dnl Find a Python interpreter.  Python versions prior to 2.0 are not
-  dnl supported. (2.0 was released on October 16, 2000).
-  m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
- python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
-
-  AC_ARG_VAR([PYTHON], [the Python interpreter])
-
-  m4_if([$1],[],[
-    dnl No version check is needed.
-    # Find any Python interpreter.
-    if test -z "$PYTHON"; then
-      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
-    fi
-    am_display_PYTHON=python
-  ], [
-    dnl A version check is needed.
-    if test -n "$PYTHON"; then
-      # If the user set $PYTHON, use it and don't search something else.
-      AC_MSG_CHECKING([whether $PYTHON version is >= $1])
-      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
-                             [AC_MSG_RESULT([yes])],
-                             [AC_MSG_RESULT([no])
-                              AC_MSG_ERROR([Python interpreter is too old])])
-      am_display_PYTHON=$PYTHON
-    else
-      # Otherwise, try each interpreter until we find one that satisfies
-      # VERSION.
-      AC_CACHE_CHECK([for a Python interpreter with version >= $1],
-       [am_cv_pathless_PYTHON],[
-       for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
-         test "$am_cv_pathless_PYTHON" = none && break
-         AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
-       done])
-      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
-      if test "$am_cv_pathless_PYTHON" = none; then
-       PYTHON=:
-      else
-        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
-      fi
-      am_display_PYTHON=$am_cv_pathless_PYTHON
-    fi
-  ])
-
-  if test "$PYTHON" = :; then
-  dnl Run any user-specified action, or abort.
-    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
-  else
-
-  dnl Query Python for its version number.  Getting [:3] seems to be
-  dnl the best way to do this; it's what "site.py" does in the standard
-  dnl library.
-
-  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
-    [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
-  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
-
-  dnl Use the values of $prefix and $exec_prefix for the corresponding
-  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
-  dnl distinct variables so they can be overridden if need be.  However,
-  dnl general consensus is that you shouldn't need this ability.
-
-  AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
-  AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
-
-  dnl At times (like when building shared libraries) you may want
-  dnl to know which OS platform Python thinks this is.
-
-  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
-    [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
-  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
-
-  # Just factor out some code duplication.
-  am_python_setup_sysconfig="\
-import sys
-# Prefer sysconfig over distutils.sysconfig, for better compatibility
-# with python 3.x.  See automake bug#10227.
-try:
-    import sysconfig
-except ImportError:
-    can_use_sysconfig = 0
-else:
-    can_use_sysconfig = 1
-# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
-# <https://github.com/pypa/virtualenv/issues/118>
-try:
-    from platform import python_implementation
-    if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
-        can_use_sysconfig = 0
-except ImportError:
-    pass"
-
-  dnl Set up 4 directories:
-
-  dnl pythondir -- where to install python scripts.  This is the
-  dnl   site-packages directory, not the python standard library
-  dnl   directory like in previous automake betas.  This behavior
-  dnl   is more consistent with lispdir.m4 for example.
-  dnl Query distutils for this directory.
-  AC_CACHE_CHECK([for $am_display_PYTHON script directory],
-    [am_cv_python_pythondir],
-    [if test "x$prefix" = xNONE
-     then
-       am_py_prefix=$ac_default_prefix
-     else
-       am_py_prefix=$prefix
-     fi
-     am_cv_python_pythondir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
-    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
-else:
-    from distutils import sysconfig
-    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
-sys.stdout.write(sitedir)"`
-     case $am_cv_python_pythondir in
-     $am_py_prefix*)
-       am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
-       am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
-       ;;
-     *)
-       case $am_py_prefix in
-         /usr|/System*) ;;
-         *)
-         am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
-         ;;
-       esac
-       ;;
-     esac
-    ])
-  AC_SUBST([pythondir], [$am_cv_python_pythondir])
-
-  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
-  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
-  dnl   more consistent with the rest of automake.
-
-  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
-
-  dnl pyexecdir -- directory for installing python extension modules
-  dnl   (shared libraries)
-  dnl Query distutils for this directory.
-  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
-    [am_cv_python_pyexecdir],
-    [if test "x$exec_prefix" = xNONE
-     then
-       am_py_exec_prefix=$am_py_prefix
-     else
-       am_py_exec_prefix=$exec_prefix
-     fi
-     am_cv_python_pyexecdir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
-    sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
-else:
-    from distutils import sysconfig
-    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
-sys.stdout.write(sitedir)"`
-     case $am_cv_python_pyexecdir in
-     $am_py_exec_prefix*)
-       am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
-       am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
-       ;;
-     *)
-       case $am_py_exec_prefix in
-         /usr|/System*) ;;
-         *)
-          am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
-          ;;
-       esac
-       ;;
-     esac
-    ])
-  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
-
-  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
-
-  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
-
-  dnl Run any user-specified action.
-  $2
-  fi
-
-])
-
-
-# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-# ---------------------------------------------------------------------------
-# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
-# Run ACTION-IF-FALSE otherwise.
-# This test uses sys.hexversion instead of the string equivalent (first
-# word of sys.version), in order to cope with versions such as 2.2c1.
-# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
-AC_DEFUN([AM_PYTHON_CHECK_VERSION],
- [prog="import sys
-# split strings by '.' and convert to numeric.  Append some zeros
-# because we need at least 4 digits for the hex conversion.
-# map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
-minverhex = 0
-# xrange is not present in Python 3.0 and range returns an iterator
-for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
-sys.exit(sys.hexversion < minverhex)"
-  AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1433,7 +1260,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1514,7 +1341,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1574,7 +1401,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1602,7 +1429,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2006-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1621,7 +1448,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+# Copyright (C) 2004-2020 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1754,6 +1581,7 @@ AC_SUBST([am__untar])
 
 m4_include([m4/gettext.m4])
 m4_include([m4/iconv.m4])
+m4_include([m4/intlmacosx.m4])
 m4_include([m4/lib-ld.m4])
 m4_include([m4/lib-link.m4])
 m4_include([m4/lib-prefix.m4])
diff --git a/compile b/compile
index 531136b..23fcba0 100755 (executable)
--- a/compile
+++ b/compile
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2012-10-14.11; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -53,7 +53,7 @@ func_file_conv ()
          MINGW*)
            file_conv=mingw
            ;;
-         CYGWIN*)
+         CYGWIN* | MSYS*)
            file_conv=cygwin
            ;;
          *)
@@ -67,7 +67,7 @@ func_file_conv ()
        mingw/*)
          file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
          ;;
-       cygwin/*)
+       cygwin/* | msys/*)
          file=`cygpath -m "$file" || echo "$file"`
          ;;
        wine/*)
@@ -255,7 +255,8 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
-  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
+  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
     func_cl_wrapper "$@"      # Doesn't return...
     ;;
 esac
@@ -339,9 +340,9 @@ exit $ret
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
index 408e256..0e70551 100644 (file)
 /* cipher mode for LUKS1 */
 #undef DEFAULT_LUKS1_MODE
 
+/* Argon2 PBKDF iteration time for LUKS2 (in ms) */
+#undef DEFAULT_LUKS2_ITER_TIME
+
+/* fallback cipher for LUKS2 keyslot (if data encryption is incompatible) */
+#undef DEFAULT_LUKS2_KEYSLOT_CIPHER
+
+/* fallback key size for LUKS2 keyslot (if data encryption is incompatible) */
+#undef DEFAULT_LUKS2_KEYSLOT_KEYBITS
+
+/* default luks2 locking directory permissions */
+#undef DEFAULT_LUKS2_LOCK_DIR_PERMS
+
+/* path to directory for LUKSv2 locks */
+#undef DEFAULT_LUKS2_LOCK_PATH
+
+/* Argon2 PBKDF memory cost for LUKS2 (in kB) */
+#undef DEFAULT_LUKS2_MEMORY_KB
+
+/* Argon2 PBKDF max parallel cost for LUKS2 (if CPUs available) */
+#undef DEFAULT_LUKS2_PARALLEL_THREADS
+
+/* Default PBKDF algorithm (pbkdf2 or argon2i/argon2id) for LUKS2 */
+#undef DEFAULT_LUKS2_PBKDF
+
+/* default LUKS format version */
+#undef DEFAULT_LUKS_FORMAT
+
 /* maximum keyfile size (in characters) */
 #undef DEFAULT_PASSPHRASE_SIZE_MAX
 
 /* default RNG type for key generator */
 #undef DEFAULT_RNG
 
+/* override default path to directory with systemd temporary files */
+#undef DEFAULT_TMPFILESDIR
+
 /* data block size for verity mode */
 #undef DEFAULT_VERITY_DATA_BLOCK
 
+/* parity bytes for verity FEC */
+#undef DEFAULT_VERITY_FEC_ROOTS
+
 /* hash function for verity mode */
 #undef DEFAULT_VERITY_HASH
 
 /* Enable FIPS mode restrictions */
 #undef ENABLE_FIPS
 
+/* XTS mode - double default LUKS keysize if needed */
+#undef ENABLE_LUKS_ADJUST_XTS_KEYSIZE
+
 /* Define to 1 if translation of program messages to the user's native
    language is requested. */
 #undef ENABLE_NLS
 
-/* Enable password quality checking */
+/* Enable password quality checking using passwdqc library */
+#undef ENABLE_PASSWDQC
+
+/* Enable password quality checking using pwquality library */
 #undef ENABLE_PWQUALITY
 
 /* Requested gcrypt version */
 #undef GCRYPT_REQ_VERSION
 
+/* Define to 1 if you have the <argon2.h> header file. */
+#undef HAVE_ARGON2_H
+
+/* Define to 1 to use blkid for detection of disk signatures. */
+#undef HAVE_BLKID
+
+/* Define to 1 if you have the <blkid/blkid.h> header file. */
+#undef HAVE_BLKID_BLKID_H
+
+/* Define to 1 to use blkid_probe_step_back. */
+#undef HAVE_BLKID_STEP_BACK
+
+/* Define to 1 to use blkid_do_wipe. */
+#undef HAVE_BLKID_WIPE
+
 /* Define to 1 if you have the <byteswap.h> header file. */
 #undef HAVE_BYTESWAP_H
 
-/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
    CoreFoundation framework. */
 #undef HAVE_CFLOCALECOPYCURRENT
 
-/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
    the CoreFoundation framework. */
 #undef HAVE_CFPREFERENCESCOPYAPPVALUE
 
    */
 #undef HAVE_DCGETTEXT
 
+/* Define to 1 if you have the declaration of `blkid_do_probe', and to 0 if
+   you don't. */
+#undef HAVE_DECL_BLKID_DO_PROBE
+
+/* Define to 1 if you have the declaration of `blkid_do_safeprobe', and to 0
+   if you don't. */
+#undef HAVE_DECL_BLKID_DO_SAFEPROBE
+
+/* Define to 1 if you have the declaration of
+   `blkid_probe_filter_superblocks_type', and to 0 if you don't. */
+#undef HAVE_DECL_BLKID_PROBE_FILTER_SUPERBLOCKS_TYPE
+
+/* Define to 1 if you have the declaration of `blkid_probe_lookup_value ', and
+   to 0 if you don't. */
+#undef HAVE_DECL_BLKID_PROBE_LOOKUP_VALUE__________
+
+/* Define to 1 if you have the declaration of `blkid_probe_set_device', and to
+   0 if you don't. */
+#undef HAVE_DECL_BLKID_PROBE_SET_DEVICE
+
+/* Define to 1 if you have the declaration of `blkid_reset_probe', and to 0 if
+   you don't. */
+#undef HAVE_DECL_BLKID_RESET_PROBE
+
+/* Define to 1 if you have the declaration of `dm_device_get_name', and to 0
+   if you don't. */
+#undef HAVE_DECL_DM_DEVICE_GET_NAME
+
+/* Define to 1 if you have the declaration of `DM_DEVICE_GET_TARGET_VERSION',
+   and to 0 if you don't. */
+#undef HAVE_DECL_DM_DEVICE_GET_TARGET_VERSION
+
+/* Define to 1 if you have the declaration of `dm_device_has_holders', and to
+   0 if you don't. */
+#undef HAVE_DECL_DM_DEVICE_HAS_HOLDERS
+
+/* Define to 1 if you have the declaration of `dm_device_has_mounted_fs', and
+   to 0 if you don't. */
+#undef HAVE_DECL_DM_DEVICE_HAS_MOUNTED_FS
+
+/* Define to 1 if you have the declaration of `dm_task_deferred_remove', and
+   to 0 if you don't. */
+#undef HAVE_DECL_DM_TASK_DEFERRED_REMOVE
+
 /* Define to 1 if you have the declaration of `dm_task_retry_remove', and to 0
    if you don't. */
 #undef HAVE_DECL_DM_TASK_RETRY_REMOVE
    `DM_UDEV_DISABLE_DISK_RULES_FLAG', and to 0 if you don't. */
 #undef HAVE_DECL_DM_UDEV_DISABLE_DISK_RULES_FLAG
 
+/* Define to 1 if you have the declaration of `GCRY_CIPHER_MODE_XTS', and to 0
+   if you don't. */
+#undef HAVE_DECL_GCRY_CIPHER_MODE_XTS
+
+/* Define to 1 if you have the declaration of `json_object_deep_copy', and to
+   0 if you don't. */
+#undef HAVE_DECL_JSON_OBJECT_DEEP_COPY
+
+/* Define to 1 if you have the declaration of `json_object_object_add_ex', and
+   to 0 if you don't. */
+#undef HAVE_DECL_JSON_OBJECT_OBJECT_ADD_EX
+
 /* Define to 1 if you have the declaration of `NSS_GetVersion', and to 0 if
    you don't. */
 #undef HAVE_DECL_NSS_GETVERSION
 
+/* Define to 1 if you have the declaration of `O_CLOEXEC', and to 0 if you
+   don't. */
+#undef HAVE_DECL_O_CLOEXEC
+
 /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
    don't. */
 #undef HAVE_DECL_STRERROR_R
 /* Define to 1 if you have the <endian.h> header file. */
 #undef HAVE_ENDIAN_H
 
+/* Define to 1 if you have the `explicit_bzero' function. */
+#undef HAVE_EXPLICIT_BZERO
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
 /* Define if the GNU gettext() function is already present or preinstalled. */
 #undef HAVE_GETTEXT
 
-/* Define if you have the iconv() function. */
+/* Define if you have the iconv() function and it works. */
 #undef HAVE_ICONV
 
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if the system has the type `key_serial_t'. */
+#undef HAVE_KEY_SERIAL_T
+
 /* Define to 1 if you have the `devmapper' library (-ldevmapper). */
 #undef HAVE_LIBDEVMAPPER
 
 /* Define to 1 if you have the <linux/if_alg.h> header file. */
 #undef HAVE_LINUX_IF_ALG_H
 
+/* Define to 1 if you have the <linux/keyctl.h> header file. */
+#undef HAVE_LINUX_KEYCTL_H
+
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
 /* Define to 1 if you have the <nettle/sha.h> header file. */
 #undef HAVE_NETTLE_SHA_H
 
+/* Define to 1 if you have the <nettle/version.h> header file. */
+#undef HAVE_NETTLE_VERSION_H
+
+/* Define to 1 if you have the `posix_fallocate' function. */
+#undef HAVE_POSIX_FALLOCATE
+
 /* Define to 1 if you have the `posix_memalign' function. */
 #undef HAVE_POSIX_MEMALIGN
 
    */
 #undef HAVE_SYS_NDIR_H
 
+/* Define to 1 if you have the <sys/statvfs.h> header file. */
+#undef HAVE_SYS_STATVFS_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/sysmacros.h> header file. */
+#undef HAVE_SYS_SYSMACROS_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
 /* Define to 1 if you have the <uuid/uuid.h> header file. */
 #undef HAVE_UUID_UUID_H
 
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
+/* Define as const if the declaration of iconv() needs const. */
+#undef ICONV_CONST
+
+/* Enable kernel keyring service support */
+#undef KERNEL_KEYRING
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
 #undef LT_OBJDIR
 
+/* Defined to 0 if not provided */
+#undef O_CLOEXEC
+
 /* Name of package */
 #undef PACKAGE
 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* passwdqc library config file */
+#undef PASSWDQC_CONFIG_FILE
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
 /* Define to 1 if strerror_r returns char *. */
 #undef STRERROR_R_CHAR_P
 
+/* Use internal Argon2 */
+#undef USE_INTERNAL_ARGON2
+
 /* Use internal PBKDF2 */
 #undef USE_INTERNAL_PBKDF2
 
 
 /* Define to `long int' if <sys/types.h> does not define. */
 #undef off_t
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
index c492a93..c38b914 100755 (executable)
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2006 Free Software Foundation, Inc.
+#   Copyright 1996-2013 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
@@ -25,7 +25,7 @@
 #   known workaround is to choose shorter directory names for the build
 #   directory and/or the installation directory.
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a '.a' archive for static linking (except MSVC,
 # which needs '.lib').
 libext=a
 shrext=.so
@@ -47,7 +47,7 @@ for cc_temp in $CC""; do
 done
 cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
 
-# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+# Code taken from libtool.m4's _LT_COMPILER_PIC.
 
 wl=
 if test "$GCC" = yes; then
@@ -57,14 +57,7 @@ else
     aix*)
       wl='-Wl,'
       ;;
-    darwin*)
-      case $cc_basename in
-        xlc*)
-          wl='-Wl,'
-          ;;
-      esac
-      ;;
-    mingw* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       ;;
     hpux9* | hpux10* | hpux11*)
       wl='-Wl,'
@@ -72,24 +65,37 @@ else
     irix5* | irix6* | nonstopux*)
       wl='-Wl,'
       ;;
-    newsos6)
-      ;;
-    linux*)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
-        icc* | ecc*)
+        ecc*)
           wl='-Wl,'
           ;;
-        pgcc | pgf77 | pgf90)
+        icc* | ifort*)
+          wl='-Wl,'
+          ;;
+        lf95*)
+          wl='-Wl,'
+          ;;
+        nagfor*)
+          wl='-Wl,-Wl,,'
+          ;;
+        pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
           wl='-Wl,'
           ;;
         ccc*)
           wl='-Wl,'
           ;;
+        xl* | bgxl* | bgf* | mpixl*)
+          wl='-Wl,'
+          ;;
         como)
           wl='-lopt='
           ;;
         *)
           case `$CC -V 2>&1 | sed 5q` in
+            *Sun\ F* | *Sun*Fortran*)
+              wl=
+              ;;
             *Sun\ C*)
               wl='-Wl,'
               ;;
@@ -97,22 +103,36 @@ else
           ;;
       esac
       ;;
+    newsos6)
+      ;;
+    *nto* | *qnx*)
+      ;;
     osf3* | osf4* | osf5*)
       wl='-Wl,'
       ;;
-    sco3.2v5*)
+    rdos*)
       ;;
     solaris*)
-      wl='-Wl,'
+      case $cc_basename in
+        f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+          wl='-Qoption ld '
+          ;;
+        *)
+          wl='-Wl,'
+          ;;
+      esac
       ;;
     sunos4*)
       wl='-Qoption ld '
       ;;
-    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+    sysv4 | sysv4.2uw2* | sysv4.3*)
       wl='-Wl,'
       ;;
     sysv4*MP*)
       ;;
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      wl='-Wl,'
+      ;;
     unicos*)
       wl='-Wl,'
       ;;
@@ -121,7 +141,7 @@ else
   esac
 fi
 
-# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
 
 hardcode_libdir_flag_spec=
 hardcode_libdir_separator=
@@ -129,7 +149,7 @@ hardcode_direct=no
 hardcode_minus_L=no
 
 case "$host_os" in
-  cygwin* | mingw* | pw32*)
+  cygwin* | mingw* | pw32* | cegcc*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -155,22 +175,21 @@ if test "$with_gnu_ld" = yes; then
   # option of GNU ld is called -rpath, not --rpath.
   hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
   case "$host_os" in
-    aix3* | aix4* | aix5*)
+    aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
         ld_shlibs=no
       fi
       ;;
     amigaos*)
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
-      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
-      # that the semantics of dynamic libraries on AmigaOS, at least up
-      # to version 4, is to share data among multiple programs linked
-      # with the same dynamic library.  Since this doesn't match the
-      # behavior of shared libraries on other platforms, we cannot use
-      # them.
-      ld_shlibs=no
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
       ;;
     beos*)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
@@ -179,7 +198,7 @@ if test "$with_gnu_ld" = yes; then
         ld_shlibs=no
       fi
       ;;
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
@@ -189,11 +208,13 @@ if test "$with_gnu_ld" = yes; then
         ld_shlibs=no
       fi
       ;;
-    interix3*)
+    haiku*)
+      ;;
+    interix[3-9]*)
       hardcode_direct=no
       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
       ;;
-    linux*)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
         :
       else
@@ -251,7 +272,7 @@ else
         hardcode_direct=unsupported
       fi
       ;;
-    aix4* | aix5*)
+    aix[4-9]*)
       if test "$host_cpu" = ia64; then
         # On IA64, the linker does run time linking by default, so we don't
         # have to do anything special.
@@ -261,7 +282,7 @@ else
         # Test if we are trying to use run time linking or normal
         # AIX style linking. If -brtl is somewhere in LDFLAGS, we
         # need to do runtime linking.
-        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+        case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
           for ld_flag in $LDFLAGS; do
             if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
               aix_use_runtimelinking=yes
@@ -280,7 +301,7 @@ else
             strings "$collect2name" | grep resolve_lib_name >/dev/null
           then
             # We have reworked collect2
-            hardcode_direct=yes
+            :
           else
             # We have old collect2
             hardcode_direct=unsupported
@@ -316,14 +337,18 @@ else
       fi
       ;;
     amigaos*)
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
-      # see comment about different semantics on the GNU ld section
-      ld_shlibs=no
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
       ;;
     bsdi[45]*)
       ;;
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -333,24 +358,15 @@ else
       ;;
     darwin* | rhapsody*)
       hardcode_direct=no
-      if test "$GCC" = yes ; then
+      if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
         :
       else
-        case $cc_basename in
-          xlc*)
-            ;;
-          *)
-            ld_shlibs=no
-            ;;
-        esac
+        ld_shlibs=no
       fi
       ;;
     dgux*)
       hardcode_libdir_flag_spec='-L$libdir'
       ;;
-    freebsd1*)
-      ld_shlibs=no
-      ;;
     freebsd2.2*)
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
@@ -359,7 +375,7 @@ else
       hardcode_direct=yes
       hardcode_minus_L=yes
       ;;
-    freebsd* | kfreebsd*-gnu | dragonfly*)
+    freebsd* | dragonfly*)
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       ;;
@@ -411,19 +427,25 @@ else
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       hardcode_libdir_separator=:
       ;;
+    *nto* | *qnx*)
+      ;;
     openbsd*)
-      hardcode_direct=yes
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      if test -f /usr/libexec/ld.so; then
+        hardcode_direct=yes
+        if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        else
+          case "$host_os" in
+            openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+              hardcode_libdir_flag_spec='-R$libdir'
+              ;;
+            *)
+              hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+              ;;
+          esac
+        fi
       else
-        case "$host_os" in
-          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-            hardcode_libdir_flag_spec='-R$libdir'
-            ;;
-          *)
-            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-            ;;
-        esac
+        ld_shlibs=no
       fi
       ;;
     os2*)
@@ -471,7 +493,7 @@ else
         ld_shlibs=yes
       fi
       ;;
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
       ;;
     sysv5* | sco3.2v5* | sco5v6*)
       hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
@@ -487,34 +509,58 @@ else
 fi
 
 # Check dynamic linker characteristics
-# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec=      # the last element of library_names_spec in libtool.m4
 libname_spec='lib$name'
 case "$host_os" in
   aix3*)
+    library_names_spec='$libname.a'
     ;;
-  aix4* | aix5*)
+  aix[4-9]*)
+    library_names_spec='$libname$shrext'
     ;;
   amigaos*)
+    case "$host_cpu" in
+      powerpc*)
+        library_names_spec='$libname$shrext' ;;
+      m68k)
+        library_names_spec='$libname.a' ;;
+    esac
     ;;
   beos*)
+    library_names_spec='$libname$shrext'
     ;;
   bsdi[45]*)
+    library_names_spec='$libname$shrext'
     ;;
-  cygwin* | mingw* | pw32*)
+  cygwin* | mingw* | pw32* | cegcc*)
     shrext=.dll
+    library_names_spec='$libname.dll.a $libname.lib'
     ;;
   darwin* | rhapsody*)
     shrext=.dylib
+    library_names_spec='$libname$shrext'
     ;;
   dgux*)
-    ;;
-  freebsd1*)
-    ;;
-  kfreebsd*-gnu)
+    library_names_spec='$libname$shrext'
     ;;
   freebsd* | dragonfly*)
+    case "$host_os" in
+      freebsd[123]*)
+        library_names_spec='$libname$shrext$versuffix' ;;
+      *)
+        library_names_spec='$libname$shrext' ;;
+    esac
     ;;
   gnu*)
+    library_names_spec='$libname$shrext'
+    ;;
+  haiku*)
+    library_names_spec='$libname$shrext'
     ;;
   hpux9* | hpux10* | hpux11*)
     case $host_cpu in
@@ -528,10 +574,13 @@ case "$host_os" in
         shrext=.sl
         ;;
     esac
+    library_names_spec='$libname$shrext'
     ;;
-  interix3*)
+  interix[3-9]*)
+    library_names_spec='$libname$shrext'
     ;;
   irix5* | irix6* | nonstopux*)
+    library_names_spec='$libname$shrext'
     case "$host_os" in
       irix5* | nonstopux*)
         libsuff= shlibsuff=
@@ -548,41 +597,62 @@ case "$host_os" in
     ;;
   linux*oldld* | linux*aout* | linux*coff*)
     ;;
-  linux*)
+  linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    library_names_spec='$libname$shrext'
     ;;
   knetbsd*-gnu)
+    library_names_spec='$libname$shrext'
     ;;
   netbsd*)
+    library_names_spec='$libname$shrext'
     ;;
   newsos6)
+    library_names_spec='$libname$shrext'
     ;;
-  nto-qnx*)
+  *nto* | *qnx*)
+    library_names_spec='$libname$shrext'
     ;;
   openbsd*)
+    library_names_spec='$libname$shrext$versuffix'
     ;;
   os2*)
     libname_spec='$name'
     shrext=.dll
+    library_names_spec='$libname.a'
     ;;
   osf3* | osf4* | osf5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  rdos*)
     ;;
   solaris*)
+    library_names_spec='$libname$shrext'
     ;;
   sunos4*)
+    library_names_spec='$libname$shrext$versuffix'
     ;;
   sysv4 | sysv4.3*)
+    library_names_spec='$libname$shrext'
     ;;
   sysv4*MP*)
+    library_names_spec='$libname$shrext'
     ;;
   sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+    library_names_spec='$libname$shrext'
+    ;;
+  tpf*)
+    library_names_spec='$libname$shrext'
     ;;
   uts4*)
+    library_names_spec='$libname$shrext'
     ;;
 esac
 
 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
 shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
 
 LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
@@ -596,6 +666,12 @@ libext="$libext"
 # Shared library suffix (normally "so").
 shlibext="$shlibext"
 
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
 # Flag to hardcode \$libdir into a binary during linking.
 # This must work even if \$libdir does not exist.
 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
index bba4efb..1d8e98b 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2018 Free Software Foundation, Inc.
 
-timestamp='2014-09-11'
+timestamp='2018-02-22'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ timestamp='2014-09-11'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -25,7 +25,7 @@ timestamp='2014-09-11'
 # of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -33,7 +33,7 @@ timestamp='2014-09-11'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -53,12 +53,11 @@ timestamp='2014-09-11'
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
-Operation modes:
+Options:
   -h, --help         print this help, then exit
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2018 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -95,7 +94,7 @@ while test $# -gt 0 ; do
 
     *local*)
        # First pass through any local machine types.
-       echo $1
+       echo "$1"
        exit ;;
 
     * )
@@ -113,24 +112,24 @@ esac
 
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
   android-linux)
     os=-linux-android
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
     ;;
   *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
+    basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
+    if [ "$basic_machine" != "$1" ]
+    then os=`echo "$1" | sed 's/.*-/-/'`
     else os=; fi
     ;;
 esac
@@ -179,44 +178,44 @@ case $os in
                ;;
        -sco6)
                os=-sco5v6
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco5)
                os=-sco3.2v5
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco4)
                os=-sco3.2v4
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco3.2.[4-9]*)
                os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco3.2v[4-9]*)
                # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco5v6*)
                # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco*)
                os=-sco3.2v2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -udk*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -isc)
                os=-isc2.2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -clix*)
                basic_machine=clipper-intergraph
                ;;
        -isc*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
                ;;
        -lynx*178)
                os=-lynxos178
@@ -228,10 +227,7 @@ case $os in
                os=-lynxos
                ;;
        -ptx*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-               ;;
-       -windowsnt*)
-               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
                ;;
        -psos*)
                os=-psos
@@ -255,15 +251,16 @@ case $basic_machine in
        | arc | arceb \
        | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
        | avr | avr32 \
+       | ba \
        | be32 | be64 \
        | bfin \
        | c4x | c8051 | clipper \
        | d10v | d30v | dlx | dsp16xx \
-       | epiphany \
-       | fido | fr30 | frv \
+       | e2k | epiphany \
+       | fido | fr30 | frv | ft32 \
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | hexagon \
-       | i370 | i860 | i960 | ia64 \
+       | i370 | i860 | i960 | ia16 | ia64 \
        | ip2k | iq2000 \
        | k1om \
        | le32 | le64 \
@@ -299,13 +296,14 @@ case $basic_machine in
        | nios | nios2 | nios2eb | nios2el \
        | ns16k | ns32k \
        | open8 | or1k | or1knd | or32 \
-       | pdp10 | pdp11 | pj | pjl \
+       | pdp10 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle \
+       | pru \
        | pyramid \
        | riscv32 | riscv64 \
        | rl78 | rx \
        | score \
-       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -313,7 +311,8 @@ case $basic_machine in
        | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
        | ubicom32 \
        | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
-       | we32k \
+       | visium \
+       | wasm32 \
        | x86 | xc16x | xstormy16 | xtensa \
        | z8k | z80)
                basic_machine=$basic_machine-unknown
@@ -327,11 +326,14 @@ case $basic_machine in
        c6x)
                basic_machine=tic6x-unknown
                ;;
+       leon|leon[3-9])
+               basic_machine=sparc-$basic_machine
+               ;;
        m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
                basic_machine=$basic_machine-unknown
                os=-none
                ;;
-       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
                ;;
        ms1)
                basic_machine=mt-unknown
@@ -360,7 +362,7 @@ case $basic_machine in
          ;;
        # Object if more than one company name word.
        *-*-*)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
                exit 1
                ;;
        # Recognize the basic CPU types with company name.
@@ -372,17 +374,18 @@ case $basic_machine in
        | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
        | avr-* | avr32-* \
+       | ba-* \
        | be32-* | be64-* \
        | bfin-* | bs2000-* \
        | c[123]* | c30-* | [cjt]90-* | c4x-* \
        | c8051-* | clipper-* | craynv-* | cydra-* \
        | d10v-* | d30v-* | dlx-* \
-       | elxsi-* \
+       | e2k-* | elxsi-* \
        | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
        | h8300-* | h8500-* \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | hexagon-* \
-       | i*86-* | i860-* | i960-* | ia64-* \
+       | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
        | ip2k-* | iq2000-* \
        | k1om-* \
        | le32-* | le64-* \
@@ -423,13 +426,15 @@ case $basic_machine in
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+       | pru-* \
        | pyramid-* \
+       | riscv32-* | riscv64-* \
        | rl78-* | romp-* | rs6000-* | rx-* \
        | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
        | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
        | sparclite-* \
-       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
        | tahoe-* \
        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
        | tile*-* \
@@ -437,6 +442,8 @@ case $basic_machine in
        | ubicom32-* \
        | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
        | vax-* \
+       | visium-* \
+       | wasm32-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* \
        | xstormy16-* | xtensa*-* \
@@ -450,7 +457,7 @@ case $basic_machine in
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
        386bsd)
-               basic_machine=i386-unknown
+               basic_machine=i386-pc
                os=-bsd
                ;;
        3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
@@ -484,7 +491,7 @@ case $basic_machine in
                basic_machine=x86_64-pc
                ;;
        amd64-*)
-               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        amdahl)
                basic_machine=580-amdahl
@@ -513,6 +520,9 @@ case $basic_machine in
                basic_machine=i386-pc
                os=-aros
                ;;
+       asmjs)
+               basic_machine=asmjs-unknown
+               ;;
        aux)
                basic_machine=m68k-apple
                os=-aux
@@ -526,7 +536,7 @@ case $basic_machine in
                os=-linux
                ;;
        blackfin-*)
-               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                os=-linux
                ;;
        bluegene*)
@@ -534,13 +544,13 @@ case $basic_machine in
                os=-cnk
                ;;
        c54x-*)
-               basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        c55x-*)
-               basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        c6x-*)
-               basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        c90)
                basic_machine=c90-cray
@@ -629,10 +639,18 @@ case $basic_machine in
                basic_machine=rs6000-bull
                os=-bosx
                ;;
-       dpx2* | dpx2*-bull)
+       dpx2*)
                basic_machine=m68k-bull
                os=-sysv3
                ;;
+       e500v[12])
+               basic_machine=powerpc-unknown
+               os=$os"spe"
+               ;;
+       e500v[12]-*)
+               basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+               os=$os"spe"
+               ;;
        ebmon29k)
                basic_machine=a29k-amd
                os=-ebmon
@@ -722,9 +740,6 @@ case $basic_machine in
        hp9k8[0-9][0-9] | hp8[0-9][0-9])
                basic_machine=hppa1.0-hp
                ;;
-       hppa-next)
-               os=-nextstep3
-               ;;
        hppaosf)
                basic_machine=hppa1.1-hp
                os=-osf
@@ -737,26 +752,26 @@ case $basic_machine in
                basic_machine=i370-ibm
                ;;
        i*86v32)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
                os=-sysv32
                ;;
        i*86v4*)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
                os=-sysv4
                ;;
        i*86v)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
                os=-sysv
                ;;
        i*86sol2)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
                os=-solaris2
                ;;
        i386mach)
                basic_machine=i386-mach
                os=-mach
                ;;
-       i386-vsta | vsta)
+       vsta)
                basic_machine=i386-unknown
                os=-vsta
                ;;
@@ -774,17 +789,17 @@ case $basic_machine in
                basic_machine=m68k-isi
                os=-sysv
                ;;
+       leon-*|leon[3-9]-*)
+               basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
+               ;;
        m68knommu)
                basic_machine=m68k-unknown
                os=-linux
                ;;
        m68knommu-*)
-               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                os=-linux
                ;;
-       m88k-omron*)
-               basic_machine=m88k-omron
-               ;;
        magnum | m3230)
                basic_machine=mips-mips
                os=-sysv
@@ -816,10 +831,10 @@ case $basic_machine in
                os=-mint
                ;;
        mips3*-*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
                ;;
        mips3*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
                ;;
        monitor)
                basic_machine=m68k-rom68k
@@ -838,7 +853,7 @@ case $basic_machine in
                os=-msdos
                ;;
        ms1-*)
-               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
                ;;
        msys)
                basic_machine=i686-pc
@@ -880,7 +895,7 @@ case $basic_machine in
                basic_machine=v70-nec
                os=-sysv
                ;;
-       next | m*-next )
+       next | m*-next)
                basic_machine=m68k-next
                case $os in
                    -nextstep* )
@@ -925,6 +940,12 @@ case $basic_machine in
        nsr-tandem)
                basic_machine=nsr-tandem
                ;;
+       nsv-tandem)
+               basic_machine=nsv-tandem
+               ;;
+       nsx-tandem)
+               basic_machine=nsx-tandem
+               ;;
        op50n-* | op60c-*)
                basic_machine=hppa1.1-oki
                os=-proelf
@@ -957,7 +978,7 @@ case $basic_machine in
                os=-linux
                ;;
        parisc-*)
-               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                os=-linux
                ;;
        pbd)
@@ -973,7 +994,7 @@ case $basic_machine in
                basic_machine=i386-pc
                ;;
        pc98-*)
-               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        pentium | p5 | k5 | k6 | nexgen | viac3)
                basic_machine=i586-pc
@@ -988,16 +1009,16 @@ case $basic_machine in
                basic_machine=i786-pc
                ;;
        pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        pentiumpro-* | p6-* | 6x86-* | athlon-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        pentium4-*)
-               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        pn)
                basic_machine=pn-gould
@@ -1007,23 +1028,23 @@ case $basic_machine in
        ppc | ppcbe)    basic_machine=powerpc-unknown
                ;;
        ppc-* | ppcbe-*)
-               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
+       ppcle | powerpclittle)
                basic_machine=powerpcle-unknown
                ;;
        ppcle-* | powerpclittle-*)
-               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        ppc64)  basic_machine=powerpc64-unknown
                ;;
-       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+       ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+       ppc64le | powerpc64little)
                basic_machine=powerpc64le-unknown
                ;;
        ppc64le-* | powerpc64little-*)
-               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        ps2)
                basic_machine=i386-ibm
@@ -1077,17 +1098,10 @@ case $basic_machine in
        sequent)
                basic_machine=i386-sequent
                ;;
-       sh)
-               basic_machine=sh-hitachi
-               os=-hms
-               ;;
        sh5el)
                basic_machine=sh5le-unknown
                ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
-       sparclite-wrs | simso-wrs)
+       simso-wrs)
                basic_machine=sparclite-wrs
                os=-vxworks
                ;;
@@ -1106,7 +1120,7 @@ case $basic_machine in
                os=-sysv4
                ;;
        strongarm-* | thumb-*)
-               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
                ;;
        sun2)
                basic_machine=m68000-sun
@@ -1228,6 +1242,9 @@ case $basic_machine in
                basic_machine=hppa1.1-winbond
                os=-proelf
                ;;
+       x64)
+               basic_machine=x86_64-pc
+               ;;
        xbox)
                basic_machine=i686-pc
                os=-mingw32
@@ -1236,20 +1253,12 @@ case $basic_machine in
                basic_machine=xps100-honeywell
                ;;
        xscale-* | xscalee[bl]-*)
-               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
                ;;
        ymp)
                basic_machine=ymp-cray
                os=-unicos
                ;;
-       z8k-*-coff)
-               basic_machine=z8k-unknown
-               os=-sim
-               ;;
-       z80-*-coff)
-               basic_machine=z80-unknown
-               os=-sim
-               ;;
        none)
                basic_machine=none-none
                os=-none
@@ -1278,10 +1287,6 @@ case $basic_machine in
        vax)
                basic_machine=vax-dec
                ;;
-       pdp10)
-               # there are many clones, so DEC is not a safe bet
-               basic_machine=pdp10-unknown
-               ;;
        pdp11)
                basic_machine=pdp11-dec
                ;;
@@ -1291,9 +1296,6 @@ case $basic_machine in
        sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
                basic_machine=sh-unknown
                ;;
-       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
-               basic_machine=sparc-sun
-               ;;
        cydra)
                basic_machine=cydra-cydrome
                ;;
@@ -1313,7 +1315,7 @@ case $basic_machine in
                # Make sure to match an already-canonicalized machine name.
                ;;
        *)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
                exit 1
                ;;
 esac
@@ -1321,10 +1323,10 @@ esac
 # Here we canonicalize certain aliases for manufacturers.
 case $basic_machine in
        *-digital*)
-               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
                ;;
        *-commodore*)
-               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
                ;;
        *)
                ;;
@@ -1335,8 +1337,8 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-       # First match some system type aliases
-       # that might get confused with valid system types.
+       # First match some system type aliases that might get confused
+       # with valid system types.
        # -solaris* is a basic system type, with this one exception.
        -auroraux)
                os=-auroraux
@@ -1347,45 +1349,48 @@ case $os in
        -solaris)
                os=-solaris2
                ;;
-       -svr4*)
-               os=-sysv4
-               ;;
        -unixware*)
                os=-sysv4.2uw
                ;;
        -gnu/linux*)
                os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
                ;;
-       # First accept the basic system types.
+       # es1800 is here to avoid being matched by es* (a different OS)
+       -es1800*)
+               os=-ose
+               ;;
+       # Now accept the basic system types.
        # The portable systems comes first.
-       # Each alternative MUST END IN A *, to match a version number.
+       # Each alternative MUST end in a * to match a version number.
        # -sysv* is not here because it comes later, after sysvr4.
        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
              | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
              | -sym* | -kopensolaris* | -plan9* \
              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* | -aros* \
+             | -aos* | -aros* | -cloudabi* | -sortix* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-             | -bitrig* | -openbsd* | -solidbsd* \
+             | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
              | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -chorusos* | -chorusrdb* | -cegcc* \
+             | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
              | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+             | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
              | -linux-newlib* | -linux-musl* | -linux-uclibc* \
              | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
-             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
              | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
              | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -morphos* | -superux* | -rtmk* | -windiss* \
              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+             | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
+             | -midnightbsd*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1402,12 +1407,12 @@ case $os in
        -nto*)
                os=`echo $os | sed -e 's|nto|nto-qnx|'`
                ;;
-       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+       -sim | -xray | -os68k* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* \
              | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
                ;;
        -mac*)
-               os=`echo $os | sed -e 's|mac|macos|'`
+               os=`echo "$os" | sed -e 's|mac|macos|'`
                ;;
        -linux-dietlibc)
                os=-linux-dietlibc
@@ -1416,10 +1421,10 @@ case $os in
                os=`echo $os | sed -e 's|linux|linux-gnu|'`
                ;;
        -sunos5*)
-               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
                ;;
        -sunos6*)
-               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
                ;;
        -opened*)
                os=-openedition
@@ -1430,12 +1435,6 @@ case $os in
        -wince*)
                os=-wince
                ;;
-       -osfrose*)
-               os=-osfrose
-               ;;
-       -osf*)
-               os=-osf
-               ;;
        -utek*)
                os=-bsd
                ;;
@@ -1460,7 +1459,7 @@ case $os in
        -nova*)
                os=-rtmk-nova
                ;;
-       -ns2 )
+       -ns2)
                os=-nextstep2
                ;;
        -nsk*)
@@ -1482,7 +1481,7 @@ case $os in
        -oss*)
                os=-sysv3
                ;;
-       -svr4)
+       -svr4*)
                os=-sysv4
                ;;
        -svr3)
@@ -1497,32 +1496,38 @@ case $os in
        -ose*)
                os=-ose
                ;;
-       -es1800*)
-               os=-ose
-               ;;
-       -xenix)
-               os=-xenix
-               ;;
        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
                os=-mint
                ;;
-       -aros*)
-               os=-aros
-               ;;
        -zvmoe)
                os=-zvmoe
                ;;
        -dicos*)
                os=-dicos
                ;;
+       -pikeos*)
+               # Until real need of OS specific support for
+               # particular features comes up, bare metal
+               # configurations are quite functional.
+               case $basic_machine in
+                   arm*)
+                       os=-eabi
+                       ;;
+                   *)
+                       os=-elf
+                       ;;
+               esac
+               ;;
        -nacl*)
                ;;
+       -ios)
+               ;;
        -none)
                ;;
        *)
                # Get rid of the `-' at the beginning of $os.
                os=`echo $os | sed 's/[^-]*-//'`
-               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
                exit 1
                ;;
 esac
@@ -1612,12 +1617,12 @@ case $basic_machine in
        sparc-* | *-sun)
                os=-sunos4.1.1
                ;;
+       pru-*)
+               os=-elf
+               ;;
        *-be)
                os=-beos
                ;;
-       *-haiku)
-               os=-haiku
-               ;;
        *-ibm)
                os=-aix
                ;;
@@ -1657,7 +1662,7 @@ case $basic_machine in
        m88k-omron*)
                os=-luna
                ;;
-       *-next )
+       *-next)
                os=-nextstep
                ;;
        *-sequent)
@@ -1672,9 +1677,6 @@ case $basic_machine in
        i370-*)
                os=-mvs
                ;;
-       *-next)
-               os=-nextstep3
-               ;;
        *-gould)
                os=-sysv
                ;;
@@ -1784,15 +1786,15 @@ case $basic_machine in
                                vendor=stratus
                                ;;
                esac
-               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
                ;;
 esac
 
-echo $basic_machine$os
+echo "$basic_machine$os"
 exit
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'write-file-functions 'time-stamp)
 # time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
index 0067979..145be42 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for cryptsetup 1.6.7.
+# Generated by GNU Autoconf 2.69 for cryptsetup 2.3.3.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='cryptsetup'
 PACKAGE_TARNAME='cryptsetup'
-PACKAGE_VERSION='1.6.7'
-PACKAGE_STRING='cryptsetup 1.6.7'
+PACKAGE_VERSION='2.3.3'
+PACKAGE_STRING='cryptsetup 2.3.3'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -630,31 +630,40 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
+gt_needs=
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
-PYTHON_CRYPTSETUP_FALSE
-PYTHON_CRYPTSETUP_TRUE
-PYTHON_LIBS
-PYTHON_INCLUDES
-pkgpyexecdir
-pyexecdir
-pkgpythondir
-pythondir
-PYTHON_PLATFORM
-PYTHON_EXEC_PREFIX
-PYTHON_PREFIX
-PYTHON_VERSION
-PYTHON
+DEFAULT_LUKS2_LOCK_DIR_PERMS
+DEFAULT_LUKS2_LOCK_PATH
+CRYPTSETUP_TMPFILE_FALSE
+CRYPTSETUP_TMPFILE_TRUE
+DEFAULT_TMPFILESDIR
 LIBCRYPTSETUP_VERSION_INFO
 LIBCRYPTSETUP_VERSION
 CRYPTO_STATIC_LIBS
 CRYPTO_LIBS
 CRYPTO_CFLAGS
+PASSWDQC_LIBS
 PWQUALITY_STATIC_LIBS
+systemd_tmpfilesdir
 DEVMAPPER_STATIC_LIBS
 DEVMAPPER_STATIC_CFLAGS
+HAVE_BLKID_STEP_BACK_FALSE
+HAVE_BLKID_STEP_BACK_TRUE
+HAVE_BLKID_WIPE_FALSE
+HAVE_BLKID_WIPE_TRUE
+HAVE_BLKID_FALSE
+HAVE_BLKID_TRUE
+BLKID_LIBS
+BLKID_CFLAGS
+CRYPTO_INTERNAL_SSE_ARGON2_FALSE
+CRYPTO_INTERNAL_SSE_ARGON2_TRUE
+CRYPTO_INTERNAL_ARGON2_FALSE
+CRYPTO_INTERNAL_ARGON2_TRUE
+LIBARGON2_LIBS
+LIBARGON2_CFLAGS
 CRYPTO_INTERNAL_PBKDF2_FALSE
 CRYPTO_INTERNAL_PBKDF2_TRUE
 CRYPTO_BACKEND_NETTLE_FALSE
@@ -676,12 +685,18 @@ OPENSSL_CFLAGS
 LIBGCRYPT_LIBS
 LIBGCRYPT_CFLAGS
 LIBGCRYPT_CONFIG
+JSON_C_LIBS
+JSON_C_CFLAGS
 DEVMAPPER_LIBS
 DEVMAPPER_CFLAGS
+INTEGRITYSETUP_FALSE
+INTEGRITYSETUP_TRUE
 REENCRYPT_FALSE
 REENCRYPT_TRUE
 VERITYSETUP_FALSE
 VERITYSETUP_TRUE
+CRYPTSETUP_FALSE
+CRYPTSETUP_TRUE
 STATIC_TOOLS_FALSE
 STATIC_TOOLS_TRUE
 PWQUALITY_LIBS
@@ -691,9 +706,8 @@ POSUB
 LTLIBINTL
 LIBINTL
 INTLLIBS
-LTLIBICONV
-LIBICONV
 INTL_MACOSX_LIBS
+XGETTEXT_EXTRA_OPTIONS
 MSGMERGE
 XGETTEXT_015
 XGETTEXT
@@ -701,11 +715,17 @@ GMSGFMT_015
 MSGFMT_015
 GMSGFMT
 MSGFMT
+GETTEXT_MACRO_VERSION
 USE_NLS
 UUID_LIBS
+KERNEL_KEYRING_FALSE
+KERNEL_KEYRING_TRUE
+LTLIBICONV
+LIBICONV
 PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
+LT_SYS_LIBRARY_PATH
 OTOOL64
 OTOOL
 LIPO
@@ -735,7 +755,6 @@ am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
-am__quote
 am__include
 DEPDIR
 OBJEXT
@@ -799,6 +818,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -817,7 +837,8 @@ PACKAGE_VERSION
 PACKAGE_TARNAME
 PACKAGE_NAME
 PATH_SEPARATOR
-SHELL'
+SHELL
+am__quote'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
@@ -827,28 +848,35 @@ enable_static
 enable_shared
 with_pic
 enable_fast_install
+with_aix_soname
 with_gnu_ld
 with_sysroot
 enable_libtool_lock
-enable_largefile
-enable_nls
 enable_rpath
 with_libiconv_prefix
+enable_keyring
+enable_largefile
+enable_nls
 with_libintl_prefix
 enable_fips
 enable_pwquality
+enable_passwdqc
 enable_static_cryptsetup
+enable_cryptsetup
 enable_veritysetup
 enable_cryptsetup_reencrypt
+enable_integritysetup
 enable_selinux
 enable_udev
 with_crypto_backend
 enable_kernel_crypto
 enable_gcrypt_pbkdf2
 with_libgcrypt_prefix
+enable_internal_argon2
+enable_libargon2
+enable_internal_sse_argon2
+enable_blkid
 enable_dev_random
-enable_python
-with_python_version
 with_plain_hash
 with_plain_cipher
 with_plain_mode
@@ -857,7 +885,14 @@ with_luks1_hash
 with_luks1_cipher
 with_luks1_mode
 with_luks1_keybits
+enable_luks_adjust_xts_keysize
+with_luks2_pbkdf
 with_luks1_iter_time
+with_luks2_iter_time
+with_luks2_memory_kb
+with_luks2_parallel_threads
+with_luks2_keyslot_cipher
+with_luks2_keyslot_keybits
 with_loopaes_cipher
 with_loopaes_keybits
 with_keyfile_size_maxkb
@@ -866,6 +901,11 @@ with_verity_hash
 with_verity_data_block
 with_verity_hash_block
 with_verity_salt_size
+with_verity_fec_roots
+with_tmpfilesdir
+with_luks2_lock_path
+with_luks2_lock_dir_perms
+with_default_luks_format
 '
       ac_precious_vars='build_alias
 host_alias
@@ -876,6 +916,7 @@ LDFLAGS
 LIBS
 CPPFLAGS
 CPP
+LT_SYS_LIBRARY_PATH
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
@@ -883,15 +924,21 @@ PWQUALITY_CFLAGS
 PWQUALITY_LIBS
 DEVMAPPER_CFLAGS
 DEVMAPPER_LIBS
+JSON_C_CFLAGS
+JSON_C_LIBS
 OPENSSL_CFLAGS
 OPENSSL_LIBS
 OPENSSL_STATIC_CFLAGS
 OPENSSL_STATIC_LIBS
 NSS_CFLAGS
 NSS_LIBS
+LIBARGON2_CFLAGS
+LIBARGON2_LIBS
+BLKID_CFLAGS
+BLKID_LIBS
 DEVMAPPER_STATIC_CFLAGS
 DEVMAPPER_STATIC_LIBS
-PYTHON'
+systemd_tmpfilesdir'
 
 
 # Initialize some variables set by options.
@@ -930,6 +977,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1182,6 +1230,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1319,7 +1376,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir
+               libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1432,7 +1489,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cryptsetup 1.6.7 to adapt to many kinds of systems.
+\`configure' configures cryptsetup 2.3.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1472,6 +1529,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1502,7 +1560,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cryptsetup 1.6.7:";;
+     short | recursive ) echo "Configuration of cryptsetup 2.3.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1521,57 +1579,92 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-rpath         do not hardcode runtime library paths
+  --disable-keyring       disable kernel keyring support and builtin kernel
+                          keyring token
   --disable-largefile     omit support for large files
   --disable-nls           do not use Native Language Support
-  --disable-rpath         do not hardcode runtime library paths
   --enable-fips           enable FIPS mode restrictions
-  --enable-pwquality      enable password quality checking
+  --enable-pwquality      enable password quality checking using pwquality
+                          library
+  --enable-passwdqc[=CONFIG_PATH]
+                          enable password quality checking using passwdqc
+                          library (optionally with CONFIG_PATH)
   --enable-static-cryptsetup
-                          enable build of static cryptsetup binary
+                          enable build of static version of tools
+  --disable-cryptsetup    disable cryptsetup support
   --disable-veritysetup   disable veritysetup support
-  --enable-cryptsetup-reencrypt
-                          enable cryptsetup-reencrypt tool
+  --disable-cryptsetup-reencrypt
+                          disable cryptsetup-reencrypt tool
+  --disable-integritysetup
+                          disable integritysetup support
   --disable-selinux       disable selinux support [default=auto]
   --disable-udev          disable udev support
   --disable-kernel_crypto disable kernel userspace crypto (no benchmark and
                           tcrypt)
-  --enable-gcrypt-pbkdf2  force enable internal gcrypt PBKDF2
-  --enable-dev-random     use blocking /dev/random by default for key
-                          generator (otherwise use /dev/urandom)
-  --enable-python         enable Python bindings
+                 --enable-gcrypt-pbkdf2  force enable internal gcrypt PBKDF2
+  --disable-internal-argon2
+                          disable internal implementation of Argon2 PBKDF
+  --enable-libargon2      enable external libargon2 (PHC) library (disables
+                          internal bundled version)
+  --enable-internal-sse-argon2
+                          enable internal SSE implementation of Argon2 PBKDF
+  --disable-blkid         disable use of blkid for device signature detection
+                          and wiping
+  --enable-dev-random     use /dev/random by default for key generation
+                          (otherwise use /dev/urandom)
+  --disable-luks-adjust-xts-keysize
+                          XTS mode requires two keys, double default LUKS
+                          keysize if needed
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
+  --with-aix-soname=aix|svr4|both
+                          shared library versioning (aka "SONAME") variant to
+                          provide on AIX, [default=aix].
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
+                          compiler's sysroot if not specified).
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-sysroot=DIR Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).
-  --with-gnu-ld           assume the C compiler uses GNU ld default=no
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
   --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
   --without-libintl-prefix     don't search for libintl in includedir and libdir
   --with-crypto_backend=BACKEND
                           crypto backend (gcrypt/openssl/nss/kernel/nettle)
-                          [gcrypt]
+                          [openssl]
   --with-libgcrypt-prefix=PFX
                           prefix where LIBGCRYPT is installed (optional)
-  --with-python_version=VERSION
-                          required Python version [2.6]
   --with-plain-hash       default password hashing function for plain mode
                           [ripemd160]
   --with-plain-cipher     default cipher for plain mode [aes]
   --with-plain-mode       default cipher mode for plain mode
                           [cbc-essiv:sha256]
   --with-plain-keybits    default key length in bits for plain mode [256]
-  --with-luks1-hash       default hash function for LUKS1 header [sha1]
+  --with-luks1-hash       default hash function for LUKS1 header [sha256]
   --with-luks1-cipher     default cipher for LUKS1 [aes]
   --with-luks1-mode       default cipher mode for LUKS1 [xts-plain64]
   --with-luks1-keybits    default key length in bits for LUKS1 [256]
+  --with-luks2-pbkdf      default Default PBKDF algorithm (pbkdf2 or
+                          argon2i/argon2id) for LUKS2 [argon2i]
   --with-luks1-iter-time  default PBKDF2 iteration time for LUKS1 (in ms)
-                          [1000]
+                          [2000]
+  --with-luks2-iter-time  default Argon2 PBKDF iteration time for LUKS2 (in
+                          ms) [2000]
+  --with-luks2-memory-kb  default Argon2 PBKDF memory cost for LUKS2 (in kB)
+                          [1048576]
+  --with-luks2-parallel-threads
+                          default Argon2 PBKDF max parallel cost for LUKS2 (if
+                          CPUs available) [4]
+  --with-luks2-keyslot-cipher
+                          default fallback cipher for LUKS2 keyslot (if data
+                          encryption is incompatible) [aes-xts-plain64]
+  --with-luks2-keyslot-keybits
+                          default fallback key size for LUKS2 keyslot (if data
+                          encryption is incompatible) [512]
   --with-loopaes-cipher   default cipher for loop-AES mode [aes]
   --with-loopaes-keybits  default key length in bits for loop-AES mode [256]
   --with-keyfile-size-maxkb
@@ -1584,6 +1677,16 @@ Optional Packages:
   --with-verity-hash-block
                           default hash block size for verity mode [4096]
   --with-verity-salt-size default salt size for verity mode [32]
+  --with-verity-fec-roots default parity bytes for verity FEC [2]
+  --with-tmpfilesdir      default override default path to directory with
+                          systemd temporary files []
+  --with-luks2-lock-path  default path to directory for LUKSv2 locks
+                          [/run/cryptsetup]
+  --with-luks2-lock-dir-perms
+                          default default luks2 locking directory permissions
+                          [0700]
+  --with-default-luks-format=FORMAT
+                          default LUKS format version (LUKS1/LUKS2) [LUKS2]
 
 Some influential environment variables:
   CC          C compiler command
@@ -1594,6 +1697,8 @@ Some influential environment variables:
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
+  LT_SYS_LIBRARY_PATH
+              User-defined run-time library search path.
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
               directories to add to pkg-config's search path
@@ -1607,6 +1712,9 @@ Some influential environment variables:
               C compiler flags for DEVMAPPER, overriding pkg-config
   DEVMAPPER_LIBS
               linker flags for DEVMAPPER, overriding pkg-config
+  JSON_C_CFLAGS
+              C compiler flags for JSON_C, overriding pkg-config
+  JSON_C_LIBS linker flags for JSON_C, overriding pkg-config
   OPENSSL_CFLAGS
               C compiler flags for OPENSSL, overriding pkg-config
   OPENSSL_LIBS
@@ -1617,11 +1725,19 @@ Some influential environment variables:
               linker flags for OPENSSL_STATIC, overriding pkg-config
   NSS_CFLAGS  C compiler flags for NSS, overriding pkg-config
   NSS_LIBS    linker flags for NSS, overriding pkg-config
+  LIBARGON2_CFLAGS
+              C compiler flags for LIBARGON2, overriding pkg-config
+  LIBARGON2_LIBS
+              linker flags for LIBARGON2, overriding pkg-config
+  BLKID_CFLAGS
+              C compiler flags for BLKID, overriding pkg-config
+  BLKID_LIBS  linker flags for BLKID, overriding pkg-config
   DEVMAPPER_STATIC_CFLAGS
               C compiler flags for DEVMAPPER_STATIC, overriding pkg-config
   DEVMAPPER_STATIC_LIBS
               linker flags for DEVMAPPER_STATIC, overriding pkg-config
-  PYTHON      the Python interpreter
+  systemd_tmpfilesdir
+              value of tmpfilesdir for systemd, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1689,7 +1805,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cryptsetup configure 1.6.7
+cryptsetup configure 2.3.3
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2051,6 +2167,52 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -2104,57 +2266,11 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_type
-
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  as_decl_name=`echo $2|sed 's/ *(.*//'`
-  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
-  (void) $as_decl_use;
-#else
-  (void) $as_decl_name;
-#endif
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cryptsetup $as_me 1.6.7, which was
+It was created by cryptsetup $as_me 2.3.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2434,6 +2550,7 @@ $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
+gt_needs="$gt_needs need-ngettext"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -2504,7 +2621,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 LIBCRYPTSETUP_VERSION=$(echo $PACKAGE_VERSION | cut -f1 -d-)
-LIBCRYPTSETUP_VERSION_INFO=11:0:7
+LIBCRYPTSETUP_VERSION_INFO=18:0:6
 
 # Check whether --enable-silent-rules was given.
 if test "${enable_silent_rules+set}" = set; then :
@@ -2555,8 +2672,8 @@ ac_config_headers="$ac_config_headers config.h:config.h.in"
 # http://lists.gnu.org/archive/html/automake/2013-01/msg00060.html
 
 # For old automake use this
-#AM_INIT_AUTOMAKE(dist-xz)
-am__api_version='1.14'
+#AM_INIT_AUTOMAKE(dist-xz subdir-objects)
+am__api_version='1.16'
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2777,7 +2894,7 @@ else
 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
 fi
 
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
   case $am_aux_dir in
   *\ * | *\    *)
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -3032,7 +3149,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='cryptsetup'
- VERSION='1.6.7'
+ VERSION='2.3.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3062,12 +3179,12 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # For better backward compatibility.  To be removed once Automake 1.9.x
 # dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 mkdir_p='$(MKDIR_P)'
 
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver).  The
+# system "awk" is bad on some platforms.
 # Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AMTAR='$${TAR-tar}'
@@ -3114,7 +3231,7 @@ END
 Aborting the configuration process, to ensure you take notice of the issue.
 
 You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
 
 If you want to complete the configuration process using your problematic
 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -3206,45 +3323,45 @@ DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
 
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
+cat > confinc.mk << 'END'
 am__doit:
-       @echo this is the am__doit target
+       @echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+   (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+  case $?:`cat confinc.out 2>/dev/null` in #(
+  '0:this is the am__doit target') :
+    case $s in #(
+  BSD) :
+    am__include='.include' am__quote='"' ;; #(
+  *) :
+    am__include='include' am__quote='' ;;
+esac ;; #(
+  *) :
      ;;
-   esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
+esac
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }
 
 # Check whether --enable-dependency-tracking was given.
 if test "${enable_dependency_tracking+set}" = set; then :
@@ -5605,14 +5722,14 @@ if test "${enable_static+set}" = set; then :
     *)
      enable_static=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$pkg" = "X$p"; then
          enable_static=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -5635,8 +5752,8 @@ esac
 
 
 
-macro_version='2.4.2'
-macro_revision='1.3337'
+macro_version='2.4.6'
+macro_revision='2.4.6'
 
 
 
@@ -5650,7 +5767,7 @@ macro_revision='1.3337'
 
 
 
-ltmain="$ac_aux_dir/ltmain.sh"
+ltmain=$ac_aux_dir/ltmain.sh
 
 # Backslashify metacharacters that are still active within
 # double-quoted strings.
@@ -5699,7 +5816,7 @@ func_echo_all ()
     $ECHO ""
 }
 
-case "$ECHO" in
+case $ECHO in
   printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
 $as_echo "printf" >&6; } ;;
   print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
@@ -5892,19 +6009,19 @@ test -z "$GREP" && GREP=grep
 
 # Check whether --with-gnu-ld was given.
 if test "${with_gnu_ld+set}" = set; then :
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+  withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes
 else
   with_gnu_ld=no
 fi
 
 ac_prog=ld
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   # Check if gcc -print-prog-name=ld gives a path.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
 $as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
+    # gcc leaves a trailing carriage return, which upsets mingw
     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
   *)
     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
@@ -5918,7 +6035,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
       while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
        ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
       done
-      test -z "$LD" && LD="$ac_prog"
+      test -z "$LD" && LD=$ac_prog
       ;;
   "")
     # If it fails, then pretend we aren't using GCC.
@@ -5929,7 +6046,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
     with_gnu_ld=unknown
     ;;
   esac
-elif test "$with_gnu_ld" = yes; then
+elif test yes = "$with_gnu_ld"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
 $as_echo_n "checking for GNU ld... " >&6; }
 else
@@ -5940,32 +6057,32 @@ if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
+      lt_cv_path_LD=$ac_dir/$ac_prog
       # Check to see if the program is GNU ld.  I'd rather use --version,
       # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break
+       test no != "$with_gnu_ld" && break
        ;;
       *)
-       test "$with_gnu_ld" != yes && break
+       test yes != "$with_gnu_ld" && break
        ;;
       esac
     fi
   done
-  IFS="$lt_save_ifs"
+  IFS=$lt_save_ifs
 else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+  lt_cv_path_LD=$LD # Let the user override the test with a path.
 fi
 fi
 
-LD="$lt_cv_path_LD"
+LD=$lt_cv_path_LD
 if test -n "$LD"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
 $as_echo "$LD" >&6; }
@@ -6008,33 +6125,38 @@ if ${lt_cv_path_NM+:} false; then :
 else
   if test -n "$NM"; then
   # Let the user override the test.
-  lt_cv_path_NM="$NM"
+  lt_cv_path_NM=$NM
 else
-  lt_nm_to_check="${ac_tool_prefix}nm"
+  lt_nm_to_check=${ac_tool_prefix}nm
   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
     lt_nm_to_check="$lt_nm_to_check nm"
   fi
   for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
     for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      tmp_nm=$ac_dir/$lt_tmp_nm
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
        # Check to see if the nm accepts a BSD-compat flag.
-       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       # Adding the 'sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
        # Tru64's nm complains that /dev/null is an invalid object file
-       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-       */dev/null* | *'Invalid file or object type'*)
+       # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
+       case $build_os in
+       mingw*) lt_bad_file=conftest.nm/nofile ;;
+       *) lt_bad_file=/dev/null ;;
+       esac
+       case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
+       *$lt_bad_file* | *'Invalid file or object type'*)
          lt_cv_path_NM="$tmp_nm -B"
-         break
+         break 2
          ;;
        *)
          case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
          */dev/null*)
            lt_cv_path_NM="$tmp_nm -p"
-           break
+           break 2
            ;;
          *)
            lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
@@ -6045,15 +6167,15 @@ else
        esac
       fi
     done
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
   done
   : ${lt_cv_path_NM=no}
 fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
 $as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
+if test no != "$lt_cv_path_NM"; then
+  NM=$lt_cv_path_NM
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
   if test -n "$DUMPBIN"; then :
@@ -6159,9 +6281,9 @@ esac
   fi
 fi
 
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
     *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
+      DUMPBIN="$DUMPBIN -symbols -headers"
       ;;
     *)
       DUMPBIN=:
@@ -6169,8 +6291,8 @@ fi
     esac
   fi
 
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
+  if test : != "$DUMPBIN"; then
+    NM=$DUMPBIN
   fi
 fi
 test -z "$NM" && NM=nm
@@ -6221,7 +6343,7 @@ if ${lt_cv_sys_max_cmd_len+:} false; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
-  teststring="ABCD"
+  teststring=ABCD
 
   case $build_os in
   msdosdjgpp*)
@@ -6261,7 +6383,7 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+  bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
     # This has been around since 386BSD, at least.  Likely further.
     if test -x /sbin/sysctl; then
       lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
@@ -6312,22 +6434,22 @@ else
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
     if test -n "$lt_cv_sys_max_cmd_len" && \
-       test undefined != "$lt_cv_sys_max_cmd_len"; then
+       test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
       # Make teststring a little bigger before we do anything with it.
       # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
+      for i in 1 2 3 4 5 6 7 8; do
         teststring=$teststring$teststring
       done
       SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+      while { test X`env echo "$teststring$teststring" 2>/dev/null` \
                 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-             test $i != 17 # 1/2 MB should be enough
+             test 17 != "$i" # 1/2 MB should be enough
       do
         i=`expr $i + 1`
         teststring=$teststring$teststring
@@ -6345,7 +6467,7 @@ else
 
 fi
 
-if test -n $lt_cv_sys_max_cmd_len ; then
+if test -n "$lt_cv_sys_max_cmd_len"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
 $as_echo "$lt_cv_sys_max_cmd_len" >&6; }
 else
@@ -6363,30 +6485,6 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
 : ${MV="mv -f"}
 : ${RM="rm -f"}
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
-$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
-$as_echo "$xsi_shell" >&6; }
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
-$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
-$as_echo "$lt_shell_append" >&6; }
-
-
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   lt_unset=unset
 else
@@ -6509,13 +6607,13 @@ esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
   cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       reload_cmds=false
     fi
     ;;
   darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    if test yes = "$GCC"; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
     else
       reload_cmds='$LD$reload_flag -o $output$reload_objs'
     fi
@@ -6643,13 +6741,13 @@ lt_cv_deplibs_check_method='unknown'
 # Need to set the preceding variable on all platforms that support
 # interlibrary dependencies.
 # 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
+# 'unknown' -- same as none, but documents that we really don't know.
 # 'pass_all' -- all dependencies passed with no checks.
 # 'test_compile' -- check by making test program.
 # 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
+# that responds to the $file_magic_cmd with a given extended regex.
+# If you have 'file' or equivalent on your system and you're not sure
+# whether 'pass_all' will *always* work, you probably want this one.
 
 case $host_os in
 aix[4-9]*)
@@ -6676,8 +6774,7 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
@@ -6773,8 +6870,8 @@ newos6*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+openbsd* | bitrig*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
   else
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
@@ -6827,6 +6924,9 @@ sysv4 | sysv4.3*)
 tpf*)
   lt_cv_deplibs_check_method=pass_all
   ;;
+os2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 esac
 
 fi
@@ -6984,8 +7084,8 @@ else
 
 case $host_os in
 cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
+  # two different shell functions defined in ltmain.sh;
+  # decide which one to use based on capabilities of $DLLTOOL
   case `$DLLTOOL --help 2>&1` in
   *--identify-strict*)
     lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
@@ -6997,7 +7097,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   ;;
 *)
   # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  lt_cv_sharedlib_from_linklib_cmd=$ECHO
   ;;
 esac
 
@@ -7114,7 +7214,7 @@ esac
 fi
 
 : ${AR=ar}
-: ${AR_FLAGS=cru}
+: ${AR_FLAGS=cr}
 
 
 
@@ -7151,7 +7251,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-      if test "$ac_status" -eq 0; then
+      if test 0 -eq "$ac_status"; then
        # Ensure the archiver fails upon bogus file names.
        rm -f conftest.$ac_objext libconftest.a
        { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
@@ -7159,7 +7259,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-       if test "$ac_status" -ne 0; then
+       if test 0 -ne "$ac_status"; then
           lt_cv_ar_at_file=@
         fi
       fi
@@ -7172,7 +7272,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
 $as_echo "$lt_cv_ar_at_file" >&6; }
 
-if test "x$lt_cv_ar_at_file" = xno; then
+if test no = "$lt_cv_ar_at_file"; then
   archiver_list_spec=
 else
   archiver_list_spec=$lt_cv_ar_at_file
@@ -7389,7 +7489,7 @@ old_postuninstall_cmds=
 
 if test -n "$RANLIB"; then
   case $host_os in
-  openbsd*)
+  bitrig* | openbsd*)
     old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
@@ -7479,7 +7579,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   symcode='[ABCDGISTW]'
   ;;
 hpux*)
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     symcode='[ABCDEGRST]'
   fi
   ;;
@@ -7512,14 +7612,44 @@ case `$NM -V 2>&1` in
   symcode='[ABCDGIRSTW]' ;;
 esac
 
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  # Gets list of data symbols to import.
+  lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
+  # Adjust the below global symbol transforms to fixup imported variables.
+  lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
+  lt_c_name_hook=" -e 's/^I .* \(.*\)$/  {\"\1\", (void *) 0},/p'"
+  lt_c_name_lib_hook="\
+  -e 's/^I .* \(lib.*\)$/  {\"\1\", (void *) 0},/p'\
+  -e 's/^I .* \(.*\)$/  {\"lib\1\", (void *) 0},/p'"
+else
+  # Disable hooks by default.
+  lt_cv_sys_global_symbol_to_import=
+  lt_cdecl_hook=
+  lt_c_name_hook=
+  lt_c_name_lib_hook=
+fi
+
 # Transform an extracted symbol line into a proper C declaration.
 # Some systems (esp. on ia64) link data and code symbols differently,
 # so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+lt_cv_sys_global_symbol_to_cdecl="sed -n"\
+$lt_cdecl_hook\
+" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
+$lt_c_name_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/p'"
+
+# Transform an extracted symbol line into symbol name with lib prefix and
+# symbol address.
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
+$lt_c_name_lib_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(lib.*\)$/  {\"\1\", (void *) \&\1},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"lib\1\", (void *) \&\1},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -7537,21 +7667,24 @@ for ac_symprfx in "" "_"; do
 
   # Write the raw and C identifiers.
   if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
+    # Fake it for dumpbin and say T for any non-static function,
+    # D for any global variable and I for any imported variable.
     # Also find C++ and __fastcall symbols from MSVC++,
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
 "     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
+"     /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
+"     /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
 "     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
+"     {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
+"     s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
 "     ' prfx=^$ac_symprfx"
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[     ]\($symcode$symcode*\)[         ][      ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
@@ -7582,11 +7715,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s "$nlist"; then
+    $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5
+    if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
        mv -f "$nlist"T "$nlist"
@@ -7599,11 +7729,11 @@ _LT_EOF
        if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
          cat <<_LT_EOF > conftest.$ac_ext
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
    relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
-#elif defined(__osf__)
+#elif defined __osf__
 /* This system does not cope well with relocations in const data.  */
 # define LT_DLSYM_CONST
 #else
@@ -7629,7 +7759,7 @@ lt__PROGRAM__LTX_preloaded_symbols[] =
 {
   { "@PROGRAM@", (void *) 0 },
 _LT_EOF
-         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+         $SED "s/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
          cat <<\_LT_EOF >> conftest.$ac_ext
   {0, (void *) 0}
 };
@@ -7649,13 +7779,13 @@ _LT_EOF
          mv conftest.$ac_objext conftstm.$ac_objext
          lt_globsym_save_LIBS=$LIBS
          lt_globsym_save_CFLAGS=$CFLAGS
-         LIBS="conftstm.$ac_objext"
+         LIBS=conftstm.$ac_objext
          CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
          if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+  test $ac_status = 0; } && test -s conftest$ac_exeext; then
            pipe_works=yes
          fi
          LIBS=$lt_globsym_save_LIBS
@@ -7676,7 +7806,7 @@ _LT_EOF
   rm -rf conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
+  if test yes = "$pipe_works"; then
     break
   else
     lt_cv_sys_global_symbol_pipe=
@@ -7729,6 +7859,16 @@ fi
 
 
 
+
+
+
+
+
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
 $as_echo_n "checking for sysroot... " >&6; }
 
@@ -7741,9 +7881,9 @@ fi
 
 
 lt_sysroot=
-case ${with_sysroot} in #(
+case $with_sysroot in #(
  yes)
-   if test "$GCC" = yes; then
+   if test yes = "$GCC"; then
      lt_sysroot=`$CC --print-sysroot 2>/dev/null`
    fi
    ;; #(
@@ -7753,8 +7893,8 @@ case ${with_sysroot} in #(
  no|'')
    ;; #(
  *)
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
-$as_echo "${with_sysroot}" >&6; }
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5
+$as_echo "$with_sysroot" >&6; }
    as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
    ;;
 esac
@@ -7766,18 +7906,99 @@ $as_echo "${lt_sysroot:-no}" >&6; }
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5
+$as_echo_n "checking for a working dd... " >&6; }
+if ${ac_cv_path_lt_DD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+: ${lt_DD:=$DD}
+if test -z "$lt_DD"; then
+  ac_path_lt_DD_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in dd; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_lt_DD" || continue
+if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
+fi
+      $ac_path_lt_DD_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_lt_DD"; then
+    :
+  fi
+else
+  ac_cv_path_lt_DD=$lt_DD
+fi
+
+rm -f conftest.i conftest2.i conftest.out
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5
+$as_echo "$ac_cv_path_lt_DD" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5
+$as_echo_n "checking how to truncate binary pipes... " >&6; }
+if ${lt_cv_truncate_bin+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+lt_cv_truncate_bin=
+if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
+fi
+rm -f conftest.i conftest2.i conftest.out
+test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5
+$as_echo "$lt_cv_truncate_bin" >&6; }
+
+
+
+
+
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
 fi
 
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+test no = "$enable_libtool_lock" || enable_libtool_lock=yes
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
 case $host in
 ia64-*-hpux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set mode
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
@@ -7786,24 +8007,25 @@ ia64-*-hpux*)
   test $ac_status = 0; }; then
     case `/usr/bin/file conftest.$ac_objext` in
       *ELF-32*)
-       HPUX_IA64_MODE="32"
+       HPUX_IA64_MODE=32
        ;;
       *ELF-64*)
-       HPUX_IA64_MODE="64"
+       HPUX_IA64_MODE=64
        ;;
     esac
   fi
   rm -rf conftest*
   ;;
 *-*-irix6*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo '#line '$LINENO' "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
+    if test yes = "$lt_cv_prog_gnu_ld"; then
       case `/usr/bin/file conftest.$ac_objext` in
        *32-bit*)
          LD="${LD-ld} -melf32bsmip"
@@ -7832,9 +8054,50 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
+mips64*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    emul=elf
+    case `/usr/bin/file conftest.$ac_objext` in
+      *32-bit*)
+       emul="${emul}32"
+       ;;
+      *64-bit*)
+       emul="${emul}64"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *MSB*)
+       emul="${emul}btsmip"
+       ;;
+      *LSB*)
+       emul="${emul}ltsmip"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *N32*)
+       emul="${emul}n32"
+       ;;
+    esac
+    LD="${LD-ld} -m $emul"
+  fi
+  rm -rf conftest*
+  ;;
+
 x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.  Note that the listed cases only cover the
+  # situations where additional linker options are needed (such as when
+  # doing 32-bit compilation for a host where ld defaults to 64-bit, or
+  # vice versa); the common cases where no linker options are needed do
+  # not appear in the list.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
@@ -7857,10 +8120,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
                ;;
            esac
            ;;
-         powerpc64le-*)
+         powerpc64le-*linux*)
            LD="${LD-ld} -m elf32lppclinux"
            ;;
-         powerpc64-*)
+         powerpc64-*linux*)
            LD="${LD-ld} -m elf32ppclinux"
            ;;
          s390x-*linux*)
@@ -7879,10 +8142,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
          x86_64-*linux*)
            LD="${LD-ld} -m elf_x86_64"
            ;;
-         powerpcle-*)
+         powerpcle-*linux*)
            LD="${LD-ld} -m elf64lppc"
            ;;
-         powerpc-*)
+         powerpc-*linux*)
            LD="${LD-ld} -m elf64ppc"
            ;;
          s390*-*linux*|s390*-*tpf*)
@@ -7900,7 +8163,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
+  SAVE_CFLAGS=$CFLAGS
   CFLAGS="$CFLAGS -belf"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
@@ -7940,13 +8203,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
 $as_echo "$lt_cv_cc_needs_belf" >&6; }
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+  if test yes != "$lt_cv_cc_needs_belf"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
+    CFLAGS=$SAVE_CFLAGS
   fi
   ;;
 *-*solaris*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
@@ -7958,7 +8222,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
       case $lt_cv_prog_gnu_ld in
       yes*)
         case $host in
-        i?86-*-solaris*)
+        i?86-*-solaris*|x86_64-*-solaris*)
           LD="${LD-ld} -m elf_x86_64"
           ;;
         sparc*-*-solaris*)
@@ -7967,7 +8231,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
         esac
         # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
         if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
+          LD=${LD-ld}_sol2
         fi
         ;;
       *)
@@ -7983,7 +8247,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
   ;;
 esac
 
-need_locks="$enable_libtool_lock"
+need_locks=$enable_libtool_lock
 
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
@@ -8094,7 +8358,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
 $as_echo "$lt_cv_path_mainfest_tool" >&6; }
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
+if test yes != "$lt_cv_path_mainfest_tool"; then
   MANIFEST_TOOL=:
 fi
 
@@ -8597,7 +8861,7 @@ if ${lt_cv_apple_cc_single_mod+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
+      if test -z "$LT_MULTI_MODULE"; then
        # By default we will add the -single_module flag. You can override
        # by either setting the environment variable LT_MULTI_MODULE
        # non-empty at configure time, or by adding -multi_module to the
@@ -8615,7 +8879,7 @@ else
          cat conftest.err >&5
        # Otherwise, if the output was created with a 0 exit code from
        # the compiler, it worked.
-       elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+       elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
          lt_cv_apple_cc_single_mod=yes
        else
          cat conftest.err >&5
@@ -8654,7 +8918,7 @@ else
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-       LDFLAGS="$save_LDFLAGS"
+       LDFLAGS=$save_LDFLAGS
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
@@ -8671,8 +8935,8 @@ int forced_loaded() { return 2;}
 _LT_EOF
       echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
       $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
-      echo "$AR cru libconftest.a conftest.o" >&5
-      $AR cru libconftest.a conftest.o 2>&5
+      echo "$AR cr libconftest.a conftest.o" >&5
+      $AR cr libconftest.a conftest.o 2>&5
       echo "$RANLIB libconftest.a" >&5
       $RANLIB libconftest.a 2>&5
       cat > conftest.c << _LT_EOF
@@ -8683,7 +8947,7 @@ _LT_EOF
       _lt_result=$?
       if test -s conftest.err && $GREP force_load conftest.err; then
        cat conftest.err >&5
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
        lt_cv_ld_force_load=yes
       else
        cat conftest.err >&5
@@ -8696,32 +8960,32 @@ fi
 $as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
     darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
     darwin*) # darwin 5.x on
       # if running on 10.5 or later, the deployment target defaults
       # to the OS version, if on x86, and 10.4, the deployment
       # target defaults to 10.4. Don't you love it?
       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
        10.0,*86*-darwin8*|10.0,*-darwin[91]*)
-         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-       10.[012]*)
-         _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+       10.[012][,.]*)
+         _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
        10.*)
-         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
       esac
     ;;
   esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+    if test yes = "$lt_cv_apple_cc_single_mod"; then
       _lt_dar_single_mod='$single_module'
     fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    if test yes = "$lt_cv_ld_exported_symbols_list"; then
+      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
     else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -8729,6 +8993,41 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
     ;;
   esac
 
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
 for ac_header in dlfcn.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
@@ -8765,14 +9064,14 @@ if test "${enable_shared+set}" = set; then :
     *)
       enable_shared=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$pkg" = "X$p"; then
          enable_shared=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -8797,14 +9096,14 @@ if test "${with_pic+set}" = set; then :
     *)
       pic_mode=default
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for lt_pkg in $withval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$lt_pkg" = "X$lt_p"; then
          pic_mode=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -8812,8 +9111,6 @@ else
 fi
 
 
-test -z "$pic_mode" && pic_mode=default
-
 
 
 
@@ -8829,14 +9126,14 @@ if test "${enable_fast_install+set}" = set; then :
     *)
       enable_fast_install=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$pkg" = "X$p"; then
          enable_fast_install=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -8850,11 +9147,63 @@ fi
 
 
 
+  shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[5-9]*,yes)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5
+$as_echo_n "checking which variant of shared library versioning to provide... " >&6; }
+
+# Check whether --with-aix-soname was given.
+if test "${with_aix_soname+set}" = set; then :
+  withval=$with_aix_soname; case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname
+else
+  if ${lt_cv_with_aix_soname+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_with_aix_soname=aix
+fi
+
+    with_aix_soname=$lt_cv_with_aix_soname
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5
+$as_echo "$with_aix_soname" >&6; }
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+
+
+
+
+
+
 
 
 
 # This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
+LIBTOOL_DEPS=$ltmain
 
 # Always use our own libtool.
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -8903,7 +9252,7 @@ test -z "$LN_S" && LN_S="ln -s"
 
 
 
-if test -n "${ZSH_VERSION+set}" ; then
+if test -n "${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 
@@ -8942,7 +9291,7 @@ aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
   # reason, if we set the COLLECT_NAMES environment variable, the problems
   # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
+  if test set != "${COLLECT_NAMES+set}"; then
     COLLECT_NAMES=
     export COLLECT_NAMES
   fi
@@ -8953,14 +9302,14 @@ esac
 ofile=libtool
 can_build_shared=yes
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a '.a' archive for static linking (except MSVC,
 # which needs '.lib').
 libext=a
 
-with_gnu_ld="$lt_cv_prog_gnu_ld"
+with_gnu_ld=$lt_cv_prog_gnu_ld
 
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
+old_CC=$CC
+old_CFLAGS=$CFLAGS
 
 # Set sane defaults for various variables
 test -z "$CC" && CC=cc
@@ -8969,15 +9318,8 @@ test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
 test -z "$LD" && LD=ld
 test -z "$ac_objext" && ac_objext=o
 
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+func_cc_basename $compiler
+cc_basename=$func_cc_basename_result
 
 
 # Only perform the check for file, if the check method requires it
@@ -8992,22 +9334,22 @@ if ${lt_cv_path_MAGIC_CMD+:} false; then :
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
   ;;
 *)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
   for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/${ac_tool_prefix}file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+    if test -f "$ac_dir/${ac_tool_prefix}file"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file"
       if test -n "$file_magic_test_file"; then
        case $deplibs_check_method in
        "file_magic "*)
          file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         MAGIC_CMD=$lt_cv_path_MAGIC_CMD
          if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
            $EGREP "$file_magic_regex" > /dev/null; then
            :
@@ -9030,13 +9372,13 @@ _LT_EOF
       break
     fi
   done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
   ;;
 esac
 fi
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 if test -n "$MAGIC_CMD"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
 $as_echo "$MAGIC_CMD" >&6; }
@@ -9058,22 +9400,22 @@ if ${lt_cv_path_MAGIC_CMD+:} false; then :
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
   ;;
 *)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
   for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+    if test -f "$ac_dir/file"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"file"
       if test -n "$file_magic_test_file"; then
        case $deplibs_check_method in
        "file_magic "*)
          file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         MAGIC_CMD=$lt_cv_path_MAGIC_CMD
          if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
            $EGREP "$file_magic_regex" > /dev/null; then
            :
@@ -9096,13 +9438,13 @@ _LT_EOF
       break
     fi
   done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
   ;;
 esac
 fi
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 if test -n "$MAGIC_CMD"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
 $as_echo "$MAGIC_CMD" >&6; }
@@ -9123,7 +9465,7 @@ esac
 
 # Use C for the default configuration in the libtool script
 
-lt_save_CC="$CC"
+lt_save_CC=$CC
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -9185,7 +9527,7 @@ if test -n "$compiler"; then
 
 lt_prog_compiler_no_builtin_flag=
 
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $cc_basename in
   nvcc*)
     lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
@@ -9201,7 +9543,7 @@ else
   lt_cv_prog_compiler_rtti_exceptions=no
    ac_outfile=conftest.$ac_objext
    echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   lt_compiler_flag="-fno-rtti -fno-exceptions"  ## exclude from sc_useless_quotes_in_assignment
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
@@ -9231,7 +9573,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
-if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then
     lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
 else
     :
@@ -9249,17 +9591,18 @@ lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
 
-  if test "$GCC" = yes; then
+  if test yes = "$GCC"; then
     lt_prog_compiler_wl='-Wl,'
     lt_prog_compiler_static='-static'
 
     case $host_os in
       aix*)
       # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
        # AIX 5 now supports IA64 processor
        lt_prog_compiler_static='-Bstatic'
       fi
+      lt_prog_compiler_pic='-fPIC'
       ;;
 
     amigaos*)
@@ -9270,8 +9613,8 @@ lt_prog_compiler_static=
         ;;
       m68k)
             # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
             lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
         ;;
       esac
@@ -9287,6 +9630,11 @@ lt_prog_compiler_static=
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
       # (--disable-auto-import) libraries
       lt_prog_compiler_pic='-DDLL_EXPORT'
+      case $host_os in
+      os2*)
+       lt_prog_compiler_static='$wl-static'
+       ;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -9357,7 +9705,7 @@ lt_prog_compiler_static=
     case $host_os in
     aix*)
       lt_prog_compiler_wl='-Wl,'
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
        # AIX 5 now supports IA64 processor
        lt_prog_compiler_static='-Bstatic'
       else
@@ -9365,10 +9713,29 @@ lt_prog_compiler_static=
       fi
       ;;
 
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      case $cc_basename in
+      nagfor*)
+        # NAG Fortran compiler
+        lt_prog_compiler_wl='-Wl,-Wl,,'
+        lt_prog_compiler_pic='-PIC'
+        lt_prog_compiler_static='-Bstatic'
+        ;;
+      esac
+      ;;
+
     mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       lt_prog_compiler_pic='-DDLL_EXPORT'
+      case $host_os in
+      os2*)
+       lt_prog_compiler_static='$wl-static'
+       ;;
+      esac
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -9384,7 +9751,7 @@ lt_prog_compiler_static=
        ;;
       esac
       # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      lt_prog_compiler_static='$wl-a ${wl}archive'
       ;;
 
     irix5* | irix6* | nonstopux*)
@@ -9395,12 +9762,18 @@ lt_prog_compiler_static=
 
     linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
+      # old Intel for x86_64, which still supported -KPIC.
       ecc*)
        lt_prog_compiler_wl='-Wl,'
        lt_prog_compiler_pic='-KPIC'
        lt_prog_compiler_static='-static'
         ;;
+      # flang / f18. f95 an alias for gfortran or flang on Debian
+      flang* | f18* | f95*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fPIC'
+       lt_prog_compiler_static='-static'
+        ;;
       # icc used to be incompatible with GCC.
       # ICC 10 doesn't accept -KPIC any more.
       icc* | ifort*)
@@ -9420,6 +9793,12 @@ lt_prog_compiler_static=
        lt_prog_compiler_pic='-PIC'
        lt_prog_compiler_static='-Bstatic'
        ;;
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fPIC'
+       lt_prog_compiler_static='-static'
+       ;;
       pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
        # which looks to be a dead project)
@@ -9517,7 +9896,7 @@ lt_prog_compiler_static=
       ;;
 
     sysv4*MP*)
-      if test -d /usr/nec ;then
+      if test -d /usr/necthen
        lt_prog_compiler_pic='-Kconform_pic'
        lt_prog_compiler_static='-Bstatic'
       fi
@@ -9546,7 +9925,7 @@ lt_prog_compiler_static=
   fi
 
 case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
+  # For platforms that do not support PIC, -DPIC is meaningless:
   *djgpp*)
     lt_prog_compiler_pic=
     ;;
@@ -9578,7 +9957,7 @@ else
   lt_cv_prog_compiler_pic_works=no
    ac_outfile=conftest.$ac_objext
    echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"  ## exclude from sc_useless_quotes_in_assignment
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
@@ -9608,7 +9987,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+if test yes = "$lt_cv_prog_compiler_pic_works"; then
     case $lt_prog_compiler_pic in
      "" | " "*) ;;
      *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
@@ -9640,7 +10019,7 @@ if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
-   save_LDFLAGS="$LDFLAGS"
+   save_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
    echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
@@ -9659,13 +10038,13 @@ else
      fi
    fi
    $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+   LDFLAGS=$save_LDFLAGS
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
 $as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+if test yes = "$lt_cv_prog_compiler_static_works"; then
     :
 else
     lt_prog_compiler_static=
@@ -9785,8 +10164,8 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+hard_links=nottested
+if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then
   # do not overwrite the value of need_locks provided by the user
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
 $as_echo_n "checking if we can lock with hard links... " >&6; }
@@ -9798,9 +10177,9 @@ $as_echo_n "checking if we can lock with hard links... " >&6; }
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
 $as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+  if test no = "$hard_links"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;}
     need_locks=warn
   fi
 else
@@ -9843,9 +10222,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   # included in the symbol list
   include_expsyms=
   # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
+  # it will be wrapped by ' (' and ')$', so one must not match beginning or
+  # end of line.  Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
+  # as well as any symbol that contains 'd'.
   exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
@@ -9860,7 +10239,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       with_gnu_ld=no
     fi
     ;;
@@ -9868,7 +10247,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     # we just hope/assume this is gcc and not c89 (= MSVC++)
     with_gnu_ld=yes
     ;;
-  openbsd*)
+  openbsd* | bitrig*)
     with_gnu_ld=no
     ;;
   linux* | k*bsd*-gnu | gnu*)
@@ -9881,7 +10260,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   # On some targets, GNU ld is compatible enough with the native linker
   # that we're better off using the native interface for both.
   lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     case $host_os in
       aix*)
        # The AIX port of GNU ld has always aspired to compatibility
@@ -9903,24 +10282,24 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     esac
   fi
 
-  if test "$lt_use_gnu_ld_interface" = yes; then
+  if test yes = "$lt_use_gnu_ld_interface"; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
+    wlarc='$wl'
 
     # Set some defaults for GNU ld with shared library support. These
     # are reset later if shared libraries are not supported. Putting them
     # here allows them to be overridden if necessary.
     runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    export_dynamic_flag_spec='${wl}--export-dynamic'
+    hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+    export_dynamic_flag_spec='$wl--export-dynamic'
     # ancient GNU ld didn't support --whole-archive et. al.
     if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
     else
       whole_archive_flag_spec=
     fi
     supports_anon_versioning=no
-    case `$LD -v 2>&1` in
+    case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in
       *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
@@ -9933,7 +10312,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     case $host_os in
     aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
+      if test ia64 != "$host_cpu"; then
        ld_shlibs=no
        cat <<_LT_EOF 1>&2
 
@@ -9952,7 +10331,7 @@ _LT_EOF
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             archive_expsym_cmds=''
         ;;
       m68k)
@@ -9968,7 +10347,7 @@ _LT_EOF
        allow_undefined_flag=unsupported
        # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
        # support --undefined.  This deserves some investigation.  FIXME
-       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       else
        ld_shlibs=no
       fi
@@ -9978,7 +10357,7 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
-      export_dynamic_flag_spec='${wl}--export-all-symbols'
+      export_dynamic_flag_spec='$wl--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
@@ -9986,61 +10365,89 @@ _LT_EOF
       exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-       # If the export-symbols file already is a .def file (1st line
-       # is EXPORTS), use it as is; otherwise, prepend...
-       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-         cp $export_symbols $output_objdir/$soname.def;
-       else
-         echo EXPORTS > $output_objdir/$soname.def;
-         cat $export_symbols >> $output_objdir/$soname.def;
-       fi~
-       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file, use it as
+       # is; otherwise, prepend EXPORTS...
+       archive_expsym_cmds='if   test DEF = "`$SED -n     -e '\''s/^[   ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([     ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+          cp $export_symbols $output_objdir/$soname.def;
+        else
+          echo EXPORTS > $output_objdir/$soname.def;
+          cat $export_symbols >> $output_objdir/$soname.def;
+        fi~
+        $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
       else
        ld_shlibs=no
       fi
       ;;
 
     haiku*)
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       link_all_deplibs=yes
       ;;
 
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      shrext_cmds=.dll
+      archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec='${wl}-E'
+      hardcode_libdir_flag_spec='$wl-rpath,$libdir'
+      export_dynamic_flag_spec='$wl-E'
       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
       # Instead, shared libraries are loaded at an image base (0x10000000 by
       # default) and relocated if they conflict, which is a slow very memory
       # consuming and fragmenting process.  To avoid this, we pick a random,
       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
     gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
+      if test linux-dietlibc = "$host_os"; then
        case $cc_basename in
          diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
        esac
       fi
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-        && test "$tmp_diet" = no
+        && test no = "$tmp_diet"
       then
        tmp_addflag=' $pic_flag'
        tmp_sharedflag='-shared'
        case $cc_basename,$host_cpu in
         pgcc*)                         # Portland Group C compiler
-         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          tmp_addflag=' $pic_flag'
          ;;
        pgf77* | pgf90* | pgf95* | pgfortran*)
                                        # Portland Group f77 and f90 compilers
-         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          tmp_addflag=' $pic_flag -Mnomain' ;;
        ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
          tmp_addflag=' -i_dynamic' ;;
@@ -10051,42 +10458,47 @@ _LT_EOF
        lf95*)                          # Lahey Fortran 8.1
          whole_archive_flag_spec=
          tmp_sharedflag='--shared' ;;
+        nagfor*)                        # NAGFOR 5.3
+          tmp_sharedflag='-Wl,-shared' ;;
        xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
          tmp_sharedflag='-qmkshrobj'
          tmp_addflag= ;;
        nvcc*)  # Cuda Compiler Driver 2.2
-         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          compiler_needs_object=yes
          ;;
        esac
        case `$CC -V 2>&1 | sed 5q` in
        *Sun\ C*)                       # Sun C 5.9
-         whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          compiler_needs_object=yes
          tmp_sharedflag='-G' ;;
        *Sun\ F*)                       # Sun Fortran 8.3
          tmp_sharedflag='-G' ;;
        esac
-       archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
 
-        if test "x$supports_anon_versioning" = xyes; then
+        if test yes = "$supports_anon_versioning"; then
           archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-           echo "local: *; };" >> $output_objdir/$libname.ver~
-           $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+            cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+            echo "local: *; };" >> $output_objdir/$libname.ver~
+            $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
         fi
 
        case $cc_basename in
+       tcc*)
+         export_dynamic_flag_spec='-rdynamic'
+         ;;
        xlf* | bgf* | bgxlf* | mpixlf*)
          # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
          whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-         hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+         hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
          archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-         if test "x$supports_anon_versioning" = xyes; then
+         if test yes = "$supports_anon_versioning"; then
            archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-             cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-             echo "local: *; };" >> $output_objdir/$libname.ver~
-             $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+              echo "local: *; };" >> $output_objdir/$libname.ver~
+              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
          fi
          ;;
        esac
@@ -10100,8 +10512,8 @@ _LT_EOF
        archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
        wlarc=
       else
-       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -10119,8 +10531,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
        ld_shlibs=no
       fi
@@ -10132,7 +10544,7 @@ _LT_EOF
        ld_shlibs=no
        cat <<_LT_EOF 1>&2
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
 *** reliably create shared libraries on SCO systems.  Therefore, libtool
 *** is disabling shared libraries support.  We urge you to upgrade GNU
 *** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
@@ -10147,9 +10559,9 @@ _LT_EOF
          # DT_RUNPATH tag from executables and libraries.  But doing so
          # requires that you compile everything twice, which is a pain.
          if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-           hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-           archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-           archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+           hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+           archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+           archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
          else
            ld_shlibs=no
          fi
@@ -10166,15 +10578,15 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
        ld_shlibs=no
       fi
       ;;
     esac
 
-    if test "$ld_shlibs" = no; then
+    if test no = "$ld_shlibs"; then
       runpath_var=
       hardcode_libdir_flag_spec=
       export_dynamic_flag_spec=
@@ -10190,7 +10602,7 @@ _LT_EOF
       # Note: this linker hardcodes the directories in LIBPATH if there
       # are no directories specified by -L.
       hardcode_minus_L=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+      if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
        # Neither direct hardcoding nor static linking is supported with a
        # broken collect2.
        hardcode_direct=unsupported
@@ -10198,34 +10610,57 @@ _LT_EOF
       ;;
 
     aix[4-9]*)
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
        # On IA64, the linker does run time linking by default, so we don't
        # have to do anything special.
        aix_use_runtimelinking=no
        exp_sym_flag='-Bexport'
-       no_entry_flag=""
+       no_entry_flag=
       else
        # If we're using GNU nm, then we don't want the "-C" option.
-       # -C means demangle to AIX nm, but means don't demangle with GNU nm
-       # Also, AIX nm treats weak defined symbols like other global
-       # defined symbols, whereas GNU nm marks them as "W".
+       # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+       # Without the "-l" option, or with the "-B" option, AIX nm treats
+       # weak defined symbols like other global defined symbols, whereas
+       # GNU nm marks them as "W".
+       # While the 'weak' keyword is ignored in the Export File, we need
+       # it in the Import File for the 'aix-soname' feature, so we have
+       # to replace the "-B" option with "-P" for AIX nm.
        if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
        else
-         export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+         export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
        fi
        aix_use_runtimelinking=no
 
        # Test if we are trying to use run time linking or normal
        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-       # need to do runtime linking.
+       # have runtime linking enabled, and use it for executables.
+       # For shared libraries, we enable/disable runtime linking
+       # depending on the kind of the shared library created -
+       # when "with_aix_soname,aix_use_runtimelinking" is:
+       # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "aix,yes"  lib.so          shared, rtl:yes, for executables
+       #            lib.a           static archive
+       # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+       #            lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a(lib.so.V) shared, rtl:no
+       # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a           static archive
        case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
          for ld_flag in $LDFLAGS; do
-         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+         if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
            aix_use_runtimelinking=yes
            break
          fi
          done
+         if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+           # With aix-soname=svr4, we create the lib.so.V shared archives only,
+           # so we don't have lib.a shared libs to link our executables.
+           # We have to force runtime linking in this case.
+           aix_use_runtimelinking=yes
+           LDFLAGS="$LDFLAGS -Wl,-brtl"
+         fi
          ;;
        esac
 
@@ -10244,13 +10679,21 @@ _LT_EOF
       hardcode_direct_absolute=yes
       hardcode_libdir_separator=':'
       link_all_deplibs=yes
-      file_list_spec='${wl}-f,'
+      file_list_spec='$wl-f,'
+      case $with_aix_soname,$aix_use_runtimelinking in
+      aix,*) ;; # traditional, no import file
+      svr4,* | *,yes) # use import file
+       # The Import File defines what to hardcode.
+       hardcode_direct=no
+       hardcode_direct_absolute=no
+       ;;
+      esac
 
-      if test "$GCC" = yes; then
+      if test yes = "$GCC"; then
        case $host_os in aix4.[012]|aix4.[012].*)
        # We only want to do this on AIX 4.2 and lower, the check
        # below for broken collect2 doesn't work under 4.3+
-         collect2name=`${CC} -print-prog-name=collect2`
+         collect2name=`$CC -print-prog-name=collect2`
          if test -f "$collect2name" &&
           strings "$collect2name" | $GREP resolve_lib_name >/dev/null
          then
@@ -10269,36 +10712,42 @@ _LT_EOF
          ;;
        esac
        shared_flag='-shared'
-       if test "$aix_use_runtimelinking" = yes; then
-         shared_flag="$shared_flag "'${wl}-G'
+       if test yes = "$aix_use_runtimelinking"; then
+         shared_flag="$shared_flag "'$wl-G'
        fi
-       link_all_deplibs=no
+       # Need to ensure runtime linking is disabled for the traditional
+       # shared library, or the linker may eventually find shared libraries
+       # /with/ Import File - we do not want to mix them.
+       shared_flag_aix='-shared'
+       shared_flag_svr4='-shared $wl-G'
       else
        # not using gcc
-       if test "$host_cpu" = ia64; then
+       if test ia64 = "$host_cpu"; then
        # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
        # chokes on -Wl,-G. The following line is correct:
          shared_flag='-G'
        else
-         if test "$aix_use_runtimelinking" = yes; then
-           shared_flag='${wl}-G'
+         if test yes = "$aix_use_runtimelinking"; then
+           shared_flag='$wl-G'
          else
-           shared_flag='${wl}-bM:SRE'
+           shared_flag='$wl-bM:SRE'
          fi
+         shared_flag_aix='$wl-bM:SRE'
+         shared_flag_svr4='$wl-G'
        fi
       fi
 
-      export_dynamic_flag_spec='${wl}-bexpall'
+      export_dynamic_flag_spec='$wl-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       always_export_symbols=yes
-      if test "$aix_use_runtimelinking" = yes; then
+      if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
        # Warning - without using the other runtime loading flags (-brtl),
        # -berok will link without error, but may produce a broken library.
        allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        if test "${lt_cv_aix_libpath+set}" = set; then
+        if test set = "${lt_cv_aix_libpath+set}"; then
   aix_libpath=$lt_cv_aix_libpath
 else
   if ${lt_cv_aix_libpath_+:} false; then :
@@ -10333,7 +10782,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
   if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
+    lt_cv_aix_libpath_=/usr/lib:/lib
   fi
 
 fi
   aix_libpath=$lt_cv_aix_libpath_
 fi
 
-        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
       else
-       if test "$host_cpu" = ia64; then
-         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+       if test ia64 = "$host_cpu"; then
+         hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib'
          allow_undefined_flag="-z nodefs"
-         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
        else
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        if test "${lt_cv_aix_libpath+set}" = set; then
+        if test set = "${lt_cv_aix_libpath+set}"; then
   aix_libpath=$lt_cv_aix_libpath
 else
   if ${lt_cv_aix_libpath_+:} false; then :
@@ -10386,7 +10835,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
   if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
+    lt_cv_aix_libpath_=/usr/lib:/lib
   fi
 
 fi
   aix_libpath=$lt_cv_aix_libpath_
 fi
 
-        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
          # Warning - without using the other run time loading flags,
          # -berok will link without error, but may produce a broken library.
-         no_undefined_flag=' ${wl}-bernotok'
-         allow_undefined_flag=' ${wl}-berok'
-         if test "$with_gnu_ld" = yes; then
+         no_undefined_flag=' $wl-bernotok'
+         allow_undefined_flag=' $wl-berok'
+         if test yes = "$with_gnu_ld"; then
            # We only use this code for GNU lds that support --whole-archive.
-           whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive'
          else
            # Exported symbols can be pulled into shared objects from archives
            whole_archive_flag_spec='$convenience'
          fi
          archive_cmds_need_lc=yes
-         # This is similar to how AIX traditionally builds its shared libraries.
-         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+         archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+         # -brtl affects multiple linker settings, -berok does not and is overridden later
+         compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
+         if test svr4 != "$with_aix_soname"; then
+           # This is similar to how AIX traditionally builds its shared libraries.
+           archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+         fi
+         if test aix != "$with_aix_soname"; then
+           archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+         else
+           # used by -dlpreopen to get the symbols
+           archive_expsym_cmds="$archive_expsym_cmds"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+         fi
+         archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d'
        fi
       fi
       ;;
@@ -10417,7 +10878,7 @@ fi
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             archive_expsym_cmds=''
         ;;
       m68k)
        # Tell ltmain to make .lib files, not .a files.
        libext=lib
        # Tell ltmain to make .dll files, not .so files.
-       shrext_cmds=".dll"
+       shrext_cmds=.dll
        # FIXME: Setting linknames here is a bad hack.
-       archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-           sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-         else
-           sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-         fi~
-         $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-         linknames='
+       archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+       archive_expsym_cmds='if   test DEF = "`$SED -n     -e '\''s/^[   ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([     ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+            cp "$export_symbols" "$output_objdir/$soname.def";
+            echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+          else
+            $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+          fi~
+          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+          linknames='
        # The linker will not automatically build a static lib if we build a DLL.
        # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
        enable_shared_with_static_runtimes=yes
        # Don't use ranlib
        old_postinstall_cmds='chmod 644 $oldlib'
        postlink_cmds='lt_outputfile="@OUTPUT@"~
-         lt_tool_outputfile="@TOOL_OUTPUT@"~
-         case $lt_outputfile in
-           *.exe|*.EXE) ;;
-           *)
-             lt_outputfile="$lt_outputfile.exe"
-             lt_tool_outputfile="$lt_tool_outputfile.exe"
-             ;;
-         esac~
-         if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-           $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-           $RM "$lt_outputfile.manifest";
-         fi'
+          lt_tool_outputfile="@TOOL_OUTPUT@"~
+          case $lt_outputfile in
+            *.exe|*.EXE) ;;
+            *)
+              lt_outputfile=$lt_outputfile.exe
+              lt_tool_outputfile=$lt_tool_outputfile.exe
+              ;;
+          esac~
+          if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+            $RM "$lt_outputfile.manifest";
+          fi'
        ;;
       *)
        # Assume MSVC wrapper
@@ -10485,7 +10947,7 @@ fi
        # Tell ltmain to make .lib files, not .a files.
        libext=lib
        # Tell ltmain to make .dll files, not .so files.
-       shrext_cmds=".dll"
+       shrext_cmds=.dll
        # FIXME: Setting linknames here is a bad hack.
        archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
        # The linker will automatically build a .lib file if we build a DLL.
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  if test yes = "$lt_cv_ld_force_load"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
 
   else
     whole_archive_flag_spec=''
   fi
   link_all_deplibs=yes
-  allow_undefined_flag="$_lt_dar_allow_undefined"
+  allow_undefined_flag=$_lt_dar_allow_undefined
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
-  if test "$_lt_dar_can_shared" = "yes"; then
+  if test yes = "$_lt_dar_can_shared"; then
     output_verbose_link_cmd=func_echo_all
-    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
+    archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+    module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
 
   else
   ld_shlibs=no
       ;;
 
     hpux9*)
-      if test "$GCC" = yes; then
-       archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      if test yes = "$GCC"; then
+       archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       else
-       archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+       archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       fi
-      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl+b $wl$libdir'
       hardcode_libdir_separator=:
       hardcode_direct=yes
 
       # hardcode_minus_L: Not really in the search PATH,
       # but as the default location of the library.
       hardcode_minus_L=yes
-      export_dynamic_flag_spec='${wl}-E'
+      export_dynamic_flag_spec='$wl-E'
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-       archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+       archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
        archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
-      if test "$with_gnu_ld" = no; then
-       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+       hardcode_libdir_flag_spec='$wl+b $wl$libdir'
        hardcode_libdir_separator=:
        hardcode_direct=yes
        hardcode_direct_absolute=yes
-       export_dynamic_flag_spec='${wl}-E'
+       export_dynamic_flag_spec='$wl-E'
        # hardcode_minus_L: Not really in the search PATH,
        # but as the default location of the library.
        hardcode_minus_L=yes
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test yes,no = "$GCC,$with_gnu_ld"; then
        case $host_cpu in
        hppa*64*)
-         archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        ia64*)
-         archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
-         archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        esac
       else
        case $host_cpu in
        hppa*64*)
-         archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        ia64*)
-         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
 
@@ -10627,7 +11089,7 @@ if ${lt_cv_prog_compiler__b+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler__b=no
-   save_LDFLAGS="$LDFLAGS"
+   save_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS -b"
    echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
@@ -10646,14 +11108,14 @@ else
      fi
    fi
    $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+   LDFLAGS=$save_LDFLAGS
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
 $as_echo "$lt_cv_prog_compiler__b" >&6; }
 
-if test x"$lt_cv_prog_compiler__b" = xyes; then
-    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+if test yes = "$lt_cv_prog_compiler__b"; then
+    archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 else
     archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
 fi
@@ -10661,8 +11123,8 @@ fi
          ;;
        esac
       fi
-      if test "$with_gnu_ld" = no; then
-       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+       hardcode_libdir_flag_spec='$wl+b $wl$libdir'
        hardcode_libdir_separator=:
 
        case $host_cpu in
@@ -10673,7 +11135,7 @@ fi
        *)
          hardcode_direct=yes
          hardcode_direct_absolute=yes
-         export_dynamic_flag_spec='${wl}-E'
+         export_dynamic_flag_spec='$wl-E'
 
          # hardcode_minus_L: Not really in the search PATH,
          # but as the default location of the library.
@@ -10684,8 +11146,8 @@ fi
       ;;
 
     irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+       archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
        # Try to use the -exported_symbol ld option, if it does not
        # work, assume that -exports_file does not work either and
        # implicitly export all symbols.
@@ -10695,8 +11157,8 @@ $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >
 if ${lt_cv_irix_exported_symbol+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  save_LDFLAGS="$LDFLAGS"
-          LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+  save_LDFLAGS=$LDFLAGS
+          LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 int foo (void) { return 0; }
@@ -10708,24 +11170,35 @@ else
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-           LDFLAGS="$save_LDFLAGS"
+           LDFLAGS=$save_LDFLAGS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
 $as_echo "$lt_cv_irix_exported_symbol" >&6; }
-       if test "$lt_cv_irix_exported_symbol" = yes; then
-          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+       if test yes = "$lt_cv_irix_exported_symbol"; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
        fi
+       link_all_deplibs=no
       else
-       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       hardcode_libdir_separator=:
       inherit_rpath=yes
       link_all_deplibs=yes
       ;;
 
+    linux*)
+      case $cc_basename in
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       ld_shlibs=yes
+       archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      esac
+      ;;
+
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
@@ -10740,7 +11213,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
     newsos6)
       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       hardcode_libdir_separator=:
       hardcode_shlibpath_var=no
       ;;
@@ -10748,27 +11221,19 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
     *nto* | *qnx*)
       ;;
 
-    openbsd*)
+    openbsd* | bitrig*)
       if test -f /usr/libexec/ld.so; then
        hardcode_direct=yes
        hardcode_shlibpath_var=no
        hardcode_direct_absolute=yes
-       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
          archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-         archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-         hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-         export_dynamic_flag_spec='${wl}-E'
+         archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
+         hardcode_libdir_flag_spec='$wl-rpath,$libdir'
+         export_dynamic_flag_spec='$wl-E'
        else
-         case $host_os in
-          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-            archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-            hardcode_libdir_flag_spec='-R$libdir'
-            ;;
-          *)
-            archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-            ;;
-         esac
+         archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         hardcode_libdir_flag_spec='$wl-rpath,$libdir'
        fi
       else
        ld_shlibs=no
@@ -10779,33 +11244,53 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      shrext_cmds=.dll
+      archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      enable_shared_with_static_runtimes=yes
       ;;
 
     osf3*)
-      if test "$GCC" = yes; then
-       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+       allow_undefined_flag=' $wl-expect_unresolved $wl\*'
+       archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
       else
        allow_undefined_flag=' -expect_unresolved \*'
-       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       hardcode_libdir_separator=:
       ;;
 
     osf4* | osf5*)     # as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-       archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      if test yes = "$GCC"; then
+       allow_undefined_flag=' $wl-expect_unresolved $wl\*'
+       archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+       hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       else
        allow_undefined_flag=' -expect_unresolved \*'
-       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
        archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+          $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
 
        # Both c and cxx compiler support -rpath directly
        hardcode_libdir_flag_spec='-rpath $libdir'
@@ -10816,24 +11301,24 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
 
     solaris*)
       no_undefined_flag=' -z defs'
-      if test "$GCC" = yes; then
-       wlarc='${wl}'
-       archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+       wlarc='$wl'
+       archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
        archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+          $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
        case `$CC -V 2>&1` in
        *"Compilers 5.0"*)
          wlarc=''
-         archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
          archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+            $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
          ;;
        *)
-         wlarc='${wl}'
-         archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         wlarc='$wl'
+         archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
          archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+            $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
          ;;
        esac
       fi
@@ -10843,11 +11328,11 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       solaris2.[0-5] | solaris2.[0-5].*) ;;
       *)
        # The compiler driver will combine and reorder linker options,
-       # but understands `-z linker_flag'.  GCC discards it without `$wl',
+       # but understands '-z linker_flag'.  GCC discards it without '$wl',
        # but is careful enough not to reorder.
        # Supported since Solaris 2.6 (maybe 2.5.1?)
-       if test "$GCC" = yes; then
-         whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+       if test yes = "$GCC"; then
+         whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
        else
          whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
        fi
@@ -10857,10 +11342,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       ;;
 
     sunos4*)
-      if test "x$host_vendor" = xsequent; then
+      if test sequent = "$host_vendor"; then
        # Use $CC to link under sequent, because it throws in some extra .o
        # files that make .init and .fini sections work.
-       archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
       else
        archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -10909,43 +11394,43 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       ;;
 
     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag='${wl}-z,text'
+      no_undefined_flag='$wl-z,text'
       archive_cmds_need_lc=no
       hardcode_shlibpath_var=no
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+       archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
     sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
+      # Note: We CANNOT use -z defs as we might desire, because we do not
       # link with -lc, and that would cause any symbols used from libc to
       # always be unresolved, which means just about no library would
       # ever link correctly.  If we're not using GNU ld we use -z text
       # though, which does catch some bad symbols but isn't as heavy-handed
       # as -z defs.
-      no_undefined_flag='${wl}-z,text'
-      allow_undefined_flag='${wl}-z,nodefs'
+      no_undefined_flag='$wl-z,text'
+      allow_undefined_flag='$wl-z,nodefs'
       archive_cmds_need_lc=no
       hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_flag_spec='$wl-R,$libdir'
       hardcode_libdir_separator=':'
       link_all_deplibs=yes
-      export_dynamic_flag_spec='${wl}-Bexport'
+      export_dynamic_flag_spec='$wl-Bexport'
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+       archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
@@ -10960,10 +11445,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       ;;
     esac
 
-    if test x$host_vendor = xsni; then
+    if test sni = "$host_vendor"; then
       case $host in
       sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-       export_dynamic_flag_spec='${wl}-Blargedynsym'
+       export_dynamic_flag_spec='$wl-Blargedynsym'
        ;;
       esac
     fi
@@ -10971,7 +11456,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
 $as_echo "$ld_shlibs" >&6; }
-test "$ld_shlibs" = no && can_build_shared=no
+test no = "$ld_shlibs" && can_build_shared=no
 
 with_gnu_ld=$with_gnu_ld
 
@@ -10997,7 +11482,7 @@ x|xyes)
   # Assume -lc should be added
   archive_cmds_need_lc=yes
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
+  if test yes,yes = "$GCC,$enable_shared"; then
     case $archive_cmds in
     *'~'*)
       # FIXME: we may have to deal with multi-command sequences.
@@ -11212,14 +11697,14 @@ esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
+    darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
+    *) lt_awk_arg='/^libraries:/' ;;
   esac
   case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
+    mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;;
+    *) lt_sed_strip_eq='s|=/|/|g' ;;
   esac
   lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
   case $lt_search_path_spec in
@@ -11235,28 +11720,35 @@ if test "$GCC" = yes; then
     ;;
   esac
   # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
+  # and add multilib dir if necessary...
   lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  # ...but if some path component already ends with the multilib dir we assume
+  # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
+  case "$lt_multi_os_dir; $lt_search_path_spec " in
+  "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
+    lt_multi_os_dir=
+    ;;
+  esac
   for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
+    if test -d "$lt_sys_path$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
+    elif test -n "$lt_multi_os_dir"; then
       test -d "$lt_sys_path" && \
        lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
   lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
+BEGIN {RS = " "; FS = "/|\n";} {
+  lt_foo = "";
+  lt_count = 0;
   for (lt_i = NF; lt_i > 0; lt_i--) {
     if ($lt_i != "" && $lt_i != ".") {
       if ($lt_i == "..") {
         lt_count++;
       } else {
         if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
+          lt_foo = "/" $lt_i lt_foo;
         } else {
           lt_count--;
         }
@@ -11270,7 +11762,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   # for these hosts.
   case $host_os in
     mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+      $SED 's|/\([A-Za-z]:\)|\1|g'` ;;
   esac
   sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
@@ -11279,7 +11771,7 @@ fi
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
-shrext_cmds=".so"
+shrext_cmds=.so
 postinstall_cmds=
 postuninstall_cmds=
 finish_cmds=
@@ -11296,14 +11788,16 @@ hardcode_into_libs=no
 # flags to be left without arguments
 need_version=unknown
 
+
+
 case $host_os in
 aix3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
   # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
+  soname_spec='$libname$release$shared_ext$major'
   ;;
 
 aix[4-9]*)
@@ -11311,41 +11805,91 @@ aix[4-9]*)
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
     shlibpath_var=LD_LIBRARY_PATH
   else
     # With GCC up to 2.95.x, collect2 would create an import file
     # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
+    # the line '#! .'.  This would cause the generated library to
+    # depend on '.', always an invalid library.  This was fixed in
     # development snapshots of GCC prior to 3.0.
     case $host_os in
       aix4 | aix4.[01] | aix4.[01].*)
       if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
           echo ' yes '
-          echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+          echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
        :
       else
        can_build_shared=no
       fi
       ;;
     esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # Using Import Files as archive members, it is possible to support
+    # filename-based versioning of shared library archives on AIX. While
+    # this would work for both with and without runtime linking, it will
+    # prevent static linking of such archives. So we do filename-based
+    # shared library versioning with .so extension only, which is used
+    # when both runtime linking and shared linking is enabled.
+    # Unfortunately, runtime linking may impact performance, so we do
+    # not want this to be the default eventually. Also, we use the
+    # versioned .so libs for executables only if there is the -brtl
+    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # To allow for filename-based versioning support, we need to create
+    # libNAME.so.V as an archive file, containing:
+    # *) an Import File, referring to the versioned filename of the
+    #    archive as well as the shared archive member, telling the
+    #    bitwidth (32 or 64) of that shared object, and providing the
+    #    list of exported symbols of that shared object, eventually
+    #    decorated with the 'weak' keyword
+    # *) the shared object with the F_LOADONLY flag set, to really avoid
+    #    it being seen by the linker.
+    # At run time we better use the real file rather than another symlink,
+    # but for link time we create the symlink libNAME.so -> libNAME.so.V
+
+    case $with_aix_soname,$aix_use_runtimelinking in
+    # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
     # soname into executable. Probably we can add versioning support to
     # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
+    aix,yes) # traditional libtool
+      dynamic_linker='AIX unversionable lib.so'
       # If using run time linking (on AIX 4.2 or later) use lib<name>.so
       # instead of lib<name>.a to let people know that these are not
       # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      ;;
+    aix,no) # traditional AIX only
+      dynamic_linker='AIX lib.a(lib.so.V)'
       # We preserve .a as extension for shared libraries through AIX4.2
       # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      ;;
+    svr4,*) # full svr4 only
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,yes) # both, prefer svr4
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # unpreferred sharedlib libNAME.a needs extra handling
+      postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
+      postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,no) # both, prefer aix
+      dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
+      postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
+      postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
+      ;;
+    esac
     shlibpath_var=LIBPATH
   fi
   ;;
@@ -11355,18 +11899,18 @@ amigaos*)
   powerpc)
     # Since July 2007 AmigaOS4 officially supports .so libraries.
     # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
     ;;
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
 
 beos*)
-  library_names_spec='${libname}${shared_ext}'
+  library_names_spec='$libname$shared_ext'
   dynamic_linker="$host_os ld.so"
   shlibpath_var=LIBRARY_PATH
   ;;
@@ -11374,8 +11918,8 @@ beos*)
 bsdi[45]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
@@ -11387,7 +11931,7 @@ bsdi[45]*)
 
 cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
-  shrext_cmds=".dll"
+  shrext_cmds=.dll
   need_version=no
   need_lib_prefix=no
 
@@ -11396,8 +11940,8 @@ cygwin* | mingw* | pw32* | cegcc*)
     # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname~
@@ -11413,17 +11957,17 @@ cygwin* | mingw* | pw32* | cegcc*)
     case $host_os in
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
 
       sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
       ;;
     esac
     dynamic_linker='Win32 ld.exe'
@@ -11432,8 +11976,8 @@ cygwin* | mingw* | pw32* | cegcc*)
   *,cl*)
     # Native MSVC
     libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
+    soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+    library_names_spec='$libname.dll.lib'
 
     case $build_os in
     mingw*)
@@ -11460,7 +12004,7 @@ cygwin* | mingw* | pw32* | cegcc*)
       sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
       ;;
     *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=$LIB
       if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
         # It is most probably a Windows format PATH.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
@@ -11473,8 +12017,8 @@ cygwin* | mingw* | pw32* | cegcc*)
     esac
 
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname'
@@ -11487,7 +12031,7 @@ cygwin* | mingw* | pw32* | cegcc*)
 
   *)
     # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib'
     dynamic_linker='Win32 ld.exe'
     ;;
   esac
@@ -11500,8 +12044,8 @@ darwin* | rhapsody*)
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
+  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$major$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
@@ -11514,8 +12058,8 @@ dgux*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -11533,12 +12077,13 @@ freebsd* | dragonfly*)
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
     freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
       need_version=yes
       ;;
   esac
@@ -11568,10 +12113,10 @@ haiku*)
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=no
   sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
@@ -11589,14 +12134,15 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.so"
     shlibpath_var=LD_LIBRARY_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    if test 32 = "$HPUX_IA64_MODE"; then
       sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
     else
       sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
     fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   hppa*64*)
     shrext_cmds='.sl'
@@ -11604,8 +12150,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
@@ -11614,8 +12160,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=SHLIB_PATH
     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     ;;
   esac
   # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
@@ -11628,8 +12174,8 @@ interix[3-9]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
@@ -11640,7 +12186,7 @@ irix5* | irix6* | nonstopux*)
   case $host_os in
     nonstopux*) version_type=nonstopux ;;
     *)
-       if test "$lt_cv_prog_gnu_ld" = yes; then
+       if test yes = "$lt_cv_prog_gnu_ld"; then
                version_type=linux # correct to gnu/linux during the next big refactor
        else
                version_type=irix
@@ -11648,8 +12194,8 @@ irix5* | irix6* | nonstopux*)
   esac
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
   case $host_os in
   irix5* | nonstopux*)
     libsuff= shlibsuff=
@@ -11668,8 +12214,8 @@ irix5* | irix6* | nonstopux*)
   esac
   shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
   shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
+  sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
   hardcode_into_libs=yes
   ;;
 
@@ -11678,13 +12224,33 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
+linux*android*)
+  version_type=none # Android doesn't support versioned libraries.
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext'
+  soname_spec='$libname$release$shared_ext'
+  finish_cmds=
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  dynamic_linker='Android linker'
+  # Don't embed -rpath directories since the linker doesn't support them.
+  hardcode_libdir_flag_spec='-L$libdir'
+  ;;
+
 # This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) to the search path.
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[      ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
@@ -11760,12 +12331,12 @@ netbsd*)
   need_lib_prefix=no
   need_version=no
   if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
   else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     dynamic_linker='NetBSD ld.elf_so'
   fi
   shlibpath_var=LD_LIBRARY_PATH
@@ -11775,7 +12346,7 @@ netbsd*)
 
 newsos6)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   ;;
@@ -11784,58 +12355,68 @@ newsos6)
   version_type=qnx
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   dynamic_linker='ldqnx.so'
   ;;
 
-openbsd*)
+openbsd* | bitrig*)
   version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
+  sys_lib_dlsearch_path_spec=/usr/lib
   need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-       shlibpath_overrides_runpath=no
-       ;;
-      *)
-       shlibpath_overrides_runpath=yes
-       ;;
-      esac
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    need_version=no
   else
-    shlibpath_overrides_runpath=yes
+    need_version=yes
   fi
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
   ;;
 
 os2*)
   libname_spec='$name'
-  shrext_cmds=".dll"
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
   need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
+  # OS/2 can only load a DLL with a base name of 8 characters or less.
+  soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
+    v=$($ECHO $release$versuffix | tr -d .-);
+    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
+    $ECHO $n$v`$shared_ext'
+  library_names_spec='${libname}_dll.$libext'
   dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
+  shlibpath_var=BEGINLIBPATH
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  postinstall_cmds='base_file=`basename \$file`~
+    dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
+    dldir=$destdir/`dirname \$dlpath`~
+    test -d \$dldir || mkdir -p \$dldir~
+    $install_prog $dir/$dlname \$dldir/$dlname~
+    chmod a+x \$dldir/$dlname~
+    if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+      eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+    fi'
+  postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+    dlpath=$dir/\$dldll~
+    $RM \$dlpath'
   ;;
 
 osf3* | osf4* | osf5*)
   version_type=osf
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
   ;;
 
 rdos*)
@@ -11846,8 +12427,8 @@ solaris*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
@@ -11857,11 +12438,11 @@ solaris*)
 
 sunos4*)
   version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
   finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     need_lib_prefix=no
   fi
   need_version=yes
@@ -11869,8 +12450,8 @@ sunos4*)
 
 sysv4 | sysv4.3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   case $host_vendor in
     sni)
@@ -11891,24 +12472,24 @@ sysv4 | sysv4.3*)
   ;;
 
 sysv4*MP*)
-  if test -d /usr/nec ;then
+  if test -d /usr/necthen
     version_type=linux # correct to gnu/linux during the next big refactor
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
+    library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
+    soname_spec='$libname$shared_ext.$major'
     shlibpath_var=LD_LIBRARY_PATH
   fi
   ;;
 
 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
+  version_type=sco
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
   else
     sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
@@ -11926,7 +12507,7 @@ tpf*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -11934,8 +12515,8 @@ tpf*)
 
 uts4*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -11945,20 +12526,35 @@ uts4*)
 esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
 $as_echo "$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
+test no = "$dynamic_linker" && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
+  sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
 fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
+  sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
 
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
+
+
+
+
+
 
 
 
@@ -12055,15 +12651,15 @@ $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" ||
    test -n "$runpath_var" ||
-   test "X$hardcode_automatic" = "Xyes" ; then
+   test yes = "$hardcode_automatic"; then
 
   # We can hardcode non-existent directories.
-  if test "$hardcode_direct" != no &&
+  if test no != "$hardcode_direct" &&
      # If the only mechanism to avoid hardcoding is shlibpath_var, we
      # have to relink, otherwise we might link with an installed library
      # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
-     test "$hardcode_minus_L" != no; then
+     ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" &&
+     test no != "$hardcode_minus_L"; then
     # Linking always hardcodes the temporary library directory.
     hardcode_action=relink
   else
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
 $as_echo "$hardcode_action" >&6; }
 
-if test "$hardcode_action" = relink ||
-   test "$inherit_rpath" = yes; then
+if test relink = "$hardcode_action" ||
+   test yes = "$inherit_rpath"; then
   # Fast installation is not supported
   enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
+elif test yes = "$shlibpath_overrides_runpath" ||
+     test no = "$enable_shared"; then
   # Fast installation is not necessary
   enable_fast_install=needless
 fi
@@ -12093,7 +12689,7 @@ fi
 
 
 
-  if test "x$enable_dlopen" != xyes; then
+  if test yes != "$enable_dlopen"; then
   enable_dlopen=unknown
   enable_dlopen_self=unknown
   enable_dlopen_self_static=unknown
@@ -12103,23 +12699,23 @@ else
 
   case $host_os in
   beos*)
-    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen=load_add_on
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
     ;;
 
   mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen=LoadLibrary
     lt_cv_dlopen_libs=
     ;;
 
   cygwin*)
-    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen=dlopen
     lt_cv_dlopen_libs=
     ;;
 
   darwin*)
-  # if libdl is installed we need to link against it
+    # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
 if ${ac_cv_lib_dl_dlopen+:} false; then :
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
 else
 
-    lt_cv_dlopen="dyld"
+    lt_cv_dlopen=dyld
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
 
 
     ;;
 
+  tpf*)
+    # Don't try to run any link tests for TPF.  We know it's impossible
+    # because TPF is a cross-compiler, and we know how we open DSOs.
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=no
+    ;;
+
   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
 if test "x$ac_cv_func_shl_load" = xyes; then :
-  lt_cv_dlopen="shl_load"
+  lt_cv_dlopen=shl_load
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
 if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
-  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+  lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld
 else
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
 if test "x$ac_cv_func_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen"
+  lt_cv_dlopen=dlopen
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
@@ -12253,7 +12857,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
@@ -12292,7 +12896,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
 if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
@@ -12331,7 +12935,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
 if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
-  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+  lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld
 fi
 
 
     ;;
   esac
 
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
+  if test no = "$lt_cv_dlopen"; then
     enable_dlopen=no
+  else
+    enable_dlopen=yes
   fi
 
   case $lt_cv_dlopen in
   dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+    save_CPPFLAGS=$CPPFLAGS
+    test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-    save_LDFLAGS="$LDFLAGS"
+    save_LDFLAGS=$LDFLAGS
     wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    save_LIBS="$LIBS"
+    save_LIBS=$LIBS
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
@@ -12374,7 +12978,7 @@ $as_echo_n "checking whether a program can dlopen itself... " >&6; }
 if ${lt_cv_dlopen_self+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-         if test "$cross_compiling" = yes; then :
+         if test yes = "$cross_compiling"; then :
   lt_cv_dlopen_self=cross
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -12421,9 +13025,9 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
+/* When -fvisibility=hidden is used, assume the code has been annotated
    correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
 int fnord () __attribute__((visibility("default")));
 #endif
 
@@ -12453,7 +13057,7 @@ _LT_EOF
   (eval $ac_link) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
 $as_echo "$lt_cv_dlopen_self" >&6; }
 
-    if test "x$lt_cv_dlopen_self" = xyes; then
+    if test yes = "$lt_cv_dlopen_self"; then
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
 if ${lt_cv_dlopen_self_static+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-         if test "$cross_compiling" = yes; then :
+         if test yes = "$cross_compiling"; then :
   lt_cv_dlopen_self_static=cross
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -12527,9 +13131,9 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
+/* When -fvisibility=hidden is used, assume the code has been annotated
    correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
 int fnord () __attribute__((visibility("default")));
 #endif
 
@@ -12559,7 +13163,7 @@ _LT_EOF
   (eval $ac_link) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -12580,9 +13184,9 @@ fi
 $as_echo "$lt_cv_dlopen_self_static" >&6; }
     fi
 
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
+    CPPFLAGS=$save_CPPFLAGS
+    LDFLAGS=$save_LDFLAGS
+    LIBS=$save_LIBS
     ;;
   esac
 
@@ -12626,7 +13230,7 @@ else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
   darwin*)
-    if test -n "$STRIP" ; then
+    if test -n "$STRIP"; then
       striplib="$STRIP -x"
       old_striplib="$STRIP -S"
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -12654,7 +13258,7 @@ fi
 
 
 
-  # Report which library types will actually be built
+  # Report what library types will actually be built
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
 $as_echo_n "checking if libtool supports shared libraries... " >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
@@ -12662,13 +13266,13 @@ $as_echo "$can_build_shared" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
 $as_echo_n "checking whether to build shared libraries... " >&6; }
-  test "$can_build_shared" = "no" && enable_shared=no
+  test no = "$can_build_shared" && enable_shared=no
 
   # On AIX, shared libraries and static libraries use the same namespace, and
   # are all built from PIC.
   case $host_os in
   aix3*)
-    test "$enable_shared" = yes && enable_static=no
+    test yes = "$enable_shared" && enable_static=no
     if test -n "$RANLIB"; then
       archive_cmds="$archive_cmds~\$RANLIB \$lib"
       postinstall_cmds='$RANLIB $lib'
@@ -12676,8 +13280,12 @@ $as_echo_n "checking whether to build shared libraries... " >&6; }
     ;;
 
   aix[4-9]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
+    if test ia64 != "$host_cpu"; then
+      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+      yes,aix,yes) ;;                  # shared object as lib.so file only
+      yes,svr4,*) ;;                   # shared object as lib.so archive member only
+      yes,*) enable_static=no ;;       # shared object in lib.a archive as well
+      esac
     fi
     ;;
   esac
@@ -12687,7 +13295,7 @@ $as_echo "$enable_shared" >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
 $as_echo_n "checking whether to build static libraries... " >&6; }
   # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
+  test yes = "$enable_shared" || enable_static=yes
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
 $as_echo "$enable_static" >&6; }
 
@@ -12701,7 +13309,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-CC="$lt_save_CC"
+CC=$lt_save_CC
 
 
 
@@ -12846,899 +13454,1226 @@ $as_echo "no" >&6; }
        fi
 fi
 
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
-$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if eval \${$as_ac_Header+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_hdr>
-
-int
-main ()
-{
-if ((DIR *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$as_ac_Header=yes"
-else
-  eval "$as_ac_Header=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$as_ac_Header
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
-_ACEOF
-
-ac_header_dirent=$ac_hdr; break
-fi
-
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if ${ac_cv_search_opendir+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' dir; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
+      if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
   else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    acl_final_prefix="$prefix"
   fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_opendir=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_opendir+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_opendir+:} false; then :
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+
 
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
 else
-  ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
+  with_gnu_ld=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
 fi
 
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if ${ac_cv_search_opendir+:} false; then :
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
+      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${acl_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' x; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_opendir=$ac_res
+  if test -z "$LD"; then
+  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$acl_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+        test "$with_gnu_ld" != no && break
+        ;;
+      *)
+        test "$with_gnu_ld" != yes && break
+        ;;
+      esac
+    fi
+  done
+  IFS="$acl_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_opendir+:} false; then :
-  break
 fi
-done
-if ${ac_cv_search_opendir+:} false; then :
 
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
 else
-  ac_cv_search_opendir=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${acl_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes
+  ;;
+*)
+  acl_cv_prog_gnu_ld=no
+  ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
+$as_echo "$acl_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$acl_cv_prog_gnu_ld
 
-fi
 
-fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
+
+                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
+$as_echo_n "checking for shared library run path origin... " >&6; }
+if ${acl_cv_rpath+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
 
-int
-main ()
-{
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
+$as_echo "$acl_cv_rpath" >&6; }
+  wl="$acl_cv_wl"
+  acl_libext="$acl_cv_libext"
+  acl_shlibext="$acl_cv_shlibext"
+  acl_libname_spec="$acl_cv_libname_spec"
+  acl_library_names_spec="$acl_cv_library_names_spec"
+  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  acl_hardcode_direct="$acl_cv_hardcode_direct"
+  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+    # Check whether --enable-rpath was given.
+if test "${enable_rpath+set}" = set; then :
+  enableval=$enable_rpath; :
 else
-  ac_cv_header_stdc=no
+  enable_rpath=yes
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
 
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
 
-fi
 
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  acl_libdirstem=lib
+  acl_libdirstem2=
+  case "$host_os" in
+    solaris*)
+                                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5
+$as_echo_n "checking for 64-bit host... " >&6; }
+if ${gl_cv_solaris_64bit+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
+
+#ifdef _LP64
+sixtyfour bits
+#endif
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
+  $EGREP "sixtyfour bits" >/dev/null 2>&1; then :
+  gl_cv_solaris_64bit=yes
 else
-  ac_cv_header_stdc=no
+  gl_cv_solaris_64bit=no
 fi
 rm -f conftest*
 
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5
+$as_echo "$gl_cv_solaris_64bit" >&6; }
+      if test $gl_cv_solaris_64bit = yes; then
+        acl_libdirstem=lib/64
+        case "$host_cpu" in
+          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
+          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
+        esac
+      fi
+      ;;
+    *)
+      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+      if test -n "$searchpath"; then
+        acl_save_IFS="${IFS=   }"; IFS=":"
+        for searchdir in $searchpath; do
+          if test -d "$searchdir"; then
+            case "$searchdir" in
+              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+              */../ | */.. )
+                # Better ignore directories of this form. They are misleading.
+                ;;
+              *) searchdir=`cd "$searchdir" && pwd`
+                 case "$searchdir" in
+                   */lib64 ) acl_libdirstem=lib64 ;;
+                 esac ;;
+            esac
+          fi
+        done
+        IFS="$acl_save_IFS"
+      fi
+      ;;
+  esac
+  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-                  (('a' <= (c) && (c) <= 'i') \
-                    || ('j' <= (c) && (c) <= 'r') \
-                    || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
 
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-       || toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
 
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
 
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
 
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
-fi
 
-for ac_header in fcntl.h malloc.h inttypes.h sys/ioctl.h sys/mman.h \
-       ctype.h unistd.h locale.h byteswap.h endian.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
-fi
 
-done
 
 
-for ac_header in uuid/uuid.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
-if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_UUID_UUID_H 1
-_ACEOF
 
-else
-  as_fn_error $? "You need the uuid library." "$LINENO" 5
-fi
+    use_additional=yes
 
-done
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
 
-ac_fn_c_check_header_mongrel "$LINENO" "libdevmapper.h" "ac_cv_header_libdevmapper_h" "$ac_includes_default"
-if test "x$ac_cv_header_libdevmapper_h" = xyes; then :
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
 
-else
-  as_fn_error $? "You need the device-mapper library." "$LINENO" 5
-fi
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
 
 
+# Check whether --with-libiconv-prefix was given.
+if test "${with_libiconv_prefix+set}" = set; then :
+  withval=$with_libiconv_prefix;
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
 
-saved_LIBS=$LIBS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_clear in -luuid" >&5
-$as_echo_n "checking for uuid_clear in -luuid... " >&6; }
-if ${ac_cv_lib_uuid_uuid_clear+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-luuid  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char uuid_clear ();
-int
-main ()
-{
-return uuid_clear ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_uuid_uuid_clear=yes
-else
-  ac_cv_lib_uuid_uuid_clear=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_clear" >&5
-$as_echo "$ac_cv_lib_uuid_uuid_clear" >&6; }
-if test "x$ac_cv_lib_uuid_uuid_clear" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBUUID 1
-_ACEOF
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
 
-  LIBS="-luuid $LIBS"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
+      fi
+    fi
 
-else
-  as_fn_error $? "You need the uuid library." "$LINENO" 5
 fi
 
-UUID_LIBS=$LIBS
+      LIBICONV=
+  LTLIBICONV=
+  INCICONV=
+  LIBICONV_PREFIX=
+      HAVE_LIBICONV=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='iconv '
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
+          else
+                                    :
+          fi
+        else
+                              found_dir=
+          found_la=
+          found_so=
+          found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
+          if test $use_additional = yes; then
+            dir="$additional_libdir"
+                                    if test -n "$acl_shlibext"; then
+              if test -f "$dir/$libname$shrext"; then
+                found_dir="$dir"
+                found_so="$dir/$libname$shrext"
+              else
+                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                  ver=`(cd "$dir" && \
+                        for f in "$libname$shrext".*; do echo "$f"; done \
+                        | sed -e "s,^$libname$shrext\\\\.,," \
+                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                        | sed 1q ) 2>/dev/null`
+                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                    found_dir="$dir"
+                    found_so="$dir/$libname$shrext.$ver"
+                  fi
+                else
+                  eval library_names=\"$acl_library_names_spec\"
+                  for f in $library_names; do
+                    if test -f "$dir/$f"; then
+                      found_dir="$dir"
+                      found_so="$dir/$f"
+                      break
+                    fi
+                  done
+                fi
+              fi
+            fi
+                        if test "X$found_dir" = "X"; then
+              if test -f "$dir/$libname.$acl_libext"; then
+                found_dir="$dir"
+                found_a="$dir/$libname.$acl_libext"
+              fi
+            fi
+            if test "X$found_dir" != "X"; then
+              if test -f "$dir/$libname.la"; then
+                found_la="$dir/$libname.la"
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIBICONV; do
 
-LIBS=$saved_LIBS
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
-$as_echo_n "checking for library containing clock_gettime... " >&6; }
-if ${ac_cv_search_clock_gettime+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                                    if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
+                      fi
+                    fi
+                  fi
+                                    if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+                                                        if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+              else
+                                                                                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                                if test "$acl_hardcode_direct" = yes; then
+                                                      LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                else
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                                                            haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                                                                                haveit=
+                    for x in $LDFLAGS $LIBICONV; do
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char clock_gettime ();
-int
-main ()
-{
-return clock_gettime ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' rt posix4; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_clock_gettime=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_clock_gettime+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_clock_gettime+:} false; then :
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
 
-else
-  ac_cv_search_clock_gettime=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
-$as_echo "$ac_cv_search_clock_gettime" >&6; }
-ac_res=$ac_cv_search_clock_gettime
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
+                    fi
+                    if test "$acl_hardcode_minus_L" != no; then
+                                                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                    else
+                                                                                                                                                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
+              else
+                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
+              fi
+            fi
+                        additional_includedir=
+            case "$found_dir" in
+              */$acl_libdirstem | */$acl_libdirstem/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = 'iconv'; then
+                  LIBICONV_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = 'iconv'; then
+                  LIBICONV_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INCICONV; do
 
-fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
 
-for ac_func in posix_memalign clock_gettime
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                                            INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+                        if test -n "$found_la"; then
+                                                        save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+                            for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIBICONV; do
 
-fi
-done
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
 
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIBICONV; do
 
-if test "x$enable_largefile" = "xno" ; then
-  as_fn_error $? "Building with --disable-largefile is not supported, it can cause data corruption." "$LINENO" 5
-fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if ${ac_cv_c_const+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                                                                  haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                                                                  haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
+                    LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+            LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
+                        alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+      done
+            acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+    else
+            for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+            for found_dir in $ltrpathdirs; do
+      LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
+    done
+  fi
 
-int
-main ()
-{
 
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this sort of thing.  */
-  typedef int charset[2];
-  const charset cs = { 0, 0 };
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *pcpcc;
-  char **ppc;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  pcpcc = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++pcpcc;
-  ppc = (char**) pcpcc;
-  pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this sort of thing.  */
-    char tx;
-    char *t = &tx;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
 
-    *t++ = 0;
-    if (s) return 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; } bx;
-    struct s *b = &bx; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-    if (!foo) return 0;
-  }
-  return !cs[0] && !zero.x;
-#endif
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_const=yes
-else
-  ac_cv_c_const=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
 
-$as_echo "#define const /**/" >>confdefs.h
 
-fi
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
-$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if ${ac_cv_c_bigendian+:} false; then :
+
+
+
+
+
+          am_save_CPPFLAGS="$CPPFLAGS"
+
+  for element in $INCICONV; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
+$as_echo_n "checking for iconv... " >&6; }
+if ${am_cv_func_iconv+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_c_bigendian=unknown
-    # See if we're dealing with a universal compiler.
+
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#ifndef __APPLE_CC__
-              not a universal capable compiler
-            #endif
-            typedef int dummy;
 
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-       # Check for potential -arch flags.  It is not universal unless
-       # there are at least two -arch flags with different values.
-       ac_arch=
-       ac_prev=
-       for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
-        if test -n "$ac_prev"; then
-          case $ac_word in
-            i?86 | x86_64 | ppc | ppc64)
-              if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
-                ac_arch=$ac_word
-              else
-                ac_cv_c_bigendian=universal
-                break
-              fi
-              ;;
-          esac
-          ac_prev=
-        elif test "x$ac_word" = "x-arch"; then
-          ac_prev=arch
-        fi
-       done
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    if test $ac_cv_c_bigendian = unknown; then
-      # See if sys/param.h defines the BYTE_ORDER macro.
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-            #include <sys/param.h>
+#include <stdlib.h>
+#include <iconv.h>
 
 int
 main ()
 {
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
-                    && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
-                    && LITTLE_ENDIAN)
-             bogus endian macros
-            #endif
-
+iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  # It does; now see whether it defined to BIG_ENDIAN or not.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_func_iconv=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
-               #include <sys/param.h>
+
+#include <stdlib.h>
+#include <iconv.h>
 
 int
 main ()
 {
-#if BYTE_ORDER != BIG_ENDIAN
-                not big endian
-               #endif
-
+iconv_t cd = iconv_open("","");
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_bigendian=yes
-else
-  ac_cv_c_bigendian=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      LIBS="$am_save_LIBS"
     fi
-    if test $ac_cv_c_bigendian = unknown; then
-      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5
+$as_echo "$am_cv_func_iconv" >&6; }
+  if test "$am_cv_func_iconv" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5
+$as_echo_n "checking for working iconv... " >&6; }
+if ${am_cv_func_iconv_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                  am_save_LIBS="$LIBS"
+      if test $am_cv_lib_iconv = yes; then
+        LIBS="$LIBS $LIBICONV"
+      fi
+      if test "$cross_compiling" = yes; then :
+
+         case "$host_os" in
+           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+           *)            am_cv_func_iconv_works="guessing yes" ;;
+         esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <limits.h>
 
-int
-main ()
+#include <iconv.h>
+#include <string.h>
+int main ()
 {
-#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
-             bogus endian macros
-            #endif
-
-  ;
-  return 0;
+  int result = 0;
+  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+     returns.  */
+  {
+    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+    if (cd_utf8_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\342\202\254"; /* EURO SIGN */
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_utf8_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
+      }
+  }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
+      }
+  }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        const char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#if 0 /* This bug could be worked around by the caller.  */
+  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        char buf[50];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if ((int)res > 0)
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#endif
+  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+     provided.  */
+  if (/* Try standardized names.  */
+      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+      /* Try IRIX, OSF/1 names.  */
+      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+      /* Try AIX names.  */
+      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+      /* Try HP-UX names.  */
+      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+    result |= 16;
+  return result;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  # It does; now see whether it defined to _BIG_ENDIAN or not.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if ac_fn_c_try_run "$LINENO"; then :
+  am_cv_func_iconv_works=yes
+else
+  am_cv_func_iconv_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      LIBS="$am_save_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5
+$as_echo "$am_cv_func_iconv_works" >&6; }
+    case "$am_cv_func_iconv_works" in
+      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+      *)   am_func_iconv=yes ;;
+    esac
+  else
+    am_func_iconv=no am_cv_lib_iconv=no
+  fi
+  if test "$am_func_iconv" = yes; then
+
+$as_echo "#define HAVE_ICONV 1" >>confdefs.h
+
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5
+$as_echo_n "checking how to link with libiconv... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5
+$as_echo "$LIBICONV" >&6; }
+  else
+            CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+
+
+
+  if test "$am_cv_func_iconv" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5
+$as_echo_n "checking for iconv declaration... " >&6; }
+    if ${am_cv_proto_iconv+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <limits.h>
+
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
 
 int
 main ()
 {
-#ifndef _BIG_ENDIAN
-                not big endian
-               #endif
 
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_bigendian=yes
+  am_cv_proto_iconv_arg1=""
 else
-  ac_cv_c_bigendian=no
+  am_cv_proto_iconv_arg1="const"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    fi
-    if test $ac_cv_c_bigendian = unknown; then
-      # Compile a test program.
-      if test "$cross_compiling" = yes; then :
-  # Try to guess by grepping values from an object file.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-short int ascii_mm[] =
-                 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-               short int ascii_ii[] =
-                 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-               int use_ascii (int i) {
-                 return ascii_mm[i] + ascii_ii[i];
-               }
-               short int ebcdic_ii[] =
-                 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-               short int ebcdic_mm[] =
-                 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-               int use_ebcdic (int i) {
-                 return ebcdic_mm[i] + ebcdic_ii[i];
-               }
-               extern int foo;
 
+    am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result:
+         $am_cv_proto_iconv" >&5
+$as_echo "
+         $am_cv_proto_iconv" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define ICONV_CONST $am_cv_proto_iconv_arg1
+_ACEOF
+
+
+  fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
+$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
+if ${ac_cv_c_restrict+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_restrict=no
+   # The order here caters to the fact that C++ does not require restrict.
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+typedef int * int_ptr;
+       int foo (int_ptr $ac_kw ip) {
+       return ip[0];
+       }
 int
 main ()
 {
-return use_ascii (foo) == use_ebcdic (foo);
+int s[1];
+       int * $ac_kw t = s;
+       t[0] = 0;
+       return foo(t)
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
-             ac_cv_c_bigendian=yes
-           fi
-           if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
-             if test "$ac_cv_c_bigendian" = unknown; then
-               ac_cv_c_bigendian=no
-             else
-               # finding both strings is unlikely to happen, but who knows?
-               ac_cv_c_bigendian=unknown
-             fi
-           fi
+  ac_cv_c_restrict=$ac_kw
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     test "$ac_cv_c_restrict" != no && break
+   done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
+$as_echo "$ac_cv_c_restrict" >&6; }
+
+ case $ac_cv_c_restrict in
+   restrict) ;;
+   no) $as_echo "#define restrict /**/" >>confdefs.h
+ ;;
+   *)  cat >>confdefs.h <<_ACEOF
+#define restrict $ac_cv_c_restrict
+_ACEOF
+ ;;
+ esac
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if eval \${$as_ac_Header+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <sys/types.h>
+#include <$ac_hdr>
+
 int
 main ()
 {
-
-            /* Are we little or big endian?  From Harbison&Steele.  */
-            union
-            {
-              long int l;
-              char c[sizeof (long int)];
-            } u;
-            u.l = 1;
-            return u.c[sizeof (long int) - 1] == 1;
-
+if ((DIR *) 0)
+return 0;
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_c_bigendian=no
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_ac_Header=yes"
 else
-  ac_cv_c_bigendian=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+  eval "$as_ac_Header=no"
 fi
-
-    fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
-$as_echo "$ac_cv_c_bigendian" >&6; }
- case $ac_cv_c_bigendian in #(
-   yes)
-     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
-;; #(
-   no)
-      ;; #(
-   universal)
-
-$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
-
-     ;; #(
-   *)
-     as_fn_error $? "unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
- esac
-
-ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
+eval ac_res=\$$as_ac_Header
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
 
+ac_header_dirent=$ac_hdr; break
 fi
 
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then :
-  enableval=$enable_largefile;
-fi
-
-if test "$enable_largefile" != no; then
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_CC+:} false; then :
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_sys_largefile_CC=no
-     if test "$GCC" != yes; then
-       ac_save_CC=$CC
-       while :; do
-        # IRIX 6.2 and later do not support large files by default,
-        # so use the C compiler's -n32 option if that helps.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                      && LARGE_OFF_T % 2147483647 == 1)
-                     ? 1 : -1];
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
 int
 main ()
 {
-
+return opendir ();
   ;
   return 0;
 }
 _ACEOF
-        if ac_fn_c_try_compile "$LINENO"; then :
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_opendir+:} false; then :
   break
 fi
-rm -f core conftest.err conftest.$ac_objext
-        CC="$CC -n32"
-        if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_largefile_CC=' -n32'; break
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+  ac_cv_search_opendir=no
 fi
-rm -f core conftest.err conftest.$ac_objext
-        break
-       done
-       CC=$ac_save_CC
-       rm -f conftest.$ac_ext
-    fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
-  if test "$ac_cv_sys_largefile_CC" != no; then
-    CC=$CC$ac_cv_sys_largefile_CC
-  fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if ${ac_cv_sys_file_offset_bits+:} false; then :
+fi
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                      && LARGE_OFF_T % 2147483647 == 1)
-                     ? 1 : -1];
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                      && LARGE_OFF_T % 2147483647 == 1)
-                     ? 1 : -1];
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
 int
 main ()
 {
-
+return opendir ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=64; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_file_offset_bits=unknown
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_opendir+:} false; then :
   break
+fi
 done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+  ac_cv_search_opendir=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if ${ac_cv_sys_large_files+:} false; then :
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  while :; do
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                      && LARGE_OFF_T % 2147483647 == 1)
-                     ? 1 : -1];
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
 int
 main ()
 {
@@ -13748,868 +14683,1989 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=no; break
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#define _LARGE_FILES 1
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                      && LARGE_OFF_T % 2147483647 == 1)
-                     ? 1 : -1];
-int
-main ()
-{
+#include <string.h>
 
-  ;
-  return 0;
-}
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=1; break
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_large_files=unknown
-  break
-done
+rm -f conftest*
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
 _ACEOF
-;;
-esac
-rm -rf conftest*
-  fi
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
 
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
-$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_source+:} false; then :
-  $as_echo_n "(cached) " >&6
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
 else
-  while :; do
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
-  ;
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      return 2;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=no; break
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _LARGEFILE_SOURCE 1
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
-int
-main ()
-{
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=1; break
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  ac_cv_sys_largefile_source=unknown
-  break
-done
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
-$as_echo "$ac_cv_sys_largefile_source" >&6; }
-case $ac_cv_sys_largefile_source in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
-_ACEOF
-;;
-esac
-rm -rf conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
 
-# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
-# in glibc 2.1.3, but that breaks too many other things.
-# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-if test $ac_cv_sys_largefile_source != unknown; then
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
-$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
+fi
+
+for ac_header in fcntl.h malloc.h inttypes.h sys/ioctl.h sys/mman.h \
+       sys/sysmacros.h sys/statvfs.h ctype.h unistd.h locale.h byteswap.h endian.h stdint.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
 fi
 
-if test $ac_cv_c_compiler_gnu = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
-$as_echo_n "checking whether $CC needs -traditional... " >&6; }
-if ${ac_cv_prog_gcc_traditional+:} false; then :
-  $as_echo_n "(cached) " >&6
+done
+
+ac_fn_c_check_decl "$LINENO" "O_CLOEXEC" "ac_cv_have_decl_O_CLOEXEC" "
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_O_CLOEXEC" = xyes; then :
+  ac_have_decl=1
 else
-    ac_pattern="Autoconf.*'x'"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sgtty.h>
-Autoconf TIOCGETP
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_O_CLOEXEC $ac_have_decl
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
-  ac_cv_prog_gcc_traditional=yes
+if test $ac_have_decl = 1; then :
+
 else
-  ac_cv_prog_gcc_traditional=no
+
+$as_echo "#define O_CLOEXEC 0" >>confdefs.h
+
 fi
-rm -f conftest*
 
 
-  if test $ac_cv_prog_gcc_traditional = no; then
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <termio.h>
-Autoconf TCGETA
+for ac_header in uuid/uuid.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
+if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UUID_UUID_H 1
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
-  ac_cv_prog_gcc_traditional=yes
-fi
-rm -f conftest*
 
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
-$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
-  if test $ac_cv_prog_gcc_traditional = yes; then
-    CC="$CC -traditional"
-  fi
+else
+  as_fn_error $? "You need the uuid library." "$LINENO" 5
 fi
 
-ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strerror_r" = xyes; then :
-  ac_have_decl=1
+done
+
+ac_fn_c_check_header_mongrel "$LINENO" "libdevmapper.h" "ac_cv_header_libdevmapper_h" "$ac_includes_default"
+if test "x$ac_cv_header_libdevmapper_h" = xyes; then :
+
 else
-  ac_have_decl=0
+  as_fn_error $? "You need the device-mapper library." "$LINENO" 5
 fi
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR_R $ac_have_decl
-_ACEOF
 
-for ac_func in strerror_r
+
+# Check whether --enable-keyring was given.
+if test "${enable_keyring+set}" = set; then :
+  enableval=$enable_keyring;
+else
+  enable_keyring=yes
+fi
+
+if test "x$enable_keyring" = "xyes"; then
+       for ac_header in linux/keyctl.h
 do :
-  ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r"
-if test "x$ac_cv_func_strerror_r" = xyes; then :
+  ac_fn_c_check_header_mongrel "$LINENO" "linux/keyctl.h" "ac_cv_header_linux_keyctl_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_keyctl_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_STRERROR_R 1
+#define HAVE_LINUX_KEYCTL_H 1
 _ACEOF
 
+else
+  as_fn_error $? "You need Linux kernel headers with kernel keyring service compiled." "$LINENO" 5
 fi
-done
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5
-$as_echo_n "checking whether strerror_r returns char *... " >&6; }
-if ${ac_cv_func_strerror_r_char_p+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+done
 
-    ac_cv_func_strerror_r_char_p=no
-    if test $ac_cv_have_decl_strerror_r = yes; then
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
 
-         char buf[100];
-         char x = *strerror_r (0, buf, sizeof buf);
-         char *p = strerror_r (0, buf, sizeof buf);
-         return !p || x;
+                       ac_fn_c_check_decl "$LINENO" "__NR_add_key" "ac_cv_have_decl___NR_add_key" "#include <syscall.h>
+"
+if test "x$ac_cv_have_decl___NR_add_key" = xyes; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_func_strerror_r_char_p=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    else
-      # strerror_r is not declared.  Choose between
-      # systems that have relatively inaccessible declarations for the
-      # function.  BeOS and DEC UNIX 4.0 fall in this category, but the
-      # former has a strerror_r that returns char*, while the latter
-      # has a strerror_r that returns `int'.
-      # This test should segfault on the DEC system.
-      if test "$cross_compiling" = yes; then :
-  :
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-       extern char *strerror_r ();
-int
-main ()
-{
-char buf[100];
-         char x = *strerror_r (0, buf, sizeof buf);
-         return ! isalpha (x);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_strerror_r_char_p=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+  as_fn_error $? "The kernel is missing add_key syscall." "$LINENO" 5
 fi
 
-    fi
+       ac_fn_c_check_decl "$LINENO" "__NR_keyctl" "ac_cv_have_decl___NR_keyctl" "#include <syscall.h>
+"
+if test "x$ac_cv_have_decl___NR_keyctl" = xyes; then :
 
+else
+  as_fn_error $? "The kernel is missing keyctl syscall." "$LINENO" 5
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5
-$as_echo "$ac_cv_func_strerror_r_char_p" >&6; }
-if test $ac_cv_func_strerror_r_char_p = yes; then
 
-$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h
+       ac_fn_c_check_decl "$LINENO" "__NR_request_key" "ac_cv_have_decl___NR_request_key" "#include <syscall.h>
+"
+if test "x$ac_cv_have_decl___NR_request_key" = xyes; then :
 
+else
+  as_fn_error $? "The kernel is missing request_key syscall." "$LINENO" 5
 fi
 
 
+                       ac_fn_c_check_type "$LINENO" "key_serial_t" "ac_cv_type_key_serial_t" "
+       $ac_includes_default
+       #ifdef HAVE_LINUX_KEYCTL_H
+       # include <linux/keyctl.h>
+       #endif
 
+"
+if test "x$ac_cv_type_key_serial_t" = xyes; then :
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
+cat >>confdefs.h <<_ACEOF
+#define HAVE_KEY_SERIAL_T 1
+_ACEOF
 
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5
-$as_echo_n "checking whether NLS is requested... " >&6; }
-    # Check whether --enable-nls was given.
-if test "${enable_nls+set}" = set; then :
-  enableval=$enable_nls; USE_NLS=$enableval
-else
-  USE_NLS=yes
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5
-$as_echo "$USE_NLS" >&6; }
-
-
-
 
 
+$as_echo "#define KERNEL_KEYRING 1" >>confdefs.h
 
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
 fi
-
-# Find out how to test for executable files. Don't use a zero-byte file,
-# as systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
-  ac_executable_p="test -x"
+ if test "x$enable_keyring" = "xyes"; then
+  KERNEL_KEYRING_TRUE=
+  KERNEL_KEYRING_FALSE='#'
 else
-  ac_executable_p="test -f"
+  KERNEL_KEYRING_TRUE='#'
+  KERNEL_KEYRING_FALSE=
 fi
-rm -f conf$$.file
 
-# Extract the first word of "msgfmt", so it can be a program name with args.
-set dummy msgfmt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MSGFMT+:} false; then :
+
+saved_LIBS=$LIBS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_clear in -luuid" >&5
+$as_echo_n "checking for uuid_clear in -luuid... " >&6; }
+if ${ac_cv_lib_uuid_uuid_clear+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case "$MSGFMT" in
-  [\\/]* | ?:[\\/]*)
-    ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
-    ;;
-  *)
-    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH; do
-      IFS="$ac_save_IFS"
-      test -z "$ac_dir" && ac_dir=.
-      for ac_exec_ext in '' $ac_executable_extensions; do
-        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
-          echo "$as_me: trying $ac_dir/$ac_word..." >&5
-          if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 &&
-     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
-            ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
-            break 2
-          fi
-        fi
-      done
-    done
-    IFS="$ac_save_IFS"
-  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
-    ;;
-esac
-fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test "$MSGFMT" != ":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
-$as_echo "$MSGFMT" >&6; }
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-luuid  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char uuid_clear ();
+int
+main ()
+{
+return uuid_clear ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_uuid_uuid_clear=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  ac_cv_lib_uuid_uuid_clear=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_clear" >&5
+$as_echo "$ac_cv_lib_uuid_uuid_clear" >&6; }
+if test "x$ac_cv_lib_uuid_uuid_clear" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBUUID 1
+_ACEOF
 
-  # Extract the first word of "gmsgfmt", so it can be a program name with args.
-set dummy gmsgfmt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GMSGFMT+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $GMSGFMT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  LIBS="-luuid $LIBS"
 
-  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
-  ;;
-esac
-fi
-GMSGFMT=$ac_cv_path_GMSGFMT
-if test -n "$GMSGFMT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
-$as_echo "$GMSGFMT" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  as_fn_error $? "You need the uuid library." "$LINENO" 5
 fi
 
+UUID_LIBS=$LIBS
 
+LIBS=$saved_LIBS
 
-    case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
-    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
-    *) MSGFMT_015=$MSGFMT ;;
-  esac
-
-  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
-    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
-    *) GMSGFMT_015=$GMSGFMT ;;
-  esac
-
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if ${ac_cv_search_clock_gettime+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' rt posix4; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
   else
-    PATH_SEPARATOR=:
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
-  rm -f conf$$.sh
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_clock_gettime=$ac_res
 fi
-
-# Find out how to test for executable files. Don't use a zero-byte file,
-# as systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
-  ac_executable_p="test -x"
-else
-  ac_executable_p="test -f"
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_clock_gettime+:} false; then :
+  break
 fi
-rm -f conf$$.file
+done
+if ${ac_cv_search_clock_gettime+:} false; then :
 
-# Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XGETTEXT+:} false; then :
-  $as_echo_n "(cached) " >&6
 else
-  case "$XGETTEXT" in
-  [\\/]* | ?:[\\/]*)
-    ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
-    ;;
-  *)
-    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH; do
-      IFS="$ac_save_IFS"
-      test -z "$ac_dir" && ac_dir=.
-      for ac_exec_ext in '' $ac_executable_extensions; do
-        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
-          echo "$as_me: trying $ac_dir/$ac_word..." >&5
-          if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 &&
-     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
-            ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
-            break 2
-          fi
-        fi
-      done
-    done
-    IFS="$ac_save_IFS"
-  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
-    ;;
-esac
+  ac_cv_search_clock_gettime=no
 fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test "$XGETTEXT" != ":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
-$as_echo "$XGETTEXT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
+$as_echo "$ac_cv_search_clock_gettime" >&6; }
+ac_res=$ac_cv_search_clock_gettime
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-    rm -f messages.po
-
-    case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
-    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
-    *) XGETTEXT_015=$XGETTEXT ;;
-  esac
-
+fi
 
+for ac_func in posix_memalign clock_gettime posix_fallocate explicit_bzero
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
 fi
+done
 
-# Find out how to test for executable files. Don't use a zero-byte file,
-# as systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
-  ac_executable_p="test -x"
-else
-  ac_executable_p="test -f"
+
+if test "x$enable_largefile" = "xno"; then
+  as_fn_error $? "Building with --disable-largefile is not supported, it can cause data corruption." "$LINENO" 5
 fi
-rm -f conf$$.file
 
-# Extract the first word of "msgmerge", so it can be a program name with args.
-set dummy msgmerge; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MSGMERGE+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case "$MSGMERGE" in
-  [\\/]* | ?:[\\/]*)
-    ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
-    ;;
-  *)
-    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH; do
-      IFS="$ac_save_IFS"
-      test -z "$ac_dir" && ac_dir=.
-      for ac_exec_ext in '' $ac_executable_extensions; do
-        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
-          echo "$as_me: trying $ac_dir/$ac_word..." >&5
-          if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then
-            ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
-            break 2
-          fi
-        fi
-      done
-    done
-    IFS="$ac_save_IFS"
-  test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
-    ;;
-esac
-fi
-MSGMERGE="$ac_cv_path_MSGMERGE"
-if test "$MSGMERGE" != ":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
-$as_echo "$MSGMERGE" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
-        test -n "$localedir" || localedir='${datadir}/locale'
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this sort of thing.  */
+  typedef int charset[2];
+  const charset cs = { 0, 0 };
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
 
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
 
-  ac_config_commands="$ac_config_commands po-directories"
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_const=yes
+else
+  ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
 
+$as_echo "#define const /**/" >>confdefs.h
 
+fi
 
-      if test "X$prefix" = "XNONE"; then
-    acl_final_prefix="$ac_default_prefix"
-  else
-    acl_final_prefix="$prefix"
-  fi
-  if test "X$exec_prefix" = "XNONE"; then
-    acl_final_exec_prefix='${prefix}'
-  else
-    acl_final_exec_prefix="$exec_prefix"
-  fi
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
-  prefix="$acl_save_prefix"
-
-
-# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then :
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
-else
-  with_gnu_ld=no
-fi
-
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
-$as_echo_n "checking for ld used by GCC... " >&6; }
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [\\/]* | [A-Za-z]:[\\/]*)
-      re_direlt='/[^/][^/]*/\.\./'
-      # Canonicalize the path of ld
-      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
-fi
-if ${acl_cv_path_LD+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -z "$LD"; then
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      acl_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some GNU ld's only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
-      *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break ;;
-      *)
-       test "$with_gnu_ld" != yes && break ;;
-      esac
-    fi
-  done
-  IFS="$ac_save_ifs"
-else
-  acl_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
+  ac_cv_c_bigendian=unknown
+    # See if we're dealing with a universal compiler.
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __APPLE_CC__
+              not a universal capable compiler
+            #endif
+            typedef int dummy;
 
-LD="$acl_cv_path_LD"
-if test -n "$LD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${acl_cv_prog_gnu_ld+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  acl_cv_prog_gnu_ld=yes ;;
-*)
-  acl_cv_prog_gnu_ld=no ;;
-esac
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+       # Check for potential -arch flags.  It is not universal unless
+       # there are at least two -arch flags with different values.
+       ac_arch=
+       ac_prev=
+       for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+        if test -n "$ac_prev"; then
+          case $ac_word in
+            i?86 | x86_64 | ppc | ppc64)
+              if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+                ac_arch=$ac_word
+              else
+                ac_cv_c_bigendian=universal
+                break
+              fi
+              ;;
+          esac
+          ac_prev=
+        elif test "x$ac_word" = "x-arch"; then
+          ac_prev=arch
+        fi
+       done
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
-$as_echo "$acl_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$acl_cv_prog_gnu_ld
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if sys/param.h defines the BYTE_ORDER macro.
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+            #include <sys/param.h>
 
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+                    && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+                    && LITTLE_ENDIAN)
+             bogus endian macros
+            #endif
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+               #include <sys/param.h>
 
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+                not big endian
+               #endif
 
-                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5
-$as_echo_n "checking for shared library run path origin... " >&6; }
-if ${acl_cv_rpath+:} false; then :
-  $as_echo_n "(cached) " >&6
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-
-    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
-    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
-    . ./conftest.sh
-    rm -f ./conftest.sh
-    acl_cv_rpath=done
-
+  ac_cv_c_bigendian=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
-$as_echo "$acl_cv_rpath" >&6; }
-  wl="$acl_cv_wl"
-  libext="$acl_cv_libext"
-  shlibext="$acl_cv_shlibext"
-  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-  hardcode_direct="$acl_cv_hardcode_direct"
-  hardcode_minus_L="$acl_cv_hardcode_minus_L"
-    # Check whether --enable-rpath was given.
-if test "${enable_rpath+set}" = set; then :
-  enableval=$enable_rpath; :
-else
-  enable_rpath=yes
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <limits.h>
 
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+             bogus endian macros
+            #endif
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to _BIG_ENDIAN or not.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <limits.h>
 
-                  acl_libdirstem=lib
-  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
-  if test -n "$searchpath"; then
-    acl_save_IFS="${IFS=       }"; IFS=":"
-    for searchdir in $searchpath; do
-      if test -d "$searchdir"; then
-        case "$searchdir" in
-          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
-          *) searchdir=`cd "$searchdir" && pwd`
-             case "$searchdir" in
-               */lib64 ) acl_libdirstem=lib64 ;;
-             esac ;;
-        esac
-      fi
-    done
-    IFS="$acl_save_IFS"
-  fi
-
-
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+                not big endian
+               #endif
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
+else
+  ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # Compile a test program.
+      if test "$cross_compiling" = yes; then :
+  # Try to guess by grepping values from an object file.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+short int ascii_mm[] =
+                 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+               short int ascii_ii[] =
+                 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+               int use_ascii (int i) {
+                 return ascii_mm[i] + ascii_ii[i];
+               }
+               short int ebcdic_ii[] =
+                 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+               short int ebcdic_mm[] =
+                 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+               int use_ebcdic (int i) {
+                 return ebcdic_mm[i] + ebcdic_ii[i];
+               }
+               extern int foo;
 
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+             ac_cv_c_bigendian=yes
+           fi
+           if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+             if test "$ac_cv_c_bigendian" = unknown; then
+               ac_cv_c_bigendian=no
+             else
+               # finding both strings is unlikely to happen, but who knows?
+               ac_cv_c_bigendian=unknown
+             fi
+           fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
 
+            /* Are we little or big endian?  From Harbison&Steele.  */
+            union
+            {
+              long int l;
+              char c[sizeof (long int)];
+            } u;
+            u.l = 1;
+            return u.c[sizeof (long int) - 1] == 1;
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_bigendian=no
+else
+  ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+   yes)
+     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+   no)
+      ;; #(
+   universal)
 
-    use_additional=yes
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
+     ;; #(
+   *)
+     as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
 
-    eval additional_includedir=\"$includedir\"
-    eval additional_libdir=\"$libdir\"
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = xyes; then :
 
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+else
 
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
 
-# Check whether --with-libiconv-prefix was given.
-if test "${with_libiconv_prefix+set}" = set; then :
-  withval=$with_libiconv_prefix;
-    if test "X$withval" = "Xno"; then
-      use_additional=no
-    else
-      if test "X$withval" = "X"; then
+fi
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
 
-          eval additional_includedir=\"$includedir\"
-          eval additional_libdir=\"$libdir\"
+if test "$enable_largefile" != no; then
 
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+        # IRIX 6.2 and later do not support large files by default,
+        # so use the C compiler's -n32 option if that helps.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
 
-      else
-        additional_includedir="$withval/include"
-        additional_libdir="$withval/$acl_libdirstem"
-      fi
+  ;
+  return 0;
+}
+_ACEOF
+        if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+        CC="$CC -n32"
+        if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+        break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
     fi
-
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
 
-      LIBICONV=
-  LTLIBICONV=
-  INCICONV=
-  rpathdirs=
-  ltrpathdirs=
-  names_already_handled=
-  names_next_round='iconv '
-  while test -n "$names_next_round"; do
-    names_this_round="$names_next_round"
-    names_next_round=
-    for name in $names_this_round; do
-      already_handled=
-      for n in $names_already_handled; do
-        if test "$n" = "$name"; then
-          already_handled=yes
-          break
-        fi
-      done
-      if test -z "$already_handled"; then
-        names_already_handled="$names_already_handled $name"
-                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
-        eval value=\"\$HAVE_LIB$uppername\"
-        if test -n "$value"; then
-          if test "$value" = yes; then
-            eval value=\"\$LIB$uppername\"
-            test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
-            eval value=\"\$LTLIB$uppername\"
-            test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
-          else
-                                    :
-          fi
-        else
-                              found_dir=
-          found_la=
-          found_so=
-          found_a=
-          if test $use_additional = yes; then
-            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
-              found_dir="$additional_libdir"
-              found_so="$additional_libdir/lib$name.$shlibext"
-              if test -f "$additional_libdir/lib$name.la"; then
-                found_la="$additional_libdir/lib$name.la"
-              fi
-            else
-              if test -f "$additional_libdir/lib$name.$libext"; then
-                found_dir="$additional_libdir"
-                found_a="$additional_libdir/lib$name.$libext"
-                if test -f "$additional_libdir/lib$name.la"; then
-                  found_la="$additional_libdir/lib$name.la"
-                fi
-              fi
-            fi
-          fi
-          if test "X$found_dir" = "X"; then
-            for x in $LDFLAGS $LTLIBICONV; do
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
 
-              case "$x" in
-                -L*)
-                  dir=`echo "X$x" | sed -e 's/^X-L//'`
-                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
-                    found_dir="$dir"
-                    found_so="$dir/lib$name.$shlibext"
-                    if test -f "$dir/lib$name.la"; then
-                      found_la="$dir/lib$name.la"
-                    fi
-                  else
-                    if test -f "$dir/lib$name.$libext"; then
-                      found_dir="$dir"
-                      found_a="$dir/lib$name.$libext"
-                      if test -f "$dir/lib$name.la"; then
-                        found_la="$dir/lib$name.la"
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
+
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_source+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  ac_cv_sys_largefile_source=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
+$as_echo "$ac_cv_sys_largefile_source" >&6; }
+case $ac_cv_sys_largefile_source in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
+_ACEOF
+;;
+esac
+rm -rf conftest*
+
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
+
+$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
+
+fi
+
+if test $ac_cv_c_compiler_gnu = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
+$as_echo_n "checking whether $CC needs -traditional... " >&6; }
+if ${ac_cv_prog_gcc_traditional+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+    ac_pattern="Autoconf.*'x'"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
+  ac_cv_prog_gcc_traditional=yes
+else
+  ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+  if test $ac_cv_prog_gcc_traditional = no; then
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
+  ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
+$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
+  if test $ac_cv_prog_gcc_traditional = yes; then
+    CC="$CC -traditional"
+  fi
+fi
+
+ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strerror_r" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRERROR_R $ac_have_decl
+_ACEOF
+
+for ac_func in strerror_r
+do :
+  ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r"
+if test "x$ac_cv_func_strerror_r" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STRERROR_R 1
+_ACEOF
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5
+$as_echo_n "checking whether strerror_r returns char *... " >&6; }
+if ${ac_cv_func_strerror_r_char_p+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    ac_cv_func_strerror_r_char_p=no
+    if test $ac_cv_have_decl_strerror_r = yes; then
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+         char buf[100];
+         char x = *strerror_r (0, buf, sizeof buf);
+         char *p = strerror_r (0, buf, sizeof buf);
+         return !p || x;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_func_strerror_r_char_p=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    else
+      # strerror_r is not declared.  Choose between
+      # systems that have relatively inaccessible declarations for the
+      # function.  BeOS and DEC UNIX 4.0 fall in this category, but the
+      # former has a strerror_r that returns char*, while the latter
+      # has a strerror_r that returns `int'.
+      # This test should segfault on the DEC system.
+      if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+       extern char *strerror_r ();
+int
+main ()
+{
+char buf[100];
+         char x = *strerror_r (0, buf, sizeof buf);
+         return ! isalpha (x);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_strerror_r_char_p=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+    fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5
+$as_echo "$ac_cv_func_strerror_r_char_p" >&6; }
+if test $ac_cv_func_strerror_r_char_p = yes; then
+
+$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h
+
+fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5
+$as_echo_n "checking whether NLS is requested... " >&6; }
+    # Check whether --enable-nls was given.
+if test "${enable_nls+set}" = set; then :
+  enableval=$enable_nls; USE_NLS=$enableval
+else
+  USE_NLS=yes
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5
+$as_echo "$USE_NLS" >&6; }
+
+
+
+
+      GETTEXT_MACRO_VERSION=0.18
+
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case "$MSGFMT" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 &&
+     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+            ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
+    ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test "$MSGFMT" != ":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
+$as_echo "$MSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GMSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GMSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+  ;;
+esac
+fi
+GMSGFMT=$ac_cv_path_GMSGFMT
+if test -n "$GMSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
+$as_echo "$GMSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+    case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
+    *) MSGFMT_015=$MSGFMT ;;
+  esac
+
+  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
+    *) GMSGFMT_015=$GMSGFMT ;;
+  esac
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XGETTEXT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case "$XGETTEXT" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 &&
+     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+            ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+    ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test "$XGETTEXT" != ":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
+$as_echo "$XGETTEXT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+    rm -f messages.po
+
+    case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
+    *) XGETTEXT_015=$XGETTEXT ;;
+  esac
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGMERGE+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case "$MSGMERGE" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then
+            ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
+    ;;
+esac
+fi
+MSGMERGE="$ac_cv_path_MSGMERGE"
+if test "$MSGMERGE" != ":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
+$as_echo "$MSGMERGE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+        test -n "$localedir" || localedir='${datadir}/locale'
+
+
+    test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
+
+
+  ac_config_commands="$ac_config_commands po-directories"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5
+$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; }
+if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <CoreFoundation/CFPreferences.h>
+int
+main ()
+{
+CFPreferencesCopyAppValue(NULL, NULL)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gt_cv_func_CFPreferencesCopyAppValue=yes
+else
+  gt_cv_func_CFPreferencesCopyAppValue=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     LIBS="$gt_save_LIBS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5
+$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; }
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+
+$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h
+
+  fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5
+$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; }
+if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <CoreFoundation/CFLocale.h>
+int
+main ()
+{
+CFLocaleCopyCurrent();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gt_cv_func_CFLocaleCopyCurrent=yes
+else
+  gt_cv_func_CFLocaleCopyCurrent=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     LIBS="$gt_save_LIBS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5
+$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; }
+  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+
+$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h
+
+  fi
+  INTL_MACOSX_LIBS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+  fi
+
+
+
+
+
+
+  LIBINTL=
+  LTLIBINTL=
+  POSUB=
+
+    case " $gt_needs " in
+    *" need-formatstring-macros "*) gt_api_version=3 ;;
+    *" need-ngettext "*) gt_api_version=2 ;;
+    *) gt_api_version=1 ;;
+  esac
+  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
+  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
+
+    if test "$USE_NLS" = "yes"; then
+    gt_use_preinstalled_gnugettext=no
+
+
+        if test $gt_api_version -ge 3; then
+          gt_revision_test_code='
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+'
+        else
+          gt_revision_test_code=
+        fi
+        if test $gt_api_version -ge 2; then
+          gt_expression_test_code=' + * ngettext ("", "", 0)'
+        else
+          gt_expression_test_code=
+        fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5
+$as_echo_n "checking for GNU gettext in libc... " >&6; }
+if eval \${$gt_func_gnugettext_libc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+
+int
+main ()
+{
+
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$gt_func_gnugettext_libc=yes"
+else
+  eval "$gt_func_gnugettext_libc=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$gt_func_gnugettext_libc
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+
+
+
+
+
+          am_save_CPPFLAGS="$CPPFLAGS"
+
+  for element in $INCICONV; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
+$as_echo_n "checking for iconv... " >&6; }
+if ${am_cv_func_iconv+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_func_iconv=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      LIBS="$am_save_LIBS"
+    fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5
+$as_echo "$am_cv_func_iconv" >&6; }
+  if test "$am_cv_func_iconv" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5
+$as_echo_n "checking for working iconv... " >&6; }
+if ${am_cv_func_iconv_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                  am_save_LIBS="$LIBS"
+      if test $am_cv_lib_iconv = yes; then
+        LIBS="$LIBS $LIBICONV"
+      fi
+      if test "$cross_compiling" = yes; then :
+
+         case "$host_os" in
+           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+           *)            am_cv_func_iconv_works="guessing yes" ;;
+         esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <iconv.h>
+#include <string.h>
+int main ()
+{
+  int result = 0;
+  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+     returns.  */
+  {
+    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+    if (cd_utf8_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\342\202\254"; /* EURO SIGN */
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_utf8_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
+      }
+  }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
+      }
+  }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        const char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#if 0 /* This bug could be worked around by the caller.  */
+  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        char buf[50];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if ((int)res > 0)
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#endif
+  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+     provided.  */
+  if (/* Try standardized names.  */
+      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+      /* Try IRIX, OSF/1 names.  */
+      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+      /* Try AIX names.  */
+      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+      /* Try HP-UX names.  */
+      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+    result |= 16;
+  return result;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  am_cv_func_iconv_works=yes
+else
+  am_cv_func_iconv_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      LIBS="$am_save_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5
+$as_echo "$am_cv_func_iconv_works" >&6; }
+    case "$am_cv_func_iconv_works" in
+      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+      *)   am_func_iconv=yes ;;
+    esac
+  else
+    am_func_iconv=no am_cv_lib_iconv=no
+  fi
+  if test "$am_func_iconv" = yes; then
+
+$as_echo "#define HAVE_ICONV 1" >>confdefs.h
+
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5
+$as_echo_n "checking how to link with libiconv... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5
+$as_echo "$LIBICONV" >&6; }
+  else
+            CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+
+
+
+
+
+
+
+
+
+
+
+    use_additional=yes
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+
+# Check whether --with-libintl-prefix was given.
+if test "${with_libintl_prefix+set}" = set; then :
+  withval=$with_libintl_prefix;
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
+      fi
+    fi
+
+fi
+
+      LIBINTL=
+  LTLIBINTL=
+  INCINTL=
+  LIBINTL_PREFIX=
+      HAVE_LIBINTL=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='intl '
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value"
+          else
+                                    :
+          fi
+        else
+                              found_dir=
+          found_la=
+          found_so=
+          found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
+          if test $use_additional = yes; then
+            dir="$additional_libdir"
+                                    if test -n "$acl_shlibext"; then
+              if test -f "$dir/$libname$shrext"; then
+                found_dir="$dir"
+                found_so="$dir/$libname$shrext"
+              else
+                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                  ver=`(cd "$dir" && \
+                        for f in "$libname$shrext".*; do echo "$f"; done \
+                        | sed -e "s,^$libname$shrext\\\\.,," \
+                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                        | sed 1q ) 2>/dev/null`
+                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                    found_dir="$dir"
+                    found_so="$dir/$libname$shrext.$ver"
+                  fi
+                else
+                  eval library_names=\"$acl_library_names_spec\"
+                  for f in $library_names; do
+                    if test -f "$dir/$f"; then
+                      found_dir="$dir"
+                      found_so="$dir/$f"
+                      break
+                    fi
+                  done
+                fi
+              fi
+            fi
+                        if test "X$found_dir" = "X"; then
+              if test -f "$dir/$libname.$acl_libext"; then
+                found_dir="$dir"
+                found_a="$dir/$libname.$acl_libext"
+              fi
+            fi
+            if test "X$found_dir" != "X"; then
+              if test -f "$dir/$libname.la"; then
+                found_la="$dir/$libname.la"
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                                    if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
                       fi
                     fi
                   fi
+                                    if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
                   ;;
               esac
               if test "X$found_dir" != "X"; then
             done
           fi
           if test "X$found_dir" != "X"; then
-                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
+                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name"
             if test "X$found_so" != "X"; then
-                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
-                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                                                        if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
               else
                                                                                 haveit=
                 for x in $ltrpathdirs; do
                 if test -z "$haveit"; then
                   ltrpathdirs="$ltrpathdirs $found_dir"
                 fi
-                                if test "$hardcode_direct" = yes; then
-                                                      LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                                if test "$acl_hardcode_direct" = yes; then
+                                                      LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
                 else
-                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
-                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
                                                             haveit=
                     for x in $rpathdirs; do
                       if test "X$x" = "X$found_dir"; then
                       fi
                     done
                     if test -z "$haveit"; then
-                      rpathdirs="$rpathdirs $found_dir"
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                                                                                haveit=
+                    for x in $LDFLAGS $LIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir"
                     fi
-                  else
-                                                                                haveit=
-                    for x in $LDFLAGS $LIBICONV; do
+                    if test "$acl_hardcode_minus_L" != no; then
+                                                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+                    else
+                                                                                                                                                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a"
+              else
+                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name"
+              fi
+            fi
+                        additional_includedir=
+            case "$found_dir" in
+              */$acl_libdirstem | */$acl_libdirstem/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = 'intl'; then
+                  LIBINTL_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = 'intl'; then
+                  LIBINTL_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INCINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                                            INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+                        if test -n "$found_la"; then
+                                                        save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+                            for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                                                                  haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                                                                  haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$dep"
+                    LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+            LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
+                        alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+      done
+            acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+    else
+            for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+            for found_dir in $ltrpathdirs; do
+      LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir"
+    done
+  fi
+
+
+
+
+
+
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5
+$as_echo_n "checking for GNU gettext in libintl... " >&6; }
+if eval \${$gt_func_gnugettext_libintl+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gt_save_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS $INCINTL"
+            gt_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBINTL"
+                        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+
+int
+main ()
+{
+
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$gt_func_gnugettext_libintl=yes"
+else
+  eval "$gt_func_gnugettext_libintl=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+                        if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+
+int
+main ()
+{
+
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  LIBINTL="$LIBINTL $LIBICONV"
+                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                 eval "$gt_func_gnugettext_libintl=yes"
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+            fi
+            CPPFLAGS="$gt_save_CPPFLAGS"
+            LIBS="$gt_save_LIBS"
+fi
+eval ac_res=\$$gt_func_gnugettext_libintl
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+        fi
+
+                                        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
+           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+                && test "$PACKAGE" != gettext-runtime \
+                && test "$PACKAGE" != gettext-tools; }; then
+          gt_use_preinstalled_gnugettext=yes
+        else
+                    LIBINTL=
+          LTLIBINTL=
+          INCINTL=
+        fi
+
+
+
+    if test -n "$INTL_MACOSX_LIBS"; then
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+                LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+      fi
+    fi
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes" \
+       || test "$nls_cv_use_gnu_gettext" = "yes"; then
+
+$as_echo "#define ENABLE_NLS 1" >>confdefs.h
+
+    else
+      USE_NLS=no
+    fi
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5
+$as_echo_n "checking whether to use NLS... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5
+$as_echo "$USE_NLS" >&6; }
+  if test "$USE_NLS" = "yes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5
+$as_echo_n "checking where the gettext function comes from... " >&6; }
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+        gt_source="external libintl"
+      else
+        gt_source="libc"
+      fi
+    else
+      gt_source="included intl directory"
+    fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5
+$as_echo "$gt_source" >&6; }
+  fi
+
+  if test "$USE_NLS" = "yes"; then
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5
+$as_echo_n "checking how to link with libintl... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5
+$as_echo "$LIBINTL" >&6; }
+
+  for element in $INCINTL; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+      fi
+
+
+$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h
+
+    fi
+
+        POSUB=po
+  fi
+
+
+
+    INTLLIBS="$LIBINTL"
+
+
+
+
+
+
+
+
+
+saved_LIBS=$LIBS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for poptConfigFileToString in -lpopt" >&5
+$as_echo_n "checking for poptConfigFileToString in -lpopt... " >&6; }
+if ${ac_cv_lib_popt_poptConfigFileToString+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpopt  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char poptConfigFileToString ();
+int
+main ()
+{
+return poptConfigFileToString ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_popt_poptConfigFileToString=yes
+else
+  ac_cv_lib_popt_poptConfigFileToString=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_popt_poptConfigFileToString" >&5
+$as_echo "$ac_cv_lib_popt_poptConfigFileToString" >&6; }
+if test "x$ac_cv_lib_popt_poptConfigFileToString" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPOPT 1
+_ACEOF
+
+  LIBS="-lpopt $LIBS"
+
+else
+  as_fn_error $? "You need popt 1.7 or newer to compile." "$LINENO" 5
+fi
+
+POPT_LIBS=$LIBS
+
+LIBS=$saved_LIBS
+
+# Check whether --enable-fips was given.
+if test "${enable_fips+set}" = set; then :
+  enableval=$enable_fips;
+fi
+
+if test "x$enable_fips" = "xyes"; then
+
+$as_echo "#define ENABLE_FIPS 1" >>confdefs.h
+
+
+       if test "x$enable_static" = "xyes" -o "x$enable_static_cryptsetup" = "xyes" ; then
+               as_fn_error $? "Static build is not compatible with FIPS." "$LINENO" 5
+       fi
+fi
+
+
+
+# Check whether --enable-pwquality was given.
+if test "${enable_pwquality+set}" = set; then :
+  enableval=$enable_pwquality;
+fi
+
+
+if test "x$enable_pwquality" = "xyes"; then
+
+$as_echo "#define ENABLE_PWQUALITY 1" >>confdefs.h
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pwquality >= 1.0.0" >&5
+$as_echo_n "checking for pwquality >= 1.0.0... " >&6; }
+
+if test -n "$PWQUALITY_CFLAGS"; then
+    pkg_cv_PWQUALITY_CFLAGS="$PWQUALITY_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pwquality >= 1.0.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "pwquality >= 1.0.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PWQUALITY_CFLAGS=`$PKG_CONFIG --cflags "pwquality >= 1.0.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$PWQUALITY_LIBS"; then
+    pkg_cv_PWQUALITY_LIBS="$PWQUALITY_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pwquality >= 1.0.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "pwquality >= 1.0.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PWQUALITY_LIBS=`$PKG_CONFIG --libs "pwquality >= 1.0.0" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               PWQUALITY_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pwquality >= 1.0.0" 2>&1`
+        else
+               PWQUALITY_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pwquality >= 1.0.0" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$PWQUALITY_PKG_ERRORS" >&5
+
+       as_fn_error $? "You need pwquality library." "$LINENO" 5
+elif test $pkg_failed = untried; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       as_fn_error $? "You need pwquality library." "$LINENO" 5
+else
+       PWQUALITY_CFLAGS=$pkg_cv_PWQUALITY_CFLAGS
+       PWQUALITY_LIBS=$pkg_cv_PWQUALITY_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+fi
 
-                      if test "X$x" = "X-L$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
-                    fi
-                    if test "$hardcode_minus_L" != no; then
-                                                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
-                    else
-                                                                                                                                                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
-                    fi
-                  fi
-                fi
-              fi
-            else
-              if test "X$found_a" != "X"; then
-                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
-              else
-                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
-              fi
-            fi
-                        additional_includedir=
-            case "$found_dir" in
-              */$acl_libdirstem | */$acl_libdirstem/)
-                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
-                additional_includedir="$basedir/include"
-                ;;
-            esac
-            if test "X$additional_includedir" != "X"; then
-                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
-                haveit=
-                if test "X$additional_includedir" = "X/usr/local/include"; then
-                  if test -n "$GCC"; then
-                    case $host_os in
-                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
-                    esac
-                  fi
-                fi
-                if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INCICONV; do
+               PWQUALITY_STATIC_LIBS="$PWQUALITY_LIBS -lcrack -lz"
+fi
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+# Check whether --enable-passwdqc was given.
+if test "${enable_passwdqc+set}" = set; then :
+  enableval=$enable_passwdqc;
+fi
 
-                    if test "X$x" = "X-I$additional_includedir"; then
-                      haveit=yes
-                      break
-                    fi
-                  done
-                  if test -z "$haveit"; then
-                    if test -d "$additional_includedir"; then
-                                            INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
-                    fi
-                  fi
-                fi
-              fi
-            fi
-                        if test -n "$found_la"; then
-                                                        save_libdir="$libdir"
-              case "$found_la" in
-                */* | *\\*) . "$found_la" ;;
-                *) . "./$found_la" ;;
-              esac
-              libdir="$save_libdir"
-                            for dep in $dependency_libs; do
-                case "$dep" in
-                  -L*)
-                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
-                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
-                      haveit=
-                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
-                        if test -n "$GCC"; then
-                          case $host_os in
-                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
-                          esac
-                        fi
-                      fi
-                      if test -z "$haveit"; then
-                        haveit=
-                        for x in $LDFLAGS $LIBICONV; do
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+case "$enable_passwdqc" in
+       ""|yes|no) use_passwdqc_config="" ;;
+       /*) use_passwdqc_config="$enable_passwdqc"; enable_passwdqc=yes ;;
+       *) as_fn_error $? "Unrecognized --enable-passwdqc parameter." "$LINENO" 5 ;;
+esac
 
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
-                          fi
-                        fi
-                        haveit=
-                        for x in $LDFLAGS $LTLIBICONV; do
+cat >>confdefs.h <<_ACEOF
+#define PASSWDQC_CONFIG_FILE "$use_passwdqc_config"
+_ACEOF
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
 
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
-                          fi
-                        fi
-                      fi
-                    fi
-                    ;;
-                  -R*)
-                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
-                    if test "$enable_rpath" != no; then
-                                                                  haveit=
-                      for x in $rpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        rpathdirs="$rpathdirs $dir"
-                      fi
-                                                                  haveit=
-                      for x in $ltrpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        ltrpathdirs="$ltrpathdirs $dir"
-                      fi
-                    fi
-                    ;;
-                  -l*)
-                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
-                    ;;
-                  *.la)
-                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
-                    ;;
-                  *)
-                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
-                    LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
-                    ;;
-                esac
-              done
-            fi
-          else
-                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
-            LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
-          fi
-        fi
-      fi
-    done
-  done
-  if test "X$rpathdirs" != "X"; then
-    if test -n "$hardcode_libdir_separator"; then
-                        alldirs=
-      for found_dir in $rpathdirs; do
-        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
-      done
-            acl_save_libdir="$libdir"
-      libdir="$alldirs"
-      eval flag=\"$hardcode_libdir_flag_spec\"
-      libdir="$acl_save_libdir"
-      LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
-    else
-            for found_dir in $rpathdirs; do
-        acl_save_libdir="$libdir"
-        libdir="$found_dir"
-        eval flag=\"$hardcode_libdir_flag_spec\"
-        libdir="$acl_save_libdir"
-        LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
-      done
-    fi
-  fi
-  if test "X$ltrpathdirs" != "X"; then
-            for found_dir in $ltrpathdirs; do
-      LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
-    done
-  fi
+if test "x$enable_passwdqc" = "xyes"; then
+
+$as_echo "#define ENABLE_PASSWDQC 1" >>confdefs.h
+
+
+       PASSWDQC_LIBS="-lpasswdqc"
+fi
+
+if test "x$enable_pwquality$enable_passwdqc" = "xyesyes"; then
+       as_fn_error $? "--enable-pwquality and --enable-passwdqc are mutually incompatible." "$LINENO" 5
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+saved_LIBS=$LIBS
+
+# Check whether --enable-static-cryptsetup was given.
+if test "${enable_static_cryptsetup+set}" = set; then :
+  enableval=$enable_static_cryptsetup;
+fi
+
+if test "x$enable_static_cryptsetup" = "xyes"; then
+       if test "x$enable_static" = "xno"; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Requested static cryptsetup build, enabling static library." >&5
+$as_echo "$as_me: WARNING: Requested static cryptsetup build, enabling static library." >&2;}
+               enable_static=yes
+       fi
+fi
+ if test "x$enable_static_cryptsetup" = "xyes"; then
+  STATIC_TOOLS_TRUE=
+  STATIC_TOOLS_FALSE='#'
+else
+  STATIC_TOOLS_TRUE='#'
+  STATIC_TOOLS_FALSE=
+fi
+
+
+# Check whether --enable-cryptsetup was given.
+if test "${enable_cryptsetup+set}" = set; then :
+  enableval=$enable_cryptsetup;
+else
+  enable_cryptsetup=yes
+fi
+
+ if test "x$enable_cryptsetup" = "xyes"; then
+  CRYPTSETUP_TRUE=
+  CRYPTSETUP_FALSE='#'
+else
+  CRYPTSETUP_TRUE='#'
+  CRYPTSETUP_FALSE=
+fi
+
+
+# Check whether --enable-veritysetup was given.
+if test "${enable_veritysetup+set}" = set; then :
+  enableval=$enable_veritysetup;
+else
+  enable_veritysetup=yes
+fi
+
+ if test "x$enable_veritysetup" = "xyes"; then
+  VERITYSETUP_TRUE=
+  VERITYSETUP_FALSE='#'
+else
+  VERITYSETUP_TRUE='#'
+  VERITYSETUP_FALSE=
+fi
+
+
+# Check whether --enable-cryptsetup-reencrypt was given.
+if test "${enable_cryptsetup_reencrypt+set}" = set; then :
+  enableval=$enable_cryptsetup_reencrypt;
+else
+  enable_cryptsetup_reencrypt=yes
+fi
 
+ if test "x$enable_cryptsetup_reencrypt" = "xyes"; then
+  REENCRYPT_TRUE=
+  REENCRYPT_FALSE='#'
+else
+  REENCRYPT_TRUE='#'
+  REENCRYPT_FALSE=
+fi
 
 
+# Check whether --enable-integritysetup was given.
+if test "${enable_integritysetup+set}" = set; then :
+  enableval=$enable_integritysetup;
+else
+  enable_integritysetup=yes
+fi
 
+ if test "x$enable_integritysetup" = "xyes"; then
+  INTEGRITYSETUP_TRUE=
+  INTEGRITYSETUP_FALSE='#'
+else
+  INTEGRITYSETUP_TRUE='#'
+  INTEGRITYSETUP_FALSE=
+fi
 
 
+# Check whether --enable-selinux was given.
+if test "${enable_selinux+set}" = set; then :
+  enableval=$enable_selinux;
+else
+  enable_selinux=yes
+fi
 
 
+# Check whether --enable-udev was given.
+if test "${enable_udev+set}" = set; then :
+  enableval=$enable_udev;
+else
+  enable_udev=yes
+fi
 
 
 
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for devmapper >= 1.02.03" >&5
+$as_echo_n "checking for devmapper >= 1.02.03... " >&6; }
 
+if test -n "$DEVMAPPER_CFLAGS"; then
+    pkg_cv_DEVMAPPER_CFLAGS="$DEVMAPPER_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"devmapper >= 1.02.03\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "devmapper >= 1.02.03") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEVMAPPER_CFLAGS=`$PKG_CONFIG --cflags "devmapper >= 1.02.03" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$DEVMAPPER_LIBS"; then
+    pkg_cv_DEVMAPPER_LIBS="$DEVMAPPER_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"devmapper >= 1.02.03\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "devmapper >= 1.02.03") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEVMAPPER_LIBS=`$PKG_CONFIG --libs "devmapper >= 1.02.03" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
 
 
 
+if test $pkg_failed = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               DEVMAPPER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "devmapper >= 1.02.03" 2>&1`
+        else
+               DEVMAPPER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "devmapper >= 1.02.03" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$DEVMAPPER_PKG_ERRORS" >&5
 
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5
-$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; }
-if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_name in -ldevmapper" >&5
+$as_echo_n "checking for dm_task_set_name in -ldevmapper... " >&6; }
+if ${ac_cv_lib_devmapper_dm_task_set_name+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  gt_save_LIBS="$LIBS"
-     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
-     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldevmapper  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <CoreFoundation/CFPreferences.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dm_task_set_name ();
 int
 main ()
 {
-CFPreferencesCopyAppValue(NULL, NULL)
+return dm_task_set_name ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gt_cv_func_CFPreferencesCopyAppValue=yes
+  ac_cv_lib_devmapper_dm_task_set_name=yes
 else
-  gt_cv_func_CFPreferencesCopyAppValue=no
+  ac_cv_lib_devmapper_dm_task_set_name=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-     LIBS="$gt_save_LIBS"
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5
-$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; }
-  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_name" >&5
+$as_echo "$ac_cv_lib_devmapper_dm_task_set_name" >&6; }
+if test "x$ac_cv_lib_devmapper_dm_task_set_name" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDEVMAPPER 1
+_ACEOF
 
-$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h
+  LIBS="-ldevmapper $LIBS"
 
-  fi
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5
-$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; }
-if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then :
+else
+  as_fn_error $? "You need the device-mapper library." "$LINENO" 5
+fi
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_message in -ldevmapper" >&5
+$as_echo_n "checking for dm_task_set_message in -ldevmapper... " >&6; }
+if ${ac_cv_lib_devmapper_dm_task_set_message+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  gt_save_LIBS="$LIBS"
-     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
-     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldevmapper  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <CoreFoundation/CFLocale.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dm_task_set_message ();
 int
 main ()
 {
-CFLocaleCopyCurrent();
+return dm_task_set_message ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gt_cv_func_CFLocaleCopyCurrent=yes
+  ac_cv_lib_devmapper_dm_task_set_message=yes
 else
-  gt_cv_func_CFLocaleCopyCurrent=no
+  ac_cv_lib_devmapper_dm_task_set_message=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-     LIBS="$gt_save_LIBS"
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5
-$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; }
-  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
-
-$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h
-
-  fi
-  INTL_MACOSX_LIBS=
-  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
-    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
-  fi
-
-
-
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_message" >&5
+$as_echo "$ac_cv_lib_devmapper_dm_task_set_message" >&6; }
+if test "x$ac_cv_lib_devmapper_dm_task_set_message" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDEVMAPPER 1
+_ACEOF
 
+  LIBS="-ldevmapper $LIBS"
 
-  LIBINTL=
-  LTLIBINTL=
-  POSUB=
+else
+  as_fn_error $? "The device-mapper library on your system is too old." "$LINENO" 5
+fi
 
-    if test "$USE_NLS" = "yes"; then
-    gt_use_preinstalled_gnugettext=no
+       DEVMAPPER_LIBS=$LIBS
 
+elif test $pkg_failed = untried; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_name in -ldevmapper" >&5
+$as_echo_n "checking for dm_task_set_name in -ldevmapper... " >&6; }
+if ${ac_cv_lib_devmapper_dm_task_set_name+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldevmapper  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dm_task_set_name ();
+int
+main ()
+{
+return dm_task_set_name ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_devmapper_dm_task_set_name=yes
+else
+  ac_cv_lib_devmapper_dm_task_set_name=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_name" >&5
+$as_echo "$ac_cv_lib_devmapper_dm_task_set_name" >&6; }
+if test "x$ac_cv_lib_devmapper_dm_task_set_name" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDEVMAPPER 1
+_ACEOF
 
+  LIBS="-ldevmapper $LIBS"
 
+else
+  as_fn_error $? "You need the device-mapper library." "$LINENO" 5
+fi
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5
-$as_echo_n "checking for GNU gettext in libc... " >&6; }
-if ${gt_cv_func_gnugettext2_libc+:} false; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_message in -ldevmapper" >&5
+$as_echo_n "checking for dm_task_set_message in -ldevmapper... " >&6; }
+if ${ac_cv_lib_devmapper_dm_task_set_message+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldevmapper  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <libintl.h>
-extern int _nl_msg_cat_cntr;
-extern int *_nl_domain_bindings;
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dm_task_set_message ();
 int
 main ()
 {
-bindtextdomain ("", "");
-return * gettext ("") + * ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_domain_bindings
+return dm_task_set_message ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gt_cv_func_gnugettext2_libc=yes
+  ac_cv_lib_devmapper_dm_task_set_message=yes
 else
-  gt_cv_func_gnugettext2_libc=no
+  ac_cv_lib_devmapper_dm_task_set_message=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext2_libc" >&5
-$as_echo "$gt_cv_func_gnugettext2_libc" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_message" >&5
+$as_echo "$ac_cv_lib_devmapper_dm_task_set_message" >&6; }
+if test "x$ac_cv_lib_devmapper_dm_task_set_message" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDEVMAPPER 1
+_ACEOF
 
-        if test "$gt_cv_func_gnugettext2_libc" != "yes"; then
+  LIBS="-ldevmapper $LIBS"
 
+else
+  as_fn_error $? "The device-mapper library on your system is too old." "$LINENO" 5
+fi
 
+       DEVMAPPER_LIBS=$LIBS
 
+else
+       DEVMAPPER_CFLAGS=$pkg_cv_DEVMAPPER_CFLAGS
+       DEVMAPPER_LIBS=$pkg_cv_DEVMAPPER_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
+fi
+LIBS=$saved_LIBS
 
-          am_save_CPPFLAGS="$CPPFLAGS"
+LIBS="$LIBS $DEVMAPPER_LIBS"
+ac_fn_c_check_decl "$LINENO" "dm_task_secure_data" "ac_cv_have_decl_dm_task_secure_data" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_dm_task_secure_data" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
 
-  for element in $INCICONV; do
-    haveit=
-    for x in $CPPFLAGS; do
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_TASK_SECURE_DATA $ac_have_decl
+_ACEOF
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+ac_fn_c_check_decl "$LINENO" "dm_task_retry_remove" "ac_cv_have_decl_dm_task_retry_remove" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_dm_task_retry_remove" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
 
-      if test "X$x" = "X$element"; then
-        haveit=yes
-        break
-      fi
-    done
-    if test -z "$haveit"; then
-      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
-    fi
-  done
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_TASK_RETRY_REMOVE $ac_have_decl
+_ACEOF
 
+ac_fn_c_check_decl "$LINENO" "dm_task_deferred_remove" "ac_cv_have_decl_dm_task_deferred_remove" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_dm_task_deferred_remove" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
-$as_echo_n "checking for iconv... " >&6; }
-if ${am_cv_func_iconv+:} false; then :
-  $as_echo_n "(cached) " >&6
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_TASK_DEFERRED_REMOVE $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "dm_device_has_mounted_fs" "ac_cv_have_decl_dm_device_has_mounted_fs" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_dm_device_has_mounted_fs" = xyes; then :
+  ac_have_decl=1
 else
+  ac_have_decl=0
+fi
 
-    am_cv_func_iconv="no, consider installing GNU libiconv"
-    am_cv_lib_iconv=no
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <iconv.h>
-int
-main ()
-{
-iconv_t cd = iconv_open("","");
-       iconv(cd,NULL,NULL,NULL,NULL);
-       iconv_close(cd);
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_DEVICE_HAS_MOUNTED_FS $ac_have_decl
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  am_cv_func_iconv=yes
+
+ac_fn_c_check_decl "$LINENO" "dm_device_has_holders" "ac_cv_have_decl_dm_device_has_holders" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_dm_device_has_holders" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    if test "$am_cv_func_iconv" != yes; then
-      am_save_LIBS="$LIBS"
-      LIBS="$LIBS $LIBICONV"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <iconv.h>
-int
-main ()
-{
-iconv_t cd = iconv_open("","");
-         iconv(cd,NULL,NULL,NULL,NULL);
-         iconv_close(cd);
-  ;
-  return 0;
-}
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_DEVICE_HAS_HOLDERS $ac_have_decl
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes
+
+ac_fn_c_check_decl "$LINENO" "dm_device_get_name" "ac_cv_have_decl_dm_device_get_name" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_dm_device_get_name" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-      LIBS="$am_save_LIBS"
-    fi
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_DEVICE_GET_NAME $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "DM_DEVICE_GET_TARGET_VERSION" "ac_cv_have_decl_DM_DEVICE_GET_TARGET_VERSION" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_DM_DEVICE_GET_TARGET_VERSION" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5
-$as_echo "$am_cv_func_iconv" >&6; }
-  if test "$am_cv_func_iconv" = yes; then
 
-$as_echo "#define HAVE_ICONV 1" >>confdefs.h
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_DEVICE_GET_TARGET_VERSION $ac_have_decl
+_ACEOF
 
-  fi
-  if test "$am_cv_lib_iconv" = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5
-$as_echo_n "checking how to link with libiconv... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5
-$as_echo "$LIBICONV" >&6; }
-  else
-            CPPFLAGS="$am_save_CPPFLAGS"
-    LIBICONV=
-    LTLIBICONV=
-  fi
+ac_fn_c_check_decl "$LINENO" "DM_UDEV_DISABLE_DISK_RULES_FLAG" "ac_cv_have_decl_DM_UDEV_DISABLE_DISK_RULES_FLAG" "#include <libdevmapper.h>
+"
+if test "x$ac_cv_have_decl_DM_UDEV_DISABLE_DISK_RULES_FLAG" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_DM_UDEV_DISABLE_DISK_RULES_FLAG $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+  have_cookie=yes
+else
+  have_cookie=no
+fi
 
+if test "x$enable_udev" = xyes; then
+       if test "x$have_cookie" = xno; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The device-mapper library on your system has no udev support, udev support disabled." >&5
+$as_echo "$as_me: WARNING: The device-mapper library on your system has no udev support, udev support disabled." >&2;}
+       else
 
+$as_echo "#define USE_UDEV 1" >>confdefs.h
 
+       fi
+fi
+LIBS=$saved_LIBS
 
 
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for json-c" >&5
+$as_echo_n "checking for json-c... " >&6; }
 
-    use_additional=yes
+if test -n "$JSON_C_CFLAGS"; then
+    pkg_cv_JSON_C_CFLAGS="$JSON_C_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_JSON_C_CFLAGS=`$PKG_CONFIG --cflags "json-c" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$JSON_C_LIBS"; then
+    pkg_cv_JSON_C_LIBS="$JSON_C_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_JSON_C_LIBS=`$PKG_CONFIG --libs "json-c" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
 
-    eval additional_includedir=\"$includedir\"
-    eval additional_libdir=\"$libdir\"
 
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+if test $pkg_failed = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               JSON_C_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c" 2>&1`
+        else
+               JSON_C_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$JSON_C_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (json-c) were not met:
+
+$JSON_C_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables JSON_C_CFLAGS
+and JSON_C_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables JSON_C_CFLAGS
+and JSON_C_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+       JSON_C_CFLAGS=$pkg_cv_JSON_C_CFLAGS
+       JSON_C_LIBS=$pkg_cv_JSON_C_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+ac_fn_c_check_decl "$LINENO" "json_object_object_add_ex" "ac_cv_have_decl_json_object_object_add_ex" "#include <json-c/json.h>
+"
+if test "x$ac_cv_have_decl_json_object_object_add_ex" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_JSON_OBJECT_OBJECT_ADD_EX $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "json_object_deep_copy" "ac_cv_have_decl_json_object_deep_copy" "#include <json-c/json.h>
+"
+if test "x$ac_cv_have_decl_json_object_deep_copy" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_JSON_OBJECT_DEEP_COPY $ac_have_decl
+_ACEOF
+
 
 
-# Check whether --with-libintl-prefix was given.
-if test "${with_libintl_prefix+set}" = set; then :
-  withval=$with_libintl_prefix;
-    if test "X$withval" = "Xno"; then
-      use_additional=no
-    else
-      if test "X$withval" = "X"; then
+# Check whether --with-crypto_backend was given.
+if test "${with_crypto_backend+set}" = set; then :
+  withval=$with_crypto_backend;
+else
+  with_crypto_backend=openssl
+fi
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
 
-          eval additional_includedir=\"$includedir\"
-          eval additional_libdir=\"$libdir\"
+# Check whether --enable-kernel_crypto was given.
+if test "${enable_kernel_crypto+set}" = set; then :
+  enableval=$enable_kernel_crypto;
+else
+  enable_kernel_crypto=yes
+fi
 
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
 
-      else
-        additional_includedir="$withval/include"
-        additional_libdir="$withval/$acl_libdirstem"
-      fi
-    fi
+if test "x$enable_kernel_crypto" = "xyes"; then
+       for ac_header in linux/if_alg.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "linux/if_alg.h" "ac_cv_header_linux_if_alg_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_if_alg_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LINUX_IF_ALG_H 1
+_ACEOF
 
+else
+  as_fn_error $? "You need Linux kernel headers with userspace crypto interface. (Or use --disable-kernel_crypto.)" "$LINENO" 5
 fi
 
-      LIBINTL=
-  LTLIBINTL=
-  INCINTL=
-  rpathdirs=
-  ltrpathdirs=
-  names_already_handled=
-  names_next_round='intl '
-  while test -n "$names_next_round"; do
-    names_this_round="$names_next_round"
-    names_next_round=
-    for name in $names_this_round; do
-      already_handled=
-      for n in $names_already_handled; do
-        if test "$n" = "$name"; then
-          already_handled=yes
-          break
-        fi
-      done
-      if test -z "$already_handled"; then
-        names_already_handled="$names_already_handled $name"
-                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
-        eval value=\"\$HAVE_LIB$uppername\"
-        if test -n "$value"; then
-          if test "$value" = yes; then
-            eval value=\"\$LIB$uppername\"
-            test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value"
-            eval value=\"\$LTLIB$uppername\"
-            test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value"
-          else
-                                    :
-          fi
-        else
-                              found_dir=
-          found_la=
-          found_so=
-          found_a=
-          if test $use_additional = yes; then
-            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
-              found_dir="$additional_libdir"
-              found_so="$additional_libdir/lib$name.$shlibext"
-              if test -f "$additional_libdir/lib$name.la"; then
-                found_la="$additional_libdir/lib$name.la"
-              fi
-            else
-              if test -f "$additional_libdir/lib$name.$libext"; then
-                found_dir="$additional_libdir"
-                found_a="$additional_libdir/lib$name.$libext"
-                if test -f "$additional_libdir/lib$name.la"; then
-                  found_la="$additional_libdir/lib$name.la"
-                fi
-              fi
-            fi
-          fi
-          if test "X$found_dir" = "X"; then
-            for x in $LDFLAGS $LTLIBINTL; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+done
 
-              case "$x" in
-                -L*)
-                  dir=`echo "X$x" | sed -e 's/^X-L//'`
-                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
-                    found_dir="$dir"
-                    found_so="$dir/lib$name.$shlibext"
-                    if test -f "$dir/lib$name.la"; then
-                      found_la="$dir/lib$name.la"
-                    fi
-                  else
-                    if test -f "$dir/lib$name.$libext"; then
-                      found_dir="$dir"
-                      found_a="$dir/lib$name.$libext"
-                      if test -f "$dir/lib$name.la"; then
-                        found_la="$dir/lib$name.la"
-                      fi
-                    fi
-                  fi
-                  ;;
-              esac
-              if test "X$found_dir" != "X"; then
-                break
-              fi
-            done
-          fi
-          if test "X$found_dir" != "X"; then
-                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name"
-            if test "X$found_so" != "X"; then
-                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
-                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
-              else
-                                                                                haveit=
-                for x in $ltrpathdirs; do
-                  if test "X$x" = "X$found_dir"; then
-                    haveit=yes
-                    break
-                  fi
-                done
-                if test -z "$haveit"; then
-                  ltrpathdirs="$ltrpathdirs $found_dir"
-                fi
-                                if test "$hardcode_direct" = yes; then
-                                                      LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
-                else
-                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
-                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
-                                                            haveit=
-                    for x in $rpathdirs; do
-                      if test "X$x" = "X$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      rpathdirs="$rpathdirs $found_dir"
-                    fi
-                  else
-                                                                                haveit=
-                    for x in $LDFLAGS $LIBINTL; do
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+$as_echo "#define ENABLE_AF_ALG 1" >>confdefs.h
 
-                      if test "X$x" = "X-L$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir"
-                    fi
-                    if test "$hardcode_minus_L" != no; then
-                                                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
-                    else
-                                                                                                                                                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
-                    fi
-                  fi
-                fi
-              fi
-            else
-              if test "X$found_a" != "X"; then
-                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a"
-              else
-                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name"
-              fi
-            fi
-                        additional_includedir=
-            case "$found_dir" in
-              */$acl_libdirstem | */$acl_libdirstem/)
-                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
-                additional_includedir="$basedir/include"
-                ;;
-            esac
-            if test "X$additional_includedir" != "X"; then
-                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
-                haveit=
-                if test "X$additional_includedir" = "X/usr/local/include"; then
-                  if test -n "$GCC"; then
-                    case $host_os in
-                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
-                    esac
-                  fi
-                fi
-                if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INCINTL; do
+fi
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+case $with_crypto_backend in
+       gcrypt)
+       if test "x$enable_fips" = "xyes"; then
+               GCRYPT_REQ_VERSION=1.4.5
+       else
+               GCRYPT_REQ_VERSION=1.1.42
+       fi
 
-                    if test "X$x" = "X-I$additional_includedir"; then
-                      haveit=yes
-                      break
-                    fi
-                  done
-                  if test -z "$haveit"; then
-                    if test -d "$additional_includedir"; then
-                                            INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir"
-                    fi
-                  fi
-                fi
-              fi
-            fi
-                        if test -n "$found_la"; then
-                                                        save_libdir="$libdir"
-              case "$found_la" in
-                */* | *\\*) . "$found_la" ;;
-                *) . "./$found_la" ;;
-              esac
-              libdir="$save_libdir"
-                            for dep in $dependency_libs; do
-                case "$dep" in
-                  -L*)
-                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
-                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
-                      haveit=
-                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
-                        if test -n "$GCC"; then
-                          case $host_os in
-                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
-                          esac
-                        fi
-                      fi
-                      if test -z "$haveit"; then
-                        haveit=
-                        for x in $LDFLAGS $LIBINTL; do
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+       # Check whether --enable-gcrypt-pbkdf2 was given.
+if test "${enable_gcrypt_pbkdf2+set}" = set; then :
+  enableval=$enable_gcrypt_pbkdf2; if test "x$enableval" = "xyes"; then
+                       use_internal_pbkdf2=0
+               else
+                       use_internal_pbkdf2=1
+               fi
+else
 
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir"
-                          fi
-                        fi
-                        haveit=
-                        for x in $LDFLAGS $LTLIBINTL; do
 
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
+# Check whether --with-libgcrypt-prefix was given.
+if test "${with_libgcrypt_prefix+set}" = set; then :
+  withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval"
+else
+  libgcrypt_config_prefix=""
+fi
 
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir"
-                          fi
-                        fi
-                      fi
-                    fi
-                    ;;
-                  -R*)
-                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
-                    if test "$enable_rpath" != no; then
-                                                                  haveit=
-                      for x in $rpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        rpathdirs="$rpathdirs $dir"
-                      fi
-                                                                  haveit=
-                      for x in $ltrpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        ltrpathdirs="$ltrpathdirs $dir"
-                      fi
-                    fi
-                    ;;
-                  -l*)
-                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
-                    ;;
-                  *.la)
-                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
-                    ;;
-                  *)
-                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$dep"
-                    LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep"
-                    ;;
-                esac
-              done
-            fi
-          else
-                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
-            LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name"
-          fi
-        fi
-      fi
-    done
-  done
-  if test "X$rpathdirs" != "X"; then
-    if test -n "$hardcode_libdir_separator"; then
-                        alldirs=
-      for found_dir in $rpathdirs; do
-        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
-      done
-            acl_save_libdir="$libdir"
-      libdir="$alldirs"
-      eval flag=\"$hardcode_libdir_flag_spec\"
-      libdir="$acl_save_libdir"
-      LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
-    else
-            for found_dir in $rpathdirs; do
-        acl_save_libdir="$libdir"
-        libdir="$found_dir"
-        eval flag=\"$hardcode_libdir_flag_spec\"
-        libdir="$acl_save_libdir"
-        LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
-      done
-    fi
-  fi
-  if test "X$ltrpathdirs" != "X"; then
-            for found_dir in $ltrpathdirs; do
-      LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir"
-    done
+  if test x"${LIBGCRYPT_CONFIG}" = x ; then
+     if test x"${libgcrypt_config_prefix}" != x ; then
+        LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config"
+     fi
   fi
 
-          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5
-$as_echo_n "checking for GNU gettext in libintl... " >&6; }
-if ${gt_cv_func_gnugettext2_libintl+:} false; then :
+  use_gpgrt_config=""
+  if test x"${LIBGCRYPT_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+    if $GPGRT_CONFIG libgcrypt --exists; then
+      LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Use gpgrt-config as libgcrypt-config" >&5
+$as_echo "$as_me: Use gpgrt-config as libgcrypt-config" >&6;}
+      use_gpgrt_config=yes
+    fi
+  fi
+  if test -z "$use_gpgrt_config"; then
+    if test x"${LIBGCRYPT_CONFIG}" = x ; then
+      case "${SYSROOT}" in
+         /*)
+           if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
+             LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
+           fi
+           ;;
+         '')
+           ;;
+          *)
+           { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&5
+$as_echo "$as_me: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&2;}
+           ;;
+      esac
+    fi
+    # Extract the first word of "libgcrypt-config", so it can be a program name with args.
+set dummy libgcrypt-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LIBGCRYPT_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  gt_save_CPPFLAGS="$CPPFLAGS"
-            CPPFLAGS="$CPPFLAGS $INCINTL"
-            gt_save_LIBS="$LIBS"
-            LIBS="$LIBS $LIBINTL"
-                        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <libintl.h>
-extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias (const char *);
-int
-main ()
-{
-bindtextdomain ("", "");
-return * gettext ("") + * ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias ("")
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gt_cv_func_gnugettext2_libintl=yes
+  case $LIBGCRYPT_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no"
+  ;;
+esac
+fi
+LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG
+if test -n "$LIBGCRYPT_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5
+$as_echo "$LIBGCRYPT_CONFIG" >&6; }
 else
-  gt_cv_func_gnugettext2_libintl=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-                        if test "$gt_cv_func_gnugettext2_libintl" != yes && test -n "$LIBICONV"; then
-              LIBS="$LIBS $LIBICONV"
-              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <libintl.h>
-extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias (const char *);
-int
-main ()
-{
-bindtextdomain ("", "");
-return * gettext ("") + * ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias ("")
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  LIBINTL="$LIBINTL $LIBICONV"
-                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
-                gt_cv_func_gnugettext2_libintl=yes
 
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
+
+  fi
+
+  tmp=1.6.1
+  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+     req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+     min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  else
+     req_libgcrypt_api=0
+     min_libgcrypt_version="$tmp"
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5
+$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; }
+  ok=no
+  if test "$LIBGCRYPT_CONFIG" != "no" ; then
+    req_major=`echo $min_libgcrypt_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
+    req_minor=`echo $min_libgcrypt_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
+    req_micro=`echo $min_libgcrypt_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
+    if test -z "$use_gpgrt_config"; then
+      libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
+    else
+      libgcrypt_config_version=`$LIBGCRYPT_CONFIG --modversion`
+    fi
+    major=`echo $libgcrypt_config_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
+    minor=`echo $libgcrypt_config_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
+    micro=`echo $libgcrypt_config_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
+    if test "$major" -gt "$req_major"; then
+        ok=yes
+    else
+        if test "$major" -eq "$req_major"; then
+            if test "$minor" -gt "$req_minor"; then
+               ok=yes
+            else
+               if test "$minor" -eq "$req_minor"; then
+                   if test "$micro" -ge "$req_micro"; then
+                     ok=yes
+                   fi
+               fi
             fi
-            CPPFLAGS="$gt_save_CPPFLAGS"
-            LIBS="$gt_save_LIBS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext2_libintl" >&5
-$as_echo "$gt_cv_func_gnugettext2_libintl" >&6; }
         fi
+    fi
+  fi
+  if test $ok = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5
+$as_echo "yes ($libgcrypt_config_version)" >&6; }
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  fi
+  if test $ok = yes; then
+     # If we have a recent libgcrypt, we should also check that the
+     # API is compatible
+     if test "$req_libgcrypt_api" -gt 0 ; then
+        if test -z "$use_gpgrt_config"; then
+           tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+       else
+           tmp=`$LIBGCRYPT_CONFIG --variable=api_version 2>/dev/null || echo 0`
+       fi
+        if test "$tmp" -gt 0 ; then
+           { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5
+$as_echo_n "checking LIBGCRYPT API version... " >&6; }
+           if test "$req_libgcrypt_api" -eq "$tmp" ; then
+             { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5
+$as_echo "okay" >&6; }
+           else
+             ok=no
+             { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5
+$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; }
+           fi
+        fi
+     fi
+  fi
+  if test $ok = yes; then
+    LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
+    LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
+    use_internal_pbkdf2=0
+    if test -z "$use_gpgrt_config"; then
+      libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
+    else
+      libgcrypt_config_host=`$LIBGCRYPT_CONFIG --variable=host 2>/dev/null || echo none`
+    fi
+    if test x"$libgcrypt_config_host" != xnone ; then
+      if test x"$libgcrypt_config_host" != x"$host" ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+***
+*** The config script \"$LIBGCRYPT_CONFIG\" was
+*** built for $libgcrypt_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-libgcrypt-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&5
+$as_echo "$as_me: WARNING:
+***
+*** The config script \"$LIBGCRYPT_CONFIG\" was
+*** built for $libgcrypt_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-libgcrypt-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&2;}
+        gpg_config_script_warn="$gpg_config_script_warn libgcrypt"
+      fi
+    fi
+  else
+    LIBGCRYPT_CFLAGS=""
+    LIBGCRYPT_LIBS=""
+    use_internal_pbkdf2=1
+  fi
 
-                                        if test "$gt_cv_func_gnugettext2_libc" = "yes" \
-           || { test "$gt_cv_func_gnugettext2_libintl" = "yes" \
-                && test "$PACKAGE" != gettext-runtime \
-                && test "$PACKAGE" != gettext-tools; }; then
-          gt_use_preinstalled_gnugettext=yes
-        else
-                    LIBINTL=
-          LTLIBINTL=
-          INCINTL=
-        fi
 
 
+fi
 
-    if test -n "$INTL_MACOSX_LIBS"; then
-      if test "$gt_use_preinstalled_gnugettext" = "yes" \
-         || test "$nls_cv_use_gnu_gettext" = "yes"; then
-                LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
-        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
-      fi
-    fi
 
-    if test "$gt_use_preinstalled_gnugettext" = "yes" \
-       || test "$nls_cv_use_gnu_gettext" = "yes"; then
 
-$as_echo "#define ENABLE_NLS 1" >>confdefs.h
+# Check whether --with-libgcrypt-prefix was given.
+if test "${with_libgcrypt_prefix+set}" = set; then :
+  withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval"
+else
+  libgcrypt_config_prefix=""
+fi
 
-    else
-      USE_NLS=no
-    fi
+  if test x"${LIBGCRYPT_CONFIG}" = x ; then
+     if test x"${libgcrypt_config_prefix}" != x ; then
+        LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config"
+     fi
   fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5
-$as_echo_n "checking whether to use NLS... " >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5
-$as_echo "$USE_NLS" >&6; }
-  if test "$USE_NLS" = "yes"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5
-$as_echo_n "checking where the gettext function comes from... " >&6; }
-    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
-      if test "$gt_cv_func_gnugettext2_libintl" = "yes"; then
-        gt_source="external libintl"
-      else
-        gt_source="libc"
-      fi
-    else
-      gt_source="included intl directory"
+  use_gpgrt_config=""
+  if test x"${LIBGCRYPT_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+    if $GPGRT_CONFIG libgcrypt --exists; then
+      LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Use gpgrt-config as libgcrypt-config" >&5
+$as_echo "$as_me: Use gpgrt-config as libgcrypt-config" >&6;}
+      use_gpgrt_config=yes
     fi
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5
-$as_echo "$gt_source" >&6; }
   fi
-
-  if test "$USE_NLS" = "yes"; then
-
-    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
-      if test "$gt_cv_func_gnugettext2_libintl" = "yes"; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5
-$as_echo_n "checking how to link with libintl... " >&6; }
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5
-$as_echo "$LIBINTL" >&6; }
-
-  for element in $INCINTL; do
-    haveit=
-    for x in $CPPFLAGS; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-      if test "X$x" = "X$element"; then
-        haveit=yes
-        break
-      fi
-    done
-    if test -z "$haveit"; then
-      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+  if test -z "$use_gpgrt_config"; then
+    if test x"${LIBGCRYPT_CONFIG}" = x ; then
+      case "${SYSROOT}" in
+         /*)
+           if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
+             LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
+           fi
+           ;;
+         '')
+           ;;
+          *)
+           { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&5
+$as_echo "$as_me: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&2;}
+           ;;
+      esac
     fi
+    # Extract the first word of "libgcrypt-config", so it can be a program name with args.
+set dummy libgcrypt-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LIBGCRYPT_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LIBGCRYPT_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
+IFS=$as_save_IFS
 
-      fi
-
+  test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no"
+  ;;
+esac
+fi
+LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG
+if test -n "$LIBGCRYPT_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5
+$as_echo "$LIBGCRYPT_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h
 
+  fi
 
-$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h
+  tmp=$GCRYPT_REQ_VERSION
+  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+     req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
+     min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  else
+     req_libgcrypt_api=0
+     min_libgcrypt_version="$tmp"
+  fi
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5
+$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; }
+  ok=no
+  if test "$LIBGCRYPT_CONFIG" != "no" ; then
+    req_major=`echo $min_libgcrypt_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
+    req_minor=`echo $min_libgcrypt_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
+    req_micro=`echo $min_libgcrypt_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
+    if test -z "$use_gpgrt_config"; then
+      libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
+    else
+      libgcrypt_config_version=`$LIBGCRYPT_CONFIG --modversion`
+    fi
+    major=`echo $libgcrypt_config_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
+    minor=`echo $libgcrypt_config_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
+    micro=`echo $libgcrypt_config_version | \
+               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
+    if test "$major" -gt "$req_major"; then
+        ok=yes
+    else
+        if test "$major" -eq "$req_major"; then
+            if test "$minor" -gt "$req_minor"; then
+               ok=yes
+            else
+               if test "$minor" -eq "$req_minor"; then
+                   if test "$micro" -ge "$req_micro"; then
+                     ok=yes
+                   fi
+               fi
+            fi
+        fi
     fi
-
-        POSUB=po
+  fi
+  if test $ok = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5
+$as_echo "yes ($libgcrypt_config_version)" >&6; }
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  fi
+  if test $ok = yes; then
+     # If we have a recent libgcrypt, we should also check that the
+     # API is compatible
+     if test "$req_libgcrypt_api" -gt 0 ; then
+        if test -z "$use_gpgrt_config"; then
+           tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+       else
+           tmp=`$LIBGCRYPT_CONFIG --variable=api_version 2>/dev/null || echo 0`
+       fi
+        if test "$tmp" -gt 0 ; then
+           { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5
+$as_echo_n "checking LIBGCRYPT API version... " >&6; }
+           if test "$req_libgcrypt_api" -eq "$tmp" ; then
+             { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5
+$as_echo "okay" >&6; }
+           else
+             ok=no
+             { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5
+$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; }
+           fi
+        fi
+     fi
+  fi
+  if test $ok = yes; then
+    LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
+    LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
+    :
+    if test -z "$use_gpgrt_config"; then
+      libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
+    else
+      libgcrypt_config_host=`$LIBGCRYPT_CONFIG --variable=host 2>/dev/null || echo none`
+    fi
+    if test x"$libgcrypt_config_host" != xnone ; then
+      if test x"$libgcrypt_config_host" != x"$host" ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+***
+*** The config script \"$LIBGCRYPT_CONFIG\" was
+*** built for $libgcrypt_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-libgcrypt-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&5
+$as_echo "$as_me: WARNING:
+***
+*** The config script \"$LIBGCRYPT_CONFIG\" was
+*** built for $libgcrypt_config_host and thus may not match the
+*** used host $host.
+*** You may want to use the configure option --with-libgcrypt-prefix
+*** to specify a matching config script or use \$SYSROOT.
+***" >&2;}
+        gpg_config_script_warn="$gpg_config_script_warn libgcrypt"
+      fi
+    fi
+  else
+    LIBGCRYPT_CFLAGS=""
+    LIBGCRYPT_LIBS=""
+    as_fn_error $? "You need the gcrypt library." "$LINENO" 5
   fi
 
 
 
-    INTLLIBS="$LIBINTL"
-
-
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking if internal cryptsetup PBKDF2 is compiled-in" >&5
+$as_echo_n "checking if internal cryptsetup PBKDF2 is compiled-in... " >&6; }
+       if test $use_internal_pbkdf2 = 0; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       else
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
+       if test "x$enable_fips" = "xyes"; then
+               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
+       fi
 
+       fi
 
+       ac_fn_c_check_decl "$LINENO" "GCRY_CIPHER_MODE_XTS" "ac_cv_have_decl_GCRY_CIPHER_MODE_XTS" "#include <gcrypt.h>
+"
+if test "x$ac_cv_have_decl_GCRY_CIPHER_MODE_XTS" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GCRY_CIPHER_MODE_XTS $ac_have_decl
+_ACEOF
 
 
-saved_LIBS=$LIBS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for poptConfigFileToString in -lpopt" >&5
-$as_echo_n "checking for poptConfigFileToString in -lpopt... " >&6; }
-if ${ac_cv_lib_popt_poptConfigFileToString+:} false; then :
+       if test "x$enable_static_cryptsetup" = "xyes"; then
+               saved_LIBS=$LIBS
+               LIBS="$saved_LIBS $LIBGCRYPT_LIBS -static"
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_check_version in -lgcrypt" >&5
+$as_echo_n "checking for gcry_check_version in -lgcrypt... " >&6; }
+if ${ac_cv_lib_gcrypt_gcry_check_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpopt  $LIBS"
+LIBS="-lgcrypt -lgpg-error $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15679,88 +18416,67 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char poptConfigFileToString ();
+char gcry_check_version ();
 int
 main ()
 {
-return poptConfigFileToString ();
+return gcry_check_version ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_popt_poptConfigFileToString=yes
+  ac_cv_lib_gcrypt_gcry_check_version=yes
 else
-  ac_cv_lib_popt_poptConfigFileToString=no
+  ac_cv_lib_gcrypt_gcry_check_version=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_popt_poptConfigFileToString" >&5
-$as_echo "$ac_cv_lib_popt_poptConfigFileToString" >&6; }
-if test "x$ac_cv_lib_popt_poptConfigFileToString" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcrypt_gcry_check_version" >&5
+$as_echo "$ac_cv_lib_gcrypt_gcry_check_version" >&6; }
+if test "x$ac_cv_lib_gcrypt_gcry_check_version" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPOPT 1
+#define HAVE_LIBGCRYPT 1
 _ACEOF
 
-  LIBS="-lpopt $LIBS"
-
-else
-  as_fn_error $? "You need popt 1.7 or newer to compile." "$LINENO" 5
-fi
-
-POPT_LIBS=$LIBS
-
-LIBS=$saved_LIBS
+  LIBS="-lgcrypt $LIBS"
 
-# Check whether --enable-fips was given.
-if test "${enable_fips+set}" = set; then :
-  enableval=$enable_fips; with_fips=$enableval
 else
-  with_fips=no
-fi
-
-
-if test "x$with_fips" = "xyes"; then
-
-$as_echo "#define ENABLE_FIPS 1" >>confdefs.h
-
-
-       if test "x$enable_static" = "xyes" -o "x$enable_static_cryptsetup" = "xyes" ; then
-               as_fn_error $? "Static build is not compatible with FIPS." "$LINENO" 5
-       fi
+  as_fn_error $? "Cannot find static gcrypt library." "$LINENO" 5
 fi
 
+               LIBGCRYPT_STATIC_LIBS="$LIBGCRYPT_LIBS -lgpg-error"
+               LIBS=$saved_LIBS
+        fi
 
+       CRYPTO_CFLAGS=$LIBGCRYPT_CFLAGS
+       CRYPTO_LIBS=$LIBGCRYPT_LIBS
+       CRYPTO_STATIC_LIBS=$LIBGCRYPT_STATIC_LIBS
 
-# Check whether --enable-pwquality was given.
-if test "${enable_pwquality+set}" = set; then :
-  enableval=$enable_pwquality; with_pwquality=$enableval
-else
-  with_pwquality=no
-fi
-
-
-if test "x$with_pwquality" = "xyes"; then
 
-$as_echo "#define ENABLE_PWQUALITY 1" >>confdefs.h
+cat >>confdefs.h <<_ACEOF
+#define GCRYPT_REQ_VERSION "$GCRYPT_REQ_VERSION"
+_ACEOF
 
+ ;;
+       openssl)
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PWQUALITY" >&5
-$as_echo_n "checking for PWQUALITY... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl >= 0.9.8" >&5
+$as_echo_n "checking for openssl >= 0.9.8... " >&6; }
 
-if test -n "$PWQUALITY_CFLAGS"; then
-    pkg_cv_PWQUALITY_CFLAGS="$PWQUALITY_CFLAGS"
+if test -n "$OPENSSL_CFLAGS"; then
+    pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pwquality >= 1.0.0\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "pwquality >= 1.0.0") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 0.9.8\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl >= 0.9.8") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_PWQUALITY_CFLAGS=`$PKG_CONFIG --cflags "pwquality >= 1.0.0" 2>/dev/null`
+  pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl >= 0.9.8" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
  else
     pkg_failed=untried
 fi
-if test -n "$PWQUALITY_LIBS"; then
-    pkg_cv_PWQUALITY_LIBS="$PWQUALITY_LIBS"
+if test -n "$OPENSSL_LIBS"; then
+    pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pwquality >= 1.0.0\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "pwquality >= 1.0.0") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 0.9.8\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl >= 0.9.8") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_PWQUALITY_LIBS=`$PKG_CONFIG --libs "pwquality >= 1.0.0" 2>/dev/null`
+  pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl >= 0.9.8" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -15789,7 +18505,7 @@ fi
 
 
 if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               PWQUALITY_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pwquality >= 1.0.0" 2>&1`
+               OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl >= 0.9.8" 2>&1`
         else
-               PWQUALITY_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pwquality >= 1.0.0" 2>&1`
+               OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl >= 0.9.8" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$PWQUALITY_PKG_ERRORS" >&5
+       echo "$OPENSSL_PKG_ERRORS" >&5
 
-       as_fn_error $? "You need pwquality library." "$LINENO" 5
+       as_fn_error $? "You need openssl library." "$LINENO" 5
 elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-       as_fn_error $? "You need pwquality library." "$LINENO" 5
+       as_fn_error $? "You need openssl library." "$LINENO" 5
 else
-       PWQUALITY_CFLAGS=$pkg_cv_PWQUALITY_CFLAGS
-       PWQUALITY_LIBS=$pkg_cv_PWQUALITY_LIBS
+       OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
+       OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 fi
+       CRYPTO_CFLAGS=$OPENSSL_CFLAGS
+       CRYPTO_LIBS=$OPENSSL_LIBS
+       use_internal_pbkdf2=0
 
-               PWQUALITY_STATIC_LIBS="$PWQUALITY_LIBS -lcrack -lz"
-fi
-
-
-
-
-
-
-
-
-
-
-
+       if test "x$enable_static_cryptsetup" = "xyes"; then
+               saved_PKG_CONFIG=$PKG_CONFIG
+               PKG_CONFIG="$PKG_CONFIG --static"
 
-saved_LIBS=$LIBS
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl" >&5
+$as_echo_n "checking for openssl... " >&6; }
 
-# Check whether --enable-static-cryptsetup was given.
-if test "${enable_static_cryptsetup+set}" = set; then :
-  enableval=$enable_static_cryptsetup;
+if test -n "$OPENSSL_STATIC_CFLAGS"; then
+    pkg_cv_OPENSSL_STATIC_CFLAGS="$OPENSSL_STATIC_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_STATIC_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
 fi
-
-if test x$enable_static_cryptsetup = xyes; then
-       if test x$enable_static = xno; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Requested static cryptsetup build, enabling static library." >&5
-$as_echo "$as_me: WARNING: Requested static cryptsetup build, enabling static library." >&2;}
-               enable_static=yes
-       fi
+ else
+    pkg_failed=untried
 fi
- if test x$enable_static_cryptsetup = xyes; then
-  STATIC_TOOLS_TRUE=
-  STATIC_TOOLS_FALSE='#'
+if test -n "$OPENSSL_STATIC_LIBS"; then
+    pkg_cv_OPENSSL_STATIC_LIBS="$OPENSSL_STATIC_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_OPENSSL_STATIC_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
 else
-  STATIC_TOOLS_TRUE='#'
-  STATIC_TOOLS_FALSE=
+  pkg_failed=yes
 fi
-
-
-# Check whether --enable-veritysetup was given.
-if test "${enable_veritysetup+set}" = set; then :
-  enableval=$enable_veritysetup;
-else
-  enable_veritysetup=yes
+ else
+    pkg_failed=untried
 fi
 
- if test x$enable_veritysetup = xyes; then
-  VERITYSETUP_TRUE=
-  VERITYSETUP_FALSE='#'
-else
-  VERITYSETUP_TRUE='#'
-  VERITYSETUP_FALSE=
-fi
 
 
-# Check whether --enable-cryptsetup-reencrypt was given.
-if test "${enable_cryptsetup_reencrypt+set}" = set; then :
-  enableval=$enable_cryptsetup_reencrypt;
-fi
+if test $pkg_failed = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
- if test x$enable_cryptsetup_reencrypt = xyes; then
-  REENCRYPT_TRUE=
-  REENCRYPT_FALSE='#'
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
 else
-  REENCRYPT_TRUE='#'
-  REENCRYPT_FALSE=
+        _pkg_short_errors_supported=no
 fi
+        if test $_pkg_short_errors_supported = yes; then
+               OPENSSL_STATIC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1`
+        else
+               OPENSSL_STATIC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$OPENSSL_STATIC_PKG_ERRORS" >&5
 
+       as_fn_error $? "Package requirements (openssl) were not met:
 
-# Check whether --enable-selinux was given.
-if test "${enable_selinux+set}" = set; then :
-  enableval=$enable_selinux;
-fi
+$OPENSSL_STATIC_PKG_ERRORS
 
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
-# Check whether --enable-udev was given.
-if test "${enable_udev+set}" = set; then :
-  enableval=$enable_udev;
+Alternatively, you may set the environment variables OPENSSL_STATIC_CFLAGS
+and OPENSSL_STATIC_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables OPENSSL_STATIC_CFLAGS
+and OPENSSL_STATIC_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
 else
-  enable_udev=yes
+       OPENSSL_STATIC_CFLAGS=$pkg_cv_OPENSSL_STATIC_CFLAGS
+       OPENSSL_STATIC_LIBS=$pkg_cv_OPENSSL_STATIC_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
 fi
+               CRYPTO_STATIC_LIBS=$OPENSSL_STATIC_LIBS
+               PKG_CONFIG=$saved_PKG_CONFIG
+       fi
+ ;;
+       nss)
+       if test "x$enable_static_cryptsetup" = "xyes"; then
+               as_fn_error $? "Static build of cryptsetup is not supported with NSS." "$LINENO" 5
+       fi
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: NSS backend does NOT provide backward compatibility (missing ripemd160 hash)." >&5
+$as_echo "$as_me: WARNING: NSS backend does NOT provide backward compatibility (missing ripemd160 hash)." >&2;}
 
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEVMAPPER" >&5
-$as_echo_n "checking for DEVMAPPER... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nss" >&5
+$as_echo_n "checking for nss... " >&6; }
 
-if test -n "$DEVMAPPER_CFLAGS"; then
-    pkg_cv_DEVMAPPER_CFLAGS="$DEVMAPPER_CFLAGS"
+if test -n "$NSS_CFLAGS"; then
+    pkg_cv_NSS_CFLAGS="$NSS_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"devmapper >= 1.02.03\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "devmapper >= 1.02.03") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "nss") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_DEVMAPPER_CFLAGS=`$PKG_CONFIG --cflags "devmapper >= 1.02.03" 2>/dev/null`
+  pkg_cv_NSS_CFLAGS=`$PKG_CONFIG --cflags "nss" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
  else
     pkg_failed=untried
 fi
-if test -n "$DEVMAPPER_LIBS"; then
-    pkg_cv_DEVMAPPER_LIBS="$DEVMAPPER_LIBS"
+if test -n "$NSS_LIBS"; then
+    pkg_cv_NSS_LIBS="$NSS_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"devmapper >= 1.02.03\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "devmapper >= 1.02.03") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "nss") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_DEVMAPPER_LIBS=`$PKG_CONFIG --libs "devmapper >= 1.02.03" 2>/dev/null`
+  pkg_cv_NSS_LIBS=`$PKG_CONFIG --libs "nss" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -15942,7 +18686,7 @@ fi
 
 
 if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -15951,292 +18695,52 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               DEVMAPPER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "devmapper >= 1.02.03" 2>&1`
+               NSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "nss" 2>&1`
         else
-               DEVMAPPER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "devmapper >= 1.02.03" 2>&1`
+               NSS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "nss" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$DEVMAPPER_PKG_ERRORS" >&5
-
-
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_name in -ldevmapper" >&5
-$as_echo_n "checking for dm_task_set_name in -ldevmapper... " >&6; }
-if ${ac_cv_lib_devmapper_dm_task_set_name+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldevmapper  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dm_task_set_name ();
-int
-main ()
-{
-return dm_task_set_name ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_devmapper_dm_task_set_name=yes
-else
-  ac_cv_lib_devmapper_dm_task_set_name=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_name" >&5
-$as_echo "$ac_cv_lib_devmapper_dm_task_set_name" >&6; }
-if test "x$ac_cv_lib_devmapper_dm_task_set_name" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDEVMAPPER 1
-_ACEOF
-
-  LIBS="-ldevmapper $LIBS"
-
-else
-  as_fn_error $? "You need the device-mapper library." "$LINENO" 5
-fi
-
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_message in -ldevmapper" >&5
-$as_echo_n "checking for dm_task_set_message in -ldevmapper... " >&6; }
-if ${ac_cv_lib_devmapper_dm_task_set_message+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldevmapper  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dm_task_set_message ();
-int
-main ()
-{
-return dm_task_set_message ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_devmapper_dm_task_set_message=yes
-else
-  ac_cv_lib_devmapper_dm_task_set_message=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_message" >&5
-$as_echo "$ac_cv_lib_devmapper_dm_task_set_message" >&6; }
-if test "x$ac_cv_lib_devmapper_dm_task_set_message" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDEVMAPPER 1
-_ACEOF
-
-  LIBS="-ldevmapper $LIBS"
-
-else
-  as_fn_error $? "The device-mapper library on your system is too old." "$LINENO" 5
-fi
-
-       DEVMAPPER_LIBS=$LIBS
+       echo "$NSS_PKG_ERRORS" >&5
 
+       as_fn_error $? "You need nss library." "$LINENO" 5
 elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_name in -ldevmapper" >&5
-$as_echo_n "checking for dm_task_set_name in -ldevmapper... " >&6; }
-if ${ac_cv_lib_devmapper_dm_task_set_name+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldevmapper  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dm_task_set_name ();
-int
-main ()
-{
-return dm_task_set_name ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_devmapper_dm_task_set_name=yes
-else
-  ac_cv_lib_devmapper_dm_task_set_name=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_name" >&5
-$as_echo "$ac_cv_lib_devmapper_dm_task_set_name" >&6; }
-if test "x$ac_cv_lib_devmapper_dm_task_set_name" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDEVMAPPER 1
-_ACEOF
-
-  LIBS="-ldevmapper $LIBS"
-
-else
-  as_fn_error $? "You need the device-mapper library." "$LINENO" 5
-fi
-
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dm_task_set_message in -ldevmapper" >&5
-$as_echo_n "checking for dm_task_set_message in -ldevmapper... " >&6; }
-if ${ac_cv_lib_devmapper_dm_task_set_message+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldevmapper  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dm_task_set_message ();
-int
-main ()
-{
-return dm_task_set_message ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_devmapper_dm_task_set_message=yes
-else
-  ac_cv_lib_devmapper_dm_task_set_message=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devmapper_dm_task_set_message" >&5
-$as_echo "$ac_cv_lib_devmapper_dm_task_set_message" >&6; }
-if test "x$ac_cv_lib_devmapper_dm_task_set_message" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDEVMAPPER 1
-_ACEOF
-
-  LIBS="-ldevmapper $LIBS"
-
-else
-  as_fn_error $? "The device-mapper library on your system is too old." "$LINENO" 5
-fi
-
-       DEVMAPPER_LIBS=$LIBS
-
+       as_fn_error $? "You need nss library." "$LINENO" 5
 else
-       DEVMAPPER_CFLAGS=$pkg_cv_DEVMAPPER_CFLAGS
-       DEVMAPPER_LIBS=$pkg_cv_DEVMAPPER_LIBS
+       NSS_CFLAGS=$pkg_cv_NSS_CFLAGS
+       NSS_LIBS=$pkg_cv_NSS_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-fi
-LIBS=$saved_LIBS
-
-LIBS="$LIBS $DEVMAPPER_LIBS"
-ac_fn_c_check_decl "$LINENO" "dm_task_secure_data" "ac_cv_have_decl_dm_task_secure_data" "#include <libdevmapper.h>
-"
-if test "x$ac_cv_have_decl_dm_task_secure_data" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_DM_TASK_SECURE_DATA $ac_have_decl
-_ACEOF
-
-ac_fn_c_check_decl "$LINENO" "dm_task_retry_remove" "ac_cv_have_decl_dm_task_retry_remove" "#include <libdevmapper.h>
-"
-if test "x$ac_cv_have_decl_dm_task_retry_remove" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_DM_TASK_RETRY_REMOVE $ac_have_decl
-_ACEOF
-
-ac_fn_c_check_decl "$LINENO" "DM_UDEV_DISABLE_DISK_RULES_FLAG" "ac_cv_have_decl_DM_UDEV_DISABLE_DISK_RULES_FLAG" "#include <libdevmapper.h>
+fi
+
+       saved_CFLAGS=$CFLAGS
+       CFLAGS="$CFLAGS $NSS_CFLAGS"
+       ac_fn_c_check_decl "$LINENO" "NSS_GetVersion" "ac_cv_have_decl_NSS_GetVersion" "#include <nss.h>
 "
-if test "x$ac_cv_have_decl_DM_UDEV_DISABLE_DISK_RULES_FLAG" = xyes; then :
+if test "x$ac_cv_have_decl_NSS_GetVersion" = xyes; then :
   ac_have_decl=1
 else
   ac_have_decl=0
 fi
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_DM_UDEV_DISABLE_DISK_RULES_FLAG $ac_have_decl
+#define HAVE_DECL_NSS_GETVERSION $ac_have_decl
 _ACEOF
-if test $ac_have_decl = 1; then :
-  have_cookie=yes
-else
-  have_cookie=no
-fi
 
-if test "x$enable_udev" = xyes; then
-       if test "x$have_cookie" = xno; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The device-mapper library on your system has no udev support, udev support disabled." >&5
-$as_echo "$as_me: WARNING: The device-mapper library on your system has no udev support, udev support disabled." >&2;}
-       else
+       CFLAGS=$saved_CFLAGS
 
-$as_echo "#define USE_UDEV 1" >>confdefs.h
+       CRYPTO_CFLAGS=$NSS_CFLAGS
+       CRYPTO_LIBS=$NSS_LIBS
+       use_internal_pbkdf2=1
 
+       if test "x$enable_fips" = "xyes"; then
+               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
        fi
-fi
-LIBS=$saved_LIBS
-
-
-# Check whether --with-crypto_backend was given.
-if test "${with_crypto_backend+set}" = set; then :
-  withval=$with_crypto_backend;
-else
-  with_crypto_backend=gcrypt
-
-fi
-
-
-# Check whether --enable-kernel_crypto was given.
-if test "${enable_kernel_crypto+set}" = set; then :
-  enableval=$enable_kernel_crypto; with_kernel_crypto=$enableval
-else
-  with_kernel_crypto=yes
-fi
 
-
-if test "x$with_kernel_crypto" = "xyes"; then
+ ;;
+       kernel)
        for ac_header in linux/if_alg.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "linux/if_alg.h" "ac_cv_header_linux_if_alg_h" "$ac_includes_default"
@@ -16246,557 +18750,217 @@ if test "x$ac_cv_header_linux_if_alg_h" = xyes; then :
 _ACEOF
 
 else
-  as_fn_error $? "You need Linux kernel headers with userspace crypto interface. (Or use --disable-kernel_crypto.)" "$LINENO" 5
+  as_fn_error $? "You need Linux kernel headers with userspace crypto interface." "$LINENO" 5
 fi
 
 done
 
+#      AC_CHECK_DECLS([AF_ALG],,
+#              [AC_MSG_ERROR([You need Linux kernel with userspace crypto interface.])],
+#              [#include <sys/socket.h>])
+       use_internal_pbkdf2=1
 
-$as_echo "#define ENABLE_AF_ALG 1" >>confdefs.h
-
-fi
-
-case $with_crypto_backend in
-       gcrypt)
-       if test "x$with_fips" = "xyes"; then
-               GCRYPT_REQ_VERSION=1.4.5
-       else
-               GCRYPT_REQ_VERSION=1.1.42
+       if test "x$enable_fips" = "xyes"; then
+               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
        fi
-               # Check whether --enable-gcrypt-pbkdf2 was given.
-if test "${enable_gcrypt_pbkdf2+set}" = set; then :
-  enableval=$enable_gcrypt_pbkdf2; if test "x$enableval" = "xyes"; then
-                       use_internal_pbkdf2=0
-               else
-                       use_internal_pbkdf2=1
-               fi
-else
-
-
-# Check whether --with-libgcrypt-prefix was given.
-if test "${with_libgcrypt_prefix+set}" = set; then :
-  withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval"
-else
-  libgcrypt_config_prefix=""
-fi
 
-  if test x$libgcrypt_config_prefix != x ; then
-     if test x${LIBGCRYPT_CONFIG+set} != xset ; then
-        LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
-     fi
-  fi
-
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}libgcrypt-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}libgcrypt-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_LIBGCRYPT_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $LIBGCRYPT_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+ ;;
+       nettle)
+       for ac_header in nettle/sha.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "nettle/sha.h" "ac_cv_header_nettle_sha_h" "$ac_includes_default"
+if test "x$ac_cv_header_nettle_sha_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NETTLE_SHA_H 1
+_ACEOF
 
-  ;;
-esac
-fi
-LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG
-if test -n "$LIBGCRYPT_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5
-$as_echo "$LIBGCRYPT_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  as_fn_error $? "You need Nettle cryptographic library." "$LINENO" 5
 fi
 
-
-fi
-if test -z "$ac_cv_path_LIBGCRYPT_CONFIG"; then
-  ac_pt_LIBGCRYPT_CONFIG=$LIBGCRYPT_CONFIG
-  # Extract the first word of "libgcrypt-config", so it can be a program name with args.
-set dummy libgcrypt-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_LIBGCRYPT_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ac_pt_LIBGCRYPT_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_LIBGCRYPT_CONFIG="$ac_pt_LIBGCRYPT_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_ac_pt_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
 done
-  done
-IFS=$as_save_IFS
 
-  ;;
-esac
-fi
-ac_pt_LIBGCRYPT_CONFIG=$ac_cv_path_ac_pt_LIBGCRYPT_CONFIG
-if test -n "$ac_pt_LIBGCRYPT_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_LIBGCRYPT_CONFIG" >&5
-$as_echo "$ac_pt_LIBGCRYPT_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
+       for ac_header in nettle/version.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "nettle/version.h" "ac_cv_header_nettle_version_h" "$ac_includes_default"
+if test "x$ac_cv_header_nettle_version_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NETTLE_VERSION_H 1
+_ACEOF
 
-  if test "x$ac_pt_LIBGCRYPT_CONFIG" = x; then
-    LIBGCRYPT_CONFIG="no"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    LIBGCRYPT_CONFIG=$ac_pt_LIBGCRYPT_CONFIG
-  fi
-else
-  LIBGCRYPT_CONFIG="$ac_cv_path_LIBGCRYPT_CONFIG"
 fi
 
-  tmp=1.6.1
-  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
-     req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
-     min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
-  else
-     req_libgcrypt_api=0
-     min_libgcrypt_version="$tmp"
-  fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5
-$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; }
-  ok=no
-  if test "$LIBGCRYPT_CONFIG" != "no" ; then
-    req_major=`echo $min_libgcrypt_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
-    req_minor=`echo $min_libgcrypt_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
-    req_micro=`echo $min_libgcrypt_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
-    libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
-    major=`echo $libgcrypt_config_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
-    minor=`echo $libgcrypt_config_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
-    micro=`echo $libgcrypt_config_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
-    if test "$major" -gt "$req_major"; then
-        ok=yes
-    else
-        if test "$major" -eq "$req_major"; then
-            if test "$minor" -gt "$req_minor"; then
-               ok=yes
-            else
-               if test "$minor" -eq "$req_minor"; then
-                   if test "$micro" -ge "$req_micro"; then
-                     ok=yes
-                   fi
-               fi
-            fi
-        fi
-    fi
-  fi
-  if test $ok = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5
-$as_echo "yes ($libgcrypt_config_version)" >&6; }
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  fi
-  if test $ok = yes; then
-     # If we have a recent libgcrypt, we should also check that the
-     # API is compatible
-     if test "$req_libgcrypt_api" -gt 0 ; then
-        tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
-        if test "$tmp" -gt 0 ; then
-           { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5
-$as_echo_n "checking LIBGCRYPT API version... " >&6; }
-           if test "$req_libgcrypt_api" -eq "$tmp" ; then
-             { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5
-$as_echo "okay" >&6; }
-           else
-             ok=no
-             { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5
-$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; }
-           fi
-        fi
-     fi
-  fi
-  if test $ok = yes; then
-    LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
-    LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
-    use_internal_pbkdf2=0
-    libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
-    if test x"$libgcrypt_config_host" != xnone ; then
-      if test x"$libgcrypt_config_host" != x"$host" ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-***
-*** The config script $LIBGCRYPT_CONFIG was
-*** built for $libgcrypt_config_host and thus may not match the
-*** used host $host.
-*** You may want to use the configure option --with-libgcrypt-prefix
-*** to specify a matching config script.
-***" >&5
-$as_echo "$as_me: WARNING:
-***
-*** The config script $LIBGCRYPT_CONFIG was
-*** built for $libgcrypt_config_host and thus may not match the
-*** used host $host.
-*** You may want to use the configure option --with-libgcrypt-prefix
-*** to specify a matching config script.
-***" >&2;}
-      fi
-    fi
-  else
-    LIBGCRYPT_CFLAGS=""
-    LIBGCRYPT_LIBS=""
-    use_internal_pbkdf2=1
-  fi
+done
 
 
+       saved_LIBS=$LIBS
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nettle_pbkdf2_hmac_sha256 in -lnettle" >&5
+$as_echo_n "checking for nettle_pbkdf2_hmac_sha256 in -lnettle... " >&6; }
+if ${ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnettle  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char nettle_pbkdf2_hmac_sha256 ();
+int
+main ()
+{
+return nettle_pbkdf2_hmac_sha256 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256=yes
+else
+  ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256" >&5
+$as_echo "$ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256" >&6; }
+if test "x$ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBNETTLE 1
+_ACEOF
 
+  LIBS="-lnettle $LIBS"
 
-
-# Check whether --with-libgcrypt-prefix was given.
-if test "${with_libgcrypt_prefix+set}" = set; then :
-  withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval"
 else
-  libgcrypt_config_prefix=""
+  as_fn_error $? "You need Nettle library version 2.6 or more recent." "$LINENO" 5
 fi
 
-  if test x$libgcrypt_config_prefix != x ; then
-     if test x${LIBGCRYPT_CONFIG+set} != xset ; then
-        LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
-     fi
-  fi
+       CRYPTO_LIBS=$LIBS
+       LIBS=$saved_LIBS
 
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}libgcrypt-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}libgcrypt-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_LIBGCRYPT_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $LIBGCRYPT_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+       CRYPTO_STATIC_LIBS=$CRYPTO_LIBS
+       use_internal_pbkdf2=0
 
-  ;;
+       if test "x$enable_fips" = "xyes"; then
+               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
+       fi
+
+ ;;
+       *) as_fn_error $? "Unknown crypto backend." "$LINENO" 5 ;;
 esac
-fi
-LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG
-if test -n "$LIBGCRYPT_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5
-$as_echo "$LIBGCRYPT_CONFIG" >&6; }
+ if test "$with_crypto_backend" = "gcrypt"; then
+  CRYPTO_BACKEND_GCRYPT_TRUE=
+  CRYPTO_BACKEND_GCRYPT_FALSE='#'
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  CRYPTO_BACKEND_GCRYPT_TRUE='#'
+  CRYPTO_BACKEND_GCRYPT_FALSE=
 fi
 
-
-fi
-if test -z "$ac_cv_path_LIBGCRYPT_CONFIG"; then
-  ac_pt_LIBGCRYPT_CONFIG=$LIBGCRYPT_CONFIG
-  # Extract the first word of "libgcrypt-config", so it can be a program name with args.
-set dummy libgcrypt-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_LIBGCRYPT_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
+ if test "$with_crypto_backend" = "openssl"; then
+  CRYPTO_BACKEND_OPENSSL_TRUE=
+  CRYPTO_BACKEND_OPENSSL_FALSE='#'
 else
-  case $ac_pt_LIBGCRYPT_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_LIBGCRYPT_CONFIG="$ac_pt_LIBGCRYPT_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_ac_pt_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
+  CRYPTO_BACKEND_OPENSSL_TRUE='#'
+  CRYPTO_BACKEND_OPENSSL_FALSE=
 fi
-ac_pt_LIBGCRYPT_CONFIG=$ac_cv_path_ac_pt_LIBGCRYPT_CONFIG
-if test -n "$ac_pt_LIBGCRYPT_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_LIBGCRYPT_CONFIG" >&5
-$as_echo "$ac_pt_LIBGCRYPT_CONFIG" >&6; }
+
+ if test "$with_crypto_backend" = "nss"; then
+  CRYPTO_BACKEND_NSS_TRUE=
+  CRYPTO_BACKEND_NSS_FALSE='#'
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  CRYPTO_BACKEND_NSS_TRUE='#'
+  CRYPTO_BACKEND_NSS_FALSE=
 fi
 
-  if test "x$ac_pt_LIBGCRYPT_CONFIG" = x; then
-    LIBGCRYPT_CONFIG="no"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    LIBGCRYPT_CONFIG=$ac_pt_LIBGCRYPT_CONFIG
-  fi
+ if test "$with_crypto_backend" = "kernel"; then
+  CRYPTO_BACKEND_KERNEL_TRUE=
+  CRYPTO_BACKEND_KERNEL_FALSE='#'
 else
-  LIBGCRYPT_CONFIG="$ac_cv_path_LIBGCRYPT_CONFIG"
+  CRYPTO_BACKEND_KERNEL_TRUE='#'
+  CRYPTO_BACKEND_KERNEL_FALSE=
 fi
 
-  tmp=$GCRYPT_REQ_VERSION
-  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
-     req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
-     min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
-  else
-     req_libgcrypt_api=0
-     min_libgcrypt_version="$tmp"
-  fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5
-$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; }
-  ok=no
-  if test "$LIBGCRYPT_CONFIG" != "no" ; then
-    req_major=`echo $min_libgcrypt_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
-    req_minor=`echo $min_libgcrypt_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
-    req_micro=`echo $min_libgcrypt_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
-    libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
-    major=`echo $libgcrypt_config_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
-    minor=`echo $libgcrypt_config_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
-    micro=`echo $libgcrypt_config_version | \
-               sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
-    if test "$major" -gt "$req_major"; then
-        ok=yes
-    else
-        if test "$major" -eq "$req_major"; then
-            if test "$minor" -gt "$req_minor"; then
-               ok=yes
-            else
-               if test "$minor" -eq "$req_minor"; then
-                   if test "$micro" -ge "$req_micro"; then
-                     ok=yes
-                   fi
-               fi
-            fi
-        fi
-    fi
-  fi
-  if test $ok = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5
-$as_echo "yes ($libgcrypt_config_version)" >&6; }
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  fi
-  if test $ok = yes; then
-     # If we have a recent libgcrypt, we should also check that the
-     # API is compatible
-     if test "$req_libgcrypt_api" -gt 0 ; then
-        tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
-        if test "$tmp" -gt 0 ; then
-           { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5
-$as_echo_n "checking LIBGCRYPT API version... " >&6; }
-           if test "$req_libgcrypt_api" -eq "$tmp" ; then
-             { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5
-$as_echo "okay" >&6; }
-           else
-             ok=no
-             { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5
-$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; }
-           fi
-        fi
-     fi
-  fi
-  if test $ok = yes; then
-    LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
-    LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
-    :
-    libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
-    if test x"$libgcrypt_config_host" != xnone ; then
-      if test x"$libgcrypt_config_host" != x"$host" ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-***
-*** The config script $LIBGCRYPT_CONFIG was
-*** built for $libgcrypt_config_host and thus may not match the
-*** used host $host.
-*** You may want to use the configure option --with-libgcrypt-prefix
-*** to specify a matching config script.
-***" >&5
-$as_echo "$as_me: WARNING:
-***
-*** The config script $LIBGCRYPT_CONFIG was
-*** built for $libgcrypt_config_host and thus may not match the
-*** used host $host.
-*** You may want to use the configure option --with-libgcrypt-prefix
-*** to specify a matching config script.
-***" >&2;}
-      fi
-    fi
-  else
-    LIBGCRYPT_CFLAGS=""
-    LIBGCRYPT_LIBS=""
-    as_fn_error $? "You need the gcrypt library." "$LINENO" 5
-  fi
-
-
+ if test "$with_crypto_backend" = "nettle"; then
+  CRYPTO_BACKEND_NETTLE_TRUE=
+  CRYPTO_BACKEND_NETTLE_FALSE='#'
+else
+  CRYPTO_BACKEND_NETTLE_TRUE='#'
+  CRYPTO_BACKEND_NETTLE_FALSE=
+fi
 
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking if internal cryptsetup PBKDF2 is compiled-in" >&5
-$as_echo_n "checking if internal cryptsetup PBKDF2 is compiled-in... " >&6; }
-       if test $use_internal_pbkdf2 = 0; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-       else
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+ if test $use_internal_pbkdf2 = 1; then
+  CRYPTO_INTERNAL_PBKDF2_TRUE=
+  CRYPTO_INTERNAL_PBKDF2_FALSE='#'
+else
+  CRYPTO_INTERNAL_PBKDF2_TRUE='#'
+  CRYPTO_INTERNAL_PBKDF2_FALSE=
+fi
 
-       if test "x$with_fips" = "xyes"; then
-               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
-       fi
 
-       fi
+cat >>confdefs.h <<_ACEOF
+#define USE_INTERNAL_PBKDF2 $use_internal_pbkdf2
+_ACEOF
 
-       if test x$enable_static_cryptsetup = xyes; then
-               saved_LIBS=$LIBS
-               LIBS="$saved_LIBS $LIBGCRYPT_LIBS -static"
-               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_check_version in -lgcrypt" >&5
-$as_echo_n "checking for gcry_check_version in -lgcrypt... " >&6; }
-if ${ac_cv_lib_gcrypt_gcry_check_version+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgcrypt -lgpg-error $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gcry_check_version ();
-int
-main ()
-{
-return gcry_check_version ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_gcrypt_gcry_check_version=yes
+# Check whether --enable-internal-argon2 was given.
+if test "${enable_internal_argon2+set}" = set; then :
+  enableval=$enable_internal_argon2;
 else
-  ac_cv_lib_gcrypt_gcry_check_version=no
+  enable_internal_argon2=yes
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
+
+# Check whether --enable-libargon2 was given.
+if test "${enable_libargon2+set}" = set; then :
+  enableval=$enable_libargon2;
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcrypt_gcry_check_version" >&5
-$as_echo "$ac_cv_lib_gcrypt_gcry_check_version" >&6; }
-if test "x$ac_cv_lib_gcrypt_gcry_check_version" = xyes; then :
+
+
+if test "x$enable_libargon2" = "xyes" ; then
+       for ac_header in argon2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "argon2.h" "ac_cv_header_argon2_h" "$ac_includes_default"
+if test "x$ac_cv_header_argon2_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBGCRYPT 1
+#define HAVE_ARGON2_H 1
 _ACEOF
 
-  LIBS="-lgcrypt $LIBS"
-
 else
-  as_fn_error $? "Cannot find static gcrypt library." "$LINENO" 5
+  as_fn_error $? "You need libargon2 development library installed." "$LINENO" 5
 fi
 
-               LIBGCRYPT_STATIC_LIBS="$LIBGCRYPT_LIBS -lgpg-error"
-               LIBS=$saved_LIBS
-        fi
-
-       CRYPTO_CFLAGS=$LIBGCRYPT_CFLAGS
-       CRYPTO_LIBS=$LIBGCRYPT_LIBS
-       CRYPTO_STATIC_LIBS=$LIBGCRYPT_STATIC_LIBS
+done
 
+       ac_fn_c_check_decl "$LINENO" "Argon2_id" "ac_cv_have_decl_Argon2_id" "#include <argon2.h>
+"
+if test "x$ac_cv_have_decl_Argon2_id" = xyes; then :
 
-cat >>confdefs.h <<_ACEOF
-#define GCRYPT_REQ_VERSION "$GCRYPT_REQ_VERSION"
-_ACEOF
+else
+  as_fn_error $? "You need more recent Argon2 library with support for Argon2id." "$LINENO" 5
+fi
 
- ;;
-       openssl)
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL" >&5
-$as_echo_n "checking for OPENSSL... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libargon2" >&5
+$as_echo_n "checking for libargon2... " >&6; }
 
-if test -n "$OPENSSL_CFLAGS"; then
-    pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS"
+if test -n "$LIBARGON2_CFLAGS"; then
+    pkg_cv_LIBARGON2_CFLAGS="$LIBARGON2_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 0.9.8\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "openssl >= 0.9.8") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libargon2") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl >= 0.9.8" 2>/dev/null`
+  pkg_cv_LIBARGON2_CFLAGS=`$PKG_CONFIG --cflags "libargon2" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
  else
     pkg_failed=untried
 fi
-if test -n "$OPENSSL_LIBS"; then
-    pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS"
+if test -n "$LIBARGON2_LIBS"; then
+    pkg_cv_LIBARGON2_LIBS="$LIBARGON2_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 0.9.8\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "openssl >= 0.9.8") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libargon2") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl >= 0.9.8" 2>/dev/null`
+  pkg_cv_LIBARGON2_LIBS=`$PKG_CONFIG --libs "libargon2" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -16825,7 +18989,7 @@ fi
 
 
 if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl >= 0.9.8" 2>&1`
+               LIBARGON2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libargon2" 2>&1`
         else
-               OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl >= 0.9.8" 2>&1`
+               LIBARGON2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libargon2" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$OPENSSL_PKG_ERRORS" >&5
+       echo "$LIBARGON2_PKG_ERRORS" >&5
 
-       as_fn_error $? "You need openssl library." "$LINENO" 5
+       LIBARGON2_LIBS="-largon2"
 elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-       as_fn_error $? "You need openssl library." "$LINENO" 5
+       LIBARGON2_LIBS="-largon2"
 else
-       OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
-       OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
+       LIBARGON2_CFLAGS=$pkg_cv_LIBARGON2_CFLAGS
+       LIBARGON2_LIBS=$pkg_cv_LIBARGON2_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 fi
-       CRYPTO_CFLAGS=$OPENSSL_CFLAGS
-       CRYPTO_LIBS=$OPENSSL_LIBS
-       use_internal_pbkdf2=0
+       enable_internal_argon2=no
+else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Argon2 bundled (slow) reference implementation will be used, please consider to use system library with --enable-libargon2." >&5
+$as_echo "$as_me: WARNING: Argon2 bundled (slow) reference implementation will be used, please consider to use system library with --enable-libargon2." >&2;}
 
-       if test x$enable_static_cryptsetup = xyes; then
-               saved_PKG_CONFIG=$PKG_CONFIG
-               PKG_CONFIG="$PKG_CONFIG --static"
+       # Check whether --enable-internal-sse-argon2 was given.
+if test "${enable_internal_sse_argon2+set}" = set; then :
+  enableval=$enable_internal_sse_argon2;
+fi
 
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_STATIC" >&5
-$as_echo_n "checking for OPENSSL_STATIC... " >&6; }
 
-if test -n "$OPENSSL_STATIC_CFLAGS"; then
-    pkg_cv_OPENSSL_STATIC_CFLAGS="$OPENSSL_STATIC_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_OPENSSL_STATIC_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null`
-                     test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$OPENSSL_STATIC_LIBS"; then
-    pkg_cv_OPENSSL_STATIC_LIBS="$OPENSSL_STATIC_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "openssl") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_OPENSSL_STATIC_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null`
-                     test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
+       if test "x$enable_internal_sse_argon2" = "xyes"; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Argon2 SSE optimization can be used" >&5
+$as_echo_n "checking if Argon2 SSE optimization can be used... " >&6; }
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+                       #include <emmintrin.h>
+                       __m128i testfunc(__m128i *a, __m128i *b) {
+                         return _mm_xor_si128(_mm_loadu_si128(a), _mm_loadu_si128(b));
+                       }
 
+int
+main ()
+{
 
-if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
 else
-        _pkg_short_errors_supported=no
+  enable_internal_sse_argon2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_internal_sse_argon2" >&5
+$as_echo "$enable_internal_sse_argon2" >&6; }
+       fi
 fi
-        if test $_pkg_short_errors_supported = yes; then
-               OPENSSL_STATIC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1`
-        else
-               OPENSSL_STATIC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1`
-        fi
-       # Put the nasty error message in config.log where it belongs
-       echo "$OPENSSL_STATIC_PKG_ERRORS" >&5
-
-       as_fn_error $? "Package requirements (openssl) were not met:
-
-$OPENSSL_STATIC_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
 
-Alternatively, you may set the environment variables OPENSSL_STATIC_CFLAGS
-and OPENSSL_STATIC_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
-elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
+if test "x$enable_internal_argon2" = "xyes"; then
 
-Alternatively, you may set the environment variables OPENSSL_STATIC_CFLAGS
-and OPENSSL_STATIC_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
+$as_echo "#define USE_INTERNAL_ARGON2 1" >>confdefs.h
 
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
+fi
+ if test "x$enable_internal_argon2" = "xyes"; then
+  CRYPTO_INTERNAL_ARGON2_TRUE=
+  CRYPTO_INTERNAL_ARGON2_FALSE='#'
 else
-       OPENSSL_STATIC_CFLAGS=$pkg_cv_OPENSSL_STATIC_CFLAGS
-       OPENSSL_STATIC_LIBS=$pkg_cv_OPENSSL_STATIC_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+  CRYPTO_INTERNAL_ARGON2_TRUE='#'
+  CRYPTO_INTERNAL_ARGON2_FALSE=
+fi
 
+ if test "x$enable_internal_sse_argon2" = "xyes"; then
+  CRYPTO_INTERNAL_SSE_ARGON2_TRUE=
+  CRYPTO_INTERNAL_SSE_ARGON2_FALSE='#'
+else
+  CRYPTO_INTERNAL_SSE_ARGON2_TRUE='#'
+  CRYPTO_INTERNAL_SSE_ARGON2_FALSE=
 fi
-               CRYPTO_STATIC_LIBS=$OPENSSL_STATIC_LIBS
-               PKG_CONFIG=$saved_PKG_CONFIG
-       fi
 
-       if test "x$with_fips" = "xyes"; then
-               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
-       fi
 
- ;;
-       nss)
-       if test x$enable_static_cryptsetup = xyes; then
-               as_fn_error $? "Static build of cryptsetup is not supported with NSS." "$LINENO" 5
-       fi
+# Check whether --enable-blkid was given.
+if test "${enable_blkid+set}" = set; then :
+  enableval=$enable_blkid;
+else
+  enable_blkid=yes
+fi
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: NSS backend does NOT provide backward compatibility (missing ripemd160 hash)." >&5
-$as_echo "$as_me: WARNING: NSS backend does NOT provide backward compatibility (missing ripemd160 hash)." >&2;}
 
+if test "x$enable_blkid" = "xyes"; then
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSS" >&5
-$as_echo_n "checking for NSS... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid" >&5
+$as_echo_n "checking for blkid... " >&6; }
 
-if test -n "$NSS_CFLAGS"; then
-    pkg_cv_NSS_CFLAGS="$NSS_CFLAGS"
+if test -n "$BLKID_CFLAGS"; then
+    pkg_cv_BLKID_CFLAGS="$BLKID_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "nss") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkid\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "blkid") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_NSS_CFLAGS=`$PKG_CONFIG --cflags "nss" 2>/dev/null`
+  pkg_cv_BLKID_CFLAGS=`$PKG_CONFIG --cflags "blkid" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
  else
     pkg_failed=untried
 fi
-if test -n "$NSS_LIBS"; then
-    pkg_cv_NSS_LIBS="$NSS_LIBS"
+if test -n "$BLKID_LIBS"; then
+    pkg_cv_BLKID_LIBS="$BLKID_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "nss") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"blkid\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "blkid") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_NSS_LIBS=`$PKG_CONFIG --libs "nss" 2>/dev/null`
+  pkg_cv_BLKID_LIBS=`$PKG_CONFIG --libs "blkid" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -17011,7 +19133,7 @@ fi
 
 
 if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               NSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "nss" 2>&1`
+               BLKID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "blkid" 2>&1`
         else
-               NSS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "nss" 2>&1`
+               BLKID_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "blkid" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$NSS_PKG_ERRORS" >&5
+       echo "$BLKID_PKG_ERRORS" >&5
 
-       as_fn_error $? "You need nss library." "$LINENO" 5
+       LIBBLKID_LIBS="-lblkid"
 elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-       as_fn_error $? "You need nss library." "$LINENO" 5
+       LIBBLKID_LIBS="-lblkid"
 else
-       NSS_CFLAGS=$pkg_cv_NSS_CFLAGS
-       NSS_LIBS=$pkg_cv_NSS_LIBS
+       BLKID_CFLAGS=$pkg_cv_BLKID_CFLAGS
+       BLKID_LIBS=$pkg_cv_BLKID_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-fi
+$as_echo "#define HAVE_BLKID 1" >>confdefs.h
 
-       saved_CFLAGS=$CFLAGS
-       CFLAGS="$CFLAGS $NSS_CFLAGS"
-       ac_fn_c_check_decl "$LINENO" "NSS_GetVersion" "ac_cv_have_decl_NSS_GetVersion" "#include <nss.h>
-"
-if test "x$ac_cv_have_decl_NSS_GetVersion" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
 fi
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_NSS_GETVERSION $ac_have_decl
-_ACEOF
-
-       CFLAGS=$saved_CFLAGS
-
-       CRYPTO_CFLAGS=$NSS_CFLAGS
-       CRYPTO_LIBS=$NSS_LIBS
-       use_internal_pbkdf2=1
-
-       if test "x$with_fips" = "xyes"; then
-               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
-       fi
-
- ;;
-       kernel)
-       for ac_header in linux/if_alg.h
+       for ac_header in blkid/blkid.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "linux/if_alg.h" "ac_cv_header_linux_if_alg_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_if_alg_h" = xyes; then :
+  ac_fn_c_check_header_mongrel "$LINENO" "blkid/blkid.h" "ac_cv_header_blkid_blkid_h" "$ac_includes_default"
+if test "x$ac_cv_header_blkid_blkid_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_LINUX_IF_ALG_H 1
+#define HAVE_BLKID_BLKID_H 1
 _ACEOF
 
 else
-  as_fn_error $? "You need Linux kernel headers with userspace crypto interface." "$LINENO" 5
+  as_fn_error $? "You need blkid development library installed." "$LINENO" 5
 fi
 
 done
 
-#      AC_CHECK_DECLS([AF_ALG],,
-#              [AC_MSG_ERROR([You need Linux kernel with userspace crypto interface.])],
-#              [#include <sys/socket.h>])
-       use_internal_pbkdf2=1
+       ac_fn_c_check_decl "$LINENO" "blkid_do_wipe" "ac_cv_have_decl_blkid_do_wipe" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_do_wipe" = xyes; then :
 
-       if test "x$with_fips" = "xyes"; then
-               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
-       fi
+$as_echo "#define HAVE_BLKID_WIPE 1" >>confdefs.h
 
- ;;
-       nettle)
-       for ac_header in nettle/sha.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "nettle/sha.h" "ac_cv_header_nettle_sha_h" "$ac_includes_default"
-if test "x$ac_cv_header_nettle_sha_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_NETTLE_SHA_H 1
-_ACEOF
+                       enable_blkid_wipe=yes
 
-else
-  as_fn_error $? "You need Nettle cryptographic library." "$LINENO" 5
 fi
 
-done
+       ac_fn_c_check_decl "$LINENO" "blkid_probe_step_back" "ac_cv_have_decl_blkid_probe_step_back" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_probe_step_back" = xyes; then :
 
+$as_echo "#define HAVE_BLKID_STEP_BACK 1" >>confdefs.h
 
-       saved_LIBS=$LIBS
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nettle_pbkdf2_hmac_sha256 in -lnettle" >&5
-$as_echo_n "checking for nettle_pbkdf2_hmac_sha256 in -lnettle... " >&6; }
-if ${ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256+:} false; then :
-  $as_echo_n "(cached) " >&6
+                       enable_blkid_step_back=yes
+
+fi
+
+       ac_fn_c_check_decl "$LINENO" "blkid_reset_probe" "ac_cv_have_decl_blkid_reset_probe" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_reset_probe" = xyes; then :
+  ac_have_decl=1
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnettle  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  ac_have_decl=0
+fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char nettle_pbkdf2_hmac_sha256 ();
-int
-main ()
-{
-return nettle_pbkdf2_hmac_sha256 ();
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BLKID_RESET_PROBE $ac_have_decl
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256=yes
+if test $ac_have_decl = 1; then :
+
 else
-  ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256=no
+  as_fn_error $? "Can not compile with blkid support, disable it by --disable-blkid." "$LINENO" 5
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ac_fn_c_check_decl "$LINENO" "blkid_probe_set_device" "ac_cv_have_decl_blkid_probe_set_device" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_probe_set_device" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256" >&5
-$as_echo "$ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256" >&6; }
-if test "x$ac_cv_lib_nettle_nettle_pbkdf2_hmac_sha256" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBNETTLE 1
-_ACEOF
 
-  LIBS="-lnettle $LIBS"
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BLKID_PROBE_SET_DEVICE $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
 
 else
-  as_fn_error $? "You need Nettle library version 2.6 or more recent." "$LINENO" 5
+  as_fn_error $? "Can not compile with blkid support, disable it by --disable-blkid." "$LINENO" 5
+fi
+ac_fn_c_check_decl "$LINENO" "blkid_probe_filter_superblocks_type" "ac_cv_have_decl_blkid_probe_filter_superblocks_type" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_probe_filter_superblocks_type" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
 fi
 
-       CRYPTO_LIBS=$LIBS
-       LIBS=$saved_LIBS
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BLKID_PROBE_FILTER_SUPERBLOCKS_TYPE $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
 
-       CRYPTO_STATIC_LIBS=$CRYPTO_LIBS
-       use_internal_pbkdf2=0
+else
+  as_fn_error $? "Can not compile with blkid support, disable it by --disable-blkid." "$LINENO" 5
+fi
+ac_fn_c_check_decl "$LINENO" "blkid_do_safeprobe" "ac_cv_have_decl_blkid_do_safeprobe" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_do_safeprobe" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
 
-       if test "x$with_fips" = "xyes"; then
-               as_fn_error $? "This option is not compatible with FIPS." "$LINENO" 5
-       fi
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BLKID_DO_SAFEPROBE $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
 
- ;;
-       *) as_fn_error $? "Unknown crypto backend." "$LINENO" 5 ;;
-esac
- if test $with_crypto_backend = gcrypt; then
-  CRYPTO_BACKEND_GCRYPT_TRUE=
-  CRYPTO_BACKEND_GCRYPT_FALSE='#'
 else
-  CRYPTO_BACKEND_GCRYPT_TRUE='#'
-  CRYPTO_BACKEND_GCRYPT_FALSE=
+  as_fn_error $? "Can not compile with blkid support, disable it by --disable-blkid." "$LINENO" 5
 fi
-
- if test $with_crypto_backend = openssl; then
-  CRYPTO_BACKEND_OPENSSL_TRUE=
-  CRYPTO_BACKEND_OPENSSL_FALSE='#'
+ac_fn_c_check_decl "$LINENO" "blkid_do_probe" "ac_cv_have_decl_blkid_do_probe" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_do_probe" = xyes; then :
+  ac_have_decl=1
 else
-  CRYPTO_BACKEND_OPENSSL_TRUE='#'
-  CRYPTO_BACKEND_OPENSSL_FALSE=
+  ac_have_decl=0
 fi
 
- if test $with_crypto_backend = nss; then
-  CRYPTO_BACKEND_NSS_TRUE=
-  CRYPTO_BACKEND_NSS_FALSE='#'
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BLKID_DO_PROBE $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+
 else
-  CRYPTO_BACKEND_NSS_TRUE='#'
-  CRYPTO_BACKEND_NSS_FALSE=
+  as_fn_error $? "Can not compile with blkid support, disable it by --disable-blkid." "$LINENO" 5
 fi
-
- if test $with_crypto_backend = kernel; then
-  CRYPTO_BACKEND_KERNEL_TRUE=
-  CRYPTO_BACKEND_KERNEL_FALSE='#'
+ac_fn_c_check_decl "$LINENO" "blkid_probe_lookup_value
+                      " "ac_cv_have_decl_blkid_probe_lookup_value__________" "#include <blkid/blkid.h>
+"
+if test "x$ac_cv_have_decl_blkid_probe_lookup_value__________" = xyes; then :
+  ac_have_decl=1
 else
-  CRYPTO_BACKEND_KERNEL_TRUE='#'
-  CRYPTO_BACKEND_KERNEL_FALSE=
+  ac_have_decl=0
 fi
 
- if test $with_crypto_backend = nettle; then
-  CRYPTO_BACKEND_NETTLE_TRUE=
-  CRYPTO_BACKEND_NETTLE_FALSE='#'
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BLKID_PROBE_LOOKUP_VALUE__________ $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+
 else
-  CRYPTO_BACKEND_NETTLE_TRUE='#'
-  CRYPTO_BACKEND_NETTLE_FALSE=
+  as_fn_error $? "Can not compile with blkid support, disable it by --disable-blkid." "$LINENO" 5
 fi
 
-
- if test $use_internal_pbkdf2 = 1; then
-  CRYPTO_INTERNAL_PBKDF2_TRUE=
-  CRYPTO_INTERNAL_PBKDF2_FALSE='#'
+fi
+ if test "x$enable_blkid" = "xyes"; then
+  HAVE_BLKID_TRUE=
+  HAVE_BLKID_FALSE='#'
 else
-  CRYPTO_INTERNAL_PBKDF2_TRUE='#'
-  CRYPTO_INTERNAL_PBKDF2_FALSE=
+  HAVE_BLKID_TRUE='#'
+  HAVE_BLKID_FALSE=
 fi
 
+ if test "x$enable_blkid_wipe" = "xyes"; then
+  HAVE_BLKID_WIPE_TRUE=
+  HAVE_BLKID_WIPE_FALSE='#'
+else
+  HAVE_BLKID_WIPE_TRUE='#'
+  HAVE_BLKID_WIPE_FALSE=
+fi
 
-cat >>confdefs.h <<_ACEOF
-#define USE_INTERNAL_PBKDF2 $use_internal_pbkdf2
-_ACEOF
+ if test "x$enable_blkid_step_back" = "xyes"; then
+  HAVE_BLKID_STEP_BACK_TRUE=
+  HAVE_BLKID_STEP_BACK_FALSE='#'
+else
+  HAVE_BLKID_STEP_BACK_TRUE='#'
+  HAVE_BLKID_STEP_BACK_FALSE=
+fi
 
 
-if test x$enable_static_cryptsetup = xyes; then
+if test "x$enable_static_cryptsetup" = "xyes"; then
        saved_PKG_CONFIG=$PKG_CONFIG
        PKG_CONFIG="$PKG_CONFIG --static"
 
@@ -17278,8 +19378,8 @@ fi
                LIBS="$saved_LIBS -static"
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEVMAPPER_STATIC" >&5
-$as_echo_n "checking for DEVMAPPER_STATIC... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for devmapper >= 1.02.27" >&5
+$as_echo_n "checking for devmapper >= 1.02.27... " >&6; }
 
 if test -n "$DEVMAPPER_STATIC_CFLAGS"; then
     pkg_cv_DEVMAPPER_STATIC_CFLAGS="$DEVMAPPER_STATIC_CFLAGS"
@@ -17319,7 +19419,7 @@ fi
 
 
 if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -17337,7 +19437,7 @@ fi
 
 
                DEVMAPPER_STATIC_LIBS=$DEVMAPPER_LIBS
-               if test "x$enable_selinux" != xno; then
+               if test "x$enable_selinux" = "xyes"; then
                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sepol_bool_set in -lsepol" >&5
 $as_echo_n "checking for sepol_bool_set in -lsepol... " >&6; }
 if ${ac_cv_lib_sepol_sepol_bool_set+:} false; then :
                fi
 
 elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
                DEVMAPPER_STATIC_LIBS=$DEVMAPPER_LIBS
-               if test "x$enable_selinux" != xno; then
+               if test "x$enable_selinux" = "xyes"; then
                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sepol_bool_set in -lsepol" >&5
 $as_echo_n "checking for sepol_bool_set in -lsepol... " >&6; }
 if ${ac_cv_lib_sepol_sepol_bool_set+:} false; then :
        PKG_CONFIG=$saved_PKG_CONFIG
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd tmpfiles config directory" >&5
+$as_echo_n "checking for systemd tmpfiles config directory... " >&6; }
 
-
-
-
-
-
-
-
-
-
-
-
-
-# Check whether --enable-dev-random was given.
-if test "${enable_dev_random+set}" = set; then :
-  enableval=$enable_dev_random; default_rng=/dev/random
+if test -n "$systemd_tmpfilesdir"; then
+    pkg_cv_systemd_tmpfilesdir="$systemd_tmpfilesdir"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "systemd") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_systemd_tmpfilesdir=`$PKG_CONFIG --variable="tmpfilesdir" "systemd" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
 else
-  default_rng=/dev/urandom
+  pkg_failed=yes
 fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define DEFAULT_RNG "$default_rng"
-_ACEOF
-
-
-
-
-
-
-
-
-# Check whether --enable-python was given.
-if test "${enable_python+set}" = set; then :
-  enableval=$enable_python; with_python=$enableval
-else
-  with_python=no
+ else
+    pkg_failed=untried
 fi
+systemd_tmpfilesdir=$pkg_cv_systemd_tmpfilesdir
 
-
-
-# Check whether --with-python_version was given.
-if test "${with_python_version+set}" = set; then :
-  withval=$with_python_version; PYTHON_VERSION=$withval
-else
-  PYTHON_VERSION=2.6
+if test "x$systemd_tmpfilesdir" = x""; then :
+  systemd_tmpfilesdir=no
 fi
-
-
-if test "x$with_python" = "xyes"; then
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemd_tmpfilesdir" >&5
+$as_echo "$systemd_tmpfilesdir" >&6; }
 
 
 
 
 
-        if test -n "$PYTHON"; then
-      # If the user set $PYTHON, use it and don't search something else.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= $PYTHON_VERSION" >&5
-$as_echo_n "checking whether $PYTHON version is >= $PYTHON_VERSION... " >&6; }
-      prog="import sys
-# split strings by '.' and convert to numeric.  Append some zeros
-# because we need at least 4 digits for the hex conversion.
-# map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '$PYTHON_VERSION'.split('.'))) + [0, 0, 0]
-minverhex = 0
-# xrange is not present in Python 3.0 and range returns an iterator
-for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
-sys.exit(sys.hexversion < minverhex)"
-  if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5
-   ($PYTHON -c "$prog") >&5 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                              as_fn_error $? "Python interpreter is too old" "$LINENO" 5
-fi
-      am_display_PYTHON=$PYTHON
-    else
-      # Otherwise, try each interpreter until we find one that satisfies
-      # VERSION.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= $PYTHON_VERSION" >&5
-$as_echo_n "checking for a Python interpreter with version >= $PYTHON_VERSION... " >&6; }
-if ${am_cv_pathless_PYTHON+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-       for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7  python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
-         test "$am_cv_pathless_PYTHON" = none && break
-         prog="import sys
-# split strings by '.' and convert to numeric.  Append some zeros
-# because we need at least 4 digits for the hex conversion.
-# map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '$PYTHON_VERSION'.split('.'))) + [0, 0, 0]
-minverhex = 0
-# xrange is not present in Python 3.0 and range returns an iterator
-for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
-sys.exit(sys.hexversion < minverhex)"
-  if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5
-   ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; then :
-  break
-fi
-       done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5
-$as_echo "$am_cv_pathless_PYTHON" >&6; }
-      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
-      if test "$am_cv_pathless_PYTHON" = none; then
-       PYTHON=:
-      else
-        # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args.
-set dummy $am_cv_pathless_PYTHON; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PYTHON+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PYTHON in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
 
-  ;;
-esac
-fi
-PYTHON=$ac_cv_path_PYTHON
-if test -n "$PYTHON"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
-$as_echo "$PYTHON" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-      fi
-      am_display_PYTHON=$am_cv_pathless_PYTHON
-    fi
 
 
-  if test "$PYTHON" = :; then
-      as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5
-  else
 
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5
-$as_echo_n "checking for $am_display_PYTHON version... " >&6; }
-if ${am_cv_python_version+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5
-$as_echo "$am_cv_python_version" >&6; }
-  PYTHON_VERSION=$am_cv_python_version
 
 
 
-  PYTHON_PREFIX='${prefix}'
 
-  PYTHON_EXEC_PREFIX='${exec_prefix}'
 
 
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5
-$as_echo_n "checking for $am_display_PYTHON platform... " >&6; }
-if ${am_cv_python_platform+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5
-$as_echo "$am_cv_python_platform" >&6; }
-  PYTHON_PLATFORM=$am_cv_python_platform
-
-
-  # Just factor out some code duplication.
-  am_python_setup_sysconfig="\
-import sys
-# Prefer sysconfig over distutils.sysconfig, for better compatibility
-# with python 3.x.  See automake bug#10227.
-try:
-    import sysconfig
-except ImportError:
-    can_use_sysconfig = 0
-else:
-    can_use_sysconfig = 1
-# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
-# <https://github.com/pypa/virtualenv/issues/118>
-try:
-    from platform import python_implementation
-    if python_implementation() == 'CPython' and sys.version[:3] == '2.7':
-        can_use_sysconfig = 0
-except ImportError:
-    pass"
-
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5
-$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; }
-if ${am_cv_python_pythondir+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$prefix" = xNONE
-     then
-       am_py_prefix=$ac_default_prefix
-     else
-       am_py_prefix=$prefix
-     fi
-     am_cv_python_pythondir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
-    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
-else:
-    from distutils import sysconfig
-    sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
-sys.stdout.write(sitedir)"`
-     case $am_cv_python_pythondir in
-     $am_py_prefix*)
-       am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
-       am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
-       ;;
-     *)
-       case $am_py_prefix in
-         /usr|/System*) ;;
-         *)
-         am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
-         ;;
-       esac
-       ;;
-     esac
 
+# Check whether --enable-dev-random was given.
+if test "${enable_dev_random+set}" = set; then :
+  enableval=$enable_dev_random;
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5
-$as_echo "$am_cv_python_pythondir" >&6; }
-  pythondir=$am_cv_python_pythondir
-
-
 
-  pkgpythondir=\${pythondir}/$PACKAGE
-
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5
-$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; }
-if ${am_cv_python_pyexecdir+:} false; then :
-  $as_echo_n "(cached) " >&6
+if test "x$enable_dev_random" = "xyes"; then
+       default_rng=/dev/random
 else
-  if test "x$exec_prefix" = xNONE
-     then
-       am_py_exec_prefix=$am_py_prefix
-     else
-       am_py_exec_prefix=$exec_prefix
-     fi
-     am_cv_python_pyexecdir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
-    sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
-else:
-    from distutils import sysconfig
-    sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
-sys.stdout.write(sitedir)"`
-     case $am_cv_python_pyexecdir in
-     $am_py_exec_prefix*)
-       am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
-       am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
-       ;;
-     *)
-       case $am_py_exec_prefix in
-         /usr|/System*) ;;
-         *)
-          am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
-          ;;
-       esac
-       ;;
-     esac
-
+       default_rng=/dev/urandom
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5
-$as_echo "$am_cv_python_pyexecdir" >&6; }
-  pyexecdir=$am_cv_python_pyexecdir
-
-
-
-  pkgpyexecdir=\${pyexecdir}/$PACKAGE
-
 
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_RNG "$default_rng"
+_ACEOF
 
-  fi
 
 
 
-       if ! test -x "$PYTHON-config" ; then
-            as_fn_error $? "Cannot find python development packages to build bindings" "$LINENO" 5
-       fi
 
-       PYTHON_INCLUDES=$($PYTHON-config --includes)
 
 
-       PYTHON_LIBS=$($PYTHON-config --libs)
 
-fi
- if test "x$with_python" = "xyes"; then
-  PYTHON_CRYPTSETUP_TRUE=
-  PYTHON_CRYPTSETUP_FALSE='#'
-else
-  PYTHON_CRYPTSETUP_TRUE='#'
-  PYTHON_CRYPTSETUP_FALSE=
-fi
 
 
 
@@ -18059,7 +19899,7 @@ _ACEOF
 else
 
 cat >>confdefs.h <<_ACEOF
-#define DEFAULT_LUKS1_HASH "sha1"
+#define DEFAULT_LUKS1_HASH "sha256"
 _ACEOF
 
 
@@ -18124,6 +19964,39 @@ _ACEOF
 fi
 
 
+# Check whether --enable-luks_adjust_xts_keysize was given.
+if test "${enable_luks_adjust_xts_keysize+set}" = set; then :
+  enableval=$enable_luks_adjust_xts_keysize;
+else
+  enable_luks_adjust_xts_keysize=yes
+fi
+
+if test "x$enable_luks_adjust_xts_keysize" = "xyes"; then
+
+$as_echo "#define ENABLE_LUKS_ADJUST_XTS_KEYSIZE 1" >>confdefs.h
+
+fi
+
+
+# Check whether --with-luks2-pbkdf was given.
+if test "${with_luks2_pbkdf+set}" = set; then :
+  withval=$with_luks2_pbkdf;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_PBKDF "$withval"
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_PBKDF "argon2i"
+_ACEOF
+
+
+
+fi
+
+
 # Check whether --with-luks1-iter-time was given.
 if test "${with_luks1_iter_time+set}" = set; then :
   withval=$with_luks1_iter_time;
@@ -18135,7 +20008,103 @@ _ACEOF
 else
 
 cat >>confdefs.h <<_ACEOF
-#define DEFAULT_LUKS1_ITER_TIME 1000
+#define DEFAULT_LUKS1_ITER_TIME 2000
+_ACEOF
+
+
+
+fi
+
+
+# Check whether --with-luks2-iter-time was given.
+if test "${with_luks2_iter_time+set}" = set; then :
+  withval=$with_luks2_iter_time;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_ITER_TIME $withval
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_ITER_TIME 2000
+_ACEOF
+
+
+
+fi
+
+
+# Check whether --with-luks2-memory-kb was given.
+if test "${with_luks2_memory_kb+set}" = set; then :
+  withval=$with_luks2_memory_kb;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_MEMORY_KB $withval
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_MEMORY_KB 1048576
+_ACEOF
+
+
+
+fi
+
+
+# Check whether --with-luks2-parallel-threads was given.
+if test "${with_luks2_parallel_threads+set}" = set; then :
+  withval=$with_luks2_parallel_threads;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_PARALLEL_THREADS $withval
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_PARALLEL_THREADS 4
+_ACEOF
+
+
+
+fi
+
+
+
+# Check whether --with-luks2-keyslot-cipher was given.
+if test "${with_luks2_keyslot_cipher+set}" = set; then :
+  withval=$with_luks2_keyslot_cipher;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_KEYSLOT_CIPHER "$withval"
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_KEYSLOT_CIPHER "aes-xts-plain64"
+_ACEOF
+
+
+
+fi
+
+
+# Check whether --with-luks2-keyslot-keybits was given.
+if test "${with_luks2_keyslot_keybits+set}" = set; then :
+  withval=$with_luks2_keyslot_keybits;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_KEYSLOT_KEYBITS $withval
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_KEYSLOT_KEYBITS 512
 _ACEOF
 
 
@@ -18298,8 +20267,138 @@ _ACEOF
 fi
 
 
+# Check whether --with-verity-fec-roots was given.
+if test "${with_verity_fec_roots+set}" = set; then :
+  withval=$with_verity_fec_roots;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_VERITY_FEC_ROOTS $withval
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_VERITY_FEC_ROOTS 2
+_ACEOF
+
+
+
+fi
+
+
+
+# Check whether --with-tmpfilesdir was given.
+if test "${with_tmpfilesdir+set}" = set; then :
+  withval=$with_tmpfilesdir;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_TMPFILESDIR "$withval"
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_TMPFILESDIR ""
+_ACEOF
+
+
+
+fi
+
+test -z "$with_tmpfilesdir" && with_tmpfilesdir=$systemd_tmpfilesdir
+test "x$with_tmpfilesdir" = "xno" || {
+
+       case "${with_tmpfilesdir}" in
+               /*) ;;
+               *) as_fn_error $? "with-tmpfilesdir argument must be an absolute path." "$LINENO" 5;;
+       esac
+
+       DEFAULT_TMPFILESDIR=$with_tmpfilesdir
+
+}
+ if test -n "$DEFAULT_TMPFILESDIR"; then
+  CRYPTSETUP_TMPFILE_TRUE=
+  CRYPTSETUP_TMPFILE_FALSE='#'
+else
+  CRYPTSETUP_TMPFILE_TRUE='#'
+  CRYPTSETUP_TMPFILE_FALSE=
+fi
+
+
+
+# Check whether --with-luks2-lock-path was given.
+if test "${with_luks2_lock_path+set}" = set; then :
+  withval=$with_luks2_lock_path;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_LOCK_PATH "$withval"
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_LOCK_PATH "/run/cryptsetup"
+_ACEOF
+
+
+
+fi
+
+test -z "$with_luks2_lock_path" && with_luks2_lock_path=/run/cryptsetup
+
+       case "${with_luks2_lock_path}" in
+               /*) ;;
+               *) as_fn_error $? "with-luks2-lock-path argument must be an absolute path." "$LINENO" 5;;
+       esac
+
+DEFAULT_LUKS2_LOCK_PATH=$with_luks2_lock_path
+
+
+
+# Check whether --with-luks2-lock-dir-perms was given.
+if test "${with_luks2_lock_dir_perms+set}" = set; then :
+  withval=$with_luks2_lock_dir_perms;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_LOCK_DIR_PERMS $withval
+_ACEOF
+
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS2_LOCK_DIR_PERMS 0700
+_ACEOF
+
+
+
+fi
+
+test -z "$with_luks2_lock_dir_perms" && with_luks2_lock_dir_perms=0700
+DEFAULT_LUKS2_LOCK_DIR_PERMS=$with_luks2_lock_dir_perms
+
+
+
+# Check whether --with-default_luks_format was given.
+if test "${with_default_luks_format+set}" = set; then :
+  withval=$with_default_luks_format;
+else
+  with_default_luks_format=LUKS2
+fi
+
+
+case $with_default_luks_format in
+       LUKS1) default_luks=CRYPT_LUKS1 ;;
+       LUKS2) default_luks=CRYPT_LUKS2 ;;
+       *) as_fn_error $? "Unknown default LUKS format. Use LUKS1 or LUKS2 only." "$LINENO" 5 ;;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LUKS_FORMAT $default_luks
+_ACEOF
+
+
 
-ac_config_files="$ac_config_files Makefile lib/Makefile lib/libcryptsetup.pc lib/crypto_backend/Makefile lib/luks1/Makefile lib/loopaes/Makefile lib/verity/Makefile lib/tcrypt/Makefile src/Makefile po/Makefile.in man/Makefile tests/Makefile python/Makefile"
+ac_config_files="$ac_config_files Makefile lib/libcryptsetup.pc po/Makefile.in scripts/cryptsetup.conf tests/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -18438,11 +20537,19 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${KERNEL_KEYRING_TRUE}" && test -z "${KERNEL_KEYRING_FALSE}"; then
+  as_fn_error $? "conditional \"KERNEL_KEYRING\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 if test -z "${STATIC_TOOLS_TRUE}" && test -z "${STATIC_TOOLS_FALSE}"; then
   as_fn_error $? "conditional \"STATIC_TOOLS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${CRYPTSETUP_TRUE}" && test -z "${CRYPTSETUP_FALSE}"; then
+  as_fn_error $? "conditional \"CRYPTSETUP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${VERITYSETUP_TRUE}" && test -z "${VERITYSETUP_FALSE}"; then
   as_fn_error $? "conditional \"VERITYSETUP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -18451,6 +20558,10 @@ if test -z "${REENCRYPT_TRUE}" && test -z "${REENCRYPT_FALSE}"; then
   as_fn_error $? "conditional \"REENCRYPT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${INTEGRITYSETUP_TRUE}" && test -z "${INTEGRITYSETUP_FALSE}"; then
+  as_fn_error $? "conditional \"INTEGRITYSETUP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${CRYPTO_BACKEND_GCRYPT_TRUE}" && test -z "${CRYPTO_BACKEND_GCRYPT_FALSE}"; then
   as_fn_error $? "conditional \"CRYPTO_BACKEND_GCRYPT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -18475,8 +20586,28 @@ if test -z "${CRYPTO_INTERNAL_PBKDF2_TRUE}" && test -z "${CRYPTO_INTERNAL_PBKDF2
   as_fn_error $? "conditional \"CRYPTO_INTERNAL_PBKDF2\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${PYTHON_CRYPTSETUP_TRUE}" && test -z "${PYTHON_CRYPTSETUP_FALSE}"; then
-  as_fn_error $? "conditional \"PYTHON_CRYPTSETUP\" was never defined.
+if test -z "${CRYPTO_INTERNAL_ARGON2_TRUE}" && test -z "${CRYPTO_INTERNAL_ARGON2_FALSE}"; then
+  as_fn_error $? "conditional \"CRYPTO_INTERNAL_ARGON2\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${CRYPTO_INTERNAL_SSE_ARGON2_TRUE}" && test -z "${CRYPTO_INTERNAL_SSE_ARGON2_FALSE}"; then
+  as_fn_error $? "conditional \"CRYPTO_INTERNAL_SSE_ARGON2\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_BLKID_TRUE}" && test -z "${HAVE_BLKID_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_BLKID\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_BLKID_WIPE_TRUE}" && test -z "${HAVE_BLKID_WIPE_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_BLKID_WIPE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_BLKID_STEP_BACK_TRUE}" && test -z "${HAVE_BLKID_STEP_BACK_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_BLKID_STEP_BACK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${CRYPTSETUP_TMPFILE_TRUE}" && test -z "${CRYPTSETUP_TMPFILE_FALSE}"; then
+  as_fn_error $? "conditional \"CRYPTSETUP_TMPFILE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
@@ -18876,7 +21007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cryptsetup $as_me 1.6.7, which was
+This file was extended by cryptsetup $as_me 2.3.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -18942,7 +21073,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-cryptsetup config.status 1.6.7
+cryptsetup config.status 2.3.3
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -19061,7 +21192,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #
 # INIT-COMMANDS
 #
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
 
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
@@ -19077,6 +21208,7 @@ macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
 enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
 pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`'
 SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
 ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
 PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
@@ -19126,10 +21258,13 @@ compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
 GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`'
 nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
 lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`'
 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
@@ -19194,7 +21329,8 @@ finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
 finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
 hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
 sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`'
+configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`'
 hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
 enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
 enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
@@ -19245,9 +21381,12 @@ CFLAGS \
 compiler \
 lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_import \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+lt_cv_nm_interface \
 nm_file_list_spec \
+lt_cv_truncate_bin \
 lt_prog_compiler_no_builtin_flag \
 lt_prog_compiler_pic \
 lt_prog_compiler_wl \
@@ -19282,7 +21421,7 @@ old_striplib \
 striplib; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -19309,10 +21448,11 @@ postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
-sys_lib_dlsearch_path_spec; do
+configure_time_dlsearch_path \
+configure_time_lt_sys_library_path; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -19321,19 +21461,16 @@ sys_lib_dlsearch_path_spec; do
 done
 
 ac_aux_dir='$ac_aux_dir'
-xsi_shell='$xsi_shell'
-lt_shell_append='$lt_shell_append'
 
-# See if we are running on zsh, and set the options which allow our
+# See if we are running on zsh, and set the options that allow our
 # commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
+if test -n "\${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 
 
     PACKAGE='$PACKAGE'
     VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
     RM='$RM'
     ofile='$ofile'
 
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
     "lib/libcryptsetup.pc") CONFIG_FILES="$CONFIG_FILES lib/libcryptsetup.pc" ;;
-    "lib/crypto_backend/Makefile") CONFIG_FILES="$CONFIG_FILES lib/crypto_backend/Makefile" ;;
-    "lib/luks1/Makefile") CONFIG_FILES="$CONFIG_FILES lib/luks1/Makefile" ;;
-    "lib/loopaes/Makefile") CONFIG_FILES="$CONFIG_FILES lib/loopaes/Makefile" ;;
-    "lib/verity/Makefile") CONFIG_FILES="$CONFIG_FILES lib/verity/Makefile" ;;
-    "lib/tcrypt/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tcrypt/Makefile" ;;
-    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
-    "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+    "scripts/cryptsetup.conf") CONFIG_FILES="$CONFIG_FILES scripts/cryptsetup.conf" ;;
     "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
-    "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -19971,29 +22100,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  case $CONFIG_FILES in #(
+  *\'*) :
+    eval set x "$CONFIG_FILES" ;; #(
+  *) :
+    set x $CONFIG_FILES ;; #(
+  *) :
+     ;;
+esac
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$mf" : 'X\(//\)[^/]' \| \
-        X"$mf" : 'X\(//\)$' \| \
-        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$mf" |
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`$as_dirname -- "$am_mf" ||
+$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$am_mf" : 'X\(//\)[^/]' \| \
+        X"$am_mf" : 'X\(//\)$' \| \
+        X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$am_mf" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -20011,106 +22146,100 @@ $as_echo X"$mf" |
            q
          }
          s/.*/./; q'`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "$am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$file" : 'X\(//\)[^/]' \| \
-        X"$file" : 'X\(//\)$' \| \
-        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
+    am_filepart=`$as_basename -- "$am_mf" ||
+$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$am_mf" : 'X\(//\)$' \| \
+        X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$am_mf" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
            s//\1/
            q
          }
-         /^X\(\/\/\)$/{
+         /^X\/\(\/\/\)$/{
            s//\1/
            q
          }
-         /^X\(\/\).*/{
+         /^X\/\(\/\).*/{
            s//\1/
            q
          }
          s/.*/./; q'`
-      as_dir=$dirpart/$fdir; as_fn_mkdir_p
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    { echo "$as_me:$LINENO: cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles" >&5
+   (cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  If GNU make was not used, consider
+    re-running the configure script with MAKE=\"gmake\" (or whatever is
+    necessary).  You can also try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+  { am_dirpart=; unset am_dirpart;}
+  { am_filepart=; unset am_filepart;}
+  { am_mf=; unset am_mf;}
+  { am_rc=; unset am_rc;}
+  rm -f conftest-deps.mk
 }
  ;;
     "libtool":C)
 
-    # See if we are running on zsh, and set the options which allow our
+    # See if we are running on zsh, and set the options that allow our
     # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
+    if test -n "${ZSH_VERSION+set}"; then
       setopt NO_GLOB_SUBST
     fi
 
-    cfgfile="${ofile}T"
+    cfgfile=${ofile}T
     trap "$RM \"$cfgfile\"; exit 1" 1 2 15
     $RM "$cfgfile"
 
     cat <<_LT_EOF >> "$cfgfile"
 #! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# Generated automatically by $as_me ($PACKAGE) $VERSION
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
+
+# Provide generalized library-building support services.
+# Written by Gordon Matzigkeit, 1996
+
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of of the License, or
+# (at your option) any later version.
 #
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program or library that is built
+# using GNU Libtool, you may include this file under the  same
+# distribution terms that you use for the rest of that program.
 #
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 # The names of the tagged configurations supported by this script.
-available_tags=""
+available_tags=''
+
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
 
 # ### BEGIN LIBTOOL CONFIG
 
@@ -20130,6 +22259,9 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shared archive member basename,for filename based shared library versioning on AIX.
+shared_archive_member_spec=$shared_archive_member_spec
+
 # Shell to use when invoking shell scripts.
 SHELL=$lt_SHELL
 
@@ -20247,18 +22379,27 @@ global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
 # Transform the output of nm in a proper C declaration.
 global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
 
+# Transform the output of nm into a list of symbols to manually relocate.
+global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import
+
 # Transform the output of nm in a C name address pair.
 global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
+# The name lister interface.
+nm_interface=$lt_lt_cv_nm_interface
+
 # Specify filename containing input files for \$NM.
 nm_file_list_spec=$lt_nm_file_list_spec
 
-# The root where to search for dependent libraries,and in which our libraries should be installed.
+# The root where to search for dependent libraries,and where our libraries should be installed.
 lt_sysroot=$lt_sysroot
 
+# Command to truncate a binary pipe.
+lt_truncate_bin=$lt_lt_cv_truncate_bin
+
 # The name of the directory that contains temporary libtool files.
 objdir=$objdir
 
@@ -20349,8 +22490,11 @@ hardcode_into_libs=$hardcode_into_libs
 # Compile-time system search path for libraries.
 sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
 
-# Run-time system search path for libraries.
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+# Detected run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path
+
+# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
+configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path
 
 # Whether dlopen is supported.
 dlopen_support=$enable_dlopen
@@ -20443,13 +22587,13 @@ hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
 # DIR into the resulting binary.
 hardcode_direct=$hardcode_direct
 
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
 # DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# "absolute",i.e impossible to change by setting \$shlibpath_var if the
 # library is relocated.
 hardcode_direct_absolute=$hardcode_direct_absolute
 
@@ -20501,13 +22645,72 @@ hardcode_action=$hardcode_action
 
 _LT_EOF
 
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
   case $host_os in
   aix3*)
     cat <<\_LT_EOF >> "$cfgfile"
 # AIX sometimes has problems with the GCC collect2 program.  For some
 # reason, if we set the COLLECT_NAMES environment variable, the problems
 # vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
+if test set != "${COLLECT_NAMES+set}"; then
   COLLECT_NAMES=
   export COLLECT_NAMES
 fi
@@ -20516,7 +22719,7 @@ _LT_EOF
   esac
 
 
-ltmain="$ac_aux_dir/ltmain.sh"
+ltmain=$ac_aux_dir/ltmain.sh
 
 
   # We use sed instead of cat because bash on DJGPP gets confused if
@@ -20526,165 +22729,6 @@ ltmain="$ac_aux_dir/ltmain.sh"
   sed '$q' "$ltmain" >> "$cfgfile" \
      || (rm -f "$cfgfile"; exit 1)
 
-  if test x"$xsi_shell" = xyes; then
-  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
-func_dirname ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_basename ()$/,/^} # func_basename /c\
-func_basename ()\
-{\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
-func_dirname_and_basename ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
-func_stripname ()\
-{\
-\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
-\    # positional parameters, so assign one to ordinary parameter first.\
-\    func_stripname_result=${3}\
-\    func_stripname_result=${func_stripname_result#"${1}"}\
-\    func_stripname_result=${func_stripname_result%"${2}"}\
-} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
-func_split_long_opt ()\
-{\
-\    func_split_long_opt_name=${1%%=*}\
-\    func_split_long_opt_arg=${1#*=}\
-} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
-func_split_short_opt ()\
-{\
-\    func_split_short_opt_arg=${1#??}\
-\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
-} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
-func_lo2o ()\
-{\
-\    case ${1} in\
-\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
-\      *)    func_lo2o_result=${1} ;;\
-\    esac\
-} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_xform ()$/,/^} # func_xform /c\
-func_xform ()\
-{\
-    func_xform_result=${1%.*}.lo\
-} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_arith ()$/,/^} # func_arith /c\
-func_arith ()\
-{\
-    func_arith_result=$(( $* ))\
-} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_len ()$/,/^} # func_len /c\
-func_len ()\
-{\
-    func_len_result=${#1}\
-} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  sed -e '/^func_append ()$/,/^} # func_append /c\
-func_append ()\
-{\
-    eval "${1}+=\\${2}"\
-} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
-func_append_quoted ()\
-{\
-\    func_quote_for_eval "${2}"\
-\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
-} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
-$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
-fi
-
-
    mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
@@ -20700,7 +22744,7 @@ fi
       case "$ac_file" in */Makefile.in)
         # Adjust a relative srcdir.
         ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
-        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+        ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
         ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
         # In autoconf-2.13 it is called $ac_given_srcdir.
         # In autoconf-2.50 it is called $srcdir.
@@ -20716,7 +22760,8 @@ fi
         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
           rm -f "$ac_dir/POTFILES"
           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
-          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          gt_tab=`printf '\t'`
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
           POMAKEFILEDEPS="POTFILES.in"
           # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
           # on $ac_dir but don't depend on user-specified configuration
               test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
             fi
             ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
-            # Hide the ALL_LINGUAS assigment from automake < 1.5.
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
             eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
             POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
           else
             # The set of available languages was given in configure.in.
-            # Hide the ALL_LINGUAS assigment from automake < 1.5.
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
             eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
           fi
           # Compute POFILES
index 05574d2..0d2fa63 100644 (file)
@@ -1,9 +1,9 @@
 AC_PREREQ([2.67])
-AC_INIT([cryptsetup],[1.6.7])
+AC_INIT([cryptsetup],[2.3.3])
 
 dnl library version from <major>.<minor>.<release>[-<suffix>]
 LIBCRYPTSETUP_VERSION=$(echo $PACKAGE_VERSION | cut -f1 -d-)
-LIBCRYPTSETUP_VERSION_INFO=11:0:7
+LIBCRYPTSETUP_VERSION_INFO=18:0:6
 
 AM_SILENT_RULES([yes])
 AC_CONFIG_SRCDIR(src/cryptsetup.c)
@@ -15,8 +15,8 @@ AC_CONFIG_HEADERS([config.h:config.h.in])
 # http://lists.gnu.org/archive/html/automake/2013-01/msg00060.html
 
 # For old automake use this
-#AM_INIT_AUTOMAKE(dist-xz)
-AM_INIT_AUTOMAKE([dist-xz 1.12 serial-tests])
+#AM_INIT_AUTOMAKE(dist-xz subdir-objects)
+AM_INIT_AUTOMAKE([dist-xz 1.12 serial-tests subdir-objects])
 
 if test "x$prefix" = "xNONE"; then
        sysconfdir=/etc
@@ -33,24 +33,77 @@ AC_PROG_MAKE_SET
 AC_ENABLE_STATIC(no)
 LT_INIT
 PKG_PROG_PKG_CONFIG
+AM_ICONV
+
+dnl ==========================================================================
+dnl define PKG_CHECK_VAR for old pkg-config <= 0.28
+m4_ifndef([AS_VAR_COPY],
+[m4_define([AS_VAR_COPY],
+[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
+])
+m4_ifndef([PKG_CHECK_VAR], [
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])
+])
+])
+dnl ==========================================================================
+
+AC_C_RESTRICT
 
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_CHECK_HEADERS(fcntl.h malloc.h inttypes.h sys/ioctl.h sys/mman.h \
-       ctype.h unistd.h locale.h byteswap.h endian.h)
+       sys/sysmacros.h sys/statvfs.h ctype.h unistd.h locale.h byteswap.h endian.h stdint.h)
+AC_CHECK_DECLS([O_CLOEXEC],,[AC_DEFINE([O_CLOEXEC],[0], [Defined to 0 if not provided])],
+[[
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+]])
 
 AC_CHECK_HEADERS(uuid/uuid.h,,[AC_MSG_ERROR([You need the uuid library.])])
 AC_CHECK_HEADER(libdevmapper.h,,[AC_MSG_ERROR([You need the device-mapper library.])])
 
+AC_ARG_ENABLE([keyring],
+       AS_HELP_STRING([--disable-keyring], [disable kernel keyring support and builtin kernel keyring token]),
+       [], [enable_keyring=yes])
+if test "x$enable_keyring" = "xyes"; then
+       AC_CHECK_HEADERS(linux/keyctl.h,,[AC_MSG_ERROR([You need Linux kernel headers with kernel keyring service compiled.])])
+
+       dnl ==========================================================================
+       dnl check whether kernel is compiled with kernel keyring service syscalls
+       AC_CHECK_DECL(__NR_add_key,,[AC_MSG_ERROR([The kernel is missing add_key syscall.])], [#include <syscall.h>])
+       AC_CHECK_DECL(__NR_keyctl,,[AC_MSG_ERROR([The kernel is missing keyctl syscall.])], [#include <syscall.h>])
+       AC_CHECK_DECL(__NR_request_key,,[AC_MSG_ERROR([The kernel is missing request_key syscall.])], [#include <syscall.h>])
+
+       dnl ==========================================================================
+       dnl check that key_serial_t hasn't been adopted yet in stdlib
+       AC_CHECK_TYPES([key_serial_t], [], [], [
+       AC_INCLUDES_DEFAULT
+       #ifdef HAVE_LINUX_KEYCTL_H
+       # include <linux/keyctl.h>
+       #endif
+       ])
+
+       AC_DEFINE(KERNEL_KEYRING, 1, [Enable kernel keyring service support])
+fi
+AM_CONDITIONAL(KERNEL_KEYRING, test "x$enable_keyring" = "xyes")
+
 saved_LIBS=$LIBS
 AC_CHECK_LIB(uuid, uuid_clear, ,[AC_MSG_ERROR([You need the uuid library.])])
 AC_SUBST(UUID_LIBS, $LIBS)
 LIBS=$saved_LIBS
 
 AC_SEARCH_LIBS([clock_gettime],[rt posix4])
-AC_CHECK_FUNCS([posix_memalign clock_gettime])
+AC_CHECK_FUNCS([posix_memalign clock_gettime posix_fallocate explicit_bzero])
 
-if test "x$enable_largefile" = "xno" ; then
+if test "x$enable_largefile" = "xno"; then
   AC_MSG_ERROR([Building with --disable-largefile is not supported, it can cause data corruption.])
 fi
 
@@ -65,7 +118,7 @@ AC_FUNC_STRERROR_R
 dnl ==========================================================================
 
 AM_GNU_GETTEXT([external],[need-ngettext])
-AM_GNU_GETTEXT_VERSION([0.15])
+AM_GNU_GETTEXT_VERSION([0.18.3])
 
 dnl ==========================================================================
 
@@ -76,12 +129,10 @@ AC_SUBST(POPT_LIBS, $LIBS)
 LIBS=$saved_LIBS
 
 dnl ==========================================================================
-dnl FIPS extensions (only for RHEL)
-AC_ARG_ENABLE([fips], AS_HELP_STRING([--enable-fips],[enable FIPS mode restrictions]),
-[with_fips=$enableval],
-[with_fips=no])
-
-if test "x$with_fips" = "xyes"; then
+dnl FIPS extensions
+AC_ARG_ENABLE([fips],
+       AS_HELP_STRING([--enable-fips], [enable FIPS mode restrictions]))
+if test "x$enable_fips" = "xyes"; then
        AC_DEFINE(ENABLE_FIPS, 1, [Enable FIPS mode restrictions])
 
        if test "x$enable_static" = "xyes" -o "x$enable_static_cryptsetup" = "xyes" ; then
@@ -90,19 +141,18 @@ if test "x$with_fips" = "xyes"; then
 fi
 
 AC_DEFUN([NO_FIPS], [
-       if test "x$with_fips" = "xyes"; then
+       if test "x$enable_fips" = "xyes"; then
                AC_MSG_ERROR([This option is not compatible with FIPS.])
        fi
 ])
 
 dnl ==========================================================================
 dnl pwquality library (cryptsetup CLI only)
-AC_ARG_ENABLE([pwquality], AS_HELP_STRING([--enable-pwquality],[enable password quality checking]),
-[with_pwquality=$enableval],
-[with_pwquality=no])
+AC_ARG_ENABLE([pwquality],
+       AS_HELP_STRING([--enable-pwquality], [enable password quality checking using pwquality library]))
 
-if test "x$with_pwquality" = "xyes"; then
-       AC_DEFINE(ENABLE_PWQUALITY, 1, [Enable password quality checking])
+if test "x$enable_pwquality" = "xyes"; then
+       AC_DEFINE(ENABLE_PWQUALITY, 1, [Enable password quality checking using pwquality library])
        PKG_CHECK_MODULES([PWQUALITY], [pwquality >= 1.0.0],,
                AC_MSG_ERROR([You need pwquality library.]))
 
@@ -111,23 +161,52 @@ if test "x$with_pwquality" = "xyes"; then
 fi
 
 dnl ==========================================================================
+dnl passwdqc library (cryptsetup CLI only)
+AC_ARG_ENABLE([passwdqc],
+       AS_HELP_STRING([--enable-passwdqc@<:@=CONFIG_PATH@:>@],
+                      [enable password quality checking using passwdqc library (optionally with CONFIG_PATH)]))
+
+case "$enable_passwdqc" in
+       ""|yes|no) use_passwdqc_config="" ;;
+       /*) use_passwdqc_config="$enable_passwdqc"; enable_passwdqc=yes ;;
+       *) AC_MSG_ERROR([Unrecognized --enable-passwdqc parameter.]) ;;
+esac
+AC_DEFINE_UNQUOTED([PASSWDQC_CONFIG_FILE], ["$use_passwdqc_config"], [passwdqc library config file])
+
+if test "x$enable_passwdqc" = "xyes"; then
+       AC_DEFINE(ENABLE_PASSWDQC, 1, [Enable password quality checking using passwdqc library])
+
+       PASSWDQC_LIBS="-lpasswdqc"
+fi
+
+if test "x$enable_pwquality$enable_passwdqc" = "xyesyes"; then
+       AC_MSG_ERROR([--enable-pwquality and --enable-passwdqc are mutually incompatible.])
+fi
+
+dnl ==========================================================================
 dnl Crypto backend functions
 
 AC_DEFUN([CONFIGURE_GCRYPT], [
-       if test "x$with_fips" = "xyes"; then
+       if test "x$enable_fips" = "xyes"; then
                GCRYPT_REQ_VERSION=1.4.5
        else
                GCRYPT_REQ_VERSION=1.1.42
        fi
-       dnl Check if we can use gcrypt PBKDF2 (1.6.0 supports empty password)
-       AC_ARG_ENABLE([gcrypt-pbkdf2], AS_HELP_STRING([--enable-gcrypt-pbkdf2],[force enable internal gcrypt PBKDF2]),
+
+       dnl libgcrypt rejects to use pkgconfig, use AM_PATH_LIBGCRYPT from gcrypt-devel here.
+       dnl Do not require gcrypt-devel if other crypto backend is used.
+       m4_ifdef([AM_PATH_LIBGCRYPT],[
+       AC_ARG_ENABLE([gcrypt-pbkdf2],
+               dnl Check if we can use gcrypt PBKDF2 (1.6.0 supports empty password)
+               AS_HELP_STRING([--enable-gcrypt-pbkdf2], [force enable internal gcrypt PBKDF2]),
                if test "x$enableval" = "xyes"; then
                        [use_internal_pbkdf2=0]
                else
                        [use_internal_pbkdf2=1]
                fi,
                [AM_PATH_LIBGCRYPT([1.6.1], [use_internal_pbkdf2=0], [use_internal_pbkdf2=1])])
-       AM_PATH_LIBGCRYPT($GCRYPT_REQ_VERSION,,[AC_MSG_ERROR([You need the gcrypt library.])])
+       AM_PATH_LIBGCRYPT($GCRYPT_REQ_VERSION,,[AC_MSG_ERROR([You need the gcrypt library.])])],
+       AC_MSG_ERROR([Missing support for gcrypt: install gcrypt and regenerate configure.]))
 
        AC_MSG_CHECKING([if internal cryptsetup PBKDF2 is compiled-in])
        if test $use_internal_pbkdf2 = 0; then
@@ -137,7 +216,9 @@ AC_DEFUN([CONFIGURE_GCRYPT], [
                NO_FIPS([])
        fi
 
-       if test x$enable_static_cryptsetup = xyes; then
+       AC_CHECK_DECLS([GCRY_CIPHER_MODE_XTS], [], [], [#include <gcrypt.h>])
+
+       if test "x$enable_static_cryptsetup" = "xyes"; then
                saved_LIBS=$LIBS
                LIBS="$saved_LIBS $LIBGCRYPT_LIBS -static"
                AC_CHECK_LIB(gcrypt, gcry_check_version,,
@@ -161,18 +242,17 @@ AC_DEFUN([CONFIGURE_OPENSSL], [
        CRYPTO_LIBS=$OPENSSL_LIBS
        use_internal_pbkdf2=0
 
-       if test x$enable_static_cryptsetup = xyes; then
+       if test "x$enable_static_cryptsetup" = "xyes"; then
                saved_PKG_CONFIG=$PKG_CONFIG
                PKG_CONFIG="$PKG_CONFIG --static"
                PKG_CHECK_MODULES([OPENSSL_STATIC], [openssl])
                CRYPTO_STATIC_LIBS=$OPENSSL_STATIC_LIBS
                PKG_CONFIG=$saved_PKG_CONFIG
        fi
-       NO_FIPS([])
 ])
 
 AC_DEFUN([CONFIGURE_NSS], [
-       if test x$enable_static_cryptsetup = xyes; then
+       if test "x$enable_static_cryptsetup" = "xyes"; then
                AC_MSG_ERROR([Static build of cryptsetup is not supported with NSS.])
        fi
 
@@ -205,6 +285,7 @@ AC_DEFUN([CONFIGURE_KERNEL], [
 AC_DEFUN([CONFIGURE_NETTLE], [
        AC_CHECK_HEADERS(nettle/sha.h,,
                [AC_MSG_ERROR([You need Nettle cryptographic library.])])
+       AC_CHECK_HEADERS(nettle/version.h)
 
        saved_LIBS=$LIBS
        AC_CHECK_LIB(nettle, nettle_pbkdf2_hmac_sha256,,
@@ -221,33 +302,42 @@ dnl ==========================================================================
 saved_LIBS=$LIBS
 
 AC_ARG_ENABLE([static-cryptsetup],
-       AS_HELP_STRING([--enable-static-cryptsetup],
-       [enable build of static cryptsetup binary]))
-if test x$enable_static_cryptsetup = xyes; then
-       if test x$enable_static = xno; then
+       AS_HELP_STRING([--enable-static-cryptsetup], [enable build of static version of tools]))
+if test "x$enable_static_cryptsetup" = "xyes"; then
+       if test "x$enable_static" = "xno"; then
                AC_MSG_WARN([Requested static cryptsetup build, enabling static library.])
                enable_static=yes
        fi
 fi
-AM_CONDITIONAL(STATIC_TOOLS, test x$enable_static_cryptsetup = xyes)
+AM_CONDITIONAL(STATIC_TOOLS, test "x$enable_static_cryptsetup" = "xyes")
+
+AC_ARG_ENABLE([cryptsetup],
+       AS_HELP_STRING([--disable-cryptsetup], [disable cryptsetup support]),
+       [], [enable_cryptsetup=yes])
+AM_CONDITIONAL(CRYPTSETUP, test "x$enable_cryptsetup" = "xyes")
 
-AC_ARG_ENABLE(veritysetup,
-       AS_HELP_STRING([--disable-veritysetup],
-       [disable veritysetup support]),[], [enable_veritysetup=yes])
-AM_CONDITIONAL(VERITYSETUP, test x$enable_veritysetup = xyes)
+AC_ARG_ENABLE([veritysetup],
+       AS_HELP_STRING([--disable-veritysetup], [disable veritysetup support]),
+       [], [enable_veritysetup=yes])
+AM_CONDITIONAL(VERITYSETUP, test "x$enable_veritysetup" = "xyes")
 
 AC_ARG_ENABLE([cryptsetup-reencrypt],
-       AS_HELP_STRING([--enable-cryptsetup-reencrypt],
-       [enable cryptsetup-reencrypt tool]))
-AM_CONDITIONAL(REENCRYPT, test x$enable_cryptsetup_reencrypt = xyes)
+       AS_HELP_STRING([--disable-cryptsetup-reencrypt], [disable cryptsetup-reencrypt tool]),
+       [], [enable_cryptsetup_reencrypt=yes])
+AM_CONDITIONAL(REENCRYPT, test "x$enable_cryptsetup_reencrypt" = "xyes")
 
-AC_ARG_ENABLE(selinux,
-       AS_HELP_STRING([--disable-selinux],
-       [disable selinux support [default=auto]]),[], [])
+AC_ARG_ENABLE([integritysetup],
+       AS_HELP_STRING([--disable-integritysetup], [disable integritysetup support]),
+       [], [enable_integritysetup=yes])
+AM_CONDITIONAL(INTEGRITYSETUP, test "x$enable_integritysetup" = "xyes")
+
+AC_ARG_ENABLE([selinux],
+       AS_HELP_STRING([--disable-selinux], [disable selinux support [default=auto]]),
+       [], [enable_selinux=yes])
 
 AC_ARG_ENABLE([udev],
-       AS_HELP_STRING([--disable-udev],
-       [disable udev support]),[], enable_udev=yes)
+       AS_HELP_STRING([--disable-udev], [disable udev support]),
+       [], [enable_udev=yes])
 
 dnl Try to use pkg-config for devmapper, but fallback to old detection
 PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= 1.02.03],, [
@@ -262,6 +352,11 @@ LIBS=$saved_LIBS
 LIBS="$LIBS $DEVMAPPER_LIBS"
 AC_CHECK_DECLS([dm_task_secure_data], [], [], [#include <libdevmapper.h>])
 AC_CHECK_DECLS([dm_task_retry_remove], [], [], [#include <libdevmapper.h>])
+AC_CHECK_DECLS([dm_task_deferred_remove], [], [], [#include <libdevmapper.h>])
+AC_CHECK_DECLS([dm_device_has_mounted_fs], [], [], [#include <libdevmapper.h>])
+AC_CHECK_DECLS([dm_device_has_holders], [], [], [#include <libdevmapper.h>])
+AC_CHECK_DECLS([dm_device_get_name], [], [], [#include <libdevmapper.h>])
+AC_CHECK_DECLS([DM_DEVICE_GET_TARGET_VERSION], [], [], [#include <libdevmapper.h>])
 AC_CHECK_DECLS([DM_UDEV_DISABLE_DISK_RULES_FLAG], [have_cookie=yes], [have_cookie=no], [#include <libdevmapper.h>])
 if test "x$enable_udev" = xyes; then
        if test "x$have_cookie" = xno; then
@@ -272,19 +367,22 @@ if test "x$enable_udev" = xyes; then
 fi
 LIBS=$saved_LIBS
 
+dnl Check for JSON-C used in LUKS2
+PKG_CHECK_MODULES([JSON_C], [json-c])
+AC_CHECK_DECLS([json_object_object_add_ex], [], [], [#include <json-c/json.h>])
+AC_CHECK_DECLS([json_object_deep_copy], [], [], [#include <json-c/json.h>])
+
 dnl Crypto backend configuration.
 AC_ARG_WITH([crypto_backend],
-       AS_HELP_STRING([--with-crypto_backend=BACKEND], [crypto backend (gcrypt/openssl/nss/kernel/nettle) [gcrypt]]),
-       [], with_crypto_backend=gcrypt
-)
+       AS_HELP_STRING([--with-crypto_backend=BACKEND], [crypto backend (gcrypt/openssl/nss/kernel/nettle) [openssl]]),
+       [], [with_crypto_backend=openssl])
 
 dnl Kernel crypto API backend needed for benchmark and tcrypt
-AC_ARG_ENABLE([kernel_crypto], AS_HELP_STRING([--disable-kernel_crypto],
-       [disable kernel userspace crypto (no benchmark and tcrypt)]),
-       [with_kernel_crypto=$enableval],
-       [with_kernel_crypto=yes])
+AC_ARG_ENABLE([kernel_crypto],
+       AS_HELP_STRING([--disable-kernel_crypto], [disable kernel userspace crypto (no benchmark and tcrypt)]),
+       [], [enable_kernel_crypto=yes])
 
-if test "x$with_kernel_crypto" = "xyes"; then
+if test "x$enable_kernel_crypto" = "xyes"; then
        AC_CHECK_HEADERS(linux/if_alg.h,,
                [AC_MSG_ERROR([You need Linux kernel headers with userspace crypto interface. (Or use --disable-kernel_crypto.)])])
        AC_DEFINE(ENABLE_AF_ALG, 1, [Enable using of kernel userspace crypto])
@@ -298,17 +396,88 @@ case $with_crypto_backend in
        nettle)  CONFIGURE_NETTLE([]) ;;
        *) AC_MSG_ERROR([Unknown crypto backend.]) ;;
 esac
-AM_CONDITIONAL(CRYPTO_BACKEND_GCRYPT,  test $with_crypto_backend = gcrypt)
-AM_CONDITIONAL(CRYPTO_BACKEND_OPENSSL, test $with_crypto_backend = openssl)
-AM_CONDITIONAL(CRYPTO_BACKEND_NSS,     test $with_crypto_backend = nss)
-AM_CONDITIONAL(CRYPTO_BACKEND_KERNEL,  test $with_crypto_backend = kernel)
-AM_CONDITIONAL(CRYPTO_BACKEND_NETTLE,  test $with_crypto_backend = nettle)
+AM_CONDITIONAL(CRYPTO_BACKEND_GCRYPT,  test "$with_crypto_backend" = "gcrypt")
+AM_CONDITIONAL(CRYPTO_BACKEND_OPENSSL, test "$with_crypto_backend" = "openssl")
+AM_CONDITIONAL(CRYPTO_BACKEND_NSS,     test "$with_crypto_backend" = "nss")
+AM_CONDITIONAL(CRYPTO_BACKEND_KERNEL,  test "$with_crypto_backend" = "kernel")
+AM_CONDITIONAL(CRYPTO_BACKEND_NETTLE,  test "$with_crypto_backend" = "nettle")
 
 AM_CONDITIONAL(CRYPTO_INTERNAL_PBKDF2, test $use_internal_pbkdf2 = 1)
 AC_DEFINE_UNQUOTED(USE_INTERNAL_PBKDF2, [$use_internal_pbkdf2], [Use internal PBKDF2])
 
+dnl Argon2 implementation
+AC_ARG_ENABLE([internal-argon2],
+       AS_HELP_STRING([--disable-internal-argon2], [disable internal implementation of Argon2 PBKDF]),
+       [], [enable_internal_argon2=yes])
+
+AC_ARG_ENABLE([libargon2],
+       AS_HELP_STRING([--enable-libargon2], [enable external libargon2 (PHC) library (disables internal bundled version)]))
+
+if test "x$enable_libargon2" = "xyes" ; then
+       AC_CHECK_HEADERS(argon2.h,,
+               [AC_MSG_ERROR([You need libargon2 development library installed.])])
+       AC_CHECK_DECL(Argon2_id,,[AC_MSG_ERROR([You need more recent Argon2 library with support for Argon2id.])], [#include <argon2.h>])
+       PKG_CHECK_MODULES([LIBARGON2], [libargon2],,[LIBARGON2_LIBS="-largon2"])
+       enable_internal_argon2=no
+else
+       AC_MSG_WARN([Argon2 bundled (slow) reference implementation will be used, please consider to use system library with --enable-libargon2.])
+
+       AC_ARG_ENABLE([internal-sse-argon2],
+               AS_HELP_STRING([--enable-internal-sse-argon2], [enable internal SSE implementation of Argon2 PBKDF]))
+
+       if test "x$enable_internal_sse_argon2" = "xyes"; then
+               AC_MSG_CHECKING(if Argon2 SSE optimization can be used)
+               AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+                       #include <emmintrin.h>
+                       __m128i testfunc(__m128i *a, __m128i *b) {
+                         return _mm_xor_si128(_mm_loadu_si128(a), _mm_loadu_si128(b));
+                       }
+               ]])],,[enable_internal_sse_argon2=no])
+               AC_MSG_RESULT($enable_internal_sse_argon2)
+       fi
+fi
+
+if test "x$enable_internal_argon2" = "xyes"; then
+       AC_DEFINE(USE_INTERNAL_ARGON2, 1, [Use internal Argon2])
+fi
+AM_CONDITIONAL(CRYPTO_INTERNAL_ARGON2, test "x$enable_internal_argon2" = "xyes")
+AM_CONDITIONAL(CRYPTO_INTERNAL_SSE_ARGON2, test "x$enable_internal_sse_argon2" = "xyes")
+
+dnl Link with blkid to check for other device types
+AC_ARG_ENABLE([blkid],
+       AS_HELP_STRING([--disable-blkid], [disable use of blkid for device signature detection and wiping]),
+       [], [enable_blkid=yes])
+
+if test "x$enable_blkid" = "xyes"; then
+       PKG_CHECK_MODULES([BLKID], [blkid],[AC_DEFINE([HAVE_BLKID], 1, [Define to 1 to use blkid for detection of disk signatures.])],[LIBBLKID_LIBS="-lblkid"])
+
+       AC_CHECK_HEADERS(blkid/blkid.h,,[AC_MSG_ERROR([You need blkid development library installed.])])
+       AC_CHECK_DECL([blkid_do_wipe],
+                     [ AC_DEFINE([HAVE_BLKID_WIPE], 1, [Define to 1 to use blkid_do_wipe.])
+                       enable_blkid_wipe=yes
+                     ],,
+                     [#include <blkid/blkid.h>])
+       AC_CHECK_DECL([blkid_probe_step_back],
+                     [ AC_DEFINE([HAVE_BLKID_STEP_BACK], 1, [Define to 1 to use blkid_probe_step_back.])
+                       enable_blkid_step_back=yes
+                     ],,
+                     [#include <blkid/blkid.h>])
+       AC_CHECK_DECLS([ blkid_reset_probe,
+                        blkid_probe_set_device,
+                        blkid_probe_filter_superblocks_type,
+                        blkid_do_safeprobe,
+                        blkid_do_probe,
+                        blkid_probe_lookup_value
+                      ],,
+                      [AC_MSG_ERROR([Can not compile with blkid support, disable it by --disable-blkid.])],
+                      [#include <blkid/blkid.h>])
+fi
+AM_CONDITIONAL(HAVE_BLKID, test "x$enable_blkid" = "xyes")
+AM_CONDITIONAL(HAVE_BLKID_WIPE, test "x$enable_blkid_wipe" = "xyes")
+AM_CONDITIONAL(HAVE_BLKID_STEP_BACK, test "x$enable_blkid_step_back" = "xyes")
+
 dnl Magic for cryptsetup.static build.
-if test x$enable_static_cryptsetup = xyes; then
+if test "x$enable_static_cryptsetup" = "xyes"; then
        saved_PKG_CONFIG=$PKG_CONFIG
        PKG_CONFIG="$PKG_CONFIG --static"
 
@@ -320,7 +489,7 @@ if test x$enable_static_cryptsetup = xyes; then
        LIBS="$saved_LIBS -static"
        PKG_CHECK_MODULES([DEVMAPPER_STATIC], [devmapper >= 1.02.27],,[
                DEVMAPPER_STATIC_LIBS=$DEVMAPPER_LIBS
-               if test "x$enable_selinux" != xno; then
+               if test "x$enable_selinux" = "xyes"; then
                        AC_CHECK_LIB(sepol, sepol_bool_set)
                        AC_CHECK_LIB(selinux, is_selinux_enabled)
                        DEVMAPPER_STATIC_LIBS="$DEVMAPPER_STATIC_LIBS $LIBS"
@@ -339,23 +508,37 @@ if test x$enable_static_cryptsetup = xyes; then
        PKG_CONFIG=$saved_PKG_CONFIG
 fi
 
+AC_MSG_CHECKING([for systemd tmpfiles config directory])
+PKG_CHECK_VAR([systemd_tmpfilesdir], [systemd], [tmpfilesdir], [], [systemd_tmpfilesdir=no])
+AC_MSG_RESULT([$systemd_tmpfilesdir])
+
 AC_SUBST([DEVMAPPER_LIBS])
 AC_SUBST([DEVMAPPER_STATIC_LIBS])
 
 AC_SUBST([PWQUALITY_LIBS])
 AC_SUBST([PWQUALITY_STATIC_LIBS])
 
+AC_SUBST([PASSWDQC_LIBS])
+
 AC_SUBST([CRYPTO_CFLAGS])
 AC_SUBST([CRYPTO_LIBS])
 AC_SUBST([CRYPTO_STATIC_LIBS])
 
+AC_SUBST([JSON_C_LIBS])
+AC_SUBST([LIBARGON2_LIBS])
+AC_SUBST([BLKID_LIBS])
+
 AC_SUBST([LIBCRYPTSETUP_VERSION])
 AC_SUBST([LIBCRYPTSETUP_VERSION_INFO])
 
 dnl ==========================================================================
-AC_ARG_ENABLE([dev-random], AS_HELP_STRING([--enable-dev-random],
-[use blocking /dev/random by default for key generator (otherwise use /dev/urandom)]),
-[default_rng=/dev/random], [default_rng=/dev/urandom])
+AC_ARG_ENABLE([dev-random],
+       AS_HELP_STRING([--enable-dev-random], [use /dev/random by default for key generation (otherwise use /dev/urandom)]))
+if test "x$enable_dev_random" = "xyes"; then
+       default_rng=/dev/random
+else
+       default_rng=/dev/urandom
+fi
 AC_DEFINE_UNQUOTED(DEFAULT_RNG, ["$default_rng"], [default RNG type for key generator])
 
 dnl ==========================================================================
@@ -375,30 +558,12 @@ AC_DEFUN([CS_NUM_WITH], [AC_ARG_WITH([$1],
        [CS_DEFINE([$1], [$3], [$2])]
 )])
 
-dnl ==========================================================================
-dnl Python bindings
-AC_ARG_ENABLE([python], AS_HELP_STRING([--enable-python],[enable Python bindings]),
-[with_python=$enableval],
-[with_python=no])
-
-AC_ARG_WITH([python_version],
-       AS_HELP_STRING([--with-python_version=VERSION], [required Python version [2.6]]),
-       [PYTHON_VERSION=$withval], [PYTHON_VERSION=2.6])
-
-if test "x$with_python" = "xyes"; then
-       AM_PATH_PYTHON([$PYTHON_VERSION])
-
-       if ! test -x "$PYTHON-config" ; then
-            AC_MSG_ERROR([Cannot find python development packages to build bindings])
-       fi
-
-       PYTHON_INCLUDES=$($PYTHON-config --includes)
-       AC_SUBST(PYTHON_INCLUDES)
-
-       PYTHON_LIBS=$($PYTHON-config --libs)
-       AC_SUBST(PYTHON_LIBS)
-fi
-AM_CONDITIONAL([PYTHON_CRYPTSETUP], [test "x$with_python" = "xyes"])
+AC_DEFUN([CS_ABSPATH], [
+       case "$1" in
+               /*) ;;
+               *) AC_MSG_ERROR([$2 argument must be an absolute path.]);;
+       esac
+])
 
 dnl ==========================================================================
 CS_STR_WITH([plain-hash],   [password hashing function for plain mode], [ripemd160])
@@ -406,11 +571,26 @@ CS_STR_WITH([plain-cipher], [cipher for plain mode], [aes])
 CS_STR_WITH([plain-mode],   [cipher mode for plain mode], [cbc-essiv:sha256])
 CS_NUM_WITH([plain-keybits],[key length in bits for plain mode], [256])
 
-CS_STR_WITH([luks1-hash],   [hash function for LUKS1 header], [sha1])
+CS_STR_WITH([luks1-hash],   [hash function for LUKS1 header], [sha256])
 CS_STR_WITH([luks1-cipher], [cipher for LUKS1], [aes])
 CS_STR_WITH([luks1-mode],   [cipher mode for LUKS1], [xts-plain64])
 CS_NUM_WITH([luks1-keybits],[key length in bits for LUKS1], [256])
-CS_NUM_WITH([luks1-iter-time],[PBKDF2 iteration time for LUKS1 (in ms)], [1000])
+
+AC_ARG_ENABLE([luks_adjust_xts_keysize], AS_HELP_STRING([--disable-luks-adjust-xts-keysize],
+       [XTS mode requires two keys, double default LUKS keysize if needed]),
+       [], [enable_luks_adjust_xts_keysize=yes])
+if test "x$enable_luks_adjust_xts_keysize" = "xyes"; then
+       AC_DEFINE(ENABLE_LUKS_ADJUST_XTS_KEYSIZE, 1, [XTS mode - double default LUKS keysize if needed])
+fi
+
+CS_STR_WITH([luks2-pbkdf],           [Default PBKDF algorithm (pbkdf2 or argon2i/argon2id) for LUKS2], [argon2i])
+CS_NUM_WITH([luks1-iter-time],       [PBKDF2 iteration time for LUKS1 (in ms)], [2000])
+CS_NUM_WITH([luks2-iter-time],       [Argon2 PBKDF iteration time for LUKS2 (in ms)], [2000])
+CS_NUM_WITH([luks2-memory-kb],       [Argon2 PBKDF memory cost for LUKS2 (in kB)], [1048576])
+CS_NUM_WITH([luks2-parallel-threads],[Argon2 PBKDF max parallel cost for LUKS2 (if CPUs available)], [4])
+
+CS_STR_WITH([luks2-keyslot-cipher], [fallback cipher for LUKS2 keyslot (if data encryption is incompatible)], [aes-xts-plain64])
+CS_NUM_WITH([luks2-keyslot-keybits],[fallback key size for LUKS2 keyslot (if data encryption is incompatible)], [512])
 
 CS_STR_WITH([loopaes-cipher], [cipher for loop-AES mode], [aes])
 CS_NUM_WITH([loopaes-keybits],[key length in bits for loop-AES mode], [256])
@@ -422,21 +602,46 @@ CS_STR_WITH([verity-hash],       [hash function for verity mode], [sha256])
 CS_NUM_WITH([verity-data-block], [data block size for verity mode], [4096])
 CS_NUM_WITH([verity-hash-block], [hash block size for verity mode], [4096])
 CS_NUM_WITH([verity-salt-size],  [salt size for verity mode], [32])
+CS_NUM_WITH([verity-fec-roots],  [parity bytes for verity FEC], [2])
+
+CS_STR_WITH([tmpfilesdir], [override default path to directory with systemd temporary files], [])
+test -z "$with_tmpfilesdir" && with_tmpfilesdir=$systemd_tmpfilesdir
+test "x$with_tmpfilesdir" = "xno" || {
+       CS_ABSPATH([${with_tmpfilesdir}],[with-tmpfilesdir])
+       DEFAULT_TMPFILESDIR=$with_tmpfilesdir
+       AC_SUBST(DEFAULT_TMPFILESDIR)
+}
+AM_CONDITIONAL(CRYPTSETUP_TMPFILE, test -n "$DEFAULT_TMPFILESDIR")
+
+CS_STR_WITH([luks2-lock-path], [path to directory for LUKSv2 locks], [/run/cryptsetup])
+test -z "$with_luks2_lock_path" && with_luks2_lock_path=/run/cryptsetup
+CS_ABSPATH([${with_luks2_lock_path}],[with-luks2-lock-path])
+DEFAULT_LUKS2_LOCK_PATH=$with_luks2_lock_path
+AC_SUBST(DEFAULT_LUKS2_LOCK_PATH)
+
+CS_NUM_WITH([luks2-lock-dir-perms], [default luks2 locking directory permissions], [0700])
+test -z "$with_luks2_lock_dir_perms" && with_luks2_lock_dir_perms=0700
+DEFAULT_LUKS2_LOCK_DIR_PERMS=$with_luks2_lock_dir_perms
+AC_SUBST(DEFAULT_LUKS2_LOCK_DIR_PERMS)
+
+dnl Override default LUKS format version (for cryptsetup or cryptsetup-reencrypt format actions only).
+AC_ARG_WITH([default_luks_format],
+       AS_HELP_STRING([--with-default-luks-format=FORMAT], [default LUKS format version (LUKS1/LUKS2) [LUKS2]]),
+       [], [with_default_luks_format=LUKS2])
+
+case $with_default_luks_format in
+       LUKS1) default_luks=CRYPT_LUKS1 ;;
+       LUKS2) default_luks=CRYPT_LUKS2 ;;
+       *) AC_MSG_ERROR([Unknown default LUKS format. Use LUKS1 or LUKS2 only.]) ;;
+esac
+AC_DEFINE_UNQUOTED([DEFAULT_LUKS_FORMAT], [$default_luks], [default LUKS format version])
 
 dnl ==========================================================================
 
 AC_CONFIG_FILES([ Makefile
-lib/Makefile
 lib/libcryptsetup.pc
-lib/crypto_backend/Makefile
-lib/luks1/Makefile
-lib/loopaes/Makefile
-lib/verity/Makefile
-lib/tcrypt/Makefile
-src/Makefile
 po/Makefile.in
-man/Makefile
+scripts/cryptsetup.conf
 tests/Makefile
-python/Makefile
 ])
 AC_OUTPUT
diff --git a/depcomp b/depcomp
index 4ebd5b3..6b39162 100755 (executable)
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2013-05-30.07; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@ scriptversion=2013-05-30.07; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -783,9 +783,9 @@ exit 0
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
index e51d362..7a4027c 100644 (file)
        * Document cryptsetup exit codes.
 
 2011-03-18  Milan Broz  <mbroz@redhat.com>
-       * Respect maximum keyfile size paramater.
+       * Respect maximum keyfile size parameter.
        * Introduce maximum default keyfile size, add configure option.
        * Require the whole key read from keyfile in create command (broken in 1.2.0).
        * Fix offset option for loopaesOpen.
 
 2011-03-05  Milan Broz  <mbroz@redhat.com>
        * Add exception to COPYING for binary distribution linked with OpenSSL library.
-       * Set secure data flag (wipe all ioclt buffers) if devmapper library supports it.
+       * Set secure data flag (wipe all ioctl buffers) if devmapper library supports it.
 
 2011-01-29  Milan Broz  <mbroz@redhat.com>
        * Fix mapping removal if device disappeared but node still exists.
        * Version 1.1.0.
 
 2010-01-10  Milan Broz  <mbroz@redhat.com>
-       * Fix initialisation of gcrypt duting luksFormat.
-       * Convert hash name to lower case in header (fix sha1 backward comatible header)
+       * Fix initialisation of gcrypt during luksFormat.
+       * Convert hash name to lower case in header (fix sha1 backward compatible header)
        * Check for minimum required gcrypt version.
 
 2009-12-30  Milan Broz  <mbroz@redhat.com>
        * Fix key slot iteration count calculation (small -i value was the same as default).
-       * The slot and key digest iteration minimun is now 1000.
+       * The slot and key digest iteration minimum is now 1000.
        * The key digest iteration # is calculated from iteration time (approx 1/8 of that).
        * Version 1.1.0-rc4.
 
        * Require device device-mapper to build and do not use backend wrapper for dm calls.
        * Move memory locking and dm initialization to command layer.
        * Increase priority of process if memory is locked.
-       * Add log macros and make logging modre consitent.
+       * Add log macros and make logging more consistent.
        * Move command successful messages to verbose level.
        * Introduce --debug parameter.
        * Move device utils code and provide context parameter (for log).
        * Keyfile now must be provided by path, only stdin file descriptor is used (api only).
        * Do not call isatty() on closed keyfile descriptor.
-       * Run performance check for PBKDF2 from LUKS code, do not mix hash algoritms results.
+       * Run performance check for PBKDF2 from LUKS code, do not mix hash algorithms results.
        * Add ability to provide pre-generated master key and UUID in LUKS header format.
        * Add LUKS function to verify master key digest.
-       * Move key slot manuipulation function into LUKS specific code.
+       * Move key slot manipulation function into LUKS specific code.
        * Replace global options struct with separate parameters in helper functions.
        * Add new libcryptsetup API (documented in libcryptsetup.h).
        * Implement old API calls using new functions.
        * Add --master-key-file option for luksFormat and luksAddKey.
 
 2009-08-17  Milan Broz  <mbroz@redhat.com>
-       * Fix PBKDF2 speed calculation for large passhrases.
+       * Fix PBKDF2 speed calculation for large passphrases.
        * Allow using passphrase provided in options struct for LuksOpen.
        * Allow restrict keys size in LuksOpen.
 
        * Switch PBKDF2 from internal SHA1 to libgcrypt, make hash algorithm not hardcoded to SHA1 here.
        * Add required parameters for changing hash used in LUKS key setup scheme.
        * Do not export simple XOR helper now used only inside AF functions.
-       * Completely remove internal SHA1 implementanion code, not needed anymore.
+       * Completely remove internal SHA1 implementation code, not needed anymore.
        * Enable hash algorithm selection for LUKS through -h luksFormat option.
 
 2009-07-28  Milan Broz  <mbroz@redhat.com>
 
 2006-03-15  Clemens Fruhwirth  <clemens@endorphin.org>
 
-       * configure.in: 1.0.3-rc3. Most unplease release ever. 
+       * configure.in: 1.0.3-rc3. Most displease release ever. 
        * lib/setup.c (__crypt_create_device): More verbose error message.
 
 2006-02-26  Clemens Fruhwirth  <clemens@endorphin.org>
 
 2005-12-06  Clemens Fruhwirth  <clemens@endorphin.org>
 
-       * man/cryptsetup.8: Correct "seconds" to "microseconds" in the explaination for -i.
+       * man/cryptsetup.8: Correct "seconds" to "microseconds" in the explanation for -i.
 
 2005-11-09  Clemens Fruhwirth  <clemens@endorphin.org>
 
 
 2005-09-08  Clemens Fruhwirth  <clemens@endorphin.org>
 
-       * lib/setup.c (get_key): Fixed another incompatiblity with
+       * lib/setup.c (get_key): Fixed another incompatibility with
        original cryptsetup.
 
 2005-08-20  Clemens Fruhwirth  <clemens@endorphin.org>
 
        * man/cryptsetup.1: Add man page.
 
-       * lib/setup.c: Remove unneccessary LUKS_write_phdr call, so the
+       * lib/setup.c: Remove unnecessary LUKS_write_phdr call, so the
        phdr is written after passphrase reading, so the user can change
        his mind, and not have a partial written LUKS header on it's disk.
 
diff --git a/docs/Keyring.txt b/docs/Keyring.txt
new file mode 100644 (file)
index 0000000..bdcc838
--- /dev/null
@@ -0,0 +1,56 @@
+Integration with kernel keyring service
+---------------------------------------
+
+We have two different use cases for kernel keyring service:
+
+I) Volume keys
+
+Since upstream kernel 4.10 dm-crypt device mapper target allows loading volume
+key (VK) in kernel keyring service. The key offloaded in kernel keyring service
+is only referenced (by key description) in dm-crypt target and the VK is therefore
+no longer stored directly in dm-crypt target. Starting with cryptsetup 2.0 we
+load VK in kernel keyring by default for LUKSv2 devices (when dm-crypt with the
+feature is available).
+
+Currently cryptsetup loads VK in 'logon' type kernel key so that VK is passed in
+the kernel and can't be read from userspace afterward. Also cryptsetup loads VK in
+thread keyring (before passing the reference to dm-crypt target) so that the key
+lifetime is directly bound to the process that performs the dm-crypt setup. When
+cryptsetup process exits (for whatever reason) the key gets unlinked in kernel
+automatically. In summary, the key description visible in dm-crypt table line is
+a reference to VK that usually no longer exists in kernel keyring service if you
+used cryptsetup to for device activation.
+
+Using this feature dm-crypt no longer maintains a direct key copy (but there's
+always at least one copy in kernel crypto layer).
+
+II) Keyslot passphrase
+The second use case for kernel keyring is to allow cryptsetup reading the keyslot
+passphrase stored in kernel keyring instead. The user may load passphrase in kernel
+keyring and notify cryptsetup to read it from there later. Currently, cryptsetup
+cli supports kernel keyring for passphrase only via LUKS2 internal token
+(luks2-keyring). Library also provides a general method for device activation by
+reading passphrase from keyring: crypt_activate_by_keyring(). The key type
+for use case II) must always be 'user' since we need to read the actual key
+data from userspace unlike with VK in I). Ability to read keyslot passphrase
+from kernel keyring also allows easily auto-activate LUKS2 devices.
+
+Simple example how to use kernel keyring for keyslot passphrase:
+
+1) create LUKS2 keyring token for keyslot 0 (in LUKS2 device/image)
+cryptsetup token add --key-description my:key -S 0 /dev/device
+
+2) Load keyslot passphrase in user keyring
+read -s -p "Keyslot passphrase: "; echo -n $REPLY | keyctl padd user my:key @u
+
+3) Activate device using passphrase stored in kernel keyring
+cryptsetup open /dev/device my_unlocked_device
+
+4a) unlink the key when no longer needed by
+keyctl unlink %user:my:key @u
+
+4b) or revoke it immediately by
+keyctl revoke %user:my:key
+
+If cryptsetup asks for passphrase in step 3) something went wrong with keyring
+activation. See --debug output then.
diff --git a/docs/LUKS2-locking.txt b/docs/LUKS2-locking.txt
new file mode 100644 (file)
index 0000000..e401b61
--- /dev/null
@@ -0,0 +1,61 @@
+LUKS2 device locking overview
+=============================
+
+Why
+~~~
+
+LUKS2 format keeps two identical copies of metadata stored consecutively
+at the head of metadata device (file or bdev). The metadata
+area (both copies) must be updated in a single atomic operation to avoid
+header corruption during concurrent write.
+
+While with LUKS1 users may have clear knowledge of when a LUKS header is
+being updated (written to) or when it's being read solely the need for
+locking with legacy format was not so obvious as it is with the LUKSv2 format.
+
+With LUKS2 the boundary between read-only and read-write is blurry and what
+used to be the exclusively read-only operation (i.e., cryptsetup open command) may
+easily become read-update operation silently without user's knowledge.
+Major feature of LUKS2 format is resilience against accidental
+corruption of metadata (i.e., partial header overwrite by parted or cfdisk
+while creating partition on mistaken block device).
+Such header corruption is detected early on header read and auto-recovery
+procedure takes place (the corrupted header with checksum mismatch is being
+replaced by the secondary one if that one is intact).
+On current Linux systems header load operation may be triggered without user
+direct intervention for example by udev rule or from systemd service.
+Such clash of header read and auto-recovery procedure could have severe
+consequences with the worst case of having LUKS2 device unaccessible or being
+broken beyond repair.
+
+The whole locking of LUKSv2 device headers split into two categories depending
+what backend the header is stored on:
+
+I) block device
+~~~~~~~~~~~~~~~
+
+We perform flock() on file descriptors of files stored in a private
+directory (by default /run/lock/cryptsetup). The file name is derived
+from major:minor couple of affected block device. Note we recommend
+that access to private locking directory is supposed to be limited
+to superuser only. For this method to work the distribution needs
+to install the locking directory with appropriate access rights.
+
+II) regular files
+~~~~~~~~~~~~~~~~~
+
+First notable difference between headers stored in a file
+vs. headers stored in a block device is that headers in a file may be
+manipulated by the regular user unlike headers on block devices. Therefore
+we perform flock() protection on file with the luks2 header directly.
+
+Limitations
+~~~~~~~~~~~
+
+a) In general, the locking model provides serialization of I/Os targeting
+the header only. It means the header is always written or read at once
+while locking is enabled.
+We do not suppress any other negative effect that two or more concurrent
+writers of the same header may cause.
+
+b) The locking is not cluster aware in any way.
index 1257eff..a8c84db 100644 (file)
@@ -1,4 +1,4 @@
-# Doxyfile 1.7.4
+# Doxyfile 1.8.8
 
 #---------------------------------------------------------------------------
 # Project related configuration options
@@ -10,6 +10,7 @@ PROJECT_BRIEF          = "Public cryptsetup API"
 PROJECT_LOGO           =
 OUTPUT_DIRECTORY       = doxygen_api_docs
 CREATE_SUBDIRS         = NO
+ALLOW_UNICODE_NAMES    = NO
 OUTPUT_LANGUAGE        = English
 BRIEF_MEMBER_DESC      = YES
 REPEAT_BRIEF           = YES
@@ -27,11 +28,14 @@ INHERIT_DOCS           = YES
 SEPARATE_MEMBER_PAGES  = NO
 TAB_SIZE               = 8
 ALIASES                =
+TCL_SUBST              =
 OPTIMIZE_OUTPUT_FOR_C  = YES
 OPTIMIZE_OUTPUT_JAVA   = NO
 OPTIMIZE_FOR_FORTRAN   = NO
 OPTIMIZE_OUTPUT_VHDL   = NO
 EXTENSION_MAPPING      =
+MARKDOWN_SUPPORT       = YES
+AUTOLINK_SUPPORT       = YES
 BUILTIN_STL_SUPPORT    = NO
 CPP_CLI_SUPPORT        = NO
 SIP_SUPPORT            = NO
@@ -39,13 +43,15 @@ IDL_PROPERTY_SUPPORT   = YES
 DISTRIBUTE_GROUP_DOC   = NO
 SUBGROUPING            = YES
 INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS  = NO
 TYPEDEF_HIDES_STRUCT   = YES
-SYMBOL_CACHE_SIZE      = 0
+LOOKUP_CACHE_SIZE      = 0
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
 EXTRACT_ALL            = NO
 EXTRACT_PRIVATE        = NO
+EXTRACT_PACKAGE        = NO
 EXTRACT_STATIC         = NO
 EXTRACT_LOCAL_CLASSES  = YES
 EXTRACT_LOCAL_METHODS  = NO
@@ -58,6 +64,7 @@ INTERNAL_DOCS          = NO
 CASE_SENSE_NAMES       = YES
 HIDE_SCOPE_NAMES       = NO
 SHOW_INCLUDE_FILES     = YES
+SHOW_GROUPED_MEMB_INC  = NO
 FORCE_LOCAL_INCLUDES   = NO
 INLINE_INFO            = YES
 SORT_MEMBER_DOCS       = YES
@@ -73,13 +80,13 @@ GENERATE_DEPRECATEDLIST= YES
 ENABLED_SECTIONS       =
 MAX_INITIALIZER_LINES  = 30
 SHOW_USED_FILES        = YES
-SHOW_DIRECTORIES       = NO
 SHOW_FILES             = YES
 SHOW_NAMESPACES        = YES
 FILE_VERSION_FILTER    =
 LAYOUT_FILE            =
+CITE_BIB_FILES         =
 #---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
+# Configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
 QUIET                  = NO
 WARNINGS               = YES
@@ -89,9 +96,10 @@ WARN_NO_PARAMDOC       = NO
 WARN_FORMAT            = "$file:$line: $text"
 WARN_LOGFILE           =
 #---------------------------------------------------------------------------
-# configuration options related to the input files
+# Configuration options related to the input files
 #---------------------------------------------------------------------------
-INPUT                  = "doxygen_index" "../lib/libcryptsetup.h"
+INPUT                  = "doxygen_index.h" \
+                         "../lib/libcryptsetup.h"
 INPUT_ENCODING         = UTF-8
 FILE_PATTERNS          =
 RECURSIVE              = NO
@@ -107,8 +115,9 @@ INPUT_FILTER           =
 FILTER_PATTERNS        =
 FILTER_SOURCE_FILES    = NO
 FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
 #---------------------------------------------------------------------------
-# configuration options related to source browsing
+# Configuration options related to source browsing
 #---------------------------------------------------------------------------
 SOURCE_BROWSER         = NO
 INLINE_SOURCES         = NO
@@ -116,16 +125,19 @@ STRIP_CODE_COMMENTS    = YES
 REFERENCED_BY_RELATION = NO
 REFERENCES_RELATION    = NO
 REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS        = YES
 USE_HTAGS              = NO
 VERBATIM_HEADERS       = YES
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS          =
 #---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
+# Configuration options related to the alphabetical class index
 #---------------------------------------------------------------------------
 ALPHABETICAL_INDEX     = YES
 COLS_IN_ALPHA_INDEX    = 5
 IGNORE_PREFIX          =
 #---------------------------------------------------------------------------
-# configuration options related to the HTML output
+# Configuration options related to the HTML output
 #---------------------------------------------------------------------------
 GENERATE_HTML          = YES
 HTML_OUTPUT            = html
@@ -133,13 +145,14 @@ HTML_FILE_EXTENSION    = .html
 HTML_HEADER            =
 HTML_FOOTER            =
 HTML_STYLESHEET        =
+HTML_EXTRA_STYLESHEET  =
 HTML_EXTRA_FILES       =
 HTML_COLORSTYLE_HUE    = 220
 HTML_COLORSTYLE_SAT    = 100
 HTML_COLORSTYLE_GAMMA  = 80
 HTML_TIMESTAMP         = YES
-HTML_ALIGN_MEMBERS     = YES
 HTML_DYNAMIC_SECTIONS  = NO
+HTML_INDEX_NUM_ENTRIES = 100
 GENERATE_DOCSET        = NO
 DOCSET_FEEDNAME        = "Doxygen generated docs"
 DOCSET_BUNDLE_ID       = org.doxygen.Project
@@ -163,19 +176,26 @@ QHG_LOCATION           =
 GENERATE_ECLIPSEHELP   = NO
 ECLIPSE_DOC_ID         = org.doxygen.Project
 DISABLE_INDEX          = NO
-ENUM_VALUES_PER_LINE   = 4
 GENERATE_TREEVIEW      = NO
-USE_INLINE_TREES       = NO
+ENUM_VALUES_PER_LINE   = 4
 TREEVIEW_WIDTH         = 250
 EXT_LINKS_IN_WINDOW    = NO
 FORMULA_FONTSIZE       = 10
 FORMULA_TRANSPARENT    = YES
 USE_MATHJAX            = NO
+MATHJAX_FORMAT         = HTML-CSS
 MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+MATHJAX_EXTENSIONS     =
+MATHJAX_CODEFILE       =
 SEARCHENGINE           = YES
 SERVER_BASED_SEARCH    = NO
+EXTERNAL_SEARCH        = NO
+SEARCHENGINE_URL       =
+SEARCHDATA_FILE        = searchdata.xml
+EXTERNAL_SEARCH_ID     =
+EXTRA_SEARCH_MAPPINGS  =
 #---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
+# Configuration options related to the LaTeX output
 #---------------------------------------------------------------------------
 GENERATE_LATEX         = YES
 LATEX_OUTPUT           = latex
@@ -186,13 +206,15 @@ PAPER_TYPE             = a4
 EXTRA_PACKAGES         =
 LATEX_HEADER           =
 LATEX_FOOTER           =
+LATEX_EXTRA_FILES      =
 PDF_HYPERLINKS         = YES
 USE_PDFLATEX           = YES
 LATEX_BATCHMODE        = NO
 LATEX_HIDE_INDICES     = NO
 LATEX_SOURCE_CODE      = NO
+LATEX_BIB_STYLE        = plain
 #---------------------------------------------------------------------------
-# configuration options related to the RTF output
+# Configuration options related to the RTF output
 #---------------------------------------------------------------------------
 GENERATE_RTF           = NO
 RTF_OUTPUT             = rtf
@@ -201,26 +223,31 @@ RTF_HYPERLINKS         = NO
 RTF_STYLESHEET_FILE    =
 RTF_EXTENSIONS_FILE    =
 #---------------------------------------------------------------------------
-# configuration options related to the man page output
+# Configuration options related to the man page output
 #---------------------------------------------------------------------------
 GENERATE_MAN           = NO
 MAN_OUTPUT             = man
 MAN_EXTENSION          = .3
+MAN_SUBDIR             =
 MAN_LINKS              = NO
 #---------------------------------------------------------------------------
-# configuration options related to the XML output
+# Configuration options related to the XML output
 #---------------------------------------------------------------------------
 GENERATE_XML           = NO
 XML_OUTPUT             = xml
-XML_SCHEMA             =
-XML_DTD                =
 XML_PROGRAMLISTING     = YES
 #---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK       = NO
+DOCBOOK_OUTPUT         = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
 #---------------------------------------------------------------------------
 GENERATE_AUTOGEN_DEF   = NO
 #---------------------------------------------------------------------------
-# configuration options related to the Perl module output
+# Configuration options related to the Perl module output
 #---------------------------------------------------------------------------
 GENERATE_PERLMOD       = NO
 PERLMOD_LATEX          = NO
@@ -239,18 +266,20 @@ PREDEFINED             =
 EXPAND_AS_DEFINED      =
 SKIP_FUNCTION_MACROS   = YES
 #---------------------------------------------------------------------------
-# Configuration::additions related to external references
+# Configuration options related to external references
 #---------------------------------------------------------------------------
 TAGFILES               =
 GENERATE_TAGFILE       =
 ALLEXTERNALS           = NO
 EXTERNAL_GROUPS        = YES
+EXTERNAL_PAGES         = YES
 PERL_PATH              =
 #---------------------------------------------------------------------------
 # Configuration options related to the dot tool
 #---------------------------------------------------------------------------
 CLASS_DIAGRAMS         = YES
 MSCGEN_PATH            =
+DIA_PATH               =
 HIDE_UNDOC_RELATIONS   = YES
 HAVE_DOT               = NO
 DOT_NUM_THREADS        = 0
@@ -261,6 +290,7 @@ CLASS_GRAPH            = YES
 COLLABORATION_GRAPH    = YES
 GROUP_GRAPHS           = YES
 UML_LOOK               = NO
+UML_LIMIT_NUM_FIELDS   = 10
 TEMPLATE_RELATIONS     = NO
 INCLUDE_GRAPH          = YES
 INCLUDED_BY_GRAPH      = YES
@@ -269,9 +299,12 @@ CALLER_GRAPH           = NO
 GRAPHICAL_HIERARCHY    = YES
 DIRECTORY_GRAPH        = YES
 DOT_IMAGE_FORMAT       = png
+INTERACTIVE_SVG        = NO
 DOT_PATH               =
 DOTFILE_DIRS           =
 MSCFILE_DIRS           =
+DIAFILE_DIRS           =
+PLANTUML_JAR_PATH      =
 DOT_GRAPH_MAX_NODES    = 50
 MAX_DOT_GRAPH_DEPTH    = 0
 DOT_TRANSPARENT        = NO
similarity index 91%
rename from docs/doxygen_index
rename to docs/doxygen_index.h
index ec394ad..8bdf05f 100644 (file)
@@ -1,10 +1,9 @@
-/**
- * @mainpage Cryptsetup API
+/*! \mainpage Cryptsetup API
  *
- * The documentation covers public parts of cryptsetup API. In the following sections you'll find
+ * <b>The</b> documentation covers public parts of cryptsetup API. In the following sections you'll find
  * the examples that describe some features of cryptsetup API.
  * For more info about libcryptsetup API versions see
- * <a href="http://upstream-tracker.org/versions/libcryptsetup.html">Upstream Tracker</a>.
+ * <a href="https://gitlab.com/cryptsetup/cryptsetup/wikis/ABI-tracker/timeline/libcryptsetup/index.html">API Tracker</a>.
  *
  * <OL type="A">
  *     <LI>@ref cexamples "Cryptsetup API examples"</LI>
  * @section cexamples Cryptsetup API examples
  *     @section cluks crypt_luks_usage - cryptsetup LUKS device type usage
  *             @subsection cinit crypt_init()
- *
- *                     Every time you need to do something with cryptsetup or dmcrypt device
+ *                     Every time you need to do something with cryptsetup or dmcrypt device
  *                     you need a valid context. The first step to start your work is
  *                     @ref crypt_init call. You can call it either with path
  *                     to the block device or path to the regular file. If you don't supply the path,
  *                     empty context is initialized.
  *
  *             @subsection cformat crypt_format() - header and payload on mutual device
- *
  *                     This section covers basic use cases for formatting LUKS devices. Format operation
  *                     sets device type in context and in case of LUKS header is written at the beginning
- *                     of block device. In the example bellow we use the scenario where LUKS header and data
+ *                     of block device. In the example below we use the scenario where LUKS header and data
  *                     are both stored on the same device. There's also a possibility to store header and
  *                     data separately.
  *
@@ -51,7 +48,6 @@
  *                     overwrites part of the backing block device.
  *
  *             @subsection ckeys Keyslot operations examples
- *
  *                     After successful @ref crypt_format of LUKS device, volume key is not stored
  *                     in a persistent way on the device. Keyslot area is an array beyond LUKS header, where
  *                     volume key is stored in the encrypted form using user input passphrase. For more info about
  *                     There are two basic methods to create a new keyslot:
  *
  *                     @subsection ckeyslot_vol crypt_keyslot_add_by_volume_key()
- *
  *                             Creates a new keyslot directly by encrypting volume_key stored in the device
  *                             context. Passphrase should be supplied or user is prompted if passphrase param is
  *                             NULL.
  *
  *                     @subsection ckeyslot_pass crypt_keyslot_add_by_passphrase()
- *
  *                             Creates a new keyslot for the volume key by opening existing active keyslot,
  *                             extracting volume key from it and storing it into a new keyslot
  *                             protected by a new passphrase
  *
  *             @subsection cload crypt_load()
- *
  *                     Function loads header from backing block device into device context.
  *
  *             @subsection cactivate crypt_activate_by_passphrase()
- *
  *                     Activates crypt device by user supplied password for keyslot containing the volume_key.
  *                     If <I>keyslot</I> parameter is set to <I>CRYPT_ANY_SLOT</I> then all active keyslots
  *                     are tried one by one until the volume key is found.
  *
  *             @subsection cactive_pars crypt_get_active_device()
- *
  *                     This call returns structure containing runtime attributes of active device.
  *
  *             @subsection cinit_by_name crypt_init_by_name()
- *
  *                     In case you need to do operations with active device (device which already
  *                     has its corresponding mapping) and you miss valid device context stored in
  *                     *crypt_device reference, you should use this call. Function tries to
  *                     header.
  *
  *                     @subsection cdeactivate crypt_deactivate()
- *
  *                     Deactivates crypt device (removes DM mapping and safely erases volume key from kernel).
  *
  *             @subsection cluks_ex crypt_luks_usage.c - Complex example
- *
  *                     To compile and run use following commands in examples directory:
  *
  * @code
  * make
  * ./crypt_luks_usage _path_to_[block_device]_file
  * @endcode
- *
  *                     Note that you need to have the cryptsetup library compiled. @include crypt_luks_usage.c
  *
  *     @section clog crypt_log_usage - cryptsetup logging API example
- *
  *             Example describes basic use case for cryptsetup logging. To compile and run
  *             use following commands in examples directory:
  *
  * make
  * ./crypt_log_usage
  * @endcode
- *
  *             Note that you need to have the cryptsetup library compiled. @include crypt_log_usage.c
  *
  *             @example crypt_luks_usage.c
index e3e4a2a..d8364af 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * An example of using logging through libcryptsetup API
+ * libcryptsetup API log example
  *
- * Copyright (C) 2011, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include <libcryptsetup.h>
 
 /*
- * This is an example of function that can be registered using crypt_set_log_callback API.
+ * This is an example of crypt_set_log_callback API callback.
  *
- * Its prototype is void (*log)(int level, const char *msg, void *usrptr) as defined
- * in crypt_set_log_callback
  */
 static void simple_syslog_wrapper(int level, const char *msg, void *usrptr)
 {
@@ -71,7 +69,7 @@ int main(void)
                return 2;
        }
 
-       /* crypt_set_log_callback() - register a log function for crypt context */
+       /* crypt_set_log_callback() - register a log callback for crypt context */
        crypt_set_log_callback(cd, &simple_syslog_wrapper, (void *)usrprefix);
 
        /* send messages ithrough the crypt_log() interface */
@@ -83,7 +81,7 @@ int main(void)
        /* release crypt context */
        crypt_free(cd);
 
-       /* Initialize default (global) log function */
+       /* Initialize default (global) log callback */
        crypt_set_log_callback(NULL, &simple_syslog_wrapper, NULL);
 
        crypt_log(NULL, CRYPT_LOG_NORMAL, "This is normal log message");
index 2abd4ed..7299a1c 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * An example of using LUKS device through libcryptsetup API
+ *  libcryptsetup API - using LUKS device example
  *
- * Copyright (C) 2011, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 static int format_and_add_keyslots(const char *path)
 {
        struct crypt_device *cd;
-       struct crypt_params_luks1 params;
        int r;
 
        /*
-        * crypt_init() call precedes most of operations of cryptsetup API. The call is used
-        * to initialize crypt device context stored in structure referenced by _cd_ in
-        * the example. Second parameter is used to pass underlaying device path.
+        * The crypt_init() call is used  to initialize crypt_device context,
+        * The path parameter specifies a device path.
         *
-        * Note:
-        * If path refers to a regular file it'll be attached to a first free loop device.
-        * crypt_init() operation fails in case there's no more loop device available.
-        * Also, loop device will have the AUTOCLEAR flag set, so the file loopback will
-        * be detached automatically.
+        * For path, you can use either link to a file or block device.
+        * The loopback device will be detached automatically.
         */
 
        r = crypt_init(&cd, path);
-       if (r < 0 ) {
+       if (r < 0) {
                printf("crypt_init() failed for %s.\n", path);
                return r;
        }
@@ -53,73 +48,37 @@ static int format_and_add_keyslots(const char *path)
        printf("Context is attached to block device %s.\n", crypt_get_device_name(cd));
 
        /*
-        * So far no data were written on your device. This will change with call of
-        * crypt_format() only if you specify CRYPT_LUKS1 as device type.
+        * So far, no data were written to the device.
         */
-       printf("Device %s will be formatted to LUKS device after 5 seconds.\n"
+       printf("Device %s will be formatted as a LUKS device after 5 seconds.\n"
               "Press CTRL+C now if you want to cancel this operation.\n", path);
        sleep(5);
 
-
-       /*
-        * Prepare LUKS format parameters
-        *
-        * hash parameter defines PBKDF2 hash algorithm used in LUKS header.
-        * For compatibility reason we use SHA1 here.
-        */
-       params.hash = "sha1";
-
-       /*
-        * data_alignment parameter is relevant only in case of the luks header
-        * and the payload are both stored on same device.
-        *
-        * if you set data_alignment = 0, cryptsetup will autodetect
-        * data_alignment according to underlaying device topology.
-        */
-       params.data_alignment = 0;
-
-       /*
-        * data_device parameter defines that no external device
-        * for luks header will be used
-        */
-       params.data_device = NULL;
-
        /*
         * NULLs for uuid and volume_key means that these attributes will be
-        * generated during crypt_format(). Volume key is generated with respect
-        * to key size parameter passed to function.
-        *
-        * crypt_format() checks device size (LUKS header must fit there).
+        * generated during crypt_format().
         */
        r = crypt_format(cd,            /* crypt context */
-                        CRYPT_LUKS1,   /* LUKS1 is standard LUKS header */
+                        CRYPT_LUKS2,   /* LUKS2 is a new LUKS format; use CRYPT_LUKS1 for LUKS1 */
                         "aes",         /* used cipher */
-                        "xts-plain64", /* used block mode and IV generator*/
+                        "xts-plain64", /* used block mode and IV */
                         NULL,          /* generate UUID */
                         NULL,          /* generate volume key from RNG */
-                        256 / 8,       /* 256bit key - here AES-128 in XTS mode, size is in bytes */
-                        &params);      /* parameters above */
+                        512 / 8,       /* 512bit key - here AES-256 in XTS mode, size is in bytes */
+                        NULL);         /* default parameters */
 
-       if(r < 0) {
+       if (r < 0) {
                printf("crypt_format() failed on device %s\n", crypt_get_device_name(cd));
                crypt_free(cd);
                return r;
        }
 
        /*
-        * The device now contains LUKS1 header, but there is
-        * no active keyslot with encrypted volume key yet.
-        */
-
-       /*
-        * cryptt_kesylot_add_* call stores volume_key in encrypted form into keyslot.
-        * Without keyslot you can't manipulate with LUKS device after the context will be freed.
+        * The device now contains a LUKS header, but there is no active keyslot.
         *
-        * To create a new keyslot you need to supply the existing one (to get the volume key from) or
-        * you need to supply the volume key.
+        * crypt_keyslot_add_* call stores the volume_key in the encrypted form into the keyslot.
         *
-        * After format, we have volume key stored internally in context so add new keyslot
-        * using this internal volume key.
+        * After format, the volume key is stored internally.
         */
        r = crypt_keyslot_add_by_volume_key(cd,                 /* crypt context */
                                            CRYPT_ANY_SLOT,     /* just use first free slot */
@@ -137,8 +96,8 @@ static int format_and_add_keyslots(const char *path)
        printf("The first keyslot is initialized.\n");
 
        /*
-        * Add another keyslot, now using the first keyslot.
-        * It will decrypt volume key from the first keyslot and creates new one with another passphrase.
+        * Add another keyslot, now authenticating with the first keyslot.
+        * It decrypts the volume key from the first keyslot and creates a new one with the specified passphrase.
         */
        r = crypt_keyslot_add_by_passphrase(cd,                 /* crypt context */
                                            CRYPT_ANY_SLOT,     /* just use first free slot */
@@ -164,21 +123,18 @@ static int activate_and_check_status(const char *path, const char *device_name)
 
        /*
         * LUKS device activation example.
-        * It's sequence of sub-steps: device initialization, LUKS header load
-        * and the device activation itself.
         */
        r = crypt_init(&cd, path);
-       if (r < 0 ) {
+       if (r < 0) {
                printf("crypt_init() failed for %s.\n", path);
                return r;
        }
 
        /*
-        * crypt_load() is used to load the LUKS header from block device
-        * into crypt_device context.
+        * crypt_load() is used to load existing LUKS header from a block device
         */
        r = crypt_load(cd,              /* crypt context */
-                      CRYPT_LUKS1,     /* requested type */
+                      CRYPT_LUKS,      /* requested type - here LUKS of any type */
                       NULL);           /* additional parameters (not used) */
 
        if (r < 0) {
@@ -188,11 +144,11 @@ static int activate_and_check_status(const char *path, const char *device_name)
        }
 
        /*
-        * Device activation creates device-mapper devie mapping with name device_name.
+        * Device activation creates a device-mapper device with the specified name.
         */
        r = crypt_activate_by_passphrase(cd,            /* crypt context */
                                         device_name,   /* device name to activate */
-                                        CRYPT_ANY_SLOT,/* which slot use (ANY - try all) */
+                                        CRYPT_ANY_SLOT,/* the keyslot use (try all here) */
                                         "foo", 3,      /* passphrase */
                                         CRYPT_ACTIVATE_READONLY); /* flags */
        if (r < 0) {
@@ -201,13 +157,13 @@ static int activate_and_check_status(const char *path, const char *device_name)
                return r;
        }
 
-       printf("LUKS device %s/%s is active.\n", crypt_get_dir(), device_name);
+       printf("%s device %s/%s is active.\n", crypt_get_type(cd), crypt_get_dir(), device_name);
        printf("\tcipher used: %s\n", crypt_get_cipher(cd));
        printf("\tcipher mode: %s\n", crypt_get_cipher_mode(cd));
        printf("\tdevice UUID: %s\n", crypt_get_uuid(cd));
 
        /*
-        * Get info about active device (query DM backend)
+        * Get info about the active device.
         */
        r = crypt_get_active_device(cd, device_name, &cad);
        if (r < 0) {
@@ -235,7 +191,7 @@ static int handle_active_device(const char *device_name)
        int r;
 
        /*
-        * crypt_init_by_name() initializes device context and loads LUKS header from backing device
+        * crypt_init_by_name() initializes context by an active device-mapper name
         */
        r = crypt_init_by_name(&cd, device_name);
        if (r < 0) {
@@ -252,7 +208,7 @@ static int handle_active_device(const char *device_name)
        }
 
        /*
-        * crypt_deactivate() is used to deactivate device
+        * crypt_deactivate() is used to deactivate device
         */
        r = crypt_deactivate(cd, device_name);
        if (r < 0) {
diff --git a/docs/on-disk-format-luks2.pdf b/docs/on-disk-format-luks2.pdf
new file mode 100644 (file)
index 0000000..f4ecda3
Binary files /dev/null and b/docs/on-disk-format-luks2.pdf differ
index a9a18d5..7f6e5e7 100644 (file)
Binary files a/docs/on-disk-format.pdf and b/docs/on-disk-format.pdf differ
index 9ba8a3b..b7ae977 100644 (file)
@@ -15,7 +15,7 @@ Important changes
    * NSS (because of missing ripemd160 it cannot provide full backward compatibility)
    * kernel userspace API (provided by kernel 2.6.38 and above)
      (Note that kernel userspace backend is very slow for this type of operation.
-      But it can be usefull for embedded systems, because you can avoid userspace
+      But it can be useful for embedded systems, because you can avoid userspace
       crypto library completely.)
 
    Backend is selected during configure time, using --with-crypto_backend option.
index 6a176d4..bef4e74 100644 (file)
@@ -89,7 +89,7 @@ WARNING: This release removes old deprecated API from libcryptsetup
  (It can be used to simulate trivial hidden disk concepts.)
 
 libcryptsetup API changes:
-  * Added options to suport detached metadata device
+  * Added options to support detached metadata device
      crypt_init_by_name_and_header()
      crypt_set_data_device()
   * Add crypt_last_error() API call.
index 16a34cb..9f1e1d1 100644 (file)
@@ -46,7 +46,7 @@ Side effect of reencryption is that final device will contain
 only ciphertext (for all sectors) so even if device was not properly
 wiped by random data, after reencryption you cannot distinguish
 which sectors are used.
-(Reecryption is done always for the whole device.)
+(Reencryption is done always for the whole device.)
 
 There are for sure bugs, please TEST IT IN TEST ENVIRONMENT before
 use for your data.
diff --git a/docs/v1.6.8-ReleaseNotes b/docs/v1.6.8-ReleaseNotes
new file mode 100644 (file)
index 0000000..43b4f2c
--- /dev/null
@@ -0,0 +1,47 @@
+Cryptsetup 1.6.8 Release Notes
+==============================
+
+Changes since version 1.6.7
+
+* If the null cipher (no encryption) is used, allow only empty password for LUKS.
+  (Previously cryptsetup accepted any password in this case.)
+
+  The null cipher can be used only for testing and it is used temporarily during
+  offline encrypting not yet encrypted device (cryptsetup-reencrypt tool).
+
+  Accepting only empty password prevents situation when someone adds another
+  LUKS device using the same UUID (UUID of existing LUKS device) with faked
+  header containing null cipher.
+  This could force user to use different LUKS device (with no encryption)
+  without noticing.
+  (IOW it prevents situation when attacker intentionally forces
+  user to boot into different system just by LUKS header manipulation.)
+
+  Properly configured systems should have an additional integrity protection
+  in place here (LUKS here provides only confidentiality) but it is better
+  to not allow this situation in the first place.
+
+  (For more info see QubesOS Security Bulletin QSB-019-2015.)
+
+* Properly support stdin "-" handling for luksAddKey for both new and old
+  keyfile parameters.
+
+* If encrypted device is file-backed (it uses underlying loop device),
+  cryptsetup resize will try to resize underlying loop device as well.
+  (It can be used to grow up file-backed device in one step.)
+
+* Cryptsetup now allows to use empty password through stdin pipe.
+  (Intended only for testing in scripts.)
+
+Cryptsetup API NOTE:
+
+Direct terminal handling and password calling callback for passphrase
+entry will be removed from libcryptsetup in next major (2.x) version
+(application should handle it itself).
+It means that application have to always provide password in API calls.
+
+Functions returning last error will be removed in next major version (2.x).
+These functions did not work properly for early initialization errors
+and application can implement better function easily using own error callback.
+
+See comments in libcryptsetup.h for more info about deprecated functions.
diff --git a/docs/v1.7.0-ReleaseNotes b/docs/v1.7.0-ReleaseNotes
new file mode 100644 (file)
index 0000000..cd568c1
--- /dev/null
@@ -0,0 +1,81 @@
+Cryptsetup 1.7.0 Release Notes
+==============================
+
+The cryptsetup 1.7 release changes defaults for LUKS,
+there are no API changes.
+
+Changes since version 1.6.8
+
+* Default hash function is now SHA256 (used in key derivation function
+  and anti-forensic splitter).
+
+  Note that replacing SHA1 with SHA256 is not for security reasons.
+  (LUKS does not have problems even if collisions are found for SHA1,
+  for details see FAQ item 5.20).
+
+  Using SHA256 as default is mainly to prevent compatibility problems
+  on hardened systems where SHA1 is already be phased out.
+
+  Note that all checks (kernel crypto API availability check) now uses
+  SHA256 as well.
+
+* Default iteration time for PBKDF2 is now 2 seconds.
+
+  Increasing iteration time is in combination with PBKDF2 benchmark
+  fixes a try to keep PBKDF2 iteration count still high enough and
+  also still acceptable for users.
+
+  N.B. Long term is to replace PBKDF2 algorithm with Password Hashing
+  Competition winner - Argon2.
+
+  Distributions can still change these defaults in compilation time.
+
+  You can change iteration time and used hash function in existing LUKS
+  header with cryptsetup-reencrypt utility even without full reencryption
+  of device (see --keep-key option).
+
+* Fix PBKDF2 iteration benchmark for longer key sizes.
+
+  The previous PBKDF2 benchmark code did not take into account
+  output key length properly.
+
+  For SHA1 (with 160-bits output) and 256-bit keys (and longer)
+  it means that the final iteration value was higher than it should be.
+
+  For other hash algorithms (like SHA256 or SHA512) it caused
+  that iteration count was lower (in comparison to SHA1) than
+  expected for the requested time period.
+
+  The PBKDF2 benchmark code is now fixed to use the key size for
+  the formatted device (or default LUKS key size if running in informational
+  benchmark mode).
+
+  Thanks to A.Visconti, S.Bossi, A.Calo and H.Ragab
+  (http://www.club.di.unimi.it/) for point this out.
+  (Based on "What users should know about Full Disk Encryption
+  based on LUKS" paper to be presented on CANS2015).
+
+* Remove experimental warning for reencrypt tool.
+  The strong request for full backup before using reencryption utility
+  still applies :)
+
+* Add optional libpasswdqc support for new LUKS passwords.
+
+  If password is entered through terminal (no keyfile specified) and
+  cryptsetup is compiled with --enable-passwdqc[=/etc/passwdqc.conf],
+  configured system passwdqc settings are used to check password quality.
+
+* Update FAQ document.
+
+Cryptsetup API NOTE:
+
+Direct terminal handling and password calling callback for passphrase
+entry will be removed from libcryptsetup in next major (2.x) version
+(application should handle it itself).
+It means that application have to always provide password in API calls.
+
+Functions returning last error will be removed in next major version (2.x).
+These functions did not work properly for early initialization errors
+and application can implement better function easily using own error callback.
+
+See comments in libcryptsetup.h for more info about deprecated functions.
diff --git a/docs/v1.7.1-ReleaseNotes b/docs/v1.7.1-ReleaseNotes
new file mode 100644 (file)
index 0000000..057c135
--- /dev/null
@@ -0,0 +1,36 @@
+Cryptsetup 1.7.1 Release Notes
+==============================
+
+Changes since version 1.7.0
+
+* Code now uses kernel crypto API backend according to new
+  changes introduced in mainline kernel
+
+  While mainline kernel should contain backward compatible
+  changes, some stable series kernels do not contain fully
+  backported compatibility patches.
+  Without these patches  most of cryptsetup operations
+  (like unlocking device) fail.
+
+  This change in cryptsetup ensures that all operations using
+  kernel crypto API works even on these kernels.
+
+* The cryptsetup-reencrypt utility now properly detects removal
+  of underlying link to block device and does not remove
+  ongoing re-encryption log.
+  This allows proper recovery (resume) of reencrypt operation later.
+
+  NOTE: Never use /dev/disk/by-uuid/ path for reencryption utility,
+  this link disappears once the device metadata is temporarily
+  removed from device.
+
+* Cryptsetup now allows special "-" (standard input) keyfile handling
+  even for TCRYPT (TrueCrypt and VeraCrypt compatible) devices.
+
+* Cryptsetup now fails if there are more keyfiles specified
+  for non-TCRYPT device.
+
+* The luksKillSlot command now does not suppress provided password
+  in batch mode (if password is wrong slot is not destroyed).
+  Note that not providing password in batch mode means that keyslot
+  is destroyed unconditionally.
diff --git a/docs/v1.7.2-ReleaseNotes b/docs/v1.7.2-ReleaseNotes
new file mode 100644 (file)
index 0000000..6323430
--- /dev/null
@@ -0,0 +1,37 @@
+Cryptsetup 1.7.2 Release Notes
+==============================
+
+Changes since version 1.7.1
+
+* Update LUKS documentation format.
+  Clarify fixed sector size and keyslots alignment.
+
+* Support activation options for error handling modes in Linux kernel
+  dm-verity module:
+
+  --ignore-corruption - dm-verity just logs detected corruption
+
+  --restart-on-corruption - dm-verity restarts the kernel if corruption is detected
+
+  If the options above are not specified, default behavior for dm-verity remains.
+  Default is that I/O operation fails with I/O error if corrupted block is detected.
+
+  --ignore-zero-blocks - Instructs dm-verity to not verify blocks that are expected
+  to contain zeroes and always return zeroes directly instead.
+
+  NOTE that these options could have security or functional impacts,
+  do not use them without assessing the risks!
+
+* Fix help text for cipher benchmark specification (mention --cipher option).
+
+* Fix off-by-one error in maximum keyfile size.
+  Allow keyfiles up to compiled-in default and not that value minus one.
+
+* Support resume of interrupted decryption in cryptsetup-reencrypt utility.
+  To resume decryption, LUKS device UUID (--uuid option) option must be used.
+
+* Do not use direct-io for LUKS header with unaligned keyslots.
+  Such headers were used only by the first cryptsetup-luks-1.0.0 release (2005).
+
+* Fix device block size detection to properly work on particular file-based
+  containers over underlying devices with 4k sectors.
diff --git a/docs/v1.7.3-ReleaseNotes b/docs/v1.7.3-ReleaseNotes
new file mode 100644 (file)
index 0000000..4a2757c
--- /dev/null
@@ -0,0 +1,20 @@
+Cryptsetup 1.7.3 Release Notes
+==============================
+
+Changes since version 1.7.2
+
+* Fix device access to hash offsets located beyond the 2GB device boundary in veritysetup.
+
+* Set configured (compile-time) default iteration time for devices created directly through
+  libcryptsetup (default was hardcoded 1 second, the configured value applied only
+  for cryptsetup application).
+
+* Fix PBKDF2 benchmark to not double iteration count for specific corner case.
+  If the measurement function returns exactly 500 ms, the iteration calculation loop
+  doubled iteration count but instead of repeating measurement it used this value directly.
+
+* OpenSSL backend: fix memory leak if hash context was repeatedly reused.
+
+* OpenSSL backend: add support for OpenSSL 1.1.0.
+
+* Fix several minor spelling errors.
diff --git a/docs/v1.7.4-ReleaseNotes b/docs/v1.7.4-ReleaseNotes
new file mode 100644 (file)
index 0000000..73dbaa7
--- /dev/null
@@ -0,0 +1,22 @@
+Cryptsetup 1.7.4 Release Notes
+==============================
+
+Changes since version 1.7.3
+
+* Allow to specify LUKS1 hash algorithm in Python luksFormat wrapper.
+
+* Use LUKS1 compiled-in defaults also in Python wrapper.
+
+* OpenSSL backend: Fix OpenSSL 1.1.0 support without backward compatible API.
+
+* OpenSSL backend: Fix LibreSSL compatibility.
+
+* Check for data device and hash device area overlap in veritysetup.
+
+* Fix a possible race while allocating a free loop device.
+
+* Fix possible file descriptor leaks if libcryptsetup is run from a forked process.
+
+* Fix missing same_cpu_crypt flag in status command.
+
+* Various updates to FAQ and man pages.
diff --git a/docs/v1.7.5-ReleaseNotes b/docs/v1.7.5-ReleaseNotes
new file mode 100644 (file)
index 0000000..eec4315
--- /dev/null
@@ -0,0 +1,22 @@
+Cryptsetup 1.7.5 Release Notes
+==============================
+
+Changes since version 1.7.4
+
+* Fixes to luksFormat to properly support recent kernel running in FIPS mode.
+
+  Cryptsetup must never use a weak key even if it is just used for testing
+  of algorithm availability. In FIPS mode, weak keys are always rejected.
+
+  A weak key is for example detected if the XTS encryption mode use
+  the same key for the tweak and the encryption part.
+
+* Fixes accesses to unaligned hidden legacy TrueCrypt header.
+
+  On a native 4k-sector device the old hidden TrueCrypt header is not
+  aligned with the hw sector size (this problem was fixed in later TrueCrypt
+  on-disk format versions).
+
+  Cryptsetup now properly aligns the read so it does not fail.
+
+* Fixes to optional dracut ramdisk scripts for offline re-encryption on initial boot.
diff --git a/docs/v2.0.0-ReleaseNotes b/docs/v2.0.0-ReleaseNotes
new file mode 100644 (file)
index 0000000..779dcb0
--- /dev/null
@@ -0,0 +1,605 @@
+Cryptsetup 2.0.0 Release Notes
+==============================
+Stable release with experimental features.
+
+This version introduces a new on-disk LUKS2 format.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported
+forever as well as a traditional and fully backward compatible format.
+
+NOTE: This version changes soname of libcryptsetup library and increases
+major version for all public symbols.
+Most of the old functions are fully backward compatible, so only
+recompilation of programs should be needed.
+
+Please note that authenticated disk encryption, non-cryptographic
+data integrity protection (dm-integrity), use of Argon2 Password-Based
+Key Derivation Function and the LUKS2 on-disk format itself are new
+features and can contain some bugs.
+
+To provide all security features of authenticated encryption we need
+better nonce-reuse resistant algorithm in kernel (see note below).
+For now, please use authenticated encryption as experimental feature.
+
+Please do not use LUKS2 without properly configured backup or in
+production systems that need to be compatible with older systems.
+
+Changes since version 2.0.0-RC1
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Limit KDF requested (for format) memory by available physical memory.
+  On some systems too high requested amount of memory causes OOM killer
+  to kill the process (instead of returning ENOMEM).
+  We never try to use more than half of available physical memory.
+
+* Ignore device alignment if it is not multiple of minimal-io.
+  Some USB enclosures seems to report bogus topology info that
+  prevents to use LUKS detached header.
+
+Changes since version 2.0.0-RC0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Enable to use system libargon2 instead of bundled version.
+  Renames --disable-argon2 to --disable-internal-argon2 option
+  and adds --enable-libargon2 flag to allow system libargon2.
+
+* Changes in build system (Automake)
+  - The build system now uses non-recursive automake (except for tests).
+  (Tools binaries are now located in buildroot directory.)
+  - New --disable-cryptsetup option to disable build of cryptsetup tool.
+  - Enable build of cryptsetup-reencrypt by default.
+
+* Install tmpfiles.d configuration for LUKS2 locking directory.
+  You can overwrite this using --with-tmpfilesdir configure option.
+  If your distro does not support tmpfiles.d directory, you have
+  to create locking directory (/run/lock/cryptsetup) in cryptsetup
+  package (or init scripts).
+
+* Adds limited support for offline reencryption of LUKS2 format.
+
+* Decrease size of testing images (and the whole release archive).
+
+* Fixes for several memory leaks found by Valgrind and Coverity tools.
+
+* Fixes for several typos in man pages and error messages.
+
+* LUKS header file in luksFormat is now automatically created
+  if it does not exist.
+
+* Do not allow resize if device size is not aligned to sector size.
+
+Cryptsetup 2.0.0 RC0 Release Notes
+==================================
+
+Important features
+~~~~~~~~~~~~~~~~~~
+
+* New command integritysetup: support for the new dm-integrity kernel target.
+
+  The dm-integrity is a new kernel device-mapper target that introduces
+  software emulation of per-sector integrity fields on the disk sector level.
+  It is available since Linux kernel version 4.12.
+
+  The provided per-sector metadata fields can be used for storing a data
+  integrity checksum (for example CRC32).
+  The dm-integrity implements data journal that enforces atomic update
+  of a sector and its integrity metadata.
+
+  Integritysetup is a CLI utility that can setup standalone dm-integrity
+  devices (that internally check integrity of data).
+
+  Integritysetup is intended to be used for settings that require
+  non-cryptographic data integrity protection with no data encryption.
+  Fo setting integrity protected encrypted devices, see disk authenticated
+  encryption below.
+
+  Note that after formatting the checksums need to be initialized;
+  otherwise device reads will fail because of integrity errors.
+  Integritysetup by default tries to wipe the device with zero blocks
+  to avoid this problem. Device wipe can be time-consuming, you can skip
+  this step by specifying --no-wipe option.
+  (But note that not wiping device can cause some operations to fail
+  if a write is not multiple of page size and kernel page cache tries
+  to read sectors with not yet initialized checksums.)
+
+  The default setting is tag size 4 bytes per-sector and CRC32C protection.
+  To format device with these defaults:
+  $ integritysetup format <device>
+  $ integritysetup open <device> <name>
+
+  Note that used algorithm (unlike tag size) is NOT stored in device
+  kernel superblock and if you use different algorithm, you MUST specify
+  it in every open command, for example:
+  $ integritysetup format <device> --tag-size 32 --integrity sha256
+  $ integritysetup open <device> <name> --integrity sha256
+
+  For more info, see integrity man page.
+
+* Veritysetup command can now format and activate dm-verity devices
+  that contain Forward Error Correction (FEC) (Reed-Solomon code is used).
+  This feature is used on most of Android devices already (available since
+  Linux kernel 4.5).
+
+  There are new options --fec-device, --fec-offset to specify data area
+  with correction code and --fec-roots that set Redd-Solomon generator roots.
+  This setting can be used for format command (veritysetup will calculate
+  and store RS codes) or open command (veritysetup configures kernel
+  dm-verity to use RS codes).
+
+  For more info see veritysetup man page.
+
+* Support for larger sector sizes for crypt devices.
+
+  LUKS2 and plain crypt devices can be now configured with larger encryption
+  sector (typically 4096 bytes, sector size must be the power of two,
+  maximal sector size is 4096 bytes for portability).
+  Large sector size can decrease encryption overhead and can also help
+  with some specific crypto hardware accelerators that perform very
+  badly with 512 bytes sectors.
+
+  Note that if you configure such a larger sector of the device that does use
+  smaller physical sector, there is a possibility of a data corruption during
+  power fail (partial sector writes).
+
+  WARNING: If you use different sector size for a plain device after data were
+  stored,  the decryption will produce garbage.
+
+  For LUKS2, the sector size is stored in metadata and cannot be changed later.
+
+LUKS2 format and features
+~~~~~~~~~~~~~~~~~~~~~~~~~
+The LUKS2 is an on-disk storage format designed to provide simple key
+management, primarily intended for Full Disk Encryption based on dm-crypt.
+
+The LUKS2 is inspired by LUKS1 format and in some specific situations (most
+of the default configurations) can be converted in-place from LUKS1.
+
+The LUKS2 format is designed to allow future updates of various
+parts without the need to modify binary structures and internally
+uses JSON text format for metadata. Compilation now requires the json-c library
+that is used for JSON data processing.
+
+On-disk format provides redundancy of metadata, detection
+of metadata corruption and automatic repair from metadata copy.
+
+NOTE: For security reasons, there is no redundancy in keyslots binary data
+(encrypted keys) but the format allows adding such a feature in future.
+
+NOTE: to operate correctly, LUKS2 requires locking of metadata.
+Locking is performed by using flock() system call for images in file
+and for block device by using a specific lock file in /run/lock/cryptsetup.
+
+This directory must be created by distribution (do not rely on internal
+fallback). For systemd-based distribution, you can simply install
+scripts/cryptsetup.conf into tmpfiles.d directory.
+
+For more details see LUKS2-format.txt and LUKS2-locking.txt in the docs
+directory. (Please note this is just overview, there will be more formal
+documentation later.)
+
+LUKS2 use
+~~~~~~~~~
+
+LUKS2 allows using all possible configurations as LUKS1.
+
+To format device as LUKS2, you have to add "--type luks2" during format:
+
+ $ cryptsetup luksFormat --type luks2 <device>
+
+All commands issued later will recognize the new format automatically.
+
+The newly added features in LUKS2 include:
+
+* Authenticated disk (sector) encryption (EXPERIMENTAL)
+
+  Legacy Full disk encryption (FDE), for example, LUKS1, is a length-preserving
+  encryption (plaintext is the same size as a ciphertext).
+  Such FDE can provide data confidentiality, but cannot provide sound data
+  integrity protection.
+
+  Full disk authenticated encryption is a way how to provide both
+  confidentiality and data integrity protection. Integrity protection here means
+  not only detection of random data corruption (silent data corruption) but also
+  prevention of an unauthorized intentional change of disk sector content.
+
+  NOTE: Integrity protection of this type cannot prevent a replay attack.
+  An attacker can replace the device or its part of the old content, and it
+  cannot be detected.
+  If you need such protection, better use integrity protection on a higher layer.
+
+  For data integrity protection on the sector level, we need additional
+  per-sector metadata space. In LUKS2 this space is provided by a new
+  device-mapper dm-integrity target (available since kernel 4.12).
+  Here the integrity target provides only reliable per-sector metadata store,
+  and the whole authenticated encryption is performed inside dm-crypt stacked
+  over the dm-integrity device.
+
+  For encryption, Authenticated Encryption with Additional Data (AEAD) is used.
+  Every sector is processed as a encryption request of this format:
+
+   |----- AAD -------|------ DATA -------|-- AUTH TAG --|
+   | (authenticated) | (auth+encryption) |              |
+   | sector_LE |  IV |  sector in/out    |  tag in/out  |
+
+  AEAD encrypts the whole sector and also authenticates sector number
+  (to detect sector relocation) and also authenticates Initialization Vector.
+
+  AEAD encryption produces encrypted data and authentication tag.
+  The authenticated tag is then stored in per-sector metadata space provided
+  by dm-integrity.
+
+  Most of the current AEAD algorithms requires IV as a nonce, value that is
+  never reused. Because sector number, as an IV, cannot be used in this
+  environment, we use a new random IV (IV is a random value generated by system
+  RNG on every write). This random IV is then stored in the per-sector metadata
+  as well.
+
+  Because the authentication tag (and IV) requires additional space, the device
+  provided for a user has less capacity. Also, the data journalling means that
+  writes are performed twice, decreasing throughput.
+
+  This integrity protection works better with SSDs. If you want to ignore
+  dm-integrity data journal (because journalling is performed on some higher
+  layer or you just want to trade-off performance to safe recovery), you can
+  switch journal off with --integrity-no-journal option.
+  (This flag can be stored persistently as well.)
+
+  Note that (similar to integritysetup) the device read will fail if
+  authentication tag is not initialized (no previous write).
+  By default cryptsetup run wipe of a device (writing zeroes) to initialize
+  authentication tags. This operation can be very time-consuming.
+  You can skip device wipe using --integrity-no-wipe option.
+
+  To format LUKS2 device with integrity protection, use new --integrity option.
+
+  For now, there are very few AEAD algorithms that can be used, and some
+  of them are known to be problematic. In this release we support only
+  a few of AEAD algorithms (options are for now hard coded), later this
+  extension will be completely algorithm-agnostic.
+
+  For testing of authenticated encryption, these algorithms work for now:
+
+  1) aes-xts-plain64 with hmac-sha256 or hmac-sha512 as the authentication tag.
+     (Common FDE mode + independent authentication tag. Authentication key
+      for HMAC is independently generated. This mode is very slow.)
+     $ cryptsetup luksFormat --type luks2 <device> --cipher aes-xts-plain64 --integrity hmac-sha256
+
+  2) aes-gcm-random (native AEAD mode)
+     DO NOT USE in production! The GCM mode uses only 96-bit nonce,
+     and possible collision means fatal security problem.
+     GCM mode has very good hardware support through AES-NI, so it is useful
+     for performance testing.
+     $ cryptsetup luksFormat --type luks2 <device> --cipher aes-gcm-random --integrity aead
+
+  3) ChaCha20 with Poly1305 authenticator (according to RFC7539)
+     $ cryptsetup luksFormat --type luks2 <device> --cipher chacha20-random --integrity poly1305
+
+  To specify AES128/AES256 just specify proper key size (without possible
+  authentication key). Other symmetric ciphers, like Serpent or Twofish,
+  should work as well. The mode 1) and 2) should be compatible with IEEE 1619.1
+  standard recommendation.
+
+  There will be better suitable authenticated modes available soon
+  For now we are just preparing framework to enable it (and hopefully improve security of FDE).
+
+  FDE authenticated encryption is not a replacement for filesystem layer
+  authenticated encryption. The goal is to provide at least something because
+  data integrity protection is often completely ignored in today systems.
+
+* New memory-hard PBKDF
+
+  LUKS1 introduced Password-Based Key Derivation Function v2 as a tool to
+  increase attacker cost for a dictionary and brute force attacks.
+  The PBKDF2 uses iteration count to increase time of key derivation.
+  Unfortunately, with modern GPUs, the PBKDF2 calculations can be run
+  in parallel and PBKDF2 can no longer provide the best available protection.
+  Increasing iteration count just cannot prevent massive parallel dictionary
+  password attacks in long-term.
+
+  To solve this problem, a new PBKDF, based on so-called memory-hard functions
+  can be used. Key derivation with memory-hard function requires a certain
+  amount of memory to compute its output. The memory requirement is very
+  costly for GPUs and prevents these systems to operate effectively,
+  increasing cost for attackers.
+
+  LUKS2 introduces support for Argon2i and Argon2id as a PBKDF.
+  Argon2 is the winner of Password Hashing Competition and is currently
+  in final RFC draft specification.
+
+  For now, libcryptsetup contains the embedded copy of reference implementation
+  of Argon2 (that is easily portable to all architectures).
+  Later, once this function is available in common crypto libraries, it will
+  switch to external implementation. (This happened for LUKS1 and PBKDF2
+  as well years ago.)
+  With using reference implementation (that is not optimized for speed), there
+  is some performance penalty. However, using memory-hard PBKDF should still
+  significantly complicate GPU-optimized dictionary and brute force attacks.
+
+  The Argon2 uses three costs: memory, time (number of iterations) and parallel
+  (number of threads).
+  Note that time and memory cost highly influences each other (accessing a lot
+  of memory takes more time).
+
+  There is a new benchmark that tries to calculate costs to take similar way as
+  in LUKS1 (where iteration is measured to take 1-2 seconds on user system).
+  Because now there are more cost variables, it prefers time cost (iterations)
+  and tries to find required memory that fits. (IOW required memory cost can be
+  lower if the benchmarks are not able to find required parameters.)
+  The benchmark cannot run too long, so it tries to approximate next step
+  for benchmarking.
+
+  For now, default LUKS2 PBKDF algorithm is Argon2i (data independent variant)
+  with memory cost set to 128MB, time to 800ms and parallel thread according
+  to available CPU cores but no more than 4.
+
+  All default parameters can be set during compile time and also set on
+  the command line by using --pbkdf, --pbkdf-memory, --pbkdf-parallel and
+  --iter-time options.
+  (Or without benchmark directly by using --pbkdf-force-iterations, see below.)
+
+  You can still use PBKDF2 even for LUKS2 by specifying --pbkdf pbkdf2 option.
+  (Then only iteration count is applied.)
+
+* Use of kernel keyring
+
+  Kernel keyring is a storage for sensitive material (like cryptographic keys)
+  inside Linux kernel.
+
+  LUKS2 uses keyring for two major functions:
+
+   - To store volume key for dm-crypt where it avoids sending volume key in
+  every device-mapper ioctl structure. Volume key is also no longer directly
+  visible in a dm-crypt mapping table. The key is not available for the user
+  after dm-crypt configuration (obviously except direct memory scan).
+  Use of kernel keyring can be disabled in runtime by --disable-keyring option.
+
+   - As a tool to automatically unlock LUKS device if a passphrase is put into
+  kernel keyring and proper keyring token is configured.
+
+   This allows storing a secret (passphrase) to kernel per-user keyring by
+  some external tool (for example some TPM handler) and LUKS2, if configured,
+  will automatically search in the keyring and unlock the system.
+  For more info see Tokens section below.
+
+* Persistent flags
+  The activation flags (like allow-discards) can be stored in metadata and used
+  automatically by all later activations (even without using crypttab).
+
+  To store activation flags permanently, use activation command with required
+  flags and add --persistent option.
+
+  For example, to mark device to always activate with TRIM enabled,
+  use (for LUKS2 type):
+
+   $ cryptsetup open <device> <name> --allow-discards --persistent
+
+  You can check persistent flags in dump command output:
+
+  $ cryptsetup luksDump <device>
+
+* Tokens and auto-activation
+
+  A LUKS2 token is an object that can be described "how to get passphrase or key"
+  to unlock particular keyslot.
+  (Also it can be used to store any additional metadata, and with
+  the libcryptsetup interface it can be used to define user token types.)
+
+  Cryptsetup internally implements keyring token. Cryptsetup tries to use
+  available tokens before asking for the passphrase. For keyring token,
+  it means that if the passphrase is available under specified identifier
+  inside kernel keyring, the device is automatically activated using this
+  stored passphrase.
+
+  Example of using LUKS2 keyring token:
+
+  # Adding token to metadata with "my_token" identifier (by default it applies to all keyslots).
+  $ cryptsetup token add --key-description "my_token" <device>
+
+  # Storing passphrase to user keyring (this can be done by an external application)
+  $ echo -n <passphrase> | keyctl padd user my_token @u
+
+  # Now cryptsetup activates automatically if it finds correct passphrase
+  $ cryptsetup open <device> <name>
+
+  The main reason to use tokens this way is to separate possible hardware
+  handlers from cryptsetup code.
+
+* Keyslot priorities
+
+  LUKS2 keyslot can have a new priority attribute.
+  The default is "normal". The "prefer" priority tell the keyslot to be tried
+  before other keyslots. Priority "ignore" means that keyslot will never be
+  used if not specified explicitly (it can be used for backup administrator
+  passwords that are used only situations when a user forgets own passphrase).
+
+  The priority of keyslot can be set with new config command, for example
+  $ cryptsetup config <device> --key-slot 1 --priority prefer
+
+  Setting priority to normal will reset slot to normal state.
+
+* LUKS2 label and subsystem
+
+  The header now contains additional fields for label and subsystem (additional
+  label). These fields can be used similar to filesystem label and will be
+  visible in udev rules to possible filtering. (Note that blkid do not yet
+  contain the LUKS scanning code).
+
+  By default both labels are empty. Label and subsystem are always set together
+  (no option  means clear the label) with the config command:
+
+  $ cryptsetup config <device> --label my_device --subsystem ""
+
+* In-place conversion form LUKS1
+
+  To allow easy testing and transition to the new LUKS2 format, there is a new
+  convert command that allows in-place conversion from the LUKS1 format and,
+  if there are no incompatible options, also conversion back from LUKS2
+  to LUKS1 format.
+
+  Note this command can be used only on some LUKS1 devices (some device header
+  sizes are not supported).
+  This command is dangerous, never run it without header backup!
+  If something fails in the middle of conversion (IO error), the header
+  is destroyed. (Note that conversion requires move of keyslot data area to
+  a different offset.)
+
+  To convert header in-place to LUKS2 format, use
+  $ cryptsetup convert <device> --type luks2
+
+  To convert it back to LUKS1 format, use
+  $ cryptsetup convert <device> --type luks1
+
+  You can verify LUKS version with luksDump command.
+  $ cryptsetup luksDump <device>
+
+  Note that some LUKS2 features will make header incompatible with LUKS1 and
+  conversion will be rejected (for example using new Argon2 PBKDF or integrity
+  extensions). Some minor attributes can be lost in conversion.
+
+Other changes
+~~~~~~~~~~~~~
+
+* Explicit KDF iterations count setting
+
+  With new PBKDF interface, there is also the possibility to setup PBKDF costs
+  directly, avoiding benchmarks. This can be useful if device is formatted to be
+  primarily used on a different system.
+
+  The option --pbkdf-force-iterations is available for both LUKS1 and LUKS2
+  format. Using this option can cause device to have either very low or very
+  high PBKDF costs.
+  In the first case it means bad protection to dictionary attacks, in the second
+  case, it can mean extremely high unlocking time or memory requirements.
+  Use only if you are sure what you are doing!
+
+  Not that this setting also affects iteration count for the key digest.
+  For LUKS1 iteration count for digest will be approximately 1/8 of requested
+  value, for LUKS2 and "pbkdf2" digest minimal PBKDF2 iteration count (1000)
+  will be used. You cannot set lower iteration count than the internal minimum
+  (1000 for PBKDF2).
+
+  To format LUKS1 device with forced iteration count (and no benchmarking), use
+  $ cryptsetup luksFormat <device> --pbkdf-force-iterations 22222
+
+  For LUKS2 it is always better to specify full settings (do not rely on default
+  cost values).
+  For example, we can set to use Argon2id with iteration cost 5, memory 128000
+  and parallel set 1:
+  $ cryptsetup luksFormat --type luks2 <device> \
+    --pbkdf argon2id --pbkdf-force-iterations 5 --pbkdf-memory 128000 --pbkdf-parallel 1
+
+* VeraCrypt PIM
+
+  Cryptsetup can now also open VeraCrypt device that uses Personal Iteration
+  Multiplier (PIM). PIM is an integer value that user must remember additionally
+  to passphrase and influences PBKDF2 iteration count (without it VeraCrypt uses
+  a fixed number of iterations).
+
+  To open VeraCrypt device with PIM settings, use --veracrypt-pim (to specify
+  PIM on the command line) or --veracrypt-query-pim to query PIM interactively.
+
+* Support for plain64be IV
+
+  The plain64be is big-endian variant of plain64 Initialization Vector. It is
+  used in some images of hardware-based disk encryption systems. Supporting this
+  variant allows using dm-crypt to map such images through cryptsetup.
+
+* Deferral removal
+
+  Cryptsetup now can mark device for deferred removal by using a new option
+  --deferred. This means that close command will not fail if the device is still
+  in use, but will instruct the kernel to remove the device automatically after
+  use count drops to zero (for example, once the filesystem is unmounted).
+
+* A lot of updates to man pages and many minor changes that would make this
+  release notes too long ;-)
+
+Libcryptsetup API changes
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+These API functions were removed, libcryptsetup no longer handles password
+retries from terminal (application should handle terminal operations itself):
+       crypt_set_password_callback;
+       crypt_set_timeout;
+       crypt_set_password_retry;
+       crypt_set_password_verify;
+
+This call is removed (no need to keep typo backward compatibility,
+the proper function is crypt_set_iteration_time :-)
+       crypt_set_iterarion_time;
+
+These calls were removed because are not safe, use per-context
+error callbacks instead:
+       crypt_last_error;
+       crypt_get_error;
+
+The PBKDF benchmark was replaced by a new function that uses new KDF structure
+       crypt_benchmark_kdf; (removed)
+       crypt_benchmark_pbkdf; (new API call)
+
+These new calls are now exported, for details see libcryptsetup.h:
+       crypt_keyslot_add_by_key;
+       crypt_keyslot_set_priority;
+       crypt_keyslot_get_priority;
+
+       crypt_token_json_get;
+       crypt_token_json_set;
+       crypt_token_status;
+       crypt_token_luks2_keyring_get;
+       crypt_token_luks2_keyring_set;
+       crypt_token_assign_keyslot;
+       crypt_token_unassign_keyslot;
+       crypt_token_register;
+
+       crypt_activate_by_token;
+       crypt_activate_by_keyring;
+       crypt_deactivate_by_name;
+
+       crypt_metadata_locking;
+       crypt_volume_key_keyring;
+       crypt_get_integrity_info;
+       crypt_get_sector_size;
+       crypt_persistent_flags_set;
+       crypt_persistent_flags_get;
+       crypt_set_pbkdf_type;
+       crypt_get_pbkdf_type;
+
+       crypt_convert;
+       crypt_keyfile_read;
+       crypt_wipe;
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* There will be better documentation and examples.
+
+* There will be some more formal definition of the threat model for integrity
+  protection. (And a link to some papers discussing integrity protection,
+  once it is, hopefully, accepted and published.)
+
+* Offline re-encrypt tool LUKS2 support is currently limited.
+  There will be online LUKS2 re-encryption tool in future.
+
+* Authenticated encryption will use new algorithms from CAESAR competition
+  (https://competitions.cr.yp.to/caesar.html) once these algorithms are available
+  in kernel (more on this later).
+  NOTE: Currently available authenticated modes (GCM, Chacha20-poly1305)
+  in kernel have too small 96-bit nonces that are problematic with
+  randomly generated IVs (the collison probability is not negligible).
+  For the GCM, nonce collision is a fatal problem.
+
+* Authenticated encryption do not set encryption for dm-integrity journal.
+
+  While it does not influence data confidentiality or integrity protection,
+  an attacker can get some more information from data journal or cause that
+  system will corrupt sectors after journal replay. (That corruption will be
+  detected though.)
+
+* Some utilities (blkid, systemd-cryptsetup) have already support for LUKS
+  but not yet in released version (support in crypttab etc).
+
+* There are some examples of user-defined tokens inside misc/luks2_keyslot_example
+  directory (like a simple external program that uses libssh to unlock LUKS2
+  using remote keyfile).
+
+* The python binding (pycryptsetup) contains only basic functionality for LUKS1
+  (it is not updated for new features) and will be deprecated soon in favor
+  of python bindings to libblockdev library (that can already handle LUKS1 devices).
diff --git a/docs/v2.0.1-ReleaseNotes b/docs/v2.0.1-ReleaseNotes
new file mode 100644 (file)
index 0000000..0cc13b9
--- /dev/null
@@ -0,0 +1,109 @@
+Cryptsetup 2.0.1 Release Notes
+==============================
+Stable and bug-fix release with experimental features.
+
+This version introduces a new on-disk LUKS2 format.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported
+forever as well as a traditional and fully backward compatible format.
+
+Please note that authenticated disk encryption, non-cryptographic
+data integrity protection (dm-integrity), use of Argon2 Password-Based
+Key Derivation Function and the LUKS2 on-disk format itself are new
+features and can contain some bugs.
+
+To provide all security features of authenticated encryption we need
+a better nonce-reuse resistant algorithm in the kernel (see note below).
+For now, please use authenticated encryption as an experimental feature.
+
+Please do not use LUKS2 without properly configured backup or in
+production systems that need to be compatible with older systems.
+
+Changes since version 2.0.0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* To store volume key into kernel keyring, kernel 4.15 with dm-crypt 1.18.1
+  is required. If a volume key is stored in keyring (LUKS2 only),
+  the dm-crypt v1.15.0 through v1.18.0 contains a serious bug that may cause
+  data corruption for ciphers with ESSIV.
+  (The key for ESSIV is zeroed because of code misplacement.)
+  This bug is not present for LUKS1 or any other IVs used in LUKS modes.
+  This change is not visible to the user (except dmsetup output).
+
+* Increase maximum allowed PBKDF memory-cost limit to 4 GiB.
+  The Argon2 PBKDF uses 1GiB by default; this is also limited by the amount
+  of physical memory available (maximum is half of the physical memory).
+
+* Use /run/cryptsetup as default for cryptsetup locking dir.
+  There were problems with sharing /run/lock with lockdev, and in the early
+  boot, the directory was missing.
+  The directory can be changed with --with-luks2-lock-path and
+  --with-luks2-lock-dir-perms configure switches.
+
+* Introduce new 64-bit byte-offset *keyfile_device_offset functions.
+
+  The keyfile interface was designed, well, for keyfiles. Unfortunately,
+  there are user cases where a keyfile can be placed on a device, and
+  size_t offset can overflow on 32-bit systems.
+
+  New set of functions that allow 64-bit offsets even on 32bit systems
+  are now available:
+
+     - crypt_resume_by_keyfile_device_offset
+     - crypt_keyslot_add_by_keyfile_device_offset
+     - crypt_activate_by_keyfile_device_offset
+     - crypt_keyfile_device_read
+
+  The new functions have added the _device_ in name.
+  Old functions are just internal wrappers around these.
+
+  Also cryptsetup --keyfile-offset and --new-keyfile-offset now allows
+  64-bit offsets as parameters.
+
+* Add error hint for wrongly formatted cipher strings in LUKS1 and
+  properly fail in luksFormat if cipher format is missing required IV.
+  For now, crypto API quietly used cipher without IV if a cipher
+  algorithm without IV specification was used (e.g., aes-xts).
+  This caused fail later during activation.
+
+* Configure check for a recent Argon2 lib to support mandatory Argon2id.
+
+* Fix for the cryptsetup-reencrypt static build if pwquality is enabled.
+
+* Update LUKS1 standard doc (https links in the bibliography).
+
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* There will be better documentation and examples.
+
+* There will be some more formal definition of the threat model for integrity
+  protection. (And a link to some papers discussing integrity protection,
+  once it is, hopefully, accepted and published.)
+
+* Offline re-encrypt tool LUKS2 support is currently limited.
+  There will be online LUKS2 re-encryption tool in future.
+
+* Authenticated encryption will use new algorithms from CAESAR competition
+  (https://competitions.cr.yp.to/caesar.html) once these algorithms are
+  available in the kernel (more on this later).
+  NOTE: Currently available authenticated modes (GCM, Chacha20-poly1305)
+  in the kernel have too small 96-bit nonces that are problematic with
+  randomly generated IVs (the collision probability is not negligible).
+  For the GCM, nonce collision is a fatal problem.
+
+* Authenticated encryption do not set encryption for a dm-integrity journal.
+
+  While it does not influence data confidentiality or integrity protection,
+  an attacker can get some more information from data journal or cause that
+  system will corrupt sectors after journal replay. (That corruption will be
+  detected though.)
+
+* There are examples of user-defined tokens inside misc/luks2_keyslot_example
+  directory (like a simple external program that uses libssh to unlock LUKS2
+  using remote keyfile).
+
+* The python binding (pycryptsetup) contains only basic functionality for LUKS1
+  (it is not updated for new features) and will be deprecated soon in favor
+  of python bindings to the libblockdev library (that can already handle LUKS1
+  devices).
diff --git a/docs/v2.0.2-ReleaseNotes b/docs/v2.0.2-ReleaseNotes
new file mode 100644 (file)
index 0000000..a85a248
--- /dev/null
@@ -0,0 +1,93 @@
+Cryptsetup 2.0.2 Release Notes
+==============================
+Stable and bug-fix release with experimental features.
+
+Cryptsetup 2.x version introduces a new on-disk LUKS2 format.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported
+forever as well as a traditional and fully backward compatible format.
+
+Please note that authenticated disk encryption, non-cryptographic
+data integrity protection (dm-integrity), use of Argon2 Password-Based
+Key Derivation Function and the LUKS2 on-disk format itself are new
+features and can contain some bugs.
+
+To provide all security features of authenticated encryption, we need
+a better nonce-reuse resistant algorithm in the kernel (see note below).
+For now, please use authenticated encryption as an experimental feature.
+
+Please do not use LUKS2 without properly configured backup or in
+production systems that need to be compatible with older systems.
+
+Changes since version 2.0.1
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Fix a regression in early detection of inactive keyslot for luksKillSlot.
+  It tried to ask for passphrase even for already erased keyslot.
+
+* Fix a regression in loopaesOpen processing for keyfile on standard input.
+  Use of "-" argument was not working properly.
+
+* Add LUKS2 specific options for cryptsetup-reencrypt.
+  Tokens and persistent flags are now transferred during reencryption;
+  change of PBKDF keyslot parameters is now supported and allows
+  to set precalculated values (no benchmarks).
+
+* Do not allow LUKS2 --persistent and --test-passphrase cryptsetup flags
+  combination. Persistent flags are now stored only if the device was
+  successfully activated with the specified flags.
+
+* Fix integritysetup format after recent Linux kernel changes that
+  requires to setup key for HMAC in all cases.
+  Previously integritysetup allowed HMAC with zero key that behaves
+  like a plain hash.
+
+* Fix VeraCrypt PIM handling that modified internal iteration counts
+  even for subsequent activations. The PIM count is no longer printed
+  in debug log as it is sensitive information.
+  Also, the code now skips legacy TrueCrypt algorithms if a PIM
+  is specified (they cannot be used with PIM anyway).
+
+* PBKDF values cannot be set (even with force parameters) below
+  hardcoded minimums. For PBKDF2 is it 1000 iterations, for Argon2
+  it is 4 iterations and 32 KiB of memory cost.
+
+* Introduce new crypt_token_is_assigned() API function for reporting
+  the binding between token and keyslots.
+
+* Allow crypt_token_json_set() API function to create internal token types.
+  Do not allow unknown fields in internal token objects.
+
+* Print message in cryptsetup that about was aborted if a user did not
+  answer YES in a query.
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* There will be better documentation and examples.
+
+* There will be some more formal definition of the threat model for integrity
+  protection. (And a link to some papers discussing integrity protection,
+  once it is, hopefully, accepted and published.)
+
+* Authenticated encryption will use new algorithms from CAESAR competition
+  https://competitions.cr.yp.to/caesar-submissions.html.
+  We plan to use AEGIS and MORUS, as CAESAR finalists.
+
+  NOTE: Currently available authenticated modes (GCM, Chacha20-poly1305)
+  in the kernel have too small 96-bit nonces that are problematic with
+  randomly generated IVs (the collision probability is not negligible).
+
+* Authenticated encryption do not set encryption for a dm-integrity journal.
+
+  While it does not influence data confidentiality or integrity protection,
+  an attacker can get some more information from data journal or cause that
+  system will corrupt sectors after journal replay. (That corruption will be
+  detected though.)
+
+* There are examples of user-defined tokens inside misc/luks2_keyslot_example
+  directory (like a simple external program that uses libssh to unlock LUKS2
+  using remote keyfile).
+
+* The python binding (pycryptsetup) contains only basic functionality for LUKS1
+  (it is not updated for new features) and will be deprecated in version 2.1
+  in favor of python bindings to the libblockdev library.
diff --git a/docs/v2.0.3-ReleaseNotes b/docs/v2.0.3-ReleaseNotes
new file mode 100644 (file)
index 0000000..030a1b4
--- /dev/null
@@ -0,0 +1,121 @@
+Cryptsetup 2.0.3 Release Notes
+==============================
+Stable bug-fix release with new features.
+
+Cryptsetup 2.x version introduces a new on-disk LUKS2 format.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported
+forever as well as a traditional and fully backward compatible format.
+
+Please note that authenticated disk encryption, non-cryptographic
+data integrity protection (dm-integrity), use of Argon2 Password-Based
+Key Derivation Function and the LUKS2 on-disk format itself are new
+features and can contain some bugs.
+
+To provide all security features of authenticated encryption, we need
+a better nonce-reuse resistant algorithm in the kernel (see note below).
+For now, please use authenticated encryption as an experimental feature.
+
+Please do not use LUKS2 without properly configured backup or in
+production systems that need to be compatible with older systems.
+
+Changes since version 2.0.2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Expose interface to unbound LUKS2 keyslots.
+  Unbound LUKS2 keyslot allows storing a key material that is independent
+  of master volume key (it is not bound to encrypted data segment).
+
+* New API extensions for unbound keyslots (LUKS2 only)
+  crypt_keyslot_get_key_size() and crypt_volume_key_get()
+  These functions allow to get key and key size for unbound keyslots.
+
+* New enum value CRYPT_SLOT_UNBOUND for keyslot status (LUKS2 only).
+
+* Add --unbound keyslot option to the cryptsetup luksAddKey command.
+
+* Add crypt_get_active_integrity_failures() call to get integrity
+  failure count for dm-integrity devices.
+
+* Add crypt_get_pbkdf_default() function to get per-type PBKDF default
+  setting.
+
+* Add new flag to crypt_keyslot_add_by_key() to force update device
+  volume key. This call is mainly intended for a wrapped key change.
+
+* Allow volume key store in a file with cryptsetup.
+  The --dump-master-key together with --master-key-file allows cryptsetup
+  to store the binary volume key to a file instead of standard output.
+
+* Add support detached header for cryptsetup-reencrypt command.
+
+* Fix VeraCrypt PIM handling - use proper iterations count formula
+  for PBKDF2-SHA512 and PBKDF2-Whirlpool used in system volumes.
+
+* Fix cryptsetup tcryptDump for VeraCrypt PIM (support --veracrypt-pim).
+
+* Add --with-default-luks-format configure time option.
+  (Option to override default LUKS format version.)
+
+* Fix LUKS version conversion for detached (and trimmed) LUKS headers.
+
+* Add luksConvertKey cryptsetup command that converts specific keyslot
+  from one PBKDF to another.
+
+* Do not allow conversion to LUKS2 if LUKSMETA (external tool metadata)
+  header is detected.
+
+* More cleanup and hardening of LUKS2 keyslot specific validation options.
+  Add more checks for cipher validity before writing metadata on-disk.
+
+* Do not allow LUKS1 version downconversion if the header contains tokens.
+
+* Add "paes" family ciphers (AES wrapped key scheme for mainframes)
+  to allowed ciphers.
+  Specific wrapped ley configuration logic must be done by 3rd party tool,
+  LUKS2 stores only keyslot material and allow activation of the device.
+
+* Add support for --check-at-most-once option (kernel 4.17) to veritysetup.
+  This flag can be dangerous; if you can control underlying device
+  (you can change its content after it was verified) it will no longer
+  prevent reading tampered data and also it does not prevent silent
+  data corruptions that appear after the block was once read.
+
+* Fix return code (EPERM instead of EINVAL) and retry count for bad
+  passphrase on non-tty input.
+
+* Enable support for FEC decoding in veritysetup to check dm-verity devices
+  with additional Reed-Solomon code in userspace (verify command).
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* There will be better documentation and examples (planned for 2.0.4).
+
+* There will be some more formal definition of the threat model for integrity
+  protection. (And a link to some papers discussing integrity protection,
+  once it is, hopefully, accepted and published.)
+
+* Authenticated encryption will use new algorithms from CAESAR competition
+  https://competitions.cr.yp.to/caesar-submissions.html.
+  We plan to use AEGIS and MORUS, as CAESAR finalists.
+
+  NOTE: Currently available authenticated modes (GCM, Chacha20-poly1305)
+  in the kernel have too small 96-bit nonces that are problematic with
+  randomly generated IVs (the collision probability is not negligible).
+
+* Authenticated encryption do not set encryption for a dm-integrity journal.
+
+  While it does not influence data confidentiality or integrity protection,
+  an attacker can get some more information from data journal or cause that
+  system will corrupt sectors after journal replay. (That corruption will be
+  detected though.)
+
+* There are examples of user-defined tokens inside misc/luks2_keyslot_example
+  directory (like a simple external program that uses libssh to unlock LUKS2
+  using remote keyfile).
+
+* The python binding (pycryptsetup) contains only basic functionality for LUKS1
+  (it is not updated for new features) and will be REMOVED in version 2.1
+  in favor of python bindings to the libblockdev library.
+  See https://github.com/storaged-project/libblockdev/releases/tag/2.17-1 that
+  already supports LUKS2 and VeraCrypt devices handling through libcryptsetup.
diff --git a/docs/v2.0.4-ReleaseNotes b/docs/v2.0.4-ReleaseNotes
new file mode 100644 (file)
index 0000000..9731f59
--- /dev/null
@@ -0,0 +1,119 @@
+Cryptsetup 2.0.4 Release Notes
+==============================
+Stable bug-fix release with new features.
+
+Cryptsetup 2.x version introduces a new on-disk LUKS2 format.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported
+forever as well as a traditional and fully backward compatible format.
+
+Please note that authenticated disk encryption, non-cryptographic
+data integrity protection (dm-integrity), use of Argon2 Password-Based
+Key Derivation Function and the LUKS2 on-disk format itself are new
+features and can contain some bugs.
+
+To provide all security features of authenticated encryption, we need
+a better nonce-reuse resistant algorithm in the kernel (see note below).
+For now, please use authenticated encryption as an experimental feature.
+
+Please do not use LUKS2 without properly configured backup or in
+production systems that need to be compatible with older systems.
+
+Changes since version 2.0.3
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Use the libblkid (blockid) library to detect foreign signatures
+  on a device before LUKS format and LUKS2 auto-recovery.
+
+  This change fixes an unexpected recovery using the secondary
+  LUKS2 header after a device was already overwritten with
+  another format (filesystem or LVM physical volume).
+
+  LUKS2 will not recreate a primary header if it detects a valid
+  foreign signature. In this situation, a user must always
+  use cryptsetup repair command for the recovery.
+
+  Note that libcryptsetup and utilities are now linked to libblkid
+  as a new dependence.
+
+  To compile code without blockid support (strongly discouraged),
+  use --disable-blkid configure switch.
+
+* Add prompt for format and repair actions in cryptsetup and
+  integritysetup if foreign signatures are detected on the device
+  through the blockid library.
+
+  After the confirmation, all known signatures are then wiped as
+  part of the format or repair procedure.
+
+* Print consistent verbose message about keyslot and token numbers.
+  For keyslot actions: Key slot <number> unlocked/created/removed.
+  For token actions: Token <number> created/removed.
+
+* Print error, if a non-existent token is tried to be removed.
+
+* Add support for LUKS2 token definition export and import.
+
+  The token command now can export/import customized token JSON file
+  directly from command line. See the man page for more details.
+
+* Add support for new dm-integrity superblock version 2.
+
+* Add an error message when nothing was read from a key file.
+
+* Update cryptsetup man pages, including --type option usage.
+
+* Add a snapshot of LUKS2 format specification to documentation
+  and accordingly fix supported secondary header offsets.
+
+* Add bundled optimized Argon2 SSE (X86_64 platform) code.
+
+  If the bundled Argon2 code is used and the new configure switch
+  --enable-internal-sse-argon2 option is present, and compiler flags
+  support required optimization, the code will try to use optimized
+  and faster variant.
+
+  Always use the shared library (--enable-libargon2) if possible.
+
+  This option was added because an enterprise distribution
+  rejected to support the shared Argon2 library and native support
+  in generic cryptographic libraries is not ready yet.
+
+* Fix compilation with crypto backend for LibreSSL >= 2.7.0.
+  LibreSSL introduced OpenSSL 1.1.x API functions, so compatibility
+  wrapper must be commented out.
+
+* Fix on-disk header size calculation for LUKS2 format if a specific
+  data alignment is requested. Until now, the code used default size
+  that could be wrong for converted devices.
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Authenticated encryption will use new algorithms from CAESAR competition
+  https://competitions.cr.yp.to/caesar-submissions.html.
+  We plan to use AEGIS and MORUS (in kernel 4.18), as CAESAR finalists.
+
+  NOTE: Currently available authenticated modes (GCM, Chacha20-poly1305)
+  in the kernel have too small 96-bit nonces that are problematic with
+  randomly generated IVs (the collision probability is not negligible).
+
+  For more info about LUKS2 authenticated encryption, please see our paper
+  https://arxiv.org/abs/1807.00309
+
+* Authenticated encryption do not set encryption for a dm-integrity journal.
+
+  While it does not influence data confidentiality or integrity protection,
+  an attacker can get some more information from data journal or cause that
+  system will corrupt sectors after journal replay. (That corruption will be
+  detected though.)
+
+* There are examples of user-defined tokens inside misc/luks2_keyslot_example
+  directory (like a simple external program that uses libssh to unlock LUKS2
+  using remote keyfile).
+
+* The python binding (pycryptsetup) contains only basic functionality for LUKS1
+  (it is not updated for new features) and will be REMOVED in version 2.1
+  in favor of python bindings to the libblockdev library.
+  See https://github.com/storaged-project/libblockdev/releases that
+  already supports LUKS2 and VeraCrypt devices handling through libcryptsetup.
+
diff --git a/docs/v2.0.5-ReleaseNotes b/docs/v2.0.5-ReleaseNotes
new file mode 100644 (file)
index 0000000..907d5aa
--- /dev/null
@@ -0,0 +1,102 @@
+Cryptsetup 2.0.5 Release Notes
+==============================
+Stable bug-fix release with new features.
+
+Cryptsetup 2.x version introduces a new on-disk LUKS2 format.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported
+forever as well as a traditional and fully backward compatible format.
+
+Please note that authenticated disk encryption, non-cryptographic
+data integrity protection (dm-integrity), use of Argon2 Password-Based
+Key Derivation Function and the LUKS2 on-disk format itself are new
+features and can contain some bugs.
+
+Please do not use LUKS2 without properly configured backup or in
+production systems that need to be compatible with older systems.
+
+Changes since version 2.0.4
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Wipe full header areas (including unused) during LUKS format.
+
+  Since this version, the whole area up to the data offset is zeroed,
+  and subsequently, all keyslots areas are wiped with random data.
+  This ensures that no remaining old data remains in the LUKS header
+  areas, but it could slow down format operation on some devices.
+  Previously only first 4k (or 32k for LUKS2) and the used keyslot
+  was overwritten in the format operation.
+
+* Several fixes to error messages that were unintentionally replaced
+  in previous versions with a silent exit code.
+  More descriptive error messages were added, including error
+  messages if
+   - a device is unusable (not a block device, no access, etc.),
+   - a LUKS device is not detected,
+   - LUKS header load code detects unsupported version,
+   - a keyslot decryption fails (also happens in the cipher check),
+   - converting an inactive keyslot.
+
+* Device activation fails if data area overlaps with LUKS header.
+
+* Code now uses explicit_bzero to wipe memory if available
+  (instead of own implementation).
+
+* Additional VeraCrypt modes are now supported, including Camellia
+  and Kuznyechik symmetric ciphers (and cipher chains) and Streebog
+  hash function. These were introduced in a recent VeraCrypt upstream.
+
+  Note that Kuznyechik requires out-of-tree kernel module and
+  Streebog hash function is available only with the gcrypt cryptographic
+  backend for now.
+
+* Fixes static build for integritysetup if the pwquality library is used.
+
+* Allows passphrase change for unbound keyslots.
+
+* Fixes removed keyslot number in verbose message for luksKillSlot,
+  luksRemoveKey and erase command.
+
+* Adds blkid scan when attempting to open a plain device and warn the user
+  about existing device signatures in a ciphertext device.
+
+* Remove LUKS header signature if luksFormat fails to add the first keyslot.
+
+* Remove O_SYNC from device open and use fsync() to speed up
+  wipe operation considerably.
+
+* Create --master-key-file in luksDump and fail if the file already exists.
+
+* Fixes a bug when LUKS2 authenticated encryption with a detached header
+  wiped the header device instead of dm-integrity data device area (causing
+  unnecessary LUKS2 header auto recovery).
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Authenticated encryption should use new algorithms from CAESAR competition
+  https://competitions.cr.yp.to/caesar-submissions.html.
+  AEGIS and MORUS are already available in kernel 4.18.
+
+  For more info about LUKS2 authenticated encryption, please see our paper
+  https://arxiv.org/abs/1807.00309
+
+  Please note that authenticated encryption is still an experimental feature
+  and can have performance problems for hish-speed devices and device
+  with larger IO blocks (like RAID).
+
+* Authenticated encryption do not set encryption for a dm-integrity journal.
+
+  While it does not influence data confidentiality or integrity protection,
+  an attacker can get some more information from data journal or cause that
+  system will corrupt sectors after journal replay. (That corruption will be
+  detected though.)
+
+* There are examples of user-defined tokens inside misc/luks2_keyslot_example
+  directory (like a simple external program that uses libssh to unlock LUKS2
+  using remote keyfile).
+
+* The python binding (pycryptsetup) contains only basic functionality for LUKS1
+  (it is not updated for new features) and will be REMOVED in version 2.1
+  in favor of python bindings to the libblockdev library.
+  See https://github.com/storaged-project/libblockdev/releases that
+  already supports LUKS2 and VeraCrypt devices handling through libcryptsetup.
diff --git a/docs/v2.0.6-ReleaseNotes b/docs/v2.0.6-ReleaseNotes
new file mode 100644 (file)
index 0000000..7fe276a
--- /dev/null
@@ -0,0 +1,97 @@
+Cryptsetup 2.0.6 Release Notes
+==============================
+Stable bug-fix release.
+All users of cryptsetup 2.0.x should upgrade to this version.
+
+Cryptsetup 2.x version introduces a new on-disk LUKS2 format.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported
+forever as well as a traditional and fully backward compatible format.
+
+Please note that authenticated disk encryption, non-cryptographic
+data integrity protection (dm-integrity), use of Argon2 Password-Based
+Key Derivation Function and the LUKS2 on-disk format itself are new
+features and can contain some bugs.
+
+Please do not use LUKS2 without properly configured backup or in
+production systems that need to be compatible with older systems.
+
+Changes since version 2.0.5
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Fix support of larger metadata areas in LUKS2 header.
+
+  This release properly supports all specified metadata areas, as documented
+  in LUKS2 format description (see docs/on-disk-format-luks2.pdf in archive).
+
+  Currently, only default metadata area size is used (in format or convert).
+  Later cryptsetup versions will allow increasing this metadata area size.
+
+* If AEAD (authenticated encryption) is used, cryptsetup now tries to check
+  if the requested AEAD algorithm with specified key size is available
+  in kernel crypto API.
+  This change avoids formatting a device that cannot be later activated.
+
+  For this function, the kernel must be compiled with the
+  CONFIG_CRYPTO_USER_API_AEAD option enabled.
+  Note that kernel user crypto API options (CONFIG_CRYPTO_USER_API and
+  CONFIG_CRYPTO_USER_API_SKCIPHER) are already mandatory for LUKS2.
+
+* Fix setting of integrity no-journal flag.
+  Now you can store this flag to metadata using --persistent option.
+
+* Fix cryptsetup-reencrypt to not keep temporary reencryption headers
+  if interrupted during initial password prompt.
+
+* Adds early check to plain and LUKS2 formats to disallow device format
+  if device size is not aligned to requested sector size.
+  Previously it was possible, and the device was rejected to activate by
+  kernel later.
+
+* Fix checking of hash algorithms availability for PBKDF early.
+  Previously LUKS2 format allowed non-existent hash algorithm with
+  invalid keyslot preventing the device from activation.
+
+* Allow Adiantum cipher construction (a non-authenticated length-preserving
+  fast encryption scheme), so it can be used both for data encryption and
+  keyslot encryption in LUKS1/2 devices.
+
+  For benchmark, use:
+    # cryptsetup benchmark -c xchacha12,aes-adiantum
+    # cryptsetup benchmark -c xchacha20,aes-adiantum
+
+  For LUKS format:
+    # cryptsetup luksFormat -c xchacha20,aes-adiantum-plain64 -s 256 <device>
+
+  The support for Adiantum will be merged in Linux kernel 4.21.
+  For more info see the paper https://eprint.iacr.org/2018/720.
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Authenticated encryption should use new algorithms from CAESAR competition
+  https://competitions.cr.yp.to/caesar-submissions.html.
+  AEGIS and MORUS are already available in kernel 4.18.
+
+  For more info about LUKS2 authenticated encryption, please see our paper
+  https://arxiv.org/abs/1807.00309
+
+  Please note that authenticated encryption is still an experimental feature
+  and can have performance problems for high-speed devices and device
+  with larger IO blocks (like RAID).
+
+* Authenticated encryption do not set encryption for a dm-integrity journal.
+
+  While it does not influence data confidentiality or integrity protection,
+  an attacker can get some more information from data journal or cause that
+  system will corrupt sectors after journal replay. (That corruption will be
+  detected though.)
+
+* There are examples of user-defined tokens inside misc/luks2_keyslot_example
+  directory (like a simple external program that uses libssh to unlock LUKS2
+  using remote keyfile).
+
+* The python binding (pycryptsetup) contains only basic functionality for LUKS1
+  (it is not updated for new features) and will be REMOVED in version 2.1
+  in favor of python bindings to the libblockdev library.
+  See https://github.com/storaged-project/libblockdev/releases that
+  already supports LUKS2 and VeraCrypt devices handling through libcryptsetup.
diff --git a/docs/v2.1.0-ReleaseNotes b/docs/v2.1.0-ReleaseNotes
new file mode 100644 (file)
index 0000000..36d2247
--- /dev/null
@@ -0,0 +1,210 @@
+Cryptsetup 2.1.0 Release Notes
+==============================
+Stable release with new features and bug fixes.
+
+Cryptsetup 2.1 version uses a new on-disk LUKS2 format as the default
+LUKS format and increases default LUKS2 header size.
+
+The legacy LUKS (referenced as LUKS1) will be fully supported forever
+as well as a traditional and fully backward compatible format.
+
+When upgrading a stable distribution, please use configure option
+--with-default-luks-format=LUKS1 to maintain backward compatibility.
+
+This release also switches to OpenSSL as a default cryptographic
+backend for LUKS header processing. Use --with-crypto_backend=gcrypt
+configure option if you need to preserve legacy libgcrypt backend.
+
+Please do not use LUKS2 without properly configured backup or
+in production systems that need to be compatible with older systems.
+
+Changes since version 2.0.6
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* The default for cryptsetup LUKS format action is now LUKS2.
+  You can use LUKS1 with cryptsetup option --type luks1.
+
+* The default size of the LUKS2 header is increased to 16 MB.
+  It includes metadata and the area used for binary keyslots;
+  it means that LUKS header backup is now 16MB in size.
+
+  Note, that used keyslot area is much smaller, but this increase
+  of reserved space allows implementation of later extensions
+  (like online reencryption).
+  It is fully compatible with older cryptsetup 2.0.x versions.
+  If you require to create LUKS2 header with the same size as
+  in the 2.0.x version, use --offset 8192 option for luksFormat
+  (units are in 512-bytes sectors; see notes below).
+
+* Cryptsetup now doubles LUKS default key size if XTS mode is used
+  (XTS mode uses two internal keys). This does not apply if key size
+  is explicitly specified on the command line and it does not apply
+  for the plain mode.
+  This fixes a confusion with AES and 256bit key in XTS mode where
+  code used AES128 and not AES256 as often expected.
+
+  Also, the default keyslot encryption algorithm (if cannot be derived
+  from data encryption algorithm) is now available as configure
+  options --with-luks2-keyslot-cipher and --with-luks2-keyslot-keybits.
+  The default is aes-xts-plain64 with 2 * 256-bits key.
+
+* Default cryptographic backend used for LUKS header processing is now
+  OpenSSL. For years, OpenSSL provided better performance for PBKDF.
+
+  NOTE: Cryptsetup/libcryptsetup supports several cryptographic
+  library backends. The fully supported are libgcrypt, OpenSSL and
+  kernel crypto API. FIPS mode extensions are maintained only for
+  libgcrypt and OpenSSL. Nettle and NSS are usable only for some
+  subset of algorithms and cannot provide full backward compatibility.
+  You can always switch to other backends by using a configure switch,
+  for libgcrypt (compatibility for older distributions) use:
+  --with-crypto_backend=gcrypt
+
+* The Python bindings are no longer supported and the code was removed
+  from cryptsetup distribution. Please use the libblockdev project
+  that already covers most of the libcryptsetup functionality
+  including LUKS2.
+
+* Cryptsetup now allows using --offset option also for luksFormat.
+  It means that the specified offset value is used for data offset.
+  LUKS2 header areas are automatically adjusted according to this value.
+  (Note units are in 512-byte sectors due to the previous definition
+  of this option in plain mode.)
+  This option can replace --align-payload with absolute alignment value.
+
+* Cryptsetup now supports new refresh action (that is the alias for
+  "open --refresh").
+  It allows changes of parameters for an active device (like root
+  device mapping), for example, it can enable or disable TRIM support
+  on-the-fly.
+  It is supported for LUKS1, LUKS2, plain and loop-AES devices.
+
+* Integritysetup now supports mode with detached data device through
+  new --data-device option.
+  Since kernel 4.18 there is a possibility to specify external data
+  device for dm-integrity that stores all integrity tags.
+
+* Integritysetup now supports automatic integrity recalculation
+  through new --integrity-recalculate option.
+  Linux kernel since version 4.18 supports automatic background
+  recalculation of integrity tags for dm-integrity.
+
+Other changes and fixes
+~~~~~~~~~~~~~~~~~~~~~~~
+
+* Fix for crypt_wipe call to allocate space if the header is backed
+  by a file. This means that if you use detached header file, it will
+  now have always the full size after luksFormat, even if only
+  a few keyslots are used.
+
+* Fixes to offline cryptsetup-reencrypt to preserve LUKS2 keyslots
+  area sizes after reencryption and fixes for some other issues when
+  creating temporary reencryption headers.
+
+* Added some FIPS mode workarounds. We cannot (yet) use Argon2 in
+  FIPS mode, libcryptsetup now fallbacks to use PBKDF2 in FIPS mode.
+
+* Rejects conversion to LUKS1 if PBKDF2 hash algorithms
+  in keyslots differ.
+
+* The hash setting on command line now applies also to LUKS2 PBKDF2
+  digest. In previous versions, the LUKS2 key digest used PBKDF2-SHA256
+  (except for converted headers).
+
+* Allow LUKS2 keyslots area to increase if data offset allows it.
+  Cryptsetup can fine-tune LUKS2 metadata area sizes through
+  --luks2-metadata-size=BYTES and --luks2-keyslots-size=BYTES.
+  Please DO NOT use these low-level options until you need it for
+  some very specific additional feature.
+  Also, the code now prints these LUKS2 header area sizes in dump
+  command.
+
+* For LUKS2, keyslot can use different encryption that data with
+  new options --keyslot-key-size=BITS and --keyslot-cipher=STRING
+  in all commands that create new LUKS keyslot.
+  Please DO NOT use these low-level options until you need it for
+  some very specific additional feature.
+
+* Code now avoids data flush when reading device status through
+  device-mapper.
+
+* The Nettle crypto backend and the userspace kernel crypto API
+  backend were enhanced to allow more available hash functions
+  (like SHA3 variants).
+
+* Upstream code now does not require libgcrypt-devel
+  for autoconfigure, because OpenSSL is the default.
+  The libgcrypt does not use standard pkgconfig detection and
+  requires specific macro (part of libgcrypt development files)
+  to be always present during autoconfigure.
+  With other crypto backends, like OpenSSL, this makes no sense,
+  so this part of autoconfigure is now optional.
+
+* Cryptsetup now understands new --debug-json option that allows
+  an additional dump of some JSON information. These are no longer
+  present in standard debug output because it could contain some
+  specific LUKS header parameters.
+
+* The luksDump contains the hash algorithm used in Anti-Forensic
+  function.
+
+* All debug messages are now sent through configured log callback
+  functions, so an application can easily use own debug messages
+  handling. In previous versions debug messages were printed directly
+  to standard output.)
+
+Libcryptsetup API additions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+These new calls are now exported, for details see libcryptsetup.h:
+
+ * crypt_init_data_device
+ * crypt_get_metadata_device_name
+     functions to init devices with separate metadata and data device
+     before a format function is called.
+
+ * crypt_set_data_offset
+     sets the data offset for LUKS to the specified value
+     in 512-byte sectors.
+     It should replace alignment calculation in LUKS param structures.
+
+ * crypt_get_metadata_size
+ * crypt_set_metadata_size
+     allows to set/get area sizes in LUKS header
+     (according to specification).
+
+ * crypt_get_default_type
+     get default compiled-in LUKS type (version).
+
+ * crypt_get_pbkdf_type_params
+     allows to get compiled-in PBKDF parameters.
+
+ * crypt_keyslot_set_encryption
+ * crypt_keyslot_get_encryption
+     allows to set/get per-keyslot encryption algorithm for LUKS2.
+
+ * crypt_keyslot_get_pbkdf
+     allows to get PBKDF parameters per-keyslot.
+
+ and these new defines:
+ * CRYPT_LOG_DEBUG_JSON (message type for JSON debug)
+ * CRYPT_DEBUG_JSON (log level for JSON debug)
+ * CRYPT_ACTIVATE_RECALCULATE (dm-integrity recalculate flag)
+ * CRYPT_ACTIVATE_REFRESH (new open with refresh flag)
+
+All existing API calls should remain backward compatible.
+
+Unfinished things & TODO for next releases
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Optional authenticated encryption is still an experimental feature
+  and can have performance problems for high-speed devices and device
+  with larger IO blocks (like RAID).
+
+* Authenticated encryption does not use encryption for a dm-integrity
+  journal. While it does not influence data confidentiality or
+  integrity protection, an attacker can get some more information
+  from data journal or cause that system will corrupt sectors after
+  journal replay. (That corruption will be detected though.)
+
+* The LUKS2 metadata area increase is mainly needed for the new online
+  reencryption as the major feature for the next release.
diff --git a/docs/v2.2.0-ReleaseNotes b/docs/v2.2.0-ReleaseNotes
new file mode 100644 (file)
index 0000000..b1fd363
--- /dev/null
@@ -0,0 +1,279 @@
+Cryptsetup 2.2.0 Release Notes
+==============================
+Stable release with new experimental features and bug fixes.
+
+Cryptsetup 2.2 version introduces a new LUKS2 online reencryption
+extension that allows reencryption of mounted LUKS2 devices
+(device in use) in the background.
+
+Online reencryption is a complex feature. Please be sure you
+have a full data backup before using this feature.
+
+Changes since version 2.1.0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+LUKS2 online reencryption
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The reencryption is intended to provide a reliable way to change
+volume key or an algorithm change while the encrypted device is still
+in use.
+
+It is based on userspace-only approach (no kernel changes needed)
+that uses the device-mapper subsystem to remap active devices on-the-fly
+dynamically. The device is split into several segments (encrypted by old
+key, new key and so-called hotzone, where reencryption is actively running).
+
+The flexible LUKS2 metadata format is used to store intermediate states
+(segment mappings) and both version of keyslots (old and new keys).
+Also, it provides a binary area (in the unused keyslot area space)
+to provide recovery metadata in the case of unexpected failure during
+reencryption. LUKS2 header is during the reencryption marked with
+"online-reencryption" keyword. After the reencryption is finished,
+this keyword is removed, and the device is backward compatible with all
+older cryptsetup tools (that support LUKS2).
+
+The recovery supports three resilience modes:
+
+  - checksum: default mode, where individual checksums of ciphertext hotzone
+    sectors are stored, so the recovery process can detect which sectors were
+    already reencrypted. It requires that the device sector write is atomic.
+
+  - journal: the hotzone is journaled in the binary area
+    (so the data are written twice)
+
+  - none: performance mode; there is no protection
+    (similar to old offline reencryption)
+
+These resilience modes are not available if reencryption uses data shift.
+
+Note: until we have full documentation (both of the process and metadata),
+please refer to Ondrej's slides (some slight details are no longer relevant)
+https://okozina.fedorapeople.org/online-disk-reencryption-with-luks2-compact.pdf
+
+The offline reencryption tool (cryptsetup-reencrypt) is still supported
+for both LUKS1 and LUKS2 format.
+
+Cryptsetup examples for reencryption
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The reencryption feature is integrated directly into cryptsetup utility
+as the new "reencrypt" action (command).
+
+There are three basic modes - to perform reencryption (change of already
+existing LUKS2 device), to add encryption to plaintext device and to remove
+encryption from a device (decryption).
+
+In all cases, if existing LUKS2 metadata contains information about
+the ongoing reencryption process, following reencrypt command continues
+with the ongoing reencryption process until it is finished.
+
+You can activate a device with ongoing reencryption as the standard LUKS2
+device, but the reencryption process will not continue until the cryptsetup
+reencrypt command is issued.
+
+
+1) Reencryption
+~~~~~~~~~~~~~~~
+This mode is intended to change any attribute of the data encryption
+(change of the volume key, algorithm or sector size).
+Note that authenticated encryption is not yet supported.
+
+You can start the reencryption process by specifying a LUKS2 device or with
+a detached LUKS2 header.
+The code should automatically recognize if the device is in use (and if it
+should use online mode of reencryption).
+
+If you do not specify parameters, only volume key is changed
+(a new random key is generated).
+
+# cryptsetup reencrypt <device> [--header <hdr>]
+
+You can also start reencryption using active mapped device name:
+  # cryptsetup reencrypt --active-name <name>
+
+You can also specify the resilience mode (none, checksum, journal) with
+--resilience=<mode> option, for checksum mode also the hash algorithm with
+--resilience-hash=<alg> (only hash algorithms supported by cryptographic
+backend are available).
+
+The maximal size of reencryption hotzone can be limited by
+--hotzone-size=<size> option and applies to all reencryption modes.
+Note that for checksum and journal mode hotzone size is also limited
+by available space in binary keyslot area.
+
+2) Encryption
+~~~~~~~~~~~~~
+This mode provides a way to encrypt a plaintext device to LUKS2 format.
+This option requires reduction of device size (for LUKS2 header) or new
+detached header.
+
+  # cryptsetup reencrypt <device> --encrypt --reduce-device-size <size>
+
+Or with detached header:
+  # cryptsetup reencrypt <device> --encrypt --header <hdr>
+
+3) Decryption
+~~~~~~~~~~~~~
+This mode provides the removal of existing LUKS2 encryption and replacing
+a device with plaintext content only.
+For now, we support only decryption with a detached header.
+
+  # cryptsetup reencrypt <device> --decrypt --header <hdr>
+
+For all three modes, you can split the process to metadata initialization
+(prepare keyslots and segments but do not run reencryption yet) and the data
+reencryption step by using --init-only option.
+
+Prepares metadata:
+  # cryptsetup reencrypt --init-only <parameters>
+
+Starts the data processing:
+  # cryptsetup reencrypt <device>
+
+Please note, that due to the Linux kernel limitation, the encryption or
+decryption process cannot be run entirely online - there must be at least
+short offline window where operation adds/removes device-mapper crypt (LUKS2) layer.
+This step should also include modification of /etc/crypttab and fstab UUIDs,
+but it is out of the scope of cryptsetup tools.
+
+Limitations
+~~~~~~~~~~~
+Most of these limitations will be (hopefully) fixed in next versions.
+
+* Only one active keyslot is supported (all old keyslots will be removed
+  after reencryption).
+
+* Only block devices are now supported as parameters. As a workaround
+  for images in a file, please explicitly map a loop device over the image
+  and use the loop device as the parameter.
+
+* Devices with authenticated encryption are not supported. (Later it will
+  be limited by the fixed per-sector metadata, per-sector metadata size
+  cannot be changed without a new device format operation.)
+
+* The reencryption uses userspace crypto library, with fallback to
+  the kernel (if available). There can be some specific configurations
+  where the fallback does not provide optimal performance.
+
+* There are no translations of error messages until the final release
+  (some messages can be rephrased as well).
+
+* The repair command is not finished; the recovery of interrupted
+  reencryption is made automatically on the first device activation.
+
+* Reencryption triggers too many udev scans on metadata updates (on closing
+  write enabled file descriptors). This has a negative performance impact on the whole
+  reencryption and generates excessive I/O load on the system.
+
+New libcryptsetup reencryption API
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The libcryptsetup contains new API calls that are used to setup and
+run the reencryption.
+
+Note that there can be some changes in API implementation of these functions
+and/or some new function can be introduced in final cryptsetup 2.2 release.
+
+New API symbols (see documentation in libcryptsetup.h)
+* struct crypt_params_reencrypt - reencryption parameters
+
+* crypt_reencrypt_init_by_passphrase
+* crypt_reencrypt_init_by_keyring
+  - function to configure LUKS2 metadata for reencryption;
+    if metadata already exists, it configures the context from this metadata
+
+* crypt_reencrypt
+  - run the reencryption process (processing the data)
+  - the optional callback function can be used to interrupt the reencryption
+    or report the progress.
+
+* crypt_reencrypt_status
+  - function to query LUKS2 metadata about the reencryption state
+
+Other changes and fixes
+~~~~~~~~~~~~~~~~~~~~~~~
+* Add optional global serialization lock for memory hard PBKDF.
+  (The --serialize-memory-hard-pbkdf option in cryptsetup and
+  CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF in activation flag.)
+
+  This is an "ugly" optional workaround for a situation when multiple devices
+  are being activated in parallel (like systemd crypttab activation).
+  The system instead of returning ENOMEM (no memory available) starts
+  out-of-memory (OOM) killer to kill processes randomly.
+
+  Until we find a reliable way how to work with memory-hard function
+  in these situations, cryptsetup provide a way how to serialize memory-hard
+  unlocking among parallel cryptsetup instances to workaround this problem.
+  This flag is intended to be used only in very specific situations,
+  never use it directly :-)
+
+* Abort conversion to LUKS1 with incompatible sector size that is
+  not supported in LUKS1.
+
+* Report error (-ENOENT) if no LUKS keyslots are available. User can now
+  distinguish between a wrong passphrase and no keyslot available.
+
+* Fix a possible segfault in detached header handling (double free).
+
+* Add integritysetup support for bitmap mode introduced in Linux kernel 5.2.
+  Integritysetup now supports --integrity-bitmap-mode option and
+  --bitmap-sector-per-bit and --bitmap-flush-time commandline options.
+
+  In the bitmap operation mode, if a bit in the bitmap is 1, the corresponding
+  region's data and integrity tags are not synchronized - if the machine
+  crashes, the unsynchronized regions will be recalculated.
+  The bitmap mode is faster than the journal mode because we don't have
+  to write the data twice, but it is also less reliable, because if data
+  corruption happens when the machine crashes, it may not be detected.
+  This can be used only for standalone devices, not with dm-crypt.
+
+* The libcryptsetup now keeps all file descriptors to underlying device
+  open during the whole lifetime of crypt device context to avoid excessive
+  scanning in udev (udev run scan on every descriptor close).
+
+* The luksDump command now prints more info for reencryption keyslot
+  (when a device is in-reencryption).
+
+* New --device-size parameter is supported for LUKS2 reencryption.
+  It may be used to encrypt/reencrypt only the initial part of the data
+  device if the user is aware that the rest of the device is empty.
+
+  Note: This change causes API break since the last rc0 release
+  (crypt_params_reencrypt structure contains additional field).
+
+* New --resume-only parameter is supported for LUKS2 reencryption.
+  This flag resumes reencryption process if it exists (not starting
+  new reencryption).
+
+* The repair command now tries LUKS2 reencryption recovery if needed.
+
+* If reencryption device is a file image, an interactive dialog now
+  asks if reencryption should be run safely in offline mode
+  (if autodetection of active devices failed).
+
+* Fix activation through a token where dm-crypt volume key was not
+  set through keyring (but using old device-mapper table parameter mode).
+
+* Online reencryption can now retain all keyslots (if all passphrases
+  are provided). Note that keyslot numbers will change in this case.
+
+* Allow volume key file to be used if no LUKS2 keyslots are present.
+  If all keyslots are removed, LUKS2 has no longer information about
+  the volume key size (there is only key digest present).
+  Please use --key-size option to open the device or add a new keyslot
+  in these cases.
+
+* Print a warning if online reencrypt is called over LUKS1 (not supported).
+
+* Fix TCRYPT KDF failure in FIPS mode.
+  Some crypto backends support plain hash in FIPS mode but not for PBKDF2.
+
+* Remove FIPS mode restriction for crypt_volume_key_get.
+  It is an application responsibility to use this API in the proper context.
+
+* Reduce keyslots area size in luksFormat when the header device is too small.
+  Unless user explicitly asks for keyslots areas size  (either via
+  --luks2-keyslots-size or --offset) reduce keyslots size so that it fits
+  in metadata device.
+
+* Make resize action accept --device-size parameter (supports units suffix).
diff --git a/docs/v2.2.1-ReleaseNotes b/docs/v2.2.1-ReleaseNotes
new file mode 100644 (file)
index 0000000..34bacc1
--- /dev/null
@@ -0,0 +1,36 @@
+Cryptsetup 2.2.1 Release Notes
+==============================
+Stable bug-fix release.
+
+This version contains a fix for a possible data corruption bug
+on 32-bit platforms.
+All users of cryptsetup 2.1 and 2.2 should upgrade to this version.
+
+Changes since version 2.2.0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Fix possible data length and IV offset overflow on 32bit architectures.
+  Other 64-bit architectures are not affected.
+
+  The flawed helper function prototypes (introduced in version 2.1.0) used
+  size_t type, that is 32-bit integer on 32-bit systems.
+  This patch fixes the problem to properly use 64-bit types.
+
+  If the offset parameter addresses devices larger than 2TB, the value
+  overflows and stores incorrect information in the metadata.
+  For example, integrity device is smaller than expected size if used
+  over large disk on 32-bit architecture.
+
+  This issue is not present with the standard LUKS1/LUKS2 devices without
+  integrity extensions.
+
+* Fix a regression in TrueCrypt/VeraCrypt system partition activation.
+
+* Reinstate missing backing file hint for loop device.
+
+  If the encrypted device is backed by a file (loopback), cryptsetup now
+  shows the path to the backing file in passphrase query (as in 1.x version).
+
+* LUKS2 reencryption block size is now aligned to reported optimal IO size.
+  This change eliminates possible non-aligned device warnings in kernel log
+  during reencryption.
diff --git a/docs/v2.2.2-ReleaseNotes b/docs/v2.2.2-ReleaseNotes
new file mode 100644 (file)
index 0000000..9e68641
--- /dev/null
@@ -0,0 +1,56 @@
+Cryptsetup 2.2.2 Release Notes
+==============================
+Stable bug-fix release.
+
+All users of cryptsetup 2.1 and 2.2 should upgrade to this version.
+
+Changes since version 2.2.1
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Print error message if a keyslot open failed for a different reason
+  than wrong passwords (for example there is not enough memory).
+  Only an exit code was present in this case.
+
+* The progress function switches unit sizes (B/s to GiB/s) according
+  to the actual speed. Also, it properly calculates speed in the case
+  of a resumed reencryption operation.
+
+* The --version now supports short -V short option and better handles
+  common option priorities.
+
+* If cryptsetup wipes signatures during format actions through blkid,
+  it also prints signature device offsets.
+
+* Compilation now properly uses LTLIBINTL gettext setting in Makefiles.
+
+* Device-mapper backend now supports new DM_GET_TARGET_VERSION ioctl
+  (available since Linux kernel 5.4).
+  This should help to detect some kernel/userspace incompatibilities
+  earlier later after a failed device activation.
+
+* Fixes LUKS2 reencryption on systems without kernel keyring.
+
+* Fixes unlocking prompt for partitions mapped through loop devices
+  (to properly show the backing device).
+
+* For LUKS2 decryption, a device is now marked for deferred removal
+  to be automatically deactivated.
+
+* Reencryption now limits hotzone size to be maximal 1 GiB or 1/4
+  system memory (if lower).
+
+* Reencryption now retains activation flags during online reencryption.
+
+* Reencryption now allows LUKS2 device to activate device right after
+  LUKS2 encryption is initialized through optional active device name
+  for cryptsetup reencrypt --encrypt command.
+  This could help with automated encryption during boot.
+
+  NOTE: It means that part of the device is still not encrypted during
+  activation. Use with care!
+
+* Fixes failure in resize and plain format activation if activated device
+  size was not aligned to underlying logical device size.
+
+* Fixes conversion to LUKS2 format with detached header if a detached
+  header size was smaller than the expected aligned LUKS1 header size.
diff --git a/docs/v2.3.0-ReleaseNotes b/docs/v2.3.0-ReleaseNotes
new file mode 100644 (file)
index 0000000..2b582c3
--- /dev/null
@@ -0,0 +1,209 @@
+Cryptsetup 2.3.0 Release Notes
+==============================
+Stable release with new experimental features and bug fixes.
+
+Cryptsetup 2.3 version introduces support for BitLocker-compatible
+devices (BITLK format). This format is used in Windows systems,
+and in combination with a filesystem driver, cryptsetup now provides
+native read-write access to BitLocker Full Disk Encryption devices.
+
+The BITLK implementation is based on publicly available information
+and it is an independent and opensource implementation that allows
+to access this proprietary disk encryption.
+
+Changes since version 2.2.2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* BITLK (Windows BitLocker compatible) device access
+
+  BITLK userspace implementation is based on the master thesis and code
+  provided by Vojtech Trefny. Also, thanks to other opensource projects
+  like libbde (that provide alternative approach to decode this format)
+  we were able to verify cryptsetup implementation.
+
+  NOTE: Support for the BITLK device is EXPERIMENTAL and will require
+  a lot of testing. If you get some error message (mainly unsupported
+  metadata in the on-disk header), please help us by submitting an issue
+  to cryptsetup project, so we can fix it. Thank you!
+
+  Cryptsetup supports BITLK activation through passphrase or recovery
+  passphrase for existing devices (BitLocker and Bitlocker to Go).
+
+  Activation through TPM, SmartCard, or any other key protector
+  is not supported. And in some situations, mainly for TPM bind to some
+  PCR registers, it could be even impossible on Linux in the future.
+
+  All metadata (key protectors) are handled read-only, cryptsetup cannot
+  create or modify them. Except for old devices (created in old Vista
+  systems), all format variants should be recognized.
+
+  Data devices can be activated read-write (followed by mounting through
+  the proper filesystem driver). To access filesystem on the decrypted device
+  you need properly installed driver (vfat, NTFS or exFAT).
+
+  Foe AES-XTS, activation is supported on all recent Linux kernels.
+
+  For older AES-CBC encryption, Linux Kernel version 5.3 is required
+  (support for special IV variant); for AES-CBC with Elephant diffuser,
+  Linux Kernel 5.6 is required.
+
+  Please note that CBC variants are legacy, and we provide it only
+  for backward compatibility (to be able to access old drives).
+
+  Cryptsetup command now supports the new "bitlk" format and implement dump,
+  open, status, and close actions.
+
+  To activate a BITLK device, use
+
+    # cryptsetup open --type bitlk <device> <name>
+      or with alias
+    # cryptsetup bitlkOpen <device> <name>
+
+  Then with properly installed fs driver (usually NTFS, vfat or exFAT),
+  you can mount the plaintext device /dev/mapper<name> device as a common
+  filesystem.
+
+ To print metadata information about BITLK device, use
+   # crypotsetup bitlkDump <device>
+
+ To print information about the active device, use
+   # cryptsetup status <name>
+
+ Example (activation of disk image):
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+  # Recent blkid recognizes BitLocker device,just to verity
+  # blkid bitlocker_xts_ntfs.img
+    bitlocker_xts_ntfs.img: TYPE="BitLocker"
+
+  # Print visible metadata information (on-disk, form the image)
+  # cryptsetup bitlkDump bitlocker_xts_ntfs.img
+    Info for BITLK device bitlocker_xts_ntfs.img.
+    Version:        2
+    GUID:           ...
+    Created:        Wed Oct 23 17:38:15 2019
+    Description:    DESKTOP-xxxxxxx E: 23.10.2019
+    Cipher name:    aes
+    Cipher mode:    xts-plain64
+    Cipher key:     128 bits
+
+    Keyslots:
+     0: VMK
+            GUID:           ...
+            Protection:     VMK protected with passphrase
+            Salt:           ...
+            Key data size:  44 [bytes]
+     1: VMK
+            GUID:           ...
+            Protection:     VMK protected with recovery passphrase
+            Salt:           ...
+            Key data size:  44 [bytes]
+     2: FVEK
+           Key data size:  44 [bytes]
+
+  # Activation (recovery passphrase works the same as password)
+  # cryptsetup bitlkOpen bitlocker_xts_ntfs.img test -v
+    Enter passphrase for bitlocker_xts_ntfs.img:
+    Command successful.
+
+  # Information about the active device
+  # cryptsetup status test
+    /dev/mapper/test is active.
+    type:    BITLK
+    cipher:  aes-xts-plain64
+    keysize: 128 bits
+    ...
+
+  # Plaintext device should now contain decrypted NTFS filesystem
+  # blkid /dev/mapper/test
+    /dev/mapper/test: UUID="..." TYPE="ntfs"
+
+  # And can be mounted
+  # mount /dev/mapper/test /mnt/tst
+
+  # Deactivation
+  # umount /mnt/tst
+  # cryptsetup close test
+
+* Veritysetup now supports activation with additional PKCS7 signature
+  of root hash through --root-hash-signature option.
+  The signature uses an in-kernel trusted key to validate the signature
+  of the root hash during activation. This option requires Linux kernel
+  5.4 with DM_VERITY_VERIFY_ROOTHASH_SIG option.
+
+  Verity devices activated with signature now has a special flag
+  (with signature) active in device status (veritysetup status <name>).
+
+  Usage:
+  # veritysetup open <data_device> name <hash_device> <root_hash> \
+    --root-hash-signature=<roothash_p7_sig_file>
+
+* Integritysetup now calculates hash integrity size according to algorithm
+  instead of requiring an explicit tag size.
+
+  Previously, when integritysetup formats a device with hash or
+  HMAC integrity checksums, it required explicitly tag size entry from
+  a user (or used default value).
+  This led to confusion and unexpected shortened tag sizes.
+
+  Now, libcryptsetup calculates tag size according to real hash output.
+  Tag size can also be specified, then it warns if these values differ.
+
+* Integritysetup now supports fixed padding for dm-integrity devices.
+
+  There was an in-kernel bug that wasted a lot of space when using metadata
+  areas for integrity-protected devices if a larger sector size than
+  512 bytes was used.
+  This problem affects both stand-alone dm-integrity and also LUKS2 with
+  authenticated encryption and larger sector size.
+
+  The new extension to dm-integrity superblock is needed, so devices
+  with the new optimal padding cannot be activated on older systems.
+
+  Integritysetup/Cryptsetup will use new padding automatically if it
+  detects the proper kernel. To create a compatible device with
+  the old padding, use --integrity-legacy-padding option.
+
+* A lot of fixes to online LUKS2 reecryption.
+
+* Add crypt_resume_by_volume_key() function to libcryptsetup.
+  If a user has a volume key available, the LUKS device can be resumed
+  directly using the provided volume key.
+  No keyslot derivation is needed, only the key digest is checked.
+
+* Implement active device suspend info.
+  Add CRYPT_ACTIVATE_SUSPENDED bit to crypt_get_active_device() flags
+  that informs the caller that device is suspended (luksSuspend).
+
+* Allow --test-passphrase for a detached header.
+  Before this fix, we required a data device specified on the command
+  line even though it was not necessary for the passphrase check.
+
+* Allow --key-file option in legacy offline encryption.
+  The option was ignored for LUKS1 encryption initialization.
+
+* Export memory safe functions.
+  To make developing of some extensions simpler, we now export
+  functions to handle memory with proper wipe on deallocation.
+
+* Fail crypt_keyslot_get_pbkdf for inactive LUKS1 keyslot.
+
+Libcryptsetup API extensions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The libcryptsetup API is backward compatible for existing symbols.
+
+New symbols
+ crypt_set_compatibility
+ crypt_get_compatibility;
+ crypt_resume_by_volume_key;
+ crypt_activate_by_signed_key;
+ crypt_safe_alloc;
+ crypt_safe_realloc;
+ crypt_safe_free;
+ crypt_safe_memzero;
+
+New defines introduced :
+  CRYPT_BITLK "BITLK" - BITLK (BitLocker-compatible mode
+  CRYPT_COMPAT_LEGACY_INTEGRITY_PADDING - dm-integrity legacy padding
+  CRYPT_VERITY_ROOT_HASH_SIGNATURE - dm-verity root hash signature
+  CRYPT_ACTIVATE_SUSPENDED - device suspended info flag
diff --git a/docs/v2.3.1-ReleaseNotes b/docs/v2.3.1-ReleaseNotes
new file mode 100644 (file)
index 0000000..1c1d365
--- /dev/null
@@ -0,0 +1,45 @@
+Cryptsetup 2.3.1 Release Notes
+==============================
+Stable bug-fix release.
+
+All users of cryptsetup 2.x should upgrade to this version.
+
+Changes since version 2.3.0
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Support VeraCrypt 128 bytes passwords.
+  VeraCrypt now allows passwords of maximal length 128 bytes
+  (compared to legacy TrueCrypt where it was limited by 64 bytes).
+
+* Strip extra newline from BitLocker recovery keys
+  There might be a trailing newline added by the text editor when
+  the recovery passphrase was passed using the --key-file option.
+
+* Detect separate libiconv library.
+  It should fix compilation issues on distributions with iconv
+  implemented in a separate library.
+
+* Various fixes and workarounds to build on old Linux distributions.
+
+* Split lines with hexadecimal digest printing for large key-sizes.
+
+* Do not wipe the device with no integrity profile.
+  With --integrity none we performed useless full device wipe.
+
+* Workaround for dm-integrity kernel table bug.
+  Some kernels show an invalid dm-integrity mapping table
+  if superblock contains the "recalculate" bit. This causes
+  integritysetup to not recognize the dm-integrity device.
+  Integritysetup now specifies kernel options such a way that
+  even on unpatched kernels mapping table is correct.
+
+* Print error message if LUKS1 keyslot cannot be processed.
+  If the crypto backend is missing support for hash algorithms
+  used in PBKDF2, the error message was not visible.
+
+* Properly align LUKS2 keyslots area on conversion.
+  If the LUKS1 payload offset (data offset) is not aligned
+  to 4 KiB boundary, new LUKS2 keyslots area in now aligned properly.
+
+* Validate LUKS2 earlier on conversion to not corrupt the device
+  if binary keyslots areas metadata are not correct.
diff --git a/docs/v2.3.2-ReleaseNotes b/docs/v2.3.2-ReleaseNotes
new file mode 100644 (file)
index 0000000..eb0d447
--- /dev/null
@@ -0,0 +1,42 @@
+Cryptsetup 2.3.2 Release Notes
+==============================
+Stable bug-fix release.
+
+All users of cryptsetup 2.x should upgrade to this version.
+
+Changes since version 2.3.1
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Support compilation with json-c library version 0.14.
+
+* Update FAQ document for some LUKS2 specific information.
+
+* Add option to dump content of LUKS2 unbound keyslot:
+    cryptsetup luksDump --unbound -S <slot> <device>
+  or optionally with --master-key-file option.
+
+  The slot number --key-slot (-S) option is mandatory here.
+
+  An unbound keyslot store a key is that is not assigned to data
+  area on disk (LUKS2 allows to store arbitrary keys).
+
+* Rephrase some error messages and remove redundant end-of-lines.
+
+* Add support for discards (TRIM) for standalone dm-integrity devices.
+  Linux kernel 5.7 adds support for optional discard/TRIM operation
+  over dm-integrity devices.
+
+  It is now supported through --allow-discards integritysetup option.
+  Note you need to add this flag in all activation calls.
+
+  Note that this option cannot be used for LUKS2 authenticated encryption
+  (that uses dm-integrity for storing additional per-sector metadata).
+
+* Fix cryptsetup-reencrypt to work on devices that do not allow
+  direct-io device access.
+
+* Fix a crash in the BitLocker-compatible code error path.
+
+* Fix Veracrypt compatible support for longer (>64 bytes) passphrases.
+  It allows some older images to be correctly opened again.
+  The issue was introduced in version 2.3.1.
diff --git a/docs/v2.3.3-ReleaseNotes b/docs/v2.3.3-ReleaseNotes
new file mode 100644 (file)
index 0000000..75471ac
--- /dev/null
@@ -0,0 +1,42 @@
+Cryptsetup 2.3.3 Release Notes
+==============================
+Stable bug-fix release.
+
+All users of cryptsetup 2.x should upgrade to this version.
+
+Changes since version 2.3.2
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* Fix BitLocker compatible device access that uses native 4kB sectors.
+
+  Devices formatted with storage that natively support 4096-bytes
+  sectors can also use this sector size for encryption units.
+
+* Support large IV count (--iv-large-sectors) cryptsetup option
+  for plain device mapping.
+
+  The large IV count is supported in dm-crypt together with larger
+  sector encryption. It counts the Initialization Vector (IV) in
+  a larger sector size instead of 512-bytes sectors.
+
+  This option does not have any performance or security impact,
+  but it can be used for accessing incompatible existing disk images
+  from other systems.
+
+  Only open action with plain device type and sector size > 512 bytes
+  are supported.
+
+* Fix a memory leak in BitLocker compatible handling.
+
+* Allow EBOIV (Initialization Vector algorithm) use.
+
+  The EBOIV initialization vector is intended to be used internally
+  with BitLocker devices (for CBC mode). It can now be used also
+  outside of the BitLocker compatible code.
+
+* Require both keyslot cipher and key size options.
+
+  If these LUKS2 keyslot parameters were not specified together,
+  cryptsetup silently failed.
+
+* Update to man pages and FAQ.
diff --git a/lib/Makefile.am b/lib/Makefile.am
deleted file mode 100644 (file)
index 6662568..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-SUBDIRS = crypto_backend luks1 loopaes verity tcrypt
-
-moduledir = $(libdir)/cryptsetup
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libcryptsetup.pc
-
-AM_CPPFLAGS = -include config.h \
-       -I$(top_srcdir)                         \
-       -I$(top_srcdir)/lib/crypto_backend      \
-       -I$(top_srcdir)/lib/luks1               \
-       -I$(top_srcdir)/lib/loopaes             \
-       -I$(top_srcdir)/lib/verity              \
-       -I$(top_srcdir)/lib/tcrypt              \
-       -DDATADIR=\""$(datadir)"\"              \
-       -DLIBDIR=\""$(libdir)"\"                \
-       -DPREFIX=\""$(prefix)"\"                \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"        \
-       -DVERSION=\""$(VERSION)"\"
-
-lib_LTLIBRARIES = libcryptsetup.la
-
-common_ldadd = \
-       crypto_backend/libcrypto_backend.la     \
-       luks1/libluks1.la                       \
-       loopaes/libloopaes.la                   \
-       verity/libverity.la                     \
-       tcrypt/libtcrypt.la
-
-libcryptsetup_la_DEPENDENCIES = $(common_ldadd) libcryptsetup.sym
-
-libcryptsetup_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
-       -Wl,--version-script=$(top_srcdir)/lib/libcryptsetup.sym \
-       -version-info @LIBCRYPTSETUP_VERSION_INFO@
-
-libcryptsetup_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-
-libcryptsetup_la_LIBADD = \
-       @UUID_LIBS@                             \
-       @DEVMAPPER_LIBS@                        \
-       @CRYPTO_LIBS@                           \
-       $(common_ldadd)
-
-
-libcryptsetup_la_SOURCES = \
-       setup.c                                 \
-       internal.h                              \
-       bitops.h                                \
-       nls.h                                   \
-       libcryptsetup.h                         \
-       utils.c                                 \
-       utils_benchmark.c                       \
-       utils_crypt.c                           \
-       utils_crypt.h                           \
-       utils_loop.c                            \
-       utils_loop.h                            \
-       utils_devpath.c                         \
-       utils_wipe.c                            \
-       utils_fips.c                            \
-       utils_fips.h                            \
-       utils_device.c                          \
-       libdevmapper.c                          \
-       utils_dm.h                              \
-       volumekey.c                             \
-       random.c                                \
-       crypt_plain.c
-
-include_HEADERS = libcryptsetup.h
-
-EXTRA_DIST = libcryptsetup.pc.in libcryptsetup.sym
diff --git a/lib/Makefile.in b/lib/Makefile.in
deleted file mode 100644 (file)
index ca389bc..0000000
+++ /dev/null
@@ -1,1023 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = lib
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(srcdir)/libcryptsetup.pc.in $(top_srcdir)/depcomp \
-       $(include_HEADERS)
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = libcryptsetup.pc
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \
-       "$(DESTDIR)$(includedir)"
-LTLIBRARIES = $(lib_LTLIBRARIES)
-am_libcryptsetup_la_OBJECTS = libcryptsetup_la-setup.lo \
-       libcryptsetup_la-utils.lo libcryptsetup_la-utils_benchmark.lo \
-       libcryptsetup_la-utils_crypt.lo libcryptsetup_la-utils_loop.lo \
-       libcryptsetup_la-utils_devpath.lo \
-       libcryptsetup_la-utils_wipe.lo libcryptsetup_la-utils_fips.lo \
-       libcryptsetup_la-utils_device.lo \
-       libcryptsetup_la-libdevmapper.lo libcryptsetup_la-volumekey.lo \
-       libcryptsetup_la-random.lo libcryptsetup_la-crypt_plain.lo
-libcryptsetup_la_OBJECTS = $(am_libcryptsetup_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libcryptsetup_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(libcryptsetup_la_CFLAGS) $(CFLAGS) \
-       $(libcryptsetup_la_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libcryptsetup_la_SOURCES)
-DIST_SOURCES = $(libcryptsetup_la_SOURCES)
-RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
-       ctags-recursive dvi-recursive html-recursive info-recursive \
-       install-data-recursive install-dvi-recursive \
-       install-exec-recursive install-html-recursive \
-       install-info-recursive install-pdf-recursive \
-       install-ps-recursive install-recursive installcheck-recursive \
-       installdirs-recursive pdf-recursive ps-recursive \
-       tags-recursive uninstall-recursive
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-DATA = $(pkgconfig_DATA)
-HEADERS = $(include_HEADERS)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
-  distclean-recursive maintainer-clean-recursive
-am__recursive_targets = \
-  $(RECURSIVE_TARGETS) \
-  $(RECURSIVE_CLEAN_TARGETS) \
-  $(am__extra_recursive_targets)
-AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-       distdir
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
-  dir0=`pwd`; \
-  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
-  sed_rest='s,^[^/]*/*,,'; \
-  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
-  sed_butlast='s,/*[^/]*$$,,'; \
-  while test -n "$$dir1"; do \
-    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
-    if test "$$first" != "."; then \
-      if test "$$first" = ".."; then \
-        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
-        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
-      else \
-        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
-        if test "$$first2" = "$$first"; then \
-          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
-        else \
-          dir2="../$$dir2"; \
-        fi; \
-        dir0="$$dir0"/"$$first"; \
-      fi; \
-    fi; \
-    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
-  done; \
-  reldir="$$dir2"
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = crypto_backend luks1 loopaes verity tcrypt
-moduledir = $(libdir)/cryptsetup
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libcryptsetup.pc
-AM_CPPFLAGS = -include config.h \
-       -I$(top_srcdir)                         \
-       -I$(top_srcdir)/lib/crypto_backend      \
-       -I$(top_srcdir)/lib/luks1               \
-       -I$(top_srcdir)/lib/loopaes             \
-       -I$(top_srcdir)/lib/verity              \
-       -I$(top_srcdir)/lib/tcrypt              \
-       -DDATADIR=\""$(datadir)"\"              \
-       -DLIBDIR=\""$(libdir)"\"                \
-       -DPREFIX=\""$(prefix)"\"                \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"        \
-       -DVERSION=\""$(VERSION)"\"
-
-lib_LTLIBRARIES = libcryptsetup.la
-common_ldadd = \
-       crypto_backend/libcrypto_backend.la     \
-       luks1/libluks1.la                       \
-       loopaes/libloopaes.la                   \
-       verity/libverity.la                     \
-       tcrypt/libtcrypt.la
-
-libcryptsetup_la_DEPENDENCIES = $(common_ldadd) libcryptsetup.sym
-libcryptsetup_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
-       -Wl,--version-script=$(top_srcdir)/lib/libcryptsetup.sym \
-       -version-info @LIBCRYPTSETUP_VERSION_INFO@
-
-libcryptsetup_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-libcryptsetup_la_LIBADD = \
-       @UUID_LIBS@                             \
-       @DEVMAPPER_LIBS@                        \
-       @CRYPTO_LIBS@                           \
-       $(common_ldadd)
-
-libcryptsetup_la_SOURCES = \
-       setup.c                                 \
-       internal.h                              \
-       bitops.h                                \
-       nls.h                                   \
-       libcryptsetup.h                         \
-       utils.c                                 \
-       utils_benchmark.c                       \
-       utils_crypt.c                           \
-       utils_crypt.h                           \
-       utils_loop.c                            \
-       utils_loop.h                            \
-       utils_devpath.c                         \
-       utils_wipe.c                            \
-       utils_fips.c                            \
-       utils_fips.h                            \
-       utils_device.c                          \
-       libdevmapper.c                          \
-       utils_dm.h                              \
-       volumekey.c                             \
-       random.c                                \
-       crypt_plain.c
-
-include_HEADERS = libcryptsetup.h
-EXTRA_DIST = libcryptsetup.pc.in libcryptsetup.sym
-all: all-recursive
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-libcryptsetup.pc: $(top_builddir)/config.status $(srcdir)/libcryptsetup.pc.in
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
-       @$(NORMAL_INSTALL)
-       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-       list2=; for p in $$list; do \
-         if test -f $$p; then \
-           list2="$$list2 $$p"; \
-         else :; fi; \
-       done; \
-       test -z "$$list2" || { \
-         echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
-       }
-
-uninstall-libLTLIBRARIES:
-       @$(NORMAL_UNINSTALL)
-       @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-       for p in $$list; do \
-         $(am__strip_dir) \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
-       done
-
-clean-libLTLIBRARIES:
-       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-       @list='$(lib_LTLIBRARIES)'; \
-       locs=`for p in $$list; do echo $$p; done | \
-             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-             sort -u`; \
-       test -z "$$locs" || { \
-         echo rm -f $${locs}; \
-         rm -f $${locs}; \
-       }
-
-libcryptsetup.la: $(libcryptsetup_la_OBJECTS) $(libcryptsetup_la_DEPENDENCIES) $(EXTRA_libcryptsetup_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libcryptsetup_la_LINK) -rpath $(libdir) $(libcryptsetup_la_OBJECTS) $(libcryptsetup_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-crypt_plain.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-libdevmapper.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-random.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-setup.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils_benchmark.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils_crypt.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils_device.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils_devpath.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils_fips.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils_loop.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-utils_wipe.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcryptsetup_la-volumekey.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libcryptsetup_la-setup.lo: setup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-setup.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-setup.Tpo -c -o libcryptsetup_la-setup.lo `test -f 'setup.c' || echo '$(srcdir)/'`setup.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-setup.Tpo $(DEPDIR)/libcryptsetup_la-setup.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='setup.c' object='libcryptsetup_la-setup.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-setup.lo `test -f 'setup.c' || echo '$(srcdir)/'`setup.c
-
-libcryptsetup_la-utils.lo: utils.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils.Tpo -c -o libcryptsetup_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils.Tpo $(DEPDIR)/libcryptsetup_la-utils.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils.c' object='libcryptsetup_la-utils.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
-
-libcryptsetup_la-utils_benchmark.lo: utils_benchmark.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils_benchmark.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils_benchmark.Tpo -c -o libcryptsetup_la-utils_benchmark.lo `test -f 'utils_benchmark.c' || echo '$(srcdir)/'`utils_benchmark.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils_benchmark.Tpo $(DEPDIR)/libcryptsetup_la-utils_benchmark.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_benchmark.c' object='libcryptsetup_la-utils_benchmark.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils_benchmark.lo `test -f 'utils_benchmark.c' || echo '$(srcdir)/'`utils_benchmark.c
-
-libcryptsetup_la-utils_crypt.lo: utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils_crypt.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils_crypt.Tpo -c -o libcryptsetup_la-utils_crypt.lo `test -f 'utils_crypt.c' || echo '$(srcdir)/'`utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils_crypt.Tpo $(DEPDIR)/libcryptsetup_la-utils_crypt.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_crypt.c' object='libcryptsetup_la-utils_crypt.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils_crypt.lo `test -f 'utils_crypt.c' || echo '$(srcdir)/'`utils_crypt.c
-
-libcryptsetup_la-utils_loop.lo: utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils_loop.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils_loop.Tpo -c -o libcryptsetup_la-utils_loop.lo `test -f 'utils_loop.c' || echo '$(srcdir)/'`utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils_loop.Tpo $(DEPDIR)/libcryptsetup_la-utils_loop.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_loop.c' object='libcryptsetup_la-utils_loop.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils_loop.lo `test -f 'utils_loop.c' || echo '$(srcdir)/'`utils_loop.c
-
-libcryptsetup_la-utils_devpath.lo: utils_devpath.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils_devpath.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils_devpath.Tpo -c -o libcryptsetup_la-utils_devpath.lo `test -f 'utils_devpath.c' || echo '$(srcdir)/'`utils_devpath.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils_devpath.Tpo $(DEPDIR)/libcryptsetup_la-utils_devpath.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_devpath.c' object='libcryptsetup_la-utils_devpath.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils_devpath.lo `test -f 'utils_devpath.c' || echo '$(srcdir)/'`utils_devpath.c
-
-libcryptsetup_la-utils_wipe.lo: utils_wipe.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils_wipe.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils_wipe.Tpo -c -o libcryptsetup_la-utils_wipe.lo `test -f 'utils_wipe.c' || echo '$(srcdir)/'`utils_wipe.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils_wipe.Tpo $(DEPDIR)/libcryptsetup_la-utils_wipe.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_wipe.c' object='libcryptsetup_la-utils_wipe.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils_wipe.lo `test -f 'utils_wipe.c' || echo '$(srcdir)/'`utils_wipe.c
-
-libcryptsetup_la-utils_fips.lo: utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils_fips.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils_fips.Tpo -c -o libcryptsetup_la-utils_fips.lo `test -f 'utils_fips.c' || echo '$(srcdir)/'`utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils_fips.Tpo $(DEPDIR)/libcryptsetup_la-utils_fips.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_fips.c' object='libcryptsetup_la-utils_fips.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils_fips.lo `test -f 'utils_fips.c' || echo '$(srcdir)/'`utils_fips.c
-
-libcryptsetup_la-utils_device.lo: utils_device.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-utils_device.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-utils_device.Tpo -c -o libcryptsetup_la-utils_device.lo `test -f 'utils_device.c' || echo '$(srcdir)/'`utils_device.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-utils_device.Tpo $(DEPDIR)/libcryptsetup_la-utils_device.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_device.c' object='libcryptsetup_la-utils_device.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-utils_device.lo `test -f 'utils_device.c' || echo '$(srcdir)/'`utils_device.c
-
-libcryptsetup_la-libdevmapper.lo: libdevmapper.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-libdevmapper.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-libdevmapper.Tpo -c -o libcryptsetup_la-libdevmapper.lo `test -f 'libdevmapper.c' || echo '$(srcdir)/'`libdevmapper.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-libdevmapper.Tpo $(DEPDIR)/libcryptsetup_la-libdevmapper.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='libdevmapper.c' object='libcryptsetup_la-libdevmapper.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-libdevmapper.lo `test -f 'libdevmapper.c' || echo '$(srcdir)/'`libdevmapper.c
-
-libcryptsetup_la-volumekey.lo: volumekey.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-volumekey.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-volumekey.Tpo -c -o libcryptsetup_la-volumekey.lo `test -f 'volumekey.c' || echo '$(srcdir)/'`volumekey.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-volumekey.Tpo $(DEPDIR)/libcryptsetup_la-volumekey.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='volumekey.c' object='libcryptsetup_la-volumekey.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-volumekey.lo `test -f 'volumekey.c' || echo '$(srcdir)/'`volumekey.c
-
-libcryptsetup_la-random.lo: random.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-random.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-random.Tpo -c -o libcryptsetup_la-random.lo `test -f 'random.c' || echo '$(srcdir)/'`random.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-random.Tpo $(DEPDIR)/libcryptsetup_la-random.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='random.c' object='libcryptsetup_la-random.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-random.lo `test -f 'random.c' || echo '$(srcdir)/'`random.c
-
-libcryptsetup_la-crypt_plain.lo: crypt_plain.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -MT libcryptsetup_la-crypt_plain.lo -MD -MP -MF $(DEPDIR)/libcryptsetup_la-crypt_plain.Tpo -c -o libcryptsetup_la-crypt_plain.lo `test -f 'crypt_plain.c' || echo '$(srcdir)/'`crypt_plain.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcryptsetup_la-crypt_plain.Tpo $(DEPDIR)/libcryptsetup_la-crypt_plain.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypt_plain.c' object='libcryptsetup_la-crypt_plain.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcryptsetup_la_CFLAGS) $(CFLAGS) -c -o libcryptsetup_la-crypt_plain.lo `test -f 'crypt_plain.c' || echo '$(srcdir)/'`crypt_plain.c
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-install-pkgconfigDATA: $(pkgconfig_DATA)
-       @$(NORMAL_INSTALL)
-       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
-       fi; \
-       for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         echo "$$d$$p"; \
-       done | $(am__base_list) | \
-       while read files; do \
-         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
-         $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
-       done
-
-uninstall-pkgconfigDATA:
-       @$(NORMAL_UNINSTALL)
-       @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
-       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
-install-includeHEADERS: $(include_HEADERS)
-       @$(NORMAL_INSTALL)
-       @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
-       fi; \
-       for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         echo "$$d$$p"; \
-       done | $(am__base_list) | \
-       while read files; do \
-         echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
-         $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
-       done
-
-uninstall-includeHEADERS:
-       @$(NORMAL_UNINSTALL)
-       @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
-       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run 'make' without going through this Makefile.
-# To change the values of 'make' variables: instead of editing Makefiles,
-# (1) if the variable is set in 'config.status', edit 'config.status'
-#     (which will cause the Makefiles to be regenerated when you run 'make');
-# (2) otherwise, pass the desired values on the 'make' command line.
-$(am__recursive_targets):
-       @fail=; \
-       if $(am__make_keepgoing); then \
-         failcom='fail=yes'; \
-       else \
-         failcom='exit 1'; \
-       fi; \
-       dot_seen=no; \
-       target=`echo $@ | sed s/-recursive//`; \
-       case "$@" in \
-         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-         *) list='$(SUBDIRS)' ;; \
-       esac; \
-       for subdir in $$list; do \
-         echo "Making $$target in $$subdir"; \
-         if test "$$subdir" = "."; then \
-           dot_seen=yes; \
-           local_target="$$target-am"; \
-         else \
-           local_target="$$target"; \
-         fi; \
-         ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-         || eval $$failcom; \
-       done; \
-       if test "$$dot_seen" = "no"; then \
-         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-       fi; test -z "$$fail"
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-recursive
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-         include_option=--etags-include; \
-         empty_fix=.; \
-       else \
-         include_option=--include; \
-         empty_fix=; \
-       fi; \
-       list='$(SUBDIRS)'; for subdir in $$list; do \
-         if test "$$subdir" = .; then :; else \
-           test ! -f $$subdir/TAGS || \
-             set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
-         fi; \
-       done; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-recursive
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-recursive
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-       @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-         if test "$$subdir" = .; then :; else \
-           $(am__make_dryrun) \
-             || test -d "$(distdir)/$$subdir" \
-             || $(MKDIR_P) "$(distdir)/$$subdir" \
-             || exit 1; \
-           dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
-           $(am__relativize); \
-           new_distdir=$$reldir; \
-           dir1=$$subdir; dir2="$(top_distdir)"; \
-           $(am__relativize); \
-           new_top_distdir=$$reldir; \
-           echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
-           echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
-           ($(am__cd) $$subdir && \
-             $(MAKE) $(AM_MAKEFLAGS) \
-               top_distdir="$$new_top_distdir" \
-               distdir="$$new_distdir" \
-               am__remove_distdir=: \
-               am__skip_length_check=: \
-               am__skip_mode_fix=: \
-               distdir) \
-             || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
-installdirs: installdirs-recursive
-installdirs-am:
-       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
-       mostlyclean-am
-
-distclean: distclean-recursive
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am: install-includeHEADERS install-pkgconfigDATA
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am: install-libLTLIBRARIES
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
-       uninstall-pkgconfigDATA
-
-.MAKE: $(am__recursive_targets) install-am install-strip
-
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-       check-am clean clean-generic clean-libLTLIBRARIES \
-       clean-libtool cscopelist-am ctags ctags-am distclean \
-       distclean-compile distclean-generic distclean-libtool \
-       distclean-tags distdir dvi dvi-am html html-am info info-am \
-       install install-am install-data install-data-am install-dvi \
-       install-dvi-am install-exec install-exec-am install-html \
-       install-html-am install-includeHEADERS install-info \
-       install-info-am install-libLTLIBRARIES install-man install-pdf \
-       install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
-       install-strip installcheck installcheck-am installdirs \
-       installdirs-am maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-       uninstall-am uninstall-includeHEADERS uninstall-libLTLIBRARIES \
-       uninstall-pkgconfigDATA
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
new file mode 100644 (file)
index 0000000..bf4230b
--- /dev/null
@@ -0,0 +1,115 @@
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lib/libcryptsetup.pc
+
+lib_LTLIBRARIES = libcryptsetup.la
+
+noinst_LTLIBRARIES += libutils_io.la
+
+include_HEADERS = lib/libcryptsetup.h
+
+EXTRA_DIST += lib/libcryptsetup.pc.in lib/libcryptsetup.sym
+
+libutils_io_la_CFLAGS = $(AM_CFLAGS)
+
+libutils_io_la_SOURCES = \
+       lib/utils_io.c                  \
+       lib/utils_io.h
+
+libcryptsetup_la_CPPFLAGS = $(AM_CPPFLAGS) \
+       -I $(top_srcdir)/lib/crypto_backend     \
+       -I $(top_srcdir)/lib/luks1              \
+       -I $(top_srcdir)/lib/luks2              \
+       -I $(top_srcdir)/lib/loopaes            \
+       -I $(top_srcdir)/lib/verity             \
+       -I $(top_srcdir)/lib/tcrypt             \
+       -I $(top_srcdir)/lib/integrity          \
+       -I $(top_srcdir)/lib/bitlk
+
+libcryptsetup_la_DEPENDENCIES = libutils_io.la libcrypto_backend.la lib/libcryptsetup.sym
+
+libcryptsetup_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
+       -Wl,--version-script=$(top_srcdir)/lib/libcryptsetup.sym \
+       -version-info @LIBCRYPTSETUP_VERSION_INFO@
+
+libcryptsetup_la_CFLAGS = $(AM_CFLAGS) @CRYPTO_CFLAGS@
+
+libcryptsetup_la_LIBADD = \
+       @UUID_LIBS@             \
+       @DEVMAPPER_LIBS@        \
+       @CRYPTO_LIBS@           \
+       @LIBARGON2_LIBS@        \
+       @JSON_C_LIBS@           \
+       @BLKID_LIBS@            \
+       $(LTLIBICONV)           \
+       libcrypto_backend.la    \
+       libutils_io.la
+
+libcryptsetup_la_SOURCES = \
+       lib/setup.c                     \
+       lib/internal.h                  \
+       lib/bitops.h                    \
+       lib/nls.h                       \
+       lib/libcryptsetup.h             \
+       lib/utils.c                     \
+       lib/utils_benchmark.c           \
+       lib/utils_crypt.c               \
+       lib/utils_crypt.h               \
+       lib/utils_loop.c                \
+       lib/utils_loop.h                \
+       lib/utils_devpath.c             \
+       lib/utils_wipe.c                \
+       lib/utils_fips.c                \
+       lib/utils_fips.h                \
+       lib/utils_device.c              \
+       lib/utils_keyring.c             \
+       lib/utils_keyring.h             \
+       lib/utils_device_locking.c      \
+       lib/utils_device_locking.h      \
+       lib/utils_pbkdf.c               \
+       lib/utils_safe_memory.c         \
+       lib/utils_storage_wrappers.c    \
+       lib/utils_storage_wrappers.h    \
+       lib/libdevmapper.c              \
+       lib/utils_dm.h                  \
+       lib/volumekey.c                 \
+       lib/random.c                    \
+       lib/crypt_plain.c               \
+       lib/base64.h                    \
+       lib/base64.c                    \
+       lib/integrity/integrity.h       \
+       lib/integrity/integrity.c       \
+       lib/loopaes/loopaes.h           \
+       lib/loopaes/loopaes.c           \
+       lib/tcrypt/tcrypt.h             \
+       lib/tcrypt/tcrypt.c             \
+       lib/luks1/af.h                  \
+       lib/luks1/af.c                  \
+       lib/luks1/keyencryption.c       \
+       lib/luks1/keymanage.c           \
+       lib/luks1/luks.h                \
+       lib/verity/verity_hash.c        \
+       lib/verity/verity_fec.c         \
+       lib/verity/verity.c             \
+       lib/verity/verity.h             \
+       lib/verity/rs_encode_char.c     \
+       lib/verity/rs_decode_char.c     \
+       lib/verity/rs.h         \
+       lib/luks2/luks2_disk_metadata.c \
+       lib/luks2/luks2_json_format.c   \
+       lib/luks2/luks2_json_metadata.c \
+       lib/luks2/luks2_luks1_convert.c \
+       lib/luks2/luks2_digest.c        \
+       lib/luks2/luks2_digest_pbkdf2.c \
+       lib/luks2/luks2_keyslot.c       \
+       lib/luks2/luks2_keyslot_luks2.c \
+       lib/luks2/luks2_keyslot_reenc.c \
+       lib/luks2/luks2_reencrypt.c     \
+       lib/luks2/luks2_segment.c       \
+       lib/luks2/luks2_token_keyring.c \
+       lib/luks2/luks2_token.c         \
+       lib/luks2/luks2_internal.h      \
+       lib/luks2/luks2.h               \
+       lib/utils_blkid.c               \
+       lib/utils_blkid.h               \
+       lib/bitlk/bitlk.h               \
+       lib/bitlk/bitlk.c
diff --git a/lib/base64.c b/lib/base64.c
new file mode 100644 (file)
index 0000000..aafb901
--- /dev/null
@@ -0,0 +1,605 @@
+/* base64.c -- Encode binary data using printable characters.
+   Copyright (C) 1999-2001, 2004-2006, 2009-2019 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Simon Josefsson.  Partially adapted from GNU MailUtils
+ * (mailbox/filter_trans.c, as of 2004-11-28).  Improved by review
+ * from Paul Eggert, Bruno Haible, and Stepan Kasal.
+ *
+ * See also RFC 4648 <https://www.ietf.org/rfc/rfc4648.txt>.
+ *
+ * Be careful with error checking.  Here is how you would typically
+ * use these functions:
+ *
+ * bool ok = base64_decode_alloc (in, inlen, &out, &outlen);
+ * if (!ok)
+ *   FAIL: input was not valid base64
+ * if (out == NULL)
+ *   FAIL: memory allocation error
+ * OK: data in OUT/OUTLEN
+ *
+ * size_t outlen = base64_encode_alloc (in, inlen, &out);
+ * if (out == NULL && outlen == 0 && inlen != 0)
+ *   FAIL: input too long
+ * if (out == NULL)
+ *   FAIL: memory allocation error
+ * OK: data in OUT/OUTLEN.
+ *
+ */
+
+#include <config.h>
+
+/* Get prototype. */
+#include "base64.h"
+
+/* Get malloc. */
+#include <stdlib.h>
+
+/* Get UCHAR_MAX. */
+#include <limits.h>
+
+#include <string.h>
+
+/* C89 compliant way to cast 'char' to 'unsigned char'. */
+static unsigned char
+to_uchar (char ch)
+{
+  return ch;
+}
+
+static const char b64c[64] =
+  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/* Base64 encode IN array of size INLEN into OUT array. OUT needs
+   to be of length >= BASE64_LENGTH(INLEN), and INLEN needs to be
+   a multiple of 3.  */
+static void
+base64_encode_fast (const char *restrict in, size_t inlen, char *restrict out)
+{
+  while (inlen)
+    {
+      *out++ = b64c[(to_uchar (in[0]) >> 2) & 0x3f];
+      *out++ = b64c[((to_uchar (in[0]) << 4) + (to_uchar (in[1]) >> 4)) & 0x3f];
+      *out++ = b64c[((to_uchar (in[1]) << 2) + (to_uchar (in[2]) >> 6)) & 0x3f];
+      *out++ = b64c[to_uchar (in[2]) & 0x3f];
+
+      inlen -= 3;
+      in += 3;
+    }
+}
+
+/* Base64 encode IN array of size INLEN into OUT array of size OUTLEN.
+   If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as
+   possible.  If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
+   terminate the output buffer. */
+void
+base64_encode (const char *restrict in, size_t inlen,
+               char *restrict out, size_t outlen)
+{
+  /* Note this outlen constraint can be enforced at compile time.
+     I.E. that the output buffer is exactly large enough to hold
+     the encoded inlen bytes.  The inlen constraints (of corresponding
+     to outlen, and being a multiple of 3) can change at runtime
+     at the end of input.  However the common case when reading
+     large inputs is to have both constraints satisfied, so we depend
+     on both in base_encode_fast().  */
+  if (outlen % 4 == 0 && inlen == outlen / 4 * 3)
+    {
+      base64_encode_fast (in, inlen, out);
+      return;
+    }
+
+  while (inlen && outlen)
+    {
+      *out++ = b64c[(to_uchar (in[0]) >> 2) & 0x3f];
+      if (!--outlen)
+        break;
+      *out++ = b64c[((to_uchar (in[0]) << 4)
+                       + (--inlen ? to_uchar (in[1]) >> 4 : 0))
+                      & 0x3f];
+      if (!--outlen)
+        break;
+      *out++ =
+        (inlen
+         ? b64c[((to_uchar (in[1]) << 2)
+                   + (--inlen ? to_uchar (in[2]) >> 6 : 0))
+                  & 0x3f]
+         : '=');
+      if (!--outlen)
+        break;
+      *out++ = inlen ? b64c[to_uchar (in[2]) & 0x3f] : '=';
+      if (!--outlen)
+        break;
+      if (inlen)
+        inlen--;
+      if (inlen)
+        in += 3;
+    }
+
+  if (outlen)
+    *out = '\0';
+}
+
+/* Allocate a buffer and store zero terminated base64 encoded data
+   from array IN of size INLEN, returning BASE64_LENGTH(INLEN), i.e.,
+   the length of the encoded data, excluding the terminating zero.  On
+   return, the OUT variable will hold a pointer to newly allocated
+   memory that must be deallocated by the caller.  If output string
+   length would overflow, 0 is returned and OUT is set to NULL.  If
+   memory allocation failed, OUT is set to NULL, and the return value
+   indicates length of the requested memory block, i.e.,
+   BASE64_LENGTH(inlen) + 1. */
+size_t
+base64_encode_alloc (const char *in, size_t inlen, char **out)
+{
+  size_t outlen = 1 + BASE64_LENGTH (inlen);
+
+  /* Check for overflow in outlen computation.
+   *
+   * If there is no overflow, outlen >= inlen.
+   *
+   * If the operation (inlen + 2) overflows then it yields at most +1, so
+   * outlen is 0.
+   *
+   * If the multiplication overflows, we lose at least half of the
+   * correct value, so the result is < ((inlen + 2) / 3) * 2, which is
+   * less than (inlen + 2) * 0.66667, which is less than inlen as soon as
+   * (inlen > 4).
+   */
+  if (inlen > outlen)
+    {
+      *out = NULL;
+      return 0;
+    }
+
+  *out = malloc (outlen);
+  if (!*out)
+    return outlen;
+
+  base64_encode (in, inlen, *out, outlen);
+
+  return outlen - 1;
+}
+
+/* With this approach this file works independent of the charset used
+   (think EBCDIC).  However, it does assume that the characters in the
+   Base64 alphabet (A-Za-z0-9+/) are encoded in 0..255.  POSIX
+   1003.1-2001 require that char and unsigned char are 8-bit
+   quantities, though, taking care of that problem.  But this may be a
+   potential problem on non-POSIX C99 platforms.
+
+   IBM C V6 for AIX mishandles "#define B64(x) ...'x'...", so use "_"
+   as the formal parameter rather than "x".  */
+#define B64(_)                                  \
+  ((_) == 'A' ? 0                               \
+   : (_) == 'B' ? 1                             \
+   : (_) == 'C' ? 2                             \
+   : (_) == 'D' ? 3                             \
+   : (_) == 'E' ? 4                             \
+   : (_) == 'F' ? 5                             \
+   : (_) == 'G' ? 6                             \
+   : (_) == 'H' ? 7                             \
+   : (_) == 'I' ? 8                             \
+   : (_) == 'J' ? 9                             \
+   : (_) == 'K' ? 10                            \
+   : (_) == 'L' ? 11                            \
+   : (_) == 'M' ? 12                            \
+   : (_) == 'N' ? 13                            \
+   : (_) == 'O' ? 14                            \
+   : (_) == 'P' ? 15                            \
+   : (_) == 'Q' ? 16                            \
+   : (_) == 'R' ? 17                            \
+   : (_) == 'S' ? 18                            \
+   : (_) == 'T' ? 19                            \
+   : (_) == 'U' ? 20                            \
+   : (_) == 'V' ? 21                            \
+   : (_) == 'W' ? 22                            \
+   : (_) == 'X' ? 23                            \
+   : (_) == 'Y' ? 24                            \
+   : (_) == 'Z' ? 25                            \
+   : (_) == 'a' ? 26                            \
+   : (_) == 'b' ? 27                            \
+   : (_) == 'c' ? 28                            \
+   : (_) == 'd' ? 29                            \
+   : (_) == 'e' ? 30                            \
+   : (_) == 'f' ? 31                            \
+   : (_) == 'g' ? 32                            \
+   : (_) == 'h' ? 33                            \
+   : (_) == 'i' ? 34                            \
+   : (_) == 'j' ? 35                            \
+   : (_) == 'k' ? 36                            \
+   : (_) == 'l' ? 37                            \
+   : (_) == 'm' ? 38                            \
+   : (_) == 'n' ? 39                            \
+   : (_) == 'o' ? 40                            \
+   : (_) == 'p' ? 41                            \
+   : (_) == 'q' ? 42                            \
+   : (_) == 'r' ? 43                            \
+   : (_) == 's' ? 44                            \
+   : (_) == 't' ? 45                            \
+   : (_) == 'u' ? 46                            \
+   : (_) == 'v' ? 47                            \
+   : (_) == 'w' ? 48                            \
+   : (_) == 'x' ? 49                            \
+   : (_) == 'y' ? 50                            \
+   : (_) == 'z' ? 51                            \
+   : (_) == '0' ? 52                            \
+   : (_) == '1' ? 53                            \
+   : (_) == '2' ? 54                            \
+   : (_) == '3' ? 55                            \
+   : (_) == '4' ? 56                            \
+   : (_) == '5' ? 57                            \
+   : (_) == '6' ? 58                            \
+   : (_) == '7' ? 59                            \
+   : (_) == '8' ? 60                            \
+   : (_) == '9' ? 61                            \
+   : (_) == '+' ? 62                            \
+   : (_) == '/' ? 63                            \
+   : -1)
+
+static const signed char b64[0x100] = {
+  B64 (0), B64 (1), B64 (2), B64 (3),
+  B64 (4), B64 (5), B64 (6), B64 (7),
+  B64 (8), B64 (9), B64 (10), B64 (11),
+  B64 (12), B64 (13), B64 (14), B64 (15),
+  B64 (16), B64 (17), B64 (18), B64 (19),
+  B64 (20), B64 (21), B64 (22), B64 (23),
+  B64 (24), B64 (25), B64 (26), B64 (27),
+  B64 (28), B64 (29), B64 (30), B64 (31),
+  B64 (32), B64 (33), B64 (34), B64 (35),
+  B64 (36), B64 (37), B64 (38), B64 (39),
+  B64 (40), B64 (41), B64 (42), B64 (43),
+  B64 (44), B64 (45), B64 (46), B64 (47),
+  B64 (48), B64 (49), B64 (50), B64 (51),
+  B64 (52), B64 (53), B64 (54), B64 (55),
+  B64 (56), B64 (57), B64 (58), B64 (59),
+  B64 (60), B64 (61), B64 (62), B64 (63),
+  B64 (64), B64 (65), B64 (66), B64 (67),
+  B64 (68), B64 (69), B64 (70), B64 (71),
+  B64 (72), B64 (73), B64 (74), B64 (75),
+  B64 (76), B64 (77), B64 (78), B64 (79),
+  B64 (80), B64 (81), B64 (82), B64 (83),
+  B64 (84), B64 (85), B64 (86), B64 (87),
+  B64 (88), B64 (89), B64 (90), B64 (91),
+  B64 (92), B64 (93), B64 (94), B64 (95),
+  B64 (96), B64 (97), B64 (98), B64 (99),
+  B64 (100), B64 (101), B64 (102), B64 (103),
+  B64 (104), B64 (105), B64 (106), B64 (107),
+  B64 (108), B64 (109), B64 (110), B64 (111),
+  B64 (112), B64 (113), B64 (114), B64 (115),
+  B64 (116), B64 (117), B64 (118), B64 (119),
+  B64 (120), B64 (121), B64 (122), B64 (123),
+  B64 (124), B64 (125), B64 (126), B64 (127),
+  B64 (128), B64 (129), B64 (130), B64 (131),
+  B64 (132), B64 (133), B64 (134), B64 (135),
+  B64 (136), B64 (137), B64 (138), B64 (139),
+  B64 (140), B64 (141), B64 (142), B64 (143),
+  B64 (144), B64 (145), B64 (146), B64 (147),
+  B64 (148), B64 (149), B64 (150), B64 (151),
+  B64 (152), B64 (153), B64 (154), B64 (155),
+  B64 (156), B64 (157), B64 (158), B64 (159),
+  B64 (160), B64 (161), B64 (162), B64 (163),
+  B64 (164), B64 (165), B64 (166), B64 (167),
+  B64 (168), B64 (169), B64 (170), B64 (171),
+  B64 (172), B64 (173), B64 (174), B64 (175),
+  B64 (176), B64 (177), B64 (178), B64 (179),
+  B64 (180), B64 (181), B64 (182), B64 (183),
+  B64 (184), B64 (185), B64 (186), B64 (187),
+  B64 (188), B64 (189), B64 (190), B64 (191),
+  B64 (192), B64 (193), B64 (194), B64 (195),
+  B64 (196), B64 (197), B64 (198), B64 (199),
+  B64 (200), B64 (201), B64 (202), B64 (203),
+  B64 (204), B64 (205), B64 (206), B64 (207),
+  B64 (208), B64 (209), B64 (210), B64 (211),
+  B64 (212), B64 (213), B64 (214), B64 (215),
+  B64 (216), B64 (217), B64 (218), B64 (219),
+  B64 (220), B64 (221), B64 (222), B64 (223),
+  B64 (224), B64 (225), B64 (226), B64 (227),
+  B64 (228), B64 (229), B64 (230), B64 (231),
+  B64 (232), B64 (233), B64 (234), B64 (235),
+  B64 (236), B64 (237), B64 (238), B64 (239),
+  B64 (240), B64 (241), B64 (242), B64 (243),
+  B64 (244), B64 (245), B64 (246), B64 (247),
+  B64 (248), B64 (249), B64 (250), B64 (251),
+  B64 (252), B64 (253), B64 (254), B64 (255)
+};
+
+#if UCHAR_MAX == 255
+# define uchar_in_range(c) true
+#else
+# define uchar_in_range(c) ((c) <= 255)
+#endif
+
+/* Return true if CH is a character from the Base64 alphabet, and
+   false otherwise.  Note that '=' is padding and not considered to be
+   part of the alphabet.  */
+bool
+isbase64 (char ch)
+{
+  return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)];
+}
+
+/* Initialize decode-context buffer, CTX.  */
+void
+base64_decode_ctx_init (struct base64_decode_context *ctx)
+{
+  ctx->i = 0;
+}
+
+/* If CTX->i is 0 or 4, there are four or more bytes in [*IN..IN_END), and
+   none of those four is a newline, then return *IN.  Otherwise, copy up to
+   4 - CTX->i non-newline bytes from that range into CTX->buf, starting at
+   index CTX->i and setting CTX->i to reflect the number of bytes copied,
+   and return CTX->buf.  In either case, advance *IN to point to the byte
+   after the last one processed, and set *N_NON_NEWLINE to the number of
+   verified non-newline bytes accessible through the returned pointer.  */
+static const char *
+get_4 (struct base64_decode_context *ctx,
+       char const *restrict *in, char const *restrict in_end,
+       size_t *n_non_newline)
+{
+  if (ctx->i == 4)
+    ctx->i = 0;
+
+  if (ctx->i == 0)
+    {
+      char const *t = *in;
+      if (4 <= in_end - *in && memchr (t, '\n', 4) == NULL)
+        {
+          /* This is the common case: no newline.  */
+          *in += 4;
+          *n_non_newline = 4;
+          return (const char *) t;
+        }
+    }
+
+  {
+    /* Copy non-newline bytes into BUF.  */
+    char const *p = *in;
+    while (p < in_end)
+      {
+        char c = *p++;
+        if (c != '\n')
+          {
+            ctx->buf[ctx->i++] = c;
+            if (ctx->i == 4)
+              break;
+          }
+      }
+
+    *in = p;
+    *n_non_newline = ctx->i;
+    return ctx->buf;
+  }
+}
+
+#define return_false                            \
+  do                                            \
+    {                                           \
+      *outp = out;                              \
+      return false;                             \
+    }                                           \
+  while (false)
+
+/* Decode up to four bytes of base64-encoded data, IN, of length INLEN
+   into the output buffer, *OUT, of size *OUTLEN bytes.  Return true if
+   decoding is successful, false otherwise.  If *OUTLEN is too small,
+   as many bytes as possible are written to *OUT.  On return, advance
+   *OUT to point to the byte after the last one written, and decrement
+   *OUTLEN to reflect the number of bytes remaining in *OUT.  */
+static bool
+decode_4 (char const *restrict in, size_t inlen,
+          char *restrict *outp, size_t *outleft)
+{
+  char *out = *outp;
+  if (inlen < 2)
+    return false;
+
+  if (!isbase64 (in[0]) || !isbase64 (in[1]))
+    return false;
+
+  if (*outleft)
+    {
+      *out++ = ((b64[to_uchar (in[0])] << 2)
+                | (b64[to_uchar (in[1])] >> 4));
+      --*outleft;
+    }
+
+  if (inlen == 2)
+    return_false;
+
+  if (in[2] == '=')
+    {
+      if (inlen != 4)
+        return_false;
+
+      if (in[3] != '=')
+        return_false;
+    }
+  else
+    {
+      if (!isbase64 (in[2]))
+        return_false;
+
+      if (*outleft)
+        {
+          *out++ = (((b64[to_uchar (in[1])] << 4) & 0xf0)
+                    | (b64[to_uchar (in[2])] >> 2));
+          --*outleft;
+        }
+
+      if (inlen == 3)
+        return_false;
+
+      if (in[3] == '=')
+        {
+          if (inlen != 4)
+            return_false;
+        }
+      else
+        {
+          if (!isbase64 (in[3]))
+            return_false;
+
+          if (*outleft)
+            {
+              *out++ = (((b64[to_uchar (in[2])] << 6) & 0xc0)
+                        | b64[to_uchar (in[3])]);
+              --*outleft;
+            }
+        }
+    }
+
+  *outp = out;
+  return true;
+}
+
+/* Decode base64-encoded input array IN of length INLEN to output array
+   OUT that can hold *OUTLEN bytes.  The input data may be interspersed
+   with newlines.  Return true if decoding was successful, i.e. if the
+   input was valid base64 data, false otherwise.  If *OUTLEN is too
+   small, as many bytes as possible will be written to OUT.  On return,
+   *OUTLEN holds the length of decoded bytes in OUT.  Note that as soon
+   as any non-alphabet, non-newline character is encountered, decoding
+   is stopped and false is returned.  If INLEN is zero, then process
+   only whatever data is stored in CTX.
+
+   Initially, CTX must have been initialized via base64_decode_ctx_init.
+   Subsequent calls to this function must reuse whatever state is recorded
+   in that buffer.  It is necessary for when a quadruple of base64 input
+   bytes spans two input buffers.
+
+   If CTX is NULL then newlines are treated as garbage and the input
+   buffer is processed as a unit.  */
+
+bool
+base64_decode_ctx (struct base64_decode_context *ctx,
+                   const char *restrict in, size_t inlen,
+                   char *restrict out, size_t *outlen)
+{
+  size_t outleft = *outlen;
+  bool ignore_newlines = ctx != NULL;
+  bool flush_ctx = false;
+  unsigned int ctx_i = 0;
+
+  if (ignore_newlines)
+    {
+      ctx_i = ctx->i;
+      flush_ctx = inlen == 0;
+    }
+
+
+  while (true)
+    {
+      size_t outleft_save = outleft;
+      if (ctx_i == 0 && !flush_ctx)
+        {
+          while (true)
+            {
+              /* Save a copy of outleft, in case we need to re-parse this
+                 block of four bytes.  */
+              outleft_save = outleft;
+              if (!decode_4 (in, inlen, &out, &outleft))
+                break;
+
+              in += 4;
+              inlen -= 4;
+            }
+        }
+
+      if (inlen == 0 && !flush_ctx)
+        break;
+
+      /* Handle the common case of 72-byte wrapped lines.
+         This also handles any other multiple-of-4-byte wrapping.  */
+      if (inlen && *in == '\n' && ignore_newlines)
+        {
+          ++in;
+          --inlen;
+          continue;
+        }
+
+      /* Restore OUT and OUTLEFT.  */
+      out -= outleft_save - outleft;
+      outleft = outleft_save;
+
+      {
+        char const *in_end = in + inlen;
+        char const *non_nl;
+
+        if (ignore_newlines)
+          non_nl = get_4 (ctx, &in, in_end, &inlen);
+        else
+          non_nl = in;  /* Might have nl in this case. */
+
+        /* If the input is empty or consists solely of newlines (0 non-newlines),
+           then we're done.  Likewise if there are fewer than 4 bytes when not
+           flushing context and not treating newlines as garbage.  */
+        if (inlen == 0 || (inlen < 4 && !flush_ctx && ignore_newlines))
+          {
+            inlen = 0;
+            break;
+          }
+        if (!decode_4 (non_nl, inlen, &out, &outleft))
+          break;
+
+        inlen = in_end - in;
+      }
+    }
+
+  *outlen -= outleft;
+
+  return inlen == 0;
+}
+
+/* Allocate an output buffer in *OUT, and decode the base64 encoded
+   data stored in IN of size INLEN to the *OUT buffer.  On return, the
+   size of the decoded data is stored in *OUTLEN.  OUTLEN may be NULL,
+   if the caller is not interested in the decoded length.  *OUT may be
+   NULL to indicate an out of memory error, in which case *OUTLEN
+   contains the size of the memory block needed.  The function returns
+   true on successful decoding and memory allocation errors.  (Use the
+   *OUT and *OUTLEN parameters to differentiate between successful
+   decoding and memory error.)  The function returns false if the
+   input was invalid, in which case *OUT is NULL and *OUTLEN is
+   undefined. */
+bool
+base64_decode_alloc_ctx (struct base64_decode_context *ctx,
+                         const char *in, size_t inlen, char **out,
+                         size_t *outlen)
+{
+  /* This may allocate a few bytes too many, depending on input,
+     but it's not worth the extra CPU time to compute the exact size.
+     The exact size is 3 * (inlen + (ctx ? ctx->i : 0)) / 4, minus 1 if the
+     input ends with "=" and minus another 1 if the input ends with "==".
+     Dividing before multiplying avoids the possibility of overflow.  */
+  size_t needlen = 3 * (inlen / 4) + 3;
+
+  *out = malloc (needlen);
+  if (!*out)
+    return true;
+
+  if (!base64_decode_ctx (ctx, in, inlen, *out, &needlen))
+    {
+      free (*out);
+      *out = NULL;
+      return false;
+    }
+
+  if (outlen)
+    *outlen = needlen;
+
+  return true;
+}
diff --git a/lib/base64.h b/lib/base64.h
new file mode 100644 (file)
index 0000000..a0360dc
--- /dev/null
@@ -0,0 +1,68 @@
+/* base64.h -- Encode binary data using printable characters.
+   Copyright (C) 2004-2006, 2009-2019 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef BASE64_H
+# define BASE64_H
+
+/* Get size_t. */
+# include <stddef.h>
+
+/* Get bool. */
+# include <stdbool.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* This uses that the expression (n+(k-1))/k means the smallest
+   integer >= n/k, i.e., the ceiling of n/k.  */
+# define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
+
+struct base64_decode_context
+{
+  unsigned int i;
+  char buf[4];
+};
+
+extern bool isbase64 (char ch) __attribute__ ((__const__));
+
+extern void base64_encode (const char *restrict in, size_t inlen,
+                           char *restrict out, size_t outlen);
+
+extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
+
+extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
+
+extern bool base64_decode_ctx (struct base64_decode_context *ctx,
+                               const char *restrict in, size_t inlen,
+                               char *restrict out, size_t *outlen);
+
+extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
+                                     const char *in, size_t inlen,
+                                     char **out, size_t *outlen);
+
+#define base64_decode(in, inlen, out, outlen) \
+        base64_decode_ctx (NULL, in, inlen, out, outlen)
+
+#define base64_decode_alloc(in, inlen, out, outlen) \
+        base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif /* BASE64_H */
diff --git a/lib/bitlk/bitlk.c b/lib/bitlk/bitlk.c
new file mode 100644 (file)
index 0000000..2ce3a94
--- /dev/null
@@ -0,0 +1,1217 @@
+/*
+ * BITLK (BitLocker-compatible) volume handling
+ *
+ * Copyright (C) 2019-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2019-2020 Milan Broz
+ * Copyright (C) 2019-2020 Vojtech Trefny
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <uuid/uuid.h>
+#include <time.h>
+#include <iconv.h>
+#include <limits.h>
+
+#include "bitlk.h"
+#include "internal.h"
+
+#define BITLK_BOOTCODE_V1 "\xeb\x52\x90"
+#define BITLK_BOOTCODE_V2 "\xeb\x58\x90"
+#define BITLK_SIGNATURE "-FVE-FS-"
+#define BITLK_SIGNATURE_TOGO "MSWIN4.1"
+#define BITLK_HEADER_METADATA_OFFSET 160
+#define BITLK_HEADER_METADATA_OFFSET_TOGO 424
+
+/* FVE metadata header is split into two parts */
+#define BITLK_FVE_METADATA_BLOCK_HEADER_LEN 64
+#define BITLK_FVE_METADATA_HEADER_LEN 48
+#define BITLK_FVE_METADATA_HEADERS_LEN BITLK_FVE_METADATA_BLOCK_HEADER_LEN + BITLK_FVE_METADATA_HEADER_LEN
+
+/* total size of the FVE area (64 KiB) */
+#define BITLK_FVE_METADATA_SIZE 64 * 1024
+
+#define BITLK_ENTRY_HEADER_LEN 8
+#define BITLK_VMK_HEADER_LEN 28
+
+#define BITLK_OPEN_KEY_METADATA_LEN 12
+
+#define BITLK_RECOVERY_KEY_LEN 55
+#define BITLK_RECOVERY_PARTS 8
+#define BITLK_RECOVERY_PART_LEN 6
+
+#define BITLK_KDF_HASH "sha256"
+#define BITLK_KDF_ITERATION_COUNT 0x100000
+
+/* maximum number of segments for the DM device */
+#define MAX_BITLK_SEGMENTS 10
+
+/* January 1, 1970 as MS file time */
+#define EPOCH_AS_FILETIME 116444736000000000
+#define HUNDREDS_OF_NANOSECONDS 10000000
+
+/* not available in older version of libuuid */
+#ifndef UUID_STR_LEN
+#define UUID_STR_LEN   37
+#endif
+
+/* known types of GUIDs from the BITLK superblock */
+const uint8_t BITLK_GUID_NORMAL[16] = { 0x3b, 0xd6, 0x67, 0x49, 0x29, 0x2e, 0xd8, 0x4a,
+                                       0x83, 0x99, 0xf6, 0xa3, 0x39, 0xe3, 0xd0, 0x01 };
+const uint8_t BITLK_GUID_EOW[16] = { 0x3b, 0x4d, 0xa8, 0x92, 0x80, 0xdd, 0x0e, 0x4d,
+                                    0x9e, 0x4e, 0xb1, 0xe3, 0x28, 0x4e, 0xae, 0xd8 };
+
+/* taken from libfdisk gpt.c -- TODO: this is a good candidate for adding to libuuid */
+struct bitlk_guid {
+       uint32_t   time_low;
+       uint16_t   time_mid;
+       uint16_t   time_hi_and_version;
+       uint8_t    clock_seq_hi;
+       uint8_t    clock_seq_low;
+       uint8_t    node[6];
+} __attribute__ ((packed));
+
+static void swap_guid(struct bitlk_guid *guid) {
+       guid->time_low = swab32(guid->time_low);
+       guid->time_mid = swab16(guid->time_mid);
+       guid->time_hi_and_version = swab16(guid->time_hi_and_version);
+}
+
+static void guid_to_string(struct bitlk_guid *guid, char *out) {
+       swap_guid(guid);
+       uuid_unparse((unsigned char *) guid, out);
+}
+
+typedef enum {
+       BITLK_SEGTYPE_CRYPT,
+       BITLK_SEGTYPE_ZERO,
+} BitlkSegmentType;
+
+struct segment {
+       uint64_t offset;
+       uint64_t length;
+       uint64_t iv_offset;
+       BitlkSegmentType type;
+};
+
+struct bitlk_signature {
+       uint8_t boot_code[3];
+       uint8_t signature[8];
+       uint16_t sector_size;
+} __attribute__ ((packed));
+
+struct bitlk_superblock {
+       struct bitlk_guid guid;
+       uint64_t fve_offset[3];
+} __attribute__ ((packed));
+
+struct bitlk_fve_metadata {
+       /* FVE metadata block header */
+       uint8_t signature[8];
+       uint16_t fve_size;
+       uint16_t fve_version;
+       uint16_t curr_state;
+       uint16_t next_state;
+       uint64_t volume_size;
+       uint32_t unknown2;
+       uint32_t volume_header_size;
+       uint64_t fve_offset[3];
+       uint64_t volume_header_offset;
+       /* FVE metadata header */
+       uint32_t metadata_size;
+       uint32_t metadata_version;
+       uint32_t metadata_header_size;
+       uint32_t metada_size_copy;
+       struct bitlk_guid guid;
+       uint32_t next_nonce;
+       uint16_t encryption;
+       uint16_t unknown3;
+       uint64_t creation_time;
+} __attribute__ ((packed));
+
+struct bitlk_entry_header_block {
+       uint64_t offset;
+       uint64_t size;
+} __attribute__ ((packed));
+
+struct bitlk_entry_vmk {
+       struct bitlk_guid guid;
+       uint8_t modified[8];
+       uint16_t _unknown;
+       uint16_t protection;
+} __attribute__ ((packed));
+
+struct bitlk_kdf_data {
+       char last_sha256[32];
+       char initial_sha256[32];
+       char salt[16];
+       uint64_t count;
+};
+
+static BITLKVMKProtection get_vmk_protection(uint16_t protection)
+{
+       switch (protection) {
+       case 0x0000:
+               return BITLK_PROTECTION_CLEAR_KEY;
+       case 0x0100:
+               return BITLK_PROTECTION_TPM;
+       case 0x0200:
+               return BITLK_PROTECTION_STARTUP_KEY;
+       case 0x0500:
+               return BITLK_PROTECTION_TPM_PIN;
+       case 0x0800:
+               return BITLK_PROTECTION_RECOVERY_PASSPHRASE;
+       case 0x1000:
+               return BITLK_PROTECTION_SMART_CARD;
+       case 0x2000:
+               return BITLK_PROTECTION_PASSPHRASE;
+       default:
+               return BITLK_PROTECTION_UNKNOWN;
+       }
+}
+
+static const char* get_vmk_protection_string(BITLKVMKProtection protection)
+{
+       switch (protection) {
+       case BITLK_PROTECTION_CLEAR_KEY:
+               return "VMK protected with clear key";
+       case BITLK_PROTECTION_TPM:
+               return "VMK protected with TPM";
+       case BITLK_PROTECTION_STARTUP_KEY:
+               return "VMK protected with startup key";
+       case BITLK_PROTECTION_TPM_PIN:
+               return "VMK protected with TPM and PIN";
+       case BITLK_PROTECTION_PASSPHRASE:
+               return "VMK protected with passphrase";
+       case BITLK_PROTECTION_RECOVERY_PASSPHRASE:
+               return "VMK protected with recovery passphrase";
+       case BITLK_PROTECTION_SMART_CARD:
+               return "VMK protected with smart card";
+       default:
+               return "VMK with unknown protection";
+       }
+}
+
+static const char* get_bitlk_type_string(BITLKEncryptionType type)
+{
+       switch (type)
+       {
+       case BITLK_ENCRYPTION_TYPE_NORMAL:
+               return "normal";
+       case BITLK_ENCRYPTION_TYPE_EOW:
+               return "encrypt-on-write";
+       default:
+               return "unknown";
+       }
+}
+
+/* TODO -- move to some utils file */
+static void hexprint(struct crypt_device *cd, const char *d, int n, const char *sep)
+{
+       int i;
+       for(i = 0; i < n; i++)
+               log_std(cd, "%02hhx%s", (const char)d[i], sep);
+}
+
+static uint64_t filetime_to_unixtime(uint64_t time)
+{
+       return (time - EPOCH_AS_FILETIME) / HUNDREDS_OF_NANOSECONDS;
+}
+
+static int convert_to_utf8(struct crypt_device *cd, uint8_t *input, size_t inlen, char **out)
+{
+       char *outbuf = NULL;
+       iconv_t ic;
+       size_t ic_inlen = inlen;
+       size_t ic_outlen = inlen;
+       char *ic_outbuf = NULL;
+       size_t r = 0;
+
+       outbuf = malloc(inlen);
+       if (outbuf == NULL)
+               return -ENOMEM;
+
+       memset(outbuf, 0, inlen);
+       ic_outbuf = outbuf;
+
+       ic = iconv_open("UTF-8", "UTF-16LE");
+       r = iconv(ic, (char **) &input, &ic_inlen, &ic_outbuf, &ic_outlen);
+       iconv_close(ic);
+
+       if (r == 0)
+               *out = strdup(outbuf);
+       else {
+               *out = NULL;
+               log_dbg(cd, "Failed to convert volume description: %s", strerror(errno));
+               r = 0;
+       }
+
+       free(outbuf);
+       return r;
+}
+
+static int passphrase_to_utf16(struct crypt_device *cd, char *input, size_t inlen, char **out)
+{
+       char *outbuf = NULL;
+       iconv_t ic;
+       size_t ic_inlen = inlen;
+       size_t ic_outlen = inlen * 2;
+       char *ic_outbuf = NULL;
+       size_t r = 0;
+
+       if (inlen == 0)
+               return r;
+
+       outbuf = crypt_safe_alloc(inlen * 2);
+       if (outbuf == NULL)
+               return -ENOMEM;
+
+       memset(outbuf, 0, inlen * 2);
+       ic_outbuf = outbuf;
+
+       ic = iconv_open("UTF-16LE", "UTF-8");
+       r = iconv(ic, &input, &ic_inlen, &ic_outbuf, &ic_outlen);
+       iconv_close(ic);
+
+       if (r == 0) {
+               *out = outbuf;
+       } else {
+               *out = NULL;
+               crypt_safe_free(outbuf);
+               log_dbg(cd, "Failed to convert passphrase: %s", strerror(errno));
+               r = -errno;
+       }
+
+       return r;
+}
+
+static int parse_vmk_entry(struct crypt_device *cd, uint8_t *data, int start, int end, struct bitlk_vmk **vmk)
+{
+       uint16_t key_entry_size = 0;
+       uint16_t key_entry_type = 0;
+       uint16_t key_entry_value = 0;
+       size_t key_size = 0;
+       char *string = NULL;
+       const char *key = NULL;
+       struct volume_key *vk = NULL;
+       bool supported = false;
+
+       /* only passphrase or recovery passphrase vmks are supported (can be used to activate) */
+       supported = (*vmk)->protection == BITLK_PROTECTION_PASSPHRASE || (*vmk)->protection == BITLK_PROTECTION_RECOVERY_PASSPHRASE;
+
+       while (end - start > 2) {
+               /* size of this entry */
+               memcpy(&key_entry_size, data + start, sizeof(key_entry_size));
+               key_entry_size = le16_to_cpu(key_entry_size);
+               if (key_entry_size == 0)
+                       break;
+
+               /* type and value of this entry */
+               memcpy(&key_entry_type, data + start + sizeof(key_entry_size), sizeof(key_entry_type));
+               memcpy(&key_entry_value,
+                      data + start + sizeof(key_entry_size) + sizeof(key_entry_type),
+                      sizeof(key_entry_value));
+               key_entry_type = le16_to_cpu(key_entry_type);
+               key_entry_value = le16_to_cpu(key_entry_value);
+
+               if (key_entry_type != BITLK_ENTRY_TYPE_PROPERTY) {
+                       if (supported) {
+                               log_err(cd, _("Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."), key_entry_type);
+                               return -EINVAL;
+                       } else {
+                               log_dbg(cd, "Unexpected metadata entry type '%u' found when parsing unsupported VMK.", key_entry_type);
+                       }
+               }
+
+               /* stretch key with salt, skip 4 B (encryption method of the stretch key) */
+               if (key_entry_value == BITLK_ENTRY_VALUE_STRETCH_KEY)
+                       memcpy((*vmk)->salt,
+                              data + start + BITLK_ENTRY_HEADER_LEN + 4,
+                              sizeof((*vmk)->salt));
+               /* AES-CCM encrypted key */
+               else if (key_entry_value == BITLK_ENTRY_VALUE_ENCRYPTED_KEY) {
+                       /* nonce */
+                       memcpy((*vmk)->nonce,
+                              data + start + BITLK_ENTRY_HEADER_LEN,
+                              sizeof((*vmk)->nonce));
+                       /* MAC tag */
+                       memcpy((*vmk)->mac_tag,
+                              data + start + BITLK_ENTRY_HEADER_LEN + BITLK_NONCE_SIZE,
+                              sizeof((*vmk)->mac_tag));
+                       /* AES-CCM encrypted key */
+                       key_size = key_entry_size - (BITLK_ENTRY_HEADER_LEN + BITLK_NONCE_SIZE + BITLK_VMK_MAC_TAG_SIZE);
+                       key = (const char *) data + start + BITLK_ENTRY_HEADER_LEN + BITLK_NONCE_SIZE + BITLK_VMK_MAC_TAG_SIZE;
+                       vk = crypt_alloc_volume_key(key_size, key);
+                       if (vk == NULL)
+                               return -ENOMEM;
+                       crypt_volume_key_add_next(&((*vmk)->vk), vk);
+               /* clear key for a partially decrypted volume */
+               } else if (key_entry_value == BITLK_ENTRY_VALUE_KEY) {
+                       /* We currently don't want to support opening a partially decrypted
+                        * device so we don't need to store this key.
+                        *
+                        * key_size = key_entry_size - (BITLK_ENTRY_HEADER_LEN + 4);
+                        * key = (const char *) data + start + BITLK_ENTRY_HEADER_LEN + 4;
+                        * vk = crypt_alloc_volume_key(key_size, key);
+                        * if (vk == NULL)
+                        *      return -ENOMEM;
+                        * crypt_volume_key_add_next(&((*vmk)->vk), vk);
+                        */
+                       log_dbg(cd, "Skipping clear key metadata entry.");
+               /* unknown timestamps in recovery protected VMK */
+               } else if (key_entry_value == BITLK_ENTRY_VALUE_RECOVERY_TIME) {
+                       ;
+               } else if (key_entry_value == BITLK_ENTRY_VALUE_STRING) {
+                       if (convert_to_utf8(cd, data + start + BITLK_ENTRY_HEADER_LEN, key_entry_size - BITLK_ENTRY_HEADER_LEN, &string) < 0) {
+                               log_err(cd, _("Invalid string found when parsing Volume Master Key."));
+                               free(string);
+                               return -EINVAL;
+                       } else if ((*vmk)->name != NULL) {
+                               if (supported) {
+                                       log_err(cd, _("Unexpected string ('%s') found when parsing supported Volume Master Key."), string);
+                                       free(string);
+                                       return -EINVAL;
+                               }
+                               log_dbg(cd, "Unexpected string ('%s') found when parsing unsupported VMK.", string);
+                               free(string);
+                               string = NULL;
+                       } else {
+                               /* Assume that strings in VMK are the name of the VMK */
+                               (*vmk)->name = string;
+                               string = NULL;
+                       }
+               } else {
+                       if (supported) {
+                               log_err(cd, _("Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."), key_entry_value);
+                               return -EINVAL;
+                       } else {
+                               log_dbg(cd, "Unexpected metadata entry value '%u' found when parsing unsupported VMK.", key_entry_value);
+                       }
+               }
+
+               start += key_entry_size;
+       }
+
+       return 0;
+}
+
+void BITLK_bitlk_fvek_free(struct bitlk_fvek *fvek)
+{
+       if (!fvek)
+               return;
+
+       crypt_free_volume_key(fvek->vk);
+       free(fvek);
+}
+
+void BITLK_bitlk_vmk_free(struct bitlk_vmk *vmk)
+{
+       struct bitlk_vmk *vmk_next = NULL;
+
+       while (vmk) {
+               if (vmk->guid)
+                       free(vmk->guid);
+               if (vmk->name)
+                       free(vmk->name);
+               crypt_free_volume_key(vmk->vk);
+               vmk_next = vmk->next;
+               free(vmk);
+               vmk = vmk_next;
+       }
+}
+
+void BITLK_bitlk_metadata_free(struct bitlk_metadata *metadata)
+{
+       free(metadata->guid);
+       if (metadata->description)
+               free(metadata->description);
+       BITLK_bitlk_vmk_free(metadata->vmks);
+       BITLK_bitlk_fvek_free(metadata->fvek);
+}
+
+int BITLK_read_sb(struct crypt_device *cd, struct bitlk_metadata *params)
+{
+       int devfd;
+       struct device *device = crypt_metadata_device(cd);
+       struct bitlk_signature sig = {};
+       struct bitlk_superblock sb = {};
+       struct bitlk_fve_metadata fve = {};
+       struct bitlk_entry_vmk entry_vmk = {};
+       uint8_t *fve_entries = NULL;
+       uint32_t fve_metadata_size = 0;
+       int fve_offset = 0;
+       char guid_buf[UUID_STR_LEN] = {0};
+       uint16_t entry_size = 0;
+       uint16_t entry_type = 0;
+       int i = 0;
+       int r = 0;
+       int start = 0;
+       int end = 0;
+       size_t key_size = 0;
+       const char *key = NULL;
+
+       struct bitlk_vmk *vmk = NULL;
+       struct bitlk_vmk *vmk_p = params->vmks;
+
+       devfd = device_open(cd, crypt_data_device(cd), O_RDONLY);
+       if (devfd < 0) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       /* read and check the signature */
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+               device_alignment(device), &sig, sizeof(sig), 0) != sizeof(sig)) {
+               log_err(cd, _("Failed to read BITLK signature from %s."), device_path(device));
+               r = -EINVAL;
+               goto out;
+       }
+
+       if (memcmp(sig.boot_code, BITLK_BOOTCODE_V1, sizeof(sig.boot_code)) == 0) {
+               log_err(cd, _("BITLK version 1 is currently not supported."));
+               r = -ENOTSUP;
+               goto out;
+       } else if (memcmp(sig.boot_code, BITLK_BOOTCODE_V2, sizeof(sig.boot_code)) == 0)
+               ;
+       else {
+               log_err(cd, _("Invalid or unknown boot signature for BITLK device."));
+               r = -EINVAL;
+               goto out;
+       }
+
+       if (memcmp(sig.signature, BITLK_SIGNATURE, sizeof(sig.signature)) == 0) {
+               params->togo = false;
+               fve_offset = BITLK_HEADER_METADATA_OFFSET;
+       } else if (memcmp(sig.signature, BITLK_SIGNATURE_TOGO, sizeof(sig.signature)) == 0) {
+               params->togo = true;
+               fve_offset = BITLK_HEADER_METADATA_OFFSET_TOGO;
+       } else {
+               log_err(cd, _("Invalid or unknown signature for BITLK device."));
+               r = -EINVAL;
+               goto out;
+       }
+
+       params->sector_size = le16_to_cpu(sig.sector_size);
+       if (!(params->sector_size == 512 || params->sector_size == 4096)) {
+               log_err(cd, _("Unsupported sector size %" PRIu16 "."), params->sector_size);
+               r = -EINVAL;
+               goto out;
+       }
+
+       /* read GUID and FVE metadata offsets */
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+               device_alignment(device), &sb, sizeof(sb), fve_offset) != sizeof(sb)) {
+               log_err(cd, _("Failed to read BITLK header from %s."), device_path(device));
+               r = -EINVAL;
+               goto out;
+       }
+
+       /* get encryption "type" based on the GUID from BITLK superblock */
+       if (memcmp(&sb.guid, BITLK_GUID_NORMAL, 16) == 0)
+               params->type = BITLK_ENCRYPTION_TYPE_NORMAL;
+       else if (memcmp(&sb.guid, BITLK_GUID_EOW, 16) == 0)
+               params->type = BITLK_ENCRYPTION_TYPE_EOW;
+       else
+               params->type = BITLK_ENCRYPTION_TYPE_UNKNOWN;
+       log_dbg(cd, "BITLK type from GUID: %s.", get_bitlk_type_string(params->type));
+
+       for (i = 0; i < 3; i++)
+               params->metadata_offset[i] = le64_to_cpu(sb.fve_offset[i]);
+
+       log_dbg(cd, "Reading BITLK FVE metadata of size %zu on device %s, offset %" PRIu64 ".",
+               sizeof(fve), device_path(device), params->metadata_offset[0]);
+
+       /* read FVE metadata from the first metadata area */
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+               device_alignment(device), &fve, sizeof(fve), params->metadata_offset[0]) != sizeof(fve) ||
+               memcmp(fve.signature, BITLK_SIGNATURE, sizeof(fve.signature)) ||
+               le16_to_cpu(fve.fve_version) != 2) {
+               log_err(cd, _("Failed to read BITLK FVE metadata from %s."), device_path(device));
+               r = -EINVAL;
+               goto out;
+       }
+
+       /* check encryption state for the device */
+       params->state = true;
+       if (le16_to_cpu(fve.curr_state) != BITLK_STATE_NORMAL || le16_to_cpu(fve.next_state) != BITLK_STATE_NORMAL) {
+               params->state = false;
+               log_dbg(cd, "Unknown/unsupported state detected. Current state: %"PRIu16", next state: %"PRIu16".",
+                       le16_to_cpu(fve.curr_state), le16_to_cpu(fve.next_state));
+       }
+
+       params->metadata_version = le16_to_cpu(fve.fve_version);
+       fve_metadata_size = le32_to_cpu(fve.metadata_size);
+
+       switch (le16_to_cpu(fve.encryption)) {
+       /* AES-CBC with Elephant difuser */
+       case 0x8000:
+               params->key_size = 128;
+               params->cipher = "aes";
+               params->cipher_mode = "cbc-elephant";
+               break;
+       case 0x8001:
+               params->key_size = 256;
+               params->cipher = "aes";
+               params->cipher_mode = "cbc-elephant";
+               break;
+       /* AES-CBC */
+       case 0x8002:
+               params->key_size = 128;
+               params->cipher = "aes";
+               params->cipher_mode = "cbc-eboiv";
+               break;
+       case 0x8003:
+               params->key_size = 256;
+               params->cipher = "aes";
+               params->cipher_mode = "cbc-eboiv";
+               break;
+       /* AES-XTS */
+       case 0x8004:
+               params->key_size = 128;
+               params->cipher = "aes";
+               params->cipher_mode = "xts-plain64";
+               break;
+       case 0x8005:
+               params->key_size = 256;
+               params->cipher = "aes";
+               params->cipher_mode = "xts-plain64";
+               break;
+       default:
+               log_err(cd, _("Unknown or unsupported encryption type."));
+               params->key_size = 0;
+               params->cipher = NULL;
+               params->cipher_mode = NULL;
+               r = -ENOTSUP;
+               goto out;
+       };
+
+       /* device GUID */
+       guid_to_string(&fve.guid, guid_buf);
+       params->guid = strdup(guid_buf);
+       if (!params->guid) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       params->creation_time = filetime_to_unixtime(le64_to_cpu(fve.creation_time));
+
+       /* read and parse all FVE metadata entries */
+       fve_entries = malloc(fve_metadata_size - BITLK_FVE_METADATA_HEADER_LEN);
+       if (!fve_entries) {
+               r = -ENOMEM;
+               goto out;
+       }
+       memset(fve_entries, 0, (fve_metadata_size - BITLK_FVE_METADATA_HEADER_LEN));
+
+       log_dbg(cd, "Reading BITLK FVE metadata entries of size %" PRIu32 " on device %s, offset %" PRIu64 ".",
+               fve_metadata_size - BITLK_FVE_METADATA_HEADER_LEN, device_path(device),
+               params->metadata_offset[0] + BITLK_FVE_METADATA_HEADERS_LEN);
+
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+               device_alignment(device), fve_entries, fve_metadata_size - BITLK_FVE_METADATA_HEADER_LEN,
+               params->metadata_offset[0] + BITLK_FVE_METADATA_HEADERS_LEN) != fve_metadata_size - BITLK_FVE_METADATA_HEADER_LEN) {
+               log_err(cd, _("Failed to read BITLK metadata entries from %s."), device_path(device));
+               r = -EINVAL;
+               goto out;
+       }
+
+       end = fve_metadata_size - BITLK_FVE_METADATA_HEADER_LEN;
+       while (end - start > 2) {
+               /* size of this entry */
+               memcpy(&entry_size, fve_entries + start, sizeof(entry_size));
+               entry_size = le16_to_cpu(entry_size);
+               if (entry_size == 0)
+                       break;
+
+               /* type of this entry */
+               memcpy(&entry_type, fve_entries + start + sizeof(entry_size), sizeof(entry_type));
+               entry_type = le16_to_cpu(entry_type);
+
+               /* VMK */
+               if (entry_type == BITLK_ENTRY_TYPE_VMK) {
+                       /* skip first four variables in the entry (entry size, type, value and version) */
+                       memcpy(&entry_vmk,
+                              fve_entries + start + BITLK_ENTRY_HEADER_LEN,
+                              sizeof(entry_vmk));
+
+                       vmk = malloc(sizeof(struct bitlk_vmk));
+                       memset(vmk, 0, sizeof(struct bitlk_vmk));
+
+                       guid_to_string(&entry_vmk.guid, guid_buf);
+                       vmk->guid = strdup (guid_buf);
+
+                       vmk->name = NULL;
+
+                       vmk->protection = get_vmk_protection(le16_to_cpu(entry_vmk.protection));
+
+                       /* more data in another entry list */
+                       r = parse_vmk_entry(cd, fve_entries,
+                                             start + BITLK_ENTRY_HEADER_LEN + BITLK_VMK_HEADER_LEN,
+                                             start + entry_size, &vmk);
+                       if (r < 0) {
+                               BITLK_bitlk_vmk_free(vmk);
+                               goto out;
+                       }
+
+                       if (params->vmks == NULL)
+                               params->vmks = vmk;
+                       else
+                               vmk_p->next = vmk;
+
+                       vmk_p = vmk;
+                       vmk = vmk->next;
+               /* FVEK */
+               } else if (entry_type == BITLK_ENTRY_TYPE_FVEK) {
+                       params->fvek = malloc(sizeof(struct bitlk_fvek));
+                       memcpy(params->fvek->nonce,
+                              fve_entries + start + BITLK_ENTRY_HEADER_LEN,
+                              sizeof(params->fvek->nonce));
+                       /* MAC tag */
+                       memcpy(params->fvek->mac_tag,
+                              fve_entries + start + BITLK_ENTRY_HEADER_LEN + BITLK_NONCE_SIZE,
+                              sizeof(params->fvek->mac_tag));
+                       /* AES-CCM encrypted key */
+                       key_size = entry_size - (BITLK_ENTRY_HEADER_LEN + BITLK_NONCE_SIZE + BITLK_VMK_MAC_TAG_SIZE);
+                       key = (const char *) fve_entries + start + BITLK_ENTRY_HEADER_LEN + BITLK_NONCE_SIZE + BITLK_VMK_MAC_TAG_SIZE;
+                       params->fvek->vk = crypt_alloc_volume_key(key_size, key);
+                       if (params->fvek->vk == NULL) {
+                               r = -ENOMEM;
+                               goto out;
+                       }
+               /* volume header info (location and size) */
+               } else if (entry_type == BITLK_ENTRY_TYPE_VOLUME_HEADER) {
+                       struct bitlk_entry_header_block entry_header;
+                       memcpy(&entry_header,
+                              fve_entries + start + BITLK_ENTRY_HEADER_LEN,
+                              sizeof(entry_header));
+                       params->volume_header_offset = le64_to_cpu(entry_header.offset);
+                       params->volume_header_size = le64_to_cpu(entry_header.size);
+               /* volume description (utf-16 string) */
+               } else if (entry_type == BITLK_ENTRY_TYPE_DESCRIPTION) {
+                       r = convert_to_utf8(cd, fve_entries + start + BITLK_ENTRY_HEADER_LEN,
+                                           entry_size - BITLK_ENTRY_HEADER_LEN,
+                                           &(params->description));
+                       if (r < 0) {
+                               BITLK_bitlk_vmk_free(vmk);
+                               goto out;
+                       }
+               }
+
+               start += entry_size;
+       }
+
+out:
+       if (fve_entries)
+               free(fve_entries);
+       return r;
+}
+
+int BITLK_dump(struct crypt_device *cd, struct device *device, struct bitlk_metadata *params)
+{
+       struct volume_key *vk_p;
+       struct bitlk_vmk *vmk_p;
+       int next_id = 0;
+       int i = 0;
+
+       log_std(cd, "Info for BITLK%s device %s.\n", params->togo ? " To Go" : "", device_path(device));
+       log_std(cd, "Version:      \t%u\n", params->metadata_version);
+       log_std(cd, "GUID:         \t%s\n", params->guid);
+       log_std(cd, "Sector size:  \t%u [bytes]\n", params->sector_size);
+       log_std(cd, "Created:      \t%s", ctime((time_t *)&(params->creation_time)));
+       log_std(cd, "Description:  \t%s\n", params->description);
+       log_std(cd, "Cipher name:  \t%s\n", params->cipher);
+       log_std(cd, "Cipher mode:  \t%s\n", params->cipher_mode);
+       log_std(cd, "Cipher key:   \t%u bits\n", params->key_size);
+
+       log_std(cd, "\n");
+
+       log_std(cd, "Keyslots:\n");
+       vmk_p = params->vmks;
+       while (vmk_p) {
+               log_std(cd, " %d: VMK\n", next_id);
+               if (vmk_p->name != NULL) {
+                       log_std(cd, "\tName:       \t%s\n", vmk_p->name);
+               }
+               log_std(cd, "\tGUID:       \t%s\n", vmk_p->guid);
+               log_std(cd, "\tProtection: \t%s\n", get_vmk_protection_string (vmk_p->protection));
+               log_std(cd, "\tSalt:       \t");
+               hexprint(cd, (const char *) vmk_p->salt, 16, "");
+               log_std(cd, "\n");
+
+               vk_p = vmk_p->vk;
+               while (vk_p) {
+                       log_std(cd, "\tKey data size:\t%zu [bytes]\n", vk_p->keylength);
+                       vk_p = vk_p->next;
+               }
+               vmk_p = vmk_p->next;
+               next_id++;
+       }
+
+       log_std(cd, " %d: FVEK\n", next_id);
+       log_std(cd, "\tKey data size:\t%zu [bytes]\n", params->fvek->vk->keylength);
+
+       log_std(cd, "\n");
+
+       log_std(cd, "Metadata segments:\n");
+
+       for (i = 0; i < 3; i++) {
+               log_std(cd, " %d: FVE metadata area\n", i);
+               log_std(cd, "\tOffset: \t%" PRIu64 " [bytes]\n", params->metadata_offset[i]);
+               log_std(cd, "\tSize:   \t%d [bytes]\n", BITLK_FVE_METADATA_SIZE);
+       }
+
+       log_std(cd, " %d: Volume header\n", i);
+       log_std(cd, "\tOffset: \t%" PRIu64 " [bytes]\n", params->volume_header_offset);
+       log_std(cd, "\tSize:   \t%" PRIu64 " [bytes]\n", params->volume_header_size);
+       log_std(cd, "\tCipher: \t%s-%s\n", params->cipher, params->cipher_mode);
+
+       return 0;
+}
+
+/* check if given passphrase can be a recovery key (has right format) and convert it */
+static int get_recovery_key(struct crypt_device *cd,
+                           const char *password,
+                           size_t passwordLen,
+                           struct volume_key **rc_key)
+{
+       unsigned int i, j = 0;
+       uint16_t parts[BITLK_RECOVERY_PARTS] = {0};
+       char part_str[BITLK_RECOVERY_PART_LEN + 1] = {0};
+       long part_num = 0;
+
+       /* check the passphrase it should be:
+           - 55 characters
+           - 8 groups of 6 divided by '-'
+           - each part is a number dividable by 11
+       */
+       if (passwordLen != BITLK_RECOVERY_KEY_LEN) {
+                if (passwordLen == BITLK_RECOVERY_KEY_LEN + 1 && password[passwordLen - 1] == '\n') {
+                        /* looks like a recovery key with an extra newline, possibly from a key file */
+                        passwordLen--;
+                        log_dbg(cd, "Possible extra EOL stripped from the recovery key.");
+                } else
+                        return 0;
+        }
+
+       for (i = BITLK_RECOVERY_PART_LEN; i < passwordLen; i += BITLK_RECOVERY_PART_LEN + 1) {
+               if (password[i] != '-')
+                       return 0;
+       }
+
+       for (i = 0, j = 0; i < passwordLen; i += BITLK_RECOVERY_PART_LEN + 1, j++) {
+               strncpy(part_str, password + i, BITLK_RECOVERY_PART_LEN);
+
+               errno = 0;
+               part_num = strtol(part_str, NULL, 10);
+               if ((errno == ERANGE && (part_num == LONG_MAX || part_num == LONG_MIN)) ||
+                   (errno != 0 && part_num == 0))
+                       return -errno;
+
+               if (part_num % 11 != 0)
+                       return 0;
+               parts[j] = cpu_to_le16(part_num / 11);
+       }
+
+       *rc_key = crypt_alloc_volume_key(16, (const char*) parts);
+       if (*rc_key == NULL)
+               return -ENOMEM;
+
+       return 0;
+}
+
+static int bitlk_kdf(struct crypt_device *cd,
+                    const char *password,
+                    size_t passwordLen,
+                    bool recovery,
+                    const uint8_t *salt,
+                    struct volume_key **vk)
+{
+       struct bitlk_kdf_data kdf = {};
+       struct crypt_hash *hd = NULL;
+       int len = 0;
+       char *utf16Password = NULL;
+       int i = 0;
+       int r = 0;
+
+       memcpy(kdf.salt, salt, 16);
+
+       r = crypt_hash_init(&hd, BITLK_KDF_HASH);
+       if (r < 0)
+               return r;
+       len = crypt_hash_size(BITLK_KDF_HASH);
+       if (len < 0) {
+               crypt_hash_destroy(hd);
+               return len;
+       }
+
+       if (!recovery) {
+               /* passphrase: convert to UTF-16 first, then sha256(sha256(pw)) */
+               r = passphrase_to_utf16(cd, CONST_CAST(char*)password, passwordLen, &utf16Password);
+               if (r < 0)
+                       goto out;
+
+               crypt_hash_write(hd, utf16Password, passwordLen * 2);
+               r = crypt_hash_final(hd, kdf.initial_sha256, len);
+               if (r < 0)
+                       goto out;
+
+               crypt_hash_write(hd, kdf.initial_sha256, len);
+               r = crypt_hash_final(hd, kdf.initial_sha256, len);
+               if (r < 0)
+                       goto out;
+       } else {
+               /* recovery passphrase: already converted in #get_recovery_key, now just sha256(rpw) */
+               crypt_hash_write(hd, password, passwordLen);
+               r = crypt_hash_final(hd, kdf.initial_sha256, len);
+               if (r < 0)
+                       goto out;
+       }
+
+       for (i = 0; i < BITLK_KDF_ITERATION_COUNT; i++) {
+               crypt_hash_write(hd, (const char*) &kdf, sizeof(kdf));
+               r = crypt_hash_final(hd, kdf.last_sha256, len);
+               if (r < 0)
+                       goto out;
+               kdf.count = cpu_to_le64(le64_to_cpu(kdf.count) + 1);
+       }
+
+       *vk = crypt_alloc_volume_key(len, kdf.last_sha256);
+
+out:
+       crypt_safe_free(utf16Password);
+       if (hd)
+               crypt_hash_destroy(hd);
+       return r;
+}
+
+static int decrypt_key(struct crypt_device *cd,
+                      struct volume_key **vk,
+                      struct volume_key *enc_key,
+                      struct volume_key *key,
+                      const uint8_t *tag, size_t tag_size,
+                      const uint8_t *iv, size_t iv_size,
+                      bool is_fvek)
+{
+       char *outbuf;
+       int r;
+       uint32_t key_size = 0;
+
+       outbuf = crypt_safe_alloc(enc_key->keylength);
+       if (!outbuf)
+               return -ENOMEM;
+
+       r = crypt_bitlk_decrypt_key(key->key, key->keylength, enc_key->key, outbuf, enc_key->keylength,
+                               (const char*)iv, iv_size, (const char*)tag, tag_size);
+       if (r < 0) {
+               if (r == -ENOTSUP)
+                       log_err(cd, _("This operation is not supported."));
+               goto out;
+       }
+
+       /* key_data has it's size as part of the metadata */
+       memcpy(&key_size, outbuf, 4);
+       key_size = le32_to_cpu(key_size);
+       if (enc_key->keylength != key_size) {
+               log_err(cd, _("Wrong key size."));
+               r = -EINVAL;
+               goto out;
+       }
+
+       if (is_fvek && strcmp(crypt_get_cipher_mode(cd), "cbc-elephant") == 0 &&
+               crypt_get_volume_key_size(cd) == 16) {
+               /* 128bit AES-CBC with Elephant -- key size is 256 bit (2 keys) but key data is 512 bits,
+                  data: 16B CBC key, 16B empty, 16B elephant key, 16B empty */
+               memcpy(outbuf + 16 + BITLK_OPEN_KEY_METADATA_LEN,
+                       outbuf + 2 * 16 + BITLK_OPEN_KEY_METADATA_LEN, 16);
+               key_size = 32 + BITLK_OPEN_KEY_METADATA_LEN;
+       }
+
+
+       *vk = crypt_alloc_volume_key(key_size - BITLK_OPEN_KEY_METADATA_LEN,
+                                       (const char *)(outbuf + BITLK_OPEN_KEY_METADATA_LEN));
+       r = *vk ? 0 : -ENOMEM;
+out:
+       crypt_safe_free(outbuf);
+       return r;
+}
+
+int BITLK_activate(struct crypt_device *cd,
+                  const char *name,
+                  const char *password,
+                  size_t passwordLen,
+                  const struct bitlk_metadata *params,
+                  uint32_t flags)
+{
+       int r = 0;
+       int i = 0;
+       int j = 0;
+       int min = 0;
+       int num_segments = 0;
+       struct crypt_dm_active_device dmd = {
+               .flags = flags,
+       };
+       struct dm_target *next_segment = NULL;
+       struct volume_key *open_vmk_key = NULL;
+       struct volume_key *open_fvek_key = NULL;
+       struct volume_key *vmk_dec_key = NULL;
+       struct volume_key *recovery_key = NULL;
+       const struct bitlk_vmk *next_vmk = NULL;
+       struct segment segments[MAX_BITLK_SEGMENTS] = {};
+       struct segment temp;
+       uint64_t next_start = 0;
+       uint64_t next_end = 0;
+       uint64_t last_segment = 0;
+       uint32_t dmt_flags;
+
+       if (!params->state) {
+               log_err(cd, _("This BITLK device is in an unsupported state and cannot be activated."));
+               r = -ENOTSUP;
+               goto out;
+       }
+
+       if (params->type != BITLK_ENCRYPTION_TYPE_NORMAL) {
+               log_err(cd, _("BITLK devices with type '%s' cannot be activated."), get_bitlk_type_string(params->type));
+               r = -ENOTSUP;
+               goto out;
+       }
+
+       next_vmk = params->vmks;
+       while (next_vmk) {
+               if (next_vmk->protection == BITLK_PROTECTION_PASSPHRASE) {
+                       r = bitlk_kdf(cd, password, passwordLen, false, next_vmk->salt, &vmk_dec_key);
+                       if (r)
+                               return r;
+               } else if (next_vmk->protection == BITLK_PROTECTION_RECOVERY_PASSPHRASE) {
+                       r = get_recovery_key(cd, password, passwordLen, &recovery_key);
+                       if (r)
+                               return r;
+                       if (recovery_key == NULL) {
+                               /* r = 0 but no key -> given passphrase is not a recovery passphrase */
+                               r = -EPERM;
+                               next_vmk = next_vmk->next;
+                               continue;
+                       }
+                       log_dbg(cd, "Trying to use given password as a recovery key.");
+                       r = bitlk_kdf(cd, recovery_key->key, recovery_key->keylength,
+                                     true, next_vmk->salt, &vmk_dec_key);
+                       crypt_free_volume_key(recovery_key);
+                       if (r)
+                               return r;
+               } else {
+                       /* only passphrase and recovery passphrase VMKs supported right now */
+                       log_dbg(cd, "Skipping %s", get_vmk_protection_string(next_vmk->protection));
+                       next_vmk = next_vmk->next;
+                       if (r == 0)
+                               /* we need to set error code in case we have only unsupported VMKs */
+                               r = -ENOTSUP;
+                       continue;
+               }
+
+               log_dbg(cd, "Trying to decrypt %s.", get_vmk_protection_string(next_vmk->protection));
+               r = decrypt_key(cd, &open_vmk_key, next_vmk->vk, vmk_dec_key,
+                               next_vmk->mac_tag, BITLK_VMK_MAC_TAG_SIZE,
+                               next_vmk->nonce, BITLK_NONCE_SIZE, false);
+               if (r < 0) {
+                       log_dbg(cd, "Failed to decrypt VMK using provided passphrase.");
+                       crypt_free_volume_key(vmk_dec_key);
+                       if (r == -ENOTSUP)
+                               return r;
+                       next_vmk = next_vmk->next;
+                       continue;
+               }
+               crypt_free_volume_key(vmk_dec_key);
+
+               r = decrypt_key(cd, &open_fvek_key, params->fvek->vk, open_vmk_key,
+                               params->fvek->mac_tag, BITLK_VMK_MAC_TAG_SIZE,
+                               params->fvek->nonce, BITLK_NONCE_SIZE, true);
+               if (r < 0) {
+                       log_dbg(cd, "Failed to decrypt FVEK using VMK.");
+                       crypt_free_volume_key(open_vmk_key);
+                       if (r == -ENOTSUP)
+                               return r;
+               } else {
+                       crypt_free_volume_key(open_vmk_key);
+                       break;
+               }
+
+               next_vmk = next_vmk->next;
+       }
+
+       if (r) {
+               log_dbg(cd, "No more VMKs to try.");
+               return r;
+       }
+
+       /* Password verify only */
+       if (!name) {
+               crypt_free_volume_key(open_fvek_key);
+               return r;
+       }
+
+       next_vmk = params->vmks;
+       while (next_vmk) {
+               if (next_vmk->protection == BITLK_PROTECTION_CLEAR_KEY) {
+                       crypt_free_volume_key(open_fvek_key);
+                       log_err(cd, _("Activation of partially decrypted BITLK device is not supported."));
+                       return -ENOTSUP;
+               }
+               next_vmk = next_vmk->next;
+       }
+
+       r = device_block_adjust(cd, crypt_data_device(cd), DEV_EXCL,
+                               0, &dmd.size, &dmd.flags);
+       if (r) {
+               crypt_free_volume_key(open_fvek_key);
+               return r;
+       }
+
+       /* there will be always 4 dm-zero segments: 3x metadata, 1x FS header */
+       for (i = 0; i < 3; i++) {
+               segments[num_segments].offset = params->metadata_offset[i] / SECTOR_SIZE;
+               segments[num_segments].length = BITLK_FVE_METADATA_SIZE / SECTOR_SIZE;
+               segments[num_segments].iv_offset = 0;
+               segments[num_segments].type = BITLK_SEGTYPE_ZERO;
+               num_segments++;
+       }
+       segments[num_segments].offset = params->volume_header_offset / SECTOR_SIZE;
+       segments[num_segments].length = params->volume_header_size / SECTOR_SIZE;
+       segments[num_segments].iv_offset = 0;
+       segments[num_segments].type = BITLK_SEGTYPE_ZERO;
+       num_segments++;
+
+       /* filesystem header (moved from the special location) */
+       segments[num_segments].offset = 0;
+       segments[num_segments].length = params->volume_header_size / SECTOR_SIZE;
+       segments[num_segments].iv_offset = params->volume_header_offset / SECTOR_SIZE;
+       segments[num_segments].type = BITLK_SEGTYPE_CRYPT;
+       num_segments++;
+
+       /* now fill gaps between the dm-zero segments with dm-crypt */
+       last_segment = params->volume_header_size / SECTOR_SIZE;
+       while (true) {
+               next_start = dmd.size;
+               next_end = dmd.size;
+
+               /* start of the next segment: end of the first existing segment after the last added */
+               for (i = 0; i < num_segments; i++)
+                       if (segments[i].offset + segments[i].length < next_start && segments[i].offset + segments[i].length >= last_segment)
+                               next_start = segments[i].offset + segments[i].length;
+
+               /* end of the next segment: start of the next segment after start we found above */
+               for (i = 0; i < num_segments; i++)
+                       if (segments[i].offset < next_end && segments[i].offset >= next_start)
+                               next_end = segments[i].offset;
+
+               /* two zero segments next to each other, just bump the last_segment
+                  so the algorithm moves */
+               if (next_end - next_start == 0) {
+                       last_segment = next_end + 1;
+                       continue;
+               }
+
+               segments[num_segments].offset = next_start;
+               segments[num_segments].length = next_end - next_start;
+               segments[num_segments].iv_offset = next_start;
+               segments[num_segments].type = BITLK_SEGTYPE_CRYPT;
+               last_segment = next_end;
+               num_segments++;
+
+               if (next_end == dmd.size)
+                       break;
+
+               if (num_segments == 10) {
+                       log_dbg(cd, "Failed to calculate number of dm-crypt segments for open.");
+                       r = -EINVAL;
+                       goto out;
+               }
+       }
+
+       /* device mapper needs the segment sorted */
+       for (i = 0; i < num_segments - 1; i++) {
+               min = i;
+               for (j = i + 1; j < num_segments; j++)
+                       if (segments[j].offset < segments[min].offset)
+                               min = j;
+
+               if (min != i) {
+                       temp.offset = segments[min].offset;
+                       temp.length = segments[min].length;
+                       temp.iv_offset = segments[min].iv_offset;
+                       temp.type = segments[min].type;
+
+                       segments[min].offset = segments[i].offset;
+                       segments[min].length = segments[i].length;
+                       segments[min].iv_offset = segments[i].iv_offset;
+                       segments[min].type = segments[i].type;
+
+                       segments[i].offset = temp.offset;
+                       segments[i].length = temp.length;
+                       segments[i].iv_offset = temp.iv_offset;
+                       segments[i].type = temp.type;
+               }
+       }
+
+       if (params->sector_size != SECTOR_SIZE)
+               dmd.flags |= CRYPT_ACTIVATE_IV_LARGE_SECTORS;
+
+       r = dm_targets_allocate(&dmd.segment, num_segments);
+       if (r)
+               goto out;
+       next_segment = &dmd.segment;
+
+       for (i = 0; i < num_segments; i++) {
+               if (segments[i].type == BITLK_SEGTYPE_ZERO)
+                       r = dm_zero_target_set(next_segment,
+                                              segments[i].offset,
+                                              segments[i].length);
+               else if (segments[i].type == BITLK_SEGTYPE_CRYPT)
+                       r = dm_crypt_target_set(next_segment,
+                                               segments[i].offset,
+                                               segments[i].length,
+                                               crypt_data_device(cd),
+                                               open_fvek_key,
+                                               crypt_get_cipher_spec(cd),
+                                               segments[i].iv_offset,
+                                               segments[i].iv_offset,
+                                               NULL, 0,
+                                               params->sector_size);
+               if (r)
+                       goto out;
+
+               next_segment = next_segment->next;
+       }
+
+       log_dbg(cd, "Trying to activate BITLK on device %s%s%s.",
+               device_path(crypt_data_device(cd)), name ? " with name " :"", name ?: "");
+
+       r = dm_create_device(cd, name, CRYPT_BITLK, &dmd);
+       if (r < 0) {
+               dm_flags(cd, DM_CRYPT, &dmt_flags);
+               if (!strcmp(params->cipher_mode, "cbc-eboiv") && !(dmt_flags & DM_BITLK_EBOIV_SUPPORTED)) {
+                       log_err(cd, _("Cannot activate device, kernel dm-crypt is missing support for BITLK IV."));
+                       r = -ENOTSUP;
+               }
+               if (!strcmp(params->cipher_mode, "cbc-elephant") && !(dmt_flags & DM_BITLK_ELEPHANT_SUPPORTED)) {
+                       log_err(cd, _("Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."));
+                       r = -ENOTSUP;
+               }
+       }
+out:
+       dm_targets_free(cd, &dmd);
+       crypt_free_volume_key(open_fvek_key);
+       return r;
+}
diff --git a/lib/bitlk/bitlk.h b/lib/bitlk/bitlk.h
new file mode 100644 (file)
index 0000000..a784883
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * BITLK (BitLocker-compatible) header definition
+ *
+ * Copyright (C) 2019-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2019-2020 Milan Broz
+ * Copyright (C) 2019-2020 Vojtech Trefny
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _CRYPTSETUP_BITLK_H
+#define _CRYPTSETUP_BITLK_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+struct crypt_device;
+struct device;
+
+#define BITLK_NONCE_SIZE 12
+#define BITLK_SALT_SIZE 16
+#define BITLK_VMK_MAC_TAG_SIZE 16
+
+#define BITLK_STATE_NORMAL 0x0004
+
+typedef enum {
+       BITLK_ENCRYPTION_TYPE_NORMAL = 0,
+       BITLK_ENCRYPTION_TYPE_EOW,
+       BITLK_ENCRYPTION_TYPE_UNKNOWN,
+} BITLKEncryptionType;
+
+typedef enum {
+       BITLK_PROTECTION_CLEAR_KEY = 0,
+       BITLK_PROTECTION_TPM,
+       BITLK_PROTECTION_STARTUP_KEY,
+       BITLK_PROTECTION_TPM_PIN,
+       BITLK_PROTECTION_RECOVERY_PASSPHRASE,
+       BITLK_PROTECTION_PASSPHRASE,
+       BITLK_PROTECTION_SMART_CARD,
+       BITLK_PROTECTION_UNKNOWN,
+} BITLKVMKProtection;
+
+typedef enum {
+       BITLK_ENTRY_TYPE_PROPERTY = 0x0000,
+       BITLK_ENTRY_TYPE_VMK = 0x0002,
+       BITLK_ENTRY_TYPE_FVEK = 0x0003,
+       BITLK_ENTRY_TYPE_STARTUP_KEY = 0x0006,
+       BITLK_ENTRY_TYPE_DESCRIPTION = 0x0007,
+       BITLK_ENTRY_TYPE_VOLUME_HEADER = 0x000f,
+} BITLKFVEEntryType;
+
+typedef enum {
+       BITLK_ENTRY_VALUE_ERASED = 0x0000,
+       BITLK_ENTRY_VALUE_KEY = 0x0001,
+       BITLK_ENTRY_VALUE_STRING = 0x0002,
+       BITLK_ENTRY_VALUE_STRETCH_KEY = 0x0003,
+       BITLK_ENTRY_VALUE_USE_KEY = 0x0004,
+       BITLK_ENTRY_VALUE_ENCRYPTED_KEY = 0x0005,
+       BITLK_ENTRY_VALUE_TPM_KEY = 0x0006,
+       BITLK_ENTRY_VALUE_VALIDATION = 0x0007,
+       BITLK_ENTRY_VALUE_VMK = 0x0008,
+       BITLK_ENTRY_VALUE_EXTERNAL_KEY = 0x0009,
+       BITLK_ENTRY_VALUE_OFFSET_SIZE = 0x000f,
+       BITLK_ENTRY_VALUE_RECOVERY_TIME = 0x015,
+} BITLKFVEEntryValue;
+
+struct bitlk_vmk {
+       char *guid;
+       char *name;
+       BITLKVMKProtection protection;
+       uint8_t salt[BITLK_SALT_SIZE];
+       uint8_t mac_tag[BITLK_VMK_MAC_TAG_SIZE];
+       uint8_t nonce[BITLK_NONCE_SIZE];
+       struct volume_key *vk;
+       struct bitlk_vmk *next;
+};
+
+struct bitlk_fvek {
+       uint8_t mac_tag[BITLK_VMK_MAC_TAG_SIZE];
+       uint8_t nonce[BITLK_NONCE_SIZE];
+       struct volume_key *vk;
+};
+
+struct bitlk_metadata {
+       uint16_t sector_size;
+       bool togo;
+       bool state;
+       BITLKEncryptionType type;
+       const char *cipher;
+       const char *cipher_mode;
+       uint16_t key_size;
+       char *guid;
+       uint64_t creation_time;
+       char *description;
+       uint64_t metadata_offset[3];
+       uint32_t metadata_version;
+       uint64_t volume_header_offset;
+       uint64_t volume_header_size;
+       struct bitlk_vmk *vmks;
+       struct bitlk_fvek *fvek;
+};
+
+int BITLK_read_sb(struct crypt_device *cd, struct bitlk_metadata *params);
+
+int BITLK_dump(struct crypt_device *cd, struct device *device, struct bitlk_metadata *params);
+
+int BITLK_activate(struct crypt_device *cd,
+                  const char *name,
+                  const char *password,
+                  size_t passwordLen,
+                  const struct bitlk_metadata *params,
+                  uint32_t flags);
+
+void BITLK_bitlk_fvek_free(struct bitlk_fvek *fvek);
+void BITLK_bitlk_vmk_free(struct bitlk_vmk *vmk);
+void BITLK_bitlk_metadata_free(struct bitlk_metadata *params);
+
+#endif
index 3f8e96b..77d72fc 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * cryptsetup plain device helper functions
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved.
- * Copyright (C) 2010-2012, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -64,7 +64,7 @@ static int hash(const char *hash_name, size_t key_size, char *key,
 
 #define PLAIN_HASH_LEN_MAX 256
 
-int crypt_plain_hash(struct crypt_device *ctx __attribute__((unused)),
+int crypt_plain_hash(struct crypt_device *cd,
                     const char *hash_name,
                     char *key, size_t key_size,
                     const char *passphrase, size_t passphrase_size)
@@ -73,7 +73,7 @@ int crypt_plain_hash(struct crypt_device *ctx __attribute__((unused)),
        size_t hash_size, pad_size;
        int r;
 
-       log_dbg("Plain: hashing passphrase using %s.", hash_name);
+       log_dbg(cd, "Plain: hashing passphrase using %s.", hash_name);
 
        if (strlen(hash_name) >= PLAIN_HASH_LEN_MAX)
                return -EINVAL;
@@ -85,11 +85,11 @@ int crypt_plain_hash(struct crypt_device *ctx __attribute__((unused)),
                *s = '\0';
                s++;
                if (!*s || sscanf(s, "%zd", &hash_size) != 1) {
-                       log_dbg("Hash length is not a number");
+                       log_dbg(cd, "Hash length is not a number");
                        return -EINVAL;
                }
                if (hash_size > key_size) {
-                       log_dbg("Hash length %zd > key length %zd",
+                       log_dbg(cd, "Hash length %zd > key length %zd",
                                hash_size, key_size);
                        return -EINVAL;
                }
@@ -102,7 +102,7 @@ int crypt_plain_hash(struct crypt_device *ctx __attribute__((unused)),
        /* No hash, copy passphrase directly */
        if (!strcmp(hash_name_buf, "plain")) {
                if (passphrase_size < hash_size) {
-                       log_dbg("Too short plain passphrase.");
+                       log_dbg(cd, "Too short plain passphrase.");
                        return -EINVAL;
                }
                memcpy(key, passphrase, hash_size);
diff --git a/lib/crypto_backend/Makefile.am b/lib/crypto_backend/Makefile.am
deleted file mode 100644 (file)
index 942d258..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-moduledir = $(libdir)/cryptsetup
-
-noinst_LTLIBRARIES = libcrypto_backend.la
-
-libcrypto_backend_la_CFLAGS = $(AM_CFLAGS) -Wall @CRYPTO_CFLAGS@
-
-libcrypto_backend_la_SOURCES = crypto_backend.h \
-       crypto_cipher_kernel.c crypto_storage.c pbkdf_check.c crc32.c
-
-if CRYPTO_BACKEND_GCRYPT
-libcrypto_backend_la_SOURCES += crypto_gcrypt.c
-endif
-if CRYPTO_BACKEND_OPENSSL
-libcrypto_backend_la_SOURCES += crypto_openssl.c
-endif
-if CRYPTO_BACKEND_NSS
-libcrypto_backend_la_SOURCES += crypto_nss.c
-endif
-if CRYPTO_BACKEND_KERNEL
-libcrypto_backend_la_SOURCES += crypto_kernel.c
-endif
-if CRYPTO_BACKEND_NETTLE
-libcrypto_backend_la_SOURCES += crypto_nettle.c
-endif
-
-if CRYPTO_INTERNAL_PBKDF2
-libcrypto_backend_la_SOURCES += pbkdf2_generic.c
-endif
-
-AM_CPPFLAGS = -include config.h -I$(top_srcdir)/lib
diff --git a/lib/crypto_backend/Makefile.in b/lib/crypto_backend/Makefile.in
deleted file mode 100644 (file)
index cb6dcfc..0000000
+++ /dev/null
@@ -1,738 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-@CRYPTO_BACKEND_GCRYPT_TRUE@am__append_1 = crypto_gcrypt.c
-@CRYPTO_BACKEND_OPENSSL_TRUE@am__append_2 = crypto_openssl.c
-@CRYPTO_BACKEND_NSS_TRUE@am__append_3 = crypto_nss.c
-@CRYPTO_BACKEND_KERNEL_TRUE@am__append_4 = crypto_kernel.c
-@CRYPTO_BACKEND_NETTLE_TRUE@am__append_5 = crypto_nettle.c
-@CRYPTO_INTERNAL_PBKDF2_TRUE@am__append_6 = pbkdf2_generic.c
-subdir = lib/crypto_backend
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libcrypto_backend_la_LIBADD =
-am__libcrypto_backend_la_SOURCES_DIST = crypto_backend.h \
-       crypto_cipher_kernel.c crypto_storage.c pbkdf_check.c crc32.c \
-       crypto_gcrypt.c crypto_openssl.c crypto_nss.c crypto_kernel.c \
-       crypto_nettle.c pbkdf2_generic.c
-@CRYPTO_BACKEND_GCRYPT_TRUE@am__objects_1 = libcrypto_backend_la-crypto_gcrypt.lo
-@CRYPTO_BACKEND_OPENSSL_TRUE@am__objects_2 = libcrypto_backend_la-crypto_openssl.lo
-@CRYPTO_BACKEND_NSS_TRUE@am__objects_3 =  \
-@CRYPTO_BACKEND_NSS_TRUE@      libcrypto_backend_la-crypto_nss.lo
-@CRYPTO_BACKEND_KERNEL_TRUE@am__objects_4 = libcrypto_backend_la-crypto_kernel.lo
-@CRYPTO_BACKEND_NETTLE_TRUE@am__objects_5 = libcrypto_backend_la-crypto_nettle.lo
-@CRYPTO_INTERNAL_PBKDF2_TRUE@am__objects_6 = libcrypto_backend_la-pbkdf2_generic.lo
-am_libcrypto_backend_la_OBJECTS =  \
-       libcrypto_backend_la-crypto_cipher_kernel.lo \
-       libcrypto_backend_la-crypto_storage.lo \
-       libcrypto_backend_la-pbkdf_check.lo \
-       libcrypto_backend_la-crc32.lo $(am__objects_1) \
-       $(am__objects_2) $(am__objects_3) $(am__objects_4) \
-       $(am__objects_5) $(am__objects_6)
-libcrypto_backend_la_OBJECTS = $(am_libcrypto_backend_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libcrypto_backend_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(libcrypto_backend_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-       $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libcrypto_backend_la_SOURCES)
-DIST_SOURCES = $(am__libcrypto_backend_la_SOURCES_DIST)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-moduledir = $(libdir)/cryptsetup
-noinst_LTLIBRARIES = libcrypto_backend.la
-libcrypto_backend_la_CFLAGS = $(AM_CFLAGS) -Wall @CRYPTO_CFLAGS@
-libcrypto_backend_la_SOURCES = crypto_backend.h crypto_cipher_kernel.c \
-       crypto_storage.c pbkdf_check.c crc32.c $(am__append_1) \
-       $(am__append_2) $(am__append_3) $(am__append_4) \
-       $(am__append_5) $(am__append_6)
-AM_CPPFLAGS = -include config.h -I$(top_srcdir)/lib
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/crypto_backend/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/crypto_backend/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
-       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-       @list='$(noinst_LTLIBRARIES)'; \
-       locs=`for p in $$list; do echo $$p; done | \
-             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-             sort -u`; \
-       test -z "$$locs" || { \
-         echo rm -f $${locs}; \
-         rm -f $${locs}; \
-       }
-
-libcrypto_backend.la: $(libcrypto_backend_la_OBJECTS) $(libcrypto_backend_la_DEPENDENCIES) $(EXTRA_libcrypto_backend_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libcrypto_backend_la_LINK)  $(libcrypto_backend_la_OBJECTS) $(libcrypto_backend_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crc32.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crypto_kernel.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crypto_nettle.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crypto_nss.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crypto_openssl.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-crypto_storage.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcrypto_backend_la-pbkdf_check.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libcrypto_backend_la-crypto_cipher_kernel.lo: crypto_cipher_kernel.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crypto_cipher_kernel.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Tpo -c -o libcrypto_backend_la-crypto_cipher_kernel.lo `test -f 'crypto_cipher_kernel.c' || echo '$(srcdir)/'`crypto_cipher_kernel.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Tpo $(DEPDIR)/libcrypto_backend_la-crypto_cipher_kernel.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto_cipher_kernel.c' object='libcrypto_backend_la-crypto_cipher_kernel.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crypto_cipher_kernel.lo `test -f 'crypto_cipher_kernel.c' || echo '$(srcdir)/'`crypto_cipher_kernel.c
-
-libcrypto_backend_la-crypto_storage.lo: crypto_storage.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crypto_storage.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crypto_storage.Tpo -c -o libcrypto_backend_la-crypto_storage.lo `test -f 'crypto_storage.c' || echo '$(srcdir)/'`crypto_storage.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crypto_storage.Tpo $(DEPDIR)/libcrypto_backend_la-crypto_storage.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto_storage.c' object='libcrypto_backend_la-crypto_storage.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crypto_storage.lo `test -f 'crypto_storage.c' || echo '$(srcdir)/'`crypto_storage.c
-
-libcrypto_backend_la-pbkdf_check.lo: pbkdf_check.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-pbkdf_check.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-pbkdf_check.Tpo -c -o libcrypto_backend_la-pbkdf_check.lo `test -f 'pbkdf_check.c' || echo '$(srcdir)/'`pbkdf_check.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-pbkdf_check.Tpo $(DEPDIR)/libcrypto_backend_la-pbkdf_check.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='pbkdf_check.c' object='libcrypto_backend_la-pbkdf_check.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-pbkdf_check.lo `test -f 'pbkdf_check.c' || echo '$(srcdir)/'`pbkdf_check.c
-
-libcrypto_backend_la-crc32.lo: crc32.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crc32.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crc32.Tpo -c -o libcrypto_backend_la-crc32.lo `test -f 'crc32.c' || echo '$(srcdir)/'`crc32.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crc32.Tpo $(DEPDIR)/libcrypto_backend_la-crc32.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crc32.c' object='libcrypto_backend_la-crc32.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crc32.lo `test -f 'crc32.c' || echo '$(srcdir)/'`crc32.c
-
-libcrypto_backend_la-crypto_gcrypt.lo: crypto_gcrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crypto_gcrypt.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Tpo -c -o libcrypto_backend_la-crypto_gcrypt.lo `test -f 'crypto_gcrypt.c' || echo '$(srcdir)/'`crypto_gcrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Tpo $(DEPDIR)/libcrypto_backend_la-crypto_gcrypt.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto_gcrypt.c' object='libcrypto_backend_la-crypto_gcrypt.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crypto_gcrypt.lo `test -f 'crypto_gcrypt.c' || echo '$(srcdir)/'`crypto_gcrypt.c
-
-libcrypto_backend_la-crypto_openssl.lo: crypto_openssl.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crypto_openssl.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crypto_openssl.Tpo -c -o libcrypto_backend_la-crypto_openssl.lo `test -f 'crypto_openssl.c' || echo '$(srcdir)/'`crypto_openssl.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crypto_openssl.Tpo $(DEPDIR)/libcrypto_backend_la-crypto_openssl.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto_openssl.c' object='libcrypto_backend_la-crypto_openssl.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crypto_openssl.lo `test -f 'crypto_openssl.c' || echo '$(srcdir)/'`crypto_openssl.c
-
-libcrypto_backend_la-crypto_nss.lo: crypto_nss.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crypto_nss.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crypto_nss.Tpo -c -o libcrypto_backend_la-crypto_nss.lo `test -f 'crypto_nss.c' || echo '$(srcdir)/'`crypto_nss.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crypto_nss.Tpo $(DEPDIR)/libcrypto_backend_la-crypto_nss.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto_nss.c' object='libcrypto_backend_la-crypto_nss.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crypto_nss.lo `test -f 'crypto_nss.c' || echo '$(srcdir)/'`crypto_nss.c
-
-libcrypto_backend_la-crypto_kernel.lo: crypto_kernel.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crypto_kernel.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crypto_kernel.Tpo -c -o libcrypto_backend_la-crypto_kernel.lo `test -f 'crypto_kernel.c' || echo '$(srcdir)/'`crypto_kernel.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crypto_kernel.Tpo $(DEPDIR)/libcrypto_backend_la-crypto_kernel.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto_kernel.c' object='libcrypto_backend_la-crypto_kernel.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crypto_kernel.lo `test -f 'crypto_kernel.c' || echo '$(srcdir)/'`crypto_kernel.c
-
-libcrypto_backend_la-crypto_nettle.lo: crypto_nettle.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-crypto_nettle.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-crypto_nettle.Tpo -c -o libcrypto_backend_la-crypto_nettle.lo `test -f 'crypto_nettle.c' || echo '$(srcdir)/'`crypto_nettle.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-crypto_nettle.Tpo $(DEPDIR)/libcrypto_backend_la-crypto_nettle.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto_nettle.c' object='libcrypto_backend_la-crypto_nettle.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-crypto_nettle.lo `test -f 'crypto_nettle.c' || echo '$(srcdir)/'`crypto_nettle.c
-
-libcrypto_backend_la-pbkdf2_generic.lo: pbkdf2_generic.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -MT libcrypto_backend_la-pbkdf2_generic.lo -MD -MP -MF $(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Tpo -c -o libcrypto_backend_la-pbkdf2_generic.lo `test -f 'pbkdf2_generic.c' || echo '$(srcdir)/'`pbkdf2_generic.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Tpo $(DEPDIR)/libcrypto_backend_la-pbkdf2_generic.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='pbkdf2_generic.c' object='libcrypto_backend_la-pbkdf2_generic.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcrypto_backend_la_CFLAGS) $(CFLAGS) -c -o libcrypto_backend_la-pbkdf2_generic.lo `test -f 'pbkdf2_generic.c' || echo '$(srcdir)/'`pbkdf2_generic.c
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-       clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-       ctags-am distclean distclean-compile distclean-generic \
-       distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/lib/crypto_backend/Makemodule.am b/lib/crypto_backend/Makemodule.am
new file mode 100644 (file)
index 0000000..f33cd45
--- /dev/null
@@ -0,0 +1,39 @@
+noinst_LTLIBRARIES += libcrypto_backend.la
+
+libcrypto_backend_la_CFLAGS = $(AM_CFLAGS) @CRYPTO_CFLAGS@
+
+libcrypto_backend_la_SOURCES = \
+       lib/crypto_backend/crypto_backend.h \
+       lib/crypto_backend/crypto_backend_internal.h \
+       lib/crypto_backend/crypto_cipher_kernel.c \
+       lib/crypto_backend/crypto_storage.c \
+       lib/crypto_backend/pbkdf_check.c \
+       lib/crypto_backend/crc32.c \
+       lib/crypto_backend/argon2_generic.c \
+       lib/crypto_backend/cipher_generic.c \
+       lib/crypto_backend/cipher_check.c
+
+if CRYPTO_BACKEND_GCRYPT
+libcrypto_backend_la_SOURCES += lib/crypto_backend/crypto_gcrypt.c
+endif
+if CRYPTO_BACKEND_OPENSSL
+libcrypto_backend_la_SOURCES += lib/crypto_backend/crypto_openssl.c
+endif
+if CRYPTO_BACKEND_NSS
+libcrypto_backend_la_SOURCES += lib/crypto_backend/crypto_nss.c
+endif
+if CRYPTO_BACKEND_KERNEL
+libcrypto_backend_la_SOURCES += lib/crypto_backend/crypto_kernel.c
+endif
+if CRYPTO_BACKEND_NETTLE
+libcrypto_backend_la_SOURCES += lib/crypto_backend/crypto_nettle.c
+endif
+
+if CRYPTO_INTERNAL_PBKDF2
+libcrypto_backend_la_SOURCES += lib/crypto_backend/pbkdf2_generic.c
+endif
+
+if CRYPTO_INTERNAL_ARGON2
+libcrypto_backend_la_DEPENDENCIES = libargon2.la
+libcrypto_backend_la_LIBADD = libargon2.la
+endif
diff --git a/lib/crypto_backend/argon2/LICENSE b/lib/crypto_backend/argon2/LICENSE
new file mode 100644 (file)
index 0000000..de14cd2
--- /dev/null
@@ -0,0 +1,30 @@
+     CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
+
+    the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
+    moral rights retained by the original author(s) and/or performer(s);
+    publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
+    rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
+    rights protecting the extraction, dissemination, use and reuse of data in a Work;
+    database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
+    other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+    No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
+    Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
+    Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
+    Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
diff --git a/lib/crypto_backend/argon2/Makemodule.am b/lib/crypto_backend/argon2/Makemodule.am
new file mode 100644 (file)
index 0000000..6fef2f1
--- /dev/null
@@ -0,0 +1,30 @@
+noinst_LTLIBRARIES += libargon2.la
+
+libargon2_la_CFLAGS = $(AM_CFLAGS) -std=c89 -pthread -O3
+libargon2_la_CPPFLAGS = $(AM_CPPFLAGS) \
+       -I lib/crypto_backend/argon2 \
+       -I lib/crypto_backend/argon2/blake2
+
+libargon2_la_SOURCES = \
+       lib/crypto_backend/argon2/blake2/blake2b.c \
+       lib/crypto_backend/argon2/blake2/blake2.h \
+       lib/crypto_backend/argon2/blake2/blake2-impl.h \
+       lib/crypto_backend/argon2/argon2.c \
+       lib/crypto_backend/argon2/argon2.h \
+       lib/crypto_backend/argon2/core.c \
+       lib/crypto_backend/argon2/core.h \
+       lib/crypto_backend/argon2/encoding.c \
+       lib/crypto_backend/argon2/encoding.h \
+       lib/crypto_backend/argon2/thread.c \
+       lib/crypto_backend/argon2/thread.h
+
+if CRYPTO_INTERNAL_SSE_ARGON2
+libargon2_la_SOURCES += lib/crypto_backend/argon2/blake2/blamka-round-opt.h \
+                       lib/crypto_backend/argon2/opt.c
+else
+libargon2_la_SOURCES += lib/crypto_backend/argon2/blake2/blamka-round-ref.h \
+                       lib/crypto_backend/argon2/ref.c
+endif
+
+EXTRA_DIST += lib/crypto_backend/argon2/LICENSE
+EXTRA_DIST += lib/crypto_backend/argon2/README
diff --git a/lib/crypto_backend/argon2/README b/lib/crypto_backend/argon2/README
new file mode 100644 (file)
index 0000000..5376b52
--- /dev/null
@@ -0,0 +1,5 @@
+This is bundled Argon2 algorithm library, copied from
+  https://github.com/P-H-C/phc-winner-argon2
+
+For more info see Password Hashing Competition site:
+  https://password-hashing.net/
diff --git a/lib/crypto_backend/argon2/argon2.c b/lib/crypto_backend/argon2/argon2.c
new file mode 100644 (file)
index 0000000..f748bcc
--- /dev/null
@@ -0,0 +1,456 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "argon2.h"
+#include "encoding.h"
+#include "core.h"
+
+/* to silent gcc -Wcast-qual for const cast */
+#define CONST_CAST(x) (x)(uintptr_t)
+
+const char *argon2_type2string(argon2_type type, int uppercase) {
+    switch (type) {
+        case Argon2_d:
+            return uppercase ? "Argon2d" : "argon2d";
+        case Argon2_i:
+            return uppercase ? "Argon2i" : "argon2i";
+        case Argon2_id:
+            return uppercase ? "Argon2id" : "argon2id";
+    }
+
+    return NULL;
+}
+
+int argon2_ctx(argon2_context *context, argon2_type type) {
+    /* 1. Validate all inputs */
+    int result = validate_inputs(context);
+    uint32_t memory_blocks, segment_length;
+    argon2_instance_t instance;
+
+    if (ARGON2_OK != result) {
+        return result;
+    }
+
+    if (Argon2_d != type && Argon2_i != type && Argon2_id != type) {
+        return ARGON2_INCORRECT_TYPE;
+    }
+
+    /* 2. Align memory size */
+    /* Minimum memory_blocks = 8L blocks, where L is the number of lanes */
+    memory_blocks = context->m_cost;
+
+    if (memory_blocks < 2 * ARGON2_SYNC_POINTS * context->lanes) {
+        memory_blocks = 2 * ARGON2_SYNC_POINTS * context->lanes;
+    }
+
+    segment_length = memory_blocks / (context->lanes * ARGON2_SYNC_POINTS);
+    /* Ensure that all segments have equal length */
+    memory_blocks = segment_length * (context->lanes * ARGON2_SYNC_POINTS);
+
+    instance.version = context->version;
+    instance.memory = NULL;
+    instance.passes = context->t_cost;
+    instance.memory_blocks = memory_blocks;
+    instance.segment_length = segment_length;
+    instance.lane_length = segment_length * ARGON2_SYNC_POINTS;
+    instance.lanes = context->lanes;
+    instance.threads = context->threads;
+    instance.type = type;
+
+    if (instance.threads > instance.lanes) {
+        instance.threads = instance.lanes;
+    }
+
+    /* 3. Initialization: Hashing inputs, allocating memory, filling first
+     * blocks
+     */
+    result = initialize(&instance, context);
+
+    if (ARGON2_OK != result) {
+        return result;
+    }
+
+    /* 4. Filling memory */
+    result = fill_memory_blocks(&instance);
+
+    if (ARGON2_OK != result) {
+        return result;
+    }
+    /* 5. Finalization */
+    finalize(context, &instance);
+
+    return ARGON2_OK;
+}
+
+int argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
+                const uint32_t parallelism, const void *pwd,
+                const size_t pwdlen, const void *salt, const size_t saltlen,
+                void *hash, const size_t hashlen, char *encoded,
+                const size_t encodedlen, argon2_type type,
+                const uint32_t version){
+
+    argon2_context context;
+    int result;
+    uint8_t *out;
+
+    if (pwdlen > ARGON2_MAX_PWD_LENGTH) {
+        return ARGON2_PWD_TOO_LONG;
+    }
+
+    if (saltlen > ARGON2_MAX_SALT_LENGTH) {
+        return ARGON2_SALT_TOO_LONG;
+    }
+
+    if (hashlen > ARGON2_MAX_OUTLEN) {
+        return ARGON2_OUTPUT_TOO_LONG;
+    }
+
+    if (hashlen < ARGON2_MIN_OUTLEN) {
+        return ARGON2_OUTPUT_TOO_SHORT;
+    }
+
+    out = malloc(hashlen);
+    if (!out) {
+        return ARGON2_MEMORY_ALLOCATION_ERROR;
+    }
+
+    context.out = (uint8_t *)out;
+    context.outlen = (uint32_t)hashlen;
+    context.pwd = CONST_CAST(uint8_t *)pwd;
+    context.pwdlen = (uint32_t)pwdlen;
+    context.salt = CONST_CAST(uint8_t *)salt;
+    context.saltlen = (uint32_t)saltlen;
+    context.secret = NULL;
+    context.secretlen = 0;
+    context.ad = NULL;
+    context.adlen = 0;
+    context.t_cost = t_cost;
+    context.m_cost = m_cost;
+    context.lanes = parallelism;
+    context.threads = parallelism;
+    context.allocate_cbk = NULL;
+    context.free_cbk = NULL;
+    context.flags = ARGON2_DEFAULT_FLAGS;
+    context.version = version;
+
+    result = argon2_ctx(&context, type);
+
+    if (result != ARGON2_OK) {
+        clear_internal_memory(out, hashlen);
+        free(out);
+        return result;
+    }
+
+    /* if raw hash requested, write it */
+    if (hash) {
+        memcpy(hash, out, hashlen);
+    }
+
+    /* if encoding requested, write it */
+    if (encoded && encodedlen) {
+        if (encode_string(encoded, encodedlen, &context, type) != ARGON2_OK) {
+            clear_internal_memory(out, hashlen); /* wipe buffers if error */
+            clear_internal_memory(encoded, encodedlen);
+            free(out);
+            return ARGON2_ENCODING_FAIL;
+        }
+    }
+    clear_internal_memory(out, hashlen);
+    free(out);
+
+    return ARGON2_OK;
+}
+
+int argon2i_hash_encoded(const uint32_t t_cost, const uint32_t m_cost,
+                         const uint32_t parallelism, const void *pwd,
+                         const size_t pwdlen, const void *salt,
+                         const size_t saltlen, const size_t hashlen,
+                         char *encoded, const size_t encodedlen) {
+
+    return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen,
+                       NULL, hashlen, encoded, encodedlen, Argon2_i,
+                       ARGON2_VERSION_NUMBER);
+}
+
+int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost,
+                     const uint32_t parallelism, const void *pwd,
+                     const size_t pwdlen, const void *salt,
+                     const size_t saltlen, void *hash, const size_t hashlen) {
+
+    return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen,
+                       hash, hashlen, NULL, 0, Argon2_i, ARGON2_VERSION_NUMBER);
+}
+
+int argon2d_hash_encoded(const uint32_t t_cost, const uint32_t m_cost,
+                         const uint32_t parallelism, const void *pwd,
+                         const size_t pwdlen, const void *salt,
+                         const size_t saltlen, const size_t hashlen,
+                         char *encoded, const size_t encodedlen) {
+
+    return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen,
+                       NULL, hashlen, encoded, encodedlen, Argon2_d,
+                       ARGON2_VERSION_NUMBER);
+}
+
+int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost,
+                     const uint32_t parallelism, const void *pwd,
+                     const size_t pwdlen, const void *salt,
+                     const size_t saltlen, void *hash, const size_t hashlen) {
+
+    return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen,
+                       hash, hashlen, NULL, 0, Argon2_d, ARGON2_VERSION_NUMBER);
+}
+
+int argon2id_hash_encoded(const uint32_t t_cost, const uint32_t m_cost,
+                          const uint32_t parallelism, const void *pwd,
+                          const size_t pwdlen, const void *salt,
+                          const size_t saltlen, const size_t hashlen,
+                          char *encoded, const size_t encodedlen) {
+
+    return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen,
+                       NULL, hashlen, encoded, encodedlen, Argon2_id,
+                       ARGON2_VERSION_NUMBER);
+}
+
+int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost,
+                      const uint32_t parallelism, const void *pwd,
+                      const size_t pwdlen, const void *salt,
+                      const size_t saltlen, void *hash, const size_t hashlen) {
+    return argon2_hash(t_cost, m_cost, parallelism, pwd, pwdlen, salt, saltlen,
+                       hash, hashlen, NULL, 0, Argon2_id,
+                       ARGON2_VERSION_NUMBER);
+}
+
+static int argon2_compare(const uint8_t *b1, const uint8_t *b2, size_t len) {
+    size_t i;
+    uint8_t d = 0U;
+
+    for (i = 0U; i < len; i++) {
+        d |= b1[i] ^ b2[i];
+    }
+    return (int)((1 & ((d - 1) >> 8)) - 1);
+}
+
+int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen,
+                  argon2_type type) {
+
+    argon2_context ctx;
+    uint8_t *desired_result = NULL;
+
+    int ret = ARGON2_OK;
+
+    size_t encoded_len;
+    uint32_t max_field_len;
+
+    if (pwdlen > ARGON2_MAX_PWD_LENGTH) {
+        return ARGON2_PWD_TOO_LONG;
+    }
+
+    if (encoded == NULL) {
+        return ARGON2_DECODING_FAIL;
+    }
+
+    encoded_len = strlen(encoded);
+    if (encoded_len > UINT32_MAX) {
+        return ARGON2_DECODING_FAIL;
+    }
+
+    /* No field can be longer than the encoded length */
+    /* coverity[strlen_assign] */
+    max_field_len = (uint32_t)encoded_len;
+
+    ctx.saltlen = max_field_len;
+    ctx.outlen = max_field_len;
+
+    ctx.salt = malloc(ctx.saltlen);
+    ctx.out = malloc(ctx.outlen);
+    if (!ctx.salt || !ctx.out) {
+        ret = ARGON2_MEMORY_ALLOCATION_ERROR;
+        goto fail;
+    }
+
+    ctx.pwd = CONST_CAST(uint8_t *)pwd;
+    ctx.pwdlen = (uint32_t)pwdlen;
+
+    ret = decode_string(&ctx, encoded, type);
+    if (ret != ARGON2_OK) {
+        goto fail;
+    }
+
+    /* Set aside the desired result, and get a new buffer. */
+    desired_result = ctx.out;
+    ctx.out = malloc(ctx.outlen);
+    if (!ctx.out) {
+        ret = ARGON2_MEMORY_ALLOCATION_ERROR;
+        goto fail;
+    }
+
+    ret = argon2_verify_ctx(&ctx, (char *)desired_result, type);
+    if (ret != ARGON2_OK) {
+        goto fail;
+    }
+
+fail:
+    free(ctx.salt);
+    free(ctx.out);
+    free(desired_result);
+
+    return ret;
+}
+
+int argon2i_verify(const char *encoded, const void *pwd, const size_t pwdlen) {
+
+    return argon2_verify(encoded, pwd, pwdlen, Argon2_i);
+}
+
+int argon2d_verify(const char *encoded, const void *pwd, const size_t pwdlen) {
+
+    return argon2_verify(encoded, pwd, pwdlen, Argon2_d);
+}
+
+int argon2id_verify(const char *encoded, const void *pwd, const size_t pwdlen) {
+
+    return argon2_verify(encoded, pwd, pwdlen, Argon2_id);
+}
+
+int argon2d_ctx(argon2_context *context) {
+    return argon2_ctx(context, Argon2_d);
+}
+
+int argon2i_ctx(argon2_context *context) {
+    return argon2_ctx(context, Argon2_i);
+}
+
+int argon2id_ctx(argon2_context *context) {
+    return argon2_ctx(context, Argon2_id);
+}
+
+int argon2_verify_ctx(argon2_context *context, const char *hash,
+                      argon2_type type) {
+    int ret = argon2_ctx(context, type);
+    if (ret != ARGON2_OK) {
+        return ret;
+    }
+
+    if (argon2_compare(CONST_CAST(uint8_t *)hash, context->out, context->outlen)) {
+        return ARGON2_VERIFY_MISMATCH;
+    }
+
+    return ARGON2_OK;
+}
+
+int argon2d_verify_ctx(argon2_context *context, const char *hash) {
+    return argon2_verify_ctx(context, hash, Argon2_d);
+}
+
+int argon2i_verify_ctx(argon2_context *context, const char *hash) {
+    return argon2_verify_ctx(context, hash, Argon2_i);
+}
+
+int argon2id_verify_ctx(argon2_context *context, const char *hash) {
+    return argon2_verify_ctx(context, hash, Argon2_id);
+}
+
+const char *argon2_error_message(int error_code) {
+    switch (error_code) {
+    case ARGON2_OK:
+        return "OK";
+    case ARGON2_OUTPUT_PTR_NULL:
+        return "Output pointer is NULL";
+    case ARGON2_OUTPUT_TOO_SHORT:
+        return "Output is too short";
+    case ARGON2_OUTPUT_TOO_LONG:
+        return "Output is too long";
+    case ARGON2_PWD_TOO_SHORT:
+        return "Password is too short";
+    case ARGON2_PWD_TOO_LONG:
+        return "Password is too long";
+    case ARGON2_SALT_TOO_SHORT:
+        return "Salt is too short";
+    case ARGON2_SALT_TOO_LONG:
+        return "Salt is too long";
+    case ARGON2_AD_TOO_SHORT:
+        return "Associated data is too short";
+    case ARGON2_AD_TOO_LONG:
+        return "Associated data is too long";
+    case ARGON2_SECRET_TOO_SHORT:
+        return "Secret is too short";
+    case ARGON2_SECRET_TOO_LONG:
+        return "Secret is too long";
+    case ARGON2_TIME_TOO_SMALL:
+        return "Time cost is too small";
+    case ARGON2_TIME_TOO_LARGE:
+        return "Time cost is too large";
+    case ARGON2_MEMORY_TOO_LITTLE:
+        return "Memory cost is too small";
+    case ARGON2_MEMORY_TOO_MUCH:
+        return "Memory cost is too large";
+    case ARGON2_LANES_TOO_FEW:
+        return "Too few lanes";
+    case ARGON2_LANES_TOO_MANY:
+        return "Too many lanes";
+    case ARGON2_PWD_PTR_MISMATCH:
+        return "Password pointer is NULL, but password length is not 0";
+    case ARGON2_SALT_PTR_MISMATCH:
+        return "Salt pointer is NULL, but salt length is not 0";
+    case ARGON2_SECRET_PTR_MISMATCH:
+        return "Secret pointer is NULL, but secret length is not 0";
+    case ARGON2_AD_PTR_MISMATCH:
+        return "Associated data pointer is NULL, but ad length is not 0";
+    case ARGON2_MEMORY_ALLOCATION_ERROR:
+        return "Memory allocation error";
+    case ARGON2_FREE_MEMORY_CBK_NULL:
+        return "The free memory callback is NULL";
+    case ARGON2_ALLOCATE_MEMORY_CBK_NULL:
+        return "The allocate memory callback is NULL";
+    case ARGON2_INCORRECT_PARAMETER:
+        return "Argon2_Context context is NULL";
+    case ARGON2_INCORRECT_TYPE:
+        return "There is no such version of Argon2";
+    case ARGON2_OUT_PTR_MISMATCH:
+        return "Output pointer mismatch";
+    case ARGON2_THREADS_TOO_FEW:
+        return "Not enough threads";
+    case ARGON2_THREADS_TOO_MANY:
+        return "Too many threads";
+    case ARGON2_MISSING_ARGS:
+        return "Missing arguments";
+    case ARGON2_ENCODING_FAIL:
+        return "Encoding failed";
+    case ARGON2_DECODING_FAIL:
+        return "Decoding failed";
+    case ARGON2_THREAD_FAIL:
+        return "Threading failure";
+    case ARGON2_DECODING_LENGTH_FAIL:
+        return "Some of encoded parameters are too long or too short";
+    case ARGON2_VERIFY_MISMATCH:
+        return "The password does not match the supplied hash";
+    default:
+        return "Unknown error code";
+    }
+}
+
+size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism,
+                         uint32_t saltlen, uint32_t hashlen, argon2_type type) {
+  return strlen("$$v=$m=,t=,p=$$") + strlen(argon2_type2string(type, 0)) +
+         numlen(t_cost) + numlen(m_cost) + numlen(parallelism) +
+         b64len(saltlen) + b64len(hashlen) + numlen(ARGON2_VERSION_NUMBER) + 1;
+}
diff --git a/lib/crypto_backend/argon2/argon2.h b/lib/crypto_backend/argon2/argon2.h
new file mode 100644 (file)
index 0000000..fc8682c
--- /dev/null
@@ -0,0 +1,437 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef ARGON2_H
+#define ARGON2_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include <limits.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* Symbols visibility control */
+#ifdef A2_VISCTL
+#define ARGON2_PUBLIC __attribute__((visibility("default")))
+#define ARGON2_LOCAL __attribute__ ((visibility ("hidden")))
+#elif _MSC_VER
+#define ARGON2_PUBLIC __declspec(dllexport)
+#define ARGON2_LOCAL
+#else
+#define ARGON2_PUBLIC
+#define ARGON2_LOCAL
+#endif
+
+/*
+ * Argon2 input parameter restrictions
+ */
+
+/* Minimum and maximum number of lanes (degree of parallelism) */
+#define ARGON2_MIN_LANES UINT32_C(1)
+#define ARGON2_MAX_LANES UINT32_C(0xFFFFFF)
+
+/* Minimum and maximum number of threads */
+#define ARGON2_MIN_THREADS UINT32_C(1)
+#define ARGON2_MAX_THREADS UINT32_C(0xFFFFFF)
+
+/* Number of synchronization points between lanes per pass */
+#define ARGON2_SYNC_POINTS UINT32_C(4)
+
+/* Minimum and maximum digest size in bytes */
+#define ARGON2_MIN_OUTLEN UINT32_C(4)
+#define ARGON2_MAX_OUTLEN UINT32_C(0xFFFFFFFF)
+
+/* Minimum and maximum number of memory blocks (each of BLOCK_SIZE bytes) */
+#define ARGON2_MIN_MEMORY (2 * ARGON2_SYNC_POINTS) /* 2 blocks per slice */
+
+#define ARGON2_MIN(a, b) ((a) < (b) ? (a) : (b))
+/* Max memory size is addressing-space/2, topping at 2^32 blocks (4 TB) */
+#define ARGON2_MAX_MEMORY_BITS                                                 \
+    ARGON2_MIN(UINT32_C(32), (sizeof(void *) * CHAR_BIT - 10 - 1))
+#define ARGON2_MAX_MEMORY                                                      \
+    ARGON2_MIN(UINT32_C(0xFFFFFFFF), UINT64_C(1) << ARGON2_MAX_MEMORY_BITS)
+
+/* Minimum and maximum number of passes */
+#define ARGON2_MIN_TIME UINT32_C(1)
+#define ARGON2_MAX_TIME UINT32_C(0xFFFFFFFF)
+
+/* Minimum and maximum password length in bytes */
+#define ARGON2_MIN_PWD_LENGTH UINT32_C(0)
+#define ARGON2_MAX_PWD_LENGTH UINT32_C(0xFFFFFFFF)
+
+/* Minimum and maximum associated data length in bytes */
+#define ARGON2_MIN_AD_LENGTH UINT32_C(0)
+#define ARGON2_MAX_AD_LENGTH UINT32_C(0xFFFFFFFF)
+
+/* Minimum and maximum salt length in bytes */
+#define ARGON2_MIN_SALT_LENGTH UINT32_C(8)
+#define ARGON2_MAX_SALT_LENGTH UINT32_C(0xFFFFFFFF)
+
+/* Minimum and maximum key length in bytes */
+#define ARGON2_MIN_SECRET UINT32_C(0)
+#define ARGON2_MAX_SECRET UINT32_C(0xFFFFFFFF)
+
+/* Flags to determine which fields are securely wiped (default = no wipe). */
+#define ARGON2_DEFAULT_FLAGS UINT32_C(0)
+#define ARGON2_FLAG_CLEAR_PASSWORD (UINT32_C(1) << 0)
+#define ARGON2_FLAG_CLEAR_SECRET (UINT32_C(1) << 1)
+
+/* Global flag to determine if we are wiping internal memory buffers. This flag
+ * is defined in core.c and defaults to 1 (wipe internal memory). */
+extern int FLAG_clear_internal_memory;
+
+/* Error codes */
+typedef enum Argon2_ErrorCodes {
+    ARGON2_OK = 0,
+
+    ARGON2_OUTPUT_PTR_NULL = -1,
+
+    ARGON2_OUTPUT_TOO_SHORT = -2,
+    ARGON2_OUTPUT_TOO_LONG = -3,
+
+    ARGON2_PWD_TOO_SHORT = -4,
+    ARGON2_PWD_TOO_LONG = -5,
+
+    ARGON2_SALT_TOO_SHORT = -6,
+    ARGON2_SALT_TOO_LONG = -7,
+
+    ARGON2_AD_TOO_SHORT = -8,
+    ARGON2_AD_TOO_LONG = -9,
+
+    ARGON2_SECRET_TOO_SHORT = -10,
+    ARGON2_SECRET_TOO_LONG = -11,
+
+    ARGON2_TIME_TOO_SMALL = -12,
+    ARGON2_TIME_TOO_LARGE = -13,
+
+    ARGON2_MEMORY_TOO_LITTLE = -14,
+    ARGON2_MEMORY_TOO_MUCH = -15,
+
+    ARGON2_LANES_TOO_FEW = -16,
+    ARGON2_LANES_TOO_MANY = -17,
+
+    ARGON2_PWD_PTR_MISMATCH = -18,    /* NULL ptr with non-zero length */
+    ARGON2_SALT_PTR_MISMATCH = -19,   /* NULL ptr with non-zero length */
+    ARGON2_SECRET_PTR_MISMATCH = -20, /* NULL ptr with non-zero length */
+    ARGON2_AD_PTR_MISMATCH = -21,     /* NULL ptr with non-zero length */
+
+    ARGON2_MEMORY_ALLOCATION_ERROR = -22,
+
+    ARGON2_FREE_MEMORY_CBK_NULL = -23,
+    ARGON2_ALLOCATE_MEMORY_CBK_NULL = -24,
+
+    ARGON2_INCORRECT_PARAMETER = -25,
+    ARGON2_INCORRECT_TYPE = -26,
+
+    ARGON2_OUT_PTR_MISMATCH = -27,
+
+    ARGON2_THREADS_TOO_FEW = -28,
+    ARGON2_THREADS_TOO_MANY = -29,
+
+    ARGON2_MISSING_ARGS = -30,
+
+    ARGON2_ENCODING_FAIL = -31,
+
+    ARGON2_DECODING_FAIL = -32,
+
+    ARGON2_THREAD_FAIL = -33,
+
+    ARGON2_DECODING_LENGTH_FAIL = -34,
+
+    ARGON2_VERIFY_MISMATCH = -35
+} argon2_error_codes;
+
+/* Memory allocator types --- for external allocation */
+typedef int (*allocate_fptr)(uint8_t **memory, size_t bytes_to_allocate);
+typedef void (*deallocate_fptr)(uint8_t *memory, size_t bytes_to_allocate);
+
+/* Argon2 external data structures */
+
+/*
+ *****
+ * Context: structure to hold Argon2 inputs:
+ *  output array and its length,
+ *  password and its length,
+ *  salt and its length,
+ *  secret and its length,
+ *  associated data and its length,
+ *  number of passes, amount of used memory (in KBytes, can be rounded up a bit)
+ *  number of parallel threads that will be run.
+ * All the parameters above affect the output hash value.
+ * Additionally, two function pointers can be provided to allocate and
+ * deallocate the memory (if NULL, memory will be allocated internally).
+ * Also, three flags indicate whether to erase password, secret as soon as they
+ * are pre-hashed (and thus not needed anymore), and the entire memory
+ *****
+ * Simplest situation: you have output array out[8], password is stored in
+ * pwd[32], salt is stored in salt[16], you do not have keys nor associated
+ * data. You need to spend 1 GB of RAM and you run 5 passes of Argon2d with
+ * 4 parallel lanes.
+ * You want to erase the password, but you're OK with last pass not being
+ * erased. You want to use the default memory allocator.
+ * Then you initialize:
+ Argon2_Context(out,8,pwd,32,salt,16,NULL,0,NULL,0,5,1<<20,4,4,NULL,NULL,true,false,false,false)
+ */
+typedef struct Argon2_Context {
+    uint8_t *out;    /* output array */
+    uint32_t outlen; /* digest length */
+
+    uint8_t *pwd;    /* password array */
+    uint32_t pwdlen; /* password length */
+
+    uint8_t *salt;    /* salt array */
+    uint32_t saltlen; /* salt length */
+
+    uint8_t *secret;    /* key array */
+    uint32_t secretlen; /* key length */
+
+    uint8_t *ad;    /* associated data array */
+    uint32_t adlen; /* associated data length */
+
+    uint32_t t_cost;  /* number of passes */
+    uint32_t m_cost;  /* amount of memory requested (KB) */
+    uint32_t lanes;   /* number of lanes */
+    uint32_t threads; /* maximum number of threads */
+
+    uint32_t version; /* version number */
+
+    allocate_fptr allocate_cbk; /* pointer to memory allocator */
+    deallocate_fptr free_cbk;   /* pointer to memory deallocator */
+
+    uint32_t flags; /* array of bool options */
+} argon2_context;
+
+/* Argon2 primitive type */
+typedef enum Argon2_type {
+  Argon2_d = 0,
+  Argon2_i = 1,
+  Argon2_id = 2
+} argon2_type;
+
+/* Version of the algorithm */
+typedef enum Argon2_version {
+    ARGON2_VERSION_10 = 0x10,
+    ARGON2_VERSION_13 = 0x13,
+    ARGON2_VERSION_NUMBER = ARGON2_VERSION_13
+} argon2_version;
+
+/*
+ * Function that gives the string representation of an argon2_type.
+ * @param type The argon2_type that we want the string for
+ * @param uppercase Whether the string should have the first letter uppercase
+ * @return NULL if invalid type, otherwise the string representation.
+ */
+ARGON2_PUBLIC const char *argon2_type2string(argon2_type type, int uppercase);
+
+/*
+ * Function that performs memory-hard hashing with certain degree of parallelism
+ * @param  context  Pointer to the Argon2 internal structure
+ * @return Error code if smth is wrong, ARGON2_OK otherwise
+ */
+ARGON2_PUBLIC int argon2_ctx(argon2_context *context, argon2_type type);
+
+/**
+ * Hashes a password with Argon2i, producing an encoded hash
+ * @param t_cost Number of iterations
+ * @param m_cost Sets memory usage to m_cost kibibytes
+ * @param parallelism Number of threads and compute lanes
+ * @param pwd Pointer to password
+ * @param pwdlen Password size in bytes
+ * @param salt Pointer to salt
+ * @param saltlen Salt size in bytes
+ * @param hashlen Desired length of the hash in bytes
+ * @param encoded Buffer where to write the encoded hash
+ * @param encodedlen Size of the buffer (thus max size of the encoded hash)
+ * @pre   Different parallelism levels will give different results
+ * @pre   Returns ARGON2_OK if successful
+ */
+ARGON2_PUBLIC int argon2i_hash_encoded(const uint32_t t_cost,
+                                       const uint32_t m_cost,
+                                       const uint32_t parallelism,
+                                       const void *pwd, const size_t pwdlen,
+                                       const void *salt, const size_t saltlen,
+                                       const size_t hashlen, char *encoded,
+                                       const size_t encodedlen);
+
+/**
+ * Hashes a password with Argon2i, producing a raw hash at @hash
+ * @param t_cost Number of iterations
+ * @param m_cost Sets memory usage to m_cost kibibytes
+ * @param parallelism Number of threads and compute lanes
+ * @param pwd Pointer to password
+ * @param pwdlen Password size in bytes
+ * @param salt Pointer to salt
+ * @param saltlen Salt size in bytes
+ * @param hash Buffer where to write the raw hash - updated by the function
+ * @param hashlen Desired length of the hash in bytes
+ * @pre   Different parallelism levels will give different results
+ * @pre   Returns ARGON2_OK if successful
+ */
+ARGON2_PUBLIC int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost,
+                                   const uint32_t parallelism, const void *pwd,
+                                   const size_t pwdlen, const void *salt,
+                                   const size_t saltlen, void *hash,
+                                   const size_t hashlen);
+
+ARGON2_PUBLIC int argon2d_hash_encoded(const uint32_t t_cost,
+                                       const uint32_t m_cost,
+                                       const uint32_t parallelism,
+                                       const void *pwd, const size_t pwdlen,
+                                       const void *salt, const size_t saltlen,
+                                       const size_t hashlen, char *encoded,
+                                       const size_t encodedlen);
+
+ARGON2_PUBLIC int argon2d_hash_raw(const uint32_t t_cost, const uint32_t m_cost,
+                                   const uint32_t parallelism, const void *pwd,
+                                   const size_t pwdlen, const void *salt,
+                                   const size_t saltlen, void *hash,
+                                   const size_t hashlen);
+
+ARGON2_PUBLIC int argon2id_hash_encoded(const uint32_t t_cost,
+                                        const uint32_t m_cost,
+                                        const uint32_t parallelism,
+                                        const void *pwd, const size_t pwdlen,
+                                        const void *salt, const size_t saltlen,
+                                        const size_t hashlen, char *encoded,
+                                        const size_t encodedlen);
+
+ARGON2_PUBLIC int argon2id_hash_raw(const uint32_t t_cost,
+                                    const uint32_t m_cost,
+                                    const uint32_t parallelism, const void *pwd,
+                                    const size_t pwdlen, const void *salt,
+                                    const size_t saltlen, void *hash,
+                                    const size_t hashlen);
+
+/* generic function underlying the above ones */
+ARGON2_PUBLIC int argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
+                              const uint32_t parallelism, const void *pwd,
+                              const size_t pwdlen, const void *salt,
+                              const size_t saltlen, void *hash,
+                              const size_t hashlen, char *encoded,
+                              const size_t encodedlen, argon2_type type,
+                              const uint32_t version);
+
+/**
+ * Verifies a password against an encoded string
+ * Encoded string is restricted as in validate_inputs()
+ * @param encoded String encoding parameters, salt, hash
+ * @param pwd Pointer to password
+ * @pre   Returns ARGON2_OK if successful
+ */
+ARGON2_PUBLIC int argon2i_verify(const char *encoded, const void *pwd,
+                                 const size_t pwdlen);
+
+ARGON2_PUBLIC int argon2d_verify(const char *encoded, const void *pwd,
+                                 const size_t pwdlen);
+
+ARGON2_PUBLIC int argon2id_verify(const char *encoded, const void *pwd,
+                                  const size_t pwdlen);
+
+/* generic function underlying the above ones */
+ARGON2_PUBLIC int argon2_verify(const char *encoded, const void *pwd,
+                                const size_t pwdlen, argon2_type type);
+
+/**
+ * Argon2d: Version of Argon2 that picks memory blocks depending
+ * on the password and salt. Only for side-channel-free
+ * environment!!
+ *****
+ * @param  context  Pointer to current Argon2 context
+ * @return  Zero if successful, a non zero error code otherwise
+ */
+ARGON2_PUBLIC int argon2d_ctx(argon2_context *context);
+
+/**
+ * Argon2i: Version of Argon2 that picks memory blocks
+ * independent on the password and salt. Good for side-channels,
+ * but worse w.r.t. tradeoff attacks if only one pass is used.
+ *****
+ * @param  context  Pointer to current Argon2 context
+ * @return  Zero if successful, a non zero error code otherwise
+ */
+ARGON2_PUBLIC int argon2i_ctx(argon2_context *context);
+
+/**
+ * Argon2id: Version of Argon2 where the first half-pass over memory is
+ * password-independent, the rest are password-dependent (on the password and
+ * salt). OK against side channels (they reduce to 1/2-pass Argon2i), and
+ * better with w.r.t. tradeoff attacks (similar to Argon2d).
+ *****
+ * @param  context  Pointer to current Argon2 context
+ * @return  Zero if successful, a non zero error code otherwise
+ */
+ARGON2_PUBLIC int argon2id_ctx(argon2_context *context);
+
+/**
+ * Verify if a given password is correct for Argon2d hashing
+ * @param  context  Pointer to current Argon2 context
+ * @param  hash  The password hash to verify. The length of the hash is
+ * specified by the context outlen member
+ * @return  Zero if successful, a non zero error code otherwise
+ */
+ARGON2_PUBLIC int argon2d_verify_ctx(argon2_context *context, const char *hash);
+
+/**
+ * Verify if a given password is correct for Argon2i hashing
+ * @param  context  Pointer to current Argon2 context
+ * @param  hash  The password hash to verify. The length of the hash is
+ * specified by the context outlen member
+ * @return  Zero if successful, a non zero error code otherwise
+ */
+ARGON2_PUBLIC int argon2i_verify_ctx(argon2_context *context, const char *hash);
+
+/**
+ * Verify if a given password is correct for Argon2id hashing
+ * @param  context  Pointer to current Argon2 context
+ * @param  hash  The password hash to verify. The length of the hash is
+ * specified by the context outlen member
+ * @return  Zero if successful, a non zero error code otherwise
+ */
+ARGON2_PUBLIC int argon2id_verify_ctx(argon2_context *context,
+                                      const char *hash);
+
+/* generic function underlying the above ones */
+ARGON2_PUBLIC int argon2_verify_ctx(argon2_context *context, const char *hash,
+                                    argon2_type type);
+
+/**
+ * Get the associated error message for given error code
+ * @return  The error message associated with the given error code
+ */
+ARGON2_PUBLIC const char *argon2_error_message(int error_code);
+
+/**
+ * Returns the encoded hash length for the given input parameters
+ * @param t_cost  Number of iterations
+ * @param m_cost  Memory usage in kibibytes
+ * @param parallelism  Number of threads; used to compute lanes
+ * @param saltlen  Salt size in bytes
+ * @param hashlen  Hash size in bytes
+ * @param type The argon2_type that we want the encoded length for
+ * @return  The encoded hash length in bytes
+ */
+ARGON2_PUBLIC size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost,
+                                       uint32_t parallelism, uint32_t saltlen,
+                                       uint32_t hashlen, argon2_type type);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/lib/crypto_backend/argon2/blake2/blake2-impl.h b/lib/crypto_backend/argon2/blake2/blake2-impl.h
new file mode 100644 (file)
index 0000000..e77ad92
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef PORTABLE_BLAKE2_IMPL_H
+#define PORTABLE_BLAKE2_IMPL_H
+
+#include <stdint.h>
+#include <string.h>
+
+#if defined(_MSC_VER)
+#define BLAKE2_INLINE __inline
+#elif defined(__GNUC__) || defined(__clang__)
+#define BLAKE2_INLINE __inline__
+#else
+#define BLAKE2_INLINE
+#endif
+
+/* Argon2 Team - Begin Code */
+/*
+   Not an exhaustive list, but should cover the majority of modern platforms
+   Additionally, the code will always be correct---this is only a performance
+   tweak.
+*/
+#if (defined(__BYTE_ORDER__) &&                                                \
+     (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) ||                           \
+    defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__MIPSEL__) || \
+    defined(__AARCH64EL__) || defined(__amd64__) || defined(__i386__) ||       \
+    defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) ||                \
+    defined(_M_ARM)
+#define NATIVE_LITTLE_ENDIAN
+#endif
+/* Argon2 Team - End Code */
+
+static BLAKE2_INLINE uint32_t load32(const void *src) {
+#if defined(NATIVE_LITTLE_ENDIAN)
+    uint32_t w;
+    memcpy(&w, src, sizeof w);
+    return w;
+#else
+    const uint8_t *p = (const uint8_t *)src;
+    uint32_t w = *p++;
+    w |= (uint32_t)(*p++) << 8;
+    w |= (uint32_t)(*p++) << 16;
+    w |= (uint32_t)(*p++) << 24;
+    return w;
+#endif
+}
+
+static BLAKE2_INLINE uint64_t load64(const void *src) {
+#if defined(NATIVE_LITTLE_ENDIAN)
+    uint64_t w;
+    memcpy(&w, src, sizeof w);
+    return w;
+#else
+    const uint8_t *p = (const uint8_t *)src;
+    uint64_t w = *p++;
+    w |= (uint64_t)(*p++) << 8;
+    w |= (uint64_t)(*p++) << 16;
+    w |= (uint64_t)(*p++) << 24;
+    w |= (uint64_t)(*p++) << 32;
+    w |= (uint64_t)(*p++) << 40;
+    w |= (uint64_t)(*p++) << 48;
+    w |= (uint64_t)(*p++) << 56;
+    return w;
+#endif
+}
+
+static BLAKE2_INLINE void store32(void *dst, uint32_t w) {
+#if defined(NATIVE_LITTLE_ENDIAN)
+    memcpy(dst, &w, sizeof w);
+#else
+    uint8_t *p = (uint8_t *)dst;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+#endif
+}
+
+static BLAKE2_INLINE void store64(void *dst, uint64_t w) {
+#if defined(NATIVE_LITTLE_ENDIAN)
+    memcpy(dst, &w, sizeof w);
+#else
+    uint8_t *p = (uint8_t *)dst;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+#endif
+}
+
+static BLAKE2_INLINE uint64_t load48(const void *src) {
+    const uint8_t *p = (const uint8_t *)src;
+    uint64_t w = *p++;
+    w |= (uint64_t)(*p++) << 8;
+    w |= (uint64_t)(*p++) << 16;
+    w |= (uint64_t)(*p++) << 24;
+    w |= (uint64_t)(*p++) << 32;
+    w |= (uint64_t)(*p++) << 40;
+    return w;
+}
+
+static BLAKE2_INLINE void store48(void *dst, uint64_t w) {
+    uint8_t *p = (uint8_t *)dst;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+    w >>= 8;
+    *p++ = (uint8_t)w;
+}
+
+static BLAKE2_INLINE uint32_t rotr32(const uint32_t w, const unsigned c) {
+    return (w >> c) | (w << (32 - c));
+}
+
+static BLAKE2_INLINE uint64_t rotr64(const uint64_t w, const unsigned c) {
+    return (w >> c) | (w << (64 - c));
+}
+
+#endif
diff --git a/lib/crypto_backend/argon2/blake2/blake2.h b/lib/crypto_backend/argon2/blake2/blake2.h
new file mode 100644 (file)
index 0000000..9f97e1c
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef PORTABLE_BLAKE2_H
+#define PORTABLE_BLAKE2_H
+
+#include "../argon2.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+enum blake2b_constant {
+    BLAKE2B_BLOCKBYTES = 128,
+    BLAKE2B_OUTBYTES = 64,
+    BLAKE2B_KEYBYTES = 64,
+    BLAKE2B_SALTBYTES = 16,
+    BLAKE2B_PERSONALBYTES = 16
+};
+
+#pragma pack(push, 1)
+typedef struct __blake2b_param {
+    uint8_t digest_length;                   /* 1 */
+    uint8_t key_length;                      /* 2 */
+    uint8_t fanout;                          /* 3 */
+    uint8_t depth;                           /* 4 */
+    uint32_t leaf_length;                    /* 8 */
+    uint64_t node_offset;                    /* 16 */
+    uint8_t node_depth;                      /* 17 */
+    uint8_t inner_length;                    /* 18 */
+    uint8_t reserved[14];                    /* 32 */
+    uint8_t salt[BLAKE2B_SALTBYTES];         /* 48 */
+    uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
+} blake2b_param;
+#pragma pack(pop)
+
+typedef struct __blake2b_state {
+    uint64_t h[8];
+    uint64_t t[2];
+    uint64_t f[2];
+    uint8_t buf[BLAKE2B_BLOCKBYTES];
+    unsigned buflen;
+    unsigned outlen;
+    uint8_t last_node;
+} blake2b_state;
+
+/* Ensure param structs have not been wrongly padded */
+/* Poor man's static_assert */
+enum {
+    blake2_size_check_0 = 1 / !!(CHAR_BIT == 8),
+    blake2_size_check_2 =
+        1 / !!(sizeof(blake2b_param) == sizeof(uint64_t) * CHAR_BIT)
+};
+
+/* Streaming API */
+ARGON2_LOCAL int blake2b_init(blake2b_state *S, size_t outlen);
+ARGON2_LOCAL int blake2b_init_key(blake2b_state *S, size_t outlen, const void *key,
+                     size_t keylen);
+ARGON2_LOCAL int blake2b_init_param(blake2b_state *S, const blake2b_param *P);
+ARGON2_LOCAL int blake2b_update(blake2b_state *S, const void *in, size_t inlen);
+ARGON2_LOCAL int blake2b_final(blake2b_state *S, void *out, size_t outlen);
+
+/* Simple API */
+ARGON2_LOCAL int blake2b(void *out, size_t outlen, const void *in, size_t inlen,
+                         const void *key, size_t keylen);
+
+/* Argon2 Team - Begin Code */
+ARGON2_LOCAL int blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
+/* Argon2 Team - End Code */
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/lib/crypto_backend/argon2/blake2/blake2b.c b/lib/crypto_backend/argon2/blake2/blake2b.c
new file mode 100644 (file)
index 0000000..b8651f2
--- /dev/null
@@ -0,0 +1,392 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "blake2.h"
+#include "blake2-impl.h"
+
+void clear_internal_memory(void *v, size_t n);
+
+static const uint64_t blake2b_IV[8] = {
+    UINT64_C(0x6a09e667f3bcc908), UINT64_C(0xbb67ae8584caa73b),
+    UINT64_C(0x3c6ef372fe94f82b), UINT64_C(0xa54ff53a5f1d36f1),
+    UINT64_C(0x510e527fade682d1), UINT64_C(0x9b05688c2b3e6c1f),
+    UINT64_C(0x1f83d9abfb41bd6b), UINT64_C(0x5be0cd19137e2179)};
+
+static const unsigned int blake2b_sigma[12][16] = {
+    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
+    {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
+    {11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4},
+    {7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8},
+    {9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13},
+    {2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9},
+    {12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11},
+    {13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10},
+    {6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5},
+    {10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0},
+    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
+    {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
+};
+
+static BLAKE2_INLINE void blake2b_set_lastnode(blake2b_state *S) {
+    S->f[1] = (uint64_t)-1;
+}
+
+static BLAKE2_INLINE void blake2b_set_lastblock(blake2b_state *S) {
+    if (S->last_node) {
+        blake2b_set_lastnode(S);
+    }
+    S->f[0] = (uint64_t)-1;
+}
+
+static BLAKE2_INLINE void blake2b_increment_counter(blake2b_state *S,
+                                                    uint64_t inc) {
+    S->t[0] += inc;
+    S->t[1] += (S->t[0] < inc);
+}
+
+static BLAKE2_INLINE void blake2b_invalidate_state(blake2b_state *S) {
+    clear_internal_memory(S, sizeof(*S));      /* wipe */
+    blake2b_set_lastblock(S); /* invalidate for further use */
+}
+
+static BLAKE2_INLINE void blake2b_init0(blake2b_state *S) {
+    memset(S, 0, sizeof(*S));
+    memcpy(S->h, blake2b_IV, sizeof(S->h));
+}
+
+int blake2b_init_param(blake2b_state *S, const blake2b_param *P) {
+    const unsigned char *p = (const unsigned char *)P;
+    unsigned int i;
+
+    if (NULL == P || NULL == S) {
+        return -1;
+    }
+
+    blake2b_init0(S);
+    /* IV XOR Parameter Block */
+    for (i = 0; i < 8; ++i) {
+        S->h[i] ^= load64(&p[i * sizeof(S->h[i])]);
+    }
+    S->outlen = P->digest_length;
+    return 0;
+}
+
+/* Sequential blake2b initialization */
+int blake2b_init(blake2b_state *S, size_t outlen) {
+    blake2b_param P;
+
+    if (S == NULL) {
+        return -1;
+    }
+
+    if ((outlen == 0) || (outlen > BLAKE2B_OUTBYTES)) {
+        blake2b_invalidate_state(S);
+        return -1;
+    }
+
+    /* Setup Parameter Block for unkeyed BLAKE2 */
+    P.digest_length = (uint8_t)outlen;
+    P.key_length = 0;
+    P.fanout = 1;
+    P.depth = 1;
+    P.leaf_length = 0;
+    P.node_offset = 0;
+    P.node_depth = 0;
+    P.inner_length = 0;
+    memset(P.reserved, 0, sizeof(P.reserved));
+    memset(P.salt, 0, sizeof(P.salt));
+    memset(P.personal, 0, sizeof(P.personal));
+
+    return blake2b_init_param(S, &P);
+}
+
+int blake2b_init_key(blake2b_state *S, size_t outlen, const void *key,
+                     size_t keylen) {
+    blake2b_param P;
+
+    if (S == NULL) {
+        return -1;
+    }
+
+    if ((outlen == 0) || (outlen > BLAKE2B_OUTBYTES)) {
+        blake2b_invalidate_state(S);
+        return -1;
+    }
+
+    if ((key == 0) || (keylen == 0) || (keylen > BLAKE2B_KEYBYTES)) {
+        blake2b_invalidate_state(S);
+        return -1;
+    }
+
+    /* Setup Parameter Block for keyed BLAKE2 */
+    P.digest_length = (uint8_t)outlen;
+    P.key_length = (uint8_t)keylen;
+    P.fanout = 1;
+    P.depth = 1;
+    P.leaf_length = 0;
+    P.node_offset = 0;
+    P.node_depth = 0;
+    P.inner_length = 0;
+    memset(P.reserved, 0, sizeof(P.reserved));
+    memset(P.salt, 0, sizeof(P.salt));
+    memset(P.personal, 0, sizeof(P.personal));
+
+    if (blake2b_init_param(S, &P) < 0) {
+        blake2b_invalidate_state(S);
+        return -1;
+    }
+
+    {
+        uint8_t block[BLAKE2B_BLOCKBYTES];
+        memset(block, 0, BLAKE2B_BLOCKBYTES);
+        memcpy(block, key, keylen);
+        blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
+        /* Burn the key from stack */
+        clear_internal_memory(block, BLAKE2B_BLOCKBYTES);
+    }
+    return 0;
+}
+
+static void blake2b_compress(blake2b_state *S, const uint8_t *block) {
+    uint64_t m[16];
+    uint64_t v[16];
+    unsigned int i, r;
+
+    for (i = 0; i < 16; ++i) {
+        m[i] = load64(block + i * sizeof(m[i]));
+    }
+
+    for (i = 0; i < 8; ++i) {
+        v[i] = S->h[i];
+    }
+
+    v[8] = blake2b_IV[0];
+    v[9] = blake2b_IV[1];
+    v[10] = blake2b_IV[2];
+    v[11] = blake2b_IV[3];
+    v[12] = blake2b_IV[4] ^ S->t[0];
+    v[13] = blake2b_IV[5] ^ S->t[1];
+    v[14] = blake2b_IV[6] ^ S->f[0];
+    v[15] = blake2b_IV[7] ^ S->f[1];
+
+#define G(r, i, a, b, c, d)                                                    \
+    do {                                                                       \
+        a = a + b + m[blake2b_sigma[r][2 * i + 0]];                            \
+        d = rotr64(d ^ a, 32);                                                 \
+        c = c + d;                                                             \
+        b = rotr64(b ^ c, 24);                                                 \
+        a = a + b + m[blake2b_sigma[r][2 * i + 1]];                            \
+        d = rotr64(d ^ a, 16);                                                 \
+        c = c + d;                                                             \
+        b = rotr64(b ^ c, 63);                                                 \
+    } while ((void)0, 0)
+
+#define ROUND(r)                                                               \
+    do {                                                                       \
+        G(r, 0, v[0], v[4], v[8], v[12]);                                      \
+        G(r, 1, v[1], v[5], v[9], v[13]);                                      \
+        G(r, 2, v[2], v[6], v[10], v[14]);                                     \
+        G(r, 3, v[3], v[7], v[11], v[15]);                                     \
+        G(r, 4, v[0], v[5], v[10], v[15]);                                     \
+        G(r, 5, v[1], v[6], v[11], v[12]);                                     \
+        G(r, 6, v[2], v[7], v[8], v[13]);                                      \
+        G(r, 7, v[3], v[4], v[9], v[14]);                                      \
+    } while ((void)0, 0)
+
+    for (r = 0; r < 12; ++r) {
+        ROUND(r);
+    }
+
+    for (i = 0; i < 8; ++i) {
+        S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
+    }
+
+#undef G
+#undef ROUND
+}
+
+int blake2b_update(blake2b_state *S, const void *in, size_t inlen) {
+    const uint8_t *pin = (const uint8_t *)in;
+
+    if (inlen == 0) {
+        return 0;
+    }
+
+    /* Sanity check */
+    if (S == NULL || in == NULL) {
+        return -1;
+    }
+
+    /* Is this a reused state? */
+    if (S->f[0] != 0) {
+        return -1;
+    }
+
+    if (S->buflen + inlen > BLAKE2B_BLOCKBYTES) {
+        /* Complete current block */
+        size_t left = S->buflen;
+        size_t fill = BLAKE2B_BLOCKBYTES - left;
+        memcpy(&S->buf[left], pin, fill);
+        blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
+        blake2b_compress(S, S->buf);
+        S->buflen = 0;
+        inlen -= fill;
+        pin += fill;
+        /* Avoid buffer copies when possible */
+        while (inlen > BLAKE2B_BLOCKBYTES) {
+            blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
+            blake2b_compress(S, pin);
+            inlen -= BLAKE2B_BLOCKBYTES;
+            pin += BLAKE2B_BLOCKBYTES;
+        }
+    }
+    memcpy(&S->buf[S->buflen], pin, inlen);
+    S->buflen += (unsigned int)inlen;
+    return 0;
+}
+
+int blake2b_final(blake2b_state *S, void *out, size_t outlen) {
+    uint8_t buffer[BLAKE2B_OUTBYTES] = {0};
+    unsigned int i;
+
+    /* Sanity checks */
+    if (S == NULL || out == NULL || outlen < S->outlen) {
+        return -1;
+    }
+
+    /* Is this a reused state? */
+    if (S->f[0] != 0) {
+        return -1;
+    }
+
+    blake2b_increment_counter(S, S->buflen);
+    blake2b_set_lastblock(S);
+    memset(&S->buf[S->buflen], 0, BLAKE2B_BLOCKBYTES - S->buflen); /* Padding */
+    blake2b_compress(S, S->buf);
+
+    for (i = 0; i < 8; ++i) { /* Output full hash to temp buffer */
+        store64(buffer + sizeof(S->h[i]) * i, S->h[i]);
+    }
+
+    memcpy(out, buffer, S->outlen);
+    clear_internal_memory(buffer, sizeof(buffer));
+    clear_internal_memory(S->buf, sizeof(S->buf));
+    clear_internal_memory(S->h, sizeof(S->h));
+    return 0;
+}
+
+int blake2b(void *out, size_t outlen, const void *in, size_t inlen,
+            const void *key, size_t keylen) {
+    blake2b_state S;
+    int ret = -1;
+
+    /* Verify parameters */
+    if (NULL == in && inlen > 0) {
+        goto fail;
+    }
+
+    if (NULL == out || outlen == 0 || outlen > BLAKE2B_OUTBYTES) {
+        goto fail;
+    }
+
+    if ((NULL == key && keylen > 0) || keylen > BLAKE2B_KEYBYTES) {
+        goto fail;
+    }
+
+    if (keylen > 0) {
+        if (blake2b_init_key(&S, outlen, key, keylen) < 0) {
+            goto fail;
+        }
+    } else {
+        if (blake2b_init(&S, outlen) < 0) {
+            goto fail;
+        }
+    }
+
+    if (blake2b_update(&S, in, inlen) < 0) {
+        goto fail;
+    }
+    ret = blake2b_final(&S, out, outlen);
+
+fail:
+    clear_internal_memory(&S, sizeof(S));
+    return ret;
+}
+
+/* Argon2 Team - Begin Code */
+int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
+    uint8_t *out = (uint8_t *)pout;
+    blake2b_state blake_state;
+    uint8_t outlen_bytes[sizeof(uint32_t)] = {0};
+    int ret = -1;
+
+    if (outlen > UINT32_MAX) {
+        goto fail;
+    }
+
+    /* Ensure little-endian byte order! */
+    store32(outlen_bytes, (uint32_t)outlen);
+
+#define TRY(statement)                                                         \
+    do {                                                                       \
+        ret = statement;                                                       \
+        if (ret < 0) {                                                         \
+            goto fail;                                                         \
+        }                                                                      \
+    } while ((void)0, 0)
+
+    if (outlen <= BLAKE2B_OUTBYTES) {
+        TRY(blake2b_init(&blake_state, outlen));
+        TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
+        TRY(blake2b_update(&blake_state, in, inlen));
+        TRY(blake2b_final(&blake_state, out, outlen));
+    } else {
+        uint32_t toproduce;
+        uint8_t out_buffer[BLAKE2B_OUTBYTES];
+        uint8_t in_buffer[BLAKE2B_OUTBYTES];
+        TRY(blake2b_init(&blake_state, BLAKE2B_OUTBYTES));
+        TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
+        TRY(blake2b_update(&blake_state, in, inlen));
+        TRY(blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES));
+        memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
+        out += BLAKE2B_OUTBYTES / 2;
+        toproduce = (uint32_t)outlen - BLAKE2B_OUTBYTES / 2;
+
+        while (toproduce > BLAKE2B_OUTBYTES) {
+            memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
+            TRY(blake2b(out_buffer, BLAKE2B_OUTBYTES, in_buffer,
+                        BLAKE2B_OUTBYTES, NULL, 0));
+            memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
+            out += BLAKE2B_OUTBYTES / 2;
+            toproduce -= BLAKE2B_OUTBYTES / 2;
+        }
+
+        memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
+        TRY(blake2b(out_buffer, toproduce, in_buffer, BLAKE2B_OUTBYTES, NULL,
+                    0));
+        memcpy(out, out_buffer, toproduce);
+    }
+fail:
+    clear_internal_memory(&blake_state, sizeof(blake_state));
+    return ret;
+#undef TRY
+}
+/* Argon2 Team - End Code */
diff --git a/lib/crypto_backend/argon2/blake2/blamka-round-opt.h b/lib/crypto_backend/argon2/blake2/blamka-round-opt.h
new file mode 100644 (file)
index 0000000..2c8942e
--- /dev/null
@@ -0,0 +1,471 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef BLAKE_ROUND_MKA_OPT_H
+#define BLAKE_ROUND_MKA_OPT_H
+
+#include "blake2-impl.h"
+
+#include <emmintrin.h>
+#if defined(__SSSE3__)
+#include <tmmintrin.h> /* for _mm_shuffle_epi8 and _mm_alignr_epi8 */
+#endif
+
+#if defined(__XOP__) && (defined(__GNUC__) || defined(__clang__))
+#include <x86intrin.h>
+#endif
+
+#if !defined(__AVX512F__)
+#if !defined(__AVX2__)
+#if !defined(__XOP__)
+#if defined(__SSSE3__)
+#define r16                                                                    \
+    (_mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9))
+#define r24                                                                    \
+    (_mm_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10))
+#define _mm_roti_epi64(x, c)                                                   \
+    (-(c) == 32)                                                               \
+        ? _mm_shuffle_epi32((x), _MM_SHUFFLE(2, 3, 0, 1))                      \
+        : (-(c) == 24)                                                         \
+              ? _mm_shuffle_epi8((x), r24)                                     \
+              : (-(c) == 16)                                                   \
+                    ? _mm_shuffle_epi8((x), r16)                               \
+                    : (-(c) == 63)                                             \
+                          ? _mm_xor_si128(_mm_srli_epi64((x), -(c)),           \
+                                          _mm_add_epi64((x), (x)))             \
+                          : _mm_xor_si128(_mm_srli_epi64((x), -(c)),           \
+                                          _mm_slli_epi64((x), 64 - (-(c))))
+#else /* defined(__SSE2__) */
+#define _mm_roti_epi64(r, c)                                                   \
+    _mm_xor_si128(_mm_srli_epi64((r), -(c)), _mm_slli_epi64((r), 64 - (-(c))))
+#endif
+#else
+#endif
+
+static BLAKE2_INLINE __m128i fBlaMka(__m128i x, __m128i y) {
+    const __m128i z = _mm_mul_epu32(x, y);
+    return _mm_add_epi64(_mm_add_epi64(x, y), _mm_add_epi64(z, z));
+}
+
+#define G1(A0, B0, C0, D0, A1, B1, C1, D1)                                     \
+    do {                                                                       \
+        A0 = fBlaMka(A0, B0);                                                  \
+        A1 = fBlaMka(A1, B1);                                                  \
+                                                                               \
+        D0 = _mm_xor_si128(D0, A0);                                            \
+        D1 = _mm_xor_si128(D1, A1);                                            \
+                                                                               \
+        D0 = _mm_roti_epi64(D0, -32);                                          \
+        D1 = _mm_roti_epi64(D1, -32);                                          \
+                                                                               \
+        C0 = fBlaMka(C0, D0);                                                  \
+        C1 = fBlaMka(C1, D1);                                                  \
+                                                                               \
+        B0 = _mm_xor_si128(B0, C0);                                            \
+        B1 = _mm_xor_si128(B1, C1);                                            \
+                                                                               \
+        B0 = _mm_roti_epi64(B0, -24);                                          \
+        B1 = _mm_roti_epi64(B1, -24);                                          \
+    } while ((void)0, 0)
+
+#define G2(A0, B0, C0, D0, A1, B1, C1, D1)                                     \
+    do {                                                                       \
+        A0 = fBlaMka(A0, B0);                                                  \
+        A1 = fBlaMka(A1, B1);                                                  \
+                                                                               \
+        D0 = _mm_xor_si128(D0, A0);                                            \
+        D1 = _mm_xor_si128(D1, A1);                                            \
+                                                                               \
+        D0 = _mm_roti_epi64(D0, -16);                                          \
+        D1 = _mm_roti_epi64(D1, -16);                                          \
+                                                                               \
+        C0 = fBlaMka(C0, D0);                                                  \
+        C1 = fBlaMka(C1, D1);                                                  \
+                                                                               \
+        B0 = _mm_xor_si128(B0, C0);                                            \
+        B1 = _mm_xor_si128(B1, C1);                                            \
+                                                                               \
+        B0 = _mm_roti_epi64(B0, -63);                                          \
+        B1 = _mm_roti_epi64(B1, -63);                                          \
+    } while ((void)0, 0)
+
+#if defined(__SSSE3__)
+#define DIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1)                            \
+    do {                                                                       \
+        __m128i t0 = _mm_alignr_epi8(B1, B0, 8);                               \
+        __m128i t1 = _mm_alignr_epi8(B0, B1, 8);                               \
+        B0 = t0;                                                               \
+        B1 = t1;                                                               \
+                                                                               \
+        t0 = C0;                                                               \
+        C0 = C1;                                                               \
+        C1 = t0;                                                               \
+                                                                               \
+        t0 = _mm_alignr_epi8(D1, D0, 8);                                       \
+        t1 = _mm_alignr_epi8(D0, D1, 8);                                       \
+        D0 = t1;                                                               \
+        D1 = t0;                                                               \
+    } while ((void)0, 0)
+
+#define UNDIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1)                          \
+    do {                                                                       \
+        __m128i t0 = _mm_alignr_epi8(B0, B1, 8);                               \
+        __m128i t1 = _mm_alignr_epi8(B1, B0, 8);                               \
+        B0 = t0;                                                               \
+        B1 = t1;                                                               \
+                                                                               \
+        t0 = C0;                                                               \
+        C0 = C1;                                                               \
+        C1 = t0;                                                               \
+                                                                               \
+        t0 = _mm_alignr_epi8(D0, D1, 8);                                       \
+        t1 = _mm_alignr_epi8(D1, D0, 8);                                       \
+        D0 = t1;                                                               \
+        D1 = t0;                                                               \
+    } while ((void)0, 0)
+#else /* SSE2 */
+#define DIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1)                            \
+    do {                                                                       \
+        __m128i t0 = D0;                                                       \
+        __m128i t1 = B0;                                                       \
+        D0 = C0;                                                               \
+        C0 = C1;                                                               \
+        C1 = D0;                                                               \
+        D0 = _mm_unpackhi_epi64(D1, _mm_unpacklo_epi64(t0, t0));               \
+        D1 = _mm_unpackhi_epi64(t0, _mm_unpacklo_epi64(D1, D1));               \
+        B0 = _mm_unpackhi_epi64(B0, _mm_unpacklo_epi64(B1, B1));               \
+        B1 = _mm_unpackhi_epi64(B1, _mm_unpacklo_epi64(t1, t1));               \
+    } while ((void)0, 0)
+
+#define UNDIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1)                          \
+    do {                                                                       \
+        __m128i t0, t1;                                                        \
+        t0 = C0;                                                               \
+        C0 = C1;                                                               \
+        C1 = t0;                                                               \
+        t0 = B0;                                                               \
+        t1 = D0;                                                               \
+        B0 = _mm_unpackhi_epi64(B1, _mm_unpacklo_epi64(B0, B0));               \
+        B1 = _mm_unpackhi_epi64(t0, _mm_unpacklo_epi64(B1, B1));               \
+        D0 = _mm_unpackhi_epi64(D0, _mm_unpacklo_epi64(D1, D1));               \
+        D1 = _mm_unpackhi_epi64(D1, _mm_unpacklo_epi64(t1, t1));               \
+    } while ((void)0, 0)
+#endif
+
+#define BLAKE2_ROUND(A0, A1, B0, B1, C0, C1, D0, D1)                           \
+    do {                                                                       \
+        G1(A0, B0, C0, D0, A1, B1, C1, D1);                                    \
+        G2(A0, B0, C0, D0, A1, B1, C1, D1);                                    \
+                                                                               \
+        DIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1);                           \
+                                                                               \
+        G1(A0, B0, C0, D0, A1, B1, C1, D1);                                    \
+        G2(A0, B0, C0, D0, A1, B1, C1, D1);                                    \
+                                                                               \
+        UNDIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1);                         \
+    } while ((void)0, 0)
+#else /* __AVX2__ */
+
+#include <immintrin.h>
+
+#define rotr32(x)   _mm256_shuffle_epi32(x, _MM_SHUFFLE(2, 3, 0, 1))
+#define rotr24(x)   _mm256_shuffle_epi8(x, _mm256_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10, 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10))
+#define rotr16(x)   _mm256_shuffle_epi8(x, _mm256_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9, 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9))
+#define rotr63(x)   _mm256_xor_si256(_mm256_srli_epi64((x), 63), _mm256_add_epi64((x), (x)))
+
+#define G1_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+    do { \
+        __m256i ml = _mm256_mul_epu32(A0, B0); \
+        ml = _mm256_add_epi64(ml, ml); \
+        A0 = _mm256_add_epi64(A0, _mm256_add_epi64(B0, ml)); \
+        D0 = _mm256_xor_si256(D0, A0); \
+        D0 = rotr32(D0); \
+        \
+        ml = _mm256_mul_epu32(C0, D0); \
+        ml = _mm256_add_epi64(ml, ml); \
+        C0 = _mm256_add_epi64(C0, _mm256_add_epi64(D0, ml)); \
+        \
+        B0 = _mm256_xor_si256(B0, C0); \
+        B0 = rotr24(B0); \
+        \
+        ml = _mm256_mul_epu32(A1, B1); \
+        ml = _mm256_add_epi64(ml, ml); \
+        A1 = _mm256_add_epi64(A1, _mm256_add_epi64(B1, ml)); \
+        D1 = _mm256_xor_si256(D1, A1); \
+        D1 = rotr32(D1); \
+        \
+        ml = _mm256_mul_epu32(C1, D1); \
+        ml = _mm256_add_epi64(ml, ml); \
+        C1 = _mm256_add_epi64(C1, _mm256_add_epi64(D1, ml)); \
+        \
+        B1 = _mm256_xor_si256(B1, C1); \
+        B1 = rotr24(B1); \
+    } while((void)0, 0);
+
+#define G2_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+    do { \
+        __m256i ml = _mm256_mul_epu32(A0, B0); \
+        ml = _mm256_add_epi64(ml, ml); \
+        A0 = _mm256_add_epi64(A0, _mm256_add_epi64(B0, ml)); \
+        D0 = _mm256_xor_si256(D0, A0); \
+        D0 = rotr16(D0); \
+        \
+        ml = _mm256_mul_epu32(C0, D0); \
+        ml = _mm256_add_epi64(ml, ml); \
+        C0 = _mm256_add_epi64(C0, _mm256_add_epi64(D0, ml)); \
+        B0 = _mm256_xor_si256(B0, C0); \
+        B0 = rotr63(B0); \
+        \
+        ml = _mm256_mul_epu32(A1, B1); \
+        ml = _mm256_add_epi64(ml, ml); \
+        A1 = _mm256_add_epi64(A1, _mm256_add_epi64(B1, ml)); \
+        D1 = _mm256_xor_si256(D1, A1); \
+        D1 = rotr16(D1); \
+        \
+        ml = _mm256_mul_epu32(C1, D1); \
+        ml = _mm256_add_epi64(ml, ml); \
+        C1 = _mm256_add_epi64(C1, _mm256_add_epi64(D1, ml)); \
+        B1 = _mm256_xor_si256(B1, C1); \
+        B1 = rotr63(B1); \
+    } while((void)0, 0);
+
+#define DIAGONALIZE_1(A0, B0, C0, D0, A1, B1, C1, D1) \
+    do { \
+        B0 = _mm256_permute4x64_epi64(B0, _MM_SHUFFLE(0, 3, 2, 1)); \
+        C0 = _mm256_permute4x64_epi64(C0, _MM_SHUFFLE(1, 0, 3, 2)); \
+        D0 = _mm256_permute4x64_epi64(D0, _MM_SHUFFLE(2, 1, 0, 3)); \
+        \
+        B1 = _mm256_permute4x64_epi64(B1, _MM_SHUFFLE(0, 3, 2, 1)); \
+        C1 = _mm256_permute4x64_epi64(C1, _MM_SHUFFLE(1, 0, 3, 2)); \
+        D1 = _mm256_permute4x64_epi64(D1, _MM_SHUFFLE(2, 1, 0, 3)); \
+    } while((void)0, 0);
+
+#define DIAGONALIZE_2(A0, A1, B0, B1, C0, C1, D0, D1) \
+    do { \
+        __m256i tmp1 = _mm256_blend_epi32(B0, B1, 0xCC); \
+        __m256i tmp2 = _mm256_blend_epi32(B0, B1, 0x33); \
+        B1 = _mm256_permute4x64_epi64(tmp1, _MM_SHUFFLE(2,3,0,1)); \
+        B0 = _mm256_permute4x64_epi64(tmp2, _MM_SHUFFLE(2,3,0,1)); \
+        \
+        tmp1 = C0; \
+        C0 = C1; \
+        C1 = tmp1; \
+        \
+        tmp1 = _mm256_blend_epi32(D0, D1, 0xCC); \
+        tmp2 = _mm256_blend_epi32(D0, D1, 0x33); \
+        D0 = _mm256_permute4x64_epi64(tmp1, _MM_SHUFFLE(2,3,0,1)); \
+        D1 = _mm256_permute4x64_epi64(tmp2, _MM_SHUFFLE(2,3,0,1)); \
+    } while(0);
+
+#define UNDIAGONALIZE_1(A0, B0, C0, D0, A1, B1, C1, D1) \
+    do { \
+        B0 = _mm256_permute4x64_epi64(B0, _MM_SHUFFLE(2, 1, 0, 3)); \
+        C0 = _mm256_permute4x64_epi64(C0, _MM_SHUFFLE(1, 0, 3, 2)); \
+        D0 = _mm256_permute4x64_epi64(D0, _MM_SHUFFLE(0, 3, 2, 1)); \
+        \
+        B1 = _mm256_permute4x64_epi64(B1, _MM_SHUFFLE(2, 1, 0, 3)); \
+        C1 = _mm256_permute4x64_epi64(C1, _MM_SHUFFLE(1, 0, 3, 2)); \
+        D1 = _mm256_permute4x64_epi64(D1, _MM_SHUFFLE(0, 3, 2, 1)); \
+    } while((void)0, 0);
+
+#define UNDIAGONALIZE_2(A0, A1, B0, B1, C0, C1, D0, D1) \
+    do { \
+        __m256i tmp1 = _mm256_blend_epi32(B0, B1, 0xCC); \
+        __m256i tmp2 = _mm256_blend_epi32(B0, B1, 0x33); \
+        B0 = _mm256_permute4x64_epi64(tmp1, _MM_SHUFFLE(2,3,0,1)); \
+        B1 = _mm256_permute4x64_epi64(tmp2, _MM_SHUFFLE(2,3,0,1)); \
+        \
+        tmp1 = C0; \
+        C0 = C1; \
+        C1 = tmp1; \
+        \
+        tmp1 = _mm256_blend_epi32(D0, D1, 0x33); \
+        tmp2 = _mm256_blend_epi32(D0, D1, 0xCC); \
+        D0 = _mm256_permute4x64_epi64(tmp1, _MM_SHUFFLE(2,3,0,1)); \
+        D1 = _mm256_permute4x64_epi64(tmp2, _MM_SHUFFLE(2,3,0,1)); \
+    } while((void)0, 0);
+
+#define BLAKE2_ROUND_1(A0, A1, B0, B1, C0, C1, D0, D1) \
+    do{ \
+        G1_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        G2_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        \
+        DIAGONALIZE_1(A0, B0, C0, D0, A1, B1, C1, D1) \
+        \
+        G1_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        G2_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        \
+        UNDIAGONALIZE_1(A0, B0, C0, D0, A1, B1, C1, D1) \
+    } while((void)0, 0);
+
+#define BLAKE2_ROUND_2(A0, A1, B0, B1, C0, C1, D0, D1) \
+    do{ \
+        G1_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        G2_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        \
+        DIAGONALIZE_2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        \
+        G1_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        G2_AVX2(A0, A1, B0, B1, C0, C1, D0, D1) \
+        \
+        UNDIAGONALIZE_2(A0, A1, B0, B1, C0, C1, D0, D1) \
+    } while((void)0, 0);
+
+#endif /* __AVX2__ */
+
+#else /* __AVX512F__ */
+
+#include <immintrin.h>
+
+#define ror64(x, n) _mm512_ror_epi64((x), (n))
+
+static __m512i muladd(__m512i x, __m512i y)
+{
+    __m512i z = _mm512_mul_epu32(x, y);
+    return _mm512_add_epi64(_mm512_add_epi64(x, y), _mm512_add_epi64(z, z));
+}
+
+#define G1(A0, B0, C0, D0, A1, B1, C1, D1) \
+    do { \
+        A0 = muladd(A0, B0); \
+        A1 = muladd(A1, B1); \
+\
+        D0 = _mm512_xor_si512(D0, A0); \
+        D1 = _mm512_xor_si512(D1, A1); \
+\
+        D0 = ror64(D0, 32); \
+        D1 = ror64(D1, 32); \
+\
+        C0 = muladd(C0, D0); \
+        C1 = muladd(C1, D1); \
+\
+        B0 = _mm512_xor_si512(B0, C0); \
+        B1 = _mm512_xor_si512(B1, C1); \
+\
+        B0 = ror64(B0, 24); \
+        B1 = ror64(B1, 24); \
+    } while ((void)0, 0)
+
+#define G2(A0, B0, C0, D0, A1, B1, C1, D1) \
+    do { \
+        A0 = muladd(A0, B0); \
+        A1 = muladd(A1, B1); \
+\
+        D0 = _mm512_xor_si512(D0, A0); \
+        D1 = _mm512_xor_si512(D1, A1); \
+\
+        D0 = ror64(D0, 16); \
+        D1 = ror64(D1, 16); \
+\
+        C0 = muladd(C0, D0); \
+        C1 = muladd(C1, D1); \
+\
+        B0 = _mm512_xor_si512(B0, C0); \
+        B1 = _mm512_xor_si512(B1, C1); \
+\
+        B0 = ror64(B0, 63); \
+        B1 = ror64(B1, 63); \
+    } while ((void)0, 0)
+
+#define DIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1) \
+    do { \
+        B0 = _mm512_permutex_epi64(B0, _MM_SHUFFLE(0, 3, 2, 1)); \
+        B1 = _mm512_permutex_epi64(B1, _MM_SHUFFLE(0, 3, 2, 1)); \
+\
+        C0 = _mm512_permutex_epi64(C0, _MM_SHUFFLE(1, 0, 3, 2)); \
+        C1 = _mm512_permutex_epi64(C1, _MM_SHUFFLE(1, 0, 3, 2)); \
+\
+        D0 = _mm512_permutex_epi64(D0, _MM_SHUFFLE(2, 1, 0, 3)); \
+        D1 = _mm512_permutex_epi64(D1, _MM_SHUFFLE(2, 1, 0, 3)); \
+    } while ((void)0, 0)
+
+#define UNDIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1) \
+    do { \
+        B0 = _mm512_permutex_epi64(B0, _MM_SHUFFLE(2, 1, 0, 3)); \
+        B1 = _mm512_permutex_epi64(B1, _MM_SHUFFLE(2, 1, 0, 3)); \
+\
+        C0 = _mm512_permutex_epi64(C0, _MM_SHUFFLE(1, 0, 3, 2)); \
+        C1 = _mm512_permutex_epi64(C1, _MM_SHUFFLE(1, 0, 3, 2)); \
+\
+        D0 = _mm512_permutex_epi64(D0, _MM_SHUFFLE(0, 3, 2, 1)); \
+        D1 = _mm512_permutex_epi64(D1, _MM_SHUFFLE(0, 3, 2, 1)); \
+    } while ((void)0, 0)
+
+#define BLAKE2_ROUND(A0, B0, C0, D0, A1, B1, C1, D1) \
+    do { \
+        G1(A0, B0, C0, D0, A1, B1, C1, D1); \
+        G2(A0, B0, C0, D0, A1, B1, C1, D1); \
+\
+        DIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1); \
+\
+        G1(A0, B0, C0, D0, A1, B1, C1, D1); \
+        G2(A0, B0, C0, D0, A1, B1, C1, D1); \
+\
+        UNDIAGONALIZE(A0, B0, C0, D0, A1, B1, C1, D1); \
+    } while ((void)0, 0)
+
+#define SWAP_HALVES(A0, A1) \
+    do { \
+        __m512i t0, t1; \
+        t0 = _mm512_shuffle_i64x2(A0, A1, _MM_SHUFFLE(1, 0, 1, 0)); \
+        t1 = _mm512_shuffle_i64x2(A0, A1, _MM_SHUFFLE(3, 2, 3, 2)); \
+        A0 = t0; \
+        A1 = t1; \
+    } while((void)0, 0)
+
+#define SWAP_QUARTERS(A0, A1) \
+    do { \
+        SWAP_HALVES(A0, A1); \
+        A0 = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), A0); \
+        A1 = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), A1); \
+    } while((void)0, 0)
+
+#define UNSWAP_QUARTERS(A0, A1) \
+    do { \
+        A0 = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), A0); \
+        A1 = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7), A1); \
+        SWAP_HALVES(A0, A1); \
+    } while((void)0, 0)
+
+#define BLAKE2_ROUND_1(A0, C0, B0, D0, A1, C1, B1, D1) \
+    do { \
+        SWAP_HALVES(A0, B0); \
+        SWAP_HALVES(C0, D0); \
+        SWAP_HALVES(A1, B1); \
+        SWAP_HALVES(C1, D1); \
+        BLAKE2_ROUND(A0, B0, C0, D0, A1, B1, C1, D1); \
+        SWAP_HALVES(A0, B0); \
+        SWAP_HALVES(C0, D0); \
+        SWAP_HALVES(A1, B1); \
+        SWAP_HALVES(C1, D1); \
+    } while ((void)0, 0)
+
+#define BLAKE2_ROUND_2(A0, A1, B0, B1, C0, C1, D0, D1) \
+    do { \
+        SWAP_QUARTERS(A0, A1); \
+        SWAP_QUARTERS(B0, B1); \
+        SWAP_QUARTERS(C0, C1); \
+        SWAP_QUARTERS(D0, D1); \
+        BLAKE2_ROUND(A0, B0, C0, D0, A1, B1, C1, D1); \
+        UNSWAP_QUARTERS(A0, A1); \
+        UNSWAP_QUARTERS(B0, B1); \
+        UNSWAP_QUARTERS(C0, C1); \
+        UNSWAP_QUARTERS(D0, D1); \
+    } while ((void)0, 0)
+
+#endif /* __AVX512F__ */
+#endif /* BLAKE_ROUND_MKA_OPT_H */
diff --git a/lib/crypto_backend/argon2/blake2/blamka-round-ref.h b/lib/crypto_backend/argon2/blake2/blamka-round-ref.h
new file mode 100644 (file)
index 0000000..b8f2cf4
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef BLAKE_ROUND_MKA_H
+#define BLAKE_ROUND_MKA_H
+
+#include "blake2.h"
+#include "blake2-impl.h"
+
+/* designed by the Lyra PHC team */
+static BLAKE2_INLINE uint64_t fBlaMka(uint64_t x, uint64_t y) {
+    const uint64_t m = UINT64_C(0xFFFFFFFF);
+    const uint64_t xy = (x & m) * (y & m);
+    return x + y + 2 * xy;
+}
+
+#define G(a, b, c, d)                                                          \
+    do {                                                                       \
+        a = fBlaMka(a, b);                                                     \
+        d = rotr64(d ^ a, 32);                                                 \
+        c = fBlaMka(c, d);                                                     \
+        b = rotr64(b ^ c, 24);                                                 \
+        a = fBlaMka(a, b);                                                     \
+        d = rotr64(d ^ a, 16);                                                 \
+        c = fBlaMka(c, d);                                                     \
+        b = rotr64(b ^ c, 63);                                                 \
+    } while ((void)0, 0)
+
+#define BLAKE2_ROUND_NOMSG(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,   \
+                           v12, v13, v14, v15)                                 \
+    do {                                                                       \
+        G(v0, v4, v8, v12);                                                    \
+        G(v1, v5, v9, v13);                                                    \
+        G(v2, v6, v10, v14);                                                   \
+        G(v3, v7, v11, v15);                                                   \
+        G(v0, v5, v10, v15);                                                   \
+        G(v1, v6, v11, v12);                                                   \
+        G(v2, v7, v8, v13);                                                    \
+        G(v3, v4, v9, v14);                                                    \
+    } while ((void)0, 0)
+
+#endif
diff --git a/lib/crypto_backend/argon2/core.c b/lib/crypto_backend/argon2/core.c
new file mode 100644 (file)
index 0000000..f5b0067
--- /dev/null
@@ -0,0 +1,641 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+/*For memory wiping*/
+#ifdef _MSC_VER
+#include <windows.h>
+#include <winbase.h> /* For SecureZeroMemory */
+#endif
+#if defined __STDC_LIB_EXT1__
+#define __STDC_WANT_LIB_EXT1__ 1
+#endif
+#define VC_GE_2005(version) (version >= 1400)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "core.h"
+#include "thread.h"
+#include "blake2/blake2.h"
+#include "blake2/blake2-impl.h"
+
+#ifdef GENKAT
+#include "genkat.h"
+#endif
+
+#if defined(__clang__)
+#if __has_attribute(optnone)
+#define NOT_OPTIMIZED __attribute__((optnone))
+#endif
+#elif defined(__GNUC__)
+#define GCC_VERSION                                                            \
+    (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#if GCC_VERSION >= 40400
+#define NOT_OPTIMIZED __attribute__((optimize("O0")))
+#endif
+#endif
+#ifndef NOT_OPTIMIZED
+#define NOT_OPTIMIZED
+#endif
+
+/***************Instance and Position constructors**********/
+void init_block_value(block *b, uint8_t in) { memset(b->v, in, sizeof(b->v)); }
+
+void copy_block(block *dst, const block *src) {
+    memcpy(dst->v, src->v, sizeof(uint64_t) * ARGON2_QWORDS_IN_BLOCK);
+}
+
+void xor_block(block *dst, const block *src) {
+    int i;
+    for (i = 0; i < ARGON2_QWORDS_IN_BLOCK; ++i) {
+        dst->v[i] ^= src->v[i];
+    }
+}
+
+static void load_block(block *dst, const void *input) {
+    unsigned i;
+    for (i = 0; i < ARGON2_QWORDS_IN_BLOCK; ++i) {
+        dst->v[i] = load64((const uint8_t *)input + i * sizeof(dst->v[i]));
+    }
+}
+
+static void store_block(void *output, const block *src) {
+    unsigned i;
+    for (i = 0; i < ARGON2_QWORDS_IN_BLOCK; ++i) {
+        store64((uint8_t *)output + i * sizeof(src->v[i]), src->v[i]);
+    }
+}
+
+/***************Memory functions*****************/
+
+int allocate_memory(const argon2_context *context, uint8_t **memory,
+                    size_t num, size_t size) {
+    size_t memory_size = num*size;
+    if (memory == NULL) {
+        return ARGON2_MEMORY_ALLOCATION_ERROR;
+    }
+
+    /* 1. Check for multiplication overflow */
+    if (size != 0 && memory_size / size != num) {
+        return ARGON2_MEMORY_ALLOCATION_ERROR;
+    }
+
+    /* 2. Try to allocate with appropriate allocator */
+    if (context->allocate_cbk) {
+        (context->allocate_cbk)(memory, memory_size);
+    } else {
+        *memory = malloc(memory_size);
+    }
+
+    if (*memory == NULL) {
+        return ARGON2_MEMORY_ALLOCATION_ERROR;
+    }
+
+    return ARGON2_OK;
+}
+
+void free_memory(const argon2_context *context, uint8_t *memory,
+                 size_t num, size_t size) {
+    size_t memory_size = num*size;
+    clear_internal_memory(memory, memory_size);
+    if (context->free_cbk) {
+        (context->free_cbk)(memory, memory_size);
+    } else {
+        free(memory);
+    }
+}
+
+void NOT_OPTIMIZED secure_wipe_memory(void *v, size_t n) {
+#if defined(_MSC_VER) && VC_GE_2005(_MSC_VER)
+    SecureZeroMemory(v, n);
+#elif defined memset_s
+    memset_s(v, n, 0, n);
+#elif defined(HAVE_EXPLICIT_BZERO)
+    explicit_bzero(v, n);
+#else
+    static void *(*const volatile memset_sec)(void *, int, size_t) = &memset;
+    memset_sec(v, 0, n);
+#endif
+}
+
+/* Memory clear flag defaults to true. */
+int FLAG_clear_internal_memory = 1;
+void clear_internal_memory(void *v, size_t n) {
+  if (FLAG_clear_internal_memory && v) {
+    secure_wipe_memory(v, n);
+  }
+}
+
+void finalize(const argon2_context *context, argon2_instance_t *instance) {
+    if (context != NULL && instance != NULL) {
+        block blockhash;
+        uint32_t l;
+
+        copy_block(&blockhash, instance->memory + instance->lane_length - 1);
+
+        /* XOR the last blocks */
+        for (l = 1; l < instance->lanes; ++l) {
+            uint32_t last_block_in_lane =
+                l * instance->lane_length + (instance->lane_length - 1);
+            xor_block(&blockhash, instance->memory + last_block_in_lane);
+        }
+
+        /* Hash the result */
+        {
+            uint8_t blockhash_bytes[ARGON2_BLOCK_SIZE];
+            store_block(blockhash_bytes, &blockhash);
+            blake2b_long(context->out, context->outlen, blockhash_bytes,
+                         ARGON2_BLOCK_SIZE);
+            /* clear blockhash and blockhash_bytes */
+            clear_internal_memory(blockhash.v, ARGON2_BLOCK_SIZE);
+            clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
+        }
+
+#ifdef GENKAT
+        print_tag(context->out, context->outlen);
+#endif
+
+        free_memory(context, (uint8_t *)instance->memory,
+                    instance->memory_blocks, sizeof(block));
+    }
+}
+
+uint32_t index_alpha(const argon2_instance_t *instance,
+                     const argon2_position_t *position, uint32_t pseudo_rand,
+                     int same_lane) {
+    /*
+     * Pass 0:
+     *      This lane : all already finished segments plus already constructed
+     * blocks in this segment
+     *      Other lanes : all already finished segments
+     * Pass 1+:
+     *      This lane : (SYNC_POINTS - 1) last segments plus already constructed
+     * blocks in this segment
+     *      Other lanes : (SYNC_POINTS - 1) last segments
+     */
+    uint32_t reference_area_size;
+    uint64_t relative_position;
+    uint32_t start_position, absolute_position;
+
+    if (0 == position->pass) {
+        /* First pass */
+        if (0 == position->slice) {
+            /* First slice */
+            reference_area_size =
+                position->index - 1; /* all but the previous */
+        } else {
+            if (same_lane) {
+                /* The same lane => add current segment */
+                reference_area_size =
+                    position->slice * instance->segment_length +
+                    position->index - 1;
+            } else {
+                reference_area_size =
+                    position->slice * instance->segment_length +
+                    ((position->index == 0) ? (-1) : 0);
+            }
+        }
+    } else {
+        /* Second pass */
+        if (same_lane) {
+            reference_area_size = instance->lane_length -
+                                  instance->segment_length + position->index -
+                                  1;
+        } else {
+            reference_area_size = instance->lane_length -
+                                  instance->segment_length +
+                                  ((position->index == 0) ? (-1) : 0);
+        }
+    }
+
+    /* 1.2.4. Mapping pseudo_rand to 0..<reference_area_size-1> and produce
+     * relative position */
+    relative_position = pseudo_rand;
+    relative_position = relative_position * relative_position >> 32;
+    relative_position = reference_area_size - 1 -
+                        (reference_area_size * relative_position >> 32);
+
+    /* 1.2.5 Computing starting position */
+    start_position = 0;
+
+    if (0 != position->pass) {
+        start_position = (position->slice == ARGON2_SYNC_POINTS - 1)
+                             ? 0
+                             : (position->slice + 1) * instance->segment_length;
+    }
+
+    /* 1.2.6. Computing absolute position */
+    absolute_position = (start_position + relative_position) %
+                        instance->lane_length; /* absolute position */
+    return absolute_position;
+}
+
+/* Single-threaded version for p=1 case */
+static int fill_memory_blocks_st(argon2_instance_t *instance) {
+    uint32_t r, s, l;
+
+    for (r = 0; r < instance->passes; ++r) {
+        for (s = 0; s < ARGON2_SYNC_POINTS; ++s) {
+            for (l = 0; l < instance->lanes; ++l) {
+                argon2_position_t position = {r, l, (uint8_t)s, 0};
+                fill_segment(instance, position);
+            }
+        }
+#ifdef GENKAT
+        internal_kat(instance, r); /* Print all memory blocks */
+#endif
+    }
+    return ARGON2_OK;
+}
+
+#if !defined(ARGON2_NO_THREADS)
+
+#ifdef _WIN32
+static unsigned __stdcall fill_segment_thr(void *thread_data)
+#else
+static void *fill_segment_thr(void *thread_data)
+#endif
+{
+    argon2_thread_data *my_data = thread_data;
+    fill_segment(my_data->instance_ptr, my_data->pos);
+    argon2_thread_exit();
+    return 0;
+}
+
+/* Multi-threaded version for p > 1 case */
+static int fill_memory_blocks_mt(argon2_instance_t *instance) {
+    uint32_t r, s;
+    argon2_thread_handle_t *thread = NULL;
+    argon2_thread_data *thr_data = NULL;
+    int rc = ARGON2_OK;
+
+    /* 1. Allocating space for threads */
+    thread = calloc(instance->lanes, sizeof(argon2_thread_handle_t));
+    if (thread == NULL) {
+        rc = ARGON2_MEMORY_ALLOCATION_ERROR;
+        goto fail;
+    }
+
+    thr_data = calloc(instance->lanes, sizeof(argon2_thread_data));
+    if (thr_data == NULL) {
+        rc = ARGON2_MEMORY_ALLOCATION_ERROR;
+        goto fail;
+    }
+
+    for (r = 0; r < instance->passes; ++r) {
+        for (s = 0; s < ARGON2_SYNC_POINTS; ++s) {
+            uint32_t l, ll;
+
+            /* 2. Calling threads */
+            for (l = 0; l < instance->lanes; ++l) {
+                argon2_position_t position;
+
+                /* 2.1 Join a thread if limit is exceeded */
+                if (l >= instance->threads) {
+                    if (argon2_thread_join(thread[l - instance->threads])) {
+                        rc = ARGON2_THREAD_FAIL;
+                        goto fail;
+                    }
+                }
+
+                /* 2.2 Create thread */
+                position.pass = r;
+                position.lane = l;
+                position.slice = (uint8_t)s;
+                position.index = 0;
+                thr_data[l].instance_ptr =
+                    instance; /* preparing the thread input */
+                memcpy(&(thr_data[l].pos), &position,
+                       sizeof(argon2_position_t));
+                if (argon2_thread_create(&thread[l], &fill_segment_thr,
+                                         (void *)&thr_data[l])) {
+                    /* Wait for already running threads */
+                    for (ll = 0; ll < l; ++ll)
+                        argon2_thread_join(thread[ll]);
+                    rc = ARGON2_THREAD_FAIL;
+                    goto fail;
+                }
+
+                /* fill_segment(instance, position); */
+                /*Non-thread equivalent of the lines above */
+            }
+
+            /* 3. Joining remaining threads */
+            for (l = instance->lanes - instance->threads; l < instance->lanes;
+                 ++l) {
+                if (argon2_thread_join(thread[l])) {
+                    rc = ARGON2_THREAD_FAIL;
+                    goto fail;
+                }
+            }
+        }
+
+#ifdef GENKAT
+        internal_kat(instance, r); /* Print all memory blocks */
+#endif
+    }
+
+fail:
+    if (thread != NULL) {
+        free(thread);
+    }
+    if (thr_data != NULL) {
+        free(thr_data);
+    }
+    return rc;
+}
+
+#endif /* ARGON2_NO_THREADS */
+
+int fill_memory_blocks(argon2_instance_t *instance) {
+       if (instance == NULL || instance->lanes == 0) {
+           return ARGON2_INCORRECT_PARAMETER;
+    }
+#if defined(ARGON2_NO_THREADS)
+    return fill_memory_blocks_st(instance);
+#else
+    return instance->threads == 1 ?
+                       fill_memory_blocks_st(instance) : fill_memory_blocks_mt(instance);
+#endif
+}
+
+int validate_inputs(const argon2_context *context) {
+    if (NULL == context) {
+        return ARGON2_INCORRECT_PARAMETER;
+    }
+
+    if (NULL == context->out) {
+        return ARGON2_OUTPUT_PTR_NULL;
+    }
+
+    /* Validate output length */
+    if (ARGON2_MIN_OUTLEN > context->outlen) {
+        return ARGON2_OUTPUT_TOO_SHORT;
+    }
+
+    if (ARGON2_MAX_OUTLEN < context->outlen) {
+        return ARGON2_OUTPUT_TOO_LONG;
+    }
+
+    /* Validate password (required param) */
+    if (NULL == context->pwd) {
+        if (0 != context->pwdlen) {
+            return ARGON2_PWD_PTR_MISMATCH;
+        }
+    }
+#if ARGON2_MIN_PWD_LENGTH > 0 /* cryptsetup: fix gcc warning */
+    if (ARGON2_MIN_PWD_LENGTH > context->pwdlen) {
+      return ARGON2_PWD_TOO_SHORT;
+    }
+#endif
+    if (ARGON2_MAX_PWD_LENGTH < context->pwdlen) {
+        return ARGON2_PWD_TOO_LONG;
+    }
+
+    /* Validate salt (required param) */
+    if (NULL == context->salt) {
+        if (0 != context->saltlen) {
+            return ARGON2_SALT_PTR_MISMATCH;
+        }
+    }
+
+    if (ARGON2_MIN_SALT_LENGTH > context->saltlen) {
+        return ARGON2_SALT_TOO_SHORT;
+    }
+
+    if (ARGON2_MAX_SALT_LENGTH < context->saltlen) {
+        return ARGON2_SALT_TOO_LONG;
+    }
+
+    /* Validate secret (optional param) */
+    if (NULL == context->secret) {
+        if (0 != context->secretlen) {
+            return ARGON2_SECRET_PTR_MISMATCH;
+        }
+    } else {
+#if ARGON2_MIN_SECRET > 0 /* cryptsetup: fix gcc warning */
+        if (ARGON2_MIN_SECRET > context->secretlen) {
+            return ARGON2_SECRET_TOO_SHORT;
+        }
+#endif
+        if (ARGON2_MAX_SECRET < context->secretlen) {
+            return ARGON2_SECRET_TOO_LONG;
+        }
+    }
+
+    /* Validate associated data (optional param) */
+    if (NULL == context->ad) {
+        if (0 != context->adlen) {
+            return ARGON2_AD_PTR_MISMATCH;
+        }
+    } else {
+#if ARGON2_MIN_AD_LENGTH > 0 /* cryptsetup: fix gcc warning */
+        if (ARGON2_MIN_AD_LENGTH > context->adlen) {
+            return ARGON2_AD_TOO_SHORT;
+        }
+#endif
+        if (ARGON2_MAX_AD_LENGTH < context->adlen) {
+            return ARGON2_AD_TOO_LONG;
+        }
+    }
+
+    /* Validate memory cost */
+    if (ARGON2_MIN_MEMORY > context->m_cost) {
+        return ARGON2_MEMORY_TOO_LITTLE;
+    }
+#if 0 /* UINT32_MAX, cryptsetup: fix gcc warning */
+    if (ARGON2_MAX_MEMORY < context->m_cost) {
+        return ARGON2_MEMORY_TOO_MUCH;
+    }
+#endif
+    if (context->m_cost < 8 * context->lanes) {
+        return ARGON2_MEMORY_TOO_LITTLE;
+    }
+
+    /* Validate time cost */
+    if (ARGON2_MIN_TIME > context->t_cost) {
+        return ARGON2_TIME_TOO_SMALL;
+    }
+
+    if (ARGON2_MAX_TIME < context->t_cost) {
+        return ARGON2_TIME_TOO_LARGE;
+    }
+
+    /* Validate lanes */
+    if (ARGON2_MIN_LANES > context->lanes) {
+        return ARGON2_LANES_TOO_FEW;
+    }
+
+    if (ARGON2_MAX_LANES < context->lanes) {
+        return ARGON2_LANES_TOO_MANY;
+    }
+
+    /* Validate threads */
+    if (ARGON2_MIN_THREADS > context->threads) {
+        return ARGON2_THREADS_TOO_FEW;
+    }
+
+    if (ARGON2_MAX_THREADS < context->threads) {
+        return ARGON2_THREADS_TOO_MANY;
+    }
+
+    if (NULL != context->allocate_cbk && NULL == context->free_cbk) {
+        return ARGON2_FREE_MEMORY_CBK_NULL;
+    }
+
+    if (NULL == context->allocate_cbk && NULL != context->free_cbk) {
+        return ARGON2_ALLOCATE_MEMORY_CBK_NULL;
+    }
+
+    return ARGON2_OK;
+}
+
+void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance) {
+    uint32_t l;
+    /* Make the first and second block in each lane as G(H0||0||i) or
+       G(H0||1||i) */
+    uint8_t blockhash_bytes[ARGON2_BLOCK_SIZE];
+    for (l = 0; l < instance->lanes; ++l) {
+
+        store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 0);
+        store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH + 4, l);
+        blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
+                     ARGON2_PREHASH_SEED_LENGTH);
+        load_block(&instance->memory[l * instance->lane_length + 0],
+                   blockhash_bytes);
+
+        store32(blockhash + ARGON2_PREHASH_DIGEST_LENGTH, 1);
+        blake2b_long(blockhash_bytes, ARGON2_BLOCK_SIZE, blockhash,
+                     ARGON2_PREHASH_SEED_LENGTH);
+        load_block(&instance->memory[l * instance->lane_length + 1],
+                   blockhash_bytes);
+    }
+    clear_internal_memory(blockhash_bytes, ARGON2_BLOCK_SIZE);
+}
+
+void initial_hash(uint8_t *blockhash, argon2_context *context,
+                  argon2_type type) {
+    blake2b_state BlakeHash;
+    uint8_t value[sizeof(uint32_t)];
+
+    if (NULL == context || NULL == blockhash) {
+        return;
+    }
+
+    blake2b_init(&BlakeHash, ARGON2_PREHASH_DIGEST_LENGTH);
+
+    store32(&value, context->lanes);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    store32(&value, context->outlen);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    store32(&value, context->m_cost);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    store32(&value, context->t_cost);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    store32(&value, context->version);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    store32(&value, (uint32_t)type);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    store32(&value, context->pwdlen);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    if (context->pwd != NULL) {
+        blake2b_update(&BlakeHash, (const uint8_t *)context->pwd,
+                       context->pwdlen);
+
+        if (context->flags & ARGON2_FLAG_CLEAR_PASSWORD) {
+            secure_wipe_memory(context->pwd, context->pwdlen);
+            context->pwdlen = 0;
+        }
+    }
+
+    store32(&value, context->saltlen);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    if (context->salt != NULL) {
+        blake2b_update(&BlakeHash, (const uint8_t *)context->salt,
+                       context->saltlen);
+    }
+
+    store32(&value, context->secretlen);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    if (context->secret != NULL) {
+        blake2b_update(&BlakeHash, (const uint8_t *)context->secret,
+                       context->secretlen);
+
+        if (context->flags & ARGON2_FLAG_CLEAR_SECRET) {
+            secure_wipe_memory(context->secret, context->secretlen);
+            context->secretlen = 0;
+        }
+    }
+
+    store32(&value, context->adlen);
+    blake2b_update(&BlakeHash, (const uint8_t *)&value, sizeof(value));
+
+    if (context->ad != NULL) {
+        blake2b_update(&BlakeHash, (const uint8_t *)context->ad,
+                       context->adlen);
+    }
+
+    blake2b_final(&BlakeHash, blockhash, ARGON2_PREHASH_DIGEST_LENGTH);
+}
+
+int initialize(argon2_instance_t *instance, argon2_context *context) {
+    uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH];
+    int result = ARGON2_OK;
+
+    if (instance == NULL || context == NULL)
+        return ARGON2_INCORRECT_PARAMETER;
+    instance->context_ptr = context;
+
+    /* 1. Memory allocation */
+    result = allocate_memory(context, (uint8_t **)&(instance->memory),
+                             instance->memory_blocks, sizeof(block));
+    if (result != ARGON2_OK) {
+        return result;
+    }
+
+    /* 2. Initial hashing */
+    /* H_0 + 8 extra bytes to produce the first blocks */
+    /* uint8_t blockhash[ARGON2_PREHASH_SEED_LENGTH]; */
+    /* Hashing all inputs */
+    initial_hash(blockhash, context, instance->type);
+    /* Zeroing 8 extra bytes */
+    clear_internal_memory(blockhash + ARGON2_PREHASH_DIGEST_LENGTH,
+                          ARGON2_PREHASH_SEED_LENGTH -
+                              ARGON2_PREHASH_DIGEST_LENGTH);
+
+#ifdef GENKAT
+    initial_kat(blockhash, context, instance->type);
+#endif
+
+    /* 3. Creating first blocks, we always have at least two blocks in a slice
+     */
+    fill_first_blocks(blockhash, instance);
+    /* Clearing the hash */
+    clear_internal_memory(blockhash, ARGON2_PREHASH_SEED_LENGTH);
+
+    return ARGON2_OK;
+}
diff --git a/lib/crypto_backend/argon2/core.h b/lib/crypto_backend/argon2/core.h
new file mode 100644 (file)
index 0000000..78000ba
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef ARGON2_CORE_H
+#define ARGON2_CORE_H
+
+#include "argon2.h"
+
+#define CONST_CAST(x) (x)(uintptr_t)
+
+/**********************Argon2 internal constants*******************************/
+
+enum argon2_core_constants {
+    /* Memory block size in bytes */
+    ARGON2_BLOCK_SIZE = 1024,
+    ARGON2_QWORDS_IN_BLOCK = ARGON2_BLOCK_SIZE / 8,
+    ARGON2_OWORDS_IN_BLOCK = ARGON2_BLOCK_SIZE / 16,
+    ARGON2_HWORDS_IN_BLOCK = ARGON2_BLOCK_SIZE / 32,
+    ARGON2_512BIT_WORDS_IN_BLOCK = ARGON2_BLOCK_SIZE / 64,
+
+    /* Number of pseudo-random values generated by one call to Blake in Argon2i
+       to
+       generate reference block positions */
+    ARGON2_ADDRESSES_IN_BLOCK = 128,
+
+    /* Pre-hashing digest length and its extension*/
+    ARGON2_PREHASH_DIGEST_LENGTH = 64,
+    ARGON2_PREHASH_SEED_LENGTH = 72
+};
+
+/*************************Argon2 internal data types***********************/
+
+/*
+ * Structure for the (1KB) memory block implemented as 128 64-bit words.
+ * Memory blocks can be copied, XORed. Internal words can be accessed by [] (no
+ * bounds checking).
+ */
+typedef struct block_ { uint64_t v[ARGON2_QWORDS_IN_BLOCK]; } block;
+
+/*****************Functions that work with the block******************/
+
+/* Initialize each byte of the block with @in */
+void init_block_value(block *b, uint8_t in);
+
+/* Copy block @src to block @dst */
+void copy_block(block *dst, const block *src);
+
+/* XOR @src onto @dst bytewise */
+void xor_block(block *dst, const block *src);
+
+/*
+ * Argon2 instance: memory pointer, number of passes, amount of memory, type,
+ * and derived values.
+ * Used to evaluate the number and location of blocks to construct in each
+ * thread
+ */
+typedef struct Argon2_instance_t {
+    block *memory;          /* Memory pointer */
+    uint32_t version;
+    uint32_t passes;        /* Number of passes */
+    uint32_t memory_blocks; /* Number of blocks in memory */
+    uint32_t segment_length;
+    uint32_t lane_length;
+    uint32_t lanes;
+    uint32_t threads;
+    argon2_type type;
+    int print_internals; /* whether to print the memory blocks */
+    argon2_context *context_ptr; /* points back to original context */
+} argon2_instance_t;
+
+/*
+ * Argon2 position: where we construct the block right now. Used to distribute
+ * work between threads.
+ */
+typedef struct Argon2_position_t {
+    uint32_t pass;
+    uint32_t lane;
+    uint8_t slice;
+    uint32_t index;
+} argon2_position_t;
+
+/*Struct that holds the inputs for thread handling FillSegment*/
+typedef struct Argon2_thread_data {
+    argon2_instance_t *instance_ptr;
+    argon2_position_t pos;
+} argon2_thread_data;
+
+/*************************Argon2 core functions********************************/
+
+/* Allocates memory to the given pointer, uses the appropriate allocator as
+ * specified in the context. Total allocated memory is num*size.
+ * @param context argon2_context which specifies the allocator
+ * @param memory pointer to the pointer to the memory
+ * @param size the size in bytes for each element to be allocated
+ * @param num the number of elements to be allocated
+ * @return ARGON2_OK if @memory is a valid pointer and memory is allocated
+ */
+int allocate_memory(const argon2_context *context, uint8_t **memory,
+                    size_t num, size_t size);
+
+/*
+ * Frees memory at the given pointer, uses the appropriate deallocator as
+ * specified in the context. Also cleans the memory using clear_internal_memory.
+ * @param context argon2_context which specifies the deallocator
+ * @param memory pointer to buffer to be freed
+ * @param size the size in bytes for each element to be deallocated
+ * @param num the number of elements to be deallocated
+ */
+void free_memory(const argon2_context *context, uint8_t *memory,
+                 size_t num, size_t size);
+
+/* Function that securely cleans the memory. This ignores any flags set
+ * regarding clearing memory. Usually one just calls clear_internal_memory.
+ * @param mem Pointer to the memory
+ * @param s Memory size in bytes
+ */
+void secure_wipe_memory(void *v, size_t n);
+
+/* Function that securely clears the memory if FLAG_clear_internal_memory is
+ * set. If the flag isn't set, this function does nothing.
+ * @param mem Pointer to the memory
+ * @param s Memory size in bytes
+ */
+void clear_internal_memory(void *v, size_t n);
+
+/*
+ * Computes absolute position of reference block in the lane following a skewed
+ * distribution and using a pseudo-random value as input
+ * @param instance Pointer to the current instance
+ * @param position Pointer to the current position
+ * @param pseudo_rand 32-bit pseudo-random value used to determine the position
+ * @param same_lane Indicates if the block will be taken from the current lane.
+ * If so we can reference the current segment
+ * @pre All pointers must be valid
+ */
+uint32_t index_alpha(const argon2_instance_t *instance,
+                     const argon2_position_t *position, uint32_t pseudo_rand,
+                     int same_lane);
+
+/*
+ * Function that validates all inputs against predefined restrictions and return
+ * an error code
+ * @param context Pointer to current Argon2 context
+ * @return ARGON2_OK if everything is all right, otherwise one of error codes
+ * (all defined in <argon2.h>
+ */
+int validate_inputs(const argon2_context *context);
+
+/*
+ * Hashes all the inputs into @a blockhash[PREHASH_DIGEST_LENGTH], clears
+ * password and secret if needed
+ * @param  context  Pointer to the Argon2 internal structure containing memory
+ * pointer, and parameters for time and space requirements.
+ * @param  blockhash Buffer for pre-hashing digest
+ * @param  type Argon2 type
+ * @pre    @a blockhash must have at least @a PREHASH_DIGEST_LENGTH bytes
+ * allocated
+ */
+void initial_hash(uint8_t *blockhash, argon2_context *context,
+                  argon2_type type);
+
+/*
+ * Function creates first 2 blocks per lane
+ * @param instance Pointer to the current instance
+ * @param blockhash Pointer to the pre-hashing digest
+ * @pre blockhash must point to @a PREHASH_SEED_LENGTH allocated values
+ */
+void fill_first_blocks(uint8_t *blockhash, const argon2_instance_t *instance);
+
+/*
+ * Function allocates memory, hashes the inputs with Blake,  and creates first
+ * two blocks. Returns the pointer to the main memory with 2 blocks per lane
+ * initialized
+ * @param  context  Pointer to the Argon2 internal structure containing memory
+ * pointer, and parameters for time and space requirements.
+ * @param  instance Current Argon2 instance
+ * @return Zero if successful, -1 if memory failed to allocate. @context->state
+ * will be modified if successful.
+ */
+int initialize(argon2_instance_t *instance, argon2_context *context);
+
+/*
+ * XORing the last block of each lane, hashing it, making the tag. Deallocates
+ * the memory.
+ * @param context Pointer to current Argon2 context (use only the out parameters
+ * from it)
+ * @param instance Pointer to current instance of Argon2
+ * @pre instance->state must point to necessary amount of memory
+ * @pre context->out must point to outlen bytes of memory
+ * @pre if context->free_cbk is not NULL, it should point to a function that
+ * deallocates memory
+ */
+void finalize(const argon2_context *context, argon2_instance_t *instance);
+
+/*
+ * Function that fills the segment using previous segments also from other
+ * threads
+ * @param context current context
+ * @param instance Pointer to the current instance
+ * @param position Current position
+ * @pre all block pointers must be valid
+ */
+void fill_segment(const argon2_instance_t *instance,
+                  argon2_position_t position);
+
+/*
+ * Function that fills the entire memory t_cost times based on the first two
+ * blocks in each lane
+ * @param instance Pointer to the current instance
+ * @return ARGON2_OK if successful, @context->state
+ */
+int fill_memory_blocks(argon2_instance_t *instance);
+
+#endif
diff --git a/lib/crypto_backend/argon2/encoding.c b/lib/crypto_backend/argon2/encoding.c
new file mode 100644 (file)
index 0000000..9de606e
--- /dev/null
@@ -0,0 +1,462 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include "encoding.h"
+#include "core.h"
+
+/*
+ * Example code for a decoder and encoder of "hash strings", with Argon2
+ * parameters.
+ *
+ * This code comprises three sections:
+ *
+ *   -- The first section contains generic Base64 encoding and decoding
+ *   functions. It is conceptually applicable to any hash function
+ *   implementation that uses Base64 to encode and decode parameters,
+ *   salts and outputs. It could be made into a library, provided that
+ *   the relevant functions are made public (non-static) and be given
+ *   reasonable names to avoid collisions with other functions.
+ *
+ *   -- The second section is specific to Argon2. It encodes and decodes
+ *   the parameters, salts and outputs. It does not compute the hash
+ *   itself.
+ *
+ * The code was originally written by Thomas Pornin <pornin@bolet.org>,
+ * to whom comments and remarks may be sent. It is released under what
+ * should amount to Public Domain or its closest equivalent; the
+ * following mantra is supposed to incarnate that fact with all the
+ * proper legal rituals:
+ *
+ * ---------------------------------------------------------------------
+ * This file is provided under the terms of Creative Commons CC0 1.0
+ * Public Domain Dedication. To the extent possible under law, the
+ * author (Thomas Pornin) has waived all copyright and related or
+ * neighboring rights to this file. This work is published from: Canada.
+ * ---------------------------------------------------------------------
+ *
+ * Copyright (c) 2015 Thomas Pornin
+ */
+
+/* ==================================================================== */
+/*
+ * Common code; could be shared between different hash functions.
+ *
+ * Note: the Base64 functions below assume that uppercase letters (resp.
+ * lowercase letters) have consecutive numerical codes, that fit on 8
+ * bits. All modern systems use ASCII-compatible charsets, where these
+ * properties are true. If you are stuck with a dinosaur of a system
+ * that still defaults to EBCDIC then you already have much bigger
+ * interoperability issues to deal with.
+ */
+
+/*
+ * Some macros for constant-time comparisons. These work over values in
+ * the 0..255 range. Returned value is 0x00 on "false", 0xFF on "true".
+ */
+#define EQ(x, y) ((((0U - ((unsigned)(x) ^ (unsigned)(y))) >> 8) & 0xFF) ^ 0xFF)
+#define GT(x, y) ((((unsigned)(y) - (unsigned)(x)) >> 8) & 0xFF)
+#define GE(x, y) (GT(y, x) ^ 0xFF)
+#define LT(x, y) GT(y, x)
+#define LE(x, y) GE(y, x)
+
+/*
+ * Convert value x (0..63) to corresponding Base64 character.
+ */
+static int b64_byte_to_char(unsigned x) {
+    return (LT(x, 26) & (x + 'A')) |
+           (GE(x, 26) & LT(x, 52) & (x + ('a' - 26))) |
+           (GE(x, 52) & LT(x, 62) & (x + ('0' - 52))) | (EQ(x, 62) & '+') |
+           (EQ(x, 63) & '/');
+}
+
+/*
+ * Convert character c to the corresponding 6-bit value. If character c
+ * is not a Base64 character, then 0xFF (255) is returned.
+ */
+static unsigned b64_char_to_byte(int c) {
+    unsigned x;
+
+    x = (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) |
+        (GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) |
+        (GE(c, '0') & LE(c, '9') & (c - ('0' - 52))) | (EQ(c, '+') & 62) |
+        (EQ(c, '/') & 63);
+    return x | (EQ(x, 0) & (EQ(c, 'A') ^ 0xFF));
+}
+
+/*
+ * Convert some bytes to Base64. 'dst_len' is the length (in characters)
+ * of the output buffer 'dst'; if that buffer is not large enough to
+ * receive the result (including the terminating 0), then (size_t)-1
+ * is returned. Otherwise, the zero-terminated Base64 string is written
+ * in the buffer, and the output length (counted WITHOUT the terminating
+ * zero) is returned.
+ */
+static size_t to_base64(char *dst, size_t dst_len, const void *src,
+                        size_t src_len) {
+    size_t olen;
+    const unsigned char *buf;
+    unsigned acc, acc_len;
+
+    olen = (src_len / 3) << 2;
+    switch (src_len % 3) {
+    case 2:
+        olen++;
+    /* fall through */
+    case 1:
+        olen += 2;
+        break;
+    }
+    if (dst_len <= olen) {
+        return (size_t)-1;
+    }
+    acc = 0;
+    acc_len = 0;
+    buf = (const unsigned char *)src;
+    while (src_len-- > 0) {
+        acc = (acc << 8) + (*buf++);
+        acc_len += 8;
+        while (acc_len >= 6) {
+            acc_len -= 6;
+            *dst++ = (char)b64_byte_to_char((acc >> acc_len) & 0x3F);
+        }
+    }
+    if (acc_len > 0) {
+        *dst++ = (char)b64_byte_to_char((acc << (6 - acc_len)) & 0x3F);
+    }
+    *dst++ = 0;
+    return olen;
+}
+
+/*
+ * Decode Base64 chars into bytes. The '*dst_len' value must initially
+ * contain the length of the output buffer '*dst'; when the decoding
+ * ends, the actual number of decoded bytes is written back in
+ * '*dst_len'.
+ *
+ * Decoding stops when a non-Base64 character is encountered, or when
+ * the output buffer capacity is exceeded. If an error occurred (output
+ * buffer is too small, invalid last characters leading to unprocessed
+ * buffered bits), then NULL is returned; otherwise, the returned value
+ * points to the first non-Base64 character in the source stream, which
+ * may be the terminating zero.
+ */
+static const char *from_base64(void *dst, size_t *dst_len, const char *src) {
+    size_t len;
+    unsigned char *buf;
+    unsigned acc, acc_len;
+
+    buf = (unsigned char *)dst;
+    len = 0;
+    acc = 0;
+    acc_len = 0;
+    for (;;) {
+        unsigned d;
+
+        d = b64_char_to_byte(*src);
+        if (d == 0xFF) {
+            break;
+        }
+        src++;
+        acc = (acc << 6) + d;
+        acc_len += 6;
+        if (acc_len >= 8) {
+            acc_len -= 8;
+            if ((len++) >= *dst_len) {
+                return NULL;
+            }
+            *buf++ = (acc >> acc_len) & 0xFF;
+        }
+    }
+
+    /*
+     * If the input length is equal to 1 modulo 4 (which is
+     * invalid), then there will remain 6 unprocessed bits;
+     * otherwise, only 0, 2 or 4 bits are buffered. The buffered
+     * bits must also all be zero.
+     */
+    if (acc_len > 4 || (acc & (((unsigned)1 << acc_len) - 1)) != 0) {
+        return NULL;
+    }
+    *dst_len = len;
+    return src;
+}
+
+/*
+ * Decode decimal integer from 'str'; the value is written in '*v'.
+ * Returned value is a pointer to the next non-decimal character in the
+ * string. If there is no digit at all, or the value encoding is not
+ * minimal (extra leading zeros), or the value does not fit in an
+ * 'unsigned long', then NULL is returned.
+ */
+static const char *decode_decimal(const char *str, unsigned long *v) {
+    const char *orig;
+    unsigned long acc;
+
+    acc = 0;
+    for (orig = str;; str++) {
+        int c;
+
+        c = *str;
+        if (c < '0' || c > '9') {
+            break;
+        }
+        c -= '0';
+        if (acc > (ULONG_MAX / 10)) {
+            return NULL;
+        }
+        acc *= 10;
+        if ((unsigned long)c > (ULONG_MAX - acc)) {
+            return NULL;
+        }
+        acc += (unsigned long)c;
+    }
+    if (str == orig || (*orig == '0' && str != (orig + 1))) {
+        return NULL;
+    }
+    *v = acc;
+    return str;
+}
+
+/* ==================================================================== */
+/*
+ * Code specific to Argon2.
+ *
+ * The code below applies the following format:
+ *
+ *  $argon2<T>[$v=<num>]$m=<num>,t=<num>,p=<num>$<bin>$<bin>
+ *
+ * where <T> is either 'd', 'id', or 'i', <num> is a decimal integer (positive,
+ * fits in an 'unsigned long'), and <bin> is Base64-encoded data (no '=' padding
+ * characters, no newline or whitespace).
+ *
+ * The last two binary chunks (encoded in Base64) are, in that order,
+ * the salt and the output. Both are required. The binary salt length and the
+ * output length must be in the allowed ranges defined in argon2.h.
+ *
+ * The ctx struct must contain buffers large enough to hold the salt and pwd
+ * when it is fed into decode_string.
+ */
+
+int decode_string(argon2_context *ctx, const char *str, argon2_type type) {
+
+/* check for prefix */
+#define CC(prefix)                                                             \
+    do {                                                                       \
+        size_t cc_len = strlen(prefix);                                        \
+        if (strncmp(str, prefix, cc_len) != 0) {                               \
+            return ARGON2_DECODING_FAIL;                                       \
+        }                                                                      \
+        str += cc_len;                                                         \
+    } while ((void)0, 0)
+
+/* optional prefix checking with supplied code */
+#define CC_opt(prefix, code)                                                   \
+    do {                                                                       \
+        size_t cc_len = strlen(prefix);                                        \
+        if (strncmp(str, prefix, cc_len) == 0) {                               \
+            str += cc_len;                                                     \
+            { code; }                                                          \
+        }                                                                      \
+    } while ((void)0, 0)
+
+/* Decoding prefix into decimal */
+#define DECIMAL(x)                                                             \
+    do {                                                                       \
+        unsigned long dec_x;                                                   \
+        str = decode_decimal(str, &dec_x);                                     \
+        if (str == NULL) {                                                     \
+            return ARGON2_DECODING_FAIL;                                       \
+        }                                                                      \
+        (x) = dec_x;                                                           \
+    } while ((void)0, 0)
+
+
+/* Decoding prefix into uint32_t decimal */
+#define DECIMAL_U32(x)                                                         \
+    do {                                                                       \
+        unsigned long dec_x;                                                   \
+        str = decode_decimal(str, &dec_x);                                     \
+        if (str == NULL || dec_x > UINT32_MAX) {                               \
+            return ARGON2_DECODING_FAIL;                                       \
+        }                                                                      \
+        (x) = (uint32_t)dec_x;                                                 \
+    } while ((void)0, 0)
+
+
+/* Decoding base64 into a binary buffer */
+#define BIN(buf, max_len, len)                                                 \
+    do {                                                                       \
+        size_t bin_len = (max_len);                                            \
+        str = from_base64(buf, &bin_len, str);                                 \
+        if (str == NULL || bin_len > UINT32_MAX) {                             \
+            return ARGON2_DECODING_FAIL;                                       \
+        }                                                                      \
+        (len) = (uint32_t)bin_len;                                             \
+    } while ((void)0, 0)
+
+    size_t maxsaltlen = ctx->saltlen;
+    size_t maxoutlen = ctx->outlen;
+    int validation_result;
+    const char* type_string;
+
+    /* We should start with the argon2_type we are using */
+    type_string = argon2_type2string(type, 0);
+    if (!type_string) {
+        return ARGON2_INCORRECT_TYPE;
+    }
+
+    CC("$");
+    CC(type_string);
+
+    /* Reading the version number if the default is suppressed */
+    ctx->version = ARGON2_VERSION_10;
+    CC_opt("$v=", DECIMAL_U32(ctx->version));
+
+    CC("$m=");
+    DECIMAL_U32(ctx->m_cost);
+    CC(",t=");
+    DECIMAL_U32(ctx->t_cost);
+    CC(",p=");
+    DECIMAL_U32(ctx->lanes);
+    ctx->threads = ctx->lanes;
+
+    CC("$");
+    BIN(ctx->salt, maxsaltlen, ctx->saltlen);
+    CC("$");
+    BIN(ctx->out, maxoutlen, ctx->outlen);
+
+    /* The rest of the fields get the default values */
+    ctx->secret = NULL;
+    ctx->secretlen = 0;
+    ctx->ad = NULL;
+    ctx->adlen = 0;
+    ctx->allocate_cbk = NULL;
+    ctx->free_cbk = NULL;
+    ctx->flags = ARGON2_DEFAULT_FLAGS;
+
+    /* On return, must have valid context */
+    validation_result = validate_inputs(ctx);
+    if (validation_result != ARGON2_OK) {
+        return validation_result;
+    }
+
+    /* Can't have any additional characters */
+    if (*str == 0) {
+        return ARGON2_OK;
+    } else {
+        return ARGON2_DECODING_FAIL;
+    }
+#undef CC
+#undef CC_opt
+#undef DECIMAL
+#undef BIN
+}
+
+int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
+                  argon2_type type) {
+#define SS(str)                                                                \
+    do {                                                                       \
+        size_t pp_len = strlen(str);                                           \
+        if (pp_len >= dst_len) {                                               \
+            return ARGON2_ENCODING_FAIL;                                       \
+        }                                                                      \
+        memcpy(dst, str, pp_len + 1);                                          \
+        dst += pp_len;                                                         \
+        dst_len -= pp_len;                                                     \
+    } while ((void)0, 0)
+
+#define SX(x)                                                                  \
+    do {                                                                       \
+        char tmp[30];                                                          \
+        sprintf(tmp, "%lu", (unsigned long)(x));                               \
+        SS(tmp);                                                               \
+    } while ((void)0, 0)
+
+#define SB(buf, len)                                                           \
+    do {                                                                       \
+        size_t sb_len = to_base64(dst, dst_len, buf, len);                     \
+        if (sb_len == (size_t)-1) {                                            \
+            return ARGON2_ENCODING_FAIL;                                       \
+        }                                                                      \
+        dst += sb_len;                                                         \
+        dst_len -= sb_len;                                                     \
+    } while ((void)0, 0)
+
+    const char* type_string = argon2_type2string(type, 0);
+    int validation_result = validate_inputs(ctx);
+
+    if (!type_string) {
+      return ARGON2_ENCODING_FAIL;
+    }
+
+    if (validation_result != ARGON2_OK) {
+      return validation_result;
+    }
+
+
+    SS("$");
+    SS(type_string);
+
+    SS("$v=");
+    SX(ctx->version);
+
+    SS("$m=");
+    SX(ctx->m_cost);
+    SS(",t=");
+    SX(ctx->t_cost);
+    SS(",p=");
+    SX(ctx->lanes);
+
+    SS("$");
+    SB(ctx->salt, ctx->saltlen);
+
+    SS("$");
+    SB(ctx->out, ctx->outlen);
+    return ARGON2_OK;
+
+#undef SS
+#undef SX
+#undef SB
+}
+
+size_t b64len(uint32_t len) {
+    size_t olen = ((size_t)len / 3) << 2;
+
+    switch (len % 3) {
+    case 2:
+        olen++;
+    /* fall through */
+    case 1:
+        olen += 2;
+        break;
+    }
+
+    return olen;
+}
+
+size_t numlen(uint32_t num) {
+    size_t len = 1;
+    while (num >= 10) {
+        ++len;
+        num = num / 10;
+    }
+    return len;
+}
diff --git a/lib/crypto_backend/argon2/encoding.h b/lib/crypto_backend/argon2/encoding.h
new file mode 100644 (file)
index 0000000..7e83ec9
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef ENCODING_H
+#define ENCODING_H
+#include "argon2.h"
+
+#define ARGON2_MAX_DECODED_LANES UINT32_C(255)
+#define ARGON2_MIN_DECODED_SALT_LEN UINT32_C(8)
+#define ARGON2_MIN_DECODED_OUT_LEN UINT32_C(12)
+
+/*
+* encode an Argon2 hash string into the provided buffer. 'dst_len'
+* contains the size, in characters, of the 'dst' buffer; if 'dst_len'
+* is less than the number of required characters (including the
+* terminating 0), then this function returns ARGON2_ENCODING_ERROR.
+*
+* on success, ARGON2_OK is returned.
+*/
+int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
+                  argon2_type type);
+
+/*
+* Decodes an Argon2 hash string into the provided structure 'ctx'.
+* The only fields that must be set prior to this call are ctx.saltlen and
+* ctx.outlen (which must be the maximal salt and out length values that are
+* allowed), ctx.salt and ctx.out (which must be buffers of the specified
+* length), and ctx.pwd and ctx.pwdlen which must hold a valid password.
+*
+* Invalid input string causes an error. On success, the ctx is valid and all
+* fields have been initialized.
+*
+* Returned value is ARGON2_OK on success, other ARGON2_ codes on error.
+*/
+int decode_string(argon2_context *ctx, const char *str, argon2_type type);
+
+/* Returns the length of the encoded byte stream with length len */
+size_t b64len(uint32_t len);
+
+/* Returns the length of the encoded number num */
+size_t numlen(uint32_t num);
+
+#endif
diff --git a/lib/crypto_backend/argon2/opt.c b/lib/crypto_backend/argon2/opt.c
new file mode 100644 (file)
index 0000000..f6c2052
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "argon2.h"
+#include "core.h"
+
+#include "blake2/blake2.h"
+#include "blake2/blamka-round-opt.h"
+
+/*
+ * Function fills a new memory block and optionally XORs the old block over the new one.
+ * Memory must be initialized.
+ * @param state Pointer to the just produced block. Content will be updated(!)
+ * @param ref_block Pointer to the reference block
+ * @param next_block Pointer to the block to be XORed over. May coincide with @ref_block
+ * @param with_xor Whether to XOR into the new block (1) or just overwrite (0)
+ * @pre all block pointers must be valid
+ */
+#if defined(__AVX512F__)
+static void fill_block(__m512i *state, const block *ref_block,
+                       block *next_block, int with_xor) {
+    __m512i block_XY[ARGON2_512BIT_WORDS_IN_BLOCK];
+    unsigned int i;
+
+    if (with_xor) {
+        for (i = 0; i < ARGON2_512BIT_WORDS_IN_BLOCK; i++) {
+            state[i] = _mm512_xor_si512(
+                state[i], _mm512_loadu_si512((const __m512i *)ref_block->v + i));
+            block_XY[i] = _mm512_xor_si512(
+                state[i], _mm512_loadu_si512((const __m512i *)next_block->v + i));
+        }
+    } else {
+        for (i = 0; i < ARGON2_512BIT_WORDS_IN_BLOCK; i++) {
+            block_XY[i] = state[i] = _mm512_xor_si512(
+                state[i], _mm512_loadu_si512((const __m512i *)ref_block->v + i));
+        }
+    }
+
+    for (i = 0; i < 2; ++i) {
+        BLAKE2_ROUND_1(
+            state[8 * i + 0], state[8 * i + 1], state[8 * i + 2], state[8 * i + 3],
+            state[8 * i + 4], state[8 * i + 5], state[8 * i + 6], state[8 * i + 7]);
+    }
+
+    for (i = 0; i < 2; ++i) {
+        BLAKE2_ROUND_2(
+            state[2 * 0 + i], state[2 * 1 + i], state[2 * 2 + i], state[2 * 3 + i],
+            state[2 * 4 + i], state[2 * 5 + i], state[2 * 6 + i], state[2 * 7 + i]);
+    }
+
+    for (i = 0; i < ARGON2_512BIT_WORDS_IN_BLOCK; i++) {
+        state[i] = _mm512_xor_si512(state[i], block_XY[i]);
+        _mm512_storeu_si512((__m512i *)next_block->v + i, state[i]);
+    }
+}
+#elif defined(__AVX2__)
+static void fill_block(__m256i *state, const block *ref_block,
+                       block *next_block, int with_xor) {
+    __m256i block_XY[ARGON2_HWORDS_IN_BLOCK];
+    unsigned int i;
+
+    if (with_xor) {
+        for (i = 0; i < ARGON2_HWORDS_IN_BLOCK; i++) {
+            state[i] = _mm256_xor_si256(
+                state[i], _mm256_loadu_si256((const __m256i *)ref_block->v + i));
+            block_XY[i] = _mm256_xor_si256(
+                state[i], _mm256_loadu_si256((const __m256i *)next_block->v + i));
+        }
+    } else {
+        for (i = 0; i < ARGON2_HWORDS_IN_BLOCK; i++) {
+            block_XY[i] = state[i] = _mm256_xor_si256(
+                state[i], _mm256_loadu_si256((const __m256i *)ref_block->v + i));
+        }
+    }
+
+    for (i = 0; i < 4; ++i) {
+        BLAKE2_ROUND_1(state[8 * i + 0], state[8 * i + 4], state[8 * i + 1], state[8 * i + 5],
+                       state[8 * i + 2], state[8 * i + 6], state[8 * i + 3], state[8 * i + 7]);
+    }
+
+    for (i = 0; i < 4; ++i) {
+        BLAKE2_ROUND_2(state[ 0 + i], state[ 4 + i], state[ 8 + i], state[12 + i],
+                       state[16 + i], state[20 + i], state[24 + i], state[28 + i]);
+    }
+
+    for (i = 0; i < ARGON2_HWORDS_IN_BLOCK; i++) {
+        state[i] = _mm256_xor_si256(state[i], block_XY[i]);
+        _mm256_storeu_si256((__m256i *)next_block->v + i, state[i]);
+    }
+}
+#else
+static void fill_block(__m128i *state, const block *ref_block,
+                       block *next_block, int with_xor) {
+    __m128i block_XY[ARGON2_OWORDS_IN_BLOCK];
+    unsigned int i;
+
+    if (with_xor) {
+        for (i = 0; i < ARGON2_OWORDS_IN_BLOCK; i++) {
+            state[i] = _mm_xor_si128(
+                state[i], _mm_loadu_si128((const __m128i *)ref_block->v + i));
+            block_XY[i] = _mm_xor_si128(
+                state[i], _mm_loadu_si128((const __m128i *)next_block->v + i));
+        }
+    } else {
+        for (i = 0; i < ARGON2_OWORDS_IN_BLOCK; i++) {
+            block_XY[i] = state[i] = _mm_xor_si128(
+                state[i], _mm_loadu_si128((const __m128i *)ref_block->v + i));
+        }
+    }
+
+    for (i = 0; i < 8; ++i) {
+        BLAKE2_ROUND(state[8 * i + 0], state[8 * i + 1], state[8 * i + 2],
+            state[8 * i + 3], state[8 * i + 4], state[8 * i + 5],
+            state[8 * i + 6], state[8 * i + 7]);
+    }
+
+    for (i = 0; i < 8; ++i) {
+        BLAKE2_ROUND(state[8 * 0 + i], state[8 * 1 + i], state[8 * 2 + i],
+            state[8 * 3 + i], state[8 * 4 + i], state[8 * 5 + i],
+            state[8 * 6 + i], state[8 * 7 + i]);
+    }
+
+    for (i = 0; i < ARGON2_OWORDS_IN_BLOCK; i++) {
+        state[i] = _mm_xor_si128(state[i], block_XY[i]);
+        _mm_storeu_si128((__m128i *)next_block->v + i, state[i]);
+    }
+}
+#endif
+
+static void next_addresses(block *address_block, block *input_block) {
+    /*Temporary zero-initialized blocks*/
+#if defined(__AVX512F__)
+    __m512i zero_block[ARGON2_512BIT_WORDS_IN_BLOCK];
+    __m512i zero2_block[ARGON2_512BIT_WORDS_IN_BLOCK];
+#elif defined(__AVX2__)
+    __m256i zero_block[ARGON2_HWORDS_IN_BLOCK];
+    __m256i zero2_block[ARGON2_HWORDS_IN_BLOCK];
+#else
+    __m128i zero_block[ARGON2_OWORDS_IN_BLOCK];
+    __m128i zero2_block[ARGON2_OWORDS_IN_BLOCK];
+#endif
+
+    memset(zero_block, 0, sizeof(zero_block));
+    memset(zero2_block, 0, sizeof(zero2_block));
+
+    /*Increasing index counter*/
+    input_block->v[6]++;
+
+    /*First iteration of G*/
+    fill_block(zero_block, input_block, address_block, 0);
+
+    /*Second iteration of G*/
+    fill_block(zero2_block, address_block, address_block, 0);
+}
+
+void fill_segment(const argon2_instance_t *instance,
+                  argon2_position_t position) {
+    block *ref_block = NULL, *curr_block = NULL;
+    block address_block, input_block;
+    uint64_t pseudo_rand, ref_index, ref_lane;
+    uint32_t prev_offset, curr_offset;
+    uint32_t starting_index, i;
+#if defined(__AVX512F__)
+    __m512i state[ARGON2_512BIT_WORDS_IN_BLOCK];
+#elif defined(__AVX2__)
+    __m256i state[ARGON2_HWORDS_IN_BLOCK];
+#else
+    __m128i state[ARGON2_OWORDS_IN_BLOCK];
+#endif
+    int data_independent_addressing;
+
+    if (instance == NULL) {
+        return;
+    }
+
+    data_independent_addressing =
+        (instance->type == Argon2_i) ||
+        (instance->type == Argon2_id && (position.pass == 0) &&
+         (position.slice < ARGON2_SYNC_POINTS / 2));
+
+    if (data_independent_addressing) {
+        init_block_value(&input_block, 0);
+
+        input_block.v[0] = position.pass;
+        input_block.v[1] = position.lane;
+        input_block.v[2] = position.slice;
+        input_block.v[3] = instance->memory_blocks;
+        input_block.v[4] = instance->passes;
+        input_block.v[5] = instance->type;
+    }
+
+    starting_index = 0;
+
+    if ((0 == position.pass) && (0 == position.slice)) {
+        starting_index = 2; /* we have already generated the first two blocks */
+
+        /* Don't forget to generate the first block of addresses: */
+        if (data_independent_addressing) {
+            next_addresses(&address_block, &input_block);
+        }
+    }
+
+    /* Offset of the current block */
+    curr_offset = position.lane * instance->lane_length +
+                  position.slice * instance->segment_length + starting_index;
+
+    if (0 == curr_offset % instance->lane_length) {
+        /* Last block in this lane */
+        prev_offset = curr_offset + instance->lane_length - 1;
+    } else {
+        /* Previous block */
+        prev_offset = curr_offset - 1;
+    }
+
+    memcpy(state, ((instance->memory + prev_offset)->v), ARGON2_BLOCK_SIZE);
+
+    for (i = starting_index; i < instance->segment_length;
+         ++i, ++curr_offset, ++prev_offset) {
+        /*1.1 Rotating prev_offset if needed */
+        if (curr_offset % instance->lane_length == 1) {
+            prev_offset = curr_offset - 1;
+        }
+
+        /* 1.2 Computing the index of the reference block */
+        /* 1.2.1 Taking pseudo-random value from the previous block */
+        if (data_independent_addressing) {
+            if (i % ARGON2_ADDRESSES_IN_BLOCK == 0) {
+                next_addresses(&address_block, &input_block);
+            }
+            pseudo_rand = address_block.v[i % ARGON2_ADDRESSES_IN_BLOCK];
+        } else {
+            pseudo_rand = instance->memory[prev_offset].v[0];
+        }
+
+        /* 1.2.2 Computing the lane of the reference block */
+        ref_lane = ((pseudo_rand >> 32)) % instance->lanes;
+
+        if ((position.pass == 0) && (position.slice == 0)) {
+            /* Can not reference other lanes yet */
+            ref_lane = position.lane;
+        }
+
+        /* 1.2.3 Computing the number of possible reference block within the
+         * lane.
+         */
+        position.index = i;
+        ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
+                                ref_lane == position.lane);
+
+        /* 2 Creating a new block */
+        ref_block =
+            instance->memory + instance->lane_length * ref_lane + ref_index;
+        curr_block = instance->memory + curr_offset;
+        if (ARGON2_VERSION_10 == instance->version) {
+            /* version 1.2.1 and earlier: overwrite, not XOR */
+            fill_block(state, ref_block, curr_block, 0);
+        } else {
+            if(0 == position.pass) {
+                fill_block(state, ref_block, curr_block, 0);
+            } else {
+                fill_block(state, ref_block, curr_block, 1);
+            }
+        }
+    }
+}
diff --git a/lib/crypto_backend/argon2/ref.c b/lib/crypto_backend/argon2/ref.c
new file mode 100644 (file)
index 0000000..ad1cf46
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "argon2.h"
+#include "core.h"
+
+#include "blake2/blamka-round-ref.h"
+#include "blake2/blake2-impl.h"
+#include "blake2/blake2.h"
+
+
+/*
+ * Function fills a new memory block and optionally XORs the old block over the new one.
+ * @next_block must be initialized.
+ * @param prev_block Pointer to the previous block
+ * @param ref_block Pointer to the reference block
+ * @param next_block Pointer to the block to be constructed
+ * @param with_xor Whether to XOR into the new block (1) or just overwrite (0)
+ * @pre all block pointers must be valid
+ */
+static void fill_block(const block *prev_block, const block *ref_block,
+                       block *next_block, int with_xor) {
+    block blockR, block_tmp;
+    unsigned i;
+
+    copy_block(&blockR, ref_block);
+    xor_block(&blockR, prev_block);
+    copy_block(&block_tmp, &blockR);
+    /* Now blockR = ref_block + prev_block and block_tmp = ref_block + prev_block */
+    if (with_xor) {
+        /* Saving the next block contents for XOR over: */
+        xor_block(&block_tmp, next_block);
+        /* Now blockR = ref_block + prev_block and
+           block_tmp = ref_block + prev_block + next_block */
+    }
+
+    /* Apply Blake2 on columns of 64-bit words: (0,1,...,15) , then
+       (16,17,..31)... finally (112,113,...127) */
+    for (i = 0; i < 8; ++i) {
+        BLAKE2_ROUND_NOMSG(
+            blockR.v[16 * i], blockR.v[16 * i + 1], blockR.v[16 * i + 2],
+            blockR.v[16 * i + 3], blockR.v[16 * i + 4], blockR.v[16 * i + 5],
+            blockR.v[16 * i + 6], blockR.v[16 * i + 7], blockR.v[16 * i + 8],
+            blockR.v[16 * i + 9], blockR.v[16 * i + 10], blockR.v[16 * i + 11],
+            blockR.v[16 * i + 12], blockR.v[16 * i + 13], blockR.v[16 * i + 14],
+            blockR.v[16 * i + 15]);
+    }
+
+    /* Apply Blake2 on rows of 64-bit words: (0,1,16,17,...112,113), then
+       (2,3,18,19,...,114,115).. finally (14,15,30,31,...,126,127) */
+    for (i = 0; i < 8; i++) {
+        BLAKE2_ROUND_NOMSG(
+            blockR.v[2 * i], blockR.v[2 * i + 1], blockR.v[2 * i + 16],
+            blockR.v[2 * i + 17], blockR.v[2 * i + 32], blockR.v[2 * i + 33],
+            blockR.v[2 * i + 48], blockR.v[2 * i + 49], blockR.v[2 * i + 64],
+            blockR.v[2 * i + 65], blockR.v[2 * i + 80], blockR.v[2 * i + 81],
+            blockR.v[2 * i + 96], blockR.v[2 * i + 97], blockR.v[2 * i + 112],
+            blockR.v[2 * i + 113]);
+    }
+
+    copy_block(next_block, &block_tmp);
+    xor_block(next_block, &blockR);
+}
+
+static void next_addresses(block *address_block, block *input_block,
+                           const block *zero_block) {
+    input_block->v[6]++;
+    fill_block(zero_block, input_block, address_block, 0);
+    fill_block(zero_block, address_block, address_block, 0);
+}
+
+void fill_segment(const argon2_instance_t *instance,
+                  argon2_position_t position) {
+    block *ref_block = NULL, *curr_block = NULL;
+    block address_block, input_block, zero_block;
+    uint64_t pseudo_rand, ref_index, ref_lane;
+    uint32_t prev_offset, curr_offset;
+    uint32_t starting_index;
+    uint32_t i;
+    int data_independent_addressing;
+
+    if (instance == NULL) {
+        return;
+    }
+
+    data_independent_addressing =
+        (instance->type == Argon2_i) ||
+        (instance->type == Argon2_id && (position.pass == 0) &&
+         (position.slice < ARGON2_SYNC_POINTS / 2));
+
+    if (data_independent_addressing) {
+        init_block_value(&zero_block, 0);
+        init_block_value(&input_block, 0);
+
+        input_block.v[0] = position.pass;
+        input_block.v[1] = position.lane;
+        input_block.v[2] = position.slice;
+        input_block.v[3] = instance->memory_blocks;
+        input_block.v[4] = instance->passes;
+        input_block.v[5] = instance->type;
+    }
+
+    starting_index = 0;
+
+    if ((0 == position.pass) && (0 == position.slice)) {
+        starting_index = 2; /* we have already generated the first two blocks */
+
+        /* Don't forget to generate the first block of addresses: */
+        if (data_independent_addressing) {
+            next_addresses(&address_block, &input_block, &zero_block);
+        }
+    }
+
+    /* Offset of the current block */
+    curr_offset = position.lane * instance->lane_length +
+                  position.slice * instance->segment_length + starting_index;
+
+    if (0 == curr_offset % instance->lane_length) {
+        /* Last block in this lane */
+        prev_offset = curr_offset + instance->lane_length - 1;
+    } else {
+        /* Previous block */
+        prev_offset = curr_offset - 1;
+    }
+
+    for (i = starting_index; i < instance->segment_length;
+         ++i, ++curr_offset, ++prev_offset) {
+        /*1.1 Rotating prev_offset if needed */
+        if (curr_offset % instance->lane_length == 1) {
+            prev_offset = curr_offset - 1;
+        }
+
+        /* 1.2 Computing the index of the reference block */
+        /* 1.2.1 Taking pseudo-random value from the previous block */
+        if (data_independent_addressing) {
+            if (i % ARGON2_ADDRESSES_IN_BLOCK == 0) {
+                next_addresses(&address_block, &input_block, &zero_block);
+            }
+            pseudo_rand = address_block.v[i % ARGON2_ADDRESSES_IN_BLOCK];
+        } else {
+            pseudo_rand = instance->memory[prev_offset].v[0];
+        }
+
+        /* 1.2.2 Computing the lane of the reference block */
+        ref_lane = ((pseudo_rand >> 32)) % instance->lanes;
+
+        if ((position.pass == 0) && (position.slice == 0)) {
+            /* Can not reference other lanes yet */
+            ref_lane = position.lane;
+        }
+
+        /* 1.2.3 Computing the number of possible reference block within the
+         * lane.
+         */
+        position.index = i;
+        ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
+                                ref_lane == position.lane);
+
+        /* 2 Creating a new block */
+        ref_block =
+            instance->memory + instance->lane_length * ref_lane + ref_index;
+        curr_block = instance->memory + curr_offset;
+        if (ARGON2_VERSION_10 == instance->version) {
+            /* version 1.2.1 and earlier: overwrite, not XOR */
+            fill_block(instance->memory + prev_offset, ref_block, curr_block, 0);
+        } else {
+            if(0 == position.pass) {
+                fill_block(instance->memory + prev_offset, ref_block,
+                           curr_block, 0);
+            } else {
+                fill_block(instance->memory + prev_offset, ref_block,
+                           curr_block, 1);
+            }
+        }
+    }
+}
diff --git a/lib/crypto_backend/argon2/thread.c b/lib/crypto_backend/argon2/thread.c
new file mode 100644 (file)
index 0000000..e099a00
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#if !defined(ARGON2_NO_THREADS)
+
+#include "thread.h"
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
+int argon2_thread_create(argon2_thread_handle_t *handle,
+                         argon2_thread_func_t func, void *args) {
+    if (NULL == handle || func == NULL) {
+        return -1;
+    }
+#if defined(_WIN32)
+    *handle = _beginthreadex(NULL, 0, func, args, 0, NULL);
+    return *handle != 0 ? 0 : -1;
+#else
+    return pthread_create(handle, NULL, func, args);
+#endif
+}
+
+int argon2_thread_join(argon2_thread_handle_t handle) {
+#if defined(_WIN32)
+    if (WaitForSingleObject((HANDLE)handle, INFINITE) == WAIT_OBJECT_0) {
+        return CloseHandle((HANDLE)handle) != 0 ? 0 : -1;
+    }
+    return -1;
+#else
+    return pthread_join(handle, NULL);
+#endif
+}
+
+void argon2_thread_exit(void) {
+#if defined(_WIN32)
+    _endthreadex(0);
+#else
+    pthread_exit(NULL);
+#endif
+}
+
+#endif /* ARGON2_NO_THREADS */
diff --git a/lib/crypto_backend/argon2/thread.h b/lib/crypto_backend/argon2/thread.h
new file mode 100644 (file)
index 0000000..49d8836
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Argon2 reference source code package - reference C implementations
+ *
+ * Copyright 2015
+ * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
+ *
+ * You may use this work under the terms of a Creative Commons CC0 1.0
+ * License/Waiver or the Apache Public License 2.0, at your option. The terms of
+ * these licenses can be found at:
+ *
+ * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ * - Apache 2.0        : http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * You should have received a copy of both of these licenses along with this
+ * software. If not, they may be obtained at the above URLs.
+ */
+
+#ifndef ARGON2_THREAD_H
+#define ARGON2_THREAD_H
+
+#if !defined(ARGON2_NO_THREADS)
+
+/*
+        Here we implement an abstraction layer for the simpĺe requirements
+        of the Argon2 code. We only require 3 primitives---thread creation,
+        joining, and termination---so full emulation of the pthreads API
+        is unwarranted. Currently we wrap pthreads and Win32 threads.
+
+        The API defines 2 types: the function pointer type,
+   argon2_thread_func_t,
+        and the type of the thread handle---argon2_thread_handle_t.
+*/
+#if defined(_WIN32)
+#include <process.h>
+typedef unsigned(__stdcall *argon2_thread_func_t)(void *);
+typedef uintptr_t argon2_thread_handle_t;
+#else
+#include <pthread.h>
+typedef void *(*argon2_thread_func_t)(void *);
+typedef pthread_t argon2_thread_handle_t;
+#endif
+
+/* Creates a thread
+ * @param handle pointer to a thread handle, which is the output of this
+ * function. Must not be NULL.
+ * @param func A function pointer for the thread's entry point. Must not be
+ * NULL.
+ * @param args Pointer that is passed as an argument to @func. May be NULL.
+ * @return 0 if @handle and @func are valid pointers and a thread is successfully
+ * created.
+ */
+int argon2_thread_create(argon2_thread_handle_t *handle,
+                         argon2_thread_func_t func, void *args);
+
+/* Waits for a thread to terminate
+ * @param handle Handle to a thread created with argon2_thread_create.
+ * @return 0 if @handle is a valid handle, and joining completed successfully.
+*/
+int argon2_thread_join(argon2_thread_handle_t handle);
+
+/* Terminate the current thread. Must be run inside a thread created by
+ * argon2_thread_create.
+*/
+void argon2_thread_exit(void);
+
+#endif /* ARGON2_NO_THREADS */
+#endif
diff --git a/lib/crypto_backend/argon2_generic.c b/lib/crypto_backend/argon2_generic.c
new file mode 100644 (file)
index 0000000..64cf10b
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Argon2 PBKDF2 library wrapper
+ *
+ * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Milan Broz
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include "crypto_backend_internal.h"
+#if HAVE_ARGON2_H
+#include <argon2.h>
+#else
+#include "argon2/argon2.h"
+#endif
+
+#define CONST_CAST(x) (x)(uintptr_t)
+
+int argon2(const char *type, const char *password, size_t password_length,
+          const char *salt, size_t salt_length,
+          char *key, size_t key_length,
+          uint32_t iterations, uint32_t memory, uint32_t parallel)
+{
+#if !USE_INTERNAL_ARGON2 && !HAVE_ARGON2_H
+       return -EINVAL;
+#else
+       argon2_type atype;
+       argon2_context context = {
+               .flags = ARGON2_DEFAULT_FLAGS,
+               .version = ARGON2_VERSION_NUMBER,
+               .t_cost = (uint32_t)iterations,
+               .m_cost = (uint32_t)memory,
+               .lanes = (uint32_t)parallel,
+               .threads = (uint32_t)parallel,
+               .out = (uint8_t *)key,
+               .outlen = (uint32_t)key_length,
+               .pwd = CONST_CAST(uint8_t *)password,
+               .pwdlen = (uint32_t)password_length,
+               .salt = CONST_CAST(uint8_t *)salt,
+               .saltlen = (uint32_t)salt_length,
+       };
+       int r;
+
+       if (!strcmp(type, "argon2i"))
+               atype = Argon2_i;
+       else if(!strcmp(type, "argon2id"))
+               atype = Argon2_id;
+       else
+               return -EINVAL;
+
+       switch (argon2_ctx(&context, atype)) {
+       case ARGON2_OK:
+               r = 0;
+               break;
+       case ARGON2_MEMORY_ALLOCATION_ERROR:
+       case ARGON2_FREE_MEMORY_CBK_NULL:
+       case ARGON2_ALLOCATE_MEMORY_CBK_NULL:
+               r = -ENOMEM;
+               break;
+       default:
+               r = -EINVAL;
+       }
+
+       return r;
+#endif
+}
diff --git a/lib/crypto_backend/cipher_check.c b/lib/crypto_backend/cipher_check.c
new file mode 100644 (file)
index 0000000..2119d97
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Cipher performance check
+ *
+ * Copyright (C) 2018-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2018-2020 Milan Broz
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <time.h>
+#include "crypto_backend_internal.h"
+
+#ifndef CLOCK_MONOTONIC_RAW
+#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
+#endif
+
+/*
+ * This is not simulating storage, so using disk block causes extreme overhead.
+ * Let's use some fixed block size where results are more reliable...
+ */
+#define CIPHER_BLOCK_BYTES 65536
+
+/*
+ * If the measured value is lower, encrypted buffer is probably too small
+ * and calculated values are not reliable.
+ */
+#define CIPHER_TIME_MIN_MS 0.001
+
+/*
+ * The whole test depends on Linux kernel usermode crypto API for now.
+ * (The same implementations are used in dm-crypt though.)
+ */
+
+static int time_ms(struct timespec *start, struct timespec *end, double *ms)
+{
+       double start_ms, end_ms;
+
+       start_ms = start->tv_sec * 1000.0 + start->tv_nsec / (1000.0 * 1000);
+       end_ms   = end->tv_sec * 1000.0 + end->tv_nsec / (1000.0 * 1000);
+
+       *ms = end_ms - start_ms;
+       return 0;
+}
+
+static int cipher_perf_one(const char *name, const char *mode, char *buffer, size_t buffer_size,
+                         const char *key, size_t key_size, const char *iv, size_t iv_size, int enc)
+{
+       struct crypt_cipher_kernel cipher;
+       size_t done = 0, block = CIPHER_BLOCK_BYTES;
+       int r;
+
+       if (buffer_size < block)
+               block = buffer_size;
+
+       r = crypt_cipher_init_kernel(&cipher, name, mode, key, key_size);
+       if (r < 0)
+               return r;
+
+       while (done < buffer_size) {
+               if ((done + block) > buffer_size)
+                       block = buffer_size - done;
+
+               if (enc)
+                       r = crypt_cipher_encrypt_kernel(&cipher, &buffer[done], &buffer[done],
+                                                block, iv, iv_size);
+               else
+                       r = crypt_cipher_decrypt_kernel(&cipher, &buffer[done], &buffer[done],
+                                                block, iv, iv_size);
+               if (r < 0)
+                       break;
+
+               done += block;
+       }
+
+       crypt_cipher_destroy_kernel(&cipher);
+
+       return r;
+}
+static int cipher_measure(const char *name, const char *mode, char *buffer, size_t buffer_size,
+                         const char *key, size_t key_size, const char *iv, size_t iv_size,
+                         int encrypt, double *ms)
+{
+       struct timespec start, end;
+       int r;
+
+       /*
+        * Using getrusage would be better here but the precision
+        * is not adequate, so better stick with CLOCK_MONOTONIC
+        */
+       if (clock_gettime(CLOCK_MONOTONIC_RAW, &start) < 0)
+               return -EINVAL;
+
+       r = cipher_perf_one(name, mode, buffer, buffer_size, key, key_size, iv, iv_size, encrypt);
+       if (r < 0)
+               return r;
+
+       if (clock_gettime(CLOCK_MONOTONIC_RAW, &end) < 0)
+               return -EINVAL;
+
+       r = time_ms(&start, &end, ms);
+       if (r < 0)
+               return r;
+
+       if (*ms < CIPHER_TIME_MIN_MS)
+               return -ERANGE;
+
+       return 0;
+}
+
+static double speed_mbs(unsigned long bytes, double ms)
+{
+       double speed = bytes, s = ms / 1000.;
+
+       return speed / (1024 * 1024) / s;
+}
+
+int crypt_cipher_perf_kernel(const char *name, const char *mode, char *buffer, size_t buffer_size,
+                            const char *key, size_t key_size, const char *iv, size_t iv_size,
+                            double *encryption_mbs, double *decryption_mbs)
+{
+       double ms_enc, ms_dec, ms;
+       int r, repeat_enc, repeat_dec;
+
+       ms_enc = 0.0;
+       repeat_enc = 1;
+       while (ms_enc < 1000.0) {
+               r = cipher_measure(name, mode, buffer, buffer_size, key, key_size, iv, iv_size, 1, &ms);
+               if (r < 0)
+                       return r;
+               ms_enc += ms;
+               repeat_enc++;
+       }
+
+       ms_dec = 0.0;
+       repeat_dec = 1;
+       while (ms_dec < 1000.0) {
+               r = cipher_measure(name, mode, buffer, buffer_size, key, key_size, iv, iv_size, 0, &ms);
+               if (r < 0)
+                       return r;
+               ms_dec += ms;
+               repeat_dec++;
+       }
+
+       *encryption_mbs = speed_mbs(buffer_size * repeat_enc, ms_enc);
+       *decryption_mbs = speed_mbs(buffer_size * repeat_dec, ms_dec);
+
+       return  0;
+}
diff --git a/lib/crypto_backend/cipher_generic.c b/lib/crypto_backend/cipher_generic.c
new file mode 100644 (file)
index 0000000..0ddec59
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Linux kernel cipher generic utilities
+ *
+ * Copyright (C) 2018-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2018-2020 Milan Broz
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <string.h>
+#include <stdbool.h>
+#include <errno.h>
+#include "crypto_backend.h"
+
+struct cipher_alg {
+       const char *name;
+       const char *mode;
+       int blocksize;
+       bool wrapped_key;
+};
+
+/* FIXME: Getting block size should be dynamic from cipher backend. */
+static const struct cipher_alg cipher_algs[] = {
+       { "cipher_null", NULL, 16, false },
+       { "aes",         NULL, 16, false },
+       { "serpent",     NULL, 16, false },
+       { "twofish",     NULL, 16, false },
+       { "anubis",      NULL, 16, false },
+       { "blowfish",    NULL,  8, false },
+       { "camellia",    NULL, 16, false },
+       { "cast5",       NULL,  8, false },
+       { "cast6",       NULL, 16, false },
+       { "des",         NULL,  8, false },
+       { "des3_ede",    NULL,  8, false },
+       { "khazad",      NULL,  8, false },
+       { "seed",        NULL, 16, false },
+       { "tea",         NULL,  8, false },
+       { "xtea",        NULL,  8, false },
+       { "paes",        NULL, 16,  true }, /* protected AES, s390 wrapped key scheme */
+       { "xchacha12,aes", "adiantum", 32, false },
+       { "xchacha20,aes", "adiantum", 32, false },
+       { "sm4",         NULL, 16, false },
+       { NULL,          NULL,  0, false }
+};
+
+static const struct cipher_alg *_get_alg(const char *name, const char *mode)
+{
+       int i = 0;
+
+       while (name && cipher_algs[i].name) {
+               if (!strcasecmp(name, cipher_algs[i].name))
+                       if (!mode || !cipher_algs[i].mode ||
+                           !strncasecmp(mode, cipher_algs[i].mode, strlen(cipher_algs[i].mode)))
+                               return &cipher_algs[i];
+               i++;
+       }
+       return NULL;
+}
+
+int crypt_cipher_ivsize(const char *name, const char *mode)
+{
+       const struct cipher_alg *ca = _get_alg(name, mode);
+
+       if (!ca)
+               return -EINVAL;
+
+       if (mode && !strcasecmp(mode, "ecb"))
+               return 0;
+
+       return ca->blocksize;
+}
+
+int crypt_cipher_wrapped_key(const char *name, const char *mode)
+{
+       const struct cipher_alg *ca = _get_alg(name, mode);
+
+       return ca ? (int)ca->wrapped_key : 0;
+}
index 332f383..9d43623 100644 (file)
@@ -19,7 +19,7 @@
  *  order from highest-order term to lowest-order term.  UARTs transmit
  *  characters in order from LSB to MSB.  By storing the CRC this way,
  *  we hand it to the UART in the order low-byte to high-byte; the UART
- *  sends each low-bit to hight-bit; and the result is transmission bit
+ *  sends each low-bit to high-bit; and the result is transmission bit
  *  by bit from highest- to lowest-order term without requiring any bit
  *  shuffling on our part.  Reception works similarly.
  *
@@ -42,7 +42,6 @@
 
 #include "crypto_backend.h"
 
-
 static const uint32_t crc32_tab[] = {
        0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
        0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
@@ -113,4 +112,3 @@ uint32_t crypt_crc32(uint32_t seed, const unsigned char *buf, size_t len)
 
        return crc;
 }
-
index 0aab38c..13fd47c 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * crypto backend implementation
  *
- * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2010-2014, Milan Broz
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #define _CRYPTO_BACKEND_H
 
 #include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
 #include <string.h>
 
-struct crypt_device;
 struct crypt_hash;
 struct crypt_hmac;
 struct crypt_cipher;
 struct crypt_storage;
 
-int crypt_backend_init(struct crypt_device *ctx);
+int crypt_backend_init(void);
+void crypt_backend_destroy(void);
 
 #define CRYPT_BACKEND_KERNEL (1 << 0)  /* Crypto uses kernel part, for benchmark */
 
@@ -42,71 +44,95 @@ int crypt_hash_size(const char *name);
 int crypt_hash_init(struct crypt_hash **ctx, const char *name);
 int crypt_hash_write(struct crypt_hash *ctx, const char *buffer, size_t length);
 int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length);
-int crypt_hash_destroy(struct crypt_hash *ctx);
+void crypt_hash_destroy(struct crypt_hash *ctx);
 
 /* HMAC */
 int crypt_hmac_size(const char *name);
 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
-                   const void *buffer, size_t length);
+                   const void *key, size_t key_length);
 int crypt_hmac_write(struct crypt_hmac *ctx, const char *buffer, size_t length);
 int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length);
-int crypt_hmac_destroy(struct crypt_hmac *ctx);
+void crypt_hmac_destroy(struct crypt_hmac *ctx);
 
-/* RNG (if fips paramater set, must provide FIPS compliance) */
+/* RNG (if fips parameter set, must provide FIPS compliance) */
 enum { CRYPT_RND_NORMAL = 0, CRYPT_RND_KEY = 1, CRYPT_RND_SALT = 2 };
 int crypt_backend_rng(char *buffer, size_t length, int quality, int fips);
 
+
 /* PBKDF*/
-int crypt_pbkdf_check(const char *kdf, const char *hash,
-                     const char *password, size_t password_size,
-                     const char *salt, size_t salt_size,
-                     uint64_t *iter_secs);
+struct crypt_pbkdf_limits {
+       uint32_t min_iterations, max_iterations;
+       uint32_t min_memory, max_memory;
+       uint32_t min_parallel, max_parallel;
+};
+
+int crypt_pbkdf_get_limits(const char *kdf, struct crypt_pbkdf_limits *l);
 int crypt_pbkdf(const char *kdf, const char *hash,
                const char *password, size_t password_length,
                const char *salt, size_t salt_length,
                char *key, size_t key_length,
-               unsigned int iterations);
-
-#if USE_INTERNAL_PBKDF2
-/* internal PBKDF2 implementation */
-int pkcs5_pbkdf2(const char *hash,
-                const char *P, size_t Plen,
-                const char *S, size_t Slen,
-                unsigned int c,
-                unsigned int dkLen, char *DK,
-                unsigned int hash_block_size);
-#endif
+               uint32_t iterations, uint32_t memory, uint32_t parallel);
+int crypt_pbkdf_perf(const char *kdf, const char *hash,
+               const char *password, size_t password_size,
+               const char *salt, size_t salt_size,
+               size_t volume_key_size, uint32_t time_ms,
+               uint32_t max_memory_kb, uint32_t parallel_threads,
+               uint32_t *iterations_out, uint32_t *memory_out,
+               int (*progress)(uint32_t time_ms, void *usrptr), void *usrptr);
 
 /* CRC32 */
 uint32_t crypt_crc32(uint32_t seed, const unsigned char *buf, size_t len);
 
-/* ciphers */
-int crypt_cipher_blocksize(const char *name);
+/* Block ciphers */
+int crypt_cipher_ivsize(const char *name, const char *mode);
+int crypt_cipher_wrapped_key(const char *name, const char *mode);
 int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
-                   const char *mode, const void *buffer, size_t length);
-int crypt_cipher_destroy(struct crypt_cipher *ctx);
+                   const char *mode, const void *key, size_t key_length);
+void crypt_cipher_destroy(struct crypt_cipher *ctx);
 int crypt_cipher_encrypt(struct crypt_cipher *ctx,
                         const char *in, char *out, size_t length,
                         const char *iv, size_t iv_length);
 int crypt_cipher_decrypt(struct crypt_cipher *ctx,
                         const char *in, char *out, size_t length,
                         const char *iv, size_t iv_length);
+bool crypt_cipher_kernel_only(struct crypt_cipher *ctx);
+
+/* Benchmark of kernel cipher performance */
+int crypt_cipher_perf_kernel(const char *name, const char *mode, char *buffer, size_t buffer_size,
+                            const char *key, size_t key_size, const char *iv, size_t iv_size,
+                            double *encryption_mbs, double *decryption_mbs);
 
-/* storage encryption wrappers */
-int crypt_storage_init(struct crypt_storage **ctx, uint64_t sector_start,
+/* Check availability of a cipher (in kernel only) */
+int crypt_cipher_check_kernel(const char *name, const char *mode,
+                             const char *integrity, size_t key_length);
+
+/* Storage encryption wrappers */
+int crypt_storage_init(struct crypt_storage **ctx, size_t sector_size,
                       const char *cipher, const char *cipher_mode,
-                      char *key, size_t key_length);
-int crypt_storage_destroy(struct crypt_storage *ctx);
-int crypt_storage_decrypt(struct crypt_storage *ctx, uint64_t sector,
-                         size_t count, char *buffer);
-int crypt_storage_encrypt(struct crypt_storage *ctx, uint64_t sector,
-                         size_t count, char *buffer);
+                      const void *key, size_t key_length);
+void crypt_storage_destroy(struct crypt_storage *ctx);
+int crypt_storage_decrypt(struct crypt_storage *ctx, uint64_t iv_offset,
+                         uint64_t length, char *buffer);
+int crypt_storage_encrypt(struct crypt_storage *ctx, uint64_t iv_offset,
+                         uint64_t length, char *buffer);
+
+bool crypt_storage_kernel_only(struct crypt_storage *ctx);
+
+/* Temporary Bitlk helper */
+int crypt_bitlk_decrypt_key(const void *key, size_t key_length,
+                           const char *in, char *out, size_t length,
+                           const char *iv, size_t iv_length,
+                           const char *tag, size_t tag_length);
 
 /* Memzero helper (memset on stack can be optimized out) */
 static inline void crypt_backend_memzero(void *s, size_t n)
 {
+#ifdef HAVE_EXPLICIT_BZERO
+       explicit_bzero(s, n);
+#else
        volatile uint8_t *p = (volatile uint8_t *)s;
        while(n--) *p++ = 0;
+#endif
 }
 
 #endif /* _CRYPTO_BACKEND_H */
diff --git a/lib/crypto_backend/crypto_backend_internal.h b/lib/crypto_backend/crypto_backend_internal.h
new file mode 100644 (file)
index 0000000..6128cd4
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * crypto backend implementation
+ *
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Milan Broz
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef _CRYPTO_BACKEND_INTERNAL_H
+#define _CRYPTO_BACKEND_INTERNAL_H
+
+#include "crypto_backend.h"
+
+#if USE_INTERNAL_PBKDF2
+/* internal PBKDF2 implementation */
+int pkcs5_pbkdf2(const char *hash,
+                const char *P, size_t Plen,
+                const char *S, size_t Slen,
+                unsigned int c,
+                unsigned int dkLen, char *DK,
+                unsigned int hash_block_size);
+#endif
+
+/* Argon2 implementation wrapper */
+int argon2(const char *type, const char *password, size_t password_length,
+          const char *salt, size_t salt_length,
+          char *key, size_t key_length,
+          uint32_t iterations, uint32_t memory, uint32_t parallel);
+
+/* Block ciphers: fallback to kernel crypto API */
+
+struct crypt_cipher_kernel {
+       int tfmfd;
+       int opfd;
+};
+
+int crypt_cipher_init_kernel(struct crypt_cipher_kernel *ctx, const char *name,
+                            const char *mode, const void *key, size_t key_length);
+int crypt_cipher_encrypt_kernel(struct crypt_cipher_kernel *ctx,
+                               const char *in, char *out, size_t length,
+                               const char *iv, size_t iv_length);
+int crypt_cipher_decrypt_kernel(struct crypt_cipher_kernel *ctx,
+                               const char *in, char *out, size_t length,
+                               const char *iv, size_t iv_length);
+void crypt_cipher_destroy_kernel(struct crypt_cipher_kernel *ctx);
+int crypt_bitlk_decrypt_key_kernel(const void *key, size_t key_length,
+                                  const char *in, char *out, size_t length,
+                                  const char *iv, size_t iv_length,
+                                  const char *tag, size_t tag_length);
+
+#endif /* _CRYPTO_BACKEND_INTERNAL_H */
index f7d2bcf..1a8aecf 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Linux kernel userspace API crypto backend implementation (skcipher)
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2014, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdbool.h>
 #include <errno.h>
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
-#include "crypto_backend.h"
+#include "crypto_backend_internal.h"
 
 #ifdef ENABLE_AF_ALG
 
 #define SOL_ALG 279
 #endif
 
-struct crypt_cipher {
-       int tfmfd;
-       int opfd;
-};
-
-struct cipher_alg {
-       const char *name;
-       int blocksize;
-};
-
-/* FIXME: Getting block size should be dynamic from cipher backend. */
-static struct cipher_alg cipher_algs[] = {
-       { "cipher_null", 16 },
-       { "aes",         16 },
-       { "serpent",     16 },
-       { "twofish",     16 },
-       { "anubis",      16 },
-       { "blowfish",     8 },
-       { "camellia",    16 },
-       { "cast5",        8 },
-       { "cast6",       16 },
-       { "des",          8 },
-       { "des3_ede",     8 },
-       { "khazad",       8 },
-       { "seed",        16 },
-       { "tea",          8 },
-       { "xtea",         8 },
-       { NULL,           0 }
-};
-
-static struct cipher_alg *_get_alg(const char *name)
-{
-       int i = 0;
-
-       while (name && cipher_algs[i].name) {
-               if (!strcasecmp(name, cipher_algs[i].name))
-                       return &cipher_algs[i];
-               i++;
-       }
-       return NULL;
-}
+#ifndef ALG_SET_AEAD_AUTHSIZE
+#define ALG_SET_AEAD_AUTHSIZE 5
+#endif
 
-int crypt_cipher_blocksize(const char *name)
+/*
+ * ciphers
+ *
+ * ENOENT - algorithm not available
+ * ENOTSUP - AF_ALG family not available
+ * (but cannot check specifically for skcipher API)
+ */
+static int _crypt_cipher_init(struct crypt_cipher_kernel *ctx,
+                             const void *key, size_t key_length,
+                             size_t tag_length, struct sockaddr_alg *sa)
 {
-       struct cipher_alg *ca = _get_alg(name);
-
-       return ca ? ca->blocksize : -EINVAL;
-}
-
-/* Shared with hash kernel backend */
-int crypt_kernel_socket_init(struct sockaddr_alg *sa, int *tfmfd, int *opfd);
+       if (!ctx)
+               return -EINVAL;
 
-int crypt_kernel_socket_init(struct sockaddr_alg *sa, int *tfmfd, int *opfd)
-{
-       *tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
-       if (*tfmfd == -1)
+       ctx->opfd = -1;
+       ctx->tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
+       if (ctx->tfmfd < 0) {
+               crypt_cipher_destroy_kernel(ctx);
                return -ENOTSUP;
+       }
 
-       if (bind(*tfmfd, (struct sockaddr *)sa, sizeof(*sa)) == -1) {
-               close(*tfmfd);
-               *tfmfd = -1;
+       if (bind(ctx->tfmfd, (struct sockaddr *)sa, sizeof(*sa)) < 0) {
+               crypt_cipher_destroy_kernel(ctx);
                return -ENOENT;
        }
 
-       *opfd = accept(*tfmfd, NULL, 0);
-       if (*opfd == -1) {
-               close(*tfmfd);
-               *tfmfd = -1;
+       if (setsockopt(ctx->tfmfd, SOL_ALG, ALG_SET_KEY, key, key_length) < 0) {
+               crypt_cipher_destroy_kernel(ctx);
+               return -EINVAL;
+       }
+
+       if (tag_length && setsockopt(ctx->tfmfd, SOL_ALG, ALG_SET_AEAD_AUTHSIZE, NULL, tag_length) < 0) {
+               crypt_cipher_destroy_kernel(ctx);
+               return -EINVAL;
+       }
+
+       ctx->opfd = accept(ctx->tfmfd, NULL, 0);
+       if (ctx->opfd < 0) {
+               crypt_cipher_destroy_kernel(ctx);
                return -EINVAL;
        }
 
        return 0;
 }
 
-/*
- *ciphers
- *
- * ENOENT - algorithm not available
- * ENOTSUP - AF_ALG family not available
- * (but cannot check specificaly for skcipher API)
- */
-int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
-                   const char *mode, const void *buffer, size_t length)
+int crypt_cipher_init_kernel(struct crypt_cipher_kernel *ctx, const char *name,
+                            const char *mode, const void *key, size_t key_length)
 {
-       struct crypt_cipher *h;
        struct sockaddr_alg sa = {
                .salg_family = AF_ALG,
                .salg_type = "skcipher",
        };
-       int r;
-
-       h = malloc(sizeof(*h));
-       if (!h)
-               return -ENOMEM;
-
-       snprintf((char *)sa.salg_name, sizeof(sa.salg_name),
-                "%s(%s)", mode, name);
 
-       r = crypt_kernel_socket_init(&sa, &h->tfmfd, &h->opfd);
-       if (r < 0) {
-               free(h);
-               return r;
-       }
+       if (!strcmp(name, "cipher_null"))
+               key_length = 0;
 
-       if (length && strcmp(name, "cipher_null") &&
-           setsockopt(h->tfmfd, SOL_ALG, ALG_SET_KEY, buffer, length) == -1) {
-               crypt_cipher_destroy(h);
-               return -EINVAL;
-       }
+       snprintf((char *)sa.salg_name, sizeof(sa.salg_name), "%s(%s)", mode, name);
 
-       *ctx = h;
-       return 0;
+       return _crypt_cipher_init(ctx, key, key_length, 0, &sa);
 }
 
 /* The in/out should be aligned to page boundary */
-static int crypt_cipher_crypt(struct crypt_cipher *ctx,
-                        const char *in, char *out, size_t length,
-                        const char *iv, size_t iv_length,
-                        uint32_t direction)
+static int _crypt_cipher_crypt(struct crypt_cipher_kernel *ctx,
+                              const char *in, size_t in_length,
+                              char *out, size_t out_length,
+                              const char *iv, size_t iv_length,
+                              uint32_t direction)
 {
        int r = 0;
        ssize_t len;
@@ -166,7 +119,7 @@ static int crypt_cipher_crypt(struct crypt_cipher *ctx,
        uint32_t *type;
        struct iovec iov = {
                .iov_base = (void*)(uintptr_t)in,
-               .iov_len = length,
+               .iov_len = in_length,
        };
        int iv_msg_size = iv ? CMSG_SPACE(sizeof(*alg_iv) + iv_length) : 0;
        char buffer[CMSG_SPACE(sizeof(*type)) + iv_msg_size];
@@ -177,7 +130,7 @@ static int crypt_cipher_crypt(struct crypt_cipher *ctx,
                .msg_iovlen = 1,
        };
 
-       if (!in || !out || !length)
+       if (!in || !out || !in_length)
                return -EINVAL;
 
        if ((!iv && iv_length) || (iv && !iv_length))
@@ -208,74 +161,183 @@ static int crypt_cipher_crypt(struct crypt_cipher *ctx,
        }
 
        len = sendmsg(ctx->opfd, &msg, 0);
-       if (len != (ssize_t)length) {
+       if (len != (ssize_t)(in_length)) {
                r = -EIO;
                goto bad;
        }
 
-       len = read(ctx->opfd, out, length);
-       if (len != (ssize_t)length)
+       len = read(ctx->opfd, out, out_length);
+       if (len != (ssize_t)out_length)
                r = -EIO;
 bad:
        crypt_backend_memzero(buffer, sizeof(buffer));
        return r;
 }
 
-int crypt_cipher_encrypt(struct crypt_cipher *ctx,
-                        const char *in, char *out, size_t length,
-                        const char *iv, size_t iv_length)
+int crypt_cipher_encrypt_kernel(struct crypt_cipher_kernel *ctx,
+                               const char *in, char *out, size_t length,
+                               const char *iv, size_t iv_length)
 {
-       return crypt_cipher_crypt(ctx, in, out, length,
-                                 iv, iv_length, ALG_OP_ENCRYPT);
+       return _crypt_cipher_crypt(ctx, in, length, out, length,
+                                  iv, iv_length, ALG_OP_ENCRYPT);
 }
 
-int crypt_cipher_decrypt(struct crypt_cipher *ctx,
-                        const char *in, char *out, size_t length,
-                        const char *iv, size_t iv_length)
+int crypt_cipher_decrypt_kernel(struct crypt_cipher_kernel *ctx,
+                               const char *in, char *out, size_t length,
+                               const char *iv, size_t iv_length)
 {
-       return crypt_cipher_crypt(ctx, in, out, length,
-                                 iv, iv_length, ALG_OP_DECRYPT);
+       return _crypt_cipher_crypt(ctx, in, length, out, length,
+                                  iv, iv_length, ALG_OP_DECRYPT);
 }
 
-int crypt_cipher_destroy(struct crypt_cipher *ctx)
+void crypt_cipher_destroy_kernel(struct crypt_cipher_kernel *ctx)
 {
-       if (ctx->tfmfd != -1)
+       if (ctx->tfmfd >= 0)
                close(ctx->tfmfd);
-       if (ctx->opfd != -1)
+       if (ctx->opfd >= 0)
                close(ctx->opfd);
-       memset(ctx, 0, sizeof(*ctx));
-       free(ctx);
-       return 0;
+
+       ctx->tfmfd = -1;
+       ctx->opfd = -1;
 }
 
-#else /* ENABLE_AF_ALG */
+int crypt_cipher_check_kernel(const char *name, const char *mode,
+                             const char *integrity, size_t key_length)
+{
+       struct crypt_cipher_kernel c;
+       char mode_name[64], tmp_salg_name[180], *real_mode = NULL, *cipher_iv = NULL, *key;
+       const char *salg_type;
+       bool aead;
+       int r;
+       struct sockaddr_alg sa = {
+               .salg_family = AF_ALG,
+       };
+
+       aead = integrity && strcmp(integrity, "none");
+
+       /* Remove IV if present */
+       if (mode) {
+               strncpy(mode_name, mode, sizeof(mode_name));
+               mode_name[sizeof(mode_name) - 1] = 0;
+               cipher_iv = strchr(mode_name, '-');
+               if (cipher_iv) {
+                       *cipher_iv = '\0';
+                       real_mode = mode_name;
+               }
+       }
+
+       salg_type = aead ? "aead" : "skcipher";
+       snprintf((char *)sa.salg_type, sizeof(sa.salg_type), "%s", salg_type);
+       memset(tmp_salg_name, 0, sizeof(tmp_salg_name));
+
+       /* FIXME: this is duplicating a part of devmapper backend */
+       if (aead && !strcmp(integrity, "poly1305"))
+               r = snprintf(tmp_salg_name, sizeof(tmp_salg_name), "rfc7539(%s,%s)", name, integrity);
+       else if (!real_mode)
+               r = snprintf(tmp_salg_name, sizeof(tmp_salg_name), "%s", name);
+       else if (aead && !strcmp(real_mode, "ccm"))
+               r = snprintf(tmp_salg_name, sizeof(tmp_salg_name), "rfc4309(%s(%s))", real_mode, name);
+       else
+               r = snprintf(tmp_salg_name, sizeof(tmp_salg_name), "%s(%s)", real_mode, name);
+
+       if (r <= 0 || r > (int)(sizeof(sa.salg_name) - 1))
+               return -EINVAL;
+
+       memcpy(sa.salg_name, tmp_salg_name, sizeof(sa.salg_name));
+
+       key = malloc(key_length);
+       if (!key)
+               return -ENOMEM;
+
+       /* We cannot use RNG yet, any key works here, tweak the first part if it is split key (XTS). */
+       memset(key, 0xab, key_length);
+       *key = 0xef;
 
-int crypt_cipher_blocksize(const char *name)
+       r = _crypt_cipher_init(&c, key, key_length, 0, &sa);
+       crypt_cipher_destroy_kernel(&c);
+       free(key);
+
+       return r;
+}
+
+int crypt_bitlk_decrypt_key_kernel(const void *key, size_t key_length,
+                                  const char *in, char *out, size_t length,
+                                  const char *iv, size_t iv_length,
+                                  const char *tag, size_t tag_length)
 {
-       return -EINVAL;
+       struct crypt_cipher_kernel c;
+       struct sockaddr_alg sa = {
+               .salg_family = AF_ALG,
+               .salg_type = "aead",
+               .salg_name = "ccm(aes)",
+       };
+       int r;
+       char buffer[128], ccm_iv[16];
+
+       if (length + tag_length > sizeof(buffer))
+               return -EINVAL;
+
+       if (iv_length > sizeof(ccm_iv) - 2)
+               return -EINVAL;
+
+       r = _crypt_cipher_init(&c, key, key_length, tag_length, &sa);
+       if (r < 0)
+               return r;
+
+       memcpy(buffer, in, length);
+       memcpy(buffer + length, tag, tag_length);
+
+       /* CCM IV - RFC3610 */
+       memset(ccm_iv, 0, sizeof(ccm_iv));
+       ccm_iv[0] = 15 - iv_length - 1;
+       memcpy(ccm_iv + 1, iv, iv_length);
+       memset(ccm_iv + 1 + iv_length, 0, ccm_iv[0] + 1);
+       iv_length = sizeof(ccm_iv);
+
+       r =  _crypt_cipher_crypt(&c, buffer, length + tag_length, out, length,
+                                ccm_iv, iv_length, ALG_OP_DECRYPT);
+
+       crypt_cipher_destroy_kernel(&c);
+       crypt_backend_memzero(buffer, sizeof(buffer));
+
+       return r;
 }
 
-int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
-                   const char *mode, const void *buffer, size_t length)
+#else /* ENABLE_AF_ALG */
+int crypt_cipher_init_kernel(struct crypt_cipher_kernel *ctx, const char *name,
+                            const char *mode, const void *key, size_t key_length)
 {
        return -ENOTSUP;
 }
 
-int crypt_cipher_destroy(struct crypt_cipher *ctx)
+void crypt_cipher_destroy_kernel(struct crypt_cipher_kernel *ctx)
 {
-       return 0;
+       return;
 }
 
-int crypt_cipher_encrypt(struct crypt_cipher *ctx,
-                        const char *in, char *out, size_t length,
-                        const char *iv, size_t iv_length)
+int crypt_cipher_encrypt_kernel(struct crypt_cipher_kernel *ctx,
+                               const char *in, char *out, size_t length,
+                               const char *iv, size_t iv_length)
 {
        return -EINVAL;
 }
-int crypt_cipher_decrypt(struct crypt_cipher *ctx,
-                        const char *in, char *out, size_t length,
-                        const char *iv, size_t iv_length)
+int crypt_cipher_decrypt_kernel(struct crypt_cipher_kernel *ctx,
+                               const char *in, char *out, size_t length,
+                               const char *iv, size_t iv_length)
 {
        return -EINVAL;
 }
+int crypt_cipher_check_kernel(const char *name, const char *mode,
+                             const char *integrity, size_t key_length)
+{
+       /* Cannot check, expect success. */
+       return 0;
+}
+int crypt_bitlk_decrypt_key_kernel(const void *key, size_t key_length,
+                                  const char *in, char *out, size_t length,
+                                  const char *iv, size_t iv_length,
+                                  const char *tag, size_t tag_length)
+{
+       return -ENOTSUP;
+}
 #endif
index 9037ad6..f2cf3c6 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * GCRYPT crypto backend implementation
  *
- * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2010-2014, Milan Broz
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,7 +24,7 @@
 #include <errno.h>
 #include <assert.h>
 #include <gcrypt.h>
-#include "crypto_backend.h"
+#include "crypto_backend_internal.h"
 
 static int crypto_backend_initialised = 0;
 static int crypto_backend_secmem = 1;
@@ -43,6 +43,14 @@ struct crypt_hmac {
        int hash_len;
 };
 
+struct crypt_cipher {
+       bool use_kernel;
+       union {
+       struct crypt_cipher_kernel kernel;
+       gcry_cipher_hd_t hd;
+       } u;
+};
+
 /*
  * Test for wrong Whirlpool variant,
  * Ref: http://lists.gnupg.org/pipermail/gcrypt-devel/2014-January/002889.html
@@ -81,7 +89,7 @@ static void crypt_hash_test_whirlpool_bug(void)
                crypto_backend_whirlpool_bug = 1;
 }
 
-int crypt_backend_init(struct crypt_device *ctx)
+int crypt_backend_init(void)
 {
        if (crypto_backend_initialised)
                return 0;
@@ -121,6 +129,14 @@ int crypt_backend_init(struct crypt_device *ctx)
        return 0;
 }
 
+void crypt_backend_destroy(void)
+{
+       if (crypto_backend_initialised)
+               gcry_control(GCRYCTL_TERM_SECMEM);
+
+       crypto_backend_initialised = 0;
+}
+
 const char *crypt_backend_version(void)
 {
        return crypto_backend_initialised ? version : "";
@@ -217,12 +233,11 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hash_destroy(struct crypt_hash *ctx)
+void crypt_hash_destroy(struct crypt_hash *ctx)
 {
        gcry_md_close(ctx->hd);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* HMAC */
@@ -232,7 +247,7 @@ int crypt_hmac_size(const char *name)
 }
 
 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
-                   const void *buffer, size_t length)
+                   const void *key, size_t key_length)
 {
        struct crypt_hmac *h;
        unsigned int flags = GCRY_MD_FLAG_HMAC;
@@ -254,7 +269,7 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
                return -EINVAL;
        }
 
-       if (gcry_md_setkey(h->hd, buffer, length)) {
+       if (gcry_md_setkey(h->hd, key, key_length)) {
                gcry_md_close(h->hd);
                free(h);
                return -EINVAL;
@@ -293,12 +308,11 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hmac_destroy(struct crypt_hmac *ctx)
+void crypt_hmac_destroy(struct crypt_hmac *ctx)
 {
        gcry_md_close(ctx->hd);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* RNG */
@@ -317,38 +331,191 @@ int crypt_backend_rng(char *buffer, size_t length, int quality, int fips)
        return 0;
 }
 
-/* PBKDF */
-int crypt_pbkdf(const char *kdf, const char *hash,
-               const char *password, size_t password_length,
-               const char *salt, size_t salt_length,
-               char *key, size_t key_length,
-               unsigned int iterations)
+static int pbkdf2(const char *hash,
+                 const char *password, size_t password_length,
+                 const char *salt, size_t salt_length,
+                 char *key, size_t key_length,
+                 uint32_t iterations)
 {
        const char *hash_name = crypt_hash_compat_name(hash, NULL);
 
 #if USE_INTERNAL_PBKDF2
-       if (!kdf || strncmp(kdf, "pbkdf2", 6))
-               return -EINVAL;
-
        return pkcs5_pbkdf2(hash_name, password, password_length, salt, salt_length,
                            iterations, key_length, key, 0);
-
 #else /* USE_INTERNAL_PBKDF2 */
        int hash_id = gcry_md_map_name(hash_name);
-       int kdf_id;
 
        if (!hash_id)
                return -EINVAL;
 
-       if (kdf && !strncmp(kdf, "pbkdf2", 6))
-               kdf_id = GCRY_KDF_PBKDF2;
+       if (gcry_kdf_derive(password, password_length, GCRY_KDF_PBKDF2, hash_id,
+           salt, salt_length, iterations, key_length, key))
+               return -EINVAL;
+
+       return 0;
+#endif /* USE_INTERNAL_PBKDF2 */
+}
+
+/* PBKDF */
+int crypt_pbkdf(const char *kdf, const char *hash,
+               const char *password, size_t password_length,
+               const char *salt, size_t salt_length,
+               char *key, size_t key_length,
+               uint32_t iterations, uint32_t memory, uint32_t parallel)
+{
+       if (!kdf)
+               return -EINVAL;
+
+       if (!strcmp(kdf, "pbkdf2"))
+               return pbkdf2(hash, password, password_length, salt, salt_length,
+                             key, key_length, iterations);
+       else if (!strncmp(kdf, "argon2", 6))
+               return argon2(kdf, password, password_length, salt, salt_length,
+                             key, key_length, iterations, memory, parallel);
+       return -EINVAL;
+}
+
+/* Block ciphers */
+static int _cipher_init(gcry_cipher_hd_t *hd, const char *name,
+                       const char *mode, const void *buffer, size_t length)
+{
+       int cipher_id, mode_id;
+
+       cipher_id = gcry_cipher_map_name(name);
+       if (cipher_id == GCRY_CIPHER_MODE_NONE)
+               return -ENOENT;
+
+       if (!strcmp(mode, "ecb"))
+               mode_id = GCRY_CIPHER_MODE_ECB;
+       else if (!strcmp(mode, "cbc"))
+               mode_id = GCRY_CIPHER_MODE_CBC;
+#if HAVE_DECL_GCRY_CIPHER_MODE_XTS
+       else if (!strcmp(mode, "xts"))
+               mode_id = GCRY_CIPHER_MODE_XTS;
+#endif
        else
+               return -ENOENT;
+
+       if (gcry_cipher_open(hd, cipher_id, mode_id, 0))
                return -EINVAL;
 
-       if (gcry_kdf_derive(password, password_length, kdf_id, hash_id,
-           salt, salt_length, iterations, key_length, key))
+       if (gcry_cipher_setkey(*hd, buffer, length)) {
+               gcry_cipher_close(*hd);
                return -EINVAL;
+       }
 
        return 0;
-#endif /* USE_INTERNAL_PBKDF2 */
+}
+
+int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
+                   const char *mode, const void *key, size_t key_length)
+{
+       struct crypt_cipher *h;
+       int r;
+
+       h = malloc(sizeof(*h));
+       if (!h)
+               return -ENOMEM;
+
+       if (!_cipher_init(&h->u.hd, name, mode, key, key_length)) {
+               h->use_kernel = false;
+               *ctx = h;
+               return 0;
+       }
+
+       r = crypt_cipher_init_kernel(&h->u.kernel, name, mode, key, key_length);
+       if (r < 0) {
+               free(h);
+               return r;
+       }
+
+       h->use_kernel = true;
+       *ctx = h;
+       return 0;
+}
+
+void crypt_cipher_destroy(struct crypt_cipher *ctx)
+{
+       if (ctx->use_kernel)
+               crypt_cipher_destroy_kernel(&ctx->u.kernel);
+       else
+               gcry_cipher_close(ctx->u.hd);
+       free(ctx);
+}
+
+int crypt_cipher_encrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       if (ctx->use_kernel)
+               return crypt_cipher_encrypt_kernel(&ctx->u.kernel, in, out, length, iv, iv_length);
+
+       if (iv && gcry_cipher_setiv(ctx->u.hd, iv, iv_length))
+               return -EINVAL;
+
+       if (gcry_cipher_encrypt(ctx->u.hd, out, length, in, length))
+               return -EINVAL;
+
+       return 0;
+}
+
+int crypt_cipher_decrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       if (ctx->use_kernel)
+               return crypt_cipher_decrypt_kernel(&ctx->u.kernel, in, out, length, iv, iv_length);
+
+       if (iv && gcry_cipher_setiv(ctx->u.hd, iv, iv_length))
+               return -EINVAL;
+
+       if (gcry_cipher_decrypt(ctx->u.hd, out, length, in, length))
+               return -EINVAL;
+
+       return 0;
+}
+
+bool crypt_cipher_kernel_only(struct crypt_cipher *ctx)
+{
+       return ctx->use_kernel;
+}
+
+int crypt_bitlk_decrypt_key(const void *key, size_t key_length,
+                           const char *in, char *out, size_t length,
+                           const char *iv, size_t iv_length,
+                           const char *tag, size_t tag_length)
+{
+#ifdef GCRY_CCM_BLOCK_LEN
+       gcry_cipher_hd_t hd;
+       uint64_t l[3];
+       int r = -EINVAL;
+
+       if (gcry_cipher_open(&hd, GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CCM, 0))
+               return -EINVAL;
+
+       if (gcry_cipher_setkey(hd, key, key_length))
+               goto out;
+
+       if (gcry_cipher_setiv(hd, iv, iv_length))
+               goto out;
+
+       l[0] = length;
+       l[1] = 0;
+       l[2] = tag_length;
+       if (gcry_cipher_ctl(hd, GCRYCTL_SET_CCM_LENGTHS, l, sizeof(l)))
+               goto out;
+
+       if (gcry_cipher_decrypt(hd, out, length, in, length))
+               goto out;
+
+       if (gcry_cipher_checktag(hd, tag, tag_length))
+               goto out;
+
+       r = 0;
+out:
+       gcry_cipher_close(hd);
+       return r;
+#else
+       return -ENOTSUP;
+#endif
 }
index 874d3a8..bb80d73 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Linux kernel userspace API crypto backend implementation
  *
- * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2010-2014, Milan Broz
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,7 @@
 #include <sys/socket.h>
 #include <sys/utsname.h>
 #include <linux/if_alg.h>
-#include "crypto_backend.h"
+#include "crypto_backend_internal.h"
 
 /* FIXME: remove later */
 #ifndef AF_ALG
@@ -38,7 +38,7 @@
 #endif
 
 static int crypto_backend_initialised = 0;
-static char version[64];
+static char version[256];
 
 struct hash_alg {
        const char *name;
@@ -48,12 +48,21 @@ struct hash_alg {
 };
 
 static struct hash_alg hash_algs[] = {
-       { "sha1",      "sha1",   20,  64 },
-       { "sha256",    "sha256", 32,  64 },
-       { "sha512",    "sha512", 64, 128 },
-       { "ripemd160", "rmd160", 20,  64 },
-       { "whirlpool", "wp512",  64,  64 },
-       { NULL,        NULL,      0,   0 }
+       { "sha1",      "sha1",        20,  64 },
+       { "sha224",    "sha224",      28,  64 },
+       { "sha256",    "sha256",      32,  64 },
+       { "sha384",    "sha384",      48, 128 },
+       { "sha512",    "sha512",      64, 128 },
+       { "ripemd160", "rmd160",      20,  64 },
+       { "whirlpool", "wp512",       64,  64 },
+       { "sha3-224",  "sha3-224",    28, 144 },
+       { "sha3-256",  "sha3-256",    32, 136 },
+       { "sha3-384",  "sha3-384",    48, 104 },
+       { "sha3-512",  "sha3-512",    64,  72 },
+       { "stribog256","streebog256", 32,  64 },
+       { "stribog512","streebog512", 64,  64 },
+       { "sm3",       "sm3",         32,  64 },
+       { NULL,        NULL,           0,   0 }
 };
 
 struct crypt_hash {
@@ -68,16 +77,46 @@ struct crypt_hmac {
        int hash_len;
 };
 
-/* Defined in crypt_kernel_ciphers.c */
-extern int crypt_kernel_socket_init(struct sockaddr_alg *sa, int *tfmfd, int *opfd);
+struct crypt_cipher {
+       struct crypt_cipher_kernel ck;
+};
+
+static int crypt_kernel_socket_init(struct sockaddr_alg *sa, int *tfmfd, int *opfd,
+                                   const void *key, size_t key_length)
+{
+       *tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
+       if (*tfmfd < 0)
+               return -ENOTSUP;
+
+       if (bind(*tfmfd, (struct sockaddr *)sa, sizeof(*sa)) < 0) {
+               close(*tfmfd);
+               *tfmfd = -1;
+               return -ENOENT;
+       }
+
+       if (key && setsockopt(*tfmfd, SOL_ALG, ALG_SET_KEY, key, key_length) < 0) {
+               close(*tfmfd);
+               *tfmfd = -1;
+               return -EINVAL;
+       }
 
-int crypt_backend_init(struct crypt_device *ctx)
+       *opfd = accept(*tfmfd, NULL, 0);
+       if (*opfd < 0) {
+               close(*tfmfd);
+               *tfmfd = -1;
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+int crypt_backend_init(void)
 {
        struct utsname uts;
        struct sockaddr_alg sa = {
                .salg_family = AF_ALG,
                .salg_type = "hash",
-               .salg_name = "sha1",
+               .salg_name = "sha256",
        };
        int tfmfd = -1, opfd = -1;
 
@@ -87,7 +126,7 @@ int crypt_backend_init(struct crypt_device *ctx)
        if (uname(&uts) == -1 || strcmp(uts.sysname, "Linux"))
                return -EINVAL;
 
-       if (crypt_kernel_socket_init(&sa, &tfmfd, &opfd) < 0)
+       if (crypt_kernel_socket_init(&sa, &tfmfd, &opfd, NULL, 0) < 0)
                return -EINVAL;
 
        close(tfmfd);
@@ -100,6 +139,11 @@ int crypt_backend_init(struct crypt_device *ctx)
        return 0;
 }
 
+void crypt_backend_destroy(void)
+{
+       crypto_backend_initialised = 0;
+}
+
 uint32_t crypt_backend_flags(void)
 {
        return CRYPT_BACKEND_KERNEL;
@@ -150,9 +194,9 @@ int crypt_hash_init(struct crypt_hash **ctx, const char *name)
        }
        h->hash_len = ha->length;
 
-       strncpy((char *)sa.salg_name, ha->kernel_name, sizeof(sa.salg_name));
+       strncpy((char *)sa.salg_name, ha->kernel_name, sizeof(sa.salg_name)-1);
 
-       if (crypt_kernel_socket_init(&sa, &h->tfmfd, &h->opfd) < 0) {
+       if (crypt_kernel_socket_init(&sa, &h->tfmfd, &h->opfd, NULL, 0) < 0) {
                free(h);
                return -EINVAL;
        }
@@ -186,15 +230,14 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hash_destroy(struct crypt_hash *ctx)
+void crypt_hash_destroy(struct crypt_hash *ctx)
 {
-       if (ctx->tfmfd != -1)
+       if (ctx->tfmfd >= 0)
                close(ctx->tfmfd);
-       if (ctx->opfd != -1)
+       if (ctx->opfd >= 0)
                close(ctx->opfd);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* HMAC */
@@ -204,7 +247,7 @@ int crypt_hmac_size(const char *name)
 }
 
 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
-                   const void *buffer, size_t length)
+                   const void *key, size_t key_length)
 {
        struct crypt_hmac *h;
        struct hash_alg *ha;
@@ -227,16 +270,11 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
        snprintf((char *)sa.salg_name, sizeof(sa.salg_name),
                 "hmac(%s)", ha->kernel_name);
 
-       if (crypt_kernel_socket_init(&sa, &h->tfmfd, &h->opfd) < 0) {
+       if (crypt_kernel_socket_init(&sa, &h->tfmfd, &h->opfd, key, key_length) < 0) {
                free(h);
                return -EINVAL;
        }
 
-       if (setsockopt(h->tfmfd, SOL_ALG, ALG_SET_KEY, buffer, length) == -1) {
-               crypt_hmac_destroy(h);
-               return -EINVAL;
-       }
-
        *ctx = h;
        return 0;
 }
@@ -266,15 +304,14 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hmac_destroy(struct crypt_hmac *ctx)
+void crypt_hmac_destroy(struct crypt_hmac *ctx)
 {
-       if (ctx->tfmfd != -1)
+       if (ctx->tfmfd >= 0)
                close(ctx->tfmfd);
-       if (ctx->opfd != -1)
+       if (ctx->opfd >= 0)
                close(ctx->opfd);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* RNG - N/A */
@@ -288,13 +325,79 @@ int crypt_pbkdf(const char *kdf, const char *hash,
                const char *password, size_t password_length,
                const char *salt, size_t salt_length,
                char *key, size_t key_length,
-               unsigned int iterations)
+               uint32_t iterations, uint32_t memory, uint32_t parallel)
 {
-       struct hash_alg *ha = _get_alg(hash);
+       struct hash_alg *ha;
 
-       if (!ha || !kdf || strncmp(kdf, "pbkdf2", 6))
+       if (!kdf)
                return -EINVAL;
 
-       return pkcs5_pbkdf2(hash, password, password_length, salt, salt_length,
-                           iterations, key_length, key, ha->block_length);
+       if (!strcmp(kdf, "pbkdf2")) {
+               ha = _get_alg(hash);
+               if (!ha)
+                       return -EINVAL;
+
+               return pkcs5_pbkdf2(hash, password, password_length, salt, salt_length,
+                                   iterations, key_length, key, ha->block_length);
+       } else if (!strncmp(kdf, "argon2", 6)) {
+               return argon2(kdf, password, password_length, salt, salt_length,
+                             key, key_length, iterations, memory, parallel);
+       }
+
+       return -EINVAL;
+}
+
+/* Block ciphers */
+int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
+                   const char *mode, const void *key, size_t key_length)
+{
+       struct crypt_cipher *h;
+       int r;
+
+       h = malloc(sizeof(*h));
+       if (!h)
+               return -ENOMEM;
+
+       r = crypt_cipher_init_kernel(&h->ck, name, mode, key, key_length);
+       if (r < 0) {
+               free(h);
+               return r;
+       }
+
+       *ctx = h;
+       return 0;
+}
+
+void crypt_cipher_destroy(struct crypt_cipher *ctx)
+{
+       crypt_cipher_destroy_kernel(&ctx->ck);
+       free(ctx);
+}
+
+int crypt_cipher_encrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       return crypt_cipher_encrypt_kernel(&ctx->ck, in, out, length, iv, iv_length);
+}
+
+int crypt_cipher_decrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       return crypt_cipher_decrypt_kernel(&ctx->ck, in, out, length, iv, iv_length);
+}
+
+bool crypt_cipher_kernel_only(struct crypt_cipher *ctx)
+{
+       return true;
+}
+
+int crypt_bitlk_decrypt_key(const void *key, size_t key_length,
+                           const char *in, char *out, size_t length,
+                           const char *iv, size_t iv_length,
+                           const char *tag, size_t tag_length)
+{
+       return crypt_bitlk_decrypt_key_kernel(key, key_length, in, out, length,
+                                             iv, iv_length, tag, tag_length);
 }
index cc6617a..c2ec305 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Nettle crypto backend implementation
  *
- * Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
- * Copyright (C) 2011-2014, Milan Broz
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include <string.h>
 #include <errno.h>
 #include <nettle/sha.h>
+#include <nettle/sha3.h>
 #include <nettle/hmac.h>
 #include <nettle/pbkdf2.h>
-#include "crypto_backend.h"
+#include "crypto_backend_internal.h"
 
-static char *version = "Nettle";
+#if HAVE_NETTLE_VERSION_H
+#include <nettle/version.h>
+#define VSTR(s) STR(s)
+#define STR(s) #s
+static const char *version = "Nettle "VSTR(NETTLE_VERSION_MAJOR)"."VSTR(NETTLE_VERSION_MINOR);
+#else
+static const char *version = "Nettle";
+#endif
 
 typedef void (*init_func) (void *);
-typedef void (*update_func) (void *, unsigned, const uint8_t *);
-typedef void (*digest_func) (void *, unsigned, uint8_t *);
-typedef void (*set_key_func) (void *, unsigned, const uint8_t *);
+typedef void (*update_func) (void *, size_t, const uint8_t *);
+typedef void (*digest_func) (void *, size_t, uint8_t *);
+typedef void (*set_key_func) (void *, size_t, const uint8_t *);
 
 struct hash_alg {
        const char *name;
@@ -45,6 +53,24 @@ struct hash_alg {
        set_key_func hmac_set_key;
 };
 
+/* Missing HMAC wrappers in Nettle */
+#define HMAC_FCE(xxx) \
+struct xhmac_##xxx##_ctx HMAC_CTX(struct xxx##_ctx); \
+static void xhmac_##xxx##_set_key(struct xhmac_##xxx##_ctx *ctx, \
+size_t key_length, const uint8_t *key) \
+{HMAC_SET_KEY(ctx, &nettle_##xxx, key_length, key);} \
+static void xhmac_##xxx##_update(struct xhmac_##xxx##_ctx *ctx, \
+size_t length, const uint8_t *data) \
+{xxx##_update(&ctx->state, length, data);} \
+static void xhmac_##xxx##_digest(struct xhmac_##xxx##_ctx *ctx, \
+size_t length, uint8_t *digest) \
+{HMAC_DIGEST(ctx, &nettle_##xxx, length, digest);}
+
+HMAC_FCE(sha3_224);
+HMAC_FCE(sha3_256);
+HMAC_FCE(sha3_384);
+HMAC_FCE(sha3_512);
+
 static struct hash_alg hash_algs[] = {
        { "sha1", SHA1_DIGEST_SIZE,
                (init_func) sha1_init,
@@ -94,6 +120,41 @@ static struct hash_alg hash_algs[] = {
                (digest_func) hmac_ripemd160_digest,
                (set_key_func) hmac_ripemd160_set_key,
        },
+/* Nettle prior to version 3.2 has incompatible SHA3 implementation */
+#if NETTLE_SHA3_FIPS202
+       { "sha3-224", SHA3_224_DIGEST_SIZE,
+               (init_func) sha3_224_init,
+               (update_func) sha3_224_update,
+               (digest_func) sha3_224_digest,
+               (update_func) xhmac_sha3_224_update,
+               (digest_func) xhmac_sha3_224_digest,
+               (set_key_func) xhmac_sha3_224_set_key,
+       },
+       { "sha3-256", SHA3_256_DIGEST_SIZE,
+               (init_func) sha3_256_init,
+               (update_func) sha3_256_update,
+               (digest_func) sha3_256_digest,
+               (update_func) xhmac_sha3_256_update,
+               (digest_func) xhmac_sha3_256_digest,
+               (set_key_func) xhmac_sha3_256_set_key,
+       },
+       { "sha3-384", SHA3_384_DIGEST_SIZE,
+               (init_func) sha3_384_init,
+               (update_func) sha3_384_update,
+               (digest_func) sha3_384_digest,
+               (update_func) xhmac_sha3_384_update,
+               (digest_func) xhmac_sha3_384_digest,
+               (set_key_func) xhmac_sha3_384_set_key,
+       },
+       { "sha3-512", SHA3_512_DIGEST_SIZE,
+               (init_func) sha3_512_init,
+               (update_func) sha3_512_update,
+               (digest_func) sha3_512_digest,
+               (update_func) xhmac_sha3_512_update,
+               (digest_func) xhmac_sha3_512_digest,
+               (set_key_func) xhmac_sha3_512_set_key,
+       },
+#endif
        { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, }
 };
 
@@ -105,6 +166,11 @@ struct crypt_hash {
                struct sha256_ctx sha256;
                struct sha384_ctx sha384;
                struct sha512_ctx sha512;
+               struct ripemd160_ctx ripemd160;
+               struct sha3_224_ctx sha3_224;
+               struct sha3_256_ctx sha3_256;
+               struct sha3_384_ctx sha3_384;
+               struct sha3_512_ctx sha3_512;
        } nettle_ctx;
 };
 
@@ -116,11 +182,20 @@ struct crypt_hmac {
                struct hmac_sha256_ctx sha256;
                struct hmac_sha384_ctx sha384;
                struct hmac_sha512_ctx sha512;
+               struct hmac_ripemd160_ctx ripemd160;
+               struct xhmac_sha3_224_ctx sha3_224;
+               struct xhmac_sha3_256_ctx sha3_256;
+               struct xhmac_sha3_384_ctx sha3_384;
+               struct xhmac_sha3_512_ctx sha3_512;
        } nettle_ctx;
        size_t key_length;
        uint8_t *key;
 };
 
+struct crypt_cipher {
+       struct crypt_cipher_kernel ck;
+};
+
 uint32_t crypt_backend_flags(void)
 {
        return 0;
@@ -138,11 +213,16 @@ static struct hash_alg *_get_alg(const char *name)
        return NULL;
 }
 
-int crypt_backend_init(struct crypt_device *ctx)
+int crypt_backend_init(void)
 {
        return 0;
 }
 
+void crypt_backend_destroy(void)
+{
+       return;
+}
+
 const char *crypt_backend_version(void)
 {
        return version;
@@ -197,11 +277,10 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hash_destroy(struct crypt_hash *ctx)
+void crypt_hash_destroy(struct crypt_hash *ctx)
 {
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* HMAC */
@@ -211,7 +290,7 @@ int crypt_hmac_size(const char *name)
 }
 
 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
-                   const void *buffer, size_t length)
+                   const void *key, size_t key_length)
 {
        struct crypt_hmac *h;
 
@@ -225,12 +304,12 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
        if (!h->hash)
                goto bad;
 
-       h->key = malloc(length);
+       h->key = malloc(key_length);
        if (!h->key)
                goto bad;
 
-       memcpy(h->key, buffer, length);
-       h->key_length = length;
+       memcpy(h->key, key, key_length);
+       h->key_length = key_length;
 
        h->hash->init(&h->nettle_ctx);
        h->hash->hmac_set_key(&h->nettle_ctx, h->key_length, h->key);
@@ -263,13 +342,12 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hmac_destroy(struct crypt_hmac *ctx)
+void crypt_hmac_destroy(struct crypt_hmac *ctx)
 {
        memset(ctx->key, 0, ctx->key_length);
        free(ctx->key);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* RNG - N/A */
@@ -283,23 +361,84 @@ int crypt_pbkdf(const char *kdf, const char *hash,
                const char *password, size_t password_length,
                const char *salt, size_t salt_length,
                char *key, size_t key_length,
-               unsigned int iterations)
+               uint32_t iterations, uint32_t memory, uint32_t parallel)
 {
        struct crypt_hmac *h;
        int r;
 
-       if (!kdf || strncmp(kdf, "pbkdf2", 6))
+       if (!kdf)
                return -EINVAL;
 
-       r = crypt_hmac_init(&h, hash, password, password_length);
-       if (r < 0)
-               return r;
+       if (!strcmp(kdf, "pbkdf2")) {
+               r = crypt_hmac_init(&h, hash, password, password_length);
+               if (r < 0)
+                       return r;
+
+               nettle_pbkdf2(&h->nettle_ctx, h->hash->hmac_update,
+                             h->hash->hmac_digest, h->hash->length, iterations,
+                             salt_length, (const uint8_t *)salt, key_length,
+                             (uint8_t *)key);
+               crypt_hmac_destroy(h);
+               return 0;
+       } else if (!strncmp(kdf, "argon2", 6)) {
+               return argon2(kdf, password, password_length, salt, salt_length,
+                             key, key_length, iterations, memory, parallel);
+       }
+
+       return -EINVAL;
+}
+
+/* Block ciphers */
+int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
+                   const char *mode, const void *key, size_t key_length)
+{
+       struct crypt_cipher *h;
+       int r;
+
+       h = malloc(sizeof(*h));
+       if (!h)
+               return -ENOMEM;
 
-       nettle_pbkdf2(&h->nettle_ctx, h->hash->nettle_hmac_update,
-                     h->hash->nettle_hmac_digest, h->hash->length, iterations,
-                     salt_length, (const uint8_t *)salt, key_length,
-                     (uint8_t *)key);
-       crypt_hmac_destroy(h);
+       r = crypt_cipher_init_kernel(&h->ck, name, mode, key, key_length);
+       if (r < 0) {
+               free(h);
+               return r;
+       }
 
+       *ctx = h;
        return 0;
 }
+
+void crypt_cipher_destroy(struct crypt_cipher *ctx)
+{
+       crypt_cipher_destroy_kernel(&ctx->ck);
+       free(ctx);
+}
+
+int crypt_cipher_encrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       return crypt_cipher_encrypt_kernel(&ctx->ck, in, out, length, iv, iv_length);
+}
+
+int crypt_cipher_decrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       return crypt_cipher_decrypt_kernel(&ctx->ck, in, out, length, iv, iv_length);
+}
+
+bool crypt_cipher_kernel_only(struct crypt_cipher *ctx)
+{
+       return true;
+}
+
+int crypt_bitlk_decrypt_key(const void *key, size_t key_length,
+                           const char *in, char *out, size_t length,
+                           const char *iv, size_t iv_length,
+                           const char *tag, size_t tag_length)
+{
+       return crypt_bitlk_decrypt_key_kernel(key, key_length, in, out, length,
+                                             iv, iv_length, tag, tag_length);
+}
index 4b9f943..f141432 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * NSS crypto backend implementation
  *
- * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2010-2014, Milan Broz
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,7 +23,7 @@
 #include <errno.h>
 #include <nss.h>
 #include <pk11pub.h>
-#include "crypto_backend.h"
+#include "crypto_backend_internal.h"
 
 #define CONST_CAST(x) (x)(uintptr_t)
 
@@ -59,6 +59,10 @@ struct crypt_hmac {
        const struct hash_alg *hash;
 };
 
+struct crypt_cipher {
+       struct crypt_cipher_kernel ck;
+};
+
 static struct hash_alg *_get_alg(const char *name)
 {
        int i = 0;
@@ -71,7 +75,7 @@ static struct hash_alg *_get_alg(const char *name)
        return NULL;
 }
 
-int crypt_backend_init(struct crypt_device *ctx)
+int crypt_backend_init(void)
 {
        if (crypto_backend_initialised)
                return 0;
@@ -88,6 +92,11 @@ int crypt_backend_init(struct crypt_device *ctx)
        return 0;
 }
 
+void crypt_backend_destroy(void)
+{
+       crypto_backend_initialised = 0;
+}
+
 uint32_t crypt_backend_flags(void)
 {
        return 0;
@@ -175,12 +184,11 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hash_destroy(struct crypt_hash *ctx)
+void crypt_hash_destroy(struct crypt_hash *ctx)
 {
        PK11_DestroyContext(ctx->md, PR_TRUE);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* HMAC */
@@ -190,15 +198,15 @@ int crypt_hmac_size(const char *name)
 }
 
 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
-                   const void *buffer, size_t length)
+                   const void *key, size_t key_length)
 {
        struct crypt_hmac *h;
        SECItem keyItem;
        SECItem noParams;
 
        keyItem.type = siBuffer;
-       keyItem.data = CONST_CAST(unsigned char *)buffer;
-       keyItem.len = (int)length;
+       keyItem.data = CONST_CAST(unsigned char *)key;
+       keyItem.len = (int)key_length;
 
        noParams.type = siBuffer;
        noParams.data = 0;
@@ -277,7 +285,7 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hmac_destroy(struct crypt_hmac *ctx)
+void crypt_hmac_destroy(struct crypt_hmac *ctx)
 {
        if (ctx->key)
                PK11_FreeSymKey(ctx->key);
@@ -287,7 +295,6 @@ int crypt_hmac_destroy(struct crypt_hmac *ctx)
                PK11_DestroyContext(ctx->md, PR_TRUE);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* RNG */
@@ -307,13 +314,79 @@ int crypt_pbkdf(const char *kdf, const char *hash,
                const char *password, size_t password_length,
                const char *salt, size_t salt_length,
                char *key, size_t key_length,
-               unsigned int iterations)
+               uint32_t iterations, uint32_t memory, uint32_t parallel)
 {
-       struct hash_alg *ha = _get_alg(hash);
+       struct hash_alg *ha;
 
-       if (!ha || !kdf || strncmp(kdf, "pbkdf2", 6))
+       if (!kdf)
                return -EINVAL;
 
-       return pkcs5_pbkdf2(hash, password, password_length, salt, salt_length,
-                           iterations, key_length, key, ha->block_length);
+       if (!strcmp(kdf, "pbkdf2")) {
+               ha = _get_alg(hash);
+               if (!ha)
+                       return -EINVAL;
+
+               return pkcs5_pbkdf2(hash, password, password_length, salt, salt_length,
+                                   iterations, key_length, key, ha->block_length);
+       } else if (!strncmp(kdf, "argon2", 6)) {
+               return argon2(kdf, password, password_length, salt, salt_length,
+                             key, key_length, iterations, memory, parallel);
+       }
+
+       return -EINVAL;
+}
+
+/* Block ciphers */
+int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
+                   const char *mode, const void *key, size_t key_length)
+{
+       struct crypt_cipher *h;
+       int r;
+
+       h = malloc(sizeof(*h));
+       if (!h)
+               return -ENOMEM;
+
+       r = crypt_cipher_init_kernel(&h->ck, name, mode, key, key_length);
+       if (r < 0) {
+               free(h);
+               return r;
+       }
+
+       *ctx = h;
+       return 0;
+}
+
+void crypt_cipher_destroy(struct crypt_cipher *ctx)
+{
+       crypt_cipher_destroy_kernel(&ctx->ck);
+       free(ctx);
+}
+
+int crypt_cipher_encrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       return crypt_cipher_encrypt_kernel(&ctx->ck, in, out, length, iv, iv_length);
+}
+
+int crypt_cipher_decrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       return crypt_cipher_decrypt_kernel(&ctx->ck, in, out, length, iv, iv_length);
+}
+
+bool crypt_cipher_kernel_only(struct crypt_cipher *ctx)
+{
+       return true;
+}
+
+int crypt_bitlk_decrypt_key(const void *key, size_t key_length,
+                           const char *in, char *out, size_t length,
+                           const char *iv, size_t iv_length,
+                           const char *tag, size_t tag_length)
+{
+       return crypt_bitlk_decrypt_key_kernel(key, key_length, in, out, length,
+                                             iv, iv_length, tag, tag_length);
 }
index 5e4345b..2edec7b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * OPENSSL crypto backend implementation
  *
- * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2010-2014, Milan Broz
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 #include <openssl/rand.h>
-#include "crypto_backend.h"
+#include "crypto_backend_internal.h"
+
+#define CONST_CAST(x) (x)(uintptr_t)
 
 static int crypto_backend_initialised = 0;
 
 struct crypt_hash {
-       EVP_MD_CTX md;
+       EVP_MD_CTX *md;
        const EVP_MD *hash_id;
        int hash_len;
 };
 
 struct crypt_hmac {
-       HMAC_CTX md;
+       HMAC_CTX *md;
        const EVP_MD *hash_id;
        int hash_len;
 };
 
-int crypt_backend_init(struct crypt_device *ctx)
+struct crypt_cipher {
+       bool use_kernel;
+       union {
+       struct crypt_cipher_kernel kernel;
+       struct {
+               EVP_CIPHER_CTX *hd_enc;
+               EVP_CIPHER_CTX *hd_dec;
+               size_t iv_length;
+       } lib;
+       } u;
+};
+
+/*
+ * Compatible wrappers for OpenSSL < 1.1.0 and LibreSSL < 2.7.0
+ */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
+    (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
+
+static void openssl_backend_init(void)
+{
+       OpenSSL_add_all_algorithms();
+}
+
+static const char *openssl_backend_version(void)
+{
+       return SSLeay_version(SSLEAY_VERSION);
+}
+
+static EVP_MD_CTX *EVP_MD_CTX_new(void)
+{
+       EVP_MD_CTX *md = malloc(sizeof(*md));
+
+       if (md)
+               EVP_MD_CTX_init(md);
+
+       return md;
+}
+
+static void EVP_MD_CTX_free(EVP_MD_CTX *md)
+{
+       EVP_MD_CTX_cleanup(md);
+       free(md);
+}
+
+static HMAC_CTX *HMAC_CTX_new(void)
+{
+       HMAC_CTX *md = malloc(sizeof(*md));
+
+       if (md)
+               HMAC_CTX_init(md);
+
+       return md;
+}
+
+static void HMAC_CTX_free(HMAC_CTX *md)
+{
+       HMAC_CTX_cleanup(md);
+       free(md);
+}
+#else
+static void openssl_backend_init(void)
+{
+}
+
+static const char *openssl_backend_version(void)
+{
+    return OpenSSL_version(OPENSSL_VERSION);
+}
+#endif
+
+int crypt_backend_init(void)
 {
        if (crypto_backend_initialised)
                return 0;
 
-       OpenSSL_add_all_algorithms();
+       openssl_backend_init();
 
        crypto_backend_initialised = 1;
        return 0;
 }
 
+void crypt_backend_destroy(void)
+{
+       crypto_backend_initialised = 0;
+}
+
 uint32_t crypt_backend_flags(void)
 {
        return 0;
@@ -67,7 +144,7 @@ uint32_t crypt_backend_flags(void)
 
 const char *crypt_backend_version(void)
 {
-       return SSLeay_version(SSLEAY_VERSION);
+       return openssl_backend_version();
 }
 
 /* HASH */
@@ -89,13 +166,21 @@ int crypt_hash_init(struct crypt_hash **ctx, const char *name)
        if (!h)
                return -ENOMEM;
 
+       h->md = EVP_MD_CTX_new();
+       if (!h->md) {
+               free(h);
+               return -ENOMEM;
+       }
+
        h->hash_id = EVP_get_digestbyname(name);
        if (!h->hash_id) {
+               EVP_MD_CTX_free(h->md);
                free(h);
                return -EINVAL;
        }
 
-       if (EVP_DigestInit(&h->md, h->hash_id) != 1) {
+       if (EVP_DigestInit_ex(h->md, h->hash_id, NULL) != 1) {
+               EVP_MD_CTX_free(h->md);
                free(h);
                return -EINVAL;
        }
@@ -107,7 +192,7 @@ int crypt_hash_init(struct crypt_hash **ctx, const char *name)
 
 static int crypt_hash_restart(struct crypt_hash *ctx)
 {
-       if (EVP_DigestInit(&ctx->md, ctx->hash_id) != 1)
+       if (EVP_DigestInit_ex(ctx->md, ctx->hash_id, NULL) != 1)
                return -EINVAL;
 
        return 0;
@@ -115,7 +200,7 @@ static int crypt_hash_restart(struct crypt_hash *ctx)
 
 int crypt_hash_write(struct crypt_hash *ctx, const char *buffer, size_t length)
 {
-       if (EVP_DigestUpdate(&ctx->md, buffer, length) != 1)
+       if (EVP_DigestUpdate(ctx->md, buffer, length) != 1)
                return -EINVAL;
 
        return 0;
@@ -129,7 +214,7 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
        if (length > (size_t)ctx->hash_len)
                return -EINVAL;
 
-       if (EVP_DigestFinal_ex(&ctx->md, tmp, &tmp_len) != 1)
+       if (EVP_DigestFinal_ex(ctx->md, tmp, &tmp_len) != 1)
                return -EINVAL;
 
        memcpy(buffer, tmp, length);
@@ -144,12 +229,11 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hash_destroy(struct crypt_hash *ctx)
+void crypt_hash_destroy(struct crypt_hash *ctx)
 {
-       EVP_MD_CTX_cleanup(&ctx->md);
+       EVP_MD_CTX_free(ctx->md);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* HMAC */
@@ -159,7 +243,7 @@ int crypt_hmac_size(const char *name)
 }
 
 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
-                   const void *buffer, size_t length)
+                   const void *key, size_t key_length)
 {
        struct crypt_hmac *h;
 
@@ -167,14 +251,20 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
        if (!h)
                return -ENOMEM;
 
+       h->md = HMAC_CTX_new();
+       if (!h->md) {
+               free(h);
+               return -ENOMEM;
+       }
+
        h->hash_id = EVP_get_digestbyname(name);
        if (!h->hash_id) {
+               HMAC_CTX_free(h->md);
                free(h);
                return -EINVAL;
        }
 
-       HMAC_CTX_init(&h->md);
-       HMAC_Init_ex(&h->md, buffer, length, h->hash_id, NULL);
+       HMAC_Init_ex(h->md, key, key_length, h->hash_id, NULL);
 
        h->hash_len = EVP_MD_size(h->hash_id);
        *ctx = h;
@@ -183,12 +273,12 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
 
 static void crypt_hmac_restart(struct crypt_hmac *ctx)
 {
-       HMAC_Init_ex(&ctx->md, NULL, 0, ctx->hash_id, NULL);
+       HMAC_Init_ex(ctx->md, NULL, 0, ctx->hash_id, NULL);
 }
 
 int crypt_hmac_write(struct crypt_hmac *ctx, const char *buffer, size_t length)
 {
-       HMAC_Update(&ctx->md, (const unsigned char *)buffer, length);
+       HMAC_Update(ctx->md, (const unsigned char *)buffer, length);
        return 0;
 }
 
@@ -200,7 +290,7 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
        if (length > (size_t)ctx->hash_len)
                return -EINVAL;
 
-       HMAC_Final(&ctx->md, tmp, &tmp_len);
+       HMAC_Final(ctx->md, tmp, &tmp_len);
 
        memcpy(buffer, tmp, length);
        crypt_backend_memzero(tmp, sizeof(tmp));
@@ -213,20 +303,16 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
        return 0;
 }
 
-int crypt_hmac_destroy(struct crypt_hmac *ctx)
+void crypt_hmac_destroy(struct crypt_hmac *ctx)
 {
-       HMAC_CTX_cleanup(&ctx->md);
+       HMAC_CTX_free(ctx->md);
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
-       return 0;
 }
 
 /* RNG */
 int crypt_backend_rng(char *buffer, size_t length, int quality, int fips)
 {
-       if (fips)
-               return -EINVAL;
-
        if (RAND_bytes((unsigned char *)buffer, length) != 1)
                return -EINVAL;
 
@@ -238,21 +324,223 @@ int crypt_pbkdf(const char *kdf, const char *hash,
                const char *password, size_t password_length,
                const char *salt, size_t salt_length,
                char *key, size_t key_length,
-               unsigned int iterations)
+               uint32_t iterations, uint32_t memory, uint32_t parallel)
+
 {
        const EVP_MD *hash_id;
 
-       if (!kdf || strncmp(kdf, "pbkdf2", 6))
+       if (!kdf)
                return -EINVAL;
 
-       hash_id = EVP_get_digestbyname(hash);
-       if (!hash_id)
+       if (!strcmp(kdf, "pbkdf2")) {
+               hash_id = EVP_get_digestbyname(hash);
+               if (!hash_id)
+                       return -EINVAL;
+
+               if (!PKCS5_PBKDF2_HMAC(password, (int)password_length,
+                   (const unsigned char *)salt, (int)salt_length,
+                   (int)iterations, hash_id, (int)key_length, (unsigned char *)key))
+                       return -EINVAL;
+               return 0;
+       } else if (!strncmp(kdf, "argon2", 6)) {
+               return argon2(kdf, password, password_length, salt, salt_length,
+                             key, key_length, iterations, memory, parallel);
+       }
+
+       return -EINVAL;
+}
+
+/* Block ciphers */
+static void _cipher_destroy(EVP_CIPHER_CTX **hd_enc, EVP_CIPHER_CTX **hd_dec)
+{
+       EVP_CIPHER_CTX_free(*hd_enc);
+       *hd_enc = NULL;
+
+       EVP_CIPHER_CTX_free(*hd_dec);
+       *hd_dec = NULL;
+}
+
+static int _cipher_init(EVP_CIPHER_CTX **hd_enc, EVP_CIPHER_CTX **hd_dec, const char *name,
+                       const char *mode, const void *key, size_t key_length, size_t *iv_length)
+{
+       char cipher_name[256];
+       const EVP_CIPHER *type;
+       int r, key_bits;
+
+       key_bits = key_length * 8;
+       if (!strcmp(mode, "xts"))
+               key_bits /= 2;
+
+       r = snprintf(cipher_name, sizeof(cipher_name), "%s-%d-%s", name, key_bits, mode);
+       if (r < 0 || r >= (int)sizeof(cipher_name))
+               return -EINVAL;
+
+       type = EVP_get_cipherbyname(cipher_name);
+       if (!type)
+               return -ENOENT;
+
+       if (EVP_CIPHER_key_length(type) != (int)key_length)
+               return -EINVAL;
+
+       *hd_enc = EVP_CIPHER_CTX_new();
+       *hd_dec = EVP_CIPHER_CTX_new();
+       *iv_length = EVP_CIPHER_iv_length(type);
+
+       if (!*hd_enc || !*hd_dec)
+               return -EINVAL;
+
+       if (EVP_EncryptInit_ex(*hd_enc, type, NULL, key, NULL) != 1 ||
+           EVP_DecryptInit_ex(*hd_dec, type, NULL, key, NULL) != 1) {
+               _cipher_destroy(hd_enc, hd_dec);
+               return -EINVAL;
+       }
+
+       if (EVP_CIPHER_CTX_set_padding(*hd_enc, 0) != 1 ||
+           EVP_CIPHER_CTX_set_padding(*hd_dec, 0) != 1) {
+               _cipher_destroy(hd_enc, hd_dec);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+int crypt_cipher_init(struct crypt_cipher **ctx, const char *name,
+                   const char *mode, const void *key, size_t key_length)
+{
+       struct crypt_cipher *h;
+       int r;
+
+       h = malloc(sizeof(*h));
+       if (!h)
+               return -ENOMEM;
+
+       if (!_cipher_init(&h->u.lib.hd_enc, &h->u.lib.hd_dec, name, mode, key,
+                         key_length, &h->u.lib.iv_length)) {
+               h->use_kernel = false;
+               *ctx = h;
+               return 0;
+       }
+
+       r = crypt_cipher_init_kernel(&h->u.kernel, name, mode, key, key_length);
+       if (r < 0) {
+               free(h);
+               return r;
+       }
+
+       h->use_kernel = true;
+       *ctx = h;
+       return 0;
+}
+
+void crypt_cipher_destroy(struct crypt_cipher *ctx)
+{
+       if (ctx->use_kernel)
+               crypt_cipher_destroy_kernel(&ctx->u.kernel);
+       else
+               _cipher_destroy(&ctx->u.lib.hd_enc, &ctx->u.lib.hd_dec);
+       free(ctx);
+}
+
+static int _cipher_encrypt(struct crypt_cipher *ctx, const unsigned char *in, unsigned char *out,
+                          int length, const unsigned char *iv, size_t iv_length)
+{
+       int len;
+
+       if (ctx->u.lib.iv_length != iv_length)
+               return -EINVAL;
+
+       if (EVP_EncryptInit_ex(ctx->u.lib.hd_enc, NULL, NULL, NULL, iv) != 1)
                return -EINVAL;
 
-       if (!PKCS5_PBKDF2_HMAC(password, (int)password_length,
-           (unsigned char *)salt, (int)salt_length,
-            (int)iterations, hash_id, (int)key_length, (unsigned char *)key))
+       if (EVP_EncryptUpdate(ctx->u.lib.hd_enc, out, &len, in, length) != 1)
+               return -EINVAL;
+
+       if (EVP_EncryptFinal(ctx->u.lib.hd_enc, out + len, &len) != 1)
+               return -EINVAL;
+
+       return 0;
+}
+
+static int _cipher_decrypt(struct crypt_cipher *ctx, const unsigned char *in, unsigned char *out,
+                          int length, const unsigned char *iv, size_t iv_length)
+{
+       int len;
+
+       if (ctx->u.lib.iv_length != iv_length)
+               return -EINVAL;
+
+       if (EVP_DecryptInit_ex(ctx->u.lib.hd_dec, NULL, NULL, NULL, iv) != 1)
+               return -EINVAL;
+
+       if (EVP_DecryptUpdate(ctx->u.lib.hd_dec, out, &len, in, length) != 1)
+               return -EINVAL;
+
+       if (EVP_DecryptFinal(ctx->u.lib.hd_dec, out + len, &len) != 1)
                return -EINVAL;
 
        return 0;
 }
+
+int crypt_cipher_encrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       if (ctx->use_kernel)
+               return crypt_cipher_encrypt_kernel(&ctx->u.kernel, in, out, length, iv, iv_length);
+
+       return _cipher_encrypt(ctx, (const unsigned char*)in,
+                              (unsigned char *)out, length, (const unsigned char*)iv, iv_length);
+}
+
+int crypt_cipher_decrypt(struct crypt_cipher *ctx,
+                        const char *in, char *out, size_t length,
+                        const char *iv, size_t iv_length)
+{
+       if (ctx->use_kernel)
+               return crypt_cipher_decrypt_kernel(&ctx->u.kernel, in, out, length, iv, iv_length);
+
+       return _cipher_decrypt(ctx, (const unsigned char*)in,
+                              (unsigned char *)out, length, (const unsigned char*)iv, iv_length);
+}
+
+bool crypt_cipher_kernel_only(struct crypt_cipher *ctx)
+{
+       return ctx->use_kernel;
+}
+
+int crypt_bitlk_decrypt_key(const void *key, size_t key_length,
+                           const char *in, char *out, size_t length,
+                           const char *iv, size_t iv_length,
+                           const char *tag, size_t tag_length)
+{
+#ifdef EVP_CTRL_CCM_SET_IVLEN
+       EVP_CIPHER_CTX *ctx;
+       int len = 0, r = -EINVAL;
+
+       ctx = EVP_CIPHER_CTX_new();
+       if (!ctx)
+               return -EINVAL;
+
+       if (EVP_DecryptInit_ex(ctx, EVP_aes_256_ccm(), NULL, NULL, NULL) != 1)
+               goto out;
+
+       //EVP_CIPHER_CTX_key_length(ctx)
+       //EVP_CIPHER_CTX_iv_length(ctx)
+
+       if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN, iv_length, NULL) != 1)
+               goto out;
+       if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, tag_length, CONST_CAST(void*)tag) != 1)
+               goto out;
+
+       if (EVP_DecryptInit_ex(ctx, NULL, NULL, key, (const unsigned char*)iv) != 1)
+               goto out;
+
+       if (EVP_DecryptUpdate(ctx, (unsigned char*)out, &len, (const unsigned char*)in, length) == 1)
+               r = 0;
+out:
+       EVP_CIPHER_CTX_free(ctx);
+       return r;
+#else
+       return -ENOTSUP;
+#endif
+}
index b0452a3..846f17c 100644 (file)
@@ -2,7 +2,7 @@
  * Generic wrapper for storage encryption modes and Initial Vectors
  * (reimplementation of some functions from Linux dm-crypt kernel)
  *
- * Copyright (C) 2014, Milan Broz
+ * Copyright (C) 2014-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include "crypto_backend.h"
 
 #define SECTOR_SHIFT   9
-#define SECTOR_SIZE    (1 << SECTOR_SHIFT)
 
 /*
  * Internal IV helper
  * IV documentation: https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt
  */
 struct crypt_sector_iv {
-       enum { IV_NONE, IV_NULL, IV_PLAIN, IV_PLAIN64, IV_ESSIV, IV_BENBI } type;
+       enum { IV_NONE, IV_NULL, IV_PLAIN, IV_PLAIN64, IV_ESSIV, IV_BENBI, IV_PLAIN64BE, IV_EBOIV } type;
        int iv_size;
        char *iv;
-       struct crypt_cipher *essiv_cipher;
-       int benbi_shift;
+       struct crypt_cipher *cipher;
+       int shift;
 };
 
 /* Block encryption storage context */
 struct crypt_storage {
-       uint64_t sector_start;
+       unsigned sector_shift;
+       unsigned iv_shift;
        struct crypt_cipher *cipher;
        struct crypt_sector_iv cipher_iv;
 };
@@ -56,24 +56,31 @@ static int int_log2(unsigned int x)
 
 static int crypt_sector_iv_init(struct crypt_sector_iv *ctx,
                         const char *cipher_name, const char *mode_name,
-                        const char *iv_name, char *key, size_t key_length)
+                        const char *iv_name, const void *key, size_t key_length, size_t sector_size)
 {
+       int r;
+
        memset(ctx, 0, sizeof(*ctx));
 
-       ctx->iv_size = crypt_cipher_blocksize(cipher_name);
-       if (ctx->iv_size < 0)
+       ctx->iv_size = crypt_cipher_ivsize(cipher_name, mode_name);
+       if (ctx->iv_size < 8)
                return -ENOENT;
 
-       if (!iv_name ||
-           !strcmp(cipher_name, "cipher_null") ||
+       if (!strcmp(cipher_name, "cipher_null") ||
            !strcmp(mode_name, "ecb")) {
+               if (iv_name)
+                       return -EINVAL;
                ctx->type = IV_NONE;
                ctx->iv_size = 0;
                return 0;
+       } else if (!iv_name) {
+               return -EINVAL;
        } else if (!strcasecmp(iv_name, "null")) {
                ctx->type = IV_NULL;
        } else if (!strcasecmp(iv_name, "plain64")) {
                ctx->type = IV_PLAIN64;
+       } else if (!strcasecmp(iv_name, "plain64be")) {
+               ctx->type = IV_PLAIN64BE;
        } else if (!strcasecmp(iv_name, "plain")) {
                ctx->type = IV_PLAIN;
        } else if (!strncasecmp(iv_name, "essiv:", 6)) {
@@ -81,7 +88,6 @@ static int crypt_sector_iv_init(struct crypt_sector_iv *ctx,
                char *hash_name = strchr(iv_name, ':');
                int hash_size;
                char tmp[256];
-               int r;
 
                if (!hash_name)
                        return -EINVAL;
@@ -109,7 +115,7 @@ static int crypt_sector_iv_init(struct crypt_sector_iv *ctx,
                        return r;
                }
 
-               r = crypt_cipher_init(&ctx->essiv_cipher, cipher_name, "ecb",
+               r = crypt_cipher_init(&ctx->cipher, cipher_name, "ecb",
                                      tmp, hash_size);
                crypt_backend_memzero(tmp, sizeof(tmp));
                if (r)
@@ -122,7 +128,15 @@ static int crypt_sector_iv_init(struct crypt_sector_iv *ctx,
                        return -EINVAL;
 
                ctx->type = IV_BENBI;
-               ctx->benbi_shift = SECTOR_SHIFT - log;
+               ctx->shift = SECTOR_SHIFT - log;
+       } else if (!strncasecmp(iv_name, "eboiv", 5)) {
+               r = crypt_cipher_init(&ctx->cipher, cipher_name, "ecb",
+                                     key, key_length);
+               if (r)
+                       return r;
+
+               ctx->type = IV_EBOIV;
+               ctx->shift = int_log2(sector_size);
        } else
                return -ENOENT;
 
@@ -151,17 +165,27 @@ static int crypt_sector_iv_generate(struct crypt_sector_iv *ctx, uint64_t sector
                memset(ctx->iv, 0, ctx->iv_size);
                *(uint64_t *)ctx->iv = cpu_to_le64(sector);
                break;
+       case IV_PLAIN64BE:
+               memset(ctx->iv, 0, ctx->iv_size);
+               *(uint64_t *)&ctx->iv[ctx->iv_size - sizeof(uint64_t)] = cpu_to_be64(sector);
+               break;
        case IV_ESSIV:
                memset(ctx->iv, 0, ctx->iv_size);
                *(uint64_t *)ctx->iv = cpu_to_le64(sector);
-               return crypt_cipher_encrypt(ctx->essiv_cipher,
+               return crypt_cipher_encrypt(ctx->cipher,
                        ctx->iv, ctx->iv, ctx->iv_size, NULL, 0);
                break;
        case IV_BENBI:
                memset(ctx->iv, 0, ctx->iv_size);
-               val = cpu_to_be64((sector << ctx->benbi_shift) + 1);
+               val = cpu_to_be64((sector << ctx->shift) + 1);
                memcpy(ctx->iv + ctx->iv_size - sizeof(val), &val, sizeof(val));
                break;
+       case IV_EBOIV:
+               memset(ctx->iv, 0, ctx->iv_size);
+               *(uint64_t *)ctx->iv = cpu_to_le64(sector << ctx->shift);
+               return crypt_cipher_encrypt(ctx->cipher,
+                       ctx->iv, ctx->iv, ctx->iv_size, NULL, 0);
+               break;
        default:
                return -EINVAL;
        }
@@ -169,10 +193,10 @@ static int crypt_sector_iv_generate(struct crypt_sector_iv *ctx, uint64_t sector
        return 0;
 }
 
-static int crypt_sector_iv_destroy(struct crypt_sector_iv *ctx)
+static void crypt_sector_iv_destroy(struct crypt_sector_iv *ctx)
 {
-       if (ctx->type == IV_ESSIV)
-               crypt_cipher_destroy(ctx->essiv_cipher);
+       if (ctx->type == IV_ESSIV || ctx->type == IV_EBOIV)
+               crypt_cipher_destroy(ctx->cipher);
 
        if (ctx->iv) {
                memset(ctx->iv, 0, ctx->iv_size);
@@ -180,22 +204,26 @@ static int crypt_sector_iv_destroy(struct crypt_sector_iv *ctx)
        }
 
        memset(ctx, 0, sizeof(*ctx));
-       return 0;
 }
 
 /* Block encryption storage wrappers */
 
 int crypt_storage_init(struct crypt_storage **ctx,
-                      uint64_t sector_start,
+                      size_t sector_size,
                       const char *cipher,
                       const char *cipher_mode,
-                      char *key, size_t key_length)
+                      const void *key, size_t key_length)
 {
        struct crypt_storage *s;
        char mode_name[64];
        char *cipher_iv = NULL;
        int r = -EIO;
 
+       if (sector_size < (1 << SECTOR_SHIFT) ||
+           sector_size > (1 << (SECTOR_SHIFT + 3)) ||
+           sector_size & (sector_size - 1))
+               return -EINVAL;
+
        s = malloc(sizeof(*s));
        if (!s)
                return -ENOMEM;
@@ -216,33 +244,39 @@ int crypt_storage_init(struct crypt_storage **ctx,
                return r;
        }
 
-       r = crypt_sector_iv_init(&s->cipher_iv, cipher, mode_name, cipher_iv, key, key_length);
+       r = crypt_sector_iv_init(&s->cipher_iv, cipher, mode_name, cipher_iv, key, key_length, sector_size);
        if (r) {
                crypt_storage_destroy(s);
                return r;
        }
 
-       s->sector_start = sector_start;
+       s->sector_shift = int_log2(sector_size);
+       s->iv_shift = s->sector_shift - SECTOR_SHIFT;
 
        *ctx = s;
        return 0;
 }
 
 int crypt_storage_decrypt(struct crypt_storage *ctx,
-                      uint64_t sector, size_t count,
-                      char *buffer)
+                      uint64_t iv_offset,
+                      uint64_t length, char *buffer)
 {
-       unsigned int i;
+       uint64_t i;
        int r = 0;
 
-       for (i = 0; i < count; i++) {
-               r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
+       if (length & ((1 << ctx->sector_shift) - 1))
+               return -EINVAL;
+
+       length >>= ctx->sector_shift;
+
+       for (i = 0; i < length; i++) {
+               r = crypt_sector_iv_generate(&ctx->cipher_iv, iv_offset + (uint64_t)(i << ctx->iv_shift));
                if (r)
                        break;
                r = crypt_cipher_decrypt(ctx->cipher,
-                                        &buffer[i * SECTOR_SIZE],
-                                        &buffer[i * SECTOR_SIZE],
-                                        SECTOR_SIZE,
+                                        &buffer[i << ctx->sector_shift],
+                                        &buffer[i << ctx->sector_shift],
+                                        1 << ctx->sector_shift,
                                         ctx->cipher_iv.iv,
                                         ctx->cipher_iv.iv_size);
                if (r)
@@ -253,20 +287,25 @@ int crypt_storage_decrypt(struct crypt_storage *ctx,
 }
 
 int crypt_storage_encrypt(struct crypt_storage *ctx,
-                      uint64_t sector, size_t count,
-                      char *buffer)
+                      uint64_t iv_offset,
+                      uint64_t length, char *buffer)
 {
-       unsigned int i;
+       uint64_t i;
        int r = 0;
 
-       for (i = 0; i < count; i++) {
-               r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
+       if (length & ((1 << ctx->sector_shift) - 1))
+               return -EINVAL;
+
+       length >>= ctx->sector_shift;
+
+       for (i = 0; i < length; i++) {
+               r = crypt_sector_iv_generate(&ctx->cipher_iv, iv_offset + (i << ctx->iv_shift));
                if (r)
                        break;
                r = crypt_cipher_encrypt(ctx->cipher,
-                                        &buffer[i * SECTOR_SIZE],
-                                        &buffer[i * SECTOR_SIZE],
-                                        SECTOR_SIZE,
+                                        &buffer[i << ctx->sector_shift],
+                                        &buffer[i << ctx->sector_shift],
+                                        1 << ctx->sector_shift,
                                         ctx->cipher_iv.iv,
                                         ctx->cipher_iv.iv_size);
                if (r)
@@ -276,10 +315,10 @@ int crypt_storage_encrypt(struct crypt_storage *ctx,
        return r;
 }
 
-int crypt_storage_destroy(struct crypt_storage *ctx)
+void crypt_storage_destroy(struct crypt_storage *ctx)
 {
        if (!ctx)
-               return 0;
+               return;
 
        crypt_sector_iv_destroy(&ctx->cipher_iv);
 
@@ -288,6 +327,9 @@ int crypt_storage_destroy(struct crypt_storage *ctx)
 
        memset(ctx, 0, sizeof(*ctx));
        free(ctx);
+}
 
-       return 0;
+bool crypt_storage_kernel_only(struct crypt_storage *ctx)
+{
+       return crypt_cipher_kernel_only(ctx->cipher);
 }
index 2e9a3d2..3f6163c 100644 (file)
@@ -4,8 +4,8 @@
  * Copyright (C) 2004 Free Software Foundation
  *
  * cryptsetup related changes
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2014, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,7 +25,7 @@
 
 #include <errno.h>
 #include <alloca.h>
-#include "crypto_backend.h"
+#include "crypto_backend_internal.h"
 
 static int hash_buf(const char *src, size_t src_len,
                    char *dst, size_t dst_len,
@@ -230,197 +230,3 @@ out:
 
        return rc;
 }
-
-#if 0
-#include <stdio.h>
-
-struct test_vector {
-       const char *hash;
-       unsigned int hash_block_length;
-       unsigned int iterations;
-       const char *password;
-       unsigned int password_length;
-       const char *salt;
-       unsigned int salt_length;
-       const char *output;
-       unsigned int output_length;
-};
-
-struct test_vector test_vectors[] = {
-       /* RFC 3962 */
-       {
-               "sha1", 64, 1,
-               "password", 8,
-               "ATHENA.MIT.EDUraeburn", 21,
-               "\xcd\xed\xb5\x28\x1b\xb2\xf8\x01"
-               "\x56\x5a\x11\x22\xb2\x56\x35\x15"
-               "\x0a\xd1\xf7\xa0\x4b\xb9\xf3\xa3"
-               "\x33\xec\xc0\xe2\xe1\xf7\x08\x37", 32
-       }, {
-               "sha1", 64, 2,
-               "password", 8,
-               "ATHENA.MIT.EDUraeburn", 21,
-               "\x01\xdb\xee\x7f\x4a\x9e\x24\x3e"
-               "\x98\x8b\x62\xc7\x3c\xda\x93\x5d"
-               "\xa0\x53\x78\xb9\x32\x44\xec\x8f"
-               "\x48\xa9\x9e\x61\xad\x79\x9d\x86", 32
-       }, {
-               "sha1", 64, 1200,
-               "password", 8,
-               "ATHENA.MIT.EDUraeburn", 21,
-               "\x5c\x08\xeb\x61\xfd\xf7\x1e\x4e"
-               "\x4e\xc3\xcf\x6b\xa1\xf5\x51\x2b"
-               "\xa7\xe5\x2d\xdb\xc5\xe5\x14\x2f"
-               "\x70\x8a\x31\xe2\xe6\x2b\x1e\x13", 32
-       }, {
-               "sha1", 64, 5,
-               "password", 8,
-               "\0224VxxV4\022", 8, // "\x1234567878563412
-               "\xd1\xda\xa7\x86\x15\xf2\x87\xe6"
-               "\xa1\xc8\xb1\x20\xd7\x06\x2a\x49"
-               "\x3f\x98\xd2\x03\xe6\xbe\x49\xa6"
-               "\xad\xf4\xfa\x57\x4b\x6e\x64\xee", 32
-       }, {
-               "sha1", 64, 1200,
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 64,
-               "pass phrase equals block size", 29,
-               "\x13\x9c\x30\xc0\x96\x6b\xc3\x2b"
-               "\xa5\x5f\xdb\xf2\x12\x53\x0a\xc9"
-               "\xc5\xec\x59\xf1\xa4\x52\xf5\xcc"
-               "\x9a\xd9\x40\xfe\xa0\x59\x8e\xd1", 32
-       }, {
-               "sha1", 64, 1200,
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 65,
-               "pass phrase exceeds block size", 30,
-               "\x9c\xca\xd6\xd4\x68\x77\x0c\xd5"
-               "\x1b\x10\xe6\xa6\x87\x21\xbe\x61"
-               "\x1a\x8b\x4d\x28\x26\x01\xdb\x3b"
-               "\x36\xbe\x92\x46\x91\x5e\xc8\x2a", 32
-       }, {
-               "sha1", 64, 50,
-               "\360\235\204\236", 4, // g-clef ("\xf09d849e)
-               "EXAMPLE.COMpianist", 18,
-               "\x6b\x9c\xf2\x6d\x45\x45\x5a\x43"
-               "\xa5\xb8\xbb\x27\x6a\x40\x3b\x39"
-               "\xe7\xfe\x37\xa0\xc4\x1e\x02\xc2"
-               "\x81\xff\x30\x69\xe1\xe9\x4f\x52", 32
-       }, {
-       /* RFC-6070 */
-               "sha1", 64, 1,
-               "password", 8,
-               "salt", 4,
-               "\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9"
-               "\xb5\x24\xaf\x60\x12\x06\x2f\xe0\x37\xa6", 20
-       }, {
-               "sha1", 64, 2,
-               "password", 8,
-               "salt", 4,
-               "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e"
-               "\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57", 20
-       }, {
-               "sha1", 64, 4096,
-               "password", 8,
-               "salt", 4,
-               "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad"
-               "\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1", 20
-       }, {
-               "sha1", 64, 16777216,
-               "password", 8,
-               "salt", 4,
-               "\xee\xfe\x3d\x61\xcd\x4d\xa4\xe4\xe9\x94"
-               "\x5b\x3d\x6b\xa2\x15\x8c\x26\x34\xe9\x84", 20
-       }, {
-               "sha1", 64, 4096,
-               "passwordPASSWORDpassword", 24,
-               "saltSALTsaltSALTsaltSALTsaltSALTsalt", 36,
-               "\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8"
-               "\xd8\x36\x62\xc0\xe4\x4a\x8b\x29\x1a\x96"
-               "\x4c\xf2\xf0\x70\x38", 25
-       }, {
-               "sha1", 64, 4096,
-               "pass\0word", 9,
-               "sa\0lt", 5,
-               "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37"
-               "\xd7\xf0\x34\x25\xe0\xc3", 16
-       }, {
-       /* empty password test */
-               "sha1", 64, 2,
-               "", 0,
-               "salt", 4,
-               "\x13\x3a\x4c\xe8\x37\xb4\xd2\x52\x1e\xe2"
-               "\xbf\x03\xe1\x1c\x71\xca\x79\x4e\x07\x97", 20
-       }, {
-       /* Password exceeds block size test */
-               "sha256", 64, 1200,
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 65,
-               "pass phrase exceeds block size", 30,
-               "\x22\x34\x4b\xc4\xb6\xe3\x26\x75"
-               "\xa8\x09\x0f\x3e\xa8\x0b\xe0\x1d"
-               "\x5f\x95\x12\x6a\x2c\xdd\xc3\xfa"
-               "\xcc\x4a\x5e\x6d\xca\x04\xec\x58", 32
-       }, {
-               "sha512", 128, 1200,
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 129,
-               "pass phrase exceeds block size", 30,
-               "\x0f\xb2\xed\x2c\x0e\x6e\xfb\x7d"
-               "\x7d\x8e\xdd\x58\x01\xb4\x59\x72"
-               "\x99\x92\x16\x30\x5e\xa4\x36\x8d"
-               "\x76\x14\x80\xf3\xe3\x7a\x22\xb9", 32
-       }, {
-               "whirlpool", 64, 1200,
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 65,
-               "pass phrase exceeds block size", 30,
-               "\x9c\x1c\x74\xf5\x88\x26\xe7\x6a"
-               "\x53\x58\xf4\x0c\x39\xe7\x80\x89"
-               "\x07\xc0\x31\x19\x9a\x50\xa2\x48"
-               "\xf1\xd9\xfe\x78\x64\xe5\x84\x50", 32
-       }
-};
-
-static void printhex(const char *s, const char *buf, size_t len)
-{
-       size_t i;
-
-       printf("%s: ", s);
-       for (i = 0; i < len; i++)
-               printf("\\x%02x", (unsigned char)buf[i]);
-       printf("\n");
-       fflush(stdout);
-}
-
-static int pkcs5_pbkdf2_test_vectors(void)
-{
-       char result[64];
-       unsigned int i, j;
-       struct test_vector *vec;
-
-       for (i = 0; i < (sizeof(test_vectors) / sizeof(*test_vectors)); i++) {
-               vec = &test_vectors[i];
-               for (j = 1; j <= vec->output_length; j++) {
-                       if (pkcs5_pbkdf2(vec->hash,
-                           vec->password, vec->password_length,
-                           vec->salt, vec->salt_length,
-                           vec->iterations,
-                           j, result, vec->hash_block_length)) {
-                               printf("pbkdf2 failed, vector %d\n", i);
-                               return -EINVAL;
-                       }
-                       if (memcmp(result, vec->output, j) != 0) {
-                               printf("vector %u\n", i);
-                               printhex(" got", result, j);
-                               printhex("want", vec->output, j);
-                               return -EINVAL;
-                       }
-                       memset(result, 0, sizeof(result));
-               }
-       }
-       return 0;
-}
-#endif
index c6236cc..7444e0a 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * PBKDF performance check
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2014, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
+ * Copyright (C) 2016-2020 Ondrej Mosnacek
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <stdlib.h>
 #include <errno.h>
+#include <limits.h>
+#include <time.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include "crypto_backend.h"
 
+#ifndef CLOCK_MONOTONIC_RAW
+#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
+#endif
+
+#define BENCH_MIN_MS 250
+#define BENCH_MIN_MS_FAST 10
+#define BENCH_PERCENT_ATLEAST 95
+#define BENCH_PERCENT_ATMOST 110
+#define BENCH_SAMPLES_FAST 3
+#define BENCH_SAMPLES_SLOW 1
+
+/* These PBKDF2 limits must be never violated */
+int crypt_pbkdf_get_limits(const char *kdf, struct crypt_pbkdf_limits *limits)
+{
+       if (!kdf || !limits)
+               return -EINVAL;
+
+       if (!strcmp(kdf, "pbkdf2")) {
+               limits->min_iterations = 1000; /* recommendation in NIST SP 800-132 */
+               limits->max_iterations = UINT32_MAX;
+               limits->min_memory     = 0; /* N/A */
+               limits->max_memory     = 0; /* N/A */
+               limits->min_parallel   = 0; /* N/A */
+               limits->max_parallel   = 0; /* N/A */
+               return 0;
+       } else if (!strcmp(kdf, "argon2i") || !strcmp(kdf, "argon2id")) {
+               limits->min_iterations = 4;
+               limits->max_iterations = UINT32_MAX;
+               limits->min_memory     = 32;
+               limits->max_memory     = 4*1024*1024; /* 4GiB */
+               limits->min_parallel   = 1;
+               limits->max_parallel   = 4;
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
 static long time_ms(struct rusage *start, struct rusage *end)
 {
        int count_kernel_time = 0;
@@ -50,35 +92,285 @@ static long time_ms(struct rusage *start, struct rusage *end)
        return ms;
 }
 
+static long timespec_ms(struct timespec *start, struct timespec *end)
+{
+       return (end->tv_sec - start->tv_sec) * 1000 +
+               (end->tv_nsec - start->tv_nsec) / (1000 * 1000);
+}
+
+static int measure_argon2(const char *kdf, const char *password, size_t password_length,
+                         const char *salt, size_t salt_length,
+                         char *key, size_t key_length,
+                         uint32_t t_cost, uint32_t m_cost, uint32_t parallel,
+                         size_t samples, long ms_atleast, long *out_ms)
+{
+       long ms, ms_min = LONG_MAX;
+       int r;
+       size_t i;
+
+       for (i = 0; i < samples; i++) {
+               struct timespec tstart, tend;
+
+               /*
+                * NOTE: We must use clock_gettime here, because Argon2 can run over
+                * multiple threads, and thus we care about real time, not CPU time!
+                */
+               if (clock_gettime(CLOCK_MONOTONIC_RAW, &tstart) < 0)
+                       return -EINVAL;
+
+               r = crypt_pbkdf(kdf, NULL, password, password_length, salt,
+                               salt_length, key, key_length, t_cost, m_cost, parallel);
+               if (r < 0)
+                       return r;
+
+               if (clock_gettime(CLOCK_MONOTONIC_RAW, &tend) < 0)
+                       return -EINVAL;
+
+               ms = timespec_ms(&tstart, &tend);
+               if (ms < 0)
+                       return -EINVAL;
+
+               if (ms < ms_atleast) {
+                       /* early exit */
+                       ms_min = ms;
+                       break;
+               }
+               if (ms < ms_min) {
+                       ms_min = ms;
+               }
+       }
+       *out_ms = ms_min;
+       return 0;
+}
+
+#define CONTINUE 0
+#define FINAL   1
+static int next_argon2_params(uint32_t *t_cost, uint32_t *m_cost,
+                             uint32_t min_t_cost, uint32_t min_m_cost,
+                             uint32_t max_m_cost, long ms, uint32_t target_ms)
+{
+       uint32_t old_t_cost, old_m_cost, new_t_cost, new_m_cost;
+       uint64_t num, denom;
+
+       old_t_cost = *t_cost;
+       old_m_cost = *m_cost;
+
+       if ((uint32_t)ms > target_ms) {
+               /* decreasing, first try to lower t_cost, then m_cost */
+               num = (uint64_t)*t_cost * (uint64_t)target_ms;
+               denom = (uint64_t)ms;
+               new_t_cost = (uint32_t)(num / denom);
+               if (new_t_cost < min_t_cost) {
+                       num = (uint64_t)*t_cost * (uint64_t)*m_cost *
+                             (uint64_t)target_ms;
+                       denom = (uint64_t)min_t_cost * (uint64_t)ms;
+                       *t_cost = min_t_cost;
+                       *m_cost = (uint32_t)(num / denom);
+                       if (*m_cost < min_m_cost) {
+                               *m_cost = min_m_cost;
+                               return FINAL;
+                       }
+               } else {
+                       *t_cost = new_t_cost;
+               }
+       } else {
+               /* increasing, first try to increase m_cost, then t_cost */
+               num = (uint64_t)*m_cost * (uint64_t)target_ms;
+               denom = (uint64_t)ms;
+               new_m_cost = (uint32_t)(num / denom);
+               if (new_m_cost > max_m_cost) {
+                       num = (uint64_t)*t_cost * (uint64_t)*m_cost *
+                             (uint64_t)target_ms;
+                       denom = (uint64_t)max_m_cost * (uint64_t)ms;
+                       *t_cost = (uint32_t)(num / denom);
+                       *m_cost = max_m_cost;
+                       if (*t_cost <= min_t_cost) {
+                               *t_cost = min_t_cost;
+                               return FINAL;
+                       }
+               } else if (new_m_cost < min_m_cost) {
+                       *m_cost = min_m_cost;
+                       return FINAL;
+               } else {
+                       *m_cost = new_m_cost;
+               }
+       }
+
+       /* do not continue if it is the same as in the previous run */
+       if (old_t_cost == *t_cost && old_m_cost == *m_cost)
+               return FINAL;
+
+       return CONTINUE;
+}
+
+static int crypt_argon2_check(const char *kdf, const char *password,
+                             size_t password_length, const char *salt,
+                             size_t salt_length, size_t key_length,
+                             uint32_t min_t_cost, uint32_t min_m_cost, uint32_t max_m_cost,
+                             uint32_t parallel, uint32_t target_ms,
+                             uint32_t *out_t_cost, uint32_t *out_m_cost,
+                             int (*progress)(uint32_t time_ms, void *usrptr),
+                             void *usrptr)
+{
+       int r = 0;
+       char *key = NULL;
+       uint32_t t_cost, m_cost;
+       long ms;
+       long ms_atleast = (long)target_ms * BENCH_PERCENT_ATLEAST / 100;
+       long ms_atmost = (long)target_ms * BENCH_PERCENT_ATMOST / 100;
+
+       if (key_length <= 0 || target_ms <= 0)
+               return -EINVAL;
+
+       if (min_m_cost < (parallel * 8))
+               min_m_cost = parallel * 8;
+
+       if (max_m_cost < min_m_cost)
+               return -EINVAL;
+
+       key = malloc(key_length);
+       if (!key)
+               return -ENOMEM;
+
+       t_cost = min_t_cost;
+       m_cost = min_m_cost;
+
+       /* 1. Find some small parameters, s. t. ms >= BENCH_MIN_MS: */
+       while (1) {
+               r = measure_argon2(kdf, password, password_length, salt, salt_length,
+                                  key, key_length, t_cost, m_cost, parallel,
+                                  BENCH_SAMPLES_FAST, BENCH_MIN_MS, &ms);
+               if (!r) {
+                       /* Update parameters to actual measurement */
+                       *out_t_cost = t_cost;
+                       *out_m_cost = m_cost;
+                       if (progress && progress((uint32_t)ms, usrptr))
+                               r = -EINTR;
+               }
+
+               if (r < 0)
+                       goto out;
+
+               if (ms >= BENCH_MIN_MS)
+                       break;
+
+               if (m_cost == max_m_cost) {
+                       if (ms < BENCH_MIN_MS_FAST)
+                               t_cost *= 16;
+                       else {
+                               uint32_t new = (t_cost * BENCH_MIN_MS) / (uint32_t)ms;
+                               if (new == t_cost)
+                                       break;
+
+                               t_cost = new;
+                       }
+               } else {
+                       if (ms < BENCH_MIN_MS_FAST)
+                               m_cost *= 16;
+                       else {
+                               uint32_t new = (m_cost * BENCH_MIN_MS) / (uint32_t)ms;
+                               if (new == m_cost)
+                                       break;
+
+                               m_cost = new;
+                       }
+                       if (m_cost > max_m_cost) {
+                               m_cost = max_m_cost;
+                       }
+               }
+       }
+       /*
+        * 2. Use the params obtained in (1.) to estimate the target params.
+        * 3. Then repeatedly measure the candidate params and if they fall out of
+        * the acceptance range (+-5 %), try to improve the estimate:
+        */
+       do {
+               if (next_argon2_params(&t_cost, &m_cost, min_t_cost, min_m_cost,
+                                      max_m_cost, ms, target_ms)) {
+                       /* Update parameters to final computation */
+                       *out_t_cost = t_cost;
+                       *out_m_cost = m_cost;
+                       break;
+               }
+
+               r = measure_argon2(kdf, password, password_length, salt, salt_length,
+                                  key, key_length, t_cost, m_cost, parallel,
+                                  BENCH_SAMPLES_SLOW, ms_atleast, &ms);
+
+               if (!r) {
+                       /* Update parameters to actual measurement */
+                       *out_t_cost = t_cost;
+                       *out_m_cost = m_cost;
+                       if (progress && progress((uint32_t)ms, usrptr))
+                               r = -EINTR;
+               }
+
+               if (r < 0)
+                       break;
+
+       } while (ms < ms_atleast || ms > ms_atmost);
+out:
+       if (key) {
+               crypt_backend_memzero(key, key_length);
+               free(key);
+       }
+       return r;
+}
+
 /* This code benchmarks PBKDF and returns iterations/second using specified hash */
-int crypt_pbkdf_check(const char *kdf, const char *hash,
-                     const char *password, size_t password_size,
-                     const char *salt, size_t salt_size,
-                     uint64_t *iter_secs)
+static int crypt_pbkdf_check(const char *kdf, const char *hash,
+                     const char *password, size_t password_length,
+                     const char *salt, size_t salt_length,
+                     size_t key_length, uint32_t *iter_secs, uint32_t target_ms,
+                     int (*progress)(uint32_t time_ms, void *usrptr), void *usrptr)
+
 {
        struct rusage rstart, rend;
        int r = 0, step = 0;
        long ms = 0;
-       char buf;
-       unsigned int iterations;
+       char *key = NULL;
+       uint32_t iterations;
+       double PBKDF2_temp;
 
-       if (!kdf || !hash)
+       if (!kdf || !hash || key_length <= 0)
                return -EINVAL;
 
+       key = malloc(key_length);
+       if (!key)
+               return -ENOMEM;
+
+       *iter_secs = 0;
        iterations = 1 << 15;
-       while (ms < 500) {
-               if (getrusage(RUSAGE_SELF, &rstart) < 0)
-                       return -EINVAL;
+       while (1) {
+               if (getrusage(RUSAGE_SELF, &rstart) < 0) {
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               r = crypt_pbkdf(kdf, hash, password, password_length, salt,
+                               salt_length, key, key_length, iterations, 0, 0);
 
-               r = crypt_pbkdf(kdf, hash, password, password_size, salt,
-                               salt_size, &buf, 1, iterations);
                if (r < 0)
-                       return r;
+                       goto out;
 
-               if (getrusage(RUSAGE_SELF, &rend) < 0)
-                       return -EINVAL;
+               if (getrusage(RUSAGE_SELF, &rend) < 0) {
+                       r = -EINVAL;
+                       goto out;
+               }
 
                ms = time_ms(&rstart, &rend);
+               if (ms) {
+                       PBKDF2_temp = (double)iterations * target_ms / ms;
+                       if (PBKDF2_temp > UINT32_MAX)
+                               return -EINVAL;
+                       *iter_secs = (uint32_t)PBKDF2_temp;
+               }
+
+               if (progress && progress((uint32_t)ms, usrptr)) {
+                       r = -EINTR;
+                       goto out;
+               }
+
                if (ms > 500)
                        break;
 
@@ -91,11 +383,53 @@ int crypt_pbkdf_check(const char *kdf, const char *hash,
                else
                        iterations <<= 1;
 
-               if (++step > 10 || !iterations)
-                       return -EINVAL;
+               if (++step > 10 || !iterations) {
+                       r = -EINVAL;
+                       goto out;
+               }
        }
+out:
+       if (key) {
+               crypt_backend_memzero(key, key_length);
+               free(key);
+       }
+       return r;
+}
+
+int crypt_pbkdf_perf(const char *kdf, const char *hash,
+               const char *password, size_t password_size,
+               const char *salt, size_t salt_size,
+               size_t volume_key_size, uint32_t time_ms,
+               uint32_t max_memory_kb, uint32_t parallel_threads,
+               uint32_t *iterations_out, uint32_t *memory_out,
+               int (*progress)(uint32_t time_ms, void *usrptr), void *usrptr)
+{
+       struct crypt_pbkdf_limits pbkdf_limits;
+       int r = -EINVAL;
+
+       if (!kdf || !iterations_out || !memory_out)
+               return -EINVAL;
+
+       /* FIXME: whole limits propagation should be more clear here */
+       r = crypt_pbkdf_get_limits(kdf, &pbkdf_limits);
+       if (r < 0)
+               return r;
+
+       *memory_out = 0;
+       *iterations_out = 0;
+
+       if (!strcmp(kdf, "pbkdf2"))
+               r = crypt_pbkdf_check(kdf, hash, password, password_size,
+                                     salt, salt_size, volume_key_size,
+                                     iterations_out, time_ms, progress, usrptr);
 
-       if (iter_secs)
-               *iter_secs = (iterations * 1000) / ms;
+       else if (!strncmp(kdf, "argon2", 6))
+               r = crypt_argon2_check(kdf, password, password_size,
+                                      salt, salt_size, volume_key_size,
+                                      pbkdf_limits.min_iterations,
+                                      pbkdf_limits.min_memory,
+                                      max_memory_kb,
+                                      parallel_threads, time_ms, iterations_out,
+                                      memory_out, progress, usrptr);
        return r;
 }
diff --git a/lib/integrity/integrity.c b/lib/integrity/integrity.c
new file mode 100644 (file)
index 0000000..86305ce
--- /dev/null
@@ -0,0 +1,366 @@
+/*
+ * Integrity volume handling
+ *
+ * Copyright (C) 2016-2020 Milan Broz
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <uuid/uuid.h>
+
+#include "integrity.h"
+#include "internal.h"
+
+static int INTEGRITY_read_superblock(struct crypt_device *cd,
+                                    struct device *device,
+                                    uint64_t offset, struct superblock *sb)
+{
+       int devfd, r;
+
+       devfd = device_open(cd, device, O_RDONLY);
+       if(devfd < 0)
+               return -EINVAL;
+
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+               device_alignment(device), sb, sizeof(*sb), offset) != sizeof(*sb) ||
+           memcmp(sb->magic, SB_MAGIC, sizeof(sb->magic)) ||
+           sb->version < SB_VERSION_1 || sb->version > SB_VERSION_4) {
+               log_std(cd, "No integrity superblock detected on %s.\n",
+                       device_path(device));
+               r = -EINVAL;
+       } else {
+               sb->integrity_tag_size = le16toh(sb->integrity_tag_size);
+               sb->journal_sections = le32toh(sb->journal_sections);
+               sb->provided_data_sectors = le64toh(sb->provided_data_sectors);
+               sb->recalc_sector = le64toh(sb->recalc_sector);
+               sb->flags = le32toh(sb->flags);
+               r = 0;
+       }
+
+       return r;
+}
+
+int INTEGRITY_read_sb(struct crypt_device *cd,
+                     struct crypt_params_integrity *params,
+                     uint32_t *flags)
+{
+       struct superblock sb;
+       int r;
+
+       r = INTEGRITY_read_superblock(cd, crypt_metadata_device(cd), 0, &sb);
+       if (r)
+               return r;
+
+       params->sector_size = SECTOR_SIZE << sb.log2_sectors_per_block;
+       params->tag_size = sb.integrity_tag_size;
+
+       if (flags)
+               *flags = sb.flags;
+
+       return 0;
+}
+
+int INTEGRITY_dump(struct crypt_device *cd, struct device *device, uint64_t offset)
+{
+       struct superblock sb;
+       int r;
+
+       r = INTEGRITY_read_superblock(cd, device, offset, &sb);
+       if (r)
+               return r;
+
+       log_std(cd, "Info for integrity device %s.\n", device_path(device));
+       log_std(cd, "superblock_version %d\n", (unsigned)sb.version);
+       log_std(cd, "log2_interleave_sectors %d\n", sb.log2_interleave_sectors);
+       log_std(cd, "integrity_tag_size %u\n", sb.integrity_tag_size);
+       log_std(cd, "journal_sections %u\n", sb.journal_sections);
+       log_std(cd, "provided_data_sectors %" PRIu64 "\n", sb.provided_data_sectors);
+       log_std(cd, "sector_size %u\n", SECTOR_SIZE << sb.log2_sectors_per_block);
+       if (sb.version == SB_VERSION_2 && (sb.flags & SB_FLAG_RECALCULATING))
+               log_std(cd, "recalc_sector %" PRIu64 "\n", sb.recalc_sector);
+       log_std(cd, "log2_blocks_per_bitmap %u\n", sb.log2_blocks_per_bitmap_bit);
+       log_std(cd, "flags %s%s%s%s\n",
+               sb.flags & SB_FLAG_HAVE_JOURNAL_MAC ? "have_journal_mac " : "",
+               sb.flags & SB_FLAG_RECALCULATING ? "recalculating " : "",
+               sb.flags & SB_FLAG_DIRTY_BITMAP ? "dirty_bitmap " : "",
+               sb.flags & SB_FLAG_FIXED_PADDING ? "fix_padding " : "");
+
+       return 0;
+}
+
+int INTEGRITY_data_sectors(struct crypt_device *cd,
+                          struct device *device, uint64_t offset,
+                          uint64_t *data_sectors)
+{
+       struct superblock sb;
+       int r;
+
+       r = INTEGRITY_read_superblock(cd, device, offset, &sb);
+       if (r)
+               return r;
+
+       *data_sectors = sb.provided_data_sectors;
+       return 0;
+}
+
+int INTEGRITY_key_size(struct crypt_device *cd, const char *integrity)
+{
+       if (!integrity)
+               return 0;
+
+       //FIXME: use crypto backend hash size
+       if (!strcmp(integrity, "aead"))
+               return 0;
+       else if (!strcmp(integrity, "hmac(sha1)"))
+               return 20;
+       else if (!strcmp(integrity, "hmac(sha256)"))
+               return 32;
+       else if (!strcmp(integrity, "hmac(sha512)"))
+               return 64;
+       else if (!strcmp(integrity, "poly1305"))
+               return 0;
+       else if (!strcmp(integrity, "none"))
+               return 0;
+
+       return -EINVAL;
+}
+
+/* Return hash or hmac(hash) size, if known */
+int INTEGRITY_hash_tag_size(const char *integrity)
+{
+       char hash[MAX_CIPHER_LEN];
+       int r;
+
+       if (!integrity)
+               return 0;
+
+       if (!strcmp(integrity, "crc32") || !strcmp(integrity, "crc32c"))
+               return 4;
+
+       r = sscanf(integrity, "hmac(%" MAX_CIPHER_LEN_STR "[^)]s", hash);
+       if (r == 1)
+               r = crypt_hash_size(hash);
+       else
+               r = crypt_hash_size(integrity);
+
+       return r < 0 ? 0 : r;
+}
+
+int INTEGRITY_tag_size(struct crypt_device *cd,
+                      const char *integrity,
+                      const char *cipher,
+                      const char *cipher_mode)
+{
+       int iv_tag_size = 0, auth_tag_size = 0;
+
+       if (!cipher_mode)
+               iv_tag_size = 0;
+       else if (!strcmp(cipher_mode, "xts-random"))
+               iv_tag_size = 16;
+       else if (!strcmp(cipher_mode, "gcm-random"))
+               iv_tag_size = 12;
+       else if (!strcmp(cipher_mode, "ccm-random"))
+               iv_tag_size = 8;
+       else if (!strcmp(cipher_mode, "ctr-random"))
+               iv_tag_size = 16;
+       else if (!strcmp(cipher, "aegis256") && !strcmp(cipher_mode, "random"))
+               iv_tag_size = 32;
+       else if (!strcmp(cipher_mode, "random"))
+               iv_tag_size = 16;
+
+       //FIXME: use crypto backend hash size
+       if (!integrity || !strcmp(integrity, "none"))
+               auth_tag_size = 0;
+       else if (!strcmp(integrity, "aead"))
+               auth_tag_size = 16; //FIXME gcm- mode only
+       else if (!strcmp(integrity, "cmac(aes)"))
+               auth_tag_size = 16;
+       else if (!strcmp(integrity, "hmac(sha1)"))
+               auth_tag_size = 20;
+       else if (!strcmp(integrity, "hmac(sha256)"))
+               auth_tag_size = 32;
+       else if (!strcmp(integrity, "hmac(sha512)"))
+               auth_tag_size = 64;
+       else if (!strcmp(integrity, "poly1305")) {
+               if (iv_tag_size)
+                       iv_tag_size = 12;
+               auth_tag_size = 16;
+       }
+
+       return iv_tag_size + auth_tag_size;
+}
+
+int INTEGRITY_create_dmd_device(struct crypt_device *cd,
+                      const struct crypt_params_integrity *params,
+                      struct volume_key *vk,
+                      struct volume_key *journal_crypt_key,
+                      struct volume_key *journal_mac_key,
+                      struct crypt_dm_active_device *dmd,
+                      uint32_t flags, uint32_t sb_flags)
+{
+       int r;
+
+       if (!dmd)
+               return -EINVAL;
+
+       *dmd = (struct crypt_dm_active_device) {
+               .flags = flags,
+       };
+
+       /* Workaround for kernel dm-integrity table bug */
+       if (sb_flags & SB_FLAG_RECALCULATING)
+               dmd->flags |= CRYPT_ACTIVATE_RECALCULATE;
+
+       r = INTEGRITY_data_sectors(cd, crypt_metadata_device(cd),
+                                  crypt_get_data_offset(cd) * SECTOR_SIZE, &dmd->size);
+       if (r < 0)
+               return r;
+
+       return dm_integrity_target_set(cd, &dmd->segment, 0, dmd->size,
+                       crypt_metadata_device(cd), crypt_data_device(cd),
+                       crypt_get_integrity_tag_size(cd), crypt_get_data_offset(cd),
+                       crypt_get_sector_size(cd), vk, journal_crypt_key,
+                       journal_mac_key, params);
+}
+
+int INTEGRITY_activate_dmd_device(struct crypt_device *cd,
+                      const char *name,
+                      const char *type,
+                      struct crypt_dm_active_device *dmd,
+                      uint32_t sb_flags)
+{
+       int r;
+       uint32_t dmi_flags;
+       struct dm_target *tgt = &dmd->segment;
+
+       if (!single_segment(dmd) || tgt->type != DM_INTEGRITY)
+               return -EINVAL;
+
+       log_dbg(cd, "Trying to activate INTEGRITY device on top of %s, using name %s, tag size %d, provided sectors %" PRIu64".",
+               device_path(tgt->data_device), name, tgt->u.integrity.tag_size, dmd->size);
+
+       r = device_block_adjust(cd, tgt->data_device, DEV_EXCL,
+                               tgt->u.integrity.offset, NULL, &dmd->flags);
+       if (r)
+               return r;
+
+       if (tgt->u.integrity.meta_device) {
+               r = device_block_adjust(cd, tgt->u.integrity.meta_device, DEV_EXCL, 0, NULL, NULL);
+               if (r)
+                       return r;
+       }
+
+       r = dm_create_device(cd, name, type, dmd);
+       if (r < 0 && (dm_flags(cd, DM_INTEGRITY, &dmi_flags) || !(dmi_flags & DM_INTEGRITY_SUPPORTED))) {
+               log_err(cd, _("Kernel does not support dm-integrity mapping."));
+               return -ENOTSUP;
+       }
+
+       if (r < 0 && (sb_flags & SB_FLAG_FIXED_PADDING) && !dm_flags(cd, DM_INTEGRITY, &dmi_flags) &&
+           !(dmi_flags & DM_INTEGRITY_FIX_PADDING_SUPPORTED)) {
+               log_err(cd, _("Kernel does not support dm-integrity fixed metadata alignment."));
+               return -ENOTSUP;
+       }
+
+       return r;
+}
+
+int INTEGRITY_activate(struct crypt_device *cd,
+                      const char *name,
+                      const struct crypt_params_integrity *params,
+                      struct volume_key *vk,
+                      struct volume_key *journal_crypt_key,
+                      struct volume_key *journal_mac_key,
+                      uint32_t flags, uint32_t sb_flags)
+{
+       struct crypt_dm_active_device dmd = {};
+       int r = INTEGRITY_create_dmd_device(cd, params, vk, journal_crypt_key,
+                                           journal_mac_key, &dmd, flags, sb_flags);
+
+       if (r < 0)
+               return r;
+
+       r = INTEGRITY_activate_dmd_device(cd, name, CRYPT_INTEGRITY, &dmd, sb_flags);
+       dm_targets_free(cd, &dmd);
+       return r;
+}
+
+int INTEGRITY_format(struct crypt_device *cd,
+                    const struct crypt_params_integrity *params,
+                    struct volume_key *journal_crypt_key,
+                    struct volume_key *journal_mac_key)
+{
+       uint32_t dmi_flags;
+       char tmp_name[64], tmp_uuid[40];
+       struct crypt_dm_active_device dmdi = {
+               .size = 8,
+               .flags = CRYPT_ACTIVATE_PRIVATE, /* We always create journal but it can be unused later */
+       };
+       struct dm_target *tgt = &dmdi.segment;
+       int r;
+       uuid_t tmp_uuid_bin;
+       struct volume_key *vk = NULL;
+
+       uuid_generate(tmp_uuid_bin);
+       uuid_unparse(tmp_uuid_bin, tmp_uuid);
+
+       snprintf(tmp_name, sizeof(tmp_name), "temporary-cryptsetup-%s", tmp_uuid);
+
+       /* There is no data area, we can actually use fake zeroed key */
+       if (params && params->integrity_key_size)
+               vk = crypt_alloc_volume_key(params->integrity_key_size, NULL);
+
+       r = dm_integrity_target_set(cd, tgt, 0, dmdi.size, crypt_metadata_device(cd),
+                       crypt_data_device(cd), crypt_get_integrity_tag_size(cd),
+                       crypt_get_data_offset(cd), crypt_get_sector_size(cd), vk,
+                       journal_crypt_key, journal_mac_key, params);
+       if (r < 0) {
+               crypt_free_volume_key(vk);
+               return r;
+       }
+
+       log_dbg(cd, "Trying to format INTEGRITY device on top of %s, tmp name %s, tag size %d.",
+               device_path(tgt->data_device), tmp_name, tgt->u.integrity.tag_size);
+
+       r = device_block_adjust(cd, tgt->data_device, DEV_EXCL, tgt->u.integrity.offset, NULL, NULL);
+       if (r < 0 && (dm_flags(cd, DM_INTEGRITY, &dmi_flags) || !(dmi_flags & DM_INTEGRITY_SUPPORTED))) {
+               log_err(cd, _("Kernel does not support dm-integrity mapping."));
+               r = -ENOTSUP;
+       }
+       if (r) {
+               dm_targets_free(cd, &dmdi);
+               return r;
+       }
+
+       if (tgt->u.integrity.meta_device) {
+               r = device_block_adjust(cd, tgt->u.integrity.meta_device, DEV_EXCL, 0, NULL, NULL);
+               if (r) {
+                       dm_targets_free(cd, &dmdi);
+                       return r;
+               }
+       }
+
+       r = dm_create_device(cd, tmp_name, CRYPT_INTEGRITY, &dmdi);
+       crypt_free_volume_key(vk);
+       dm_targets_free(cd, &dmdi);
+       if (r)
+               return r;
+
+       return dm_remove_device(cd, tmp_name, CRYPT_DEACTIVATE_FORCE);
+}
diff --git a/lib/integrity/integrity.h b/lib/integrity/integrity.h
new file mode 100644 (file)
index 0000000..38c4c5e
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Integrity header definition
+ *
+ * Copyright (C) 2016-2020 Milan Broz
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _CRYPTSETUP_INTEGRITY_H
+#define _CRYPTSETUP_INTEGRITY_H
+
+#include <stdint.h>
+
+struct crypt_device;
+struct device;
+struct crypt_params_integrity;
+struct volume_key;
+struct crypt_dm_active_device;
+
+/* dm-integrity helper */
+#define SB_MAGIC       "integrt"
+#define SB_VERSION_1   1
+#define SB_VERSION_2   2
+#define SB_VERSION_3   3
+#define SB_VERSION_4   4
+
+#define SB_FLAG_HAVE_JOURNAL_MAC       (1 << 0)
+#define SB_FLAG_RECALCULATING          (1 << 1) /* V2 only */
+#define SB_FLAG_DIRTY_BITMAP           (1 << 2) /* V3 only */
+#define SB_FLAG_FIXED_PADDING          (1 << 3) /* V4 only */
+
+struct superblock {
+       uint8_t magic[8];
+       uint8_t version;
+       int8_t log2_interleave_sectors;
+       uint16_t integrity_tag_size;
+       uint32_t journal_sections;
+       uint64_t provided_data_sectors;
+       uint32_t flags;
+       uint8_t log2_sectors_per_block;
+       uint8_t log2_blocks_per_bitmap_bit; /* V3 only */
+       uint8_t pad[2];
+       uint64_t recalc_sector; /* V2 only */
+} __attribute__ ((packed));
+
+int INTEGRITY_read_sb(struct crypt_device *cd,
+                     struct crypt_params_integrity *params,
+                     uint32_t *flags);
+
+int INTEGRITY_dump(struct crypt_device *cd, struct device *device, uint64_t offset);
+
+int INTEGRITY_data_sectors(struct crypt_device *cd,
+                          struct device *device, uint64_t offset,
+                          uint64_t *data_sectors);
+int INTEGRITY_key_size(struct crypt_device *cd,
+                      const char *integrity);
+int INTEGRITY_tag_size(struct crypt_device *cd,
+                      const char *integrity,
+                      const char *cipher,
+                      const char *cipher_mode);
+int INTEGRITY_hash_tag_size(const char *integrity);
+
+int INTEGRITY_format(struct crypt_device *cd,
+                    const struct crypt_params_integrity *params,
+                    struct volume_key *journal_crypt_key,
+                    struct volume_key *journal_mac_key);
+
+int INTEGRITY_activate(struct crypt_device *cd,
+                      const char *name,
+                      const struct crypt_params_integrity *params,
+                      struct volume_key *vk,
+                      struct volume_key *journal_crypt_key,
+                      struct volume_key *journal_mac_key,
+                      uint32_t flags, uint32_t sb_flags);
+
+int INTEGRITY_create_dmd_device(struct crypt_device *cd,
+                      const struct crypt_params_integrity *params,
+                      struct volume_key *vk,
+                      struct volume_key *journal_crypt_key,
+                      struct volume_key *journal_mac_key,
+                      struct crypt_dm_active_device *dmd,
+                      uint32_t flags, uint32_t sb_flags);
+
+int INTEGRITY_activate_dmd_device(struct crypt_device *cd,
+                      const char *name,
+                      const char *type,
+                      struct crypt_dm_active_device *dmd,
+                      uint32_t sb_flags);
+#endif
index fb265ee..a418a46 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * libcryptsetup - cryptsetup library internal
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2012, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 
 #include <stdint.h>
 #include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <inttypes.h>
+#include <fcntl.h>
 
 #include "nls.h"
 #include "bitops.h"
+#include "utils_blkid.h"
 #include "utils_crypt.h"
 #include "utils_loop.h"
 #include "utils_dm.h"
 #include "utils_fips.h"
+#include "utils_keyring.h"
+#include "utils_io.h"
 #include "crypto_backend.h"
+#include "utils_storage_wrappers.h"
 
 #include "libcryptsetup.h"
 
 /* to silent gcc -Wcast-qual for const cast */
 #define CONST_CAST(x) (x)(uintptr_t)
 
+#define SHIFT_4K               12
 #define SECTOR_SHIFT           9
 #define SECTOR_SIZE            (1 << SECTOR_SHIFT)
+#define MAX_SECTOR_SIZE                4096 /* min page size among all platforms */
 #define DEFAULT_DISK_ALIGNMENT 1048576 /* 1MiB */
 #define DEFAULT_MEM_ALIGNMENT  4096
-#define MAX_ERROR_LENGTH       512
+#define LOG_MAX_LEN            4096
+#define MAX_DM_DEPS            32
+
+#define CRYPT_SUBDEV           "SUBDEV" /* prefix for sublayered devices underneath public crypt types */
 
 #define at_least(a, b) ({ __typeof__(a) __at_least = (a); (__at_least >= (b))?__at_least:(b); })
 
+#define MISALIGNED(a, b)       ((a) & ((b) - 1))
+#define MISALIGNED_4K(a)       MISALIGNED((a), 1 << SHIFT_4K)
+#define MISALIGNED_512(a)      MISALIGNED((a), 1 << SECTOR_SHIFT)
+#define NOTPOW2(a)             MISALIGNED((a), (a))
+
+#ifndef ARRAY_SIZE
+# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
+#define MOVE_REF(x, y) \
+       do { \
+               typeof (x) *_px = &(x), *_py = &(y); \
+               *_px = *_py; \
+               *_py = NULL; \
+       } while (0)
+
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
 struct crypt_device;
+struct luks2_reenc_context;
 
 struct volume_key {
+       int id;
        size_t keylength;
+       const char *key_description;
+       struct volume_key *next;
        char key[];
 };
 
-struct volume_key *crypt_alloc_volume_key(unsigned keylength, const char *key);
-struct volume_key *crypt_generate_volume_key(struct crypt_device *cd, unsigned keylength);
+struct volume_key *crypt_alloc_volume_key(size_t keylength, const char *key);
+struct volume_key *crypt_generate_volume_key(struct crypt_device *cd, size_t keylength);
 void crypt_free_volume_key(struct volume_key *vk);
+int crypt_volume_key_set_description(struct volume_key *key, const char *key_description);
+void crypt_volume_key_set_id(struct volume_key *vk, int id);
+int crypt_volume_key_get_id(const struct volume_key *vk);
+void crypt_volume_key_add_next(struct volume_key **vks, struct volume_key *vk);
+struct volume_key *crypt_volume_key_next(struct volume_key *vk);
+struct volume_key *crypt_volume_key_by_id(struct volume_key *vk, int id);
+
+struct crypt_pbkdf_type *crypt_get_pbkdf(struct crypt_device *cd);
+int init_pbkdf_type(struct crypt_device *cd,
+                   const struct crypt_pbkdf_type *pbkdf,
+                   const char *dev_type);
+int verify_pbkdf_params(struct crypt_device *cd,
+                       const struct crypt_pbkdf_type *pbkdf);
+int crypt_benchmark_pbkdf_internal(struct crypt_device *cd,
+                                  struct crypt_pbkdf_type *pbkdf,
+                                  size_t volume_key_size);
+const char *crypt_get_cipher_spec(struct crypt_device *cd);
 
 /* Device backend */
 struct device;
-int device_alloc(struct device **device, const char *path);
-void device_free(struct device *device);
+int device_alloc(struct crypt_device *cd, struct device **device, const char *path);
+int device_alloc_no_check(struct device **device, const char *path);
+void device_close(struct crypt_device *cd, struct device *device);
+void device_free(struct crypt_device *cd, struct device *device);
 const char *device_path(const struct device *device);
+const char *device_dm_name(const struct device *device);
 const char *device_block_path(const struct device *device);
-void device_topology_alignment(struct device *device,
-                           unsigned long *required_alignment, /* bytes */
-                           unsigned long *alignment_offset,   /* bytes */
-                           unsigned long default_alignment);
-int device_block_size(struct device *device);
+void device_topology_alignment(struct crypt_device *cd,
+                              struct device *device,
+                              unsigned long *required_alignment, /* bytes */
+                              unsigned long *alignment_offset,   /* bytes */
+                              unsigned long default_alignment);
+size_t device_block_size(struct crypt_device *cd, struct device *device);
 int device_read_ahead(struct device *device, uint32_t *read_ahead);
 int device_size(struct device *device, uint64_t *size);
-int device_open(struct device *device, int flags);
+int device_open(struct crypt_device *cd, struct device *device, int flags);
+int device_open_excl(struct crypt_device *cd, struct device *device, int flags);
+void device_release_excl(struct crypt_device *cd, struct device *device);
+void device_disable_direct_io(struct device *device);
+int device_is_identical(struct device *device1, struct device *device2);
+int device_is_rotational(struct device *device);
+size_t device_alignment(struct device *device);
+int device_direct_io(const struct device *device);
+int device_fallocate(struct device *device, uint64_t size);
+void device_sync(struct crypt_device *cd, struct device *device);
+int device_check_size(struct crypt_device *cd,
+                     struct device *device,
+                     uint64_t req_offset, int falloc);
+
+int device_open_locked(struct crypt_device *cd, struct device *device, int flags);
+int device_read_lock(struct crypt_device *cd, struct device *device);
+int device_write_lock(struct crypt_device *cd, struct device *device);
+void device_read_unlock(struct crypt_device *cd, struct device *device);
+void device_write_unlock(struct crypt_device *cd, struct device *device);
+bool device_is_locked(struct device *device);
 
-enum devcheck { DEV_OK = 0, DEV_EXCL = 1, DEV_SHARED = 2 };
+enum devcheck { DEV_OK = 0, DEV_EXCL = 1 };
+int device_check_access(struct crypt_device *cd,
+                       struct device *device,
+                       enum devcheck device_check);
 int device_block_adjust(struct crypt_device *cd,
                        struct device *device,
                        enum devcheck device_check,
                        uint64_t device_offset,
                        uint64_t *size,
                        uint32_t *flags);
-size_t size_round_up(size_t size, unsigned int block);
+size_t size_round_up(size_t size, size_t block);
+
+int create_or_reload_device(struct crypt_device *cd, const char *name,
+                    const char *type, struct crypt_dm_active_device *dmd);
+
+int create_or_reload_device_with_integrity(struct crypt_device *cd, const char *name,
+                    const char *type, struct crypt_dm_active_device *dmd,
+                    struct crypt_dm_active_device *dmdi);
 
 /* Receive backend devices from context helpers */
 struct device *crypt_metadata_device(struct crypt_device *cd);
@@ -97,16 +183,18 @@ int crypt_dev_is_partition(const char *dev_path);
 char *crypt_get_partition_device(const char *dev_path, uint64_t offset, uint64_t size);
 char *crypt_get_base_device(const char *dev_path);
 uint64_t crypt_dev_partition_offset(const char *dev_path);
+int lookup_by_disk_id(const char *dm_uuid);
+int lookup_by_sysfs_uuid_field(const char *dm_uuid, size_t max_len);
+int crypt_uuid_cmp(const char *dm_uuid, const char *hdr_uuid);
 
-ssize_t write_blockwise(int fd, int bsize, void *buf, size_t count);
-ssize_t read_blockwise(int fd, int bsize, void *_buf, size_t count);
-ssize_t write_lseek_blockwise(int fd, int bsize, char *buf, size_t count, off_t offset);
+size_t crypt_getpagesize(void);
+unsigned crypt_cpusonline(void);
+uint64_t crypt_getphysmemory_kb(void);
 
-unsigned crypt_getpagesize(void);
 int init_crypto(struct crypt_device *ctx);
 
-void logger(struct crypt_device *cd, int class, const char *file, int line, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
-#define log_dbg(x...) logger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
+void logger(struct crypt_device *cd, int level, const char *file, int line, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
+#define log_dbg(c, x...) logger(c, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
 #define log_std(c, x...) logger(c, CRYPT_LOG_NORMAL, __FILE__, __LINE__, x)
 #define log_verbose(c, x...) logger(c, CRYPT_LOG_VERBOSE, __FILE__, __LINE__, x)
 #define log_err(c, x...) logger(c, CRYPT_LOG_ERROR, __FILE__, __LINE__, x)
@@ -116,12 +204,14 @@ int crypt_get_debug_level(void);
 int crypt_memlock_inc(struct crypt_device *ctx);
 int crypt_memlock_dec(struct crypt_device *ctx);
 
+int crypt_metadata_locking_enabled(void);
+
 int crypt_random_init(struct crypt_device *ctx);
 int crypt_random_get(struct crypt_device *ctx, char *buf, size_t len, int quality);
 void crypt_random_exit(void);
 int crypt_random_default_key_rng(void);
 
-int crypt_plain_hash(struct crypt_device *ctx,
+int crypt_plain_hash(struct crypt_device *cd,
                     const char *hash_name,
                     char *key, size_t key_size,
                     const char *passphrase, size_t passphrase_size);
@@ -131,23 +221,49 @@ int PLAIN_activate(struct crypt_device *cd,
                     uint64_t size,
                     uint32_t flags);
 
-/**
- * Different methods used to erase sensitive data concerning
- * either encrypted payload area or master key inside keyslot
- * area
- */
-typedef enum {
-       CRYPT_WIPE_ZERO, /**< overwrite area using zero blocks */
-       CRYPT_WIPE_DISK, /**< erase disk (using Gutmann method if it is rotational disk)*/
-       CRYPT_WIPE_SSD, /**< erase solid state disk (random write) */
-       CRYPT_WIPE_RANDOM /**< overwrite area using some up to now unspecified
-                           * random algorithm */
-} crypt_wipe_type;
-
-int crypt_wipe(struct device *device,
-              uint64_t offset,
-              uint64_t sectors,
-              crypt_wipe_type type,
-              int flags);
+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);
+struct luks2_reenc_context *crypt_get_reenc_context(struct crypt_device *cd);
+
+int onlyLUKS2(struct crypt_device *cd);
+int onlyLUKS2mask(struct crypt_device *cd, uint32_t mask);
+
+int crypt_wipe_device(struct crypt_device *cd,
+       struct device *device,
+       crypt_wipe_pattern pattern,
+       uint64_t offset,
+       uint64_t length,
+       size_t wipe_block_size,
+       int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
+       void *usrptr);
+
+/* Internal integrity helpers */
+const char *crypt_get_integrity(struct crypt_device *cd);
+int crypt_get_integrity_key_size(struct crypt_device *cd);
+int crypt_get_integrity_tag_size(struct crypt_device *cd);
+
+int crypt_key_in_keyring(struct crypt_device *cd);
+void crypt_set_key_in_keyring(struct crypt_device *cd, unsigned key_in_keyring);
+int crypt_volume_key_load_in_keyring(struct crypt_device *cd, struct volume_key *vk);
+int crypt_use_keyring_for_vk(struct crypt_device *cd);
+void crypt_drop_keyring_key_by_description(struct crypt_device *cd, const char *key_description, key_type_t ktype);
+void crypt_drop_keyring_key(struct crypt_device *cd, struct volume_key *vks);
+
+static inline uint64_t version(uint16_t major, uint16_t minor, uint16_t patch, uint16_t release)
+{
+       return (uint64_t)release | ((uint64_t)patch << 16) | ((uint64_t)minor << 32) | ((uint64_t)major << 48);
+}
+
+int kernel_version(uint64_t *kversion);
+
+int crypt_serialize_lock(struct crypt_device *cd);
+void crypt_serialize_unlock(struct crypt_device *cd);
+
+bool crypt_string_in(const char *str, char **list, size_t list_size);
+int crypt_strcmp(const char *a, const char *b);
+int crypt_compare_dm_devices(struct crypt_device *cd,
+                              const struct crypt_dm_active_device *src,
+                              const struct crypt_dm_active_device *tgt);
+static inline void *crypt_zalloc(size_t size) { return calloc(1, size); }
 
 #endif /* INTERNAL_H */
index 21b91dd..bfb0ca1 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * libcryptsetup - cryptsetup library
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2015, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2015, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -38,10 +38,17 @@ extern "C" {
 #include <stddef.h>
 #include <stdint.h>
 
+/**
+ * @defgroup crypt-init Cryptsetup device context initialization
+ * Set of functions for creating and destroying @e crypt_device context
+ * @addtogroup crypt-init
+ * @{
+ */
+
 struct crypt_device; /* crypt device handle */
 
 /**
- * Initialize crypt device handle and check if provided device exists.
+ * Initialize crypt device handle and check if the provided device exists.
  *
  * @param cd Returns pointer to crypt device handle
  * @param device Path to the backing device.
@@ -52,12 +59,29 @@ struct crypt_device; /* crypt device handle */
  *
  * @return @e 0 on success or negative errno value otherwise.
  *
- * @note Note that logging is not initialized here, possible messages uses
+ * @note Note that logging is not initialized here, possible messages use
  *      default log function.
  */
 int crypt_init(struct crypt_device **cd, const char *device);
 
 /**
+ * Initialize crypt device handle with optional data device and check
+ * if devices exist.
+ *
+ * @param cd Returns pointer to crypt device handle
+ * @param device Path to the backing device or detached header.
+ * @param data_device Path to the data device or @e NULL.
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ *
+ * @note Note that logging is not initialized here, possible messages use
+ *      default log function.
+ */
+int crypt_init_data_device(struct crypt_device **cd,
+       const char *device,
+       const char *data_device);
+
+/**
  * Initialize crypt device handle from provided active device name,
  * and, optionally, from separate metadata (header) device
  * and check if provided device exists.
@@ -77,8 +101,8 @@ int crypt_init(struct crypt_device **cd, const char *device);
  *      crypt_init_by_name_and_header(cd, name, NULL);
  */
 int crypt_init_by_name_and_header(struct crypt_device **cd,
-                                 const char *name,
-                                 const char *header_device);
+       const char *name,
+       const char *header_device);
 
 /**
  * This is equivalent to call
@@ -89,15 +113,71 @@ int crypt_init_by_name_and_header(struct crypt_device **cd,
 int crypt_init_by_name(struct crypt_device **cd, const char *name);
 
 /**
- * @defgroup loglevel Cryptsetup logging
+ * Release crypt device context and used memory.
  *
- * Set of functions and defines used in cryptsetup for
- * logging purposes
+ * @param cd crypt device handle
+ */
+void crypt_free(struct crypt_device *cd);
+
+/**
+ * Set confirmation callback (yes/no).
+ *
+ * If code need confirmation (like resetting uuid or restoring LUKS header from file)
+ * this function is called. If not defined, everything is confirmed.
+ *
+ * Callback function @e confirm should return @e 0 if operation is declined,
+ * other values mean accepted.
+ *
+ * @param cd crypt device handle
+ * @param confirm user defined confirm callback reference
+ * @param usrptr provided identification in callback
+ * @param msg Message for user to confirm
  *
+ * @note Current version of cryptsetup API requires confirmation for UUID change and
+ *      LUKS header restore only.
  */
+void crypt_set_confirm_callback(struct crypt_device *cd,
+       int (*confirm)(const char *msg, void *usrptr),
+       void *usrptr);
+
+/**
+ * Set data device
+ * For LUKS it is encrypted data device when LUKS header is separated.
+ * For VERITY it is data device when hash device is separated.
+ *
+ * @param cd crypt device handle
+ * @param device path to device
+ *
+ * @returns 0 on success or negative errno value otherwise.
+ */
+int crypt_set_data_device(struct crypt_device *cd, const char *device);
+
+/**
+ * Set data device offset in 512-byte sectors.
+ * Used for LUKS.
+ * This function is replacement for data alignment fields in LUKS param struct.
+ * If set to 0 (default), old behaviour is preserved.
+ * This value is reset on @link crypt_load @endlink.
+ *
+ * @param cd crypt device handle
+ * @param data_offset data offset in bytes
+ *
+ * @returns 0 on success or negative errno value otherwise.
+ *
+ * @note Data offset must be aligned to multiple of 8 (alignment to 4096-byte sectors)
+ * and must be big enough to accommodate the whole LUKS header with all keyslots.
+ * @note Data offset is enforced by this function, device topology
+ * information is no longer used after calling this function.
+ */
+int crypt_set_data_offset(struct crypt_device *cd, uint64_t data_offset);
+
+/** @} */
 
 /**
- * @addtogroup loglevel
+ * @defgroup crypt-log Cryptsetup logging
+ * Set of functions and defines used in cryptsetup for
+ * logging purposes
+ * @addtogroup crypt-log
  * @{
  */
 
@@ -109,6 +189,8 @@ int crypt_init_by_name(struct crypt_device **cd, const char *name);
 #define CRYPT_LOG_VERBOSE  2
 /** debug log level - always on stdout */
 #define CRYPT_LOG_DEBUG -1
+/** debug log level - additional JSON output (for LUKS2) */
+#define CRYPT_LOG_DEBUG_JSON -2
 
 /**
  * Set log function.
@@ -136,145 +218,121 @@ void crypt_log(struct crypt_device *cd, int level, const char *msg);
 /** @} */
 
 /**
- * Set confirmation callback (yes/no)
- *
- * If code need confirmation (like resetting uuid or restoring LUKS header from file)
- * this function is called. If not defined, everything is confirmed.
- *
- * Callback function @e confirm should return @e 0 if operation is declined,
- * other values mean accepted.
- *
- * @param cd crypt device handle
- * @param confirm user defined confirm callback reference
- * @param usrptr provided identification in callback
- * @param msg Message for user to confirm
- *
- * @note Current version of cryptsetup API requires confirmation only when UUID is being changed
+ * @defgroup crypt-set Cryptsetup settings (RNG, PBKDF, locking)
+ * @addtogroup crypt-set
+ * @{
  */
-void crypt_set_confirm_callback(struct crypt_device *cd,
-       int (*confirm)(const char *msg, void *usrptr),
-       void *usrptr);
 
-/**
- * Set password query callback.
- *
- * If code need @e _interactive_ query for password, this callback is called.
- * If not defined, compiled-in default is called (uses terminal input).
- *
- * Callback should return length of password in buffer
- * or negative errno value in case of error.
- *
- * @param cd crypt device handle
- * @param password user defined password callback reference
- * @param usrptr provided identification in callback
- * @param msg Message for user
- * @param buf buffer for password
- * @param length size of buffer
- *
- * @note Note that if this function is defined, verify option is ignored
- *   (caller which provided callback is responsible for password verification)
- * @note Only zero terminated passwords can be entered this way, for complex
- *   use API functions directly.
- * @note Maximal length of password is limited to @e length @e - @e 1 (minimal 511 chars)
- * @note Internal compiled-in terminal input is DEPRECATED and will be removed
- *   in future versions.
- *
- * @see Callback function is used in these call provided, that certain conditions are met:
- * @li crypt_keyslot_add_by_passphrase
- * @li crypt_activate_by_passphrase
- * @li crypt_resume_by_passphrase
- * @li crypt_resume_by_keyfile
- * @li crypt_keyslot_add_by_keyfile
- * @li crypt_keyslot_add_by_volume_key
- *
- */
-void crypt_set_password_callback(struct crypt_device *cd,
-       int (*password)(const char *msg, char *buf, size_t length, void *usrptr),
-       void *usrptr);
+/** CRYPT_RNG_URANDOM - use /dev/urandom */
+#define CRYPT_RNG_URANDOM 0
+/** CRYPT_RNG_RANDOM  - use /dev/random (waits if no entropy in system) */
+#define CRYPT_RNG_RANDOM  1
 
 /**
- * Set timeout for interactive password entry using default
- * password callback
+ * Set which RNG (random number generator) is used for generating long term key
  *
  * @param cd crypt device handle
- * @param timeout_sec timeout in seconds
+ * @param rng_type kernel random number generator to use
+ *
  */
-void crypt_set_timeout(struct crypt_device *cd, uint64_t timeout_sec);
+void crypt_set_rng_type(struct crypt_device *cd, int rng_type);
 
 /**
- * Set number of retries in case password input has been incorrect
+ * Get which RNG (random number generator) is used for generating long term key.
  *
  * @param cd crypt device handle
- * @param tries the number
+ * @return RNG type on success or negative errno value otherwise.
+ *
  */
-void crypt_set_password_retry(struct crypt_device *cd, int tries);
+int crypt_get_rng_type(struct crypt_device *cd);
 
 /**
- * Set how long should cryptsetup iterate in PBKDF2 function.
- * Default value heads towards the iterations which takes around 1 second
- *
- * @param cd crypt device handle
- * @param iteration_time_ms the time in ms
+ * PBKDF parameters.
  */
-void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms);
-/* Don't ask :-) */
-void crypt_set_iterarion_time(struct crypt_device *cd, uint64_t iteration_time_ms);
+struct crypt_pbkdf_type {
+       const char *type;         /**< PBKDF algorithm  */
+       const char *hash;         /**< Hash algorithm */
+       uint32_t time_ms;         /**< Requested time cost [milliseconds] */
+       uint32_t iterations;      /**< Iterations, 0 or benchmarked value. */
+       uint32_t max_memory_kb;   /**< Requested or benchmarked  memory cost [kilobytes] */
+       uint32_t parallel_threads;/**< Requested parallel cost [threads] */
+       uint32_t flags;           /**< CRYPT_PBKDF* flags */
+};
+
+/** Iteration time set by crypt_set_iteration_time(), for compatibility only. */
+#define CRYPT_PBKDF_ITER_TIME_SET   (1 << 0)
+/** Never run benchmarks, use pre-set value or defaults. */
+#define CRYPT_PBKDF_NO_BENCHMARK    (1 << 1)
+
+/** PBKDF2 according to RFC2898, LUKS1 legacy */
+#define CRYPT_KDF_PBKDF2   "pbkdf2"
+/** Argon2i according to RFC */
+#define CRYPT_KDF_ARGON2I  "argon2i"
+/** Argon2id according to RFC */
+#define CRYPT_KDF_ARGON2ID "argon2id"
 
 /**
- * Set whether passphrase will be verified on input
- * (user has to input same passphrase twice)
+ * Set default PBKDF (Password-Based Key Derivation Algorithm) for next keyslot
+ * about to get created with any crypt_keyslot_add_*() call.
  *
  * @param cd crypt device handle
- * @param password_verify @e 0 = false, @e !0 true
+ * @param pbkdf PBKDF parameters
+ *
+ * @return 0 on success or negative errno value otherwise.
+ *
+ * @note For LUKS1, only PBKDF2 is supported, other settings will be rejected.
+ * @note For non-LUKS context types the call succeeds, but PBKDF is not used.
  */
-void crypt_set_password_verify(struct crypt_device *cd, int password_verify);
+int crypt_set_pbkdf_type(struct crypt_device *cd,
+        const struct crypt_pbkdf_type *pbkdf);
 
 /**
- * Set data device
- * For LUKS it is encrypted data device when LUKS header is separated.
- * For VERITY it is data device when hash device is separated.
+ * Get PBKDF (Password-Based Key Derivation Algorithm) parameters.
  *
- * @param cd crypt device handle
- * @param device path to device
+ * @param pbkdf_type type of PBKDF
+ *
+ * @return struct on success or NULL value otherwise.
  *
  */
-int crypt_set_data_device(struct crypt_device *cd, const char *device);
+const struct crypt_pbkdf_type *crypt_get_pbkdf_type_params(const char *pbkdf_type);
 
 /**
- * @defgroup rng Cryptsetup RNG
+ * Get default PBKDF (Password-Based Key Derivation Algorithm) settings for keyslots.
+ * Works only with LUKS device handles (both versions).
  *
- * @addtogroup rng
- * @{
+ * @param type type of device (see @link crypt-type @endlink)
+ *
+ * @return struct on success or NULL value otherwise.
  *
  */
-
-/** CRYPT_RNG_URANDOM - use /dev/urandom */
-#define CRYPT_RNG_URANDOM 0
-/** CRYPT_RNG_RANDOM  - use /dev/random (waits if no entropy in system) */
-#define CRYPT_RNG_RANDOM  1
+const struct crypt_pbkdf_type *crypt_get_pbkdf_default(const char *type);
 
 /**
- * Set which RNG (random number generator) is used for generating long term key
+ * Get current PBKDF (Password-Based Key Derivation Algorithm) settings for keyslots.
+ * Works only with LUKS device handles (both versions).
  *
  * @param cd crypt device handle
- * @param rng_type kernel random number generator to use
+ *
+ * @return struct on success or NULL value otherwise.
  *
  */
-void crypt_set_rng_type(struct crypt_device *cd, int rng_type);
+const struct crypt_pbkdf_type *crypt_get_pbkdf_type(struct crypt_device *cd);
 
 /**
- * Get which RNG (random number generator) is used for generating long term key
+ * Set how long should cryptsetup iterate in PBKDF2 function.
+ * Default value heads towards the iterations which takes around 1 second.
+ * \b Deprecated, only for backward compatibility.
+ * Use @link crypt_set_pbkdf_type @endlink.
  *
  * @param cd crypt device handle
- * @return RNG type on success or negative errno value otherwise.
+ * @param iteration_time_ms the time in ms
  *
+ * @note If the time value is not acceptable for active PBKDF, value is quietly ignored.
  */
-int crypt_get_rng_type(struct crypt_device *cd);
-
-/** @} */
+void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms);
 
 /**
- * Helper to lock/unlock memory to avoid swap sensitive data to disk
+ * Helper to lock/unlock memory to avoid swap sensitive data to disk.
  *
  * @param cd crypt device handle, can be @e NULL
  * @param lock 0 to unlock otherwise lock memory
@@ -287,14 +345,58 @@ int crypt_get_rng_type(struct crypt_device *cd);
 int crypt_memory_lock(struct crypt_device *cd, int lock);
 
 /**
- * @defgroup crypt_type Cryptsetup on-disk format types
+ * Set global lock protection for on-disk metadata (file-based locking).
  *
- * Set of functions, \#defines and structs related
- * to on-disk format types
+ * @param cd crypt device handle, can be @e NULL
+ * @param enable 0 to disable locking otherwise enable it (default)
+ *
+ * @returns @e 0 on success or negative errno value otherwise.
+ *
+ * @note Locking applied only for some metadata formats (LUKS2).
+ * @note The switch is global on the library level.
+ *      In current version locking can be only switched off and cannot be switched on later.
+ */
+int crypt_metadata_locking(struct crypt_device *cd, int enable);
+
+/**
+ * Set metadata header area sizes. This applies only to LUKS2.
+ * These values limit amount of metadata anf number of supportable keyslots.
+ *
+ * @param cd crypt device handle, can be @e NULL
+ * @param metadata_size size in bytes of JSON area + 4k binary header
+ * @param keyslots_size size in bytes of binary keyslots area
+ *
+ * @returns @e 0 on success or negative errno value otherwise.
+ *
+ * @note The metadata area is stored twice and both copies contain 4k binary header.
+ * Only 16,32,64,128,256,512,1024,2048 and 4096 kB value is allowed (see LUKS2 specification).
+ * @note Keyslots area size must be multiple of 4k with maximum 128MB.
+ */
+int crypt_set_metadata_size(struct crypt_device *cd,
+       uint64_t metadata_size,
+       uint64_t keyslots_size);
+
+/**
+ * Get metadata header area sizes. This applies only to LUKS2.
+ * These values limit amount of metadata anf number of supportable keyslots.
+ *
+ * @param cd crypt device handle
+ * @param metadata_size size in bytes of JSON area + 4k binary header
+ * @param keyslots_size size in bytes of binary keyslots area
+ *
+ * @returns @e 0 on success or negative errno value otherwise.
  */
+int crypt_get_metadata_size(struct crypt_device *cd,
+       uint64_t *metadata_size,
+       uint64_t *keyslots_size);
+
+/** @} */
 
 /**
- * @addtogroup crypt_type
+ * @defgroup crypt-type Cryptsetup on-disk format types
+ * Set of functions, \#defines and structs related
+ * to on-disk format types
+ * @addtogroup crypt-type
  * @{
  */
 
@@ -302,12 +404,21 @@ int crypt_memory_lock(struct crypt_device *cd, int lock);
 #define CRYPT_PLAIN "PLAIN"
 /** LUKS version 1 header on-disk */
 #define CRYPT_LUKS1 "LUKS1"
+/** LUKS version 2 header on-disk */
+#define CRYPT_LUKS2 "LUKS2"
 /** loop-AES compatibility mode */
 #define CRYPT_LOOPAES "LOOPAES"
 /** dm-verity mode */
 #define CRYPT_VERITY "VERITY"
 /** TCRYPT (TrueCrypt-compatible and VeraCrypt-compatible) mode */
 #define CRYPT_TCRYPT "TCRYPT"
+/** INTEGRITY dm-integrity device */
+#define CRYPT_INTEGRITY "INTEGRITY"
+/** BITLK (BitLocker-compatible mode) */
+#define CRYPT_BITLK "BITLK"
+
+/** LUKS any version */
+#define CRYPT_LUKS NULL
 
 /**
  * Get device type
@@ -318,20 +429,28 @@ int crypt_memory_lock(struct crypt_device *cd, int lock);
 const char *crypt_get_type(struct crypt_device *cd);
 
 /**
+ * Get device default LUKS type
+ *
+ * @return string according to device type (CRYPT_LUKS1 or CRYPT_LUKS2).
+ */
+const char *crypt_get_default_type(void);
+
+/**
  *
- * Structure used as parameter for PLAIN device type
+ * Structure used as parameter for PLAIN device type.
  *
  * @see crypt_format
  */
 struct crypt_params_plain {
-       const char *hash; /**< password hash function */
-       uint64_t offset; /**< offset in sectors */
-       uint64_t skip; /**< IV offset / initialization sector */
-       uint64_t size; /**< size of mapped device or @e 0 for autodetection */
+       const char *hash;     /**< password hash function */
+       uint64_t offset;      /**< offset in sectors */
+       uint64_t skip;        /**< IV offset / initialization sector */
+       uint64_t size;        /**< size of mapped device or @e 0 for autodetection */
+       uint32_t sector_size; /**< sector size in bytes (@e 0 means 512 for compatibility) */
 };
 
 /**
- * Structure used as parameter for LUKS device type
+ * Structure used as parameter for LUKS device type.
  *
  * @see crypt_format, crypt_load
  *
@@ -340,14 +459,14 @@ struct crypt_params_plain {
  *
  */
 struct crypt_params_luks1 {
-       const char *hash; /**< hash used in LUKS header */
-       size_t data_alignment; /**< data alignment in sectors, data offset is multiple of this */
+       const char *hash;        /**< hash used in LUKS header */
+       size_t data_alignment;   /**< data area alignment in 512B sectors, data offset is multiple of this */
        const char *data_device; /**< detached encrypted data device or @e NULL */
 };
 
 /**
  *
- * Structure used as parameter for loop-AES device type
+ * Structure used as parameter for loop-AES device type.
  *
  * @see crypt_format
  *
@@ -360,7 +479,7 @@ struct crypt_params_loopaes {
 
 /**
  *
- * Structure used as parameter for dm-verity device type
+ * Structure used as parameter for dm-verity device type.
  *
  * @see crypt_format, crypt_load
  *
@@ -369,6 +488,7 @@ struct crypt_params_verity {
        const char *hash_name;     /**< hash function */
        const char *data_device;   /**< data_device (CRYPT_VERITY_CREATE_HASH) */
        const char *hash_device;   /**< hash_device (output only) */
+       const char *fec_device;    /**< fec_device (output only) */
        const char *salt;          /**< salt */
        uint32_t salt_size;        /**< salt size (in bytes) */
        uint32_t hash_type;        /**< in-kernel hashing type */
@@ -376,6 +496,8 @@ struct crypt_params_verity {
        uint32_t hash_block_size;  /**< hash block size (in bytes) */
        uint64_t data_size;        /**< data area size (in data blocks) */
        uint64_t hash_area_offset; /**< hash/header offset (in bytes) */
+       uint64_t fec_area_offset;  /**< FEC/header offset (in bytes) */
+       uint32_t fec_roots;        /**< Reed-Solomon FEC roots */
        uint32_t flags;            /**< CRYPT_VERITY* flags */
 };
 
@@ -385,10 +507,12 @@ struct crypt_params_verity {
 #define CRYPT_VERITY_CHECK_HASH  (1 << 1)
 /** Create hash - format hash device */
 #define CRYPT_VERITY_CREATE_HASH (1 << 2)
+/** Root hash signature required for activation */
+#define CRYPT_VERITY_ROOT_HASH_SIGNATURE (1 << 3)
 
 /**
  *
- * Structure used as parameter for TCRYPT device type
+ * Structure used as parameter for TCRYPT device type.
  *
  * @see crypt_load
  *
@@ -403,9 +527,10 @@ struct crypt_params_tcrypt {
        const char *mode;          /**< cipher block mode */
        size_t key_size;           /**< key size in bytes (the whole chain) */
        uint32_t flags;            /**< CRYPT_TCRYPT* flags */
+       uint32_t veracrypt_pim;    /**< VeraCrypt Personal Iteration Multiplier */
 };
 
-/** Include legacy modes when scanning for header*/
+/** Include legacy modes when scanning for header */
 #define CRYPT_TCRYPT_LEGACY_MODES    (1 << 0)
 /** Try to load hidden header (describing hidden device) */
 #define CRYPT_TCRYPT_HIDDEN_HEADER   (1 << 1)
@@ -419,10 +544,67 @@ struct crypt_params_tcrypt {
  */
 #define CRYPT_TCRYPT_VERA_MODES      (1 << 4)
 
+/**
+ *
+ * Structure used as parameter for dm-integrity device type.
+ *
+ * @see crypt_format, crypt_load
+ *
+ * @note In bitmap tracking mode, the journal is implicitly disabled.
+ *       As an ugly workaround for compatibility, journal_watermark is overloaded
+ *       to mean 512-bytes sectors-per-bit and journal_commit_time means bitmap flush time.
+ *       All other journal parameters are not applied in the bitmap mode.
+ */
+struct crypt_params_integrity {
+       uint64_t journal_size;               /**< size of journal in bytes */
+       unsigned int journal_watermark;      /**< journal flush watermark in percents; in bitmap mode sectors-per-bit  */
+       unsigned int journal_commit_time;    /**< journal commit time (or bitmap flush time) in ms */
+       uint32_t interleave_sectors;         /**< number of interleave sectors (power of two) */
+       uint32_t tag_size;                   /**< tag size per-sector in bytes */
+       uint32_t sector_size;                /**< sector size in bytes */
+       uint32_t buffer_sectors;             /**< number of sectors in one buffer */
+       const char *integrity;               /**< integrity algorithm, NULL for LUKS2 */
+       uint32_t integrity_key_size;         /**< integrity key size in bytes, info only, 0 for LUKS2 */
+
+       const char *journal_integrity;       /**< journal integrity algorithm */
+       const char *journal_integrity_key;   /**< journal integrity key, only for crypt_load */
+       uint32_t journal_integrity_key_size; /**< journal integrity key size in bytes, only for crypt_load */
+
+       const char *journal_crypt;           /**< journal encryption algorithm */
+       const char *journal_crypt_key;       /**< journal crypt key, only for crypt_load */
+       uint32_t journal_crypt_key_size;     /**< journal crypt key size in bytes, only for crypt_load */
+};
+
+/**
+ * Structure used as parameter for LUKS2 device type.
+ *
+ * @see crypt_format, crypt_load
+ *
+ * @note during crypt_format @e data_device attribute determines
+ *      if the LUKS2 header is separated from encrypted payload device
+ *
+ */
+struct crypt_params_luks2 {
+       const struct crypt_pbkdf_type *pbkdf; /**< PBKDF (and hash) parameters or @e NULL*/
+       const char *integrity;                /**< integrity algorithm or @e NULL */
+       const struct crypt_params_integrity *integrity_params; /**< Data integrity parameters or @e NULL*/
+       size_t data_alignment;   /**< data area alignment in 512B sectors, data offset is multiple of this */
+       const char *data_device; /**< detached encrypted data device or @e NULL */
+       uint32_t sector_size;    /**< encryption sector size */
+       const char *label;       /**< header label or @e NULL*/
+       const char *subsystem;   /**< header subsystem label or @e NULL*/
+};
 /** @} */
 
 /**
- * Create (format) new crypt device (and possible header on-disk) but not activates it.
+ * @defgroup crypt-actions Cryptsetup device context actions
+ * Set of functions for formatting and manipulating with specific crypt_type
+ * @addtogroup crypt-actions
+ * @{
+ */
+
+/**
+ * Create (format) new crypt device (and possible header on-disk) but do not activate it.
  *
  * @pre @e cd contains initialized and not formatted device context (device type must @b not be set)
  *
@@ -433,13 +615,13 @@ struct crypt_params_tcrypt {
  * @param uuid requested UUID or @e NULL if it should be generated
  * @param volume_key pre-generated volume key or @e NULL if it should be generated (only for LUKS)
  * @param volume_key_size size of volume key in bytes.
- * @param params crypt type specific parameters (see @link crypt_type @endlink)
+ * @param params crypt type specific parameters (see @link crypt-type @endlink)
  *
  * @returns @e 0 on success or negative errno value otherwise.
  *
- * @note Note that crypt_format does not enable any keyslot (in case of work with LUKS device),
- *     but it stores volume key internally and subsequent crypt_keyslot_add_* calls can be used.
- * @note For VERITY @link crypt_type @endlink, only uuid parameter is used, others paramaters
+ * @note Note that crypt_format does not create LUKS keyslot (any version). To create keyslot
+ *      call any crypt_keyslot_add_* function.
+ * @note For VERITY @link crypt-type @endlink, only uuid parameter is used, other parameters
  *     are ignored and verity specific attributes are set through mandatory params option.
  */
 int crypt_format(struct crypt_device *cd,
@@ -452,7 +634,49 @@ int crypt_format(struct crypt_device *cd,
        void *params);
 
 /**
- * Set new UUID for already existing device
+ * Set format compatibility flags.
+ *
+ * @param cd crypt device handle
+ * @param flags CRYPT_COMPATIBILITY_* flags
+ */
+void crypt_set_compatibility(struct crypt_device *cd, uint32_t flags);
+
+/**
+ * Get compatibility flags.
+ *
+ * @param cd crypt device handle
+ *
+ * @returns compatibility flags
+ */
+uint32_t crypt_get_compatibility(struct crypt_device *cd);
+
+/** dm-integrity device uses less effective (legacy) padding (old kernels) */
+#define CRYPT_COMPAT_LEGACY_INTEGRITY_PADDING (1 << 0)
+
+/**
+ * Convert to new type for already existing device.
+ *
+ * @param cd crypt device handle
+ * @param type type of device (optional params struct must be of this type)
+ * @param params crypt type specific parameters (see @link crypt-type @endlink)
+ *
+ * @returns 0 on success or negative errno value otherwise.
+ *
+ * @note Currently, only LUKS1->LUKS2 and LUKS2->LUKS1 conversions are supported.
+ *      Not all LUKS2 devices may be converted back to LUKS1. To make such a conversion
+ *      possible all active LUKS2 keyslots must be in LUKS1 compatible mode (i.e. pbkdf
+ *      type must be PBKDF2) and device cannot be formatted with any authenticated
+ *      encryption mode.
+ *
+ * @note Device must be offline for conversion. UUID change is not possible for active
+ *      devices.
+ */
+int crypt_convert(struct crypt_device *cd,
+       const char *type,
+       void *params);
+
+/**
+ * Set new UUID for already existing device.
  *
  * @param cd crypt device handle
  * @param uuid requested UUID or @e NULL if it should be generated
@@ -462,14 +686,48 @@ int crypt_format(struct crypt_device *cd,
  * @note Currently, only LUKS device type are supported
  */
 int crypt_set_uuid(struct crypt_device *cd,
-                  const char *uuid);
+       const char *uuid);
+
+/**
+ * Set new labels (label and subsystem) for already existing device.
+ *
+ * @param cd crypt device handle
+ * @param label requested label or @e NULL
+ * @param subsystem requested subsystem label or @e NULL
+ *
+ * @returns 0 on success or negative errno value otherwise.
+ *
+ * @note Currently, only LUKS2 device type is supported
+ */
+int crypt_set_label(struct crypt_device *cd,
+       const char *label,
+       const char *subsystem);
+
+/**
+ * Enable or disable loading of volume keys via kernel keyring. When set to
+ * 'enabled' library loads key in kernel keyring first and pass the key
+ * description to dm-crypt instead of binary key copy. If set to 'disabled'
+ * library fallbacks to old method of loading volume key directly in
+ * dm-crypt target.
+ *
+ * @param cd crypt device handle, can be @e NULL
+ * @param enable 0 to disable loading of volume keys via kernel keyring
+ *       (classical method) otherwise enable it (default)
+ *
+ * @returns @e 0 on success or negative errno value otherwise.
+ *
+ * @note Currently loading of volume keys via kernel keyring is supported
+ *      (and enabled by default) only for LUKS2 devices.
+ * @note The switch is global on the library level.
+ */
+int crypt_volume_key_keyring(struct crypt_device *cd, int enable);
 
 /**
- * Load crypt device parameters from on-disk header
+ * Load crypt device parameters from on-disk header.
  *
  * @param cd crypt device handle
- * @param requested_type @link crypt_type @endlink or @e NULL for all known
- * @param params crypt type specific parameters (see @link crypt_type @endlink)
+ * @param requested_type @link crypt-type @endlink or @e NULL for all known
+ * @param params crypt type specific parameters (see @link crypt-type @endlink)
  *
  * @returns 0 on success or negative errno value otherwise.
  *
@@ -480,38 +738,51 @@ int crypt_set_uuid(struct crypt_device *cd,
  *
  */
 int crypt_load(struct crypt_device *cd,
-              const char *requested_type,
-              void *params);
+       const char *requested_type,
+       void *params);
 
 /**
- * Try to repair crypt device on-disk header if invalid
+ * Try to repair crypt device LUKS on-disk header if invalid.
  *
  * @param cd crypt device handle
- * @param requested_type @link crypt_type @endlink or @e NULL for all known
- * @param params crypt type specific parameters (see @link crypt_type @endlink)
+ * @param requested_type @link crypt-type @endlink or @e NULL for all known
+ * @param params crypt type specific parameters (see @link crypt-type @endlink)
  *
  * @returns 0 on success or negative errno value otherwise.
  *
+ * @note For LUKS2 device crypt_repair bypass blkid checks and
+ *      perform auto-recovery even though there're third party device
+ *      signatures found by blkid probes. Currently the crypt_repair on LUKS2
+ *      works only if exactly one header checksum does not match or exactly
+ *      one header is missing.
  */
 int crypt_repair(struct crypt_device *cd,
-                const char *requested_type,
-                void *params);
+       const char *requested_type,
+       void *params);
 
 /**
- * Resize crypt device
+ * Resize crypt device.
  *
  * @param cd - crypt device handle
  * @param name - name of device to resize
  * @param new_size - new device size in sectors or @e 0 to use all of the underlying device size
  *
  * @return @e 0 on success or negative errno value otherwise.
+ *
+ * @note Most notably it returns -EPERM when device was activated with volume key
+ *      in kernel keyring and current device handle (context) doesn't have verified key
+ *      loaded in kernel. To load volume key for already active device use any of
+ *      @link crypt_activate_by_passphrase @endlink, @link crypt_activate_by_keyfile @endlink,
+ *      @link crypt_activate_by_keyfile_offset @endlink, @link crypt_activate_by_volume_key @endlink,
+ *      @link crypt_activate_by_keyring @endlink or @link crypt_activate_by_token @endlink with flag
+ *      @e CRYPT_ACTIVATE_KEYRING_KEY raised and @e name parameter set to @e NULL.
  */
 int crypt_resize(struct crypt_device *cd,
-                const char *name,
-                uint64_t new_size);
+       const char *name,
+       uint64_t new_size);
 
 /**
- * Suspends crypt device.
+ * Suspend crypt device.
  *
  * @param cd crypt device handle, can be @e NULL
  * @param name name of device to suspend
@@ -522,23 +793,21 @@ int crypt_resize(struct crypt_device *cd,
  *
  */
 int crypt_suspend(struct crypt_device *cd,
-                 const char *name);
+       const char *name);
 
 /**
- * Resumes crypt device using passphrase.
+ * Resume crypt device using passphrase.
  *
  *
  * @param cd crypt device handle
  * @param name name of device to resume
  * @param keyslot requested keyslot or CRYPT_ANY_SLOT
- * @param passphrase passphrase used to unlock volume key, @e NULL for query
+ * @param passphrase passphrase used to unlock volume key
  * @param passphrase_size size of @e passphrase (binary data)
  *
  * @return unlocked key slot number or negative errno otherwise.
  *
  * @note Only LUKS device type is supported
- * @note If passphrase is @e NULL always use crypt_set_password_callback.
- * Internal terminal password query is DEPRECATED and will be removed in next version.
  */
 int crypt_resume_by_passphrase(struct crypt_device *cd,
        const char *name,
@@ -547,19 +816,26 @@ int crypt_resume_by_passphrase(struct crypt_device *cd,
        size_t passphrase_size);
 
 /**
- * Resumes crypt device using key file.
+ * Resume crypt device using key file.
  *
  * @param cd crypt device handle
  * @param name name of device to resume
  * @param keyslot requested keyslot or CRYPT_ANY_SLOT
- * @param keyfile key file used to unlock volume key, @e NULL for passphrase query
+ * @param keyfile key file used to unlock volume key
  * @param keyfile_size number of bytes to read from keyfile, 0 is unlimited
  * @param keyfile_offset number of bytes to skip at start of keyfile
  *
  * @return unlocked key slot number or negative errno otherwise.
- *
- * @note If passphrase is @e NULL always use crypt_set_password_callback.
- * Internal terminal password query is DEPRECATED and will be removed in next version.
+ */
+int crypt_resume_by_keyfile_device_offset(struct crypt_device *cd,
+       const char *name,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       uint64_t keyfile_offset);
+
+/**
+ * Backward compatible crypt_resume_by_keyfile_device_offset() (with size_t offset).
  */
 int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
        const char *name,
@@ -567,48 +843,53 @@ int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
        const char *keyfile,
        size_t keyfile_size,
        size_t keyfile_offset);
+
 /**
- * Backward compatible crypt_resume_by_keyfile_offset() (without offset).
+ * Backward compatible crypt_resume_by_keyfile_device_offset() (without offset).
  */
 int crypt_resume_by_keyfile(struct crypt_device *cd,
        const char *name,
        int keyslot,
        const char *keyfile,
        size_t keyfile_size);
-
 /**
- * Releases crypt device context and used memory.
+ * Resume crypt device using provided volume key.
  *
  * @param cd crypt device handle
+ * @param name name of device to resume
+ * @param volume_key provided volume key
+ * @param volume_key_size size of volume_key
+ *
+ * @return @e 0 on success or negative errno value otherwise.
  */
-void crypt_free(struct crypt_device *cd);
+int crypt_resume_by_volume_key(struct crypt_device *cd,
+       const char *name,
+       const char *volume_key,
+       size_t volume_key_size);
+/** @} */
 
 /**
- * @defgroup keyslot Cryptsetup LUKS keyslots
- * @addtogroup keyslot
+ * @defgroup crypt-keyslot LUKS keyslots
+ * @addtogroup crypt-keyslot
  * @{
- *
  */
 
 /** iterate through all keyslots and find first one that fits */
 #define CRYPT_ANY_SLOT -1
 
 /**
- * Add key slot using provided passphrase
+ * Add key slot using provided passphrase.
  *
  * @pre @e cd contains initialized and formatted LUKS device context
  *
  * @param cd crypt device handle
  * @param keyslot requested keyslot or @e CRYPT_ANY_SLOT
- * @param passphrase passphrase used to unlock volume key, @e NULL for query
+ * @param passphrase passphrase used to unlock volume key
  * @param passphrase_size size of passphrase (binary data)
- * @param new_passphrase passphrase for new keyslot, @e NULL for query
+ * @param new_passphrase passphrase for new keyslot
  * @param new_passphrase_size size of @e new_passphrase (binary data)
  *
  * @return allocated key slot number or negative errno otherwise.
- *
- * @note If passphrase is @e NULL always use crypt_set_password_callback.
- * Internal terminal password query is DEPRECATED and will be removed in next version.
  */
 int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
        int keyslot,
@@ -618,26 +899,19 @@ int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
        size_t new_passphrase_size);
 
 /**
- * Change defined key slot using provided passphrase
+ * Change defined key slot using provided passphrase.
  *
  * @pre @e cd contains initialized and formatted LUKS device context
  *
  * @param cd crypt device handle
  * @param keyslot_old old keyslot or @e CRYPT_ANY_SLOT
  * @param keyslot_new new keyslot (can be the same as old)
- * @param passphrase passphrase used to unlock volume key, @e NULL for query
+ * @param passphrase passphrase used to unlock volume key
  * @param passphrase_size size of passphrase (binary data)
- * @param new_passphrase passphrase for new keyslot, @e NULL for query
+ * @param new_passphrase passphrase for new keyslot
  * @param new_passphrase_size size of @e new_passphrase (binary data)
  *
  * @return allocated key slot number or negative errno otherwise.
- *
- * @note This function is just internal implementation of luksChange
- * command to avoid reading of volume key outside libcryptsetup boundary
- * in FIPS mode.
- *
- * @note If passphrase is @e NULL always use crypt_set_password_callback.
- * Internal terminal password query is DEPRECATED and will be removed in next version.
  */
 int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
        int keyslot_old,
@@ -648,24 +922,34 @@ int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
        size_t new_passphrase_size);
 
 /**
-* Add key slot using provided key file path
+* Add key slot using provided key file path.
  *
  * @pre @e cd contains initialized and formatted LUKS device context
  *
  * @param cd crypt device handle
  * @param keyslot requested keyslot or @e CRYPT_ANY_SLOT
- * @param keyfile key file used to unlock volume key, @e NULL for passphrase query
+ * @param keyfile key file used to unlock volume key
  * @param keyfile_size number of bytes to read from keyfile, @e 0 is unlimited
  * @param keyfile_offset number of bytes to skip at start of keyfile
- * @param new_keyfile keyfile for new keyslot, @e NULL for passphrase query
+ * @param new_keyfile keyfile for new keyslot
  * @param new_keyfile_size number of bytes to read from @e new_keyfile, @e 0 is unlimited
  * @param new_keyfile_offset number of bytes to skip at start of new_keyfile
  *
  * @return allocated key slot number or negative errno otherwise.
- *
- * @note Note that @e keyfile can be "-" for STDIN
  */
-int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
+int crypt_keyslot_add_by_keyfile_device_offset(struct crypt_device *cd,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       uint64_t keyfile_offset,
+       const char *new_keyfile,
+       size_t new_keyfile_size,
+       uint64_t new_keyfile_offset);
+
+/**
+ * Backward compatible crypt_keyslot_add_by_keyfile_device_offset() (with size_t offset).
+ */
+int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
        int keyslot,
        const char *keyfile,
        size_t keyfile_size,
@@ -673,8 +957,9 @@ int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
        const char *new_keyfile,
        size_t new_keyfile_size,
        size_t new_keyfile_offset);
+
 /**
- * Backward compatible crypt_keyslot_add_by_keyfile_offset() (without offset).
+ * Backward compatible crypt_keyslot_add_by_keyfile_device_offset() (without offset).
  */
 int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
        int keyslot,
@@ -684,7 +969,7 @@ int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
        size_t new_keyfile_size);
 
 /**
- * Add key slot using provided volume key
+ * Add key slot using provided volume key.
  *
  * @pre @e cd contains initialized and formatted LUKS device context
  *
@@ -692,13 +977,10 @@ int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
  * @param keyslot requested keyslot or CRYPT_ANY_SLOT
  * @param volume_key provided volume key or @e NULL if used after crypt_format
  * @param volume_key_size size of volume_key
- * @param passphrase passphrase for new keyslot, @e NULL for query
+ * @param passphrase passphrase for new keyslot
  * @param passphrase_size size of passphrase
  *
  * @return allocated key slot number or negative errno otherwise.
- *
- * @note If passphrase is @e NULL always use crypt_set_password_callback.
- * Internal terminal password query is DEPRECATED and will be removed in next version.
  */
 int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
        int keyslot,
@@ -707,8 +989,54 @@ int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
        const char *passphrase,
        size_t passphrase_size);
 
+/** create keyslot with volume key not associated with current dm-crypt segment */
+#define CRYPT_VOLUME_KEY_NO_SEGMENT (1 << 0)
+
+/** create keyslot with new volume key and assign it to current dm-crypt segment */
+#define CRYPT_VOLUME_KEY_SET (1 << 1)
+
+/** Assign key to first matching digest before creating new digest */
+#define CRYPT_VOLUME_KEY_DIGEST_REUSE (1 << 2)
+
 /**
- * Destroy (and disable) key slot
+ * Add key slot using provided key.
+ *
+ * @pre @e cd contains initialized and formatted LUKS2 device context
+ *
+ * @param cd crypt device handle
+ * @param keyslot requested keyslot or CRYPT_ANY_SLOT
+ * @param volume_key provided volume key or @e NULL (see note below)
+ * @param volume_key_size size of volume_key
+ * @param passphrase passphrase for new keyslot
+ * @param passphrase_size size of passphrase
+ * @param flags key flags to set
+ *
+ * @return allocated key slot number or negative errno otherwise.
+ *
+ * @note in case volume_key is @e NULL following first matching rule will apply:
+ * @li if cd is device handle used in crypt_format() by current process, the volume
+ *     key generated (or passed) in crypt_format() will be stored in keyslot.
+ * @li if CRYPT_VOLUME_KEY_NO_SEGMENT flag is raised the new volume_key will be
+ *     generated and stored in keyslot. The keyslot will become unbound (unusable to
+ *     dm-crypt device activation).
+ * @li fails with -EINVAL otherwise
+ *
+ * @warning CRYPT_VOLUME_KEY_SET flag force updates volume key. It is @b not @b reencryption!
+ *         By doing so you will most probably destroy your ciphertext data device. It's supposed
+ *         to be used only in wrapped keys scheme for key refresh process where real (inner) volume
+ *         key stays untouched. It may be involed on active @e keyslot which makes the (previously
+ *         unbound) keyslot new regular keyslot.
+ */
+int crypt_keyslot_add_by_key(struct crypt_device *cd,
+       int keyslot,
+       const char *volume_key,
+       size_t volume_key_size,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags);
+
+/**
+ * Destroy (and disable) key slot.
  *
  * @pre @e cd contains initialized and formatted LUKS device context
  *
@@ -720,18 +1048,15 @@ int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
  * @note Note that there is no passphrase verification used.
  */
 int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot);
-
 /** @} */
 
 /**
- * @defgroup aflags Device runtime attributes
- *
+ * @defgroup crypt-aflags Device runtime attributes
  * Activation flags
- *
- * @addtogroup aflags
+ * @addtogroup crypt-aflags
  * @{
- *
  */
+
 /** device is read only */
 #define CRYPT_ACTIVATE_READONLY (1 << 0)
 /** only reported for device without uuid */
@@ -748,20 +1073,49 @@ int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot);
 #define CRYPT_ACTIVATE_SAME_CPU_CRYPT (1 << 6)
 /** use submit_from_crypt_cpus for dm-crypt */
 #define CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS (1 << 7)
-
+/** dm-verity: ignore_corruption flag - ignore corruption, log it only */
+#define CRYPT_ACTIVATE_IGNORE_CORRUPTION (1 << 8)
+/** dm-verity: restart_on_corruption flag - restart kernel on corruption */
+#define CRYPT_ACTIVATE_RESTART_ON_CORRUPTION (1 << 9)
+/** dm-verity: ignore_zero_blocks - do not verify zero blocks */
+#define CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS (1 << 10)
+/** key loaded in kernel keyring instead directly in dm-crypt */
+#define CRYPT_ACTIVATE_KEYRING_KEY (1 << 11)
+/** dm-integrity: direct writes, do not use journal */
+#define CRYPT_ACTIVATE_NO_JOURNAL (1 << 12)
+/** dm-integrity: recovery mode - no journal, no integrity checks */
+#define CRYPT_ACTIVATE_RECOVERY (1 << 13)
+/** ignore persistently stored flags */
+#define CRYPT_ACTIVATE_IGNORE_PERSISTENT (1 << 14)
+/** dm-verity: check_at_most_once - check data blocks only the first time */
+#define CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE (1 << 15)
+/** allow activation check including unbound keyslots (keyslots without segments) */
+#define CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY (1 << 16)
+/** dm-integrity: activate automatic recalculation */
+#define CRYPT_ACTIVATE_RECALCULATE (1 << 17)
+/** reactivate existing and update flags, input only */
+#define CRYPT_ACTIVATE_REFRESH (1 << 18)
+/** Use global lock to serialize memory hard KDF on activation (OOM workaround) */
+#define CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF (1 << 19)
+/** dm-integrity: direct writes, use bitmap to track dirty sectors */
+#define CRYPT_ACTIVATE_NO_JOURNAL_BITMAP (1 << 20)
+/** device is suspended (key should be wiped from memory), output only */
+#define CRYPT_ACTIVATE_SUSPENDED (1 << 21)
+/** use IV sector counted in sector_size instead of default 512 bytes sectors */
+#define CRYPT_ACTIVATE_IV_LARGE_SECTORS (1 << 22)
 
 /**
  * Active device runtime attributes
  */
 struct crypt_active_device {
-       uint64_t offset; /**< offset in sectors */
+       uint64_t offset;    /**< offset in sectors */
        uint64_t iv_offset; /**< IV initialization sector */
-       uint64_t size; /**< active device size */
-       uint32_t flags; /**< activation flags */
+       uint64_t size;      /**< active device size */
+       uint32_t flags;     /**< activation flags */
 };
 
 /**
- * Receives runtime attributes of active crypt device
+ * Receive runtime attributes of active crypt device.
  *
  * @param cd crypt device handle (can be @e NULL)
  * @param name name of active device
@@ -771,25 +1125,99 @@ struct crypt_active_device {
  *
  */
 int crypt_get_active_device(struct crypt_device *cd,
-                           const char *name,
-                           struct crypt_active_device *cad);
+       const char *name,
+       struct crypt_active_device *cad);
 
+/**
+ * Get detected number of integrity failures.
+ *
+ * @param cd crypt device handle (can be @e NULL)
+ * @param name name of active device
+ *
+ * @return number of integrity failures or @e 0 otherwise
+ *
+ */
+uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd,
+       const char *name);
 /** @} */
 
 /**
- * Activate device or check passphrase
+ * @defgroup crypt-pflags LUKS2 Device persistent flags and requirements
+ * @addtogroup crypt-pflags
+ * @{
+ */
+
+/**
+ * LUKS2 header requirements
+ */
+/** Unfinished offline reencryption */
+#define CRYPT_REQUIREMENT_OFFLINE_REENCRYPT    (1 << 0)
+/** Online reencryption in-progress */
+#define CRYPT_REQUIREMENT_ONLINE_REENCRYPT     (1 << 1)
+/** unknown requirement in header (output only) */
+#define CRYPT_REQUIREMENT_UNKNOWN              (1 << 31)
+
+/**
+ * Persistent flags type
+ */
+typedef enum {
+       CRYPT_FLAGS_ACTIVATION, /**< activation flags, @see aflags */
+       CRYPT_FLAGS_REQUIREMENTS /**< requirements flags */
+} crypt_flags_type;
+
+/**
+ * Set persistent flags.
+ *
+ * @param cd crypt device handle (can be @e NULL)
+ * @param type type to set (CRYPT_FLAGS_ACTIVATION or CRYPT_FLAGS_REQUIREMENTS)
+ * @param flags flags to set
+ *
+ * @return @e 0 on success or negative errno value otherwise
+ *
+ * @note Valid only for LUKS2.
+ *
+ * @note Not all activation flags can be stored. Only ALLOW_DISCARD,
+ *      SAME_CPU_CRYPT, SUBMIT_FROM_CRYPT_CPU and NO_JOURNAL can be
+ *      stored persistently.
+ *
+ * @note Only requirements flags recognised by current library may be set.
+ *      CRYPT_REQUIREMENT_UNKNOWN is illegal (output only) in set operation.
+ */
+int crypt_persistent_flags_set(struct crypt_device *cd,
+       crypt_flags_type type,
+       uint32_t flags);
+
+/**
+ * Get persistent flags stored in header.
+ *
+ * @param cd crypt device handle (can be @e NULL)
+ * @param type flags type to retrieve (CRYPT_FLAGS_ACTIVATION or CRYPT_FLAGS_REQUIREMENTS)
+ * @param flags reference to output variable
+ *
+ * @return @e 0 on success or negative errno value otherwise
+ */
+int crypt_persistent_flags_get(struct crypt_device *cd,
+       crypt_flags_type type,
+       uint32_t *flags);
+/** @} */
+
+/**
+ * @defgroup crypt-activation Device activation
+ * @addtogroup crypt-activation
+ * @{
+ */
+
+/**
+ * Activate device or check passphrase.
  *
  * @param cd crypt device handle
  * @param name name of device to create, if @e NULL only check passphrase
  * @param keyslot requested keyslot to check or @e CRYPT_ANY_SLOT
- * @param passphrase passphrase used to unlock volume key, @e NULL for query
+ * @param passphrase passphrase used to unlock volume key
  * @param passphrase_size size of @e passphrase
  * @param flags activation flags
  *
  * @return unlocked key slot number or negative errno otherwise.
- *
- * @note If passphrase is @e NULL always use crypt_set_password_callback.
- * Internal terminal password query is DEPRECATED and will be removed in next version.
  */
 int crypt_activate_by_passphrase(struct crypt_device *cd,
        const char *name,
@@ -799,7 +1227,7 @@ int crypt_activate_by_passphrase(struct crypt_device *cd,
        uint32_t flags);
 
 /**
- * Activate device or check using key file
+ * Activate device or check using key file.
  *
  * @param cd crypt device handle
  * @param name name of device to create, if @e NULL only check keyfile
@@ -811,6 +1239,17 @@ int crypt_activate_by_passphrase(struct crypt_device *cd,
  *
  * @return unlocked key slot number or negative errno otherwise.
  */
+int crypt_activate_by_keyfile_device_offset(struct crypt_device *cd,
+       const char *name,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       uint64_t keyfile_offset,
+       uint32_t flags);
+
+/**
+ * Backward compatible crypt_activate_by_keyfile_device_offset() (with size_t offset).
+ */
 int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
        const char *name,
        int keyslot,
@@ -818,8 +1257,9 @@ int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
        size_t keyfile_size,
        size_t keyfile_offset,
        uint32_t flags);
+
 /**
- * Backward compatible crypt_activate_by_keyfile_offset() (without offset).
+ * Backward compatible crypt_activate_by_keyfile_device_offset() (without offset).
  */
 int crypt_activate_by_keyfile(struct crypt_device *cd,
        const char *name,
@@ -829,8 +1269,7 @@ int crypt_activate_by_keyfile(struct crypt_device *cd,
        uint32_t flags);
 
 /**
- * Activate device using provided volume key
- *
+ * Activate device using provided volume key.
  *
  * @param cd crypt device handle
  * @param name name of device to create, if @e NULL only check volume key
@@ -856,20 +1295,87 @@ int crypt_activate_by_volume_key(struct crypt_device *cd,
        uint32_t flags);
 
 /**
+ * Activate VERITY device using provided key and optional signature).
+ *
+ * @param cd crypt device handle
+ * @param name name of device to create
+ * @param volume_key provided volume key
+ * @param volume_key_size size of volume_key
+ * @param signature buffer with signature for the key
+ * @param signature_size bsize of signature buffer
+ * @param flags activation flags
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ *
+ * @note For VERITY the volume key means root hash required for activation.
+ *     Because kernel dm-verity is always read only, you have to provide
+ *     CRYPT_ACTIVATE_READONLY flag always.
+ */
+int crypt_activate_by_signed_key(struct crypt_device *cd,
+       const char *name,
+       const char *volume_key,
+       size_t volume_key_size,
+       const char *signature,
+       size_t signature_size,
+       uint32_t flags);
+
+/**
+ * Activate device using passphrase stored in kernel keyring.
+ *
+ * @param cd crypt device handle
+ * @param name name of device to create, if @e NULL only check passphrase in keyring
+ * @param key_description kernel keyring key description library should look
+ *        for passphrase in
+ * @param keyslot requested keyslot to check or CRYPT_ANY_SLOT
+ * @param flags activation flags
+ *
+ * @return @e unlocked keyslot number on success or negative errno value otherwise.
+ *
+ * @note Keyslot passphrase must be stored in 'user' key type
+ *      and the key has to be reachable for process context
+ *      on behalf of which this function is called.
+ */
+int crypt_activate_by_keyring(struct crypt_device *cd,
+       const char *name,
+       const char *key_description,
+       int keyslot,
+       uint32_t flags);
+
+/** lazy deactivation - remove once last user releases it */
+#define CRYPT_DEACTIVATE_DEFERRED (1 << 0)
+/** force deactivation - if the device is busy, it is replaced by error device */
+#define CRYPT_DEACTIVATE_FORCE    (1 << 1)
+
+/**
  * Deactivate crypt device. This function tries to remove active device-mapper
  * mapping from kernel. Also, sensitive data like the volume key are removed from
  * memory
  *
  * @param cd crypt device handle, can be @e NULL
  * @param name name of device to deactivate
+ * @param flags deactivation flags
  *
  * @return @e 0 on success or negative errno value otherwise.
  *
  */
+int crypt_deactivate_by_name(struct crypt_device *cd,
+       const char *name,
+       uint32_t flags);
+
+/**
+ * Deactivate crypt device. See @ref crypt_deactivate_by_name with empty @e flags.
+ */
 int crypt_deactivate(struct crypt_device *cd, const char *name);
+/** @} */
 
 /**
- * Get volume key from of crypt device
+ * @defgroup crypt-key Volume Key manipulation
+ * @addtogroup crypt-key
+ * @{
+ */
+
+/**
+ * Get volume key from crypt device.
  *
  * @param cd crypt device handle
  * @param keyslot use this keyslot or @e CRYPT_ANY_SLOT
@@ -881,8 +1387,9 @@ int crypt_deactivate(struct crypt_device *cd, const char *name);
  *
  * @return unlocked key slot number or negative errno otherwise.
  *
- * @note For TCRYPT cipher chain is  the volume key concatenated
+ * @note For TCRYPT cipher chain is the volume key concatenated
  *      for all ciphers in chain.
+ * @note For VERITY the volume key means root hash used for activation.
  */
 int crypt_volume_key_get(struct crypt_device *cd,
        int keyslot,
@@ -892,7 +1399,7 @@ int crypt_volume_key_get(struct crypt_device *cd,
        size_t passphrase_size);
 
 /**
- * Verify that provided volume key is valid for crypt device
+ * Verify that provided volume key is valid for crypt device.
  *
  * @param cd crypt device handle
  * @param volume_key provided volume key
@@ -903,10 +1410,11 @@ int crypt_volume_key_get(struct crypt_device *cd,
 int crypt_volume_key_verify(struct crypt_device *cd,
        const char *volume_key,
        size_t volume_key_size);
+/** @} */
 
 /**
- * @defgroup devstat Crypt and Verity device status
- * @addtogroup devstat
+ * @defgroup crypt-devstat Crypt and Verity device status
+ * @addtogroup crypt-devstat
  * @{
  */
 
@@ -914,14 +1422,14 @@ int crypt_volume_key_verify(struct crypt_device *cd,
  * Device status
  */
 typedef enum {
-       CRYPT_INVALID, /**< device mapping is invalid in this context */
+       CRYPT_INVALID,  /**< device mapping is invalid in this context */
        CRYPT_INACTIVE, /**< no such mapped device */
-       CRYPT_ACTIVE, /**< device is active */
-       CRYPT_BUSY /**< device is active and has open count > 0 */
+       CRYPT_ACTIVE,   /**< device is active */
+       CRYPT_BUSY      /**< device is active and has open count > 0 */
 } crypt_status_info;
 
 /**
- * Get status info about device name
+ * Get status info about device name.
  *
  * @param cd crypt device handle, can be @e NULL
  * @param name crypt device name
@@ -932,7 +1440,7 @@ typedef enum {
 crypt_status_info crypt_status(struct crypt_device *cd, const char *name);
 
 /**
- * Dump text-formatted information about crypt or verity device to log output
+ * Dump text-formatted information about crypt or verity device to log output.
  *
  * @param cd crypt device handle
  *
@@ -941,7 +1449,7 @@ crypt_status_info crypt_status(struct crypt_device *cd, const char *name);
 int crypt_dump(struct crypt_device *cd);
 
 /**
- * Get cipher used in device
+ * Get cipher used in device.
  *
  * @param cd crypt device handle
  *
@@ -951,7 +1459,7 @@ int crypt_dump(struct crypt_device *cd);
 const char *crypt_get_cipher(struct crypt_device *cd);
 
 /**
- * Get cipher mode used in device
+ * Get cipher mode used in device.
  *
  * @param cd crypt device handle
  *
@@ -961,7 +1469,7 @@ const char *crypt_get_cipher(struct crypt_device *cd);
 const char *crypt_get_cipher_mode(struct crypt_device *cd);
 
 /**
- * Get device UUID
+ * Get device UUID.
  *
  * @param cd crypt device handle
  *
@@ -971,7 +1479,7 @@ const char *crypt_get_cipher_mode(struct crypt_device *cd);
 const char *crypt_get_uuid(struct crypt_device *cd);
 
 /**
- * Get path to underlaying device
+ * Get path to underlaying device.
  *
  * @param cd crypt device handle
  *
@@ -981,7 +1489,17 @@ const char *crypt_get_uuid(struct crypt_device *cd);
 const char *crypt_get_device_name(struct crypt_device *cd);
 
 /**
- * Get device offset in sectors where real data starts on underlying device)
+ * Get path to detached metadata device or @e NULL if it is not detached.
+ *
+ * @param cd crypt device handle
+ *
+ * @return path to underlaying device name
+ *
+ */
+const char *crypt_get_metadata_device_name(struct crypt_device *cd);
+
+/**
+ * Get device offset in 512-bytes sectors where real data starts (on underlying device).
  *
  * @param cd crypt device handle
  *
@@ -991,7 +1509,7 @@ const char *crypt_get_device_name(struct crypt_device *cd);
 uint64_t crypt_get_data_offset(struct crypt_device *cd);
 
 /**
- * Get IV offset in sectors (skip)
+ * Get IV offset in 512-bytes sectors (skip).
  *
  * @param cd crypt device handle
  *
@@ -1001,17 +1519,29 @@ uint64_t crypt_get_data_offset(struct crypt_device *cd);
 uint64_t crypt_get_iv_offset(struct crypt_device *cd);
 
 /**
- * Get size (in bytes) of volume key for crypt device
+ * Get size (in bytes) of volume key for crypt device.
  *
  * @param cd crypt device handle
  *
  * @return volume key size
  *
+ * @note For LUKS2, this function can be used only if there is at least
+ *       one keyslot assigned to data segment.
  */
 int crypt_get_volume_key_size(struct crypt_device *cd);
 
 /**
- * Get device parameters for VERITY device
+ * Get size (in bytes) of encryption sector for crypt device.
+ *
+ * @param cd crypt device handle
+ *
+ * @return sector size
+ *
+ */
+int crypt_get_sector_size(struct crypt_device *cd);
+
+/**
+ * Get device parameters for VERITY device.
  *
  * @param cd crypt device handle
  * @param vp verity device info
@@ -1021,20 +1551,29 @@ int crypt_get_volume_key_size(struct crypt_device *cd);
  */
 int crypt_get_verity_info(struct crypt_device *cd,
        struct crypt_params_verity *vp);
-/** @} */
 
 /**
- * @defgroup benchmark Benchmarking
+ * Get device parameters for INTEGRITY device.
  *
- * Benchmarking of algorithms
+ * @param cd crypt device handle
+ * @param ip verity device info
  *
- * @addtogroup benchmark
- * @{
+ * @e 0 on success or negative errno value otherwise.
  *
  */
+int crypt_get_integrity_info(struct crypt_device *cd,
+       struct crypt_params_integrity *ip);
+/** @} */
 
 /**
- * Informational benchmark for ciphers
+ * @defgroup crypt-benchmark Benchmarking
+ * Benchmarking of algorithms
+ * @addtogroup crypt-benchmark
+ * @{
+ */
+
+/**
+ * Informational benchmark for ciphers.
  *
  * @param cd crypt device handle
  * @param cipher (e.g. "aes")
@@ -1060,49 +1599,51 @@ int crypt_benchmark(struct crypt_device *cd,
        double *decryption_mbs);
 
 /**
- * Informational benchmark for KDF
+ * Informational benchmark for PBKDF.
  *
  * @param cd crypt device handle
- * @param kdf Key derivation function (e.g. "pbkdf2")
- * @param hash Hash algorithm used in KDF (e.g. "sha256")
+ * @param pbkdf PBKDF parameters
  * @param password password for benchmark
  * @param password_size size of password
  * @param salt salt for benchmark
  * @param salt_size size of salt
- * @param iterations_sec returns measured KDF iterations per second
+ * @param volume_key_size output volume key size
+ * @param progress callback function
+ * @param usrptr provided identification in callback
  *
  * @return @e 0 on success or negative errno value otherwise.
  */
-int crypt_benchmark_kdf(struct crypt_device *cd,
-       const char *kdf,
-       const char *hash,
+int crypt_benchmark_pbkdf(struct crypt_device *cd,
+       struct crypt_pbkdf_type *pbkdf,
        const char *password,
        size_t password_size,
        const char *salt,
        size_t salt_size,
-       uint64_t *iterations_sec);
+       size_t volume_key_size,
+       int (*progress)(uint32_t time_ms, void *usrptr),
+       void *usrptr);
 /** @} */
 
 /**
- * @addtogroup keyslot
+ * @addtogroup crypt-keyslot
  * @{
- *
  */
 
 /**
  * Crypt keyslot info
  */
 typedef enum {
-       CRYPT_SLOT_INVALID, /**< invalid keyslot */
-       CRYPT_SLOT_INACTIVE, /**< keyslot is inactive (free) */
-       CRYPT_SLOT_ACTIVE, /**< keyslot is active (used) */
-       CRYPT_SLOT_ACTIVE_LAST /**< keylost is active (used)
-                               *   and last used at the same time */
+       CRYPT_SLOT_INVALID,    /**< invalid keyslot */
+       CRYPT_SLOT_INACTIVE,   /**< keyslot is inactive (free) */
+       CRYPT_SLOT_ACTIVE,     /**< keyslot is active (used) */
+       CRYPT_SLOT_ACTIVE_LAST,/**< keylost is active (used)
+                                *  and last used at the same time */
+       CRYPT_SLOT_UNBOUND     /**< keyslot is active and not bound
+                                *  to any crypt segment (LUKS2 only) */
 } crypt_keyslot_info;
 
 /**
- * Get information about particular key slot
- *
+ * Get information about particular key slot.
  *
  * @param cd crypt device handle
  * @param keyslot requested keyslot to check or CRYPT_ANY_SLOT
@@ -1111,7 +1652,37 @@ typedef enum {
  *
  */
 crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot);
-/** @} */
+
+/**
+ * Crypt keyslot priority
+ */
+typedef enum {
+       CRYPT_SLOT_PRIORITY_INVALID =-1, /**< no such slot */
+       CRYPT_SLOT_PRIORITY_IGNORE  = 0, /**< CRYPT_ANY_SLOT will ignore it for open */
+       CRYPT_SLOT_PRIORITY_NORMAL  = 1, /**< default priority, tried after preferred */
+       CRYPT_SLOT_PRIORITY_PREFER  = 2, /**< will try to open first */
+} crypt_keyslot_priority;
+
+/**
+ * Get keyslot priority (LUKS2)
+ *
+ * @param cd crypt device handle
+ * @param keyslot keyslot number
+ *
+ * @return value defined by crypt_keyslot_priority
+ */
+crypt_keyslot_priority crypt_keyslot_get_priority(struct crypt_device *cd, int keyslot);
+
+/**
+ * Set keyslot priority (LUKS2)
+ *
+ * @param cd crypt device handle
+ * @param keyslot keyslot number
+ * @param priority priority defined in crypt_keyslot_priority
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ */
+int crypt_keyslot_set_priority(struct crypt_device *cd, int keyslot, crypt_keyslot_priority priority);
 
 /**
  * Get number of keyslots supported for device type.
@@ -1124,7 +1695,7 @@ crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot);
 int crypt_keyslot_max(const char *type);
 
 /**
- * Get keyslot area pointers (relative to metadata device)
+ * Get keyslot area pointers (relative to metadata device).
  *
  * @param cd crypt device handle
  * @param keyslot keyslot number
@@ -1140,56 +1711,60 @@ int crypt_keyslot_area(struct crypt_device *cd,
        uint64_t *length);
 
 /**
- * Backup header and keyslots to file
+ * Get size (in bytes) of stored key in particular keyslot.
+ * Use for LUKS2 unbound keyslots, for other keyslots it is the same as @ref crypt_get_volume_key_size
  *
  * @param cd crypt device handle
- * @param requested_type @link crypt_type @endlink or @e NULL for all known
- * @param backup_file file to backup header to
+ * @param keyslot keyslot number
  *
- * @return @e 0 on success or negative errno value otherwise.
+ * @return volume key size or negative errno value otherwise.
  *
  */
-int crypt_header_backup(struct crypt_device *cd,
-       const char *requested_type,
-       const char *backup_file);
+int crypt_keyslot_get_key_size(struct crypt_device *cd, int keyslot);
 
 /**
- * Restore header and keyslots from backup file
- *
+ * Get cipher and key size for keyslot encryption.
+ * Use for LUKS2 keyslot to set different encryption type than for data encryption.
+ * Parameters will be used for next keyslot operations.
  *
  * @param cd crypt device handle
- * @param requested_type @link crypt_type @endlink or @e NULL for all known
- * @param backup_file file to restore header from
+ * @param keyslot keyslot number of CRYPT_ANY_SLOT for default
+ * @param key_size encryption key size (in bytes)
  *
- * @return @e 0 on success or negative errno value otherwise.
+ * @return cipher specification on success or @e NULL.
  *
+ * @note This is the encryption of keyslot itself, not the data encryption algorithm!
  */
-int crypt_header_restore(struct crypt_device *cd,
-       const char *requested_type,
-       const char *backup_file);
+const char *crypt_keyslot_get_encryption(struct crypt_device *cd, int keyslot, size_t *key_size);
 
 /**
- * Receives last reported error
+ * Get PBKDF parameters for keyslot.
  *
  * @param cd crypt device handle
- * @param buf buffef for message
- * @param size size of buffer
+ * @param keyslot keyslot number
+ * @param pbkdf struct with returned PBKDF parameters
  *
- * @note Note that this is old API function using global context.
- * All error messages are reported also through log callback.
+ * @return @e 0 on success or negative errno value otherwise.
  */
-void crypt_last_error(struct crypt_device *cd, char *buf, size_t size);
+int crypt_keyslot_get_pbkdf(struct crypt_device *cd, int keyslot, struct crypt_pbkdf_type *pbkdf);
 
 /**
- * Receives last reported error, DEPRECATED
+ * Set encryption for keyslot.
+ * Use for LUKS2 keyslot to set different encryption type than for data encryption.
+ * Parameters will be used for next keyslot operations that create or change a keyslot.
+ *
+ * @param cd crypt device handle
+ * @param cipher (e.g. "aes-xts-plain64")
+ * @param key_size encryption key size (in bytes)
  *
- * @param buf buffef for message
- * @param size size of buffer
+ * @return @e 0 on success or negative errno value otherwise.
  *
- * @note Note that this is old API function using global context.
- * All error messages are reported also through log callback.
+ * @note To reset to default keyslot encryption (the same as for data)
+ *       set cipher to NULL and key size to 0.
  */
-void crypt_get_error(char *buf, size_t size);
+int crypt_keyslot_set_encryption(struct crypt_device *cd,
+       const char *cipher,
+       size_t key_size);
 
 /**
  * Get directory where mapped crypt devices are created
@@ -1198,17 +1773,53 @@ void crypt_get_error(char *buf, size_t size);
  */
 const char *crypt_get_dir(void);
 
+/** @} */
+
+/**
+ * @defgroup crypt-backup Device metadata backup
+ * @addtogroup crypt-backup
+ * @{
+ */
+/**
+ * Backup header and keyslots to file.
+ *
+ * @param cd crypt device handle
+ * @param requested_type @link crypt-type @endlink or @e NULL for all known
+ * @param backup_file file to backup header to
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ *
+ */
+int crypt_header_backup(struct crypt_device *cd,
+       const char *requested_type,
+       const char *backup_file);
+
 /**
- * @defgroup dbg Library debug level
+ * Restore header and keyslots from backup file.
  *
- * Set library debug level
+ * @param cd crypt device handle
+ * @param requested_type @link crypt-type @endlink or @e NULL for all known
+ * @param backup_file file to restore header from
  *
- * @addtogroup dbg
+ * @return @e 0 on success or negative errno value otherwise.
+ *
+ */
+int crypt_header_restore(struct crypt_device *cd,
+       const char *requested_type,
+       const char *backup_file);
+/** @} */
+
+/**
+ * @defgroup crypt-dbg Library debug level
+ * Set library debug level
+ * @addtogroup crypt-dbg
  * @{
  */
 
 /** Debug all */
 #define CRYPT_DEBUG_ALL  -1
+/** Debug all with additional JSON dump (for LUKS2) */
+#define CRYPT_DEBUG_JSON  -2
 /** Debug none */
 #define CRYPT_DEBUG_NONE  0
 
@@ -1219,6 +1830,539 @@ const char *crypt_get_dir(void);
  *
  */
 void crypt_set_debug_level(int level);
+/** @} */
+
+/**
+ * @defgroup crypt-keyfile Function to read keyfile
+ * @addtogroup crypt-keyfile
+ * @{
+ */
+
+/**
+ * Read keyfile
+ *
+ * @param cd crypt device handle
+ * @param keyfile keyfile to read
+ * @param key buffer for key
+ * @param key_size_read size of read key
+ * @param keyfile_offset key offset in keyfile
+ * @param key_size exact key length to read from file or 0
+ * @param flags keyfile read flags
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ *
+ * @note If key_size is set to zero we read internal max length
+ *      and actual size read is returned via key_size_read parameter.
+ */
+int crypt_keyfile_device_read(struct crypt_device *cd,
+       const char *keyfile,
+       char **key, size_t *key_size_read,
+       uint64_t keyfile_offset,
+       size_t key_size,
+       uint32_t flags);
+
+/**
+ * Backward compatible crypt_keyfile_device_read() (with size_t offset).
+ */
+int crypt_keyfile_read(struct crypt_device *cd,
+       const char *keyfile,
+       char **key, size_t *key_size_read,
+       size_t keyfile_offset,
+       size_t key_size,
+       uint32_t flags);
+
+/** Read key only to the first end of line (\\n). */
+#define CRYPT_KEYFILE_STOP_EOL   (1 << 0)
+/** @} */
+
+/**
+ * @defgroup crypt-wipe Function to wipe device
+ * @addtogroup crypt-wipe
+ * @{
+ */
+/**
+ * Wipe pattern
+ */
+typedef enum {
+       CRYPT_WIPE_ZERO,           /**< Fill with zeroes */
+       CRYPT_WIPE_RANDOM,         /**< Use RNG to fill data */
+       CRYPT_WIPE_ENCRYPTED_ZERO, /**< Add encryption and fill with zeroes as plaintext */
+       CRYPT_WIPE_SPECIAL,        /**< Compatibility only, do not use (Gutmann method) */
+} crypt_wipe_pattern;
+
+/**
+ * Wipe/Fill (part of) a device with the selected pattern.
+ *
+ * @param cd crypt device handle
+ * @param dev_path path to device to wipe or @e NULL if data device should be used
+ * @param pattern selected wipe pattern
+ * @param offset offset on device (in bytes)
+ * @param length length of area to be wiped (in bytes)
+ * @param wipe_block_size used block for wiping (one step) (in bytes)
+ * @param flags wipe flags
+ * @param progress callback function called after each @e wipe_block_size or @e NULL
+ * @param usrptr provided identification in callback
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ *
+ * @note A @e progress callback can interrupt wipe process by returning non-zero code.
+ *
+ * @note If the error values is -EIO or -EINTR, some part of the device could
+ *       be overwritten. Other error codes (-EINVAL, -ENOMEM) means that no IO was performed.
+ */
+int crypt_wipe(struct crypt_device *cd,
+       const char *dev_path, /* if null, use data device */
+       crypt_wipe_pattern pattern,
+       uint64_t offset,
+       uint64_t length,
+       size_t wipe_block_size,
+       uint32_t flags,
+       int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
+       void *usrptr
+);
+
+/** Use direct-io */
+#define CRYPT_WIPE_NO_DIRECT_IO (1 << 0)
+/** @} */
+
+/**
+ * @defgroup crypt-tokens LUKS2 token wrapper access
+ *
+ * Utilities for handling tokens LUKS2
+ * Token is a device or a method how to read password for particular keyslot
+ * automatically. It can be chunk of data stored on hardware token or
+ * just a metadata how to generate the password.
+ *
+ * @addtogroup crypt-tokens
+ * @{
+ */
+
+/** Iterate through all tokens */
+#define CRYPT_ANY_TOKEN -1
+
+/**
+ * Get content of a token definition in JSON format.
+ *
+ * @param cd crypt device handle
+ * @param token token id
+ * @param json buffer with JSON
+ *
+ * @return allocated token id or negative errno otherwise.
+ */
+int crypt_token_json_get(struct crypt_device *cd,
+       int token,
+       const char **json);
+
+/**
+ * Store content of a token definition in JSON format.
+ *
+ * @param cd crypt device handle
+ * @param token token id or @e CRYPT_ANY_TOKEN to allocate new one
+ * @param json buffer with JSON or @e NULL to remove token
+ *
+ * @return allocated token id or negative errno otherwise.
+ *
+ * @note The buffer must be in proper JSON format and must contain at least
+ *       string "type" with slot type and an array of string names "keyslots".
+ *       Keyslots array contains assignments to particular slots and can be empty.
+ */
+int crypt_token_json_set(struct crypt_device *cd,
+       int token,
+       const char *json);
+
+/**
+ * Token info
+ */
+typedef enum {
+       CRYPT_TOKEN_INVALID,          /**< token is invalid */
+       CRYPT_TOKEN_INACTIVE,         /**< token is empty (free) */
+       CRYPT_TOKEN_INTERNAL,         /**< active internal token with driver */
+       CRYPT_TOKEN_INTERNAL_UNKNOWN, /**< active internal token (reserved name) with missing token driver */
+       CRYPT_TOKEN_EXTERNAL,         /**< active external (user defined) token with driver */
+       CRYPT_TOKEN_EXTERNAL_UNKNOWN, /**< active external (user defined) token with missing token driver */
+} crypt_token_info;
+
+/**
+ * Get info for specific token.
+ *
+ * @param cd crypt device handle
+ * @param token existing token id
+ * @param type pointer for returned type string
+ *
+ * @return token status info. For any returned status (besides CRYPT_TOKEN_INVALID
+ *        and CRYPT_TOKEN_INACTIVE) and if type parameter is not NULL it will
+ *        contain address of type string.
+ *
+ * @note if required, create a copy of string referenced in *type before calling next
+ *      libcryptsetup API function. The reference may become invalid.
+ */
+crypt_token_info crypt_token_status(struct crypt_device *cd, int token, const char **type);
+
+/**
+ * LUKS2 keyring token parameters.
+ *
+ * @see crypt_token_builtin_set
+ *
+ */
+struct crypt_token_params_luks2_keyring {
+       const char *key_description; /**< Reference in keyring */
+};
+
+/**
+ * Create a new luks2 keyring token.
+ *
+ * @param cd crypt device handle
+ * @param token token id or @e CRYPT_ANY_TOKEN to allocate new one
+ * @param params luks2 keyring token params
+ *
+ * @return allocated token id or negative errno otherwise.
+ *
+ */
+int crypt_token_luks2_keyring_set(struct crypt_device *cd,
+       int token,
+       const struct crypt_token_params_luks2_keyring *params);
+
+/**
+ * Get LUKS2 keyring token params
+ *
+ * @param cd crypt device handle
+ * @param token existing luks2 keyring token id
+ * @param params returned luks2 keyring token params
+ *
+ * @return allocated token id or negative errno otherwise.
+ *
+ * @note do not call free() on params members. Members are valid only
+ *      until next libcryptsetup function is called.
+ */
+int crypt_token_luks2_keyring_get(struct crypt_device *cd,
+       int token,
+       struct crypt_token_params_luks2_keyring *params);
+
+/**
+ * Assign a token to particular keyslot.
+ * (There can be more keyslots assigned to one token id.)
+ *
+ * @param cd crypt device handle
+ * @param token token id
+ * @param keyslot keyslot to be assigned to token (CRYPT_ANY SLOT
+ *       assigns all active keyslots to token)
+ *
+ * @return allocated token id or negative errno otherwise.
+ */
+int crypt_token_assign_keyslot(struct crypt_device *cd,
+       int token,
+       int keyslot);
+
+/**
+ * Unassign a token from particular keyslot.
+ * (There can be more keyslots assigned to one token id.)
+ *
+ * @param cd crypt device handle
+ * @param token token id
+ * @param keyslot keyslot to be unassigned from token (CRYPT_ANY SLOT
+ *       unassigns all active keyslots from token)
+ *
+ * @return allocated token id or negative errno otherwise.
+ */
+int crypt_token_unassign_keyslot(struct crypt_device *cd,
+       int token,
+       int keyslot);
+
+/**
+ * Get info about token assignment to particular keyslot.
+ *
+ * @param cd crypt device handle
+ * @param token token id
+ * @param keyslot keyslot
+ *
+ * @return 0 on success (token exists and is assigned to the keyslot),
+ *        -ENOENT if token is not assigned to a keyslot (token, keyslot
+ *        or both may be inactive) or other negative errno otherwise.
+ */
+int crypt_token_is_assigned(struct crypt_device *cd,
+       int token,
+       int keyslot);
+
+/**
+ * Token handler open function prototype.
+ * This function retrieves password from a token and return allocated buffer
+ * containing this password. This buffer has to be deallocated by calling
+ * free() function and content should be wiped before deallocation.
+ *
+ * @param cd crypt device handle
+ * @param token token id
+ * @param buffer returned allocated buffer with password
+ * @param buffer_len length of the buffer
+ * @param usrptr user data in @link crypt_activate_by_token @endlink
+ */
+typedef int (*crypt_token_open_func) (
+       struct crypt_device *cd,
+       int token,
+       char **buffer,
+       size_t *buffer_len,
+       void *usrptr);
+
+/**
+ * Token handler buffer free function prototype.
+ * This function is used by library to free the buffer with keyslot
+ * passphrase when it's no longer needed. If not defined the library
+ * overwrites buffer with zeroes and call free().
+ *
+ * @param buffer the buffer with keyslot passphrase
+ * @param buffer_len the buffer length
+ */
+typedef void (*crypt_token_buffer_free_func) (void *buffer, size_t buffer_len);
+
+/**
+ * Token handler validate function prototype.
+ * This function validates JSON representation of user defined token for additional data
+ * specific for its token type. If defined in the handler, it's called
+ * during @link crypt_activate_by_token @endlink. It may also be called during
+ * @link crypt_token_json_set @endlink when appropriate token handler was registered before
+ * with @link crypt_token_register @endlink.
+ *
+ * @param cd crypt device handle
+ * @param json buffer with JSON
+ */
+typedef int (*crypt_token_validate_func) (struct crypt_device *cd, const char *json);
+
+/**
+ * Token handler dump function prototype.
+ * This function is supposed to print token implementation specific details. It gets
+ * called during @link crypt_dump @endlink if token handler was registered before.
+ *
+ * @param cd crypt device handle
+ * @param json buffer with token JSON
+ *
+ * @note dump implementations are advised to use @link crypt_log @endlink function
+ *      to dump token details.
+ */
+typedef void (*crypt_token_dump_func) (struct crypt_device *cd, const char *json);
+
+/**
+ * Token handler
+ */
+typedef struct  {
+       const char *name;           /**< token handler name */
+       crypt_token_open_func open; /**< token handler open function */
+       crypt_token_buffer_free_func buffer_free; /**< token handler buffer_free function (optional) */
+       crypt_token_validate_func validate; /**< token handler validate function (optional) */
+       crypt_token_dump_func dump; /**< token handler dump function (optional) */
+} crypt_token_handler;
+
+/**
+ * Register token handler
+ *
+ * @param handler token handler to register
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ */
+int crypt_token_register(const crypt_token_handler *handler);
+
+/**
+ * Activate device or check key using a token.
+ *
+ * @param cd crypt device handle
+ * @param name name of device to create, if @e NULL only check token
+ * @param token requested token to check or CRYPT_ANY_TOKEN to check all
+ * @param usrptr provided identification in callback
+ * @param flags activation flags
+ *
+ * @return unlocked key slot number or negative errno otherwise.
+ */
+int crypt_activate_by_token(struct crypt_device *cd,
+       const char *name,
+       int token,
+       void *usrptr,
+       uint32_t flags);
+/** @} */
+
+/**
+ * @defgroup crypt-reencryption LUKS2 volume reencryption support
+ *
+ * Set of functions to handling LUKS2 volume reencryption
+ *
+ * @addtogroup crypt-reencryption
+ * @{
+ */
+
+/** Initialize reencryption metadata but do not run reencryption yet. (in) */
+#define CRYPT_REENCRYPT_INITIALIZE_ONLY    (1 << 0)
+/** Move the first segment, used only with data shift. (in/out) */
+#define CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT (1 << 1)
+/** Resume already initialized reencryption only. (in) */
+#define CRYPT_REENCRYPT_RESUME_ONLY        (1 << 2)
+/** Run reencryption recovery only. (in) */
+#define CRYPT_REENCRYPT_RECOVERY           (1 << 3)
+
+/**
+ * Reencryption direction
+ */
+typedef enum {
+       CRYPT_REENCRYPT_FORWARD = 0, /**< forward direction */
+       CRYPT_REENCRYPT_BACKWARD     /**< backward direction */
+} crypt_reencrypt_direction_info;
+
+/**
+ * Reencryption mode
+ */
+typedef enum {
+       CRYPT_REENCRYPT_REENCRYPT = 0, /**< Reencryption mode */
+       CRYPT_REENCRYPT_ENCRYPT,       /**< Encryption mode */
+       CRYPT_REENCRYPT_DECRYPT,       /**< Decryption mode */
+} crypt_reencrypt_mode_info;
+
+/**
+ * LUKS2 reencryption options.
+ */
+struct crypt_params_reencrypt {
+       crypt_reencrypt_mode_info mode;           /**< Reencryption mode, immutable after first init. */
+       crypt_reencrypt_direction_info direction; /**< Reencryption direction, immutable after first init. */
+       const char *resilience;                   /**< Resilience mode: "none", "checksum", "journal" or "shift" (only "shift" is immutable after init) */
+       const char *hash;                         /**< Used hash for "checksum" resilience type, ignored otherwise. */
+       uint64_t data_shift;                      /**< Used in "shift" mode, must be non-zero, immutable after first init. */
+       uint64_t max_hotzone_size;                /**< Exact hotzone size for "none" mode. Maximum hotzone size for "checksum" and "journal" modes. */
+       uint64_t device_size;                     /**< Reencrypt only initial part of the data device. */
+       const struct crypt_params_luks2 *luks2;   /**< LUKS2 parameters for the final reencryption volume.*/
+       uint32_t flags;                           /**< Reencryption flags. */
+};
+
+/**
+ * Initialize reencryption metadata using passphrase.
+ *
+ * This function initializes on-disk metadata to include all reencryption segments,
+ * according to the provided options.
+ * If metadata already contains ongoing reencryption metadata, it loads these parameters
+ * (in this situation all parameters except @e name and @e passphrase can be omitted).
+ *
+ * @param cd crypt device handle
+ * @param name name of active device or @e NULL for offline reencryption
+ * @param passphrase passphrase used to unlock volume key
+ * @param passphrase_size size of @e passphrase (binary data)
+ * @param keyslot_old keyslot to unlock existing device or CRYPT_ANY_SLOT
+ * @param keyslot_new existing (unbound) reencryption keyslot; must be set except for decryption
+ * @param cipher cipher specification (e.g. "aes")
+ * @param cipher_mode cipher mode and IV (e.g. "xts-plain64")
+ * @param params reencryption parameters @link crypt_params_reencrypt @endlink.
+ *
+ * @return reencryption key slot number or negative errno otherwise.
+ */
+int crypt_reencrypt_init_by_passphrase(struct crypt_device *cd,
+       const char *name,
+       const char *passphrase,
+       size_t passphrase_size,
+       int keyslot_old,
+       int keyslot_new,
+       const char *cipher,
+       const char *cipher_mode,
+       const struct crypt_params_reencrypt *params);
+
+/**
+ * Initialize reencryption metadata using passphrase in keyring.
+ *
+ * This function initializes on-disk metadata to include all reencryption segments,
+ * according to the provided options.
+ * If metadata already contains ongoing reencryption metadata, it loads these parameters
+ * (in this situation all parameters except @e name and @e key_description can be omitted).
+ *
+ * @param cd crypt device handle
+ * @param name name of active device or @e NULL for offline reencryption
+ * @param key_description passphrase (key) identification in keyring
+ * @param keyslot_old keyslot to unlock existing device or CRYPT_ANY_SLOT
+ * @param keyslot_new existing (unbound) reencryption keyslot; must be set except for decryption
+ * @param cipher cipher specification (e.g. "aes")
+ * @param cipher_mode cipher mode and IV (e.g. "xts-plain64")
+ * @param params reencryption parameters @link crypt_params_reencrypt @endlink.
+ *
+ * @return reencryption key slot number or negative errno otherwise.
+ */
+int crypt_reencrypt_init_by_keyring(struct crypt_device *cd,
+       const char *name,
+       const char *key_description,
+       int keyslot_old,
+       int keyslot_new,
+       const char *cipher,
+       const char *cipher_mode,
+       const struct crypt_params_reencrypt *params);
+
+/**
+ * Run data reencryption.
+ *
+ * @param cd crypt device handle
+ * @param progress is a callback funtion reporting device \b size,
+ * current \b offset of reencryption and provided \b usrptr identification
+ *
+ * @return @e 0 on success or negative errno value otherwise.
+ */
+int crypt_reencrypt(struct crypt_device *cd,
+                   int (*progress)(uint64_t size, uint64_t offset, void *usrptr));
+
+/**
+ * Reencryption status info
+ */
+typedef enum {
+       CRYPT_REENCRYPT_NONE = 0, /**< No reencryption in progress */
+       CRYPT_REENCRYPT_CLEAN,    /**< Ongoing reencryption in a clean state. */
+       CRYPT_REENCRYPT_CRASH,    /**< Aborted reencryption that need internal recovery. */
+       CRYPT_REENCRYPT_INVALID   /**< Invalid state. */
+} crypt_reencrypt_info;
+
+/**
+ * LUKS2 reencryption status.
+ *
+ * @param cd crypt device handle
+ * @param params reencryption parameters
+ *
+ * @return reencryption status info and parameters.
+ */
+crypt_reencrypt_info crypt_reencrypt_status(struct crypt_device *cd,
+               struct crypt_params_reencrypt *params);
+/** @} */
+
+/**
+ * @defgroup crypt-memory Safe memory helpers functions
+ * @addtogroup crypt-memory
+ * @{
+ */
+
+/**
+ * Allocate safe memory (content is safely wiped on deallocation).
+ *
+ * @param size size of memory in bytes
+ *
+ * @return pointer to allocate memory or @e NULL.
+ */
+void *crypt_safe_alloc(size_t size);
+
+/**
+ * Release safe memory, content is safely wiped
+ * The pointer must be allocated with @link crypt_safe_alloc @endlink
+ *
+ * @param data pointer to memory to be deallocated
+ *
+ * @return pointer to allocate memory or @e NULL.
+ */
+void crypt_safe_free(void *data);
+
+/**
+ * Reallocate safe memory (content is copied and safely wiped on deallocation).
+ *
+ * @param data pointer to memory to be deallocated
+ * @param size new size of memory in bytes
+ *
+ * @return pointer to allocate memory or @e NULL.
+ */
+void *crypt_safe_realloc(void *data, size_t size);
+
+/**
+ * Safe clear memory area (compile should not compile this call out).
+ *
+ * @param data pointer to memory to cleared
+ * @param size new size of memory in bytes
+ *
+ * @return pointer to allocate memory or @e NULL.
+ */
+void crypt_safe_memzero(void *data, size_t size);
 
 /** @} */
 
index 27c5cb4..59a998c 100644 (file)
@@ -1,21 +1,24 @@
-CRYPTSETUP_1.0 {
+CRYPTSETUP_2.0 {
        global:
                crypt_init;
+               crypt_init_data_device;
                crypt_init_by_name;
                crypt_init_by_name_and_header;
+
                crypt_set_log_callback;
                crypt_set_confirm_callback;
-               crypt_set_password_callback;
-               crypt_set_timeout;
-               crypt_set_password_retry;
-               crypt_set_iterarion_time;
                crypt_set_iteration_time;
-               crypt_set_password_verify;
                crypt_set_uuid;
+               crypt_set_label;
                crypt_set_data_device;
 
+               crypt_set_compatibility;
+               crypt_get_compatibility;
+
                crypt_memory_lock;
+               crypt_metadata_locking;
                crypt_format;
+               crypt_convert;
                crypt_load;
                crypt_repair;
                crypt_resize;
@@ -23,51 +26,108 @@ CRYPTSETUP_1.0 {
                crypt_resume_by_passphrase;
                crypt_resume_by_keyfile;
                crypt_resume_by_keyfile_offset;
+               crypt_resume_by_keyfile_device_offset;
+               crypt_resume_by_volume_key;
                crypt_free;
 
                crypt_keyslot_add_by_passphrase;
                crypt_keyslot_change_by_passphrase;
                crypt_keyslot_add_by_keyfile;
                crypt_keyslot_add_by_keyfile_offset;
+               crypt_keyslot_add_by_keyfile_device_offset;
                crypt_keyslot_add_by_volume_key;
+               crypt_keyslot_add_by_key;
+
+               crypt_keyslot_set_priority;
+               crypt_keyslot_get_priority;
+
+               crypt_token_json_get;
+               crypt_token_json_set;
+               crypt_token_status;
+               crypt_token_luks2_keyring_get;
+               crypt_token_luks2_keyring_set;
+               crypt_token_assign_keyslot;
+               crypt_token_unassign_keyslot;
+               crypt_token_is_assigned;
+               crypt_token_register;
+
+               crypt_activate_by_token;
+
                crypt_keyslot_destroy;
                crypt_activate_by_passphrase;
                crypt_activate_by_keyfile;
                crypt_activate_by_keyfile_offset;
+               crypt_activate_by_keyfile_device_offset;
                crypt_activate_by_volume_key;
+               crypt_activate_by_signed_key;
+               crypt_activate_by_keyring;
                crypt_deactivate;
+               crypt_deactivate_by_name;
                crypt_volume_key_get;
                crypt_volume_key_verify;
+               crypt_volume_key_keyring;
                crypt_status;
                crypt_dump;
                crypt_benchmark;
-               crypt_benchmark_kdf;
+               crypt_benchmark_pbkdf;
                crypt_get_cipher;
                crypt_get_cipher_mode;
+               crypt_get_integrity_info;
                crypt_get_uuid;
+               crypt_set_data_offset;
                crypt_get_data_offset;
                crypt_get_iv_offset;
                crypt_get_volume_key_size;
                crypt_get_device_name;
+               crypt_get_metadata_device_name;
+               crypt_get_metadata_size;
+               crypt_set_metadata_size;
                crypt_get_verity_info;
+               crypt_get_sector_size;
 
                crypt_get_type;
+               crypt_get_default_type;
                crypt_get_active_device;
+               crypt_get_active_integrity_failures;
+               crypt_persistent_flags_set;
+               crypt_persistent_flags_get;
 
                crypt_set_rng_type;
                crypt_get_rng_type;
+               crypt_set_pbkdf_type;
+               crypt_get_pbkdf_type;
+               crypt_get_pbkdf_type_params;
+               crypt_get_pbkdf_default;
 
                crypt_keyslot_max;
                crypt_keyslot_area;
                crypt_keyslot_status;
-               crypt_last_error;
-               crypt_get_error;
+               crypt_keyslot_get_key_size;
+               crypt_keyslot_set_encryption;
+               crypt_keyslot_get_encryption;
+               crypt_keyslot_get_pbkdf;
+
                crypt_get_dir;
                crypt_set_debug_level;
                crypt_log;
 
                crypt_header_backup;
                crypt_header_restore;
+
+               crypt_keyfile_read;
+               crypt_keyfile_device_read;
+
+               crypt_wipe;
+
+               crypt_reencrypt_init_by_passphrase;
+               crypt_reencrypt_init_by_keyring;
+               crypt_reencrypt;
+               crypt_reencrypt_status;
+
+               crypt_safe_alloc;
+               crypt_safe_realloc;
+               crypt_safe_free;
+               crypt_safe_memzero;
        local:
                *;
 };
index 316fa5f..a82163b 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * libdevmapper - device-mapper backend for cryptsetup
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2015, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2015, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include <stdio.h>
+#include <stdbool.h>
+#include <ctype.h>
 #include <dirent.h>
 #include <errno.h>
 #include <libdevmapper.h>
-#include <fcntl.h>
 #include <linux/fs.h>
 #include <uuid/uuid.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+# include <sys/sysmacros.h>     /* for major, minor */
+#endif
 
 #include "internal.h"
 
 #define DM_UUID_LEN            129
+#define DM_BY_ID_PREFIX                "dm-uuid-"
+#define DM_BY_ID_PREFIX_LEN    8
 #define DM_UUID_PREFIX         "CRYPT-"
 #define DM_UUID_PREFIX_LEN     6
 #define DM_CRYPT_TARGET                "crypt"
 #define DM_VERITY_TARGET       "verity"
+#define DM_INTEGRITY_TARGET    "integrity"
+#define DM_LINEAR_TARGET       "linear"
+#define DM_ERROR_TARGET         "error"
+#define DM_ZERO_TARGET         "zero"
 #define RETRY_COUNT            5
 
-/* Set if dm-crypt version was probed */
-static int _dm_crypt_checked = 0;
+/* Set if DM target versions were probed */
+static bool _dm_ioctl_checked = false;
+static bool _dm_crypt_checked = false;
+static bool _dm_verity_checked = false;
+static bool _dm_integrity_checked = false;
+
 static int _quiet_log = 0;
-static uint32_t _dm_crypt_flags = 0;
+static uint32_t _dm_flags = 0;
 
 static struct crypt_device *_context = NULL;
 static int _dm_use_count = 0;
@@ -86,96 +101,194 @@ static void set_dm_error(int level,
        if (vasprintf(&msg, f, va) > 0) {
                if (level < 4 && !_quiet_log) {
                        log_err(_context, "%s", msg);
-                       log_err(_context, "\n");
                } else {
                        /* We do not use DM visual stack backtrace here */
                        if (strncmp(msg, "<backtrace>", 11))
-                               log_dbg("%s", msg);
+                               log_dbg(_context, "%s", msg);
                }
        }
        free(msg);
        va_end(va);
 }
 
-static int _dm_simple(int task, const char *name, int udev_wait);
-
-static int _dm_satisfies_version(unsigned target_maj, unsigned target_min,
-                                unsigned actual_maj, unsigned actual_min)
+static int _dm_satisfies_version(unsigned target_maj, unsigned target_min, unsigned target_patch,
+                                unsigned actual_maj, unsigned actual_min, unsigned actual_patch)
 {
        if (actual_maj > target_maj)
                return 1;
 
-       if (actual_maj == target_maj && actual_min >= target_min)
+       if (actual_maj == target_maj && actual_min > target_min)
+               return 1;
+
+       if (actual_maj == target_maj && actual_min == target_min && actual_patch >= target_patch)
                return 1;
 
        return 0;
 }
 
-static void _dm_set_crypt_compat(const char *dm_version, unsigned crypt_maj,
-                                unsigned crypt_min, unsigned crypt_patch)
+static void _dm_set_crypt_compat(struct crypt_device *cd,
+                                unsigned crypt_maj,
+                                unsigned crypt_min,
+                                unsigned crypt_patch)
 {
-       unsigned dm_maj, dm_min, dm_patch;
+       if (_dm_crypt_checked || crypt_maj == 0)
+               return;
 
-       if (sscanf(dm_version, "%u.%u.%u", &dm_maj, &dm_min, &dm_patch) != 3)
-               dm_maj = dm_min = dm_patch = 0;
+       log_dbg(cd, "Detected dm-crypt version %i.%i.%i.",
+               crypt_maj, crypt_min, crypt_patch);
 
-       log_dbg("Detected dm-crypt version %i.%i.%i, dm-ioctl version %u.%u.%u.",
-               crypt_maj, crypt_min, crypt_patch, dm_maj, dm_min, dm_patch);
-
-       if (_dm_satisfies_version(1, 2, crypt_maj, crypt_min))
-               _dm_crypt_flags |= DM_KEY_WIPE_SUPPORTED;
+       if (_dm_satisfies_version(1, 2, 0, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_KEY_WIPE_SUPPORTED;
        else
-               log_dbg("Suspend and resume disabled, no wipe key support.");
-
-       if (_dm_satisfies_version(1, 10, crypt_maj, crypt_min))
-               _dm_crypt_flags |= DM_LMK_SUPPORTED;
+               log_dbg(cd, "Suspend and resume disabled, no wipe key support.");
 
-       if (_dm_satisfies_version(4, 20, dm_maj, dm_min))
-               _dm_crypt_flags |= DM_SECURE_SUPPORTED;
+       if (_dm_satisfies_version(1, 10, 0, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_LMK_SUPPORTED;
 
        /* not perfect, 2.6.33 supports with 1.7.0 */
-       if (_dm_satisfies_version(1, 8, crypt_maj, crypt_min))
-               _dm_crypt_flags |= DM_PLAIN64_SUPPORTED;
+       if (_dm_satisfies_version(1, 8, 0, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_PLAIN64_SUPPORTED;
 
-       if (_dm_satisfies_version(1, 11, crypt_maj, crypt_min))
-               _dm_crypt_flags |= DM_DISCARDS_SUPPORTED;
+       if (_dm_satisfies_version(1, 11, 0, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_DISCARDS_SUPPORTED;
 
-       if (_dm_satisfies_version(1, 13, crypt_maj, crypt_min))
-               _dm_crypt_flags |= DM_TCW_SUPPORTED;
+       if (_dm_satisfies_version(1, 13, 0, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_TCW_SUPPORTED;
 
-       if (_dm_satisfies_version(1, 14, crypt_maj, crypt_min)) {
-               _dm_crypt_flags |= DM_SAME_CPU_CRYPT_SUPPORTED;
-               _dm_crypt_flags |= DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED;
+       if (_dm_satisfies_version(1, 14, 0, crypt_maj, crypt_min, crypt_patch)) {
+               _dm_flags |= DM_SAME_CPU_CRYPT_SUPPORTED;
+               _dm_flags |= DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED;
        }
 
-       /* Repeat test if dm-crypt is not present */
-       if (crypt_maj > 0)
-               _dm_crypt_checked = 1;
+       if (_dm_satisfies_version(1, 18, 1, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_KERNEL_KEYRING_SUPPORTED;
+
+       if (_dm_satisfies_version(1, 17, 0, crypt_maj, crypt_min, crypt_patch)) {
+               _dm_flags |= DM_SECTOR_SIZE_SUPPORTED;
+               _dm_flags |= DM_CAPI_STRING_SUPPORTED;
+       }
+
+       if (_dm_satisfies_version(1, 19, 0, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_BITLK_EBOIV_SUPPORTED;
+
+       if (_dm_satisfies_version(1, 20, 0, crypt_maj, crypt_min, crypt_patch))
+               _dm_flags |= DM_BITLK_ELEPHANT_SUPPORTED;
+
+       _dm_crypt_checked = true;
 }
 
-static void _dm_set_verity_compat(const char *dm_version, unsigned verity_maj,
-                                  unsigned verity_min, unsigned verity_patch)
+static void _dm_set_verity_compat(struct crypt_device *cd,
+                                 unsigned verity_maj,
+                                 unsigned verity_min,
+                                 unsigned verity_patch)
 {
-       if (verity_maj > 0)
-               _dm_crypt_flags |= DM_VERITY_SUPPORTED;
+       if (_dm_verity_checked || verity_maj == 0)
+               return;
 
-       log_dbg("Detected dm-verity version %i.%i.%i.",
+       log_dbg(cd, "Detected dm-verity version %i.%i.%i.",
                verity_maj, verity_min, verity_patch);
+
+       _dm_flags |= DM_VERITY_SUPPORTED;
+
+       /*
+        * ignore_corruption, restart_on corruption is available since 1.2 (kernel 4.1)
+        * ignore_zero_blocks since 1.3 (kernel 4.5)
+        * (but some dm-verity targets 1.2 don't support it)
+        * FEC is added in 1.3 as well.
+        * Check at most once is added in 1.4 (kernel 4.17).
+        */
+       if (_dm_satisfies_version(1, 3, 0, verity_maj, verity_min, verity_patch)) {
+               _dm_flags |= DM_VERITY_ON_CORRUPTION_SUPPORTED;
+               _dm_flags |= DM_VERITY_FEC_SUPPORTED;
+       }
+
+       if (_dm_satisfies_version(1, 5, 0, verity_maj, verity_min, verity_patch))
+               _dm_flags |= DM_VERITY_SIGNATURE_SUPPORTED;
+
+       _dm_verity_checked = true;
+}
+
+static void _dm_set_integrity_compat(struct crypt_device *cd,
+                                    unsigned integrity_maj,
+                                    unsigned integrity_min,
+                                    unsigned integrity_patch)
+{
+       if (_dm_integrity_checked || integrity_maj == 0)
+               return;
+
+       log_dbg(cd, "Detected dm-integrity version %i.%i.%i.",
+               integrity_maj, integrity_min, integrity_patch);
+
+       _dm_flags |= DM_INTEGRITY_SUPPORTED;
+
+       if (_dm_satisfies_version(1, 2, 0, integrity_maj, integrity_min, integrity_patch))
+               _dm_flags |= DM_INTEGRITY_RECALC_SUPPORTED;
+
+       if (_dm_satisfies_version(1, 3, 0, integrity_maj, integrity_min, integrity_patch))
+               _dm_flags |= DM_INTEGRITY_BITMAP_SUPPORTED;
+
+       if (_dm_satisfies_version(1, 4, 0, integrity_maj, integrity_min, integrity_patch))
+               _dm_flags |= DM_INTEGRITY_FIX_PADDING_SUPPORTED;
+
+       if (_dm_satisfies_version(1, 6, 0, integrity_maj, integrity_min, integrity_patch))
+               _dm_flags |= DM_INTEGRITY_DISCARDS_SUPPORTED;
+
+       _dm_integrity_checked = true;
+}
+
+/* We use this for loading target module */
+static void _dm_check_target(dm_target_type target_type)
+{
+#if HAVE_DECL_DM_DEVICE_GET_TARGET_VERSION
+       struct dm_task *dmt;
+       const char *target_name = NULL;
+
+       if (!(_dm_flags & DM_GET_TARGET_VERSION_SUPPORTED))
+               return;
+
+       if (target_type == DM_CRYPT)
+               target_name = DM_CRYPT_TARGET;
+       else if (target_type == DM_VERITY)
+               target_name = DM_VERITY_TARGET;
+       else if (target_type == DM_INTEGRITY)
+               target_name = DM_INTEGRITY_TARGET;
+       else
+               return;
+
+       if (!(dmt = dm_task_create(DM_DEVICE_GET_TARGET_VERSION)))
+               goto out;
+
+       if (!dm_task_set_name(dmt, target_name))
+               goto out;
+
+       if (!dm_task_run(dmt))
+               goto out;
+out:
+       if (dmt)
+               dm_task_destroy(dmt);
+#endif
 }
 
-static int _dm_check_versions(void)
+static int _dm_check_versions(struct crypt_device *cd, dm_target_type target_type)
 {
        struct dm_task *dmt;
        struct dm_versions *target, *last_target;
        char dm_version[16];
+       unsigned dm_maj, dm_min, dm_patch;
        int r = 0;
 
-       if (_dm_crypt_checked)
+       if ((target_type == DM_CRYPT     && _dm_crypt_checked) ||
+           (target_type == DM_VERITY    && _dm_verity_checked) ||
+           (target_type == DM_INTEGRITY && _dm_integrity_checked) ||
+           (target_type == DM_LINEAR) || (target_type == DM_ZERO) ||
+           (_dm_crypt_checked && _dm_verity_checked && _dm_integrity_checked))
                return 1;
 
        /* Shut up DM while checking */
        _quiet_log = 1;
 
+       _dm_check_target(target_type);
+
        /* FIXME: add support to DM so it forces crypt target module load here */
        if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
                goto out;
@@ -186,26 +299,48 @@ static int _dm_check_versions(void)
        if (!dm_task_get_driver_version(dmt, dm_version, sizeof(dm_version)))
                goto out;
 
+       if (!_dm_ioctl_checked) {
+               if (sscanf(dm_version, "%u.%u.%u", &dm_maj, &dm_min, &dm_patch) != 3)
+                       goto out;
+               log_dbg(cd, "Detected dm-ioctl version %u.%u.%u.", dm_maj, dm_min, dm_patch);
+
+               if (_dm_satisfies_version(4, 20, 0, dm_maj, dm_min, dm_patch))
+                       _dm_flags |= DM_SECURE_SUPPORTED;
+#if HAVE_DECL_DM_TASK_DEFERRED_REMOVE
+               if (_dm_satisfies_version(4, 27, 0, dm_maj, dm_min, dm_patch))
+                       _dm_flags |= DM_DEFERRED_SUPPORTED;
+#endif
+#if HAVE_DECL_DM_DEVICE_GET_TARGET_VERSION
+               if (_dm_satisfies_version(4, 41, 0, dm_maj, dm_min, dm_patch))
+                       _dm_flags |= DM_GET_TARGET_VERSION_SUPPORTED;
+#endif
+       }
+
        target = dm_task_get_versions(dmt);
        do {
                last_target = target;
                if (!strcmp(DM_CRYPT_TARGET, target->name)) {
-                       _dm_set_crypt_compat(dm_version,
-                                            (unsigned)target->version[0],
+                       _dm_set_crypt_compat(cd, (unsigned)target->version[0],
                                             (unsigned)target->version[1],
                                             (unsigned)target->version[2]);
                } else if (!strcmp(DM_VERITY_TARGET, target->name)) {
-                       _dm_set_verity_compat(dm_version,
-                                            (unsigned)target->version[0],
-                                            (unsigned)target->version[1],
-                                            (unsigned)target->version[2]);
+                       _dm_set_verity_compat(cd, (unsigned)target->version[0],
+                                             (unsigned)target->version[1],
+                                             (unsigned)target->version[2]);
+               } else if (!strcmp(DM_INTEGRITY_TARGET, target->name)) {
+                       _dm_set_integrity_compat(cd, (unsigned)target->version[0],
+                                                (unsigned)target->version[1],
+                                                (unsigned)target->version[2]);
                }
                target = (struct dm_versions *)((char *) target + target->next);
        } while (last_target != target);
 
        r = 1;
-       log_dbg("Device-mapper backend running with UDEV support %sabled.",
-               _dm_use_udev() ? "en" : "dis");
+       if (!_dm_ioctl_checked)
+               log_dbg(cd, "Device-mapper backend running with UDEV support %sabled.",
+                       _dm_use_udev() ? "en" : "dis");
+
+       _dm_ioctl_checked = true;
 out:
        if (dmt)
                dm_task_destroy(dmt);
@@ -214,26 +349,38 @@ out:
        return r;
 }
 
-uint32_t dm_flags(void)
+int dm_flags(struct crypt_device *cd, dm_target_type target, uint32_t *flags)
 {
-       _dm_check_versions();
-       return _dm_crypt_flags;
+       _dm_check_versions(cd, target);
+       *flags = _dm_flags;
+
+       if (target == DM_UNKNOWN &&
+           _dm_crypt_checked && _dm_verity_checked && _dm_integrity_checked)
+               return 0;
+
+       if ((target == DM_CRYPT     && _dm_crypt_checked) ||
+           (target == DM_VERITY    && _dm_verity_checked) ||
+           (target == DM_INTEGRITY && _dm_integrity_checked) ||
+           (target == DM_LINEAR) || (target == DM_ZERO)) /* nothing to check */
+               return 0;
+
+       return -ENODEV;
 }
 
 /* This doesn't run any kernel checks, just set up userspace libdevmapper */
-void dm_backend_init(void)
+void dm_backend_init(struct crypt_device *cd)
 {
        if (!_dm_use_count++) {
-               log_dbg("Initialising device-mapper backend library.");
+               log_dbg(cd, "Initialising device-mapper backend library.");
                dm_log_init(set_dm_error);
                dm_log_init_verbose(10);
        }
 }
 
-void dm_backend_exit(void)
+void dm_backend_exit(struct crypt_device *cd)
 {
        if (_dm_use_count && (!--_dm_use_count)) {
-               log_dbg("Releasing device-mapper backend.");
+               log_dbg(cd, "Releasing device-mapper backend.");
                dm_log_init_verbose(0);
                dm_log_init(NULL);
                dm_lib_release();
@@ -244,16 +391,16 @@ void dm_backend_exit(void)
  * libdevmapper is not context friendly, switch context on every DM call.
  * FIXME: this is not safe if called in parallel but neither is DM lib.
  */
-static int dm_init_context(struct crypt_device *cd)
+static int dm_init_context(struct crypt_device *cd, dm_target_type target)
 {
        _context = cd;
-       if (!_dm_check_versions()) {
+       if (!_dm_check_versions(cd, target)) {
                if (getuid() || geteuid())
                        log_err(cd, _("Cannot initialize device-mapper, "
-                                     "running as non-root user.\n"));
+                                     "running as non-root user."));
                else
                        log_err(cd, _("Cannot initialize device-mapper. "
-                                     "Is dm_mod kernel module loaded?\n"));
+                                     "Is dm_mod kernel module loaded?"));
                _context = NULL;
                return -ENOTSUP;
        }
@@ -275,6 +422,7 @@ char *dm_device_path(const char *prefix, int major, int minor)
                return NULL;
        if (!dm_task_set_minor(dmt, minor) ||
            !dm_task_set_major(dmt, major) ||
+           !dm_task_no_flush(dmt) ||
            !dm_task_run(dmt) ||
            !(name = dm_task_get_name(dmt))) {
                dm_task_destroy(dmt);
@@ -289,6 +437,16 @@ char *dm_device_path(const char *prefix, int major, int minor)
        return strdup(path);
 }
 
+char *dm_device_name(const char *path)
+{
+       struct stat st;
+
+       if (stat(path, &st) < 0 || !S_ISBLK(st.st_mode))
+               return NULL;
+
+       return dm_device_path(NULL, major(st.st_rdev), minor(st.st_rdev));
+}
+
 static void hex_key(char *hexkey, size_t key_size, const char *key)
 {
        unsigned i;
@@ -297,14 +455,158 @@ static void hex_key(char *hexkey, size_t key_size, const char *key)
                sprintf(&hexkey[i * 2], "%02x", (unsigned char)key[i]);
 }
 
+static size_t int_log10(uint64_t x)
+{
+       uint64_t r = 0;
+       for (x /= 10; x > 0; x /= 10)
+               r++;
+       return r;
+}
+
+#define CLEN    64   /* 2*MAX_CIPHER_LEN */
+#define CLENS  "63"  /* for sscanf length + '\0' */
+#define CAPIL  144   /* should be enough to fit whole capi string */
+#define CAPIS "143"  /* for sscanf of crypto API string + 16  + \0 */
+
+static int cipher_c2dm(const char *org_c, const char *org_i, unsigned tag_size,
+                      char *c_dm, int c_dm_size,
+                      char *i_dm, int i_dm_size)
+{
+       int c_size = 0, i_size = 0, i;
+       char cipher[CLEN], mode[CLEN], iv[CLEN+1], tmp[CLEN];
+       char capi[CAPIL];
+
+       if (!c_dm || !c_dm_size || !i_dm || !i_dm_size)
+               return -EINVAL;
+
+       i = sscanf(org_c, "%" CLENS "[^-]-%" CLENS "s", cipher, tmp);
+       if (i != 2)
+               return -EINVAL;
+
+       i = sscanf(tmp, "%" CLENS "[^-]-%" CLENS "s", mode, iv);
+       if (i == 1) {
+               memset(iv, 0, sizeof(iv));
+               strncpy(iv, mode, sizeof(iv)-1);
+               *mode = '\0';
+               if (snprintf(capi, sizeof(capi), "%s", cipher) < 0)
+                       return -EINVAL;
+       } else if (i == 2) {
+               if (snprintf(capi, sizeof(capi), "%s(%s)", mode, cipher) < 0)
+                       return -EINVAL;
+       } else
+               return -EINVAL;
+
+       if (!org_i) {
+               /* legacy mode: CIPHER-MODE-IV*/
+               i_size = snprintf(i_dm, i_dm_size, "%s", "");
+               c_size = snprintf(c_dm, c_dm_size, "%s", org_c);
+       } else if (!strcmp(org_i, "none")) {
+               /* IV only: capi:MODE(CIPHER)-IV */
+               i_size = snprintf(i_dm, i_dm_size, " integrity:%u:none", tag_size);
+               c_size = snprintf(c_dm, c_dm_size, "capi:%s-%s", capi, iv);
+       } else if (!strcmp(org_i, "aead") && !strcmp(mode, "ccm")) {
+               /* CCM AEAD: capi:rfc4309(MODE(CIPHER))-IV */
+               i_size = snprintf(i_dm, i_dm_size, " integrity:%u:aead", tag_size);
+               c_size = snprintf(c_dm, c_dm_size, "capi:rfc4309(%s)-%s", capi, iv);
+       } else if (!strcmp(org_i, "aead")) {
+               /* AEAD: capi:MODE(CIPHER))-IV */
+               i_size = snprintf(i_dm, i_dm_size, " integrity:%u:aead", tag_size);
+               c_size = snprintf(c_dm, c_dm_size, "capi:%s-%s", capi, iv);
+       } else if (!strcmp(org_i, "poly1305")) {
+               /* POLY1305 AEAD: capi:rfc7539(MODE(CIPHER),POLY1305)-IV */
+               i_size = snprintf(i_dm, i_dm_size, " integrity:%u:aead", tag_size);
+               c_size = snprintf(c_dm, c_dm_size, "capi:rfc7539(%s,poly1305)-%s", capi, iv);
+       } else {
+               /* other AEAD: capi:authenc(<AUTH>,MODE(CIPHER))-IV */
+               i_size = snprintf(i_dm, i_dm_size, " integrity:%u:aead", tag_size);
+               c_size = snprintf(c_dm, c_dm_size, "capi:authenc(%s,%s)-%s", org_i, capi, iv);
+       }
+
+       if (c_size < 0 || c_size == c_dm_size)
+               return -EINVAL;
+       if (i_size < 0 || i_size == i_dm_size)
+               return -EINVAL;
+
+       return 0;
+}
+
+static int cipher_dm2c(char **org_c, char **org_i, const char *c_dm, const char *i_dm)
+{
+       char cipher[CLEN], mode[CLEN], iv[CLEN], auth[CLEN];
+       char tmp[CAPIL], dmcrypt_tmp[CAPIL*2], capi[CAPIL+1];
+       size_t len;
+       int i;
+
+       if (!c_dm)
+               return -EINVAL;
+
+       /* legacy mode */
+       if (strncmp(c_dm, "capi:", 4)) {
+               if (!(*org_c = strdup(c_dm)))
+                       return -ENOMEM;
+               *org_i = NULL;
+               return 0;
+       }
+
+       /* modes with capi: prefix */
+       i = sscanf(c_dm, "capi:%" CAPIS "[^-]-%" CLENS "s", tmp, iv);
+       if (i != 2)
+               return -EINVAL;
+
+       len = strlen(tmp);
+       if (len < 2)
+               return -EINVAL;
+
+       if (tmp[len-1] == ')')
+               tmp[len-1] = '\0';
+
+       if (sscanf(tmp, "rfc4309(%" CAPIS "s", capi) == 1) {
+               if (!(*org_i = strdup("aead")))
+                       return -ENOMEM;
+       } else if (sscanf(tmp, "rfc7539(%" CAPIS "[^,],%" CLENS "s", capi, auth) == 2) {
+               if (!(*org_i = strdup(auth)))
+                       return -ENOMEM;
+       } else if (sscanf(tmp, "authenc(%" CLENS "[^,],%" CAPIS "s", auth, capi) == 2) {
+               if (!(*org_i = strdup(auth)))
+                       return -ENOMEM;
+       } else {
+               if (i_dm) {
+                       if (!(*org_i = strdup(i_dm)))
+                               return -ENOMEM;
+               } else
+                       *org_i = NULL;
+               memset(capi, 0, sizeof(capi));
+               strncpy(capi, tmp, sizeof(capi)-1);
+       }
+
+       i = sscanf(capi, "%" CLENS "[^(](%" CLENS "[^)])", mode, cipher);
+       if (i == 2)
+               snprintf(dmcrypt_tmp, sizeof(dmcrypt_tmp), "%s-%s-%s", cipher, mode, iv);
+       else
+               snprintf(dmcrypt_tmp, sizeof(dmcrypt_tmp), "%s-%s", capi, iv);
+
+       if (!(*org_c = strdup(dmcrypt_tmp))) {
+               free(*org_i);
+               *org_i = NULL;
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
 /* https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt */
-static char *get_dm_crypt_params(struct crypt_dm_active_device *dmd, uint32_t flags)
+static char *get_dm_crypt_params(const struct dm_target *tgt, uint32_t flags)
 {
-       int r, max_size, null_cipher = 0, num_options = 0;
+       int r, max_size, null_cipher = 0, num_options = 0, keystr_len = 0;
        char *params, *hexkey;
-       char features[256];
+       char sector_feature[32], features[512], integrity_dm[256], cipher_dm[256];
 
-       if (!dmd)
+       if (!tgt)
+               return NULL;
+
+       r = cipher_c2dm(tgt->u.crypt.cipher, tgt->u.crypt.integrity, tgt->u.crypt.tag_size,
+                       cipher_dm, sizeof(cipher_dm), integrity_dm, sizeof(integrity_dm));
+       if (r < 0)
                return NULL;
 
        if (flags & CRYPT_ACTIVATE_ALLOW_DISCARDS)
@@ -313,37 +615,60 @@ static char *get_dm_crypt_params(struct crypt_dm_active_device *dmd, uint32_t fl
                num_options++;
        if (flags & CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS)
                num_options++;
+       if (flags & CRYPT_ACTIVATE_IV_LARGE_SECTORS)
+               num_options++;
+       if (tgt->u.crypt.integrity)
+               num_options++;
 
-       if (num_options)
-               snprintf(features, sizeof(features)-1, " %d%s%s%s", num_options,
+       if (tgt->u.crypt.sector_size != SECTOR_SIZE) {
+               num_options++;
+               snprintf(sector_feature, sizeof(sector_feature), " sector_size:%u", tgt->u.crypt.sector_size);
+       } else
+               *sector_feature = '\0';
+
+       if (num_options) {
+               snprintf(features, sizeof(features)-1, " %d%s%s%s%s%s%s", num_options,
                (flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) ? " allow_discards" : "",
                (flags & CRYPT_ACTIVATE_SAME_CPU_CRYPT) ? " same_cpu_crypt" : "",
-               (flags & CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS) ? " submit_from_crypt_cpus" : "");
-       else
+               (flags & CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS) ? " submit_from_crypt_cpus" : "",
+               (flags & CRYPT_ACTIVATE_IV_LARGE_SECTORS) ? " iv_large_sectors" : "",
+               sector_feature, integrity_dm);
+       } else
                *features = '\0';
 
-       if (!strncmp(dmd->u.crypt.cipher, "cipher_null-", 12))
+       if (!strncmp(cipher_dm, "cipher_null-", 12))
                null_cipher = 1;
 
-       hexkey = crypt_safe_alloc(null_cipher ? 2 : (dmd->u.crypt.vk->keylength * 2 + 1));
+       if (flags & CRYPT_ACTIVATE_KEYRING_KEY) {
+               keystr_len = strlen(tgt->u.crypt.vk->key_description) + int_log10(tgt->u.crypt.vk->keylength) + 10;
+               hexkey = crypt_safe_alloc(keystr_len);
+       } else
+               hexkey = crypt_safe_alloc(null_cipher ? 2 : (tgt->u.crypt.vk->keylength * 2 + 1));
+
        if (!hexkey)
                return NULL;
 
        if (null_cipher)
                strncpy(hexkey, "-", 2);
-       else
-               hex_key(hexkey, dmd->u.crypt.vk->keylength, dmd->u.crypt.vk->key);
+       else if (flags & CRYPT_ACTIVATE_KEYRING_KEY) {
+               r = snprintf(hexkey, keystr_len, ":%zu:logon:%s", tgt->u.crypt.vk->keylength, tgt->u.crypt.vk->key_description);
+               if (r < 0 || r >= keystr_len) {
+                       params = NULL;
+                       goto out;
+               }
+       } else
+               hex_key(hexkey, tgt->u.crypt.vk->keylength, tgt->u.crypt.vk->key);
 
-       max_size = strlen(hexkey) + strlen(dmd->u.crypt.cipher) +
-                  strlen(device_block_path(dmd->data_device)) +
+       max_size = strlen(hexkey) + strlen(cipher_dm) +
+                  strlen(device_block_path(tgt->data_device)) +
                   strlen(features) + 64;
        params = crypt_safe_alloc(max_size);
        if (!params)
                goto out;
 
        r = snprintf(params, max_size, "%s %s %" PRIu64 " %s %" PRIu64 "%s",
-                    dmd->u.crypt.cipher, hexkey, dmd->u.crypt.iv_offset,
-                    device_block_path(dmd->data_device), dmd->u.crypt.offset,
+                    cipher_dm, hexkey, tgt->u.crypt.iv_offset,
+                    device_block_path(tgt->data_device), tgt->u.crypt.offset,
                     features);
        if (r < 0 || r >= max_size) {
                crypt_safe_free(params);
@@ -355,19 +680,61 @@ out:
 }
 
 /* https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity */
-static char *get_dm_verity_params(struct crypt_params_verity *vp,
-                                  struct crypt_dm_active_device *dmd)
+static char *get_dm_verity_params(const struct dm_target *tgt, uint32_t flags)
 {
-       int max_size, r;
+       int max_size, r, num_options = 0;
+       struct crypt_params_verity *vp;
        char *params = NULL, *hexroot = NULL, *hexsalt = NULL;
+       char features[256], fec_features[256], verity_verify_args[512+32];
 
-       if (!vp || !dmd)
+       if (!tgt || !tgt->u.verity.vp)
                return NULL;
 
-       hexroot = crypt_safe_alloc(dmd->u.verity.root_hash_size * 2 + 1);
+       vp = tgt->u.verity.vp;
+
+       /* These flags are not compatible */
+       if ((flags & CRYPT_ACTIVATE_IGNORE_CORRUPTION) &&
+           (flags & CRYPT_ACTIVATE_RESTART_ON_CORRUPTION))
+               flags &= ~CRYPT_ACTIVATE_IGNORE_CORRUPTION;
+
+       if (flags & CRYPT_ACTIVATE_IGNORE_CORRUPTION)
+               num_options++;
+       if (flags & CRYPT_ACTIVATE_RESTART_ON_CORRUPTION)
+               num_options++;
+       if (flags & CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS)
+               num_options++;
+       if (flags & CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE)
+               num_options++;
+
+       if (tgt->u.verity.fec_device) {
+               num_options += 8;
+               snprintf(fec_features, sizeof(fec_features)-1,
+                        " use_fec_from_device %s fec_start %" PRIu64 " fec_blocks %" PRIu64 " fec_roots %" PRIu32,
+                        device_block_path(tgt->u.verity.fec_device), tgt->u.verity.fec_offset,
+                        vp->data_size + tgt->u.verity.hash_blocks, vp->fec_roots);
+       } else
+               *fec_features = '\0';
+
+       if (tgt->u.verity.root_hash_sig_key_desc) {
+               num_options += 2;
+               snprintf(verity_verify_args, sizeof(verity_verify_args)-1,
+                               " root_hash_sig_key_desc %s", tgt->u.verity.root_hash_sig_key_desc);
+       } else
+               *verity_verify_args = '\0';
+
+       if (num_options)
+               snprintf(features, sizeof(features)-1, " %d%s%s%s%s", num_options,
+               (flags & CRYPT_ACTIVATE_IGNORE_CORRUPTION) ? " ignore_corruption" : "",
+               (flags & CRYPT_ACTIVATE_RESTART_ON_CORRUPTION) ? " restart_on_corruption" : "",
+               (flags & CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS) ? " ignore_zero_blocks" : "",
+               (flags & CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE) ? " check_at_most_once" : "");
+       else
+               *features = '\0';
+
+       hexroot = crypt_safe_alloc(tgt->u.verity.root_hash_size * 2 + 1);
        if (!hexroot)
                goto out;
-       hex_key(hexroot, dmd->u.verity.root_hash_size, dmd->u.verity.root_hash);
+       hex_key(hexroot, tgt->u.verity.root_hash_size, tgt->u.verity.root_hash);
 
        hexsalt = crypt_safe_alloc(vp->salt_size ? vp->salt_size * 2 + 1 : 2);
        if (!hexsalt)
@@ -378,21 +745,24 @@ static char *get_dm_verity_params(struct crypt_params_verity *vp,
                strncpy(hexsalt, "-", 2);
 
        max_size = strlen(hexroot) + strlen(hexsalt) +
-                  strlen(device_block_path(dmd->data_device)) +
-                  strlen(device_block_path(dmd->u.verity.hash_device)) +
-                  strlen(vp->hash_name) + 128;
+                  strlen(device_block_path(tgt->data_device)) +
+                  strlen(device_block_path(tgt->u.verity.hash_device)) +
+                  strlen(vp->hash_name) + strlen(features) + strlen(fec_features) + 128 +
+                  strlen(verity_verify_args);
 
        params = crypt_safe_alloc(max_size);
        if (!params)
                goto out;
 
        r = snprintf(params, max_size,
-                    "%u %s %s %u %u %" PRIu64 " %" PRIu64 " %s %s %s",
-                    vp->hash_type, device_block_path(dmd->data_device),
-                    device_block_path(dmd->u.verity.hash_device),
+                    "%u %s %s %u %u %" PRIu64 " %" PRIu64 " %s %s %s%s%s%s",
+                    vp->hash_type, device_block_path(tgt->data_device),
+                    device_block_path(tgt->u.verity.hash_device),
                     vp->data_block_size, vp->hash_block_size,
-                    vp->data_size, dmd->u.verity.hash_offset,
-                    vp->hash_name, hexroot, hexsalt);
+                    vp->data_size, tgt->u.verity.hash_offset,
+                    vp->hash_name, hexroot, hexsalt, features, fec_features,
+                    verity_verify_args);
+
        if (r < 0 || r >= max_size) {
                crypt_safe_free(params);
                params = NULL;
@@ -401,11 +771,208 @@ out:
        crypt_safe_free(hexroot);
        crypt_safe_free(hexsalt);
        return params;
+}
+
+static char *get_dm_integrity_params(const struct dm_target *tgt, uint32_t flags)
+{
+       int r, max_size, num_options = 0;
+       char *params, *hexkey, mode;
+       char features[512], feature[256];
+
+       if (!tgt)
+               return NULL;
+
+       max_size = strlen(device_block_path(tgt->data_device)) +
+                       (tgt->u.integrity.meta_device ? strlen(device_block_path(tgt->u.integrity.meta_device)) : 0) +
+                       (tgt->u.integrity.vk ? tgt->u.integrity.vk->keylength * 2 : 0) +
+                       (tgt->u.integrity.journal_integrity_key ? tgt->u.integrity.journal_integrity_key->keylength * 2 : 0) +
+                       (tgt->u.integrity.journal_crypt_key ? tgt->u.integrity.journal_crypt_key->keylength * 2 : 0) +
+                       (tgt->u.integrity.integrity ? strlen(tgt->u.integrity.integrity) : 0) +
+                       (tgt->u.integrity.journal_integrity ? strlen(tgt->u.integrity.journal_integrity) : 0) +
+                       (tgt->u.integrity.journal_crypt ? strlen(tgt->u.integrity.journal_crypt) : 0) + 128;
+
+       params = crypt_safe_alloc(max_size);
+       if (!params)
+               return NULL;
+
+       *features = '\0';
+       if (tgt->u.integrity.journal_size) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "journal_sectors:%u ",
+                        (unsigned)(tgt->u.integrity.journal_size / SECTOR_SIZE));
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+       if (tgt->u.integrity.journal_watermark) {
+               num_options++;
+               snprintf(feature, sizeof(feature),
+                        /* bitmap overloaded values */
+                        (flags & CRYPT_ACTIVATE_NO_JOURNAL_BITMAP) ? "sectors_per_bit:%u " : "journal_watermark:%u ",
+                        tgt->u.integrity.journal_watermark);
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+       if (tgt->u.integrity.journal_commit_time) {
+               num_options++;
+               snprintf(feature, sizeof(feature),
+                        /* bitmap overloaded values */
+                        (flags & CRYPT_ACTIVATE_NO_JOURNAL_BITMAP) ? "bitmap_flush_interval:%u " : "commit_time:%u ",
+                        tgt->u.integrity.journal_commit_time);
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+       if (tgt->u.integrity.interleave_sectors) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "interleave_sectors:%u ",
+                        tgt->u.integrity.interleave_sectors);
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+       if (tgt->u.integrity.sector_size) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "block_size:%u ",
+                        tgt->u.integrity.sector_size);
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+       if (tgt->u.integrity.buffer_sectors) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "buffer_sectors:%u ",
+                        tgt->u.integrity.buffer_sectors);
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+       if (tgt->u.integrity.integrity) {
+               num_options++;
+
+               if (tgt->u.integrity.vk) {
+                       hexkey = crypt_safe_alloc(tgt->u.integrity.vk->keylength * 2 + 1);
+                       if (!hexkey) {
+                               crypt_safe_free(params);
+                               return NULL;
+                       }
+                       hex_key(hexkey, tgt->u.integrity.vk->keylength, tgt->u.integrity.vk->key);
+               } else
+                       hexkey = NULL;
+
+               snprintf(feature, sizeof(feature), "internal_hash:%s%s%s ",
+                        tgt->u.integrity.integrity, hexkey ? ":" : "", hexkey ?: "");
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+               crypt_safe_free(hexkey);
+       }
+
+       if (tgt->u.integrity.journal_integrity) {
+               num_options++;
+
+               if (tgt->u.integrity.journal_integrity_key) {
+                       hexkey = crypt_safe_alloc(tgt->u.integrity.journal_integrity_key->keylength * 2 + 1);
+                       if (!hexkey) {
+                               crypt_safe_free(params);
+                               return NULL;
+                       }
+                       hex_key(hexkey, tgt->u.integrity.journal_integrity_key->keylength,
+                               tgt->u.integrity.journal_integrity_key->key);
+               } else
+                       hexkey = NULL;
+
+               snprintf(feature, sizeof(feature), "journal_mac:%s%s%s ",
+                        tgt->u.integrity.journal_integrity, hexkey ? ":" : "", hexkey ?: "");
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+               crypt_safe_free(hexkey);
+       }
+
+       if (tgt->u.integrity.journal_crypt) {
+               num_options++;
+
+               if (tgt->u.integrity.journal_crypt_key) {
+                       hexkey = crypt_safe_alloc(tgt->u.integrity.journal_crypt_key->keylength * 2 + 1);
+                       if (!hexkey) {
+                               crypt_safe_free(params);
+                               return NULL;
+                       }
+                       hex_key(hexkey, tgt->u.integrity.journal_crypt_key->keylength,
+                               tgt->u.integrity.journal_crypt_key->key);
+               } else
+                       hexkey = NULL;
+
+               snprintf(feature, sizeof(feature), "journal_crypt:%s%s%s ",
+                        tgt->u.integrity.journal_crypt, hexkey ? ":" : "", hexkey ?: "");
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+               crypt_safe_free(hexkey);
+       }
+       if (tgt->u.integrity.fix_padding) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "fix_padding ");
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+
+       if (flags & CRYPT_ACTIVATE_RECALCULATE) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "recalculate ");
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+
+       if (flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "allow_discards ");
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+
+       if (tgt->u.integrity.meta_device) {
+               num_options++;
+               snprintf(feature, sizeof(feature), "meta_device:%s ",
+                        device_block_path(tgt->u.integrity.meta_device));
+               strncat(features, feature, sizeof(features) - strlen(features) - 1);
+       }
+
+       if (flags & CRYPT_ACTIVATE_NO_JOURNAL_BITMAP)
+               mode = 'B';
+       else if (flags & CRYPT_ACTIVATE_RECOVERY)
+               mode = 'R';
+       else if (flags & CRYPT_ACTIVATE_NO_JOURNAL)
+               mode = 'D';
+       else
+               mode = 'J';
+
+       r = snprintf(params, max_size, "%s %" PRIu64 " %d %c %d %s",
+                    device_block_path(tgt->data_device), tgt->u.integrity.offset,
+                    tgt->u.integrity.tag_size, mode,
+                    num_options, *features ? features : "");
+       if (r < 0 || r >= max_size) {
+               crypt_safe_free(params);
+               params = NULL;
+       }
+
+       return params;
+}
+
+static char *get_dm_linear_params(const struct dm_target *tgt, uint32_t flags)
+{
+       char *params;
+       int r;
+       int max_size = strlen(device_block_path(tgt->data_device)) + int_log10(tgt->u.linear.offset) + 3;
+
+       params = crypt_safe_alloc(max_size);
+       if (!params)
+               return NULL;
+
+       r = snprintf(params, max_size, "%s %" PRIu64,
+                    device_block_path(tgt->data_device), tgt->u.linear.offset);
+
+       if (r < 0 || r >= max_size) {
+               crypt_safe_free(params);
+               params = NULL;
+       }
+
+       return params;
+}
+
+static char *get_dm_zero_params(const struct dm_target *tgt, uint32_t flags)
+{
+       char *params = crypt_safe_alloc(1);
+       if (!params)
+               return NULL;
 
+       params[0] = 0;
+       return params;
 }
 
 /* DM helpers */
-static int _dm_simple(int task, const char *name, int udev_wait)
+static int _dm_remove(const char *name, int udev_wait, int deferred)
 {
        int r = 0;
        struct dm_task *dmt;
@@ -414,46 +981,75 @@ static int _dm_simple(int task, const char *name, int udev_wait)
        if (!_dm_use_udev())
                udev_wait = 0;
 
-       if (!(dmt = dm_task_create(task)))
+       if (!(dmt = dm_task_create(DM_DEVICE_REMOVE)))
                return 0;
 
-       if (name && !dm_task_set_name(dmt, name))
+       if (!dm_task_set_name(dmt, name))
                goto out;
 
 #if HAVE_DECL_DM_TASK_RETRY_REMOVE
-       /* Used only in DM_DEVICE_REMOVE */
-       if (name && !dm_task_retry_remove(dmt))
+       if (!dm_task_retry_remove(dmt))
+               goto out;
+#endif
+#if HAVE_DECL_DM_TASK_DEFERRED_REMOVE
+       if (deferred && !dm_task_deferred_remove(dmt))
                goto out;
 #endif
-       if (udev_wait && !_dm_task_set_cookie(dmt, &cookie, 0))
+       if (udev_wait && !_dm_task_set_cookie(dmt, &cookie, DM_UDEV_DISABLE_LIBRARY_FALLBACK))
                goto out;
 
        r = dm_task_run(dmt);
 
        if (udev_wait)
                (void)_dm_udev_wait(cookie);
-
-      out:
+out:
        dm_task_destroy(dmt);
        return r;
 }
 
-static int _error_device(const char *name, size_t size)
+static int _dm_simple(int task, const char *name, uint32_t dmflags)
 {
-       struct dm_task *dmt;
        int r = 0;
+       struct dm_task *dmt;
 
-       if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
+       if (!(dmt = dm_task_create(task)))
                return 0;
 
-       if (!dm_task_set_name(dmt, name))
-               goto error;
+       if (name && !dm_task_set_name(dmt, name))
+               goto out;
 
-       if (!dm_task_add_target(dmt, UINT64_C(0), size, "error", ""))
-               goto error;
+       if (task == DM_DEVICE_SUSPEND &&
+           (dmflags & DM_SUSPEND_SKIP_LOCKFS) && !dm_task_skip_lockfs(dmt))
+               goto out;
 
-       if (!dm_task_set_ro(dmt))
-               goto error;
+       if (task == DM_DEVICE_SUSPEND &&
+           (dmflags & DM_SUSPEND_NOFLUSH) && !dm_task_no_flush(dmt))
+               goto out;
+
+       r = dm_task_run(dmt);
+out:
+       dm_task_destroy(dmt);
+       return r;
+}
+
+static int _dm_resume_device(const char *name, uint32_t flags);
+
+static int _error_device(const char *name, size_t size)
+{
+       struct dm_task *dmt;
+       int r = 0;
+
+       if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
+               return 0;
+
+       if (!dm_task_set_name(dmt, name))
+               goto error;
+
+       if (!dm_task_add_target(dmt, UINT64_C(0), size, "error", ""))
+               goto error;
+
+       if (!dm_task_set_ro(dmt))
+               goto error;
 
        if (!dm_task_no_open_count(dmt))
                goto error;
@@ -461,7 +1057,7 @@ static int _error_device(const char *name, size_t size)
        if (!dm_task_run(dmt))
                goto error;
 
-       if (!_dm_simple(DM_DEVICE_RESUME, name, 1)) {
+       if (_dm_resume_device(name, 0)) {
                _dm_simple(DM_DEVICE_CLEAR, name, 0);
                goto error;
        }
@@ -473,36 +1069,87 @@ error:
        return r;
 }
 
-int dm_remove_device(struct crypt_device *cd, const char *name,
-                    int force, uint64_t size)
+int dm_error_device(struct crypt_device *cd, const char *name)
+{
+       int r;
+       struct crypt_dm_active_device dmd;
+
+       if (!name)
+               return -EINVAL;
+
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+
+       if ((dm_query_device(cd, name, 0, &dmd) >= 0) && _error_device(name, dmd.size))
+               r = 0;
+       else
+               r = -EINVAL;
+
+       dm_targets_free(cd, &dmd);
+
+       dm_exit_context();
+
+       return r;
+}
+
+int dm_clear_device(struct crypt_device *cd, const char *name)
+{
+       int r;
+
+       if (!name)
+               return -EINVAL;
+
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+
+       if (_dm_simple(DM_DEVICE_CLEAR, name, 0))
+               r = 0;
+       else
+               r = -EINVAL;
+
+       dm_exit_context();
+
+       return r;
+}
+
+int dm_remove_device(struct crypt_device *cd, const char *name, uint32_t flags)
 {
+       struct crypt_dm_active_device dmd = {};
        int r = -EINVAL;
-       int retries = force ? RETRY_COUNT : 1;
+       int retries = (flags & CRYPT_DEACTIVATE_FORCE) ? RETRY_COUNT : 1;
+       int deferred = (flags & CRYPT_DEACTIVATE_DEFERRED) ? 1 : 0;
        int error_target = 0;
+       uint32_t dmt_flags;
 
-       if (!name || (force && !size))
+       if (!name)
                return -EINVAL;
 
-       if (dm_init_context(cd))
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+
+       if (deferred && !dm_flags(cd, DM_UNKNOWN, &dmt_flags) && !(dmt_flags & DM_DEFERRED_SUPPORTED)) {
+               log_err(cd, _("Requested deferred flag is not supported."));
+               dm_exit_context();
                return -ENOTSUP;
+       }
 
        do {
-               r = _dm_simple(DM_DEVICE_REMOVE, name, 1) ? 0 : -EINVAL;
+               r = _dm_remove(name, 1, deferred) ? 0 : -EINVAL;
                if (--retries && r) {
-                       log_dbg("WARNING: other process locked internal device %s, %s.",
+                       log_dbg(cd, "WARNING: other process locked internal device %s, %s.",
                                name, retries ? "retrying remove" : "giving up");
                        sleep(1);
-                       if (force && !error_target) {
+                       if ((flags & CRYPT_DEACTIVATE_FORCE) && !error_target) {
                                /* If force flag is set, replace device with error, read-only target.
                                 * it should stop processes from reading it and also removed underlying
                                 * device from mapping, so it is usable again.
-                                * Force flag should be used only for temporary devices, which are
-                                * intended to work inside cryptsetup only!
                                 * Anyway, if some process try to read temporary cryptsetup device,
                                 * it is bug - no other process should try touch it (e.g. udev).
                                 */
-                               _error_device(name, size);
-                               error_target = 1;
+                               if (!dm_query_device(cd, name, 0, &dmd)) {
+                                       _error_device(name, dmd.size);
+                                       error_target = 1;
+                               }
                        }
                }
        } while (r == -EINVAL && retries);
@@ -520,7 +1167,8 @@ int dm_remove_device(struct crypt_device *cd, const char *name,
  * CRYPT-LUKS1-00000000000000000000000000000000-name
  * CRYPT-TEMP-name
  */
-static int dm_prepare_uuid(const char *name, const char *type, const char *uuid, char *buf, size_t buflen)
+static int dm_prepare_uuid(struct crypt_device *cd, const char *name, const char *type,
+                           const char *uuid, char *buf, size_t buflen)
 {
        char *ptr, uuid2[UUID_LEN] = {0};
        uuid_t uu;
@@ -529,7 +1177,7 @@ static int dm_prepare_uuid(const char *name, const char *type, const char *uuid,
        /* Remove '-' chars */
        if (uuid) {
                if (uuid_parse(uuid, uu) < 0) {
-                       log_dbg("Requested UUID %s has invalid format.", uuid);
+                       log_dbg(cd, "Requested UUID %s has invalid format.", uuid);
                        return 0;
                }
 
@@ -545,102 +1193,182 @@ static int dm_prepare_uuid(const char *name, const char *type, const char *uuid,
                uuid2[0] ? uuid2 : "", uuid2[0] ? "-" : "",
                name);
 
-       log_dbg("DM-UUID is %s", buf);
+       log_dbg(cd, "DM-UUID is %s", buf);
        if (i >= buflen)
-               log_err(NULL, _("DM-UUID for device %s was truncated.\n"), name);
+               log_err(cd, _("DM-UUID for device %s was truncated."), name);
 
        return 1;
 }
 
-static int _dm_create_device(const char *name, const char *type,
-                            struct device *device, uint32_t flags,
-                            const char *uuid, uint64_t size,
-                            char *params, int reload)
+int lookup_dm_dev_by_uuid(struct crypt_device *cd, const char *uuid, const char *type)
+{
+       int r;
+       char *c;
+       char dev_uuid[DM_UUID_LEN + DM_BY_ID_PREFIX_LEN] = DM_BY_ID_PREFIX;
+
+       if (!dm_prepare_uuid(cd, "", type, uuid, dev_uuid + DM_BY_ID_PREFIX_LEN, DM_UUID_LEN))
+               return -EINVAL;
+
+       c = strrchr(dev_uuid, '-');
+       if (!c)
+               return -EINVAL;
+
+       /* cut of dm name */
+       *c = '\0';
+
+       r = lookup_by_disk_id(dev_uuid);
+       if (r == -ENOENT) {
+               log_dbg(cd, "Search by disk id not available. Using sysfs instead.");
+               r = lookup_by_sysfs_uuid_field(dev_uuid + DM_BY_ID_PREFIX_LEN, DM_UUID_LEN);
+       }
+
+       return r;
+}
+
+static int _add_dm_targets(struct dm_task *dmt, struct crypt_dm_active_device *dmd)
+{
+       const char *target;
+       struct dm_target *tgt = &dmd->segment;
+
+       do {
+               switch (tgt->type) {
+               case DM_CRYPT:
+                       target = DM_CRYPT_TARGET;
+                       break;
+               case DM_VERITY:
+                       target = DM_VERITY_TARGET;
+                       break;
+               case DM_INTEGRITY:
+                       target = DM_INTEGRITY_TARGET;
+                       break;
+               case DM_LINEAR:
+                       target = DM_LINEAR_TARGET;
+                       break;
+               case DM_ZERO:
+                       target = DM_ZERO_TARGET;
+                       break;
+               default:
+                       return -ENOTSUP;
+               }
+
+               if (!dm_task_add_target(dmt, tgt->offset, tgt->size, target, tgt->params))
+                       return -EINVAL;
+
+               tgt = tgt->next;
+       } while (tgt);
+
+       return 0;
+}
+
+static void _destroy_dm_targets_params(struct crypt_dm_active_device *dmd)
+{
+       struct dm_target *t = &dmd->segment;
+
+       do {
+               crypt_safe_free(t->params);
+               t->params = NULL;
+               t = t->next;
+       } while (t);
+}
+
+static int _create_dm_targets_params(struct crypt_dm_active_device *dmd)
+{
+       int r;
+       struct dm_target *tgt = &dmd->segment;
+
+       do {
+               if (tgt->type == DM_CRYPT)
+                       tgt->params = get_dm_crypt_params(tgt, dmd->flags);
+               else if (tgt->type == DM_VERITY)
+                       tgt->params = get_dm_verity_params(tgt, dmd->flags);
+               else if (tgt->type == DM_INTEGRITY)
+                       tgt->params = get_dm_integrity_params(tgt, dmd->flags);
+               else if (tgt->type == DM_LINEAR)
+                       tgt->params = get_dm_linear_params(tgt, dmd->flags);
+               else if (tgt->type == DM_ZERO)
+                       tgt->params = get_dm_zero_params(tgt, dmd->flags);
+               else {
+                       r = -ENOTSUP;
+                       goto err;
+               }
+
+               if (!tgt->params) {
+                       r = -EINVAL;
+                       goto err;
+               }
+               tgt = tgt->next;
+       } while (tgt);
+
+       return 0;
+err:
+       _destroy_dm_targets_params(dmd);
+       return r;
+}
+
+static int _dm_create_device(struct crypt_device *cd, const char *name, const char *type,
+                            const char *uuid, struct crypt_dm_active_device *dmd)
 {
        struct dm_task *dmt = NULL;
        struct dm_info dmi;
        char dev_uuid[DM_UUID_LEN] = {0};
        int r = -EINVAL;
-       uint32_t read_ahead = 0;
-       uint32_t cookie = 0;
-       uint16_t udev_flags = 0;
+       uint32_t cookie = 0, read_ahead = 0;
+       uint16_t udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK;
 
-       if (!params)
-               return -EINVAL;
-
-       if (flags & CRYPT_ACTIVATE_PRIVATE)
-               udev_flags = CRYPT_TEMP_UDEV_FLAGS;
+       if (dmd->flags & CRYPT_ACTIVATE_PRIVATE)
+               udev_flags |= CRYPT_TEMP_UDEV_FLAGS;
 
        /* All devices must have DM_UUID, only resize on old device is exception */
-       if (reload) {
-               if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
-                       goto out_no_removal;
+       if (!dm_prepare_uuid(cd, name, type, dmd->uuid, dev_uuid, sizeof(dev_uuid)))
+               goto out;
 
-               if (!dm_task_set_name(dmt, name))
-                       goto out_no_removal;
-       } else {
-               if (!dm_prepare_uuid(name, type, uuid, dev_uuid, sizeof(dev_uuid)))
-                       goto out_no_removal;
+       if (!(dmt = dm_task_create(DM_DEVICE_CREATE)))
+               goto out;
 
-               if (!(dmt = dm_task_create(DM_DEVICE_CREATE)))
-                       goto out_no_removal;
+       if (!dm_task_set_name(dmt, name))
+               goto out;
 
-               if (!dm_task_set_name(dmt, name))
-                       goto out_no_removal;
+       if (!dm_task_set_uuid(dmt, dev_uuid))
+               goto out;
 
-               if (!dm_task_set_uuid(dmt, dev_uuid))
-                       goto out_no_removal;
+       if (!dm_task_secure_data(dmt))
+               goto out;
+       if ((dmd->flags & CRYPT_ACTIVATE_READONLY) && !dm_task_set_ro(dmt))
+               goto out;
 
-               if (_dm_use_udev() && !_dm_task_set_cookie(dmt, &cookie, udev_flags))
-                       goto out_no_removal;
-       }
+       r = _create_dm_targets_params(dmd);
+       if (r)
+               goto out;
 
-       if ((dm_flags() & DM_SECURE_SUPPORTED) && !dm_task_secure_data(dmt))
-               goto out_no_removal;
-       if ((flags & CRYPT_ACTIVATE_READONLY) && !dm_task_set_ro(dmt))
-               goto out_no_removal;
+       r = _add_dm_targets(dmt, dmd);
+       if (r)
+               goto out;
 
-       if (!dm_task_add_target(dmt, 0, size,
-               !strcmp("VERITY", type) ? DM_VERITY_TARGET : DM_CRYPT_TARGET, params))
-               goto out_no_removal;
+       r = -EINVAL;
 
 #ifdef DM_READ_AHEAD_MINIMUM_FLAG
-       if (device_read_ahead(device, &read_ahead) &&
+       if (device_read_ahead(dmd->segment.data_device, &read_ahead) &&
            !dm_task_set_read_ahead(dmt, read_ahead, DM_READ_AHEAD_MINIMUM_FLAG))
-               goto out_no_removal;
+               goto out;
 #endif
+       if (_dm_use_udev() && !_dm_task_set_cookie(dmt, &cookie, udev_flags))
+               goto out;
 
        if (!dm_task_run(dmt))
-               goto out_no_removal;
-
-       if (reload) {
-               dm_task_destroy(dmt);
-               if (!(dmt = dm_task_create(DM_DEVICE_RESUME)))
-                       goto out;
-               if (!dm_task_set_name(dmt, name))
-                       goto out;
-               if (uuid && !dm_task_set_uuid(dmt, dev_uuid))
-                       goto out;
-               if (_dm_use_udev() && !_dm_task_set_cookie(dmt, &cookie, udev_flags))
-                       goto out;
-               if (!dm_task_run(dmt))
-                       goto out;
-       }
-
-       if (!dm_task_get_info(dmt, &dmi))
                goto out;
 
-       r = 0;
-out:
+       if (dm_task_get_info(dmt, &dmi))
+               r = 0;
+
        if (_dm_use_udev()) {
                (void)_dm_udev_wait(cookie);
                cookie = 0;
        }
 
-       if (r < 0 && !reload)
-               _dm_simple(DM_DEVICE_REMOVE, name, 1);
+       if (r < 0)
+               _dm_remove(name, 1, 0);
 
-out_no_removal:
+out:
        if (cookie && _dm_use_udev())
                (void)_dm_udev_wait(cookie);
 
@@ -650,301 +1378,664 @@ out_no_removal:
        dm_task_update_nodes();
 
        /* If code just loaded target module, update versions */
-       _dm_check_versions();
+       _dm_check_versions(cd, dmd->segment.type);
+
+       _destroy_dm_targets_params(dmd);
 
        return r;
 }
 
-int dm_create_device(struct crypt_device *cd, const char *name,
-                    const char *type,
-                    struct crypt_dm_active_device *dmd,
-                    int reload)
+static int _dm_resume_device(const char *name, uint32_t dmflags)
 {
-       char *table_params = NULL;
-       uint32_t dmd_flags;
-       int r;
+       struct dm_task *dmt;
+       int r = -EINVAL;
+       uint32_t cookie = 0;
+       uint16_t udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK;
 
-       if (!type)
-               return -EINVAL;
+       if (dmflags & DM_RESUME_PRIVATE)
+               udev_flags |= CRYPT_TEMP_UDEV_FLAGS;
 
-       if (dm_init_context(cd))
-               return -ENOTSUP;
+       if (!(dmt = dm_task_create(DM_DEVICE_RESUME)))
+               return r;
 
-       dmd_flags = dmd->flags;
+       if (!dm_task_set_name(dmt, name))
+               goto out;
 
-       if (dmd->target == DM_CRYPT)
-               table_params = get_dm_crypt_params(dmd, dmd_flags);
-       else if (dmd->target == DM_VERITY)
-               table_params = get_dm_verity_params(dmd->u.verity.vp, dmd);
+       if ((dmflags & DM_SUSPEND_SKIP_LOCKFS) && !dm_task_skip_lockfs(dmt))
+               goto out;
 
-       r = _dm_create_device(name, type, dmd->data_device, dmd_flags,
-                             dmd->uuid, dmd->size, table_params, reload);
+       if ((dmflags & DM_SUSPEND_NOFLUSH) && !dm_task_no_flush(dmt))
+               goto out;
 
-       /* If discard not supported try to load without discard */
-       if (!reload && r && dmd->target == DM_CRYPT &&
-           (dmd->flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) &&
-           !(dm_flags() & DM_DISCARDS_SUPPORTED)) {
-               log_dbg("Discard/TRIM is not supported, retrying activation.");
-               dmd_flags = dmd_flags & ~CRYPT_ACTIVATE_ALLOW_DISCARDS;
-               crypt_safe_free(table_params);
-               table_params = get_dm_crypt_params(dmd, dmd_flags);
-               r = _dm_create_device(name, type, dmd->data_device, dmd_flags,
-                                     dmd->uuid, dmd->size, table_params, reload);
-       }
+       if (_dm_use_udev() && !_dm_task_set_cookie(dmt, &cookie, udev_flags))
+               goto out;
 
-       if (r == -EINVAL &&
-           dmd_flags & (CRYPT_ACTIVATE_SAME_CPU_CRYPT|CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS) &&
-           !(dm_flags() & (DM_SAME_CPU_CRYPT_SUPPORTED|DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED)))
-               log_err(cd, _("Requested dmcrypt performance options are not supported.\n"));
+       if (dm_task_run(dmt))
+               r = 0;
+out:
+       if (cookie && _dm_use_udev())
+               (void)_dm_udev_wait(cookie);
+
+       dm_task_destroy(dmt);
+
+       dm_task_update_nodes();
 
-       crypt_safe_free(table_params);
-       dm_exit_context();
        return r;
 }
 
-static int dm_status_dmi(const char *name, struct dm_info *dmi,
-                         const char *target, char **status_line)
+static int _dm_reload_device(struct crypt_device *cd, const char *name,
+                            struct crypt_dm_active_device *dmd)
 {
-       struct dm_task *dmt;
-       uint64_t start, length;
-       char *target_type, *params = NULL;
-       void *next = NULL;
        int r = -EINVAL;
+       struct dm_task *dmt = NULL;
+       uint32_t read_ahead = 0;
 
-       if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
+       /* All devices must have DM_UUID, only resize on old device is exception */
+       if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
                goto out;
 
        if (!dm_task_set_name(dmt, name))
                goto out;
 
-       if (!dm_task_run(dmt))
+       if (!dm_task_secure_data(dmt))
                goto out;
-
-       if (!dm_task_get_info(dmt, dmi))
+       if ((dmd->flags & CRYPT_ACTIVATE_READONLY) && !dm_task_set_ro(dmt))
                goto out;
 
-       if (!dmi->exists) {
-               r = -ENODEV;
+       r = _create_dm_targets_params(dmd);
+       if (r)
                goto out;
-       }
 
-       next = dm_get_next_target(dmt, next, &start, &length,
-                                 &target_type, &params);
-
-       if (!target_type || start != 0 || next)
+       r = _add_dm_targets(dmt, dmd);
+       if (r)
                goto out;
 
-       if (target && strcmp(target_type, target))
-               goto out;
+       r = -EINVAL;
 
-       /* for target == NULL check all supported */
-       if (!target && (strcmp(target_type, DM_CRYPT_TARGET) &&
-                       strcmp(target_type, DM_VERITY_TARGET)))
+#ifdef DM_READ_AHEAD_MINIMUM_FLAG
+       if (device_read_ahead(dmd->segment.data_device, &read_ahead) &&
+           !dm_task_set_read_ahead(dmt, read_ahead, DM_READ_AHEAD_MINIMUM_FLAG))
                goto out;
-       r = 0;
-out:
-       if (!r && status_line && !(*status_line = strdup(params)))
-               r = -ENOMEM;
+#endif
 
+       if (dm_task_run(dmt))
+               r = 0;
+out:
        if (dmt)
                dm_task_destroy(dmt);
 
+       /* If code just loaded target module, update versions */
+       _dm_check_versions(cd, dmd->segment.type);
+
+       _destroy_dm_targets_params(dmd);
+
        return r;
 }
 
-int dm_status_device(struct crypt_device *cd, const char *name)
+static void crypt_free_verity_params(struct crypt_params_verity *vp)
 {
-       int r;
-       struct dm_info dmi;
-       struct stat st;
-
-       /* libdevmapper is too clever and handles
-        * path argument differenly with error.
-        * Fail early here if parameter is non-existent path.
-        */
-       if (strchr(name, '/') && stat(name, &st) < 0)
-               return -ENODEV;
+       if (!vp)
+               return;
+
+       free(CONST_CAST(void*)vp->hash_name);
+       free(CONST_CAST(void*)vp->data_device);
+       free(CONST_CAST(void*)vp->hash_device);
+       free(CONST_CAST(void*)vp->fec_device);
+       free(CONST_CAST(void*)vp->salt);
+       free(vp);
+}
 
-       if (dm_init_context(cd))
-               return -ENOTSUP;
-       r = dm_status_dmi(name, &dmi, NULL, NULL);
-       dm_exit_context();
-       if (r < 0)
-               return r;
+static void _dm_target_free_query_path(struct crypt_device *cd, struct dm_target *tgt)
+{
+       switch(tgt->type) {
+       case DM_CRYPT:
+               crypt_free_volume_key(tgt->u.crypt.vk);
+               free(CONST_CAST(void*)tgt->u.crypt.cipher);
+               break;
+       case DM_INTEGRITY:
+               free(CONST_CAST(void*)tgt->u.integrity.integrity);
+               crypt_free_volume_key(tgt->u.integrity.vk);
+
+               free(CONST_CAST(void*)tgt->u.integrity.journal_integrity);
+               crypt_free_volume_key(tgt->u.integrity.journal_integrity_key);
+
+               free(CONST_CAST(void*)tgt->u.integrity.journal_crypt);
+               crypt_free_volume_key(tgt->u.integrity.journal_crypt_key);
+
+               device_free(cd, tgt->u.integrity.meta_device);
+               break;
+       case DM_VERITY:
+               crypt_free_verity_params(tgt->u.verity.vp);
+               device_free(cd, tgt->u.verity.hash_device);
+               free(CONST_CAST(void*)tgt->u.verity.root_hash);
+               free(CONST_CAST(void*)tgt->u.verity.root_hash_sig_key_desc);
+               /* fall through */
+       case DM_LINEAR:
+               /* fall through */
+       case DM_ERROR:
+               /* fall through */
+       case DM_ZERO:
+               break;
+       default:
+               log_err(cd, _("Unknown dm target type."));
+               return;
+       }
 
-       return (dmi.open_count > 0);
+       device_free(cd, tgt->data_device);
 }
 
-int dm_status_suspended(struct crypt_device *cd, const char *name)
+static void _dm_target_erase(struct crypt_device *cd, struct dm_target *tgt)
 {
-       int r;
-       struct dm_info dmi;
-
-       if (dm_init_context(cd))
-               return -ENOTSUP;
-       r = dm_status_dmi(name, &dmi, DM_CRYPT_TARGET, NULL);
-       dm_exit_context();
-       if (r < 0)
-               return r;
+       if (tgt->direction == TARGET_QUERY)
+               _dm_target_free_query_path(cd, tgt);
 
-       return dmi.suspended ? 1 : 0;
+       if (tgt->type == DM_CRYPT)
+               free(CONST_CAST(void*)tgt->u.crypt.integrity);
 }
 
-static int _dm_status_verity_ok(const char *name)
+void dm_targets_free(struct crypt_device *cd, struct crypt_dm_active_device *dmd)
 {
-       int r;
-       struct dm_info dmi;
-       char *status_line = NULL;
+       struct dm_target *t = &dmd->segment, *next = t->next;
 
-       r = dm_status_dmi(name, &dmi, DM_VERITY_TARGET, &status_line);
-       if (r < 0 || !status_line) {
-               free(status_line);
-               return r;
-       }
+       _dm_target_erase(cd, t);
 
-       log_dbg("Verity volume %s status is %s.", name, status_line ?: "");
-       r = status_line[0] == 'V' ? 1 : 0;
-       free(status_line);
+       while (next) {
+               t = next;
+               next = t->next;
+               _dm_target_erase(cd, t);
+               free(t);
+       }
 
-       return r;
+       memset(&dmd->segment, 0, sizeof(dmd->segment));
 }
 
-int dm_status_verity_ok(struct crypt_device *cd, const char *name)
+int dm_targets_allocate(struct dm_target *first, unsigned count)
 {
-       int r;
+       if (!first || first->next || !count)
+               return -EINVAL;
 
-       if (dm_init_context(cd))
-               return -ENOTSUP;
-       r = _dm_status_verity_ok(name);
-       dm_exit_context();
-       return r;
+       while (--count) {
+               first->next = crypt_zalloc(sizeof(*first));
+               if (!first->next)
+                       return -ENOMEM;
+               first = first->next;
+       }
+
+       return 0;
 }
 
-/* FIXME use hex wrapper, user val wrappers for line parsing */
-static int _dm_query_crypt(uint32_t get_flags,
-                          struct dm_info *dmi,
-                          char *params,
-                          struct crypt_dm_active_device *dmd)
+static int check_retry(struct crypt_device *cd, uint32_t *dmd_flags, uint32_t dmt_flags)
 {
-       uint64_t val64;
-       char *rcipher, *key_, *rdevice, *endp, buffer[3], *arg;
-       unsigned int i;
-       int r;
+       int ret = 0;
 
-       memset(dmd, 0, sizeof(*dmd));
-       dmd->target = DM_CRYPT;
+       /* If discard not supported try to load without discard */
+       if ((*dmd_flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) &&
+           !(dmt_flags & DM_DISCARDS_SUPPORTED)) {
+               log_dbg(cd, "Discard/TRIM is not supported");
+               *dmd_flags = *dmd_flags & ~CRYPT_ACTIVATE_ALLOW_DISCARDS;
+               ret = 1;
+       }
+
+       /* If kernel keyring is not supported load key directly in dm-crypt */
+       if ((*dmd_flags & CRYPT_ACTIVATE_KEYRING_KEY) &&
+           !(dmt_flags & DM_KERNEL_KEYRING_SUPPORTED)) {
+               log_dbg(cd, "dm-crypt does not support kernel keyring");
+               *dmd_flags = *dmd_flags & ~CRYPT_ACTIVATE_KEYRING_KEY;
+               ret = 1;
+       }
+
+       /* Drop performance options if not supported */
+       if ((*dmd_flags & (CRYPT_ACTIVATE_SAME_CPU_CRYPT | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS)) &&
+           !(dmt_flags & (DM_SAME_CPU_CRYPT_SUPPORTED | DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED))) {
+               log_dbg(cd, "dm-crypt does not support performance options");
+               *dmd_flags = *dmd_flags & ~(CRYPT_ACTIVATE_SAME_CPU_CRYPT | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS);
+               ret = 1;
+       }
+
+       return ret;
+}
+
+int dm_create_device(struct crypt_device *cd, const char *name,
+                    const char *type,
+                    struct crypt_dm_active_device *dmd)
+{
+       uint32_t dmt_flags = 0;
+       int r = -EINVAL;
+
+       if (!type || !dmd)
+               return -EINVAL;
+
+       if (dm_init_context(cd, dmd->segment.type))
+               return -ENOTSUP;
+
+       r = _dm_create_device(cd, name, type, dmd->uuid, dmd);
+
+       if (r < 0 && dm_flags(cd, dmd->segment.type, &dmt_flags))
+               goto out;
+
+       if (r && (dmd->segment.type == DM_CRYPT || dmd->segment.type == DM_LINEAR || dmd->segment.type == DM_ZERO) &&
+               check_retry(cd, &dmd->flags, dmt_flags))
+               r = _dm_create_device(cd, name, type, dmd->uuid, dmd);
+
+       if (r == -EINVAL &&
+           dmd->flags & (CRYPT_ACTIVATE_SAME_CPU_CRYPT|CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS) &&
+           !(dmt_flags & (DM_SAME_CPU_CRYPT_SUPPORTED|DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED)))
+               log_err(cd, _("Requested dm-crypt performance options are not supported."));
+
+       if (r == -EINVAL && dmd->flags & (CRYPT_ACTIVATE_IGNORE_CORRUPTION|
+                                         CRYPT_ACTIVATE_RESTART_ON_CORRUPTION|
+                                         CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS|
+                                         CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE) &&
+           !(dmt_flags & DM_VERITY_ON_CORRUPTION_SUPPORTED))
+               log_err(cd, _("Requested dm-verity data corruption handling options are not supported."));
+
+       if (r == -EINVAL && dmd->segment.type == DM_VERITY &&
+           dmd->segment.u.verity.fec_device && !(dmt_flags & DM_VERITY_FEC_SUPPORTED))
+               log_err(cd, _("Requested dm-verity FEC options are not supported."));
+
+       if (r == -EINVAL && dmd->segment.type == DM_CRYPT) {
+               if (dmd->segment.u.crypt.integrity && !(dmt_flags & DM_INTEGRITY_SUPPORTED))
+                       log_err(cd, _("Requested data integrity options are not supported."));
+               if (dmd->segment.u.crypt.sector_size != SECTOR_SIZE && !(dmt_flags & DM_SECTOR_SIZE_SUPPORTED))
+                       log_err(cd, _("Requested sector_size option is not supported."));
+       }
+
+       if (r == -EINVAL && dmd->segment.type == DM_INTEGRITY && (dmd->flags & CRYPT_ACTIVATE_RECALCULATE) &&
+           !(dmt_flags & DM_INTEGRITY_RECALC_SUPPORTED))
+               log_err(cd, _("Requested automatic recalculation of integrity tags is not supported."));
+
+       if (r == -EINVAL && dmd->segment.type == DM_INTEGRITY && (dmd->flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) &&
+           !(dmt_flags & DM_INTEGRITY_DISCARDS_SUPPORTED))
+               log_err(cd, _("Discard/TRIM is not supported."));
+
+       if (r == -EINVAL && dmd->segment.type == DM_INTEGRITY && (dmd->flags & CRYPT_ACTIVATE_NO_JOURNAL_BITMAP) &&
+           !(dmt_flags & DM_INTEGRITY_BITMAP_SUPPORTED))
+               log_err(cd, _("Requested dm-integrity bitmap mode is not supported."));
+out:
+       dm_exit_context();
+       return r;
+}
+
+int dm_reload_device(struct crypt_device *cd, const char *name,
+                    struct crypt_dm_active_device *dmd, uint32_t dmflags, unsigned resume)
+{
+       int r;
+       uint32_t dmt_flags;
+
+       if (!dmd)
+               return -EINVAL;
+
+       if (dm_init_context(cd, dmd->segment.type))
+               return -ENOTSUP;
+
+       if (dm_flags(cd, DM_INTEGRITY, &dmt_flags) || !(dmt_flags & DM_INTEGRITY_RECALC_SUPPORTED))
+               dmd->flags &= ~CRYPT_ACTIVATE_RECALCULATE;
+
+       r = _dm_reload_device(cd, name, dmd);
+
+       if (r == -EINVAL && (dmd->segment.type == DM_CRYPT || dmd->segment.type == DM_LINEAR)) {
+               if ((dmd->flags & (CRYPT_ACTIVATE_SAME_CPU_CRYPT|CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS)) &&
+           !dm_flags(cd, DM_CRYPT, &dmt_flags) && !(dmt_flags & (DM_SAME_CPU_CRYPT_SUPPORTED|DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED)))
+                       log_err(cd, _("Requested dm-crypt performance options are not supported."));
+               if ((dmd->flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) &&
+                   !dm_flags(cd, DM_CRYPT, &dmt_flags) && !(dmt_flags & DM_DISCARDS_SUPPORTED))
+                       log_err(cd, _("Discard/TRIM is not supported."));
+               if ((dmd->flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) &&
+                   !dm_flags(cd, DM_INTEGRITY, &dmt_flags) && !(dmt_flags & DM_INTEGRITY_DISCARDS_SUPPORTED))
+                       log_err(cd, _("Discard/TRIM is not supported."));
+       }
+
+       if (!r && resume)
+               r = _dm_resume_device(name, dmflags | act2dmflags(dmd->flags));
+
+       dm_exit_context();
+       return r;
+}
+
+static int dm_status_dmi(const char *name, struct dm_info *dmi,
+                         const char *target, char **status_line)
+{
+       struct dm_task *dmt;
+       uint64_t start, length;
+       char *target_type, *params = NULL;
+       int r = -EINVAL;
+
+       if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
+               goto out;
+
+       if (!dm_task_no_flush(dmt))
+               goto out;
+
+       if (!dm_task_set_name(dmt, name))
+               goto out;
+
+       if (!dm_task_run(dmt))
+               goto out;
+
+       if (!dm_task_get_info(dmt, dmi))
+               goto out;
+
+       if (!dmi->exists) {
+               r = -ENODEV;
+               goto out;
+       }
+
+       dm_get_next_target(dmt, NULL, &start, &length,
+                          &target_type, &params);
+
+       if (!target_type || start != 0)
+               goto out;
+
+       if (target && strcmp(target_type, target))
+               goto out;
+
+       /* for target == NULL check all supported */
+       if (!target && (strcmp(target_type, DM_CRYPT_TARGET) &&
+                       strcmp(target_type, DM_VERITY_TARGET) &&
+                       strcmp(target_type, DM_INTEGRITY_TARGET) &&
+                       strcmp(target_type, DM_LINEAR_TARGET) &&
+                       strcmp(target_type, DM_ZERO_TARGET) &&
+                       strcmp(target_type, DM_ERROR_TARGET)))
+               goto out;
+       r = 0;
+out:
+       if (!r && status_line && !(*status_line = strdup(params)))
+               r = -ENOMEM;
+
+       if (dmt)
+               dm_task_destroy(dmt);
+
+       return r;
+}
+
+int dm_status_device(struct crypt_device *cd, const char *name)
+{
+       int r;
+       struct dm_info dmi;
+       struct stat st;
+
+       /* libdevmapper is too clever and handles
+        * path argument differently with error.
+        * Fail early here if parameter is non-existent path.
+        */
+       if (strchr(name, '/') && stat(name, &st) < 0)
+               return -ENODEV;
+
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+       r = dm_status_dmi(name, &dmi, NULL, NULL);
+       dm_exit_context();
+
+       if (r < 0)
+               return r;
+
+       return (dmi.open_count > 0) ? 1 : 0;
+}
+
+int dm_status_suspended(struct crypt_device *cd, const char *name)
+{
+       int r;
+       struct dm_info dmi;
+
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+       r = dm_status_dmi(name, &dmi, NULL, NULL);
+       dm_exit_context();
+
+       if (r < 0)
+               return r;
+
+       return dmi.suspended ? 1 : 0;
+}
+
+static int _dm_status_verity_ok(struct crypt_device *cd, const char *name)
+{
+       int r;
+       struct dm_info dmi;
+       char *status_line = NULL;
+
+       r = dm_status_dmi(name, &dmi, DM_VERITY_TARGET, &status_line);
+       if (r < 0 || !status_line) {
+               free(status_line);
+               return r;
+       }
+
+       log_dbg(cd, "Verity volume %s status is %s.", name, status_line ?: "");
+       r = status_line[0] == 'V' ? 1 : 0;
+       free(status_line);
+
+       return r;
+}
+
+int dm_status_verity_ok(struct crypt_device *cd, const char *name)
+{
+       int r;
+
+       if (dm_init_context(cd, DM_VERITY))
+               return -ENOTSUP;
+       r = _dm_status_verity_ok(cd, name);
+       dm_exit_context();
+       return r;
+}
+
+int dm_status_integrity_failures(struct crypt_device *cd, const char *name, uint64_t *count)
+{
+       int r;
+       struct dm_info dmi;
+       char *status_line = NULL;
+
+       if (dm_init_context(cd, DM_INTEGRITY))
+               return -ENOTSUP;
+
+       r = dm_status_dmi(name, &dmi, DM_INTEGRITY_TARGET, &status_line);
+       if (r < 0 || !status_line) {
+               free(status_line);
+               dm_exit_context();
+               return r;
+       }
+
+       log_dbg(cd, "Integrity volume %s failure status is %s.", name, status_line ?: "");
+       *count = strtoull(status_line, NULL, 10);
+       free(status_line);
+       dm_exit_context();
+
+       return 0;
+}
+
+/* FIXME use hex wrapper, user val wrappers for line parsing */
+static int _dm_target_query_crypt(struct crypt_device *cd, uint32_t get_flags,
+                                 char *params, struct dm_target *tgt,
+                                 uint32_t *act_flags)
+{
+       uint64_t val64;
+       char *rcipher, *rintegrity, *key_, *rdevice, *endp, buffer[3], *arg, *key_desc;
+       unsigned int i, val;
+       int r;
+       size_t key_size;
+       struct device *data_device = NULL;
+       char *cipher = NULL, *integrity = NULL;
+       struct volume_key *vk = NULL;
+
+       tgt->type = DM_CRYPT;
+       tgt->direction = TARGET_QUERY;
+       tgt->u.crypt.sector_size = SECTOR_SIZE;
+
+       r = -EINVAL;
 
        rcipher = strsep(&params, " ");
-       /* cipher */
-       if (get_flags & DM_ACTIVE_CRYPT_CIPHER)
-               dmd->u.crypt.cipher = strdup(rcipher);
+       rintegrity = NULL;
 
        /* skip */
        key_ = strsep(&params, " ");
        if (!params)
-               return -EINVAL;
+               goto err;
        val64 = strtoull(params, &params, 10);
        if (*params != ' ')
-               return -EINVAL;
+               goto err;
        params++;
 
-       dmd->u.crypt.iv_offset = val64;
+       tgt->u.crypt.iv_offset = val64;
 
        /* device */
        rdevice = strsep(&params, " ");
        if (get_flags & DM_ACTIVE_DEVICE) {
                arg = crypt_lookup_dev(rdevice);
-               r = device_alloc(&dmd->data_device, arg);
+               r = device_alloc(cd, &data_device, arg);
                free(arg);
                if (r < 0 && r != -ENOTBLK)
-                       return r;
+                       goto err;
        }
 
+       r = -EINVAL;
+
        /*offset */
        if (!params)
-               return -EINVAL;
+               goto err;
        val64 = strtoull(params, &params, 10);
-       dmd->u.crypt.offset = val64;
+       tgt->u.crypt.offset = val64;
+
+       tgt->u.crypt.tag_size = 0;
 
        /* Features section, available since crypt target version 1.11 */
        if (*params) {
                if (*params != ' ')
-                       return -EINVAL;
+                       goto err;
                params++;
 
                /* Number of arguments */
                val64 = strtoull(params, &params, 10);
                if (*params != ' ')
-                       return -EINVAL;
+                       goto err;
                params++;
 
                for (i = 0; i < val64; i++) {
                        if (!params)
-                               return -EINVAL;
+                               goto err;
                        arg = strsep(&params, " ");
                        if (!strcasecmp(arg, "allow_discards"))
-                               dmd->flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
+                               *act_flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
                        else if (!strcasecmp(arg, "same_cpu_crypt"))
-                               dmd->flags |= CRYPT_ACTIVATE_SAME_CPU_CRYPT;
+                               *act_flags |= CRYPT_ACTIVATE_SAME_CPU_CRYPT;
                        else if (!strcasecmp(arg, "submit_from_crypt_cpus"))
-                               dmd->flags |= CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS;
-                       else /* unknown option */
-                               return -EINVAL;
+                               *act_flags |= CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS;
+                       else if (!strcasecmp(arg, "iv_large_sectors"))
+                               *act_flags |= CRYPT_ACTIVATE_IV_LARGE_SECTORS;
+                       else if (sscanf(arg, "integrity:%u:", &val) == 1) {
+                               tgt->u.crypt.tag_size = val;
+                               rintegrity = strchr(arg + strlen("integrity:"), ':');
+                               if (!rintegrity)
+                                       goto err;
+                               rintegrity++;
+                       } else if (sscanf(arg, "sector_size:%u", &val) == 1) {
+                               tgt->u.crypt.sector_size = val;
+                       } else /* unknown option */
+                               goto err;
                }
 
-               /* All parameters shold be processed */
+               /* All parameters should be processed */
                if (params)
-                       return -EINVAL;
+                       goto err;
        }
 
-       /* Never allow to return empty key */
-       if ((get_flags & DM_ACTIVE_CRYPT_KEY) && dmi->suspended) {
-               log_dbg("Cannot read volume key while suspended.");
-               return -EINVAL;
+       /* cipher */
+       if (get_flags & DM_ACTIVE_CRYPT_CIPHER) {
+               r = cipher_dm2c(CONST_CAST(char**)&cipher,
+                               CONST_CAST(char**)&integrity,
+                               rcipher, rintegrity);
+               if (r < 0)
+                       goto err;
        }
 
+       r = -EINVAL;
+
+       if (key_[0] == ':')
+               *act_flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+
        if (get_flags & DM_ACTIVE_CRYPT_KEYSIZE) {
-               dmd->u.crypt.vk = crypt_alloc_volume_key(strlen(key_) / 2, NULL);
-               if (!dmd->u.crypt.vk)
-                       return -ENOMEM;
+               /* we will trust kernel the key_string is in expected format */
+               if (key_[0] == ':') {
+                       if (sscanf(key_ + 1, "%zu", &key_size) != 1)
+                               goto err;
+               } else
+                       key_size = strlen(key_) / 2;
+
+               vk = crypt_alloc_volume_key(key_size, NULL);
+               if (!vk) {
+                       r = -ENOMEM;
+                       goto err;
+               }
 
                if (get_flags & DM_ACTIVE_CRYPT_KEY) {
-                       buffer[2] = '\0';
-                       for(i = 0; i < dmd->u.crypt.vk->keylength; i++) {
-                               memcpy(buffer, &key_[i * 2], 2);
-                               dmd->u.crypt.vk->key[i] = strtoul(buffer, &endp, 16);
-                               if (endp != &buffer[2]) {
-                                       crypt_free_volume_key(dmd->u.crypt.vk);
-                                       dmd->u.crypt.vk = NULL;
-                                       return -EINVAL;
+                       if (key_[0] == ':') {
+                               /* :<key_size>:<key_type>:<key_description> */
+                               key_desc = NULL;
+                               endp = strpbrk(key_ + 1, ":");
+                               if (endp)
+                                       key_desc = strpbrk(endp + 1, ":");
+                               if (!key_desc) {
+                                       r = -ENOMEM;
+                                       goto err;
+                               }
+                               key_desc++;
+                               crypt_volume_key_set_description(vk, key_desc);
+                       } else {
+                               buffer[2] = '\0';
+                               for(i = 0; i < vk->keylength; i++) {
+                                       memcpy(buffer, &key_[i * 2], 2);
+                                       vk->key[i] = strtoul(buffer, &endp, 16);
+                                       if (endp != &buffer[2]) {
+                                               r = -EINVAL;
+                                               goto err;
+                                       }
                                }
                        }
                }
        }
        memset(key_, 0, strlen(key_));
 
+       if (cipher)
+               tgt->u.crypt.cipher = cipher;
+       if (integrity)
+               tgt->u.crypt.integrity = integrity;
+       if (data_device)
+               tgt->data_device = data_device;
+       if (vk)
+               tgt->u.crypt.vk = vk;
        return 0;
+err:
+       free(cipher);
+       free(integrity);
+       device_free(cd, data_device);
+       crypt_free_volume_key(vk);
+       return r;
 }
 
-static int _dm_query_verity(uint32_t get_flags,
-                            struct dm_info *dmi,
-                            char *params,
-                            struct crypt_dm_active_device *dmd)
+static int _dm_target_query_verity(struct crypt_device *cd,
+                                  uint32_t get_flags,
+                                  char *params,
+                                  struct dm_target *tgt,
+                                  uint32_t *act_flags)
 {
        struct crypt_params_verity *vp = NULL;
        uint32_t val32;
        uint64_t val64;
        ssize_t len;
-       char *str, *str2;
+       char *str, *str2, *arg;
+       unsigned int i, features;
        int r;
+       struct device *data_device = NULL, *hash_device = NULL, *fec_device = NULL;
+       char *hash_name = NULL, *root_hash = NULL, *salt = NULL, *fec_dev_str = NULL;
+       char *root_hash_sig_key_desc = NULL;
 
-       if (get_flags & DM_ACTIVE_VERITY_PARAMS)
-               vp = dmd->u.verity.vp;
-
-       memset(dmd, 0, sizeof(*dmd));
+       if (get_flags & DM_ACTIVE_VERITY_PARAMS) {
+               vp = crypt_zalloc(sizeof(*vp));
+               if (!vp)
+                       return -ENOMEM;
+       }
 
-       dmd->target = DM_VERITY;
-       dmd->u.verity.vp = vp;
+       tgt->type = DM_VERITY;
+       tgt->direction = TARGET_QUERY;
+       tgt->u.verity.vp = vp;
 
        /* version */
        val32 = strtoul(params, &params, 10);
@@ -960,28 +2051,32 @@ static int _dm_query_verity(uint32_t get_flags,
                return -EINVAL;
        if (get_flags & DM_ACTIVE_DEVICE) {
                str2 = crypt_lookup_dev(str);
-               r = device_alloc(&dmd->data_device, str2);
+               r = device_alloc(cd, &data_device, str2);
                free(str2);
                if (r < 0 && r != -ENOTBLK)
                        return r;
        }
 
+       r = -EINVAL;
+
        /* hash device */
        str = strsep(&params, " ");
        if (!params)
-               return -EINVAL;
+               goto err;
        if (get_flags & DM_ACTIVE_VERITY_HASH_DEVICE) {
                str2 = crypt_lookup_dev(str);
-               r = device_alloc(&dmd->u.verity.hash_device, str2);
+               r = device_alloc(cd, &hash_device, str2);
                free(str2);
                if (r < 0 && r != -ENOTBLK)
-                       return r;
+                       goto err;
        }
 
+       r = -EINVAL;
+
        /* data block size*/
        val32 = strtoul(params, &params, 10);
        if (*params != ' ')
-               return -EINVAL;
+               goto err;
        if (vp)
                vp->data_block_size = val32;
        params++;
@@ -989,7 +2084,7 @@ static int _dm_query_verity(uint32_t get_flags,
        /* hash block size */
        val32 = strtoul(params, &params, 10);
        if (*params != ' ')
-               return -EINVAL;
+               goto err;
        if (vp)
                vp->hash_block_size = val32;
        params++;
@@ -997,7 +2092,7 @@ static int _dm_query_verity(uint32_t get_flags,
        /* data blocks */
        val64 = strtoull(params, &params, 10);
        if (*params != ' ')
-               return -EINVAL;
+               goto err;
        if (vp)
                vp->data_size = val64;
        params++;
@@ -1005,66 +2100,465 @@ static int _dm_query_verity(uint32_t get_flags,
        /* hash start */
        val64 = strtoull(params, &params, 10);
        if (*params != ' ')
-               return -EINVAL;
-       dmd->u.verity.hash_offset = val64;
+               goto err;
+       tgt->u.verity.hash_offset = val64;
        params++;
 
        /* hash algorithm */
        str = strsep(&params, " ");
        if (!params)
-               return -EINVAL;
-       if (vp)
-               vp->hash_name = strdup(str);
+               goto err;
+       if (vp) {
+               hash_name = strdup(str);
+               if (!hash_name) {
+                       r = -ENOMEM;
+                       goto err;
+               }
+       }
 
        /* root digest */
        str = strsep(&params, " ");
        if (!params)
-               return -EINVAL;
+               goto err;
        len = crypt_hex_to_bytes(str, &str2, 0);
-       if (len < 0)
-               return len;
-       dmd->u.verity.root_hash_size = len;
+       if (len < 0) {
+               r = len;
+               goto err;
+       }
+       tgt->u.verity.root_hash_size = len;
        if (get_flags & DM_ACTIVE_VERITY_ROOT_HASH)
-               dmd->u.verity.root_hash = str2;
+               root_hash = str2;
        else
                free(str2);
 
        /* salt */
        str = strsep(&params, " ");
-       if (params)
-               return -EINVAL;
        if (vp) {
                if (!strcmp(str, "-")) {
                        vp->salt_size = 0;
                        vp->salt = NULL;
                } else {
                        len = crypt_hex_to_bytes(str, &str2, 0);
-                       if (len < 0)
-                               return len;
+                       if (len < 0) {
+                               r = len;
+                               goto err;
+                       }
                        vp->salt_size = len;
-                       vp->salt = str2;
+                       salt = str2;
+               }
+       }
+
+       r = -EINVAL;
+
+       /* Features section, available since verity target version 1.3 */
+       if (params) {
+               /* Number of arguments */
+               val64 = strtoull(params, &params, 10);
+               if (*params != ' ')
+                       goto err;
+               params++;
+
+               features = (int)val64;
+               for (i = 0; i < features; i++) {
+                       r = -EINVAL;
+                       if (!params)
+                               goto err;
+                       arg = strsep(&params, " ");
+                       if (!strcasecmp(arg, "ignore_corruption"))
+                               *act_flags |= CRYPT_ACTIVATE_IGNORE_CORRUPTION;
+                       else if (!strcasecmp(arg, "restart_on_corruption"))
+                               *act_flags |= CRYPT_ACTIVATE_RESTART_ON_CORRUPTION;
+                       else if (!strcasecmp(arg, "ignore_zero_blocks"))
+                               *act_flags |= CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS;
+                       else if (!strcasecmp(arg, "check_at_most_once"))
+                               *act_flags |= CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE;
+                       else if (!strcasecmp(arg, "use_fec_from_device")) {
+                               str = strsep(&params, " ");
+                               str2 = crypt_lookup_dev(str);
+                               if (get_flags & DM_ACTIVE_VERITY_HASH_DEVICE) {
+                                       r = device_alloc(cd, &fec_device, str2);
+                                       if (r < 0 && r != -ENOTBLK) {
+                                               free(str2);
+                                               goto err;
+                                       }
+                               }
+                               if (vp) {
+                                       free(fec_dev_str);
+                                       fec_dev_str = str2;
+                               } else
+                                       free(str2);
+                               i++;
+                       } else if (!strcasecmp(arg, "fec_start")) {
+                               val64 = strtoull(params, &params, 10);
+                               if (*params)
+                                       params++;
+                               tgt->u.verity.fec_offset = val64;
+                               if (vp)
+                                       vp->fec_area_offset = val64 * vp->hash_block_size;
+                               i++;
+                       } else if (!strcasecmp(arg, "fec_blocks")) {
+                               val64 = strtoull(params, &params, 10);
+                               if (*params)
+                                       params++;
+                               tgt->u.verity.fec_blocks = val64;
+                               i++;
+                       } else if (!strcasecmp(arg, "fec_roots")) {
+                               val32 = strtoul(params, &params, 10);
+                               if (*params)
+                                       params++;
+                               if (vp)
+                                       vp->fec_roots = val32;
+                               i++;
+                       } else if (!strcasecmp(arg, "root_hash_sig_key_desc")) {
+                               str = strsep(&params, " ");
+                               if (!str)
+                                       goto err;
+                               if (!root_hash_sig_key_desc)
+                                       root_hash_sig_key_desc = strdup(str);
+                               i++;
+                               if (vp)
+                                       vp->flags |= CRYPT_VERITY_ROOT_HASH_SIGNATURE;
+                       } else /* unknown option */
+                               goto err;
+               }
+
+               /* All parameters should be processed */
+               if (params && *params) {
+                       r = -EINVAL;
+                       goto err;
                }
        }
 
+       if (data_device)
+               tgt->data_device = data_device;
+       if (hash_device)
+               tgt->u.verity.hash_device = hash_device;
+       if (fec_device)
+               tgt->u.verity.fec_device = fec_device;
+       if (root_hash)
+               tgt->u.verity.root_hash = root_hash;
+       if (vp && hash_name)
+               vp->hash_name = hash_name;
+       if (vp && salt)
+               vp->salt = salt;
+       if (vp && fec_dev_str)
+               vp->fec_device = fec_dev_str;
+       if (root_hash_sig_key_desc)
+               tgt->u.verity.root_hash_sig_key_desc = root_hash_sig_key_desc;
+
        return 0;
+err:
+       device_free(cd, data_device);
+       device_free(cd, hash_device);
+       device_free(cd, fec_device);
+       free(root_hash_sig_key_desc);
+       free(root_hash);
+       free(hash_name);
+       free(salt);
+       free(fec_dev_str);
+       free(vp);
+       return r;
 }
 
-int dm_query_device(struct crypt_device *cd, const char *name,
-                   uint32_t get_flags, struct crypt_dm_active_device *dmd)
+static int _dm_target_query_integrity(struct crypt_device *cd,
+                            uint32_t get_flags,
+                            char *params,
+                            struct dm_target *tgt,
+                            uint32_t *act_flags)
 {
-       struct dm_task *dmt;
-       struct dm_info dmi;
-       uint64_t start, length;
-       char *target_type, *params;
-       const char *tmp_uuid;
-       void *next = NULL;
-       int r = -EINVAL;
+       uint32_t val32;
+       uint64_t val64;
+       char c, *str, *str2, *arg;
+       unsigned int i, features, val;
+       ssize_t len;
+       int r;
+       struct device *data_device = NULL, *meta_device = NULL;
+       char *integrity = NULL, *journal_crypt = NULL, *journal_integrity = NULL;
+       struct volume_key *vk = NULL;
+
+       tgt->type = DM_INTEGRITY;
+       tgt->direction = TARGET_QUERY;
+
+       /* data device */
+       str = strsep(&params, " ");
+       if (get_flags & DM_ACTIVE_DEVICE) {
+               str2 = crypt_lookup_dev(str);
+               r = device_alloc(cd, &data_device, str2);
+               free(str2);
+               if (r < 0 && r != -ENOTBLK)
+                       return r;
+       }
+
+       r = -EINVAL;
+
+       /*offset */
+       if (!params)
+               goto err;
+       val64 = strtoull(params, &params, 10);
+       if (!*params || *params != ' ')
+               goto err;
+       tgt->u.integrity.offset = val64;
+
+       /* tag size*/
+       val32 = strtoul(params, &params, 10);
+       tgt->u.integrity.tag_size = val32;
+       if (!*params || *params != ' ')
+               goto err;
+
+       /* journal */
+       c = toupper(*(++params));
+       if (!*params || *(++params) != ' ' || (c != 'D' && c != 'J' && c != 'R' && c != 'B'))
+               goto err;
+       if (c == 'D')
+               *act_flags |= CRYPT_ACTIVATE_NO_JOURNAL;
+       if (c == 'R')
+               *act_flags |= CRYPT_ACTIVATE_RECOVERY;
+       if (c == 'B') {
+               *act_flags |= CRYPT_ACTIVATE_NO_JOURNAL;
+               *act_flags |= CRYPT_ACTIVATE_NO_JOURNAL_BITMAP;
+       }
+
+       tgt->u.integrity.sector_size = SECTOR_SIZE;
+
+       /* Features section */
+       if (params) {
+               /* Number of arguments */
+               val64 = strtoull(params, &params, 10);
+               if (*params != ' ')
+                       goto err;
+               params++;
+
+               features = (int)val64;
+               for (i = 0; i < features; i++) {
+                       r = -EINVAL;
+                       if (!params)
+                               goto err;
+                       arg = strsep(&params, " ");
+                       if (sscanf(arg, "journal_sectors:%u", &val) == 1)
+                               tgt->u.integrity.journal_size = val * SECTOR_SIZE;
+                       else if (sscanf(arg, "journal_watermark:%u", &val) == 1)
+                               tgt->u.integrity.journal_watermark = val;
+                       else if (sscanf(arg, "sectors_per_bit:%" PRIu64, &val64) == 1) {
+                               if (val64 > UINT_MAX)
+                                       goto err;
+                               /* overloaded value for bitmap mode */
+                               tgt->u.integrity.journal_watermark = (unsigned int)val64;
+                       } else if (sscanf(arg, "commit_time:%u", &val) == 1)
+                               tgt->u.integrity.journal_commit_time = val;
+                       else if (sscanf(arg, "bitmap_flush_interval:%u", &val) == 1)
+                               /* overloaded value for bitmap mode */
+                               tgt->u.integrity.journal_commit_time = val;
+                       else if (sscanf(arg, "interleave_sectors:%u", &val) == 1)
+                               tgt->u.integrity.interleave_sectors = val;
+                       else if (sscanf(arg, "block_size:%u", &val) == 1)
+                               tgt->u.integrity.sector_size = val;
+                       else if (sscanf(arg, "buffer_sectors:%u", &val) == 1)
+                               tgt->u.integrity.buffer_sectors = val;
+                       else if (!strncmp(arg, "internal_hash:", 14) && !integrity) {
+                               str = &arg[14];
+                               arg = strsep(&str, ":");
+                               if (get_flags & DM_ACTIVE_INTEGRITY_PARAMS) {
+                                       integrity = strdup(arg);
+                                       if (!integrity) {
+                                               r = -ENOMEM;
+                                               goto err;
+                                       }
+                               }
+
+                               if (str) {
+                                       len = crypt_hex_to_bytes(str, &str2, 1);
+                                       if (len < 0) {
+                                               r = len;
+                                               goto err;
+                                       }
+
+                                       r = 0;
+                                       if (get_flags & DM_ACTIVE_CRYPT_KEY) {
+                                               vk = crypt_alloc_volume_key(len, str2);
+                                               if (!vk)
+                                                       r = -ENOMEM;
+                                       } else if (get_flags & DM_ACTIVE_CRYPT_KEYSIZE) {
+                                               vk = crypt_alloc_volume_key(len, NULL);
+                                               if (!vk)
+                                                       r = -ENOMEM;
+                                       }
+                                       crypt_safe_free(str2);
+                                       if (r < 0)
+                                               goto err;
+                               }
+                       } else if (!strncmp(arg, "meta_device:", 12) && !meta_device) {
+                               if (get_flags & DM_ACTIVE_DEVICE) {
+                                       str = crypt_lookup_dev(&arg[12]);
+                                       r = device_alloc(cd, &meta_device, str);
+                                       free(str);
+                                       if (r < 0 && r != -ENOTBLK)
+                                               goto err;
+                               }
+                       } else if (!strncmp(arg, "journal_crypt:", 14) && !journal_crypt) {
+                               str = &arg[14];
+                               arg = strsep(&str, ":");
+                               if (get_flags & DM_ACTIVE_INTEGRITY_PARAMS) {
+                                       journal_crypt = strdup(arg);
+                                       if (!journal_crypt) {
+                                               r = -ENOMEM;
+                                               goto err;
+                                       }
+                               }
+                       } else if (!strncmp(arg, "journal_mac:", 12) && !journal_integrity) {
+                               str = &arg[12];
+                               arg = strsep(&str, ":");
+                               if (get_flags & DM_ACTIVE_INTEGRITY_PARAMS) {
+                                       journal_integrity = strdup(arg);
+                                       if (!journal_integrity) {
+                                               r = -ENOMEM;
+                                               goto err;
+                                       }
+                               }
+                       } else if (!strcmp(arg, "recalculate")) {
+                               *act_flags |= CRYPT_ACTIVATE_RECALCULATE;
+                       } else if (!strcmp(arg, "fix_padding")) {
+                               tgt->u.integrity.fix_padding = true;
+                       } else if (!strcmp(arg, "allow_discards")) {
+                               *act_flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
+                       } else /* unknown option */
+                               goto err;
+               }
+
+               /* All parameters should be processed */
+               if (params && *params) {
+                       r = -EINVAL;
+                       goto err;
+               }
+       }
+
+       if (data_device)
+               tgt->data_device = data_device;
+       if (meta_device)
+               tgt->u.integrity.meta_device = meta_device;
+       if (integrity)
+               tgt->u.integrity.integrity = integrity;
+       if (journal_crypt)
+               tgt->u.integrity.journal_crypt = journal_crypt;
+       if (journal_integrity)
+               tgt->u.integrity.journal_integrity = journal_integrity;
+       if (vk)
+               tgt->u.integrity.vk = vk;
+       return 0;
+err:
+       device_free(cd, data_device);
+       device_free(cd, meta_device);
+       free(integrity);
+       free(journal_crypt);
+       free(journal_integrity);
+       crypt_free_volume_key(vk);
+       return r;
+}
+
+static int _dm_target_query_linear(struct crypt_device *cd, struct dm_target *tgt,
+                                  uint32_t get_flags, char *params)
+{
+       uint64_t val64;
+       char *rdevice, *arg;
+       int r;
+       struct device *device = NULL;
+
+       /* device */
+       rdevice = strsep(&params, " ");
+       if (get_flags & DM_ACTIVE_DEVICE) {
+               arg = crypt_lookup_dev(rdevice);
+               r = device_alloc(cd, &device, arg);
+               free(arg);
+               if (r < 0 && r != -ENOTBLK)
+                       return r;
+       }
+
+       r = -EINVAL;
+
+       /*offset */
+       if (!params)
+               goto err;
+       val64 = strtoull(params, &params, 10);
+
+       /* params should be empty now */
+       if (*params)
+               goto err;
+
+       tgt->type = DM_LINEAR;
+       tgt->direction = TARGET_QUERY;
+       tgt->data_device = device;
+       tgt->u.linear.offset = val64;
+
+       return 0;
+err:
+       device_free(cd, device);
+       return r;
+}
+
+static int _dm_target_query_error(struct crypt_device *cd, struct dm_target *tgt)
+{
+       tgt->type = DM_ERROR;
+       tgt->direction = TARGET_QUERY;
+
+       return 0;
+}
+
+static int _dm_target_query_zero(struct crypt_device *cd, struct dm_target *tgt)
+{
+       tgt->type = DM_ZERO;
+       tgt->direction = TARGET_QUERY;
+
+       return 0;
+}
+
+/*
+ * on error retval has to be negative
+ *
+ * also currently any _dm_target_query fn does not perform cleanup on error
+ */
+static int dm_target_query(struct crypt_device *cd, struct dm_target *tgt, const uint64_t *start,
+                   const uint64_t *length, const char *target_type,
+                   char *params, uint32_t get_flags, uint32_t *act_flags)
+{
+       int r = -ENOTSUP;
+
+       if (!strcmp(target_type, DM_CRYPT_TARGET))
+               r = _dm_target_query_crypt(cd, get_flags, params, tgt, act_flags);
+       else if (!strcmp(target_type, DM_VERITY_TARGET))
+               r = _dm_target_query_verity(cd, get_flags, params, tgt, act_flags);
+       else if (!strcmp(target_type, DM_INTEGRITY_TARGET))
+               r = _dm_target_query_integrity(cd, get_flags, params, tgt, act_flags);
+       else if (!strcmp(target_type, DM_LINEAR_TARGET))
+               r = _dm_target_query_linear(cd, tgt, get_flags, params);
+       else if (!strcmp(target_type, DM_ERROR_TARGET))
+               r = _dm_target_query_error(cd, tgt);
+       else if (!strcmp(target_type, DM_ZERO_TARGET))
+               r = _dm_target_query_zero(cd, tgt);
+
+       if (!r) {
+               tgt->offset = *start;
+               tgt->size = *length;
+       }
+
+       return r;
+}
+
+static int _dm_query_device(struct crypt_device *cd, const char *name,
+                   uint32_t get_flags, struct crypt_dm_active_device *dmd)
+{
+       struct dm_target *t;
+       struct dm_task *dmt;
+       struct dm_info dmi;
+       uint64_t start, length;
+       char *target_type, *params;
+       const char *tmp_uuid;
+       void *next = NULL;
+       int r = -EINVAL;
+
+       t = &dmd->segment;
 
-       if (dm_init_context(cd))
-               return -ENOTSUP;
        if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
-               goto out;
-       if ((dm_flags() & DM_SECURE_SUPPORTED) && !dm_task_secure_data(dmt))
+               return r;
+       if (!dm_task_secure_data(dmt))
                goto out;
        if (!dm_task_set_name(dmt, name))
                goto out;
@@ -1081,35 +2575,49 @@ int dm_query_device(struct crypt_device *cd, const char *name,
                goto out;
        }
 
-       next = dm_get_next_target(dmt, next, &start, &length,
-                                 &target_type, &params);
-
-       if (!target_type || start != 0 || next)
+       if (dmi.target_count <= 0) {
+               r = -EINVAL;
                goto out;
+       }
 
-       if (!strcmp(target_type, DM_CRYPT_TARGET)) {
-               r = _dm_query_crypt(get_flags, &dmi, params, dmd);
-       } else if (!strcmp(target_type, DM_VERITY_TARGET)) {
-               r = _dm_query_verity(get_flags, &dmi, params, dmd);
-               if (r < 0)
-                       goto out;
-               r = _dm_status_verity_ok(name);
-               if (r < 0)
-                       goto out;
-               if (r == 0)
-                       dmd->flags |= CRYPT_ACTIVATE_CORRUPTED;
-               r = 0;
-       } else
+       /* Never allow to return empty key */
+       if ((get_flags & DM_ACTIVE_CRYPT_KEY) && dmi.suspended) {
+               log_dbg(cd, "Cannot read volume key while suspended.");
                r = -EINVAL;
+               goto out;
+       }
 
-       if (r < 0)
+       r = dm_targets_allocate(&dmd->segment, dmi.target_count);
+       if (r)
                goto out;
 
-       dmd->size = length;
+       do {
+               next = dm_get_next_target(dmt, next, &start, &length,
+                                         &target_type, &params);
+
+               r = dm_target_query(cd, t, &start, &length, target_type, params, get_flags, &dmd->flags);
+               if (!r && t->type == DM_VERITY) {
+                       r = _dm_status_verity_ok(cd, name);
+                       if (r == 0)
+                               dmd->flags |= CRYPT_ACTIVATE_CORRUPTED;
+               }
+
+               if (r < 0) {
+                       if (r != -ENOTSUP)
+                               log_err(cd, _("Failed to query dm-%s segment."), target_type);
+                       goto out;
+               }
+
+               dmd->size += length;
+               t = t->next;
+       } while (next && t);
 
        if (dmi.read_only)
                dmd->flags |= CRYPT_ACTIVATE_READONLY;
 
+       if (dmi.suspended)
+               dmd->flags |= CRYPT_ACTIVATE_SUSPENDED;
+
        tmp_uuid = dm_task_get_uuid(dmt);
        if (!tmp_uuid)
                dmd->flags |= CRYPT_ACTIVATE_NO_UUID;
@@ -1118,11 +2626,145 @@ int dm_query_device(struct crypt_device *cd, const char *name,
                        dmd->uuid = strdup(tmp_uuid + DM_UUID_PREFIX_LEN);
        }
 
+       dmd->holders = 0;
+#if (HAVE_DECL_DM_DEVICE_HAS_HOLDERS && HAVE_DECL_DM_DEVICE_HAS_MOUNTED_FS)
+       if (get_flags & DM_ACTIVE_HOLDERS)
+               dmd->holders = (dm_device_has_mounted_fs(dmi.major, dmi.minor) ||
+                               dm_device_has_holders(dmi.major, dmi.minor));
+#endif
+
        r = (dmi.open_count > 0);
 out:
        if (dmt)
                dm_task_destroy(dmt);
 
+       if (r < 0)
+               dm_targets_free(cd, dmd);
+
+       return r;
+}
+
+int dm_query_device(struct crypt_device *cd, const char *name,
+                   uint32_t get_flags, struct crypt_dm_active_device *dmd)
+{
+       int r;
+
+       if (!dmd)
+               return -EINVAL;
+
+       memset(dmd, 0, sizeof(*dmd));
+
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+
+       r = _dm_query_device(cd, name, get_flags, dmd);
+
+       dm_exit_context();
+       return r;
+}
+
+static int _process_deps(struct crypt_device *cd, const char *prefix, struct dm_deps *deps, char **names, size_t names_offset, size_t names_length)
+{
+#if HAVE_DECL_DM_DEVICE_GET_NAME
+       struct crypt_dm_active_device dmd;
+       char dmname[PATH_MAX];
+       unsigned i;
+       int r, major, minor, count = 0;
+
+       if (!prefix || !deps)
+               return -EINVAL;
+
+       for (i = 0; i < deps->count; i++) {
+               major = major(deps->device[i]);
+               if (!dm_is_dm_major(major))
+                       continue;
+
+               minor = minor(deps->device[i]);
+               if (!dm_device_get_name(major, minor, 0, dmname, PATH_MAX))
+                       return -EINVAL;
+
+               memset(&dmd, 0, sizeof(dmd));
+               r = _dm_query_device(cd, dmname, DM_ACTIVE_UUID, &dmd);
+               if (r < 0)
+                       continue;
+
+               if (!dmd.uuid ||
+                   strncmp(prefix, dmd.uuid, strlen(prefix)) ||
+                   crypt_string_in(dmname, names, names_length))
+                       *dmname = '\0';
+
+               dm_targets_free(cd, &dmd);
+               free(CONST_CAST(void*)dmd.uuid);
+
+               if ((size_t)count >= (names_length - names_offset))
+                       return -ENOMEM;
+
+               if (*dmname && !(names[names_offset + count++] = strdup(dmname)))
+                       return -ENOMEM;
+       }
+
+       return count;
+#else
+       return -EINVAL;
+#endif
+}
+
+int dm_device_deps(struct crypt_device *cd, const char *name, const char *prefix, char **names, size_t names_length)
+{
+       struct dm_task *dmt;
+       struct dm_info dmi;
+       struct dm_deps *deps;
+       int r = -EINVAL;
+       size_t i, last = 0, offset = 0;
+
+       if (!name || !names_length || !names)
+               return -EINVAL;
+
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+
+       while (name) {
+               if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
+                       goto out;
+               if (!dm_task_set_name(dmt, name))
+                       goto out;
+
+               r = -ENODEV;
+               if (!dm_task_run(dmt))
+                       goto out;
+
+               r = -EINVAL;
+               if (!dm_task_get_info(dmt, &dmi))
+                       goto out;
+               if (!(deps = dm_task_get_deps(dmt)))
+                       goto out;
+
+               r = -ENODEV;
+               if (!dmi.exists)
+                       goto out;
+
+               r = _process_deps(cd, prefix, deps, names, offset, names_length - 1);
+               if (r < 0)
+                       goto out;
+
+               dm_task_destroy(dmt);
+               dmt = NULL;
+
+               offset += r;
+               name = names[last++];
+       }
+
+       r = 0;
+out:
+       if (r < 0) {
+               for (i = 0; i < names_length - 1; i++)
+                       free(names[i]);
+               *names = NULL;
+       }
+
+       if (dmt)
+               dm_task_destroy(dmt);
+
        dm_exit_context();
        return r;
 }
@@ -1135,7 +2777,7 @@ static int _dm_message(const char *name, const char *msg)
        if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
                return 0;
 
-       if ((dm_flags() & DM_SECURE_SUPPORTED) && !dm_task_secure_data(dmt))
+       if (!dm_task_secure_data(dmt))
                goto out;
 
        if (name && !dm_task_set_name(dmt, name))
@@ -1148,51 +2790,78 @@ static int _dm_message(const char *name, const char *msg)
                goto out;
 
        r = dm_task_run(dmt);
-
-      out:
+out:
        dm_task_destroy(dmt);
        return r;
 }
 
-int dm_suspend_and_wipe_key(struct crypt_device *cd, const char *name)
+int dm_suspend_device(struct crypt_device *cd, const char *name, uint32_t dmflags)
 {
+       uint32_t dmt_flags;
        int r = -ENOTSUP;
 
-       if (dm_init_context(cd))
-               return -ENOTSUP;
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return r;
 
-       if (!(_dm_crypt_flags & DM_KEY_WIPE_SUPPORTED))
-               goto out;
+       if (dmflags & DM_SUSPEND_WIPE_KEY) {
+               if (dm_flags(cd, DM_CRYPT, &dmt_flags))
+                       goto out;
 
-       if (!_dm_simple(DM_DEVICE_SUSPEND, name, 0)) {
-               r = -EINVAL;
-               goto out;
+               if (!(dmt_flags & DM_KEY_WIPE_SUPPORTED))
+                       goto out;
        }
 
-       if (!_dm_message(name, "key wipe")) {
-               _dm_simple(DM_DEVICE_RESUME, name, 1);
-               r = -EINVAL;
+       r = -EINVAL;
+
+       if (!_dm_simple(DM_DEVICE_SUSPEND, name, dmflags))
                goto out;
+
+       if (dmflags & DM_SUSPEND_WIPE_KEY) {
+               if (!_dm_message(name, "key wipe")) {
+                       _dm_resume_device(name, 0);
+                       goto out;
+               }
        }
+
        r = 0;
 out:
        dm_exit_context();
        return r;
 }
 
+int dm_resume_device(struct crypt_device *cd, const char *name, uint32_t dmflags)
+{
+       int r;
+
+       if (dm_init_context(cd, DM_UNKNOWN))
+               return -ENOTSUP;
+
+       r = _dm_resume_device(name, dmflags);
+
+       dm_exit_context();
+
+       return r;
+}
+
 int dm_resume_and_reinstate_key(struct crypt_device *cd, const char *name,
-                               size_t key_size, const char *key)
+                               const struct volume_key *vk)
 {
-       int msg_size = key_size * 2 + 10; // key set <key>
+       uint32_t dmt_flags;
+       int msg_size;
        char *msg = NULL;
        int r = -ENOTSUP;
 
-       if (dm_init_context(cd))
+       if (dm_init_context(cd, DM_CRYPT) || dm_flags(cd, DM_CRYPT, &dmt_flags))
                return -ENOTSUP;
 
-       if (!(_dm_crypt_flags & DM_KEY_WIPE_SUPPORTED))
+       if (!(dmt_flags & DM_KEY_WIPE_SUPPORTED))
                goto out;
 
+       if (vk->key_description)
+               msg_size = strlen(vk->key_description) + int_log10(vk->keylength) + 18;
+       else
+               msg_size = vk->keylength * 2 + 10; // key set <key>
+
        msg = crypt_safe_alloc(msg_size);
        if (!msg) {
                r = -ENOMEM;
@@ -1200,10 +2869,13 @@ int dm_resume_and_reinstate_key(struct crypt_device *cd, const char *name,
        }
 
        strcpy(msg, "key set ");
-       hex_key(&msg[8], key_size, key);
+       if (vk->key_description)
+               snprintf(msg + 8, msg_size - 8, ":%zu:logon:%s", vk->keylength, vk->key_description);
+       else
+               hex_key(&msg[8], vk->keylength, vk->key);
 
        if (!_dm_message(name, msg) ||
-           !_dm_simple(DM_DEVICE_RESUME, name, 1)) {
+           _dm_resume_device(name, 0)) {
                r = -EINVAL;
                goto out;
        }
@@ -1219,7 +2891,7 @@ const char *dm_get_dir(void)
        return dm_dir();
 }
 
-int dm_is_dm_device(int major, int minor)
+int dm_is_dm_device(int major)
 {
        return dm_is_dm_major((uint32_t)major);
 }
@@ -1228,3 +2900,147 @@ int dm_is_dm_kernel_name(const char *name)
 {
        return strncmp(name, "dm-", 3) ? 0 : 1;
 }
+
+int dm_crypt_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+       struct device *data_device, struct volume_key *vk, const char *cipher,
+       uint64_t iv_offset, uint64_t data_offset, const char *integrity, uint32_t tag_size,
+       uint32_t sector_size)
+{
+       int r = -EINVAL;
+
+       /* free on error */
+       char *dm_integrity = NULL;
+
+       if (tag_size) {
+               /* Space for IV metadata only */
+               dm_integrity = strdup(integrity ?: "none");
+               if (!dm_integrity) {
+                       r = -ENOMEM;
+                       goto err;
+               }
+       }
+
+       tgt->data_device = data_device;
+
+       tgt->type = DM_CRYPT;
+       tgt->direction = TARGET_SET;
+       tgt->u.crypt.vk = vk;
+       tgt->offset = seg_offset;
+       tgt->size = seg_size;
+
+       tgt->u.crypt.cipher = cipher;
+       tgt->u.crypt.integrity = dm_integrity;
+       tgt->u.crypt.iv_offset = iv_offset;
+       tgt->u.crypt.offset = data_offset;
+       tgt->u.crypt.tag_size = tag_size;
+       tgt->u.crypt.sector_size = sector_size;
+
+       return 0;
+err:
+       free(dm_integrity);
+
+       return r;
+}
+
+int dm_verity_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+       struct device *data_device, struct device *hash_device, struct device *fec_device,
+       const char *root_hash, uint32_t root_hash_size, const char *root_hash_sig_key_desc,
+       uint64_t hash_offset_block, uint64_t hash_blocks, struct crypt_params_verity *vp)
+{
+       if (!data_device || !hash_device || !vp)
+               return -EINVAL;
+
+       tgt->type = DM_VERITY;
+       tgt->direction = TARGET_SET;
+       tgt->offset = seg_offset;
+       tgt->size = seg_size;
+       tgt->data_device = data_device;
+
+       tgt->u.verity.hash_device = hash_device;
+       tgt->u.verity.fec_device = fec_device;
+       tgt->u.verity.root_hash = root_hash;
+       tgt->u.verity.root_hash_size = root_hash_size;
+       tgt->u.verity.root_hash_sig_key_desc = root_hash_sig_key_desc;
+       tgt->u.verity.hash_offset = hash_offset_block;
+       tgt->u.verity.fec_offset = vp->fec_area_offset / vp->hash_block_size;
+       tgt->u.verity.hash_blocks = hash_blocks;
+       tgt->u.verity.vp = vp;
+
+       return 0;
+}
+
+int dm_integrity_target_set(struct crypt_device *cd,
+                       struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+                       struct device *meta_device,
+                       struct device *data_device, uint64_t tag_size, uint64_t offset,
+                       uint32_t sector_size, struct volume_key *vk,
+                       struct volume_key *journal_crypt_key, struct volume_key *journal_mac_key,
+                       const struct crypt_params_integrity *ip)
+{
+       uint32_t dmi_flags;
+
+       if (!data_device)
+               return -EINVAL;
+
+       _dm_check_versions(cd, DM_INTEGRITY);
+
+       tgt->type = DM_INTEGRITY;
+       tgt->direction = TARGET_SET;
+       tgt->offset = seg_offset;
+       tgt->size = seg_size;
+       tgt->data_device = data_device;
+       if (meta_device != data_device)
+               tgt->u.integrity.meta_device = meta_device;
+       tgt->u.integrity.tag_size = tag_size;
+       tgt->u.integrity.offset = offset;
+       tgt->u.integrity.sector_size = sector_size;
+
+       tgt->u.integrity.vk = vk;
+       tgt->u.integrity.journal_crypt_key = journal_crypt_key;
+       tgt->u.integrity.journal_integrity_key = journal_mac_key;
+
+       if (!dm_flags(cd, DM_INTEGRITY, &dmi_flags) &&
+           (dmi_flags & DM_INTEGRITY_FIX_PADDING_SUPPORTED) &&
+           !(crypt_get_compatibility(cd) & CRYPT_COMPAT_LEGACY_INTEGRITY_PADDING))
+               tgt->u.integrity.fix_padding = true;
+
+       if (ip) {
+               tgt->u.integrity.journal_size = ip->journal_size;
+               tgt->u.integrity.journal_watermark = ip->journal_watermark;
+               tgt->u.integrity.journal_commit_time = ip->journal_commit_time;
+               tgt->u.integrity.interleave_sectors = ip->interleave_sectors;
+               tgt->u.integrity.buffer_sectors = ip->buffer_sectors;
+               tgt->u.integrity.journal_integrity = ip->journal_integrity;
+               tgt->u.integrity.journal_crypt = ip->journal_crypt;
+               tgt->u.integrity.integrity = ip->integrity;
+       }
+
+       return 0;
+}
+
+int dm_linear_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+       struct device *data_device, uint64_t data_offset)
+{
+       if (!data_device)
+               return -EINVAL;
+
+       tgt->type = DM_LINEAR;
+       tgt->direction = TARGET_SET;
+       tgt->offset = seg_offset;
+       tgt->size = seg_size;
+       tgt->data_device = data_device;
+
+       tgt->u.linear.offset = data_offset;
+
+       return 0;
+}
+
+int dm_zero_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size)
+{
+       tgt->type = DM_ZERO;
+       tgt->direction = TARGET_SET;
+       tgt->offset = seg_offset;
+       tgt->size = seg_size;
+
+       return 0;
+}
diff --git a/lib/loopaes/Makefile.am b/lib/loopaes/Makefile.am
deleted file mode 100644 (file)
index 0687c40..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-moduledir = $(libdir)/cryptsetup
-
-noinst_LTLIBRARIES = libloopaes.la
-
-libloopaes_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-
-libloopaes_la_SOURCES = \
-       loopaes.c \
-       loopaes.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
-
diff --git a/lib/loopaes/Makefile.in b/lib/loopaes/Makefile.in
deleted file mode 100644 (file)
index 24747de..0000000
+++ /dev/null
@@ -1,645 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = lib/loopaes
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libloopaes_la_LIBADD =
-am_libloopaes_la_OBJECTS = libloopaes_la-loopaes.lo
-libloopaes_la_OBJECTS = $(am_libloopaes_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libloopaes_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libloopaes_la_CFLAGS) \
-       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libloopaes_la_SOURCES)
-DIST_SOURCES = $(libloopaes_la_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-moduledir = $(libdir)/cryptsetup
-noinst_LTLIBRARIES = libloopaes.la
-libloopaes_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-libloopaes_la_SOURCES = \
-       loopaes.c \
-       loopaes.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/loopaes/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/loopaes/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
-       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-       @list='$(noinst_LTLIBRARIES)'; \
-       locs=`for p in $$list; do echo $$p; done | \
-             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-             sort -u`; \
-       test -z "$$locs" || { \
-         echo rm -f $${locs}; \
-         rm -f $${locs}; \
-       }
-
-libloopaes.la: $(libloopaes_la_OBJECTS) $(libloopaes_la_DEPENDENCIES) $(EXTRA_libloopaes_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libloopaes_la_LINK)  $(libloopaes_la_OBJECTS) $(libloopaes_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libloopaes_la-loopaes.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libloopaes_la-loopaes.lo: loopaes.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libloopaes_la_CFLAGS) $(CFLAGS) -MT libloopaes_la-loopaes.lo -MD -MP -MF $(DEPDIR)/libloopaes_la-loopaes.Tpo -c -o libloopaes_la-loopaes.lo `test -f 'loopaes.c' || echo '$(srcdir)/'`loopaes.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libloopaes_la-loopaes.Tpo $(DEPDIR)/libloopaes_la-loopaes.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='loopaes.c' object='libloopaes_la-loopaes.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libloopaes_la_CFLAGS) $(CFLAGS) -c -o libloopaes_la-loopaes.lo `test -f 'loopaes.c' || echo '$(srcdir)/'`loopaes.c
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-       clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-       ctags-am distclean distclean-compile distclean-generic \
-       distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
index 28a70b8..92090aa 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * loop-AES compatible volume handling
  *
- * Copyright (C) 2011-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2011-2013, Milan Broz
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -81,18 +81,18 @@ static int hash_keys(struct crypt_device *cd,
        const char *hash_name;
        char tweak, *key_ptr;
        unsigned int i;
-       int r;
+       int r = 0;
 
        hash_name = hash_override ?: get_hash(key_len_output);
        tweak = get_tweak(keys_count);
 
        if (!keys_count || !key_len_output || !hash_name || !key_len_input) {
-               log_err(cd, _("Key processing error (using hash %s).\n"),
+               log_err(cd, _("Key processing error (using hash %s)."),
                        hash_name ?: "[none]");
                return -EINVAL;
        }
 
-       *vk = crypt_alloc_volume_key(key_len_output * keys_count, NULL);
+       *vk = crypt_alloc_volume_key((size_t)key_len_output * keys_count, NULL);
        if (!*vk)
                return -ENOMEM;
 
@@ -137,13 +137,13 @@ int LOOPAES_parse_keyfile(struct crypt_device *cd,
        unsigned int key_lengths[LOOPAES_KEYS_MAX];
        unsigned int i, key_index, key_len, offset;
 
-       log_dbg("Parsing loop-AES keyfile of size %zu.", buffer_len);
+       log_dbg(cd, "Parsing loop-AES keyfile of size %zu.", buffer_len);
 
        if (!buffer_len)
                return -EINVAL;
 
        if (keyfile_is_gpg(buffer, buffer_len)) {
-               log_err(cd, _("Detected not yet supported GPG encrypted keyfile.\n"));
+               log_err(cd, _("Detected not yet supported GPG encrypted keyfile."));
                log_std(cd, _("Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"));
                return -EINVAL;
        }
@@ -164,8 +164,8 @@ int LOOPAES_parse_keyfile(struct crypt_device *cd,
                        key_lengths[key_index]++;
                }
                if (offset == buffer_len) {
-                       log_dbg("Unterminated key #%d in keyfile.", key_index);
-                       log_err(cd, _("Incompatible loop-AES keyfile detected.\n"));
+                       log_dbg(cd, "Unterminated key #%d in keyfile.", key_index);
+                       log_err(cd, _("Incompatible loop-AES keyfile detected."));
                        return -EINVAL;
                }
                while (offset < buffer_len && !buffer[offset])
@@ -177,7 +177,7 @@ int LOOPAES_parse_keyfile(struct crypt_device *cd,
        key_len = key_lengths[0];
        for (i = 0; i < key_index; i++)
                if (!key_lengths[i] || (key_lengths[i] != key_len)) {
-                       log_dbg("Unexpected length %d of key #%d (should be %d).",
+                       log_dbg(cd, "Unexpected length %d of key #%d (should be %d).",
                                key_lengths[i], i, key_len);
                        key_len = 0;
                        break;
@@ -185,11 +185,11 @@ int LOOPAES_parse_keyfile(struct crypt_device *cd,
 
        if (offset != buffer_len || key_len == 0 ||
           (key_index != 1 && key_index !=64 && key_index != 65)) {
-               log_err(cd, _("Incompatible loop-AES keyfile detected.\n"));
+               log_err(cd, _("Incompatible loop-AES keyfile detected."));
                return -EINVAL;
        }
 
-       log_dbg("Keyfile: %d keys of length %d.", key_index, key_len);
+       log_dbg(cd, "Keyfile: %d keys of length %d.", key_index, key_len);
 
        *keys_count = key_index;
        return hash_keys(cd, vk, hash, keys, key_index,
@@ -203,24 +203,15 @@ int LOOPAES_activate(struct crypt_device *cd,
                     struct volume_key *vk,
                     uint32_t flags)
 {
-       char *cipher = NULL;
-       uint32_t req_flags;
        int r;
+       uint32_t req_flags, dmc_flags;
+       char *cipher = NULL;
        struct crypt_dm_active_device dmd = {
-               .target = DM_CRYPT,
-               .size   = 0,
-               .flags  = flags,
-               .data_device = crypt_data_device(cd),
-               .u.crypt  = {
-                       .cipher = NULL,
-                       .vk     = vk,
-                       .offset = crypt_get_data_offset(cd),
-                       .iv_offset = crypt_get_iv_offset(cd),
-               }
+               .flags = flags,
        };
 
-       r = device_block_adjust(cd, dmd.data_device, DEV_EXCL,
-                               dmd.u.crypt.offset, &dmd.size, &dmd.flags);
+       r = device_block_adjust(cd, crypt_data_device(cd), DEV_EXCL,
+                               crypt_get_data_offset(cd), &dmd.size, &dmd.flags);
        if (r)
                return r;
 
@@ -234,17 +225,29 @@ int LOOPAES_activate(struct crypt_device *cd,
        if (r < 0)
                return -ENOMEM;
 
-       dmd.u.crypt.cipher = cipher;
-       log_dbg("Trying to activate loop-AES device %s using cipher %s.",
-               name, dmd.u.crypt.cipher);
+       r = dm_crypt_target_set(&dmd.segment, 0, dmd.size, crypt_data_device(cd),
+                       vk, cipher, crypt_get_iv_offset(cd),
+                       crypt_get_data_offset(cd), crypt_get_integrity(cd),
+                       crypt_get_integrity_tag_size(cd), crypt_get_sector_size(cd));
 
-       r = dm_create_device(cd, name, CRYPT_LOOPAES, &dmd, 0);
+       if (r) {
+               free(cipher);
+               return r;
+       }
+
+       log_dbg(cd, "Trying to activate loop-AES device %s using cipher %s.",
+               name, cipher);
 
-       if (r < 0 && !(dm_flags() & req_flags)) {
-               log_err(cd, _("Kernel doesn't support loop-AES compatible mapping.\n"));
+       r = dm_create_device(cd, name, CRYPT_LOOPAES, &dmd);
+
+       if (r < 0 && !dm_flags(cd, DM_CRYPT, &dmc_flags) &&
+           (dmc_flags & req_flags) != req_flags) {
+               log_err(cd, _("Kernel does not support loop-AES compatible mapping."));
                r = -ENOTSUP;
        }
 
+       dm_targets_free(cd, &dmd);
        free(cipher);
+
        return r;
 }
index 00d1a87..5f6e93f 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * loop-AES compatible volume handling
  *
- * Copyright (C) 2011-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2011-2013, Milan Broz
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,6 +22,7 @@
 #ifndef _LOOPAES_H
 #define _LOOPAES_H
 
+#include <stdint.h>
 #include <unistd.h>
 
 struct crypt_device;
diff --git a/lib/luks1/Makefile.am b/lib/luks1/Makefile.am
deleted file mode 100644 (file)
index 5d6800e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-moduledir = $(libdir)/cryptsetup
-
-noinst_LTLIBRARIES = libluks1.la
-
-libluks1_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-
-libluks1_la_SOURCES = \
-       af.c \
-       keymanage.c \
-       keyencryption.c \
-       af.h \
-       luks.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
-
diff --git a/lib/luks1/Makefile.in b/lib/luks1/Makefile.in
deleted file mode 100644 (file)
index f5d3fde..0000000
+++ /dev/null
@@ -1,665 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = lib/luks1
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libluks1_la_LIBADD =
-am_libluks1_la_OBJECTS = libluks1_la-af.lo libluks1_la-keymanage.lo \
-       libluks1_la-keyencryption.lo
-libluks1_la_OBJECTS = $(am_libluks1_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libluks1_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libluks1_la_CFLAGS) \
-       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libluks1_la_SOURCES)
-DIST_SOURCES = $(libluks1_la_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-moduledir = $(libdir)/cryptsetup
-noinst_LTLIBRARIES = libluks1.la
-libluks1_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-libluks1_la_SOURCES = \
-       af.c \
-       keymanage.c \
-       keyencryption.c \
-       af.h \
-       luks.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/luks1/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/luks1/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
-       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-       @list='$(noinst_LTLIBRARIES)'; \
-       locs=`for p in $$list; do echo $$p; done | \
-             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-             sort -u`; \
-       test -z "$$locs" || { \
-         echo rm -f $${locs}; \
-         rm -f $${locs}; \
-       }
-
-libluks1.la: $(libluks1_la_OBJECTS) $(libluks1_la_DEPENDENCIES) $(EXTRA_libluks1_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libluks1_la_LINK)  $(libluks1_la_OBJECTS) $(libluks1_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluks1_la-af.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluks1_la-keyencryption.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libluks1_la-keymanage.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libluks1_la-af.lo: af.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libluks1_la_CFLAGS) $(CFLAGS) -MT libluks1_la-af.lo -MD -MP -MF $(DEPDIR)/libluks1_la-af.Tpo -c -o libluks1_la-af.lo `test -f 'af.c' || echo '$(srcdir)/'`af.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libluks1_la-af.Tpo $(DEPDIR)/libluks1_la-af.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='af.c' object='libluks1_la-af.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libluks1_la_CFLAGS) $(CFLAGS) -c -o libluks1_la-af.lo `test -f 'af.c' || echo '$(srcdir)/'`af.c
-
-libluks1_la-keymanage.lo: keymanage.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libluks1_la_CFLAGS) $(CFLAGS) -MT libluks1_la-keymanage.lo -MD -MP -MF $(DEPDIR)/libluks1_la-keymanage.Tpo -c -o libluks1_la-keymanage.lo `test -f 'keymanage.c' || echo '$(srcdir)/'`keymanage.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libluks1_la-keymanage.Tpo $(DEPDIR)/libluks1_la-keymanage.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='keymanage.c' object='libluks1_la-keymanage.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libluks1_la_CFLAGS) $(CFLAGS) -c -o libluks1_la-keymanage.lo `test -f 'keymanage.c' || echo '$(srcdir)/'`keymanage.c
-
-libluks1_la-keyencryption.lo: keyencryption.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libluks1_la_CFLAGS) $(CFLAGS) -MT libluks1_la-keyencryption.lo -MD -MP -MF $(DEPDIR)/libluks1_la-keyencryption.Tpo -c -o libluks1_la-keyencryption.lo `test -f 'keyencryption.c' || echo '$(srcdir)/'`keyencryption.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libluks1_la-keyencryption.Tpo $(DEPDIR)/libluks1_la-keyencryption.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='keyencryption.c' object='libluks1_la-keyencryption.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libluks1_la_CFLAGS) $(CFLAGS) -c -o libluks1_la-keyencryption.lo `test -f 'keyencryption.c' || echo '$(srcdir)/'`keyencryption.c
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-       clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-       ctags-am distclean distclean-compile distclean-generic \
-       distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
index 835d997..a781376 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * AFsplitter - Anti forensic information splitter
  *
- * Copyright (C) 2004, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
  *
  * AFsplitter diffuses information over a large stripe of data,
- * therefor supporting secure data destruction.
+ * therefore supporting secure data destruction.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -25,7 +25,6 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-#include <netinet/in.h>
 #include <errno.h>
 #include "internal.h"
 #include "af.h"
@@ -34,7 +33,7 @@ static void XORblock(const char *src1, const char *src2, char *dst, size_t n)
 {
        size_t j;
 
-       for(j = 0; j < n; ++j)
+       for (j = 0; j < n; j++)
                dst[j] = src1[j] ^ src2[j];
 }
 
@@ -45,7 +44,7 @@ static int hash_buf(const char *src, char *dst, uint32_t iv,
        char *iv_char = (char *)&iv;
        int r;
 
-       iv = htonl(iv);
+       iv = be32_to_cpu(iv);
        if (crypt_hash_init(&hd, hash_name))
                return -EINVAL;
 
@@ -61,34 +60,38 @@ out:
        return r;
 }
 
-/* diffuse: Information spreading over the whole dataset with
+/*
+ * diffuse: Information spreading over the whole dataset with
  * the help of hash function.
  */
-
 static int diffuse(char *src, char *dst, size_t size, const char *hash_name)
 {
-       int hash_size = crypt_hash_size(hash_name);
+       int r, hash_size = crypt_hash_size(hash_name);
        unsigned int digest_size;
        unsigned int i, blocks, padding;
 
        if (hash_size <= 0)
-               return 1;
+               return -EINVAL;
        digest_size = hash_size;
 
        blocks = size / digest_size;
        padding = size % digest_size;
 
-       for (i = 0; i < blocks; i++)
-               if(hash_buf(src + digest_size * i,
+       for (i = 0; i < blocks; i++) {
+               r = hash_buf(src + digest_size * i,
                            dst + digest_size * i,
-                           i, (size_t)digest_size, hash_name))
-                       return 1;
+                           i, (size_t)digest_size, hash_name);
+               if (r < 0)
+                       return r;
+       }
 
-       if(padding)
-               if(hash_buf(src + digest_size * i,
+       if (padding) {
+               r = hash_buf(src + digest_size * i,
                            dst + digest_size * i,
-                           i, (size_t)padding, hash_name))
-                       return 1;
+                           i, (size_t)padding, hash_name);
+               if (r < 0)
+                       return r;
+       }
 
        return 0;
 }
@@ -98,53 +101,57 @@ static int diffuse(char *src, char *dst, size_t size, const char *hash_name)
  * blocknumbers. The same blocksize and blocknumbers values
  * must be supplied to AF_merge to recover information.
  */
-
-int AF_split(char *src, char *dst, size_t blocksize,
-            unsigned int blocknumbers, const char *hash)
+int AF_split(struct crypt_device *ctx, const char *src, char *dst,
+            size_t blocksize, unsigned int blocknumbers, const char *hash)
 {
        unsigned int i;
        char *bufblock;
-       int r = -EINVAL;
+       int r;
 
-       if((bufblock = calloc(blocksize, 1)) == NULL) return -ENOMEM;
+       bufblock = crypt_safe_alloc(blocksize);
+       if (!bufblock)
+               return -ENOMEM;
 
        /* process everything except the last block */
-       for(i=0; i<blocknumbers-1; i++) {
-               r = crypt_random_get(NULL, dst+(blocksize*i), blocksize, CRYPT_RND_NORMAL);
-               if(r < 0) goto out;
+       for (i = 0; i < blocknumbers - 1; i++) {
+               r = crypt_random_get(ctx, dst + blocksize * i, blocksize, CRYPT_RND_NORMAL);
+               if (r < 0)
+                       goto out;
 
-               XORblock(dst+(blocksize*i),bufblock,bufblock,blocksize);
-               if(diffuse(bufblock, bufblock, blocksize, hash))
+               XORblock(dst + blocksize * i, bufblock, bufblock, blocksize);
+               r = diffuse(bufblock, bufblock, blocksize, hash);
+               if (r < 0)
                        goto out;
        }
        /* the last block is computed */
-       XORblock(src,bufblock,dst+(i*blocksize),blocksize);
+       XORblock(src, bufblock, dst + blocksize * i, blocksize);
        r = 0;
 out:
-       free(bufblock);
+       crypt_safe_free(bufblock);
        return r;
 }
 
-int AF_merge(char *src, char *dst, size_t blocksize,
-            unsigned int blocknumbers, const char *hash)
+int AF_merge(struct crypt_device *ctx __attribute__((unused)), const char *src, char *dst,
+            size_t blocksize, unsigned int blocknumbers, const char *hash)
 {
        unsigned int i;
        char *bufblock;
-       int r = -EINVAL;
+       int r;
 
-       if((bufblock = calloc(blocksize, 1)) == NULL)
+       bufblock = crypt_safe_alloc(blocksize);
+       if (!bufblock)
                return -ENOMEM;
 
-       memset(bufblock,0,blocksize);
-       for(i=0; i<blocknumbers-1; i++) {
-               XORblock(src+(blocksize*i),bufblock,bufblock,blocksize);
-               if(diffuse(bufblock, bufblock, blocksize, hash))
+       for(i = 0; i < blocknumbers - 1; i++) {
+               XORblock(src + blocksize * i, bufblock, bufblock, blocksize);
+               r = diffuse(bufblock, bufblock, blocksize, hash);
+               if (r < 0)
                        goto out;
        }
        XORblock(src + blocksize * i, bufblock, dst, blocksize);
        r = 0;
 out:
-       free(bufblock);
+       crypt_safe_free(bufblock);
        return r;
 }
 
index b53e67b..06ba522 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * AFsplitter - Anti forensic information splitter
  *
- * Copyright (C) 2004, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
  *
  * AFsplitter diffuses information over a large stripe of data,
- * therefor supporting secure data destruction.
+ * therefore supporting secure data destruction.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -24,6 +24,8 @@
 #ifndef INCLUDED_CRYPTSETUP_LUKS_AF_H
 #define INCLUDED_CRYPTSETUP_LUKS_AF_H
 
+#include <stddef.h>
+
 /*
  * AF_split operates on src and produces information split data in
  * dst. src is assumed to be of the length blocksize. The data stripe
  * On error, both functions return -1, 0 otherwise.
  */
 
-int AF_split(char *src, char *dst, size_t blocksize, unsigned int blocknumbers, const char *hash);
-int AF_merge(char *src, char *dst, size_t blocksize, unsigned int blocknumbers, const char *hash);
+int AF_split(struct crypt_device *ctx, const char *src, char *dst,
+            size_t blocksize, unsigned int blocknumbers, const char *hash);
+int AF_merge(struct crypt_device *ctx, const char *src, char *dst, size_t blocksize,
+            unsigned int blocknumbers, const char *hash);
 size_t AF_split_sectors(size_t blocksize, unsigned int blocknumbers);
 
+int LUKS_encrypt_to_storage(
+       char *src, size_t srcLength,
+       const char *cipher,
+       const char *cipher_mode,
+       struct volume_key *vk,
+       unsigned int sector,
+       struct crypt_device *ctx);
+
+int LUKS_decrypt_from_storage(
+       char *dst, size_t dstLength,
+       const char *cipher,
+       const char *cipher_mode,
+       struct volume_key *vk,
+       unsigned int sector,
+       struct crypt_device *ctx);
+
 #endif
index 3bc9c33..fdab63a 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * LUKS - Linux Unified Key Setup
  *
- * Copyright (C) 2004-2006, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2014, Milan Broz
+ * Copyright (C) 2004-2006 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include <stdio.h>
-#include <fcntl.h>
+#include <string.h>
 #include <errno.h>
+#include <sys/stat.h>
 #include "luks.h"
+#include "af.h"
 #include "internal.h"
 
 static void _error_hint(struct crypt_device *ctx, const char *device,
                        const char *cipher, const char *mode, size_t keyLength)
 {
-       char cipher_spec[MAX_CIPHER_LEN * 3];
+       char *c, cipher_spec[MAX_CIPHER_LEN * 3];
 
        if (snprintf(cipher_spec, sizeof(cipher_spec), "%s-%s", cipher, mode) < 0)
                return;
 
        log_err(ctx, _("Failed to setup dm-crypt key mapping for device %s.\n"
-                       "Check that kernel supports %s cipher (check syslog for more info).\n"),
+                       "Check that kernel supports %s cipher (check syslog for more info)."),
                        device, cipher_spec);
 
        if (!strncmp(mode, "xts", 3) && (keyLength != 256 && keyLength != 512))
-               log_err(ctx, _("Key size in XTS mode must be 256 or 512 bits.\n"));
+               log_err(ctx, _("Key size in XTS mode must be 256 or 512 bits."));
+       else if (!(c = strchr(mode, '-')) || strlen(c) < 4)
+               log_err(ctx, _("Cipher specification should be in [cipher]-[mode]-[iv] format."));
 }
 
 static int LUKS_endec_template(char *src, size_t srcLength,
                               const char *cipher, const char *cipher_mode,
                               struct volume_key *vk,
                               unsigned int sector,
-                              ssize_t (*func)(int, int, void *, size_t),
+                              ssize_t (*func)(int, size_t, size_t, void *, size_t),
                               int mode,
                               struct crypt_device *ctx)
 {
        char name[PATH_MAX], path[PATH_MAX];
        char cipher_spec[MAX_CIPHER_LEN * 3];
        struct crypt_dm_active_device dmd = {
-               .target = DM_CRYPT,
-               .uuid   = NULL,
-               .flags  = CRYPT_ACTIVATE_PRIVATE,
-               .data_device = crypt_metadata_device(ctx),
-               .u.crypt = {
-                       .cipher = cipher_spec,
-                       .vk     = vk,
-                       .offset = sector,
-                       .iv_offset = 0,
-               }
+               .flags = CRYPT_ACTIVATE_PRIVATE,
        };
-       int r, bsize, devfd = -1;
+       int r, devfd = -1, remove_dev = 0;
+       size_t bsize, keyslot_alignment, alignment;
 
-       log_dbg("Using dmcrypt to access keyslot area.");
+       log_dbg(ctx, "Using dmcrypt to access keyslot area.");
 
-       bsize = device_block_size(dmd.data_device);
-       if (bsize <= 0)
+       bsize = device_block_size(ctx, crypt_metadata_device(ctx));
+       alignment = device_alignment(crypt_metadata_device(ctx));
+       if (!bsize || !alignment)
                return -EINVAL;
 
-       dmd.size = size_round_up(srcLength, bsize) / SECTOR_SIZE;
+       if (bsize > LUKS_ALIGN_KEYSLOTS)
+               keyslot_alignment = LUKS_ALIGN_KEYSLOTS;
+       else
+               keyslot_alignment = bsize;
+       dmd.size = size_round_up(srcLength, keyslot_alignment) / SECTOR_SIZE;
 
        if (mode == O_RDONLY)
                dmd.flags |= CRYPT_ACTIVATE_READONLY;
@@ -84,45 +85,55 @@ static int LUKS_endec_template(char *src, size_t srcLength,
        if (snprintf(cipher_spec, sizeof(cipher_spec), "%s-%s", cipher, cipher_mode) < 0)
                return -ENOMEM;
 
-       r = device_block_adjust(ctx, dmd.data_device, DEV_OK,
-                               dmd.u.crypt.offset, &dmd.size, &dmd.flags);
+       r = device_block_adjust(ctx, crypt_metadata_device(ctx), DEV_OK,
+                               sector, &dmd.size, &dmd.flags);
        if (r < 0) {
-               log_err(ctx, _("Device %s doesn't exist or access denied.\n"),
-                       device_path(dmd.data_device));
+               log_err(ctx, _("Device %s does not exist or access denied."),
+                       device_path(crypt_metadata_device(ctx)));
                return -EIO;
        }
 
        if (mode != O_RDONLY && dmd.flags & CRYPT_ACTIVATE_READONLY) {
-               log_err(ctx, _("Cannot write to device %s, permission denied.\n"),
-                       device_path(dmd.data_device));
+               log_err(ctx, _("Cannot write to device %s, permission denied."),
+                       device_path(crypt_metadata_device(ctx)));
                return -EACCES;
        }
 
-       r = dm_create_device(ctx, name, "TEMP", &dmd, 0);
+       r = dm_crypt_target_set(&dmd.segment, 0, dmd.size,
+                       crypt_metadata_device(ctx), vk, cipher_spec, 0, sector,
+                       NULL, 0, SECTOR_SIZE);
+       if (r)
+               goto out;
+
+       r = dm_create_device(ctx, name, "TEMP", &dmd);
        if (r < 0) {
                if (r != -EACCES && r != -ENOTSUP)
-                       _error_hint(ctx, device_path(dmd.data_device),
+                       _error_hint(ctx, device_path(crypt_metadata_device(ctx)),
                                    cipher, cipher_mode, vk->keylength * 8);
-               return -EIO;
+               r = -EIO;
+               goto out;
        }
+       remove_dev = 1;
 
        devfd = open(path, mode | O_DIRECT | O_SYNC);
        if (devfd == -1) {
-               log_err(ctx, _("Failed to open temporary keystore device.\n"));
+               log_err(ctx, _("Failed to open temporary keystore device."));
                r = -EIO;
                goto out;
        }
 
-       r = func(devfd, bsize, src, srcLength);
+       r = func(devfd, bsize, alignment, src, srcLength);
        if (r < 0) {
-               log_err(ctx, _("Failed to access temporary keystore device.\n"));
+               log_err(ctx, _("Failed to access temporary keystore device."));
                r = -EIO;
        } else
                r = 0;
  out:
-       if(devfd != -1)
+       dm_targets_free(ctx, &dmd);
+       if (devfd != -1)
                close(devfd);
-       dm_remove_device(ctx, name, 1, dmd.size);
+       if (remove_dev)
+               dm_remove_device(ctx, name, CRYPT_DEACTIVATE_FORCE);
        return r;
 }
 
@@ -133,20 +144,19 @@ int LUKS_encrypt_to_storage(char *src, size_t srcLength,
                            unsigned int sector,
                            struct crypt_device *ctx)
 {
-
        struct device *device = crypt_metadata_device(ctx);
        struct crypt_storage *s;
-       int devfd = -1, bsize, r = 0;
+       int devfd, r = 0;
 
        /* Only whole sector writes supported */
-       if (srcLength % SECTOR_SIZE)
+       if (MISALIGNED_512(srcLength))
                return -EINVAL;
 
        /* Encrypt buffer */
-       r = crypt_storage_init(&s, 0, cipher, cipher_mode, vk->key, vk->keylength);
+       r = crypt_storage_init(&s, SECTOR_SIZE, cipher, cipher_mode, vk->key, vk->keylength);
 
        if (r)
-               log_dbg("Userspace crypto wrapper cannot use %s-%s (%d).",
+               log_dbg(ctx, "Userspace crypto wrapper cannot use %s-%s (%d).",
                        cipher, cipher_mode, r);
 
        /* Fallback to old temporary dmcrypt device */
@@ -160,9 +170,9 @@ int LUKS_encrypt_to_storage(char *src, size_t srcLength,
                return r;
        }
 
-       log_dbg("Using userspace crypto wrapper to access keyslot area.");
+       log_dbg(ctx, "Using userspace crypto wrapper to access keyslot area.");
 
-       r = crypt_storage_encrypt(s, 0, srcLength / SECTOR_SIZE, src);
+       r = crypt_storage_encrypt(s, 0, srcLength, src);
        crypt_storage_destroy(s);
 
        if (r)
@@ -171,24 +181,23 @@ int LUKS_encrypt_to_storage(char *src, size_t srcLength,
        r = -EIO;
 
        /* Write buffer to device */
-       bsize = device_block_size(device);
-       if (bsize <= 0)
-               goto out;
-
-       devfd = device_open(device, O_RDWR);
-       if (devfd == -1)
+       if (device_is_locked(device))
+               devfd = device_open_locked(ctx, device, O_RDWR);
+       else
+               devfd = device_open(ctx, device, O_RDWR);
+       if (devfd < 0)
                goto out;
 
-       if (lseek(devfd, sector * SECTOR_SIZE, SEEK_SET) == -1 ||
-           write_blockwise(devfd, bsize, src, srcLength) == -1)
+       if (write_lseek_blockwise(devfd, device_block_size(ctx, device),
+                                 device_alignment(device), src, srcLength,
+                                 sector * SECTOR_SIZE) < 0)
                goto out;
 
        r = 0;
 out:
-       if(devfd != -1)
-               close(devfd);
+       device_sync(ctx, device);
        if (r)
-               log_err(ctx, _("IO error while encrypting keyslot.\n"));
+               log_err(ctx, _("IO error while encrypting keyslot."));
 
        return r;
 }
@@ -202,16 +211,17 @@ int LUKS_decrypt_from_storage(char *dst, size_t dstLength,
 {
        struct device *device = crypt_metadata_device(ctx);
        struct crypt_storage *s;
-       int devfd = -1, bsize, r = 0;
+       struct stat st;
+       int devfd, r = 0;
 
        /* Only whole sector reads supported */
-       if (dstLength % SECTOR_SIZE)
+       if (MISALIGNED_512(dstLength))
                return -EINVAL;
 
-       r = crypt_storage_init(&s, 0, cipher, cipher_mode, vk->key, vk->keylength);
+       r = crypt_storage_init(&s, SECTOR_SIZE, cipher, cipher_mode, vk->key, vk->keylength);
 
        if (r)
-               log_dbg("Userspace crypto wrapper cannot use %s-%s (%d).",
+               log_dbg(ctx, "Userspace crypto wrapper cannot use %s-%s (%d).",
                        cipher, cipher_mode, r);
 
        /* Fallback to old temporary dmcrypt device */
@@ -225,35 +235,33 @@ int LUKS_decrypt_from_storage(char *dst, size_t dstLength,
                return r;
        }
 
-       log_dbg("Using userspace crypto wrapper to access keyslot area.");
-
-       r = -EIO;
+       log_dbg(ctx, "Using userspace crypto wrapper to access keyslot area.");
 
        /* Read buffer from device */
-       bsize = device_block_size(device);
-       if (bsize <= 0)
-               goto bad;
-
-       devfd = device_open(device, O_RDONLY);
-       if (devfd == -1)
-               goto bad;
+       if (device_is_locked(device))
+               devfd = device_open_locked(ctx, device, O_RDONLY);
+       else
+               devfd = device_open(ctx, device, O_RDONLY);
+       if (devfd < 0) {
+               log_err(ctx, _("Cannot open device %s."), device_path(device));
+               crypt_storage_destroy(s);
+               return -EIO;
+       }
 
-       if (lseek(devfd, sector * SECTOR_SIZE, SEEK_SET) == -1 ||
-           read_blockwise(devfd, bsize, dst, dstLength) == -1)
-               goto bad;
+       if (read_lseek_blockwise(devfd, device_block_size(ctx, device),
+                                device_alignment(device), dst, dstLength,
+                                sector * SECTOR_SIZE) < 0) {
+               if (!fstat(devfd, &st) && (st.st_size < (off_t)dstLength))
+                       log_err(ctx, _("Device %s is too small."), device_path(device));
+               else
+                       log_err(ctx, _("IO error while decrypting keyslot."));
 
-       close(devfd);
+               crypt_storage_destroy(s);
+               return -EIO;
+       }
 
        /* Decrypt buffer */
-       r = crypt_storage_decrypt(s, 0, dstLength / SECTOR_SIZE, dst);
-       crypt_storage_destroy(s);
-
-       return r;
-bad:
-       if(devfd != -1)
-               close(devfd);
-
-       log_err(ctx, _("IO error while decrypting keyslot.\n"));
+       r = crypt_storage_decrypt(s, 0, dstLength, dst);
        crypt_storage_destroy(s);
 
        return r;
index 8ae2af8..a08ff50 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * LUKS - Linux Unified Key Setup
  *
- * Copyright (C) 2004-2006, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2013-2014, Milan Broz
+ * Copyright (C) 2004-2006 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2013-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -23,7 +23,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <netinet/in.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stdio.h>
 #include "af.h"
 #include "internal.h"
 
-/* Get size of struct luks_phdr with all keyslots material space */
-static size_t LUKS_device_sectors(size_t keyLen)
-{
-       size_t keyslot_sectors, sector;
-       int i;
-
-       keyslot_sectors = AF_split_sectors(keyLen, LUKS_STRIPES);
-       sector = LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE;
-
-       for (i = 0; i < LUKS_NUMKEYS; i++) {
-               sector = size_round_up(sector, LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE);
-               sector += keyslot_sectors;
-       }
-
-       return sector;
-}
-
-int LUKS_keyslot_area(struct luks_phdr *hdr,
+int LUKS_keyslot_area(const struct luks_phdr *hdr,
        int keyslot,
        uint64_t *offset,
        uint64_t *length)
@@ -62,32 +44,70 @@ int LUKS_keyslot_area(struct luks_phdr *hdr,
        if(keyslot >= LUKS_NUMKEYS || keyslot < 0)
                return -EINVAL;
 
-       *offset = hdr->keyblock[keyslot].keyMaterialOffset * SECTOR_SIZE;
+       *offset = (uint64_t)hdr->keyblock[keyslot].keyMaterialOffset * SECTOR_SIZE;
        *length = AF_split_sectors(hdr->keyBytes, LUKS_STRIPES) * SECTOR_SIZE;
 
        return 0;
 }
 
-static int LUKS_check_device_size(struct crypt_device *ctx, size_t keyLength)
+/* insertsort: because the array has 8 elements and it's mostly sorted. that's why */
+static void LUKS_sort_keyslots(const struct luks_phdr *hdr, int *array)
+{
+       int i, j, x;
+
+       for (i = 1; i < LUKS_NUMKEYS; i++) {
+               j = i;
+               while (j > 0 && hdr->keyblock[array[j-1]].keyMaterialOffset > hdr->keyblock[array[j]].keyMaterialOffset) {
+                       x = array[j];
+                       array[j] = array[j-1];
+                       array[j-1] = x;
+                       j--;
+               }
+       }
+}
+
+size_t LUKS_device_sectors(const struct luks_phdr *hdr)
+{
+       int sorted_areas[LUKS_NUMKEYS] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+
+       LUKS_sort_keyslots(hdr, sorted_areas);
+
+       return hdr->keyblock[sorted_areas[LUKS_NUMKEYS-1]].keyMaterialOffset + AF_split_sectors(hdr->keyBytes, LUKS_STRIPES);
+}
+
+size_t LUKS_keyslots_offset(const struct luks_phdr *hdr)
+{
+       int sorted_areas[LUKS_NUMKEYS] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+
+       LUKS_sort_keyslots(hdr, sorted_areas);
+
+       return hdr->keyblock[sorted_areas[0]].keyMaterialOffset;
+}
+
+static int LUKS_check_device_size(struct crypt_device *ctx, const struct luks_phdr *hdr, int falloc)
 {
        struct device *device = crypt_metadata_device(ctx);
        uint64_t dev_sectors, hdr_sectors;
 
-       if (!keyLength)
+       if (!hdr->keyBytes)
                return -EINVAL;
 
-       if(device_size(device, &dev_sectors)) {
-               log_dbg("Cannot get device size for device %s.", device_path(device));
+       if (device_size(device, &dev_sectors)) {
+               log_dbg(ctx, "Cannot get device size for device %s.", device_path(device));
                return -EIO;
        }
 
        dev_sectors >>= SECTOR_SHIFT;
-       hdr_sectors = LUKS_device_sectors(keyLength);
-       log_dbg("Key length %zu, device size %" PRIu64 " sectors, header size %"
-               PRIu64 " sectors.",keyLength, dev_sectors, hdr_sectors);
+       hdr_sectors = LUKS_device_sectors(hdr);
+       log_dbg(ctx, "Key length %u, device size %" PRIu64 " sectors, header size %"
+               PRIu64 " sectors.", hdr->keyBytes, dev_sectors, hdr_sectors);
 
        if (hdr_sectors > dev_sectors) {
-               log_err(ctx, _("Device %s is too small. (LUKS requires at least %" PRIu64 " bytes.)\n"),
+               /* If it is header file, increase its size */
+               if (falloc && !device_fallocate(device, hdr_sectors << SECTOR_SHIFT))
+                       return 0;
+
+               log_err(ctx, _("Device %s is too small. (LUKS1 requires at least %" PRIu64 " bytes.)"),
                        device_path(device), hdr_sectors * SECTOR_SIZE);
                return -EINVAL;
        }
@@ -95,40 +115,67 @@ static int LUKS_check_device_size(struct crypt_device *ctx, size_t keyLength)
        return 0;
 }
 
-/* Check keyslot to prevent access outside of header and keyslot area */
-static int LUKS_check_keyslot_size(const struct luks_phdr *phdr, unsigned int keyIndex)
+static int LUKS_check_keyslots(struct crypt_device *ctx, const struct luks_phdr *phdr)
 {
-       uint32_t secs_per_stripes;
+       int i, prev, next, sorted_areas[LUKS_NUMKEYS] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+       uint32_t secs_per_stripes = AF_split_sectors(phdr->keyBytes, LUKS_STRIPES);
 
-       /* First sectors is the header itself */
-       if (phdr->keyblock[keyIndex].keyMaterialOffset * SECTOR_SIZE < sizeof(*phdr)) {
-               log_dbg("Invalid offset %u in keyslot %u.",
-                       phdr->keyblock[keyIndex].keyMaterialOffset, keyIndex);
-               return 1;
-       }
+       LUKS_sort_keyslots(phdr, sorted_areas);
+
+       /* Check keyslot to prevent access outside of header and keyslot area */
+       for (i = 0; i < LUKS_NUMKEYS; i++) {
+               /* enforce stripes == 4000 */
+               if (phdr->keyblock[i].stripes != LUKS_STRIPES) {
+                       log_dbg(ctx, "Invalid stripes count %u in keyslot %u.",
+                               phdr->keyblock[i].stripes, i);
+                       log_err(ctx, _("LUKS keyslot %u is invalid."), i);
+                       return -1;
+               }
 
-       /* Ignore following check for detached header where offset can be zero. */
-       if (phdr->payloadOffset == 0)
-               return 0;
+               /* First sectors is the header itself */
+               if (phdr->keyblock[i].keyMaterialOffset * SECTOR_SIZE < sizeof(*phdr)) {
+                       log_dbg(ctx, "Invalid offset %u in keyslot %u.",
+                               phdr->keyblock[i].keyMaterialOffset, i);
+                       log_err(ctx, _("LUKS keyslot %u is invalid."), i);
+                       return -1;
+               }
 
-       if (phdr->payloadOffset <= phdr->keyblock[keyIndex].keyMaterialOffset) {
-               log_dbg("Invalid offset %u in keyslot %u (beyond data area offset %u).",
-                       phdr->keyblock[keyIndex].keyMaterialOffset, keyIndex,
-                       phdr->payloadOffset);
-               return 1;
-       }
+               /* Ignore following check for detached header where offset can be zero. */
+               if (phdr->payloadOffset == 0)
+                       continue;
 
-       secs_per_stripes = AF_split_sectors(phdr->keyBytes, phdr->keyblock[keyIndex].stripes);
+               if (phdr->payloadOffset <= phdr->keyblock[i].keyMaterialOffset) {
+                       log_dbg(ctx, "Invalid offset %u in keyslot %u (beyond data area offset %u).",
+                               phdr->keyblock[i].keyMaterialOffset, i,
+                               phdr->payloadOffset);
+                       log_err(ctx, _("LUKS keyslot %u is invalid."), i);
+                       return -1;
+               }
+
+               if (phdr->payloadOffset < (phdr->keyblock[i].keyMaterialOffset + secs_per_stripes)) {
+                       log_dbg(ctx, "Invalid keyslot size %u (offset %u, stripes %u) in "
+                               "keyslot %u (beyond data area offset %u).",
+                               secs_per_stripes,
+                               phdr->keyblock[i].keyMaterialOffset,
+                               phdr->keyblock[i].stripes,
+                               i, phdr->payloadOffset);
+                       log_err(ctx, _("LUKS keyslot %u is invalid."), i);
+                       return -1;
+               }
+       }
 
-       if (phdr->payloadOffset < (phdr->keyblock[keyIndex].keyMaterialOffset + secs_per_stripes)) {
-               log_dbg("Invalid keyslot size %u (offset %u, stripes %u) in "
-                       "keyslot %u (beyond data area offset %u).",
-                       secs_per_stripes,
-                       phdr->keyblock[keyIndex].keyMaterialOffset,
-                       phdr->keyblock[keyIndex].stripes,
-                       keyIndex, phdr->payloadOffset);
-               return 1;
+       /* check no keyslot overlaps with each other */
+       for (i = 1; i < LUKS_NUMKEYS; i++) {
+               prev = sorted_areas[i-1];
+               next = sorted_areas[i];
+               if (phdr->keyblock[next].keyMaterialOffset <
+                   (phdr->keyblock[prev].keyMaterialOffset + secs_per_stripes)) {
+                       log_dbg(ctx, "Not enough space in LUKS keyslot %d.", prev);
+                       log_err(ctx, _("LUKS keyslot %u is invalid."), prev);
+                       return -1;
+               }
        }
+       /* do not check last keyslot on purpose, it must be tested in device size check */
 
        return 0;
 }
@@ -152,16 +199,17 @@ int LUKS_hdr_backup(const char *backup_file, struct crypt_device *ctx)
 {
        struct device *device = crypt_metadata_device(ctx);
        struct luks_phdr hdr;
-       int r = 0, devfd = -1;
-       ssize_t hdr_size;
-       ssize_t buffer_size;
+       int fd, devfd, r = 0;
+       size_t hdr_size;
+       size_t buffer_size;
+       ssize_t ret;
        char *buffer = NULL;
 
        r = LUKS_read_phdr(&hdr, 1, 0, ctx);
        if (r)
                return r;
 
-       hdr_size = LUKS_device_sectors(hdr.keyBytes) << SECTOR_SHIFT;
+       hdr_size = LUKS_device_sectors(&hdr) << SECTOR_SHIFT;
        buffer_size = size_round_up(hdr_size, crypt_getpagesize());
 
        buffer = crypt_safe_alloc(buffer_size);
@@ -170,49 +218,48 @@ int LUKS_hdr_backup(const char *backup_file, struct crypt_device *ctx)
                goto out;
        }
 
-       log_dbg("Storing backup of header (%zu bytes) and keyslot area (%zu bytes).",
+       log_dbg(ctx, "Storing backup of header (%zu bytes) and keyslot area (%zu bytes).",
                sizeof(hdr), hdr_size - LUKS_ALIGN_KEYSLOTS);
 
-       log_dbg("Output backup file size: %zu bytes.", buffer_size);
+       log_dbg(ctx, "Output backup file size: %zu bytes.", buffer_size);
 
-       devfd = device_open(device, O_RDONLY);
-       if(devfd == -1) {
-               log_err(ctx, _("Device %s is not a valid LUKS device.\n"), device_path(device));
+       devfd = device_open(ctx, device, O_RDONLY);
+       if (devfd < 0) {
+               log_err(ctx, _("Device %s is not a valid LUKS device."), device_path(device));
                r = -EINVAL;
                goto out;
        }
 
-       if (read_blockwise(devfd, device_block_size(device), buffer, hdr_size) < hdr_size) {
+       if (read_lseek_blockwise(devfd, device_block_size(ctx, device), device_alignment(device),
+                          buffer, hdr_size, 0) < (ssize_t)hdr_size) {
                r = -EIO;
                goto out;
        }
-       close(devfd);
 
        /* Wipe unused area, so backup cannot contain old signatures */
        if (hdr.keyblock[0].keyMaterialOffset * SECTOR_SIZE == LUKS_ALIGN_KEYSLOTS)
                memset(buffer + sizeof(hdr), 0, LUKS_ALIGN_KEYSLOTS - sizeof(hdr));
 
-       devfd = open(backup_file, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR);
-       if (devfd == -1) {
+       fd = open(backup_file, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR);
+       if (fd == -1) {
                if (errno == EEXIST)
-                       log_err(ctx, _("Requested header backup file %s already exists.\n"), backup_file);
+                       log_err(ctx, _("Requested header backup file %s already exists."), backup_file);
                else
-                       log_err(ctx, _("Cannot create header backup file %s.\n"), backup_file);
+                       log_err(ctx, _("Cannot create header backup file %s."), backup_file);
                r = -EINVAL;
                goto out;
        }
-       if (write(devfd, buffer, buffer_size) < buffer_size) {
-               log_err(ctx, _("Cannot write header backup file %s.\n"), backup_file);
+       ret = write_buffer(fd, buffer, buffer_size);
+       close(fd);
+       if (ret < (ssize_t)buffer_size) {
+               log_err(ctx, _("Cannot write header backup file %s."), backup_file);
                r = -EIO;
                goto out;
        }
-       close(devfd);
 
        r = 0;
 out:
-       if (devfd != -1)
-               close(devfd);
-       crypt_memzero(&hdr, sizeof(hdr));
+       crypt_safe_memzero(&hdr, sizeof(hdr));
        crypt_safe_free(buffer);
        return r;
 }
@@ -223,8 +270,8 @@ int LUKS_hdr_restore(
        struct crypt_device *ctx)
 {
        struct device *device = crypt_metadata_device(ctx);
-       int r = 0, devfd = -1, diff_uuid = 0;
-       ssize_t buffer_size = 0;
+       int fd, r = 0, devfd = -1, diff_uuid = 0;
+       ssize_t ret, buffer_size = 0;
        char *buffer = NULL, msg[200];
        struct luks_phdr hdr_file;
 
@@ -233,10 +280,10 @@ int LUKS_hdr_restore(
                return r;
 
        if (!r)
-               buffer_size = LUKS_device_sectors(hdr_file.keyBytes) << SECTOR_SHIFT;
+               buffer_size = LUKS_device_sectors(&hdr_file) << SECTOR_SHIFT;
 
        if (r || buffer_size < LUKS_ALIGN_KEYSLOTS) {
-               log_err(ctx, _("Backup file doesn't contain valid LUKS header.\n"));
+               log_err(ctx, _("Backup file does not contain valid LUKS header."));
                r = -EINVAL;
                goto out;
        }
@@ -247,26 +294,27 @@ int LUKS_hdr_restore(
                goto out;
        }
 
-       devfd = open(backup_file, O_RDONLY);
-       if (devfd == -1) {
-               log_err(ctx, _("Cannot open header backup file %s.\n"), backup_file);
+       fd = open(backup_file, O_RDONLY);
+       if (fd == -1) {
+               log_err(ctx, _("Cannot open header backup file %s."), backup_file);
                r = -EINVAL;
                goto out;
        }
 
-       if (read(devfd, buffer, buffer_size) < buffer_size) {
-               log_err(ctx, _("Cannot read header backup file %s.\n"), backup_file);
+       ret = read_buffer(fd, buffer, buffer_size);
+       close(fd);
+       if (ret < buffer_size) {
+               log_err(ctx, _("Cannot read header backup file %s."), backup_file);
                r = -EIO;
                goto out;
        }
-       close(devfd);
 
        r = LUKS_read_phdr(hdr, 0, 0, ctx);
        if (r == 0) {
-               log_dbg("Device %s already contains LUKS header, checking UUID and offset.", device_path(device));
+               log_dbg(ctx, "Device %s already contains LUKS header, checking UUID and offset.", device_path(device));
                if(hdr->payloadOffset != hdr_file.payloadOffset ||
                   hdr->keyBytes != hdr_file.keyBytes) {
-                       log_err(ctx, _("Data offset or key size differs on device and backup, restore failed.\n"));
+                       log_err(ctx, _("Data offset or key size differs on device and backup, restore failed."));
                        r = -EINVAL;
                        goto out;
                }
@@ -287,31 +335,30 @@ int LUKS_hdr_restore(
                goto out;
        }
 
-       log_dbg("Storing backup of header (%zu bytes) and keyslot area (%zu bytes) to device %s.",
+       log_dbg(ctx, "Storing backup of header (%zu bytes) and keyslot area (%zu bytes) to device %s.",
                sizeof(*hdr), buffer_size - LUKS_ALIGN_KEYSLOTS, device_path(device));
 
-       devfd = device_open(device, O_RDWR);
-       if (devfd == -1) {
+       devfd = device_open(ctx, device, O_RDWR);
+       if (devfd < 0) {
                if (errno == EACCES)
-                       log_err(ctx, _("Cannot write to device %s, permission denied.\n"),
+                       log_err(ctx, _("Cannot write to device %s, permission denied."),
                                device_path(device));
                else
-                       log_err(ctx, _("Cannot open device %s.\n"), device_path(device));
+                       log_err(ctx, _("Cannot open device %s."), device_path(device));
                r = -EINVAL;
                goto out;
        }
 
-       if (write_blockwise(devfd, device_block_size(device), buffer, buffer_size) < buffer_size) {
+       if (write_lseek_blockwise(devfd, device_block_size(ctx, device), device_alignment(device),
+                           buffer, buffer_size, 0) < buffer_size) {
                r = -EIO;
                goto out;
        }
-       close(devfd);
 
        /* Be sure to reload new data */
        r = LUKS_read_phdr(hdr, 1, 0, ctx);
 out:
-       if (devfd != -1)
-               close(devfd);
+       device_sync(ctx, device);
        crypt_safe_free(buffer);
        return r;
 }
@@ -322,45 +369,44 @@ static int _keyslot_repair(struct luks_phdr *phdr, struct crypt_device *ctx)
        struct luks_phdr temp_phdr;
        const unsigned char *sector = (const unsigned char*)phdr;
        struct volume_key *vk;
-       uint64_t PBKDF2_per_sec = 1;
        int i, bad, r, need_write = 0;
 
        if (phdr->keyBytes != 16 && phdr->keyBytes != 32 && phdr->keyBytes != 64) {
-               log_err(ctx, _("Non standard key size, manual repair required.\n"));
+               log_err(ctx, _("Non standard key size, manual repair required."));
                return -EINVAL;
        }
        /* cryptsetup 1.0 did not align to 4k, cannot repair this one */
-       if (phdr->keyblock[0].keyMaterialOffset < (LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE)) {
-               log_err(ctx, _("Non standard keyslots alignment, manual repair required.\n"));
+       if (LUKS_keyslots_offset(phdr) < (LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE)) {
+               log_err(ctx, _("Non standard keyslots alignment, manual repair required."));
                return -EINVAL;
        }
 
+       r = LUKS_check_cipher(ctx, phdr->keyBytes, phdr->cipherName, phdr->cipherMode);
+       if (r < 0)
+               return -EINVAL;
+
        vk = crypt_alloc_volume_key(phdr->keyBytes, NULL);
 
-       log_verbose(ctx, _("Repairing keyslots.\n"));
+       log_verbose(ctx, _("Repairing keyslots."));
 
-       log_dbg("Generating second header with the same parameters for check.");
+       log_dbg(ctx, "Generating second header with the same parameters for check.");
        /* cipherName, cipherMode, hashSpec, uuid are already null terminated */
        /* payloadOffset - cannot check */
        r = LUKS_generate_phdr(&temp_phdr, vk, phdr->cipherName, phdr->cipherMode,
-                              phdr->hashSpec,phdr->uuid, LUKS_STRIPES,
-                              phdr->payloadOffset, 0,
-                              1, &PBKDF2_per_sec,
-                              1, ctx);
-       if (r < 0) {
-               log_err(ctx, _("Repair failed."));
+                              phdr->hashSpec, phdr->uuid,
+                              phdr->payloadOffset * SECTOR_SIZE, 0, 0, ctx);
+       if (r < 0)
                goto out;
-       }
 
        for(i = 0; i < LUKS_NUMKEYS; ++i) {
                if (phdr->keyblock[i].active == LUKS_KEY_ENABLED)  {
-                       log_dbg("Skipping repair for active keyslot %i.", i);
+                       log_dbg(ctx, "Skipping repair for active keyslot %i.", i);
                        continue;
                }
 
                bad = 0;
                if (phdr->keyblock[i].keyMaterialOffset != temp_phdr.keyblock[i].keyMaterialOffset) {
-                       log_err(ctx, _("Keyslot %i: offset repaired (%u -> %u).\n"), i,
+                       log_err(ctx, _("Keyslot %i: offset repaired (%u -> %u)."), i,
                                (unsigned)phdr->keyblock[i].keyMaterialOffset,
                                (unsigned)temp_phdr.keyblock[i].keyMaterialOffset);
                        phdr->keyblock[i].keyMaterialOffset = temp_phdr.keyblock[i].keyMaterialOffset;
@@ -368,7 +414,7 @@ static int _keyslot_repair(struct luks_phdr *phdr, struct crypt_device *ctx)
                }
 
                if (phdr->keyblock[i].stripes != temp_phdr.keyblock[i].stripes) {
-                       log_err(ctx, _("Keyslot %i: stripes repaired (%u -> %u).\n"), i,
+                       log_err(ctx, _("Keyslot %i: stripes repaired (%u -> %u)."), i,
                                (unsigned)phdr->keyblock[i].stripes,
                                (unsigned)temp_phdr.keyblock[i].stripes);
                        phdr->keyblock[i].stripes = temp_phdr.keyblock[i].stripes;
@@ -377,12 +423,12 @@ static int _keyslot_repair(struct luks_phdr *phdr, struct crypt_device *ctx)
 
                /* Known case - MSDOS partition table signature */
                if (i == 6 && sector[0x1fe] == 0x55 && sector[0x1ff] == 0xaa) {
-                       log_err(ctx, _("Keyslot %i: bogus partition signature.\n"), i);
+                       log_err(ctx, _("Keyslot %i: bogus partition signature."), i);
                        bad = 1;
                }
 
                if(bad) {
-                       log_err(ctx, _("Keyslot %i: salt wiped.\n"), i);
+                       log_err(ctx, _("Keyslot %i: salt wiped."), i);
                        phdr->keyblock[i].active = LUKS_KEY_DISABLED;
                        memset(&phdr->keyblock[i].passwordSalt, 0x00, LUKS_SALTSIZE);
                        phdr->keyblock[i].passwordIterations = 0;
@@ -392,13 +438,21 @@ static int _keyslot_repair(struct luks_phdr *phdr, struct crypt_device *ctx)
                        need_write = 1;
        }
 
-       if (need_write) {
-               log_verbose(ctx, _("Writing LUKS header to disk.\n"));
+       /*
+        * check repair result before writing because repair can't fix out of order
+        * keyslot offsets and would corrupt header again
+        */
+       if (LUKS_check_keyslots(ctx, phdr))
+               r = -EINVAL;
+       else if (need_write) {
+               log_verbose(ctx, _("Writing LUKS header to disk."));
                r = LUKS_write_phdr(phdr, ctx);
        }
 out:
+       if (r)
+               log_err(ctx, _("Repair failed."));
        crypt_free_volume_key(vk);
-       crypt_memzero(&temp_phdr, sizeof(temp_phdr));
+       crypt_safe_memzero(&temp_phdr, sizeof(temp_phdr));
        return r;
 }
 
@@ -413,18 +467,18 @@ static int _check_and_convert_hdr(const char *device,
        char luksMagic[] = LUKS_MAGIC;
 
        if(memcmp(hdr->magic, luksMagic, LUKS_MAGIC_L)) { /* Check magic */
-               log_dbg("LUKS header not detected.");
+               log_dbg(ctx, "LUKS header not detected.");
                if (require_luks_device)
-                       log_err(ctx, _("Device %s is not a valid LUKS device.\n"), device);
+                       log_err(ctx, _("Device %s is not a valid LUKS device."), device);
                return -EINVAL;
        } else if((hdr->version = ntohs(hdr->version)) != 1) {  /* Convert every uint16/32_t item from network byte order */
-               log_err(ctx, _("Unsupported LUKS version %d.\n"), hdr->version);
+               log_err(ctx, _("Unsupported LUKS version %d."), hdr->version);
                return -EINVAL;
        }
 
        hdr->hashSpec[LUKS_HASHSPEC_L - 1] = '\0';
        if (crypt_hmac_size(hdr->hashSpec) < LUKS_DIGESTSIZE) {
-               log_err(ctx, _("Requested LUKS hash %s is not supported.\n"), hdr->hashSpec);
+               log_err(ctx, _("Requested LUKS hash %s is not supported."), hdr->hashSpec);
                return -EINVAL;
        }
 
@@ -438,12 +492,11 @@ static int _check_and_convert_hdr(const char *device,
                hdr->keyblock[i].passwordIterations = ntohl(hdr->keyblock[i].passwordIterations);
                hdr->keyblock[i].keyMaterialOffset  = ntohl(hdr->keyblock[i].keyMaterialOffset);
                hdr->keyblock[i].stripes            = ntohl(hdr->keyblock[i].stripes);
-               if (LUKS_check_keyslot_size(hdr, i)) {
-                       log_err(ctx, _("LUKS keyslot %u is invalid.\n"), i);
-                       r = -EINVAL;
-               }
        }
 
+       if (LUKS_check_keyslots(ctx, hdr))
+               r = -EINVAL;
+
        /* Avoid unterminated strings */
        hdr->cipherName[LUKS_CIPHERNAME_L - 1] = '\0';
        hdr->cipherMode[LUKS_CIPHERMODE_L - 1] = '\0';
@@ -453,7 +506,7 @@ static int _check_and_convert_hdr(const char *device,
                if (r == -EINVAL)
                        r = _keyslot_repair(hdr, ctx);
                else
-                       log_verbose(ctx, _("No known problems detected for LUKS header.\n"));
+                       log_verbose(ctx, _("No known problems detected for LUKS header."));
        }
 
        return r;
@@ -468,7 +521,7 @@ static void _to_lower(char *str, unsigned max_len)
 
 static void LUKS_fix_header_compatible(struct luks_phdr *header)
 {
-       /* Old cryptsetup expects "sha1", gcrypt allows case insensistive names,
+       /* Old cryptsetup expects "sha1", gcrypt allows case insensitive names,
         * so always convert hash to lower case in header */
        _to_lower(header->hashSpec, LUKS_HASHSPEC_L);
 
@@ -488,16 +541,16 @@ int LUKS_read_phdr_backup(const char *backup_file,
        ssize_t hdr_size = sizeof(struct luks_phdr);
        int devfd = 0, r = 0;
 
-       log_dbg("Reading LUKS header of size %d from backup file %s",
+       log_dbg(ctx, "Reading LUKS header of size %d from backup file %s",
                (int)hdr_size, backup_file);
 
        devfd = open(backup_file, O_RDONLY);
-       if(-1 == devfd) {
-               log_err(ctx, _("Cannot open header backup file %s.\n"), backup_file);
+       if (devfd == -1) {
+               log_err(ctx, _("Cannot open header backup file %s."), backup_file);
                return -ENOENT;
        }
 
-       if (read(devfd, hdr, hdr_size) < hdr_size)
+       if (read_buffer(devfd, hdr, hdr_size) < hdr_size)
                r = -EIO;
        else {
                LUKS_fix_header_compatible(hdr);
@@ -514,9 +567,9 @@ int LUKS_read_phdr(struct luks_phdr *hdr,
                   int repair,
                   struct crypt_device *ctx)
 {
+       int devfd, r = 0;
        struct device *device = crypt_metadata_device(ctx);
        ssize_t hdr_size = sizeof(struct luks_phdr);
-       int devfd = 0, r = 0;
 
        /* LUKS header starts at offset 0, first keyslot on LUKS_ALIGN_KEYSLOTS */
        assert(sizeof(struct luks_phdr) <= LUKS_ALIGN_KEYSLOTS);
@@ -527,25 +580,35 @@ int LUKS_read_phdr(struct luks_phdr *hdr,
        if (repair && !require_luks_device)
                return -EINVAL;
 
-       log_dbg("Reading LUKS header of size %zu from device %s",
+       log_dbg(ctx, "Reading LUKS header of size %zu from device %s",
                hdr_size, device_path(device));
 
-       devfd = device_open(device, O_RDONLY);
-       if (devfd == -1) {
-               log_err(ctx, _("Cannot open device %s.\n"), device_path(device));
+       devfd = device_open(ctx, device, O_RDONLY);
+       if (devfd < 0) {
+               log_err(ctx, _("Cannot open device %s."), device_path(device));
                return -EINVAL;
        }
 
-       if (read_blockwise(devfd, device_block_size(device), hdr, hdr_size) < hdr_size)
+       if (read_lseek_blockwise(devfd, device_block_size(ctx, device), device_alignment(device),
+                          hdr, hdr_size, 0) < hdr_size)
                r = -EIO;
        else
                r = _check_and_convert_hdr(device_path(device), hdr, require_luks_device,
                                           repair, ctx);
 
        if (!r)
-               r = LUKS_check_device_size(ctx, hdr->keyBytes);
+               r = LUKS_check_device_size(ctx, hdr, 0);
+
+       /*
+        * Cryptsetup 1.0.0 did not align keyslots to 4k (very rare version).
+        * Disable direct-io to avoid possible IO errors if underlying device
+        * has bigger sector size.
+        */
+       if (!r && hdr->keyblock[0].keyMaterialOffset * SECTOR_SIZE < LUKS_ALIGN_KEYSLOTS) {
+               log_dbg(ctx, "Old unaligned LUKS keyslot detected, disabling direct-io.");
+               device_disable_direct_io(device);
+       }
 
-       close(devfd);
        return r;
 }
 
@@ -559,20 +622,20 @@ int LUKS_write_phdr(struct luks_phdr *hdr,
        struct luks_phdr convHdr;
        int r;
 
-       log_dbg("Updating LUKS header of size %zu on device %s",
+       log_dbg(ctx, "Updating LUKS header of size %zu on device %s",
                sizeof(struct luks_phdr), device_path(device));
 
-       r = LUKS_check_device_size(ctx, hdr->keyBytes);
+       r = LUKS_check_device_size(ctx, hdr, 1);
        if (r)
                return r;
 
-       devfd = device_open(device, O_RDWR);
-       if(-1 == devfd) {
+       devfd = device_open(ctx, device, O_RDWR);
+       if (devfd < 0) {
                if (errno == EACCES)
-                       log_err(ctx, _("Cannot write to device %s, permission denied.\n"),
+                       log_err(ctx, _("Cannot write to device %s, permission denied."),
                                device_path(device));
                else
-                       log_err(ctx, _("Cannot open device %s.\n"), device_path(device));
+                       log_err(ctx, _("Cannot open device %s."), device_path(device));
                return -EINVAL;
        }
 
@@ -591,16 +654,18 @@ int LUKS_write_phdr(struct luks_phdr *hdr,
                convHdr.keyblock[i].stripes            = htonl(hdr->keyblock[i].stripes);
        }
 
-       r = write_blockwise(devfd, device_block_size(device), &convHdr, hdr_size) < hdr_size ? -EIO : 0;
+       r = write_lseek_blockwise(devfd, device_block_size(ctx, device), device_alignment(device),
+                           &convHdr, hdr_size, 0) < hdr_size ? -EIO : 0;
        if (r)
-               log_err(ctx, _("Error during update of LUKS header on device %s.\n"), device_path(device));
-       close(devfd);
+               log_err(ctx, _("Error during update of LUKS header on device %s."), device_path(device));
+
+       device_sync(ctx, device);
 
        /* Re-read header from disk to be sure that in-memory and on-disk data are the same. */
        if (!r) {
                r = LUKS_read_phdr(hdr, 1, 0, ctx);
                if (r)
-                       log_err(ctx, _("Error re-reading LUKS header after update on device %s.\n"),
+                       log_err(ctx, _("Error re-reading LUKS header after update on device %s."),
                                device_path(device));
        }
 
@@ -608,139 +673,142 @@ int LUKS_write_phdr(struct luks_phdr *hdr,
 }
 
 /* Check that kernel supports requested cipher by decryption of one sector */
-static int LUKS_check_cipher(struct luks_phdr *hdr, struct crypt_device *ctx)
+int LUKS_check_cipher(struct crypt_device *ctx, size_t keylength, const char *cipher, const char *cipher_mode)
 {
        int r;
        struct volume_key *empty_key;
        char buf[SECTOR_SIZE];
 
-       log_dbg("Checking if cipher %s-%s is usable.", hdr->cipherName, hdr->cipherMode);
+       log_dbg(ctx, "Checking if cipher %s-%s is usable.", cipher, cipher_mode);
 
-       empty_key = crypt_alloc_volume_key(hdr->keyBytes, NULL);
+       empty_key = crypt_alloc_volume_key(keylength, NULL);
        if (!empty_key)
                return -ENOMEM;
 
-       r = LUKS_decrypt_from_storage(buf, sizeof(buf),
-                                     hdr->cipherName, hdr->cipherMode,
-                                     empty_key, 0, ctx);
+       /* No need to get KEY quality random but it must avoid known weak keys. */
+       r = crypt_random_get(ctx, empty_key->key, empty_key->keylength, CRYPT_RND_NORMAL);
+       if (!r)
+               r = LUKS_decrypt_from_storage(buf, sizeof(buf), cipher, cipher_mode, empty_key, 0, ctx);
 
        crypt_free_volume_key(empty_key);
-       crypt_memzero(buf, sizeof(buf));
+       crypt_safe_memzero(buf, sizeof(buf));
        return r;
 }
 
 int LUKS_generate_phdr(struct luks_phdr *header,
-                      const struct volume_key *vk,
-                      const char *cipherName, const char *cipherMode, const char *hashSpec,
-                      const char *uuid, unsigned int stripes,
-                      unsigned int alignPayload,
-                      unsigned int alignOffset,
-                      uint32_t iteration_time_ms,
-                      uint64_t *PBKDF2_per_sec,
-                      int detached_metadata_device,
-                      struct crypt_device *ctx)
+       const struct volume_key *vk,
+       const char *cipherName,
+       const char *cipherMode,
+       const char *hashSpec,
+       const char *uuid,
+       uint64_t data_offset,        /* in bytes */
+       uint64_t align_offset,       /* in bytes */
+       uint64_t required_alignment, /* in bytes */
+       struct crypt_device *ctx)
 {
-       unsigned int i = 0, hdr_sectors = LUKS_device_sectors(vk->keylength);
-       size_t blocksPerStripeSet, currentSector;
-       int r;
+       int i, r;
+       size_t keyslot_sectors, header_sectors;
        uuid_t partitionUuid;
+       struct crypt_pbkdf_type *pbkdf;
+       double PBKDF2_temp;
        char luksMagic[] = LUKS_MAGIC;
 
-       /* For separate metadata device allow zero alignment */
-       if (alignPayload == 0 && !detached_metadata_device)
-               alignPayload = DEFAULT_DISK_ALIGNMENT / SECTOR_SIZE;
+       if (data_offset % SECTOR_SIZE || align_offset % SECTOR_SIZE ||
+           required_alignment % SECTOR_SIZE)
+               return -EINVAL;
 
-       if (alignPayload && detached_metadata_device && alignPayload < hdr_sectors) {
-               log_err(ctx, _("Data offset for detached LUKS header must be "
-                              "either 0 or higher than header size (%d sectors).\n"),
-                              hdr_sectors);
+       memset(header, 0, sizeof(struct luks_phdr));
+
+       keyslot_sectors = AF_split_sectors(vk->keylength, LUKS_STRIPES);
+       header_sectors = LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE;
+
+       for (i = 0; i < LUKS_NUMKEYS; i++) {
+               header->keyblock[i].active = LUKS_KEY_DISABLED;
+               header->keyblock[i].keyMaterialOffset = header_sectors;
+               header->keyblock[i].stripes = LUKS_STRIPES;
+               header_sectors = size_round_up(header_sectors + keyslot_sectors,
+                                              LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE);
+       }
+       /* In sector is now size of all keyslot material space */
+
+       /* Data offset has priority */
+       if (data_offset)
+               header->payloadOffset = data_offset / SECTOR_SIZE;
+       else if (required_alignment) {
+               header->payloadOffset = size_round_up(header_sectors, (required_alignment / SECTOR_SIZE));
+               header->payloadOffset += (align_offset / SECTOR_SIZE);
+       } else
+               header->payloadOffset = 0;
+
+       if (header->payloadOffset && header->payloadOffset < header_sectors) {
+               log_err(ctx, _("Data offset for LUKS header must be "
+                              "either 0 or higher than header size."));
                return -EINVAL;
        }
 
        if (crypt_hmac_size(hashSpec) < LUKS_DIGESTSIZE) {
-               log_err(ctx, _("Requested LUKS hash %s is not supported.\n"), hashSpec);
+               log_err(ctx, _("Requested LUKS hash %s is not supported."), hashSpec);
                return -EINVAL;
        }
 
        if (uuid && uuid_parse(uuid, partitionUuid) == -1) {
-               log_err(ctx, _("Wrong LUKS UUID format provided.\n"));
+               log_err(ctx, _("Wrong LUKS UUID format provided."));
                return -EINVAL;
        }
        if (!uuid)
                uuid_generate(partitionUuid);
 
-       memset(header,0,sizeof(struct luks_phdr));
-
        /* Set Magic */
        memcpy(header->magic,luksMagic,LUKS_MAGIC_L);
        header->version=1;
-       strncpy(header->cipherName,cipherName,LUKS_CIPHERNAME_L);
-       strncpy(header->cipherMode,cipherMode,LUKS_CIPHERMODE_L);
-       strncpy(header->hashSpec,hashSpec,LUKS_HASHSPEC_L);
+       strncpy(header->cipherName,cipherName,LUKS_CIPHERNAME_L-1);
+       strncpy(header->cipherMode,cipherMode,LUKS_CIPHERMODE_L-1);
+       strncpy(header->hashSpec,hashSpec,LUKS_HASHSPEC_L-1);
 
        header->keyBytes=vk->keylength;
 
        LUKS_fix_header_compatible(header);
 
-       r = LUKS_check_cipher(header, ctx);
-       if (r < 0)
-               return r;
-
-       log_dbg("Generating LUKS header version %d using hash %s, %s, %s, MK %d bytes",
+       log_dbg(ctx, "Generating LUKS header version %d using hash %s, %s, %s, MK %d bytes",
                header->version, header->hashSpec ,header->cipherName, header->cipherMode,
                header->keyBytes);
 
        r = crypt_random_get(ctx, header->mkDigestSalt, LUKS_SALTSIZE, CRYPT_RND_SALT);
        if(r < 0) {
-               log_err(ctx, _("Cannot create LUKS header: reading random salt failed.\n"));
+               log_err(ctx, _("Cannot create LUKS header: reading random salt failed."));
                return r;
        }
 
-       r = crypt_benchmark_kdf(ctx, "pbkdf2", header->hashSpec,
-                               "foo", 3, "bar", 3, PBKDF2_per_sec);
-       if (r < 0) {
-               log_err(ctx, _("Not compatible PBKDF2 options (using hash algorithm %s).\n"),
-                       header->hashSpec);
+       /* Compute master key digest */
+       pbkdf = crypt_get_pbkdf(ctx);
+       r = crypt_benchmark_pbkdf_internal(ctx, pbkdf, vk->keylength);
+       if (r < 0)
                return r;
-       }
+       assert(pbkdf->iterations);
 
-       /* Compute master key digest */
-       iteration_time_ms /= 8;
-       header->mkDigestIterations = at_least((uint32_t)(*PBKDF2_per_sec/1024) * iteration_time_ms,
-                                             LUKS_MKD_ITERATIONS_MIN);
+       if (pbkdf->flags & CRYPT_PBKDF_NO_BENCHMARK && pbkdf->time_ms == 0)
+               PBKDF2_temp = LUKS_MKD_ITERATIONS_MIN;
+       else    /* iterations per ms * LUKS_MKD_ITERATIONS_MS */
+               PBKDF2_temp = (double)pbkdf->iterations * LUKS_MKD_ITERATIONS_MS / pbkdf->time_ms;
 
-       r = crypt_pbkdf("pbkdf2", header->hashSpec, vk->key,vk->keylength,
+       if (PBKDF2_temp > (double)UINT32_MAX)
+               return -EINVAL;
+       header->mkDigestIterations = at_least((uint32_t)PBKDF2_temp, LUKS_MKD_ITERATIONS_MIN);
+       assert(header->mkDigestIterations);
+
+       r = crypt_pbkdf(CRYPT_KDF_PBKDF2, header->hashSpec, vk->key,vk->keylength,
                        header->mkDigestSalt, LUKS_SALTSIZE,
                        header->mkDigest,LUKS_DIGESTSIZE,
-                       header->mkDigestIterations);
-       if(r < 0) {
-               log_err(ctx, _("Cannot create LUKS header: header digest failed (using hash %s).\n"),
+                       header->mkDigestIterations, 0, 0);
+       if (r < 0) {
+               log_err(ctx, _("Cannot create LUKS header: header digest failed (using hash %s)."),
                        header->hashSpec);
                return r;
        }
 
-       currentSector = LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE;
-       blocksPerStripeSet = AF_split_sectors(vk->keylength, stripes);
-       for(i = 0; i < LUKS_NUMKEYS; ++i) {
-               header->keyblock[i].active = LUKS_KEY_DISABLED;
-               header->keyblock[i].keyMaterialOffset = currentSector;
-               header->keyblock[i].stripes = stripes;
-               currentSector = size_round_up(currentSector + blocksPerStripeSet,
-                                               LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE);
-       }
-
-       if (detached_metadata_device) {
-               /* for separate metadata device use alignPayload directly */
-               header->payloadOffset = alignPayload;
-       } else {
-               /* alignOffset - offset from natural device alignment provided by topology info */
-               currentSector = size_round_up(currentSector, alignPayload);
-               header->payloadOffset = currentSector + alignOffset;
-       }
-
         uuid_unparse(partitionUuid, header->uuid);
 
-       log_dbg("Data offset %d, UUID %s, digest iterations %" PRIu32,
+       log_dbg(ctx, "Data offset %d, UUID %s, digest iterations %" PRIu32,
                header->payloadOffset, header->uuid, header->mkDigestIterations);
 
        return 0;
@@ -754,7 +822,7 @@ int LUKS_hdr_uuid_set(
        uuid_t partitionUuid;
 
        if (uuid && uuid_parse(uuid, partitionUuid) == -1) {
-               log_err(ctx, _("Wrong LUKS UUID format provided.\n"));
+               log_err(ctx, _("Wrong LUKS UUID format provided."));
                return -EINVAL;
        }
        if (!uuid)
@@ -768,50 +836,40 @@ int LUKS_hdr_uuid_set(
 int LUKS_set_key(unsigned int keyIndex,
                 const char *password, size_t passwordLen,
                 struct luks_phdr *hdr, struct volume_key *vk,
-                uint32_t iteration_time_ms,
-                uint64_t *PBKDF2_per_sec,
                 struct crypt_device *ctx)
 {
        struct volume_key *derived_key;
        char *AfKey = NULL;
        size_t AFEKSize;
-       uint64_t PBKDF2_temp;
+       struct crypt_pbkdf_type *pbkdf;
        int r;
 
        if(hdr->keyblock[keyIndex].active != LUKS_KEY_DISABLED) {
-               log_err(ctx, _("Key slot %d active, purge first.\n"), keyIndex);
+               log_err(ctx, _("Key slot %d active, purge first."), keyIndex);
                return -EINVAL;
        }
 
-       /* LUKS keyslot has always at least 4000 stripes accoding to specification */
+       /* LUKS keyslot has always at least 4000 stripes according to specification */
        if(hdr->keyblock[keyIndex].stripes < 4000) {
-               log_err(ctx, _("Key slot %d material includes too few stripes. Header manipulation?\n"),
+               log_err(ctx, _("Key slot %d material includes too few stripes. Header manipulation?"),
                        keyIndex);
                 return -EINVAL;
        }
 
-       log_dbg("Calculating data for key slot %d", keyIndex);
-
-       r = crypt_benchmark_kdf(ctx, "pbkdf2", hdr->hashSpec,
-                               "foo", 3, "bar", 3, PBKDF2_per_sec);
-       if (r < 0) {
-               log_err(ctx, _("Not compatible PBKDF2 options (using hash algorithm %s).\n"),
-                       hdr->hashSpec);
+       log_dbg(ctx, "Calculating data for key slot %d", keyIndex);
+       pbkdf = crypt_get_pbkdf(ctx);
+       r = crypt_benchmark_pbkdf_internal(ctx, pbkdf, vk->keylength);
+       if (r < 0)
                return r;
-       }
+       assert(pbkdf->iterations);
 
        /*
-        * Avoid floating point operation
         * Final iteration count is at least LUKS_SLOT_ITERATIONS_MIN
         */
-       PBKDF2_temp = (*PBKDF2_per_sec / 2) * (uint64_t)iteration_time_ms;
-       PBKDF2_temp /= 1024;
-       if (PBKDF2_temp > UINT32_MAX)
-               PBKDF2_temp = UINT32_MAX;
-       hdr->keyblock[keyIndex].passwordIterations = at_least((uint32_t)PBKDF2_temp,
-                                                             LUKS_SLOT_ITERATIONS_MIN);
-
-       log_dbg("Key slot %d use %" PRIu32 " password iterations.", keyIndex, hdr->keyblock[keyIndex].passwordIterations);
+       hdr->keyblock[keyIndex].passwordIterations =
+               at_least(pbkdf->iterations, LUKS_SLOT_ITERATIONS_MIN);
+       log_dbg(ctx, "Key slot %d use %" PRIu32 " password iterations.", keyIndex,
+               hdr->keyblock[keyIndex].passwordIterations);
 
        derived_key = crypt_alloc_volume_key(hdr->keyBytes, NULL);
        if (!derived_key)
@@ -822,10 +880,10 @@ int LUKS_set_key(unsigned int keyIndex,
        if (r < 0)
                goto out;
 
-       r = crypt_pbkdf("pbkdf2", hdr->hashSpec, password, passwordLen,
+       r = crypt_pbkdf(CRYPT_KDF_PBKDF2, hdr->hashSpec, password, passwordLen,
                        hdr->keyblock[keyIndex].passwordSalt, LUKS_SALTSIZE,
                        derived_key->key, hdr->keyBytes,
-                       hdr->keyblock[keyIndex].passwordIterations);
+                       hdr->keyblock[keyIndex].passwordIterations, 0, 0);
        if (r < 0)
                goto out;
 
@@ -840,13 +898,13 @@ int LUKS_set_key(unsigned int keyIndex,
                goto out;
        }
 
-       log_dbg("Using hash %s for AF in key slot %d, %d stripes",
+       log_dbg(ctx, "Using hash %s for AF in key slot %d, %d stripes",
                hdr->hashSpec, keyIndex, hdr->keyblock[keyIndex].stripes);
-       r = AF_split(vk->key,AfKey,vk->keylength,hdr->keyblock[keyIndex].stripes,hdr->hashSpec);
+       r = AF_split(ctx, vk->key, AfKey, vk->keylength, hdr->keyblock[keyIndex].stripes, hdr->hashSpec);
        if (r < 0)
                goto out;
 
-       log_dbg("Updating key slot %d [0x%04x] area.", keyIndex,
+       log_dbg(ctx, "Updating key slot %d [0x%04x] area.", keyIndex,
                hdr->keyblock[keyIndex].keyMaterialOffset << 9);
        /* Encryption via dm */
        r = LUKS_encrypt_to_storage(AfKey,
@@ -859,7 +917,7 @@ int LUKS_set_key(unsigned int keyIndex,
                goto out;
 
        /* Mark the key as active in phdr */
-       r = LUKS_keyslot_set(hdr, (int)keyIndex, 1);
+       r = LUKS_keyslot_set(hdr, (int)keyIndex, 1, ctx);
        if (r < 0)
                goto out;
 
@@ -880,10 +938,10 @@ int LUKS_verify_volume_key(const struct luks_phdr *hdr,
 {
        char checkHashBuf[LUKS_DIGESTSIZE];
 
-       if (crypt_pbkdf("pbkdf2", hdr->hashSpec, vk->key, vk->keylength,
+       if (crypt_pbkdf(CRYPT_KDF_PBKDF2, hdr->hashSpec, vk->key, vk->keylength,
                        hdr->mkDigestSalt, LUKS_SALTSIZE,
                        checkHashBuf, LUKS_DIGESTSIZE,
-                       hdr->mkDigestIterations) < 0)
+                       hdr->mkDigestIterations, 0, 0) < 0)
                return -EINVAL;
 
        if (memcmp(checkHashBuf, hdr->mkDigest, LUKS_DIGESTSIZE))
@@ -906,7 +964,7 @@ static int LUKS_open_key(unsigned int keyIndex,
        size_t AFEKSize;
        int r;
 
-       log_dbg("Trying to open key slot %d [%s].", keyIndex,
+       log_dbg(ctx, "Trying to open key slot %d [%s].", keyIndex,
                dbg_slot_state(ki));
 
        if (ki < CRYPT_SLOT_ACTIVE)
@@ -924,14 +982,16 @@ static int LUKS_open_key(unsigned int keyIndex,
                goto out;
        }
 
-       r = crypt_pbkdf("pbkdf2", hdr->hashSpec, password, passwordLen,
+       r = crypt_pbkdf(CRYPT_KDF_PBKDF2, hdr->hashSpec, password, passwordLen,
                        hdr->keyblock[keyIndex].passwordSalt, LUKS_SALTSIZE,
                        derived_key->key, hdr->keyBytes,
-                       hdr->keyblock[keyIndex].passwordIterations);
-       if (r < 0)
+                       hdr->keyblock[keyIndex].passwordIterations, 0, 0);
+       if (r < 0) {
+               log_err(ctx, _("Cannot open keyslot (using hash %s)."), hdr->hashSpec);
                goto out;
+       }
 
-       log_dbg("Reading key slot %d area.", keyIndex);
+       log_dbg(ctx, "Reading key slot %d area.", keyIndex);
        r = LUKS_decrypt_from_storage(AfKey,
                                      AFEKSize,
                                      hdr->cipherName, hdr->cipherMode,
@@ -941,13 +1001,15 @@ static int LUKS_open_key(unsigned int keyIndex,
        if (r < 0)
                goto out;
 
-       r = AF_merge(AfKey,vk->key,vk->keylength,hdr->keyblock[keyIndex].stripes,hdr->hashSpec);
+       r = AF_merge(ctx, AfKey, vk->key, vk->keylength, hdr->keyblock[keyIndex].stripes, hdr->hashSpec);
        if (r < 0)
                goto out;
 
        r = LUKS_verify_volume_key(hdr, vk);
-       if (!r)
-               log_verbose(ctx, _("Key slot %d unlocked.\n"), keyIndex);
+
+       /* Allow only empty passphrase with null cipher */
+       if (!r && !strcmp(hdr->cipherName, "cipher_null") && passwordLen)
+               r = -EPERM;
 out:
        crypt_safe_free(AfKey);
        crypt_free_volume_key(derived_key);
@@ -961,7 +1023,7 @@ int LUKS_open_key_with_hdr(int keyIndex,
                           struct volume_key **vk,
                           struct crypt_device *ctx)
 {
-       unsigned int i;
+       unsigned int i, tried = 0;
        int r;
 
        *vk = crypt_alloc_volume_key(hdr->keyBytes, NULL);
@@ -971,7 +1033,7 @@ int LUKS_open_key_with_hdr(int keyIndex,
                return (r < 0) ? r : keyIndex;
        }
 
-       for(i = 0; i < LUKS_NUMKEYS; i++) {
+       for (i = 0; i < LUKS_NUMKEYS; i++) {
                r = LUKS_open_key(i, password, passwordLen, hdr, *vk, ctx);
                if(r == 0)
                        return i;
@@ -980,10 +1042,11 @@ int LUKS_open_key_with_hdr(int keyIndex,
                   former meaning password wrong, latter key slot inactive */
                if ((r != -EPERM) && (r != -ENOENT))
                        return r;
+               if (r == -EPERM)
+                       tried++;
        }
        /* Warning, early returns above */
-       log_err(ctx, _("No key available with this passphrase.\n"));
-       return -EPERM;
+       return tried ? -EPERM : -ENOENT;
 }
 
 int LUKS_del_key(unsigned int keyIndex,
@@ -998,9 +1061,9 @@ int LUKS_del_key(unsigned int keyIndex,
        if (r)
                return r;
 
-       r = LUKS_keyslot_set(hdr, keyIndex, 0);
+       r = LUKS_keyslot_set(hdr, keyIndex, 0, ctx);
        if (r) {
-               log_err(ctx, _("Key slot %d is invalid, please select keyslot between 0 and %d.\n"),
+               log_err(ctx, _("Key slot %d is invalid, please select keyslot between 0 and %d."),
                        keyIndex, LUKS_NUMKEYS - 1);
                return r;
        }
@@ -1009,16 +1072,16 @@ int LUKS_del_key(unsigned int keyIndex,
        startOffset = hdr->keyblock[keyIndex].keyMaterialOffset;
        endOffset = startOffset + AF_split_sectors(hdr->keyBytes, hdr->keyblock[keyIndex].stripes);
 
-       r = crypt_wipe(device, startOffset * SECTOR_SIZE,
-                      (endOffset - startOffset) * SECTOR_SIZE,
-                      CRYPT_WIPE_DISK, 0);
+       r = crypt_wipe_device(ctx, device, CRYPT_WIPE_SPECIAL, startOffset * SECTOR_SIZE,
+                             (endOffset - startOffset) * SECTOR_SIZE,
+                             (endOffset - startOffset) * SECTOR_SIZE, NULL, NULL);
        if (r) {
                if (r == -EACCES) {
-                       log_err(ctx, _("Cannot write to device %s, permission denied.\n"),
+                       log_err(ctx, _("Cannot write to device %s, permission denied."),
                                device_path(device));
                        r = -EINVAL;
                } else
-                       log_err(ctx, _("Cannot wipe device %s.\n"),
+                       log_err(ctx, _("Cannot wipe device %s."),
                                device_path(device));
                return r;
        }
@@ -1077,7 +1140,7 @@ int LUKS_keyslot_active_count(struct luks_phdr *hdr)
        return num;
 }
 
-int LUKS_keyslot_set(struct luks_phdr *hdr, int keyslot, int enable)
+int LUKS_keyslot_set(struct luks_phdr *hdr, int keyslot, int enable, struct crypt_device *ctx)
 {
        crypt_keyslot_info ki = LUKS_keyslot_info(hdr, keyslot);
 
@@ -1085,7 +1148,7 @@ int LUKS_keyslot_set(struct luks_phdr *hdr, int keyslot, int enable)
                return -EINVAL;
 
        hdr->keyblock[keyslot].active = enable ? LUKS_KEY_ENABLED : LUKS_KEY_DISABLED;
-       log_dbg("Key slot %d was %s in LUKS header.", keyslot, enable ? "enabled" : "disabled");
+       log_dbg(ctx, "Key slot %d was %s in LUKS header.", keyslot, enable ? "enabled" : "disabled");
        return 0;
 }
 
@@ -1095,39 +1158,87 @@ int LUKS1_activate(struct crypt_device *cd,
                   uint32_t flags)
 {
        int r;
-       char *dm_cipher = NULL;
-       enum devcheck device_check;
        struct crypt_dm_active_device dmd = {
-               .target = DM_CRYPT,
-               .uuid   = crypt_get_uuid(cd),
-               .flags  = flags,
-               .size   = 0,
-               .data_device = crypt_data_device(cd),
-               .u.crypt = {
-                       .cipher = NULL,
-                       .vk     = vk,
-                       .offset = crypt_get_data_offset(cd),
-                       .iv_offset = 0,
-               }
+               .flags = flags,
+               .uuid = crypt_get_uuid(cd),
        };
 
-       if (dmd.flags & CRYPT_ACTIVATE_SHARED)
-               device_check = DEV_SHARED;
-       else
-               device_check = DEV_EXCL;
+       r = dm_crypt_target_set(&dmd.segment, 0, dmd.size, crypt_data_device(cd),
+                       vk, crypt_get_cipher_spec(cd), crypt_get_iv_offset(cd),
+                       crypt_get_data_offset(cd), crypt_get_integrity(cd),
+                       crypt_get_integrity_tag_size(cd), crypt_get_sector_size(cd));
+       if (!r)
+               r = create_or_reload_device(cd, name, CRYPT_LUKS1, &dmd);
 
-       r = device_block_adjust(cd, dmd.data_device, device_check,
-                                dmd.u.crypt.offset, &dmd.size, &dmd.flags);
-       if (r)
-               return r;
+       dm_targets_free(cd, &dmd);
+
+       return r;
+}
+
+int LUKS_wipe_header_areas(struct luks_phdr *hdr,
+       struct crypt_device *ctx)
+{
+       int i, r;
+       uint64_t offset, length;
+       size_t wipe_block;
+
+       /* Wipe complete header, keyslots and padding areas with zeroes. */
+       offset = 0;
+       length = (uint64_t)hdr->payloadOffset * SECTOR_SIZE;
+       wipe_block = 1024 * 1024;
+
+       /* On detached header or bogus header, wipe at least the first 4k */
+       if (length == 0 || length > (LUKS_MAX_KEYSLOT_SIZE * LUKS_NUMKEYS)) {
+               length = 4096;
+               wipe_block = 4096;
+       }
 
-       r = asprintf(&dm_cipher, "%s-%s", crypt_get_cipher(cd), crypt_get_cipher_mode(cd));
+       log_dbg(ctx, "Wiping LUKS areas (0x%06" PRIx64 " - 0x%06" PRIx64") with zeroes.",
+               offset, length + offset);
+
+       r = crypt_wipe_device(ctx, crypt_metadata_device(ctx), CRYPT_WIPE_ZERO,
+                             offset, length, wipe_block, NULL, NULL);
        if (r < 0)
-               return -ENOMEM;
+               return r;
+
+       /* Wipe keyslots areas */
+       wipe_block = 1024 * 1024;
+       for (i = 0; i < LUKS_NUMKEYS; i++) {
+               r = LUKS_keyslot_area(hdr, i, &offset, &length);
+               if (r < 0)
+                       return r;
+
+               /* Ignore too big LUKS1 keyslots here */
+               if (length > LUKS_MAX_KEYSLOT_SIZE ||
+                   offset > (LUKS_MAX_KEYSLOT_SIZE - length))
+                       continue;
+
+               if (length == 0 || offset < 4096)
+                       return -EINVAL;
 
-       dmd.u.crypt.cipher = dm_cipher;
-       r = dm_create_device(cd, name, CRYPT_LUKS1, &dmd, 0);
+               log_dbg(ctx, "Wiping keyslot %i area (0x%06" PRIx64 " - 0x%06" PRIx64") with random data.",
+                       i, offset, length + offset);
+
+               r = crypt_wipe_device(ctx, crypt_metadata_device(ctx), CRYPT_WIPE_RANDOM,
+                               offset, length, wipe_block, NULL, NULL);
+               if (r < 0)
+                       return r;
+       }
 
-       free(dm_cipher);
        return r;
 }
+
+int LUKS_keyslot_pbkdf(struct luks_phdr *hdr, int keyslot, struct crypt_pbkdf_type *pbkdf)
+{
+       if (LUKS_keyslot_info(hdr, keyslot) < CRYPT_SLOT_ACTIVE)
+               return -EINVAL;
+
+       pbkdf->type = CRYPT_KDF_PBKDF2;
+       pbkdf->hash = hdr->hashSpec;
+       pbkdf->iterations = hdr->keyblock[keyslot].passwordIterations;
+       pbkdf->max_memory_kb = 0;
+       pbkdf->parallel_threads = 0;
+       pbkdf->time_ms = 0;
+       pbkdf->flags = 0;
+       return 0;
+}
index 7aef82f..d54276e 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * LUKS - Linux Unified Key Setup
  *
- * Copyright (C) 2004-2006, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2006 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -40,6 +40,9 @@
 #define LUKS_MKD_ITERATIONS_MIN  1000
 #define LUKS_SLOT_ITERATIONS_MIN 1000
 
+// Iteration time for digest in ms
+#define LUKS_MKD_ITERATIONS_MS 125
+
 #define LUKS_KEY_DISABLED_OLD 0
 #define LUKS_KEY_ENABLED_OLD 0xCAFE
 
@@ -58,6 +61,9 @@
 /* Offset to keyslot area [in bytes] */
 #define LUKS_ALIGN_KEYSLOTS 4096
 
+/* Maximal LUKS header size, for wipe [in bytes] */
+#define LUKS_MAX_KEYSLOT_SIZE 0x1000000 /* 16 MB, up to 32768 bits key */
+
 /* Any integer values are stored in network byte order on disk and must be
 converted */
 
@@ -96,19 +102,20 @@ struct luks_phdr {
 int LUKS_verify_volume_key(const struct luks_phdr *hdr,
                           const struct volume_key *vk);
 
-int LUKS_generate_phdr(
-       struct luks_phdr *header,
+int LUKS_check_cipher(struct crypt_device *ctx,
+                     size_t keylength,
+                     const char *cipher,
+                     const char *cipher_mode);
+
+int LUKS_generate_phdr(struct luks_phdr *header,
        const struct volume_key *vk,
        const char *cipherName,
        const char *cipherMode,
        const char *hashSpec,
        const char *uuid,
-       unsigned int stripes,
-       unsigned int alignPayload,
-       unsigned int alignOffset,
-       uint32_t iteration_time_ms,
-       uint64_t *PBKDF2_per_sec,
-       int detached_metadata_device,
+       uint64_t data_offset,
+       uint64_t align_offset,
+       uint64_t required_alignment,
        struct crypt_device *ctx);
 
 int LUKS_read_phdr(
@@ -147,8 +154,6 @@ int LUKS_set_key(
        size_t passwordLen,
        struct luks_phdr *hdr,
        struct volume_key *vk,
-       uint32_t iteration_time_ms,
-       uint64_t *PBKDF2_per_sec,
        struct crypt_device *ctx);
 
 int LUKS_open_key_with_hdr(
@@ -164,30 +169,22 @@ int LUKS_del_key(
        struct luks_phdr *hdr,
        struct crypt_device *ctx);
 
+int LUKS_wipe_header_areas(struct luks_phdr *hdr,
+       struct crypt_device *ctx);
+
 crypt_keyslot_info LUKS_keyslot_info(struct luks_phdr *hdr, int keyslot);
 int LUKS_keyslot_find_empty(struct luks_phdr *hdr);
 int LUKS_keyslot_active_count(struct luks_phdr *hdr);
-int LUKS_keyslot_set(struct luks_phdr *hdr, int keyslot, int enable);
-int LUKS_keyslot_area(struct luks_phdr *hdr,
+int LUKS_keyslot_set(struct luks_phdr *hdr, int keyslot, int enable,
+                    struct crypt_device *ctx);
+int LUKS_keyslot_area(const struct luks_phdr *hdr,
        int keyslot,
        uint64_t *offset,
        uint64_t *length);
-
-int LUKS_encrypt_to_storage(
-       char *src, size_t srcLength,
-       const char *cipher,
-       const char *cipher_mode,
-       struct volume_key *vk,
-       unsigned int sector,
-       struct crypt_device *ctx);
-
-int LUKS_decrypt_from_storage(
-       char *dst, size_t dstLength,
-       const char *cipher,
-       const char *cipher_mode,
-       struct volume_key *vk,
-       unsigned int sector,
-       struct crypt_device *ctx);
+size_t LUKS_device_sectors(const struct luks_phdr *hdr);
+size_t LUKS_keyslots_offset(const struct luks_phdr *hdr);
+int LUKS_keyslot_pbkdf(struct luks_phdr *hdr, int keyslot,
+                      struct crypt_pbkdf_type *pbkdf);
 
 int LUKS1_activate(struct crypt_device *cd,
                   const char *name,
diff --git a/lib/luks2/luks2.h b/lib/luks2/luks2.h
new file mode 100644 (file)
index 0000000..6ab753a
--- /dev/null
@@ -0,0 +1,609 @@
+/*
+ * LUKS - Linux Unified Key Setup v2
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _CRYPTSETUP_LUKS2_ONDISK_H
+#define _CRYPTSETUP_LUKS2_ONDISK_H
+
+#include <stdbool.h>
+
+#include "libcryptsetup.h"
+
+#define LUKS2_MAGIC_1ST "LUKS\xba\xbe"
+#define LUKS2_MAGIC_2ND "SKUL\xba\xbe"
+#define LUKS2_MAGIC_L 6
+#define LUKS2_UUID_L 40
+#define LUKS2_LABEL_L 48
+#define LUKS2_SALT_L 64
+#define LUKS2_CHECKSUM_ALG_L 32
+#define LUKS2_CHECKSUM_L 64
+
+#define LUKS2_KEYSLOTS_MAX       32
+#define LUKS2_TOKENS_MAX         32
+#define LUKS2_SEGMENT_MAX        32
+
+#define LUKS2_BUILTIN_TOKEN_PREFIX "luks2-"
+#define LUKS2_BUILTIN_TOKEN_PREFIX_LEN 6
+
+#define LUKS2_TOKEN_KEYRING LUKS2_BUILTIN_TOKEN_PREFIX "keyring"
+
+#define LUKS2_DIGEST_MAX 8
+
+#define CRYPT_ANY_SEGMENT -1
+#define CRYPT_DEFAULT_SEGMENT -2
+#define CRYPT_ONE_SEGMENT -3
+
+#define CRYPT_ANY_DIGEST -1
+
+/* 20 MiBs */
+#define LUKS2_DEFAULT_NONE_REENCRYPTION_LENGTH 0x1400000
+
+/* 1 GiB */
+#define LUKS2_REENCRYPT_MAX_HOTZONE_LENGTH 0x40000000
+
+struct device;
+
+/*
+ * LUKS2 header on-disk.
+ *
+ * Binary header is followed by JSON area.
+ * JSON area is followed by keyslot area and data area,
+ * these are described in JSON metadata.
+ *
+ * Note: uuid, csum_alg are intentionally on the same offset as LUKS1
+ * (checksum alg replaces hash in LUKS1)
+ *
+ * String (char) should be zero terminated.
+ * Padding should be wiped.
+ * Checksum is calculated with csum zeroed (+ full JSON area).
+ */
+struct luks2_hdr_disk {
+       char            magic[LUKS2_MAGIC_L];
+       uint16_t        version;        /* Version 2 */
+       uint64_t        hdr_size;       /* in bytes, including JSON area */
+       uint64_t        seqid;          /* increased on every update */
+       char            label[LUKS2_LABEL_L];
+       char            checksum_alg[LUKS2_CHECKSUM_ALG_L];
+       uint8_t         salt[LUKS2_SALT_L]; /* unique for every header/offset */
+       char            uuid[LUKS2_UUID_L];
+       char            subsystem[LUKS2_LABEL_L]; /* owner subsystem label */
+       uint64_t        hdr_offset;     /* offset from device start in bytes */
+       char            _padding[184];
+       uint8_t         csum[LUKS2_CHECKSUM_L];
+       char            _padding4096[7*512];
+       /* JSON area starts here */
+} __attribute__ ((packed));
+
+/*
+ * LUKS2 header in-memory.
+ */
+typedef struct json_object json_object;
+struct luks2_hdr {
+       size_t          hdr_size;
+       uint64_t        seqid;
+       unsigned int    version;
+       char            label[LUKS2_LABEL_L];
+       char            subsystem[LUKS2_LABEL_L];
+       char            checksum_alg[LUKS2_CHECKSUM_ALG_L];
+       uint8_t         salt1[LUKS2_SALT_L];
+       uint8_t         salt2[LUKS2_SALT_L];
+       char            uuid[LUKS2_UUID_L];
+       json_object     *jobj;
+};
+
+struct luks2_keyslot_params {
+       enum { LUKS2_KEYSLOT_AF_LUKS1 = 0 } af_type;
+       enum { LUKS2_KEYSLOT_AREA_RAW = 0 } area_type;
+
+       union {
+       struct {
+               char hash[LUKS2_CHECKSUM_ALG_L]; // or include luks.h
+               unsigned int stripes;
+       } luks1;
+       } af;
+
+       union {
+       struct {
+               char encryption[65]; // or include utils_crypt.h
+               size_t key_size;
+       } raw;
+       } area;
+};
+
+struct reenc_protection {
+       enum { REENC_PROTECTION_NONE = 0, /* none should be 0 always */
+              REENC_PROTECTION_CHECKSUM,
+              REENC_PROTECTION_JOURNAL,
+               REENC_PROTECTION_DATASHIFT } type;
+
+       union {
+       struct {
+       } none;
+       struct {
+               char hash[LUKS2_CHECKSUM_ALG_L]; // or include luks.h
+               struct crypt_hash *ch;
+               size_t hash_size;
+               /* buffer for checksums */
+               void *checksums;
+               size_t checksums_len;
+       } csum;
+       struct {
+       } ds;
+       } p;
+};
+
+struct luks2_reenc_context {
+       /* reencryption window attributes */
+       uint64_t offset;
+       uint64_t progress;
+       uint64_t length;
+       uint64_t data_shift;
+       size_t alignment;
+       uint64_t device_size;
+       bool online;
+       bool fixed_length;
+       crypt_reencrypt_direction_info direction;
+       crypt_reencrypt_mode_info mode;
+
+       char *device_name;
+       char *hotzone_name;
+       char *overlay_name;
+       uint32_t flags;
+
+       /* reencryption window persistence attributes */
+       struct reenc_protection rp;
+
+       int reenc_keyslot;
+
+       /* already running reencryption */
+       json_object *jobj_segs_hot;
+       json_object *jobj_segs_post;
+
+       /* backup segments */
+       json_object *jobj_segment_new;
+       int digest_new;
+       json_object *jobj_segment_old;
+       int digest_old;
+       json_object *jobj_segment_moved;
+
+       struct volume_key *vks;
+
+       void *reenc_buffer;
+       ssize_t read;
+
+       struct crypt_storage_wrapper *cw1;
+       struct crypt_storage_wrapper *cw2;
+
+       uint32_t wflags1;
+       uint32_t wflags2;
+
+       struct crypt_lock_handle *reenc_lock;
+};
+
+crypt_reencrypt_info LUKS2_reenc_status(struct luks2_hdr *hdr);
+/*
+ * Supportable header sizes (hdr_disk + JSON area)
+ * Also used as offset for the 2nd header.
+ */
+#define LUKS2_HDR_16K_LEN 0x4000
+
+#define LUKS2_HDR_BIN_LEN sizeof(struct luks2_hdr_disk)
+
+//#define LUKS2_DEFAULT_HDR_SIZE 0x400000  /* 4 MiB */
+#define LUKS2_DEFAULT_HDR_SIZE 0x1000000 /* 16 MiB */
+
+#define LUKS2_MAX_KEYSLOTS_SIZE 0x8000000 /* 128 MiB */
+
+#define LUKS2_HDR_OFFSET_MAX 0x400000 /* 4 MiB */
+
+/* Offsets for secondary header (for scan if primary header is corrupted). */
+#define LUKS2_HDR2_OFFSETS { 0x04000, 0x008000, 0x010000, 0x020000, \
+                             0x40000, 0x080000, 0x100000, 0x200000, LUKS2_HDR_OFFSET_MAX }
+
+int LUKS2_hdr_version_unlocked(struct crypt_device *cd,
+       const char *backup_file);
+
+int LUKS2_device_write_lock(struct crypt_device *cd,
+       struct luks2_hdr *hdr, struct device *device);
+
+int LUKS2_hdr_read(struct crypt_device *cd, struct luks2_hdr *hdr, int repair);
+int LUKS2_hdr_write(struct crypt_device *cd, struct luks2_hdr *hdr);
+int LUKS2_hdr_write_force(struct crypt_device *cd, struct luks2_hdr *hdr);
+int LUKS2_hdr_dump(struct crypt_device *cd, struct luks2_hdr *hdr);
+
+int LUKS2_hdr_uuid(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const char *uuid);
+
+int LUKS2_hdr_labels(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const char *label,
+       const char *subsystem,
+       int commit);
+
+void LUKS2_hdr_free(struct crypt_device *cd, struct luks2_hdr *hdr);
+
+int LUKS2_hdr_backup(struct crypt_device *cd,
+                    struct luks2_hdr *hdr,
+                    const char *backup_file);
+int LUKS2_hdr_restore(struct crypt_device *cd,
+                     struct luks2_hdr *hdr,
+                     const char *backup_file);
+
+uint64_t LUKS2_hdr_and_areas_size(json_object *jobj);
+uint64_t LUKS2_keyslots_size(json_object *jobj);
+uint64_t LUKS2_metadata_size(json_object *jobj);
+
+int LUKS2_keyslot_cipher_incompatible(struct crypt_device *cd, const char *cipher_spec);
+
+/*
+ * Generic LUKS2 keyslot
+ */
+int LUKS2_keyslot_open(struct crypt_device *cd,
+       int keyslot,
+       int segment,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vk);
+
+int LUKS2_keyslot_open_all_segments(struct crypt_device *cd,
+       int keyslot_old,
+       int keyslot_new,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vks);
+
+int LUKS2_keyslot_store(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const char *password,
+       size_t password_len,
+       const struct volume_key *vk,
+       const struct luks2_keyslot_params *params);
+
+int LUKS2_keyslot_reencrypt_store(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const void *buffer,
+       size_t buffer_length);
+
+int LUKS2_keyslot_reencrypt_create(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const struct crypt_params_reencrypt *params);
+
+int reenc_keyslot_update(struct crypt_device *cd,
+       const struct luks2_reenc_context *rh);
+
+int LUKS2_keyslot_wipe(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int wipe_area_only);
+
+int LUKS2_keyslot_dump(struct crypt_device *cd,
+       int keyslot);
+
+crypt_keyslot_priority LUKS2_keyslot_priority_get(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot);
+
+int LUKS2_keyslot_priority_set(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       crypt_keyslot_priority priority,
+       int commit);
+
+/*
+ * Generic LUKS2 token
+ */
+int LUKS2_token_json_get(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char **json);
+
+int LUKS2_token_assign(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int token,
+       int assign,
+       int commit);
+
+int LUKS2_token_is_assigned(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int token);
+
+int LUKS2_token_create(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char *json,
+       int commit);
+
+crypt_token_info LUKS2_token_status(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char **type);
+
+int LUKS2_builtin_token_get(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char *type,
+       void *params);
+
+int LUKS2_builtin_token_create(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char *type,
+       const void *params,
+       int commit);
+
+int LUKS2_token_open_and_activate(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               int token,
+               const char *name,
+               uint32_t flags,
+               void *usrptr);
+
+int LUKS2_token_open_and_activate_any(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const char *name,
+       uint32_t flags);
+
+int LUKS2_tokens_count(struct luks2_hdr *hdr);
+
+/*
+ * Generic LUKS2 segment
+ */
+uint64_t json_segment_get_offset(json_object *jobj_segment, unsigned blockwise);
+const char *json_segment_type(json_object *jobj_segment);
+uint64_t json_segment_get_iv_offset(json_object *jobj_segment);
+uint64_t json_segment_get_size(json_object *jobj_segment, unsigned blockwise);
+const char *json_segment_get_cipher(json_object *jobj_segment);
+int json_segment_get_sector_size(json_object *jobj_segment);
+bool json_segment_is_backup(json_object *jobj_segment);
+json_object *json_segments_get_segment(json_object *jobj_segments, int segment);
+unsigned json_segments_count(json_object *jobj_segments);
+void json_segment_remove_flag(json_object *jobj_segment, const char *flag);
+uint64_t json_segments_get_minimal_offset(json_object *jobj_segments, unsigned blockwise);
+json_object *json_segment_create_linear(uint64_t offset, const uint64_t *length, unsigned reencryption);
+json_object *json_segment_create_crypt(uint64_t offset, uint64_t iv_offset, const uint64_t *length, const char *cipher, uint32_t sector_size, unsigned reencryption);
+int json_segments_segment_in_reencrypt(json_object *jobj_segments);
+
+int LUKS2_segments_count(struct luks2_hdr *hdr);
+
+int LUKS2_segment_first_unused_id(struct luks2_hdr *hdr);
+
+int LUKS2_segment_set_flag(json_object *jobj_segment, const char *flag);
+
+json_object *LUKS2_get_segment_by_flag(struct luks2_hdr *hdr, const char *flag);
+
+int LUKS2_get_segment_id_by_flag(struct luks2_hdr *hdr, const char *flag);
+
+int LUKS2_segments_set(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       json_object *jobj_segments,
+       int commit);
+
+uint64_t LUKS2_segment_offset(struct luks2_hdr *hdr,
+       int segment,
+       unsigned blockwise);
+
+uint64_t LUKS2_segment_size(struct luks2_hdr *hdr,
+       int segment,
+       unsigned blockwise);
+
+int LUKS2_segment_is_type(struct luks2_hdr *hdr,
+       int segment,
+       const char *type);
+
+int LUKS2_segment_by_type(struct luks2_hdr *hdr,
+       const char *type);
+
+int LUKS2_last_segment_by_type(struct luks2_hdr *hdr,
+       const char *type);
+
+int LUKS2_get_default_segment(struct luks2_hdr *hdr);
+
+int LUKS2_reencrypt_digest_new(struct luks2_hdr *hdr);
+int LUKS2_reencrypt_digest_old(struct luks2_hdr *hdr);
+int LUKS2_reencrypt_data_offset(struct luks2_hdr *hdr, bool blockwise);
+
+/*
+ * Generic LUKS2 digest
+ */
+int LUKS2_digest_any_matching(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               const struct volume_key *vk);
+
+int LUKS2_digest_by_segment(struct luks2_hdr *hdr, int segment);
+
+int LUKS2_digest_verify_by_digest(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int digest,
+       const struct volume_key *vk);
+
+int LUKS2_digest_verify_by_segment(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int segment,
+       const struct volume_key *vk);
+
+void LUKS2_digests_erase_unused(struct crypt_device *cd,
+       struct luks2_hdr *hdr);
+
+int LUKS2_digest_verify(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const struct volume_key *vk,
+       int keyslot);
+
+int LUKS2_digest_dump(struct crypt_device *cd,
+       int digest);
+
+int LUKS2_digest_assign(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int digest,
+       int assign,
+       int commit);
+
+int LUKS2_digest_segment_assign(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int segment,
+       int digest,
+       int assign,
+       int commit);
+
+int LUKS2_digest_by_keyslot(struct luks2_hdr *hdr, int keyslot);
+
+int LUKS2_digest_create(struct crypt_device *cd,
+       const char *type,
+       struct luks2_hdr *hdr,
+       const struct volume_key *vk);
+
+/*
+ * LUKS2 generic
+ */
+int LUKS2_activate(struct crypt_device *cd,
+       const char *name,
+       struct volume_key *vk,
+       uint32_t flags);
+
+int LUKS2_activate_multi(struct crypt_device *cd,
+       const char *name,
+       struct volume_key *vks,
+       uint64_t device_size,
+       uint32_t flags);
+
+struct crypt_dm_active_device;
+
+int LUKS2_deactivate(struct crypt_device *cd,
+       const char *name,
+       struct luks2_hdr *hdr,
+       struct crypt_dm_active_device *dmd,
+       uint32_t flags);
+
+int LUKS2_reload(struct crypt_device *cd,
+       const char *name,
+       struct volume_key *vks,
+       uint64_t device_size,
+       uint32_t flags);
+
+int LUKS2_generate_hdr(
+       struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const struct volume_key *vk,
+       const char *cipherName,
+       const char *cipherMode,
+       const char *integrity,
+       const char *uuid,
+       unsigned int sector_size,
+       uint64_t data_offset,
+       uint64_t align_offset,
+       uint64_t required_alignment,
+       uint64_t metadata_size,
+       uint64_t keyslots_size);
+
+int LUKS2_check_metadata_area_size(uint64_t metadata_size);
+int LUKS2_check_keyslots_area_size(uint64_t keyslots_size);
+
+int LUKS2_wipe_header_areas(struct crypt_device *cd,
+       struct luks2_hdr *hdr);
+
+uint64_t LUKS2_get_data_offset(struct luks2_hdr *hdr);
+int LUKS2_get_data_size(struct luks2_hdr *hdr, uint64_t *size, bool *dynamic);
+int LUKS2_get_sector_size(struct luks2_hdr *hdr);
+const char *LUKS2_get_cipher(struct luks2_hdr *hdr, int segment);
+const char *LUKS2_get_integrity(struct luks2_hdr *hdr, int segment);
+int LUKS2_keyslot_params_default(struct crypt_device *cd, struct luks2_hdr *hdr,
+        struct luks2_keyslot_params *params);
+int LUKS2_get_volume_key_size(struct luks2_hdr *hdr, int segment);
+int LUKS2_get_keyslot_stored_key_size(struct luks2_hdr *hdr, int keyslot);
+const char *LUKS2_get_keyslot_cipher(struct luks2_hdr *hdr, int keyslot, size_t *key_size);
+int LUKS2_keyslot_find_empty(struct luks2_hdr *hdr);
+int LUKS2_keyslot_active_count(struct luks2_hdr *hdr, int segment);
+int LUKS2_keyslot_for_segment(struct luks2_hdr *hdr, int keyslot, int segment);
+int LUKS2_find_keyslot(struct luks2_hdr *hdr, const char *type);
+crypt_keyslot_info LUKS2_keyslot_info(struct luks2_hdr *hdr, int keyslot);
+int LUKS2_keyslot_area(struct luks2_hdr *hdr,
+       int keyslot,
+       uint64_t *offset,
+       uint64_t *length);
+int LUKS2_keyslot_pbkdf(struct luks2_hdr *hdr, int keyslot, struct crypt_pbkdf_type *pbkdf);
+int LUKS2_set_keyslots_size(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       uint64_t data_offset);
+
+/*
+ * Permanent activation flags stored in header
+ */
+int LUKS2_config_get_flags(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t *flags);
+int LUKS2_config_set_flags(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t flags);
+
+/*
+ * Requirements for device activation or header modification
+ */
+int LUKS2_config_get_requirements(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t *reqs);
+int LUKS2_config_set_requirements(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t reqs, bool commit);
+
+int LUKS2_unmet_requirements(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t reqs_mask, int quiet);
+
+int LUKS2_key_description_by_segment(struct crypt_device *cd,
+               struct luks2_hdr *hdr, struct volume_key *vk, int segment);
+int LUKS2_volume_key_load_in_keyring_by_keyslot(struct crypt_device *cd,
+               struct luks2_hdr *hdr, struct volume_key *vk, int keyslot);
+int LUKS2_volume_key_load_in_keyring_by_digest(struct crypt_device *cd,
+               struct luks2_hdr *hdr, struct volume_key *vk, int digest);
+
+struct luks_phdr;
+int LUKS2_luks1_to_luks2(struct crypt_device *cd,
+                        struct luks_phdr *hdr1,
+                        struct luks2_hdr *hdr2);
+int LUKS2_luks2_to_luks1(struct crypt_device *cd,
+                        struct luks2_hdr *hdr2,
+                        struct luks_phdr *hdr1);
+
+/*
+ * LUKS2 reencryption
+ */
+int LUKS2_reencrypt_locked_recovery_by_passphrase(struct crypt_device *cd,
+       int keyslot_old,
+       int keyslot_new,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags,
+       struct volume_key **vks);
+
+void LUKS2_reenc_context_free(struct crypt_device *cd, struct luks2_reenc_context *rh);
+
+int LUKS2_assembly_multisegment_dmd(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct volume_key *vks,
+       json_object *jobj_segments,
+       struct crypt_dm_active_device *dmd);
+
+crypt_reencrypt_info LUKS2_reencrypt_status(struct crypt_device *cd,
+       struct crypt_params_reencrypt *params);
+
+int crypt_reencrypt_lock(struct crypt_device *cd, struct crypt_lock_handle **reencrypt_lock);
+int crypt_reencrypt_lock_by_dm_uuid(struct crypt_device *cd, const char *dm_uuid, struct crypt_lock_handle **reencrypt_lock);
+void crypt_reencrypt_unlock(struct crypt_device *cd, struct crypt_lock_handle *reencrypt_lock);
+
+int luks2_check_device_size(struct crypt_device *cd, struct luks2_hdr *hdr, uint64_t check_size, uint64_t *dev_size, bool activation, bool dynamic);
+
+#endif
diff --git a/lib/luks2/luks2_digest.c b/lib/luks2/luks2_digest.c
new file mode 100644 (file)
index 0000000..94b3abf
--- /dev/null
@@ -0,0 +1,455 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, digest handling
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+
+extern const digest_handler PBKDF2_digest;
+
+static const digest_handler *digest_handlers[LUKS2_DIGEST_MAX] = {
+       &PBKDF2_digest,
+       NULL
+};
+
+static const digest_handler *LUKS2_digest_handler_type(struct crypt_device *cd, const char *type)
+{
+       int i;
+
+       for (i = 0; i < LUKS2_DIGEST_MAX && digest_handlers[i]; i++) {
+               if (!strcmp(digest_handlers[i]->name, type))
+                       return digest_handlers[i];
+       }
+
+       return NULL;
+}
+
+static const digest_handler *LUKS2_digest_handler(struct crypt_device *cd, int digest)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj1, *jobj2;
+
+       if (digest < 0)
+               return NULL;
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return NULL;
+
+       if (!(jobj1 = LUKS2_get_digest_jobj(hdr, digest)))
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj1, "type", &jobj2))
+               return NULL;
+
+       return LUKS2_digest_handler_type(cd, json_object_get_string(jobj2));
+}
+
+static int LUKS2_digest_find_free(struct crypt_device *cd, struct luks2_hdr *hdr)
+{
+       int digest = 0;
+
+       while (LUKS2_get_digest_jobj(hdr, digest) && digest < LUKS2_DIGEST_MAX)
+               digest++;
+
+       return digest < LUKS2_DIGEST_MAX ? digest : -1;
+}
+
+int LUKS2_digest_create(struct crypt_device *cd,
+       const char *type,
+       struct luks2_hdr *hdr,
+       const struct volume_key *vk)
+{
+       int digest;
+       const digest_handler *dh;
+
+       dh = LUKS2_digest_handler_type(cd, type);
+       if (!dh)
+               return -EINVAL;
+
+       digest = LUKS2_digest_find_free(cd, hdr);
+       if (digest < 0)
+               return -EINVAL;
+
+       log_dbg(cd, "Creating new digest %d (%s).", digest, type);
+
+       return dh->store(cd, digest, vk->key, vk->keylength) ?: digest;
+}
+
+int LUKS2_digest_by_keyslot(struct luks2_hdr *hdr, int keyslot)
+{
+       char keyslot_name[16];
+       json_object *jobj_digests, *jobj_digest_keyslots;
+
+       if (snprintf(keyslot_name, sizeof(keyslot_name), "%u", keyslot) < 1)
+               return -ENOMEM;
+
+       json_object_object_get_ex(hdr->jobj, "digests", &jobj_digests);
+
+       json_object_object_foreach(jobj_digests, key, val) {
+               json_object_object_get_ex(val, "keyslots", &jobj_digest_keyslots);
+               if (LUKS2_array_jobj(jobj_digest_keyslots, keyslot_name))
+                       return atoi(key);
+       }
+
+       return -ENOENT;
+}
+
+int LUKS2_digest_verify_by_digest(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int digest,
+       const struct volume_key *vk)
+{
+       const digest_handler *h;
+       int r;
+
+       h = LUKS2_digest_handler(cd, digest);
+       if (!h)
+               return -EINVAL;
+
+       r = h->verify(cd, digest, vk->key, vk->keylength);
+       if (r < 0) {
+               log_dbg(cd, "Digest %d (%s) verify failed with %d.", digest, h->name, r);
+               return r;
+       }
+
+       return digest;
+}
+
+int LUKS2_digest_verify(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const struct volume_key *vk,
+       int keyslot)
+{
+       int digest;
+
+       digest = LUKS2_digest_by_keyslot(hdr, keyslot);
+       if (digest < 0)
+               return digest;
+
+       log_dbg(cd, "Verifying key from keyslot %d, digest %d.", keyslot, digest);
+
+       return LUKS2_digest_verify_by_digest(cd, hdr, digest, vk);
+}
+
+int LUKS2_digest_dump(struct crypt_device *cd, int digest)
+{
+       const digest_handler *h;
+
+       if (!(h = LUKS2_digest_handler(cd, digest)))
+               return -EINVAL;
+
+       return h->dump(cd, digest);
+}
+
+int LUKS2_digest_any_matching(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               const struct volume_key *vk)
+{
+       int digest;
+
+       for (digest = 0; digest < LUKS2_DIGEST_MAX; digest++)
+               if (LUKS2_digest_verify_by_digest(cd, hdr, digest, vk) == digest)
+                       return digest;
+
+       return -ENOENT;
+}
+
+int LUKS2_digest_verify_by_segment(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int segment,
+       const struct volume_key *vk)
+{
+       return LUKS2_digest_verify_by_digest(cd, hdr, LUKS2_digest_by_segment(hdr, segment), vk);
+}
+
+/* FIXME: segment can have more digests */
+int LUKS2_digest_by_segment(struct luks2_hdr *hdr, int segment)
+{
+       char segment_name[16];
+       json_object *jobj_digests, *jobj_digest_segments;
+
+       if (segment == CRYPT_DEFAULT_SEGMENT)
+               segment = LUKS2_get_default_segment(hdr);
+
+       json_object_object_get_ex(hdr->jobj, "digests", &jobj_digests);
+
+       if (snprintf(segment_name, sizeof(segment_name), "%u", segment) < 1)
+               return -EINVAL;
+
+       json_object_object_foreach(jobj_digests, key, val) {
+               json_object_object_get_ex(val, "segments", &jobj_digest_segments);
+               if (!LUKS2_array_jobj(jobj_digest_segments, segment_name))
+                       continue;
+
+               return atoi(key);
+       }
+
+       return -ENOENT;
+}
+
+static int assign_one_digest(struct crypt_device *cd, struct luks2_hdr *hdr,
+                            int keyslot, int digest, int assign)
+{
+       json_object *jobj1, *jobj_digest, *jobj_digest_keyslots;
+       char num[16];
+
+       log_dbg(cd, "Keyslot %i %s digest %i.", keyslot, assign ? "assigned to" : "unassigned from", digest);
+
+       jobj_digest = LUKS2_get_digest_jobj(hdr, digest);
+       if (!jobj_digest)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_digest, "keyslots", &jobj_digest_keyslots);
+       if (!jobj_digest_keyslots)
+               return -EINVAL;
+
+       snprintf(num, sizeof(num), "%d", keyslot);
+       if (assign) {
+               jobj1 = LUKS2_array_jobj(jobj_digest_keyslots, num);
+               if (!jobj1)
+                       json_object_array_add(jobj_digest_keyslots, json_object_new_string(num));
+       } else {
+               jobj1 = LUKS2_array_remove(jobj_digest_keyslots, num);
+               if (jobj1)
+                       json_object_object_add(jobj_digest, "keyslots", jobj1);
+       }
+
+       return 0;
+}
+
+int LUKS2_digest_assign(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       int keyslot, int digest, int assign, int commit)
+{
+       json_object *jobj_digests;
+       int r = 0;
+
+       if (digest == CRYPT_ANY_DIGEST) {
+               json_object_object_get_ex(hdr->jobj, "digests", &jobj_digests);
+
+               json_object_object_foreach(jobj_digests, key, val) {
+                       UNUSED(val);
+                       r = assign_one_digest(cd, hdr, keyslot, atoi(key), assign);
+                       if (r < 0)
+                               break;
+               }
+       } else
+               r = assign_one_digest(cd, hdr, keyslot, digest, assign);
+
+       if (r < 0)
+               return r;
+
+       // FIXME: do not write header in nothing changed
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+}
+
+static int assign_all_segments(struct crypt_device *cd, struct luks2_hdr *hdr,
+                            int digest, int assign)
+{
+       json_object *jobj1, *jobj_digest, *jobj_digest_segments;
+
+       jobj_digest = LUKS2_get_digest_jobj(hdr, digest);
+       if (!jobj_digest)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_digest, "segments", &jobj_digest_segments);
+       if (!jobj_digest_segments)
+               return -EINVAL;
+
+       if (assign) {
+               json_object_object_foreach(LUKS2_get_segments_jobj(hdr), key, value) {
+                       UNUSED(value);
+                       jobj1 = LUKS2_array_jobj(jobj_digest_segments, key);
+                       if (!jobj1)
+                               json_object_array_add(jobj_digest_segments, json_object_new_string(key));
+               }
+       } else {
+               jobj1 = json_object_new_array();
+               if (!jobj1)
+                       return -ENOMEM;
+               json_object_object_add(jobj_digest, "segments", jobj1);
+       }
+
+       return 0;
+}
+
+static int assign_one_segment(struct crypt_device *cd, struct luks2_hdr *hdr,
+                            int segment, int digest, int assign)
+{
+       json_object *jobj1, *jobj_digest, *jobj_digest_segments;
+       char num[16];
+
+       log_dbg(cd, "Segment %i %s digest %i.", segment, assign ? "assigned to" : "unassigned from", digest);
+
+       jobj_digest = LUKS2_get_digest_jobj(hdr, digest);
+       if (!jobj_digest)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_digest, "segments", &jobj_digest_segments);
+       if (!jobj_digest_segments)
+               return -EINVAL;
+
+       snprintf(num, sizeof(num), "%d", segment);
+       if (assign) {
+               jobj1 = LUKS2_array_jobj(jobj_digest_segments, num);
+               if (!jobj1)
+                       json_object_array_add(jobj_digest_segments, json_object_new_string(num));
+       } else {
+               jobj1 = LUKS2_array_remove(jobj_digest_segments, num);
+               if (jobj1)
+                       json_object_object_add(jobj_digest, "segments", jobj1);
+       }
+
+       return 0;
+}
+
+int LUKS2_digest_segment_assign(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       int segment, int digest, int assign, int commit)
+{
+       json_object *jobj_digests;
+       int r = 0;
+
+       if (segment == CRYPT_DEFAULT_SEGMENT)
+               segment = LUKS2_get_default_segment(hdr);
+
+       if (digest == CRYPT_ANY_DIGEST) {
+               json_object_object_get_ex(hdr->jobj, "digests", &jobj_digests);
+
+               json_object_object_foreach(jobj_digests, key, val) {
+                       UNUSED(val);
+                       if (segment == CRYPT_ANY_SEGMENT)
+                               r = assign_all_segments(cd, hdr, atoi(key), assign);
+                       else
+                               r = assign_one_segment(cd, hdr, segment, atoi(key), assign);
+                       if (r < 0)
+                               break;
+               }
+       } else {
+               if (segment == CRYPT_ANY_SEGMENT)
+                       r = assign_all_segments(cd, hdr, digest, assign);
+               else
+                       r = assign_one_segment(cd, hdr, segment, digest, assign);
+       }
+
+       if (r < 0)
+               return r;
+
+       // FIXME: do not write header in nothing changed
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+}
+
+static int digest_unused(json_object *jobj_digest)
+{
+       json_object *jobj;
+
+       json_object_object_get_ex(jobj_digest, "segments", &jobj);
+       if (!jobj || !json_object_is_type(jobj, json_type_array) || json_object_array_length(jobj) > 0)
+               return 0;
+
+       json_object_object_get_ex(jobj_digest, "keyslots", &jobj);
+       if (!jobj || !json_object_is_type(jobj, json_type_array))
+               return 0;
+
+       return json_object_array_length(jobj) > 0 ? 0 : 1;
+}
+
+void LUKS2_digests_erase_unused(struct crypt_device *cd,
+       struct luks2_hdr *hdr)
+{
+       json_object *jobj_digests;
+
+       json_object_object_get_ex(hdr->jobj, "digests", &jobj_digests);
+       if (!jobj_digests || !json_object_is_type(jobj_digests, json_type_object))
+               return;
+
+       json_object_object_foreach(jobj_digests, key, val) {
+               if (digest_unused(val)) {
+                       log_dbg(cd, "Erasing unused digest %d.", atoi(key));
+                       json_object_object_del(jobj_digests, key);
+               }
+       }
+}
+
+/* Key description helpers */
+static char *get_key_description_by_digest(struct crypt_device *cd, int digest)
+{
+       char *desc, digest_str[3];
+       int r;
+       size_t len;
+
+       if (!crypt_get_uuid(cd))
+               return NULL;
+
+       r = snprintf(digest_str, sizeof(digest_str), "d%u", digest);
+       if (r < 0 || (size_t)r >= sizeof(digest_str))
+               return NULL;
+
+       /* "cryptsetup:<uuid>-<digest_str>" + \0 */
+       len = strlen(crypt_get_uuid(cd)) + strlen(digest_str) + 13;
+
+       desc = malloc(len);
+       if (!desc)
+              return NULL;
+
+       r = snprintf(desc, len, "%s:%s-%s", "cryptsetup", crypt_get_uuid(cd), digest_str);
+       if (r < 0 || (size_t)r >= len) {
+              free(desc);
+              return NULL;
+       }
+
+       return desc;
+}
+
+int LUKS2_key_description_by_segment(struct crypt_device *cd,
+               struct luks2_hdr *hdr, struct volume_key *vk, int segment)
+{
+       char *desc = get_key_description_by_digest(cd, LUKS2_digest_by_segment(hdr, segment));
+       int r;
+
+       r = crypt_volume_key_set_description(vk, desc);
+       free(desc);
+       return r;
+}
+
+int LUKS2_volume_key_load_in_keyring_by_keyslot(struct crypt_device *cd,
+               struct luks2_hdr *hdr, struct volume_key *vk, int keyslot)
+{
+       char *desc = get_key_description_by_digest(cd, LUKS2_digest_by_keyslot(hdr, keyslot));
+       int r;
+
+       r = crypt_volume_key_set_description(vk, desc);
+       if (!r)
+               r = crypt_volume_key_load_in_keyring(cd, vk);
+
+       free(desc);
+       return r;
+}
+
+int LUKS2_volume_key_load_in_keyring_by_digest(struct crypt_device *cd,
+               struct luks2_hdr *hdr, struct volume_key *vk, int digest)
+{
+       char *desc = get_key_description_by_digest(cd, digest);
+       int r;
+
+       r = crypt_volume_key_set_description(vk, desc);
+       if (!r)
+               r = crypt_volume_key_load_in_keyring(cd, vk);
+
+       free(desc);
+       return r;
+}
diff --git a/lib/luks2/luks2_digest_pbkdf2.c b/lib/luks2/luks2_digest_pbkdf2.c
new file mode 100644 (file)
index 0000000..bf1e4f9
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, PBKDF2 digest handler (LUKS1 compatible)
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+
+#define LUKS_DIGESTSIZE 20 // since SHA1
+#define LUKS_SALTSIZE 32
+#define LUKS_MKD_ITERATIONS_MS 125
+
+static int PBKDF2_digest_verify(struct crypt_device *cd,
+       int digest,
+       const char *volume_key,
+       size_t volume_key_len)
+{
+       char checkHashBuf[64];
+       json_object *jobj_digest, *jobj1;
+       const char *hashSpec;
+       char *mkDigest = NULL, mkDigestSalt[LUKS_SALTSIZE];
+       unsigned int mkDigestIterations;
+       size_t len;
+       int r;
+
+       /* This can be done only for internally linked digests */
+       jobj_digest = LUKS2_get_digest_jobj(crypt_get_hdr(cd, CRYPT_LUKS2), digest);
+       if (!jobj_digest)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_digest, "hash", &jobj1))
+               return -EINVAL;
+       hashSpec = json_object_get_string(jobj1);
+
+       if (!json_object_object_get_ex(jobj_digest, "iterations", &jobj1))
+               return -EINVAL;
+       mkDigestIterations = json_object_get_int64(jobj1);
+
+       if (!json_object_object_get_ex(jobj_digest, "salt", &jobj1))
+               return -EINVAL;
+       len = sizeof(mkDigestSalt);
+       if (!base64_decode(json_object_get_string(jobj1),
+                          json_object_get_string_len(jobj1), mkDigestSalt, &len))
+               return -EINVAL;
+       if (len != LUKS_SALTSIZE)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_digest, "digest", &jobj1))
+               return -EINVAL;
+       len = 0;
+       if (!base64_decode_alloc(json_object_get_string(jobj1),
+                          json_object_get_string_len(jobj1), &mkDigest, &len))
+               return -EINVAL;
+       if (len < LUKS_DIGESTSIZE ||
+           len > sizeof(checkHashBuf) ||
+           (len != LUKS_DIGESTSIZE && len != (size_t)crypt_hash_size(hashSpec))) {
+               free(mkDigest);
+               return -EINVAL;
+       }
+
+       r = -EPERM;
+       if (crypt_pbkdf(CRYPT_KDF_PBKDF2, hashSpec, volume_key, volume_key_len,
+                       mkDigestSalt, LUKS_SALTSIZE,
+                       checkHashBuf, len,
+                       mkDigestIterations, 0, 0) < 0) {
+               r = -EINVAL;
+       } else {
+               if (memcmp(checkHashBuf, mkDigest, len) == 0)
+                       r = 0;
+       }
+
+       free(mkDigest);
+       return r;
+}
+
+static int PBKDF2_digest_store(struct crypt_device *cd,
+       int digest,
+       const char *volume_key,
+       size_t volume_key_len)
+{
+       json_object *jobj_digest, *jobj_digests;
+       char salt[LUKS_SALTSIZE], digest_raw[128];
+       int hmac_size, r;
+       char *base64_str;
+       struct luks2_hdr *hdr;
+       struct crypt_pbkdf_limits pbkdf_limits;
+       const struct crypt_pbkdf_type *pbkdf_cd;
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_PBKDF2,
+               .time_ms = LUKS_MKD_ITERATIONS_MS,
+       };
+
+       /* Inherit hash from PBKDF setting */
+       pbkdf_cd = crypt_get_pbkdf_type(cd);
+       if (pbkdf_cd)
+               pbkdf.hash = pbkdf_cd->hash;
+       if (!pbkdf.hash)
+               pbkdf.hash = DEFAULT_LUKS1_HASH;
+
+       log_dbg(cd, "Setting PBKDF2 type key digest %d.", digest);
+
+       r = crypt_random_get(cd, salt, LUKS_SALTSIZE, CRYPT_RND_SALT);
+       if (r < 0)
+               return r;
+
+       r = crypt_pbkdf_get_limits(CRYPT_KDF_PBKDF2, &pbkdf_limits);
+       if (r < 0)
+               return r;
+
+       if (crypt_get_pbkdf(cd)->flags & CRYPT_PBKDF_NO_BENCHMARK)
+               pbkdf.iterations = pbkdf_limits.min_iterations;
+       else {
+               r = crypt_benchmark_pbkdf_internal(cd, &pbkdf, volume_key_len);
+               if (r < 0)
+                       return r;
+       }
+
+       hmac_size = crypt_hmac_size(pbkdf.hash);
+       if (hmac_size < 0 || hmac_size > (int)sizeof(digest_raw))
+               return -EINVAL;
+
+       r = crypt_pbkdf(CRYPT_KDF_PBKDF2, pbkdf.hash, volume_key, volume_key_len,
+                       salt, LUKS_SALTSIZE, digest_raw, hmac_size,
+                       pbkdf.iterations, 0, 0);
+       if (r < 0)
+               return r;
+
+       jobj_digest = LUKS2_get_digest_jobj(crypt_get_hdr(cd, CRYPT_LUKS2), digest);
+       jobj_digests = NULL;
+       if (!jobj_digest) {
+               hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+               jobj_digest = json_object_new_object();
+               json_object_object_get_ex(hdr->jobj, "digests", &jobj_digests);
+       }
+
+       json_object_object_add(jobj_digest, "type", json_object_new_string("pbkdf2"));
+       json_object_object_add(jobj_digest, "keyslots", json_object_new_array());
+       json_object_object_add(jobj_digest, "segments", json_object_new_array());
+       json_object_object_add(jobj_digest, "hash", json_object_new_string(pbkdf.hash));
+       json_object_object_add(jobj_digest, "iterations", json_object_new_int(pbkdf.iterations));
+
+       base64_encode_alloc(salt, LUKS_SALTSIZE, &base64_str);
+       if (!base64_str) {
+               json_object_put(jobj_digest);
+               return -ENOMEM;
+       }
+       json_object_object_add(jobj_digest, "salt", json_object_new_string(base64_str));
+       free(base64_str);
+
+       base64_encode_alloc(digest_raw, hmac_size, &base64_str);
+       if (!base64_str) {
+               json_object_put(jobj_digest);
+               return -ENOMEM;
+       }
+       json_object_object_add(jobj_digest, "digest", json_object_new_string(base64_str));
+       free(base64_str);
+
+       if (jobj_digests)
+               json_object_object_add_by_uint(jobj_digests, digest, jobj_digest);
+
+       JSON_DBG(cd, jobj_digest, "Digest JSON:");
+       return 0;
+}
+
+static int PBKDF2_digest_dump(struct crypt_device *cd, int digest)
+{
+       json_object *jobj_digest, *jobj1;
+
+       /* This can be done only for internally linked digests */
+       jobj_digest = LUKS2_get_digest_jobj(crypt_get_hdr(cd, CRYPT_LUKS2), digest);
+       if (!jobj_digest)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_digest, "hash", &jobj1);
+       log_std(cd, "\tHash:       %s\n", json_object_get_string(jobj1));
+
+       json_object_object_get_ex(jobj_digest, "iterations", &jobj1);
+       log_std(cd, "\tIterations: %" PRIu64 "\n", json_object_get_int64(jobj1));
+
+       json_object_object_get_ex(jobj_digest, "salt", &jobj1);
+       log_std(cd, "\tSalt:       ");
+       hexprint_base64(cd, jobj1, " ", "            ");
+
+       json_object_object_get_ex(jobj_digest, "digest", &jobj1);
+       log_std(cd, "\tDigest:     ");
+       hexprint_base64(cd, jobj1, " ", "            ");
+
+       return 0;
+}
+
+const digest_handler PBKDF2_digest = {
+       .name   = "pbkdf2",
+       .verify = PBKDF2_digest_verify,
+       .store  = PBKDF2_digest_store,
+       .dump   = PBKDF2_digest_dump,
+};
diff --git a/lib/luks2/luks2_disk_metadata.c b/lib/luks2/luks2_disk_metadata.c
new file mode 100644 (file)
index 0000000..9654cdb
--- /dev/null
@@ -0,0 +1,806 @@
+/*
+ * LUKS - Linux Unified Key Setup v2
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <assert.h>
+
+#include "luks2_internal.h"
+
+/*
+ * Helper functions
+ */
+static json_object *parse_json_len(struct crypt_device *cd, const char *json_area,
+                           uint64_t max_length, int *json_len)
+{
+       json_object *jobj;
+       struct json_tokener *jtok;
+
+        /* INT32_MAX is internal (json-c) json_tokener_parse_ex() limit */
+       if (!json_area || max_length > INT32_MAX)
+               return NULL;
+
+       jtok = json_tokener_new();
+       if (!jtok) {
+               log_dbg(cd, "ERROR: Failed to init json tokener");
+               return NULL;
+       }
+
+       jobj = json_tokener_parse_ex(jtok, json_area, max_length);
+       if (!jobj)
+               log_dbg(cd, "ERROR: Failed to parse json data (%d): %s",
+                       json_tokener_get_error(jtok),
+                       json_tokener_error_desc(json_tokener_get_error(jtok)));
+       else
+               *json_len = jtok->char_offset;
+
+       json_tokener_free(jtok);
+
+       return jobj;
+}
+
+static void log_dbg_checksum(struct crypt_device *cd,
+                            const uint8_t *csum, const char *csum_alg, const char *info)
+{
+       char csum_txt[2*LUKS2_CHECKSUM_L+1];
+       int i;
+
+       for (i = 0; i < crypt_hash_size(csum_alg); i++)
+               snprintf(&csum_txt[i*2], 3, "%02hhx", (const char)csum[i]);
+       csum_txt[i*2+1] = '\0'; /* Just to be safe, sprintf should write \0 there. */
+
+       log_dbg(cd, "Checksum:%s (%s)", &csum_txt[0], info);
+}
+
+/*
+ * Calculate hash (checksum) of |LUKS2_bin|LUKS2_JSON_area| from in-memory structs.
+ * LUKS2 on-disk header contains uniques salt both for primary and secondary header.
+ * Checksum is always calculated with zeroed checksum field in binary header.
+ */
+static int hdr_checksum_calculate(const char *alg, struct luks2_hdr_disk *hdr_disk,
+                                 const char *json_area, size_t json_len)
+{
+       struct crypt_hash *hd = NULL;
+       int hash_size, r;
+
+       hash_size = crypt_hash_size(alg);
+       if (hash_size <= 0 || crypt_hash_init(&hd, alg))
+               return -EINVAL;
+
+       /* Binary header, csum zeroed. */
+       r = crypt_hash_write(hd, (char*)hdr_disk, LUKS2_HDR_BIN_LEN);
+
+       /* JSON area (including unused space) */
+       if (!r)
+               r = crypt_hash_write(hd, json_area, json_len);
+
+       if (!r)
+               r = crypt_hash_final(hd, (char*)hdr_disk->csum, (size_t)hash_size);
+
+       crypt_hash_destroy(hd);
+       return r;
+}
+
+/*
+ * Compare hash (checksum) of on-disk and in-memory header.
+ */
+static int hdr_checksum_check(struct crypt_device *cd,
+                             const char *alg, struct luks2_hdr_disk *hdr_disk,
+                             const char *json_area, size_t json_len)
+{
+       struct luks2_hdr_disk hdr_tmp;
+       int hash_size, r;
+
+       hash_size = crypt_hash_size(alg);
+       if (hash_size <= 0)
+               return -EINVAL;
+
+       /* Copy header and zero checksum. */
+       memcpy(&hdr_tmp, hdr_disk, LUKS2_HDR_BIN_LEN);
+       memset(&hdr_tmp.csum, 0, sizeof(hdr_tmp.csum));
+
+       r = hdr_checksum_calculate(alg, &hdr_tmp, json_area, json_len);
+       if (r < 0)
+               return r;
+
+       log_dbg_checksum(cd, hdr_disk->csum, alg, "on-disk");
+       log_dbg_checksum(cd, hdr_tmp.csum, alg, "in-memory");
+
+       if (memcmp(hdr_tmp.csum, hdr_disk->csum, (size_t)hash_size))
+               return -EINVAL;
+
+       return 0;
+}
+
+/*
+ * Convert header from on-disk format to in-memory struct
+ */
+static void hdr_from_disk(struct luks2_hdr_disk *hdr_disk1,
+                         struct luks2_hdr_disk *hdr_disk2,
+                         struct luks2_hdr *hdr,
+                         int secondary)
+{
+       hdr->version  = be16_to_cpu(hdr_disk1->version);
+       hdr->hdr_size = be64_to_cpu(hdr_disk1->hdr_size);
+       hdr->seqid    = be64_to_cpu(hdr_disk1->seqid);
+
+       memcpy(hdr->label, hdr_disk1->label, LUKS2_LABEL_L);
+       hdr->label[LUKS2_LABEL_L - 1] = '\0';
+       memcpy(hdr->subsystem, hdr_disk1->subsystem, LUKS2_LABEL_L);
+       hdr->subsystem[LUKS2_LABEL_L - 1] = '\0';
+       memcpy(hdr->checksum_alg, hdr_disk1->checksum_alg, LUKS2_CHECKSUM_ALG_L);
+       hdr->checksum_alg[LUKS2_CHECKSUM_ALG_L - 1] = '\0';
+       memcpy(hdr->uuid, hdr_disk1->uuid, LUKS2_UUID_L);
+       hdr->uuid[LUKS2_UUID_L - 1] = '\0';
+
+       if (secondary) {
+               memcpy(hdr->salt1, hdr_disk2->salt, LUKS2_SALT_L);
+               memcpy(hdr->salt2, hdr_disk1->salt, LUKS2_SALT_L);
+       } else {
+               memcpy(hdr->salt1, hdr_disk1->salt, LUKS2_SALT_L);
+               memcpy(hdr->salt2, hdr_disk2->salt, LUKS2_SALT_L);
+       }
+}
+
+/*
+ * Convert header from in-memory struct to on-disk format
+ */
+static void hdr_to_disk(struct luks2_hdr *hdr,
+                       struct luks2_hdr_disk *hdr_disk,
+                       int secondary, uint64_t offset)
+{
+       assert(((char*)&(hdr_disk->_padding4096) - (char*)&(hdr_disk->magic)) == 512);
+
+       memset(hdr_disk, 0, LUKS2_HDR_BIN_LEN);
+
+       memcpy(&hdr_disk->magic, secondary ? LUKS2_MAGIC_2ND : LUKS2_MAGIC_1ST, LUKS2_MAGIC_L);
+       hdr_disk->version     = cpu_to_be16(hdr->version);
+       hdr_disk->hdr_size    = cpu_to_be64(hdr->hdr_size);
+       hdr_disk->hdr_offset  = cpu_to_be64(offset);
+       hdr_disk->seqid       = cpu_to_be64(hdr->seqid);
+
+       strncpy(hdr_disk->label, hdr->label, LUKS2_LABEL_L);
+       hdr_disk->label[LUKS2_LABEL_L - 1] = '\0';
+       strncpy(hdr_disk->subsystem, hdr->subsystem, LUKS2_LABEL_L);
+       hdr_disk->subsystem[LUKS2_LABEL_L - 1] = '\0';
+       strncpy(hdr_disk->checksum_alg, hdr->checksum_alg, LUKS2_CHECKSUM_ALG_L);
+       hdr_disk->checksum_alg[LUKS2_CHECKSUM_ALG_L - 1] = '\0';
+       strncpy(hdr_disk->uuid, hdr->uuid, LUKS2_UUID_L);
+       hdr_disk->uuid[LUKS2_UUID_L - 1] = '\0';
+
+       memcpy(hdr_disk->salt, secondary ? hdr->salt2 : hdr->salt1, LUKS2_SALT_L);
+}
+
+/*
+ * Sanity checks before checksum is validated
+ */
+static int hdr_disk_sanity_check_pre(struct crypt_device *cd,
+                                    struct luks2_hdr_disk *hdr,
+                                    size_t *hdr_json_size, int secondary,
+                                    uint64_t offset)
+{
+       if (memcmp(hdr->magic, secondary ? LUKS2_MAGIC_2ND : LUKS2_MAGIC_1ST, LUKS2_MAGIC_L))
+               return -EINVAL;
+
+       if (be16_to_cpu(hdr->version) != 2) {
+               log_dbg(cd, "Unsupported LUKS2 header version %u.", be16_to_cpu(hdr->version));
+               return -EINVAL;
+       }
+
+       if (offset != be64_to_cpu(hdr->hdr_offset)) {
+               log_dbg(cd, "LUKS2 offset 0x%04x on device differs to expected offset 0x%04x.",
+                       (unsigned)be64_to_cpu(hdr->hdr_offset), (unsigned)offset);
+               return -EINVAL;
+       }
+
+       if (secondary && (offset != be64_to_cpu(hdr->hdr_size))) {
+               log_dbg(cd, "LUKS2 offset 0x%04x in secondary header does not match size 0x%04x.",
+                       (unsigned)offset, (unsigned)be64_to_cpu(hdr->hdr_size));
+               return -EINVAL;
+       }
+
+       /* FIXME: sanity check checksum alg. */
+
+       log_dbg(cd, "LUKS2 header version %u of size %u bytes, checksum %s.",
+               (unsigned)be16_to_cpu(hdr->version), (unsigned)be64_to_cpu(hdr->hdr_size),
+               hdr->checksum_alg);
+
+       *hdr_json_size = be64_to_cpu(hdr->hdr_size) - LUKS2_HDR_BIN_LEN;
+       return 0;
+}
+
+/*
+ * Read LUKS2 header from disk at specific offset.
+ */
+static int hdr_read_disk(struct crypt_device *cd,
+                        struct device *device, struct luks2_hdr_disk *hdr_disk,
+                        char **json_area, uint64_t offset, int secondary)
+{
+       size_t hdr_json_size = 0;
+       int devfd, r;
+
+       log_dbg(cd, "Trying to read %s LUKS2 header at offset 0x%" PRIx64 ".",
+               secondary ? "secondary" : "primary", offset);
+
+       devfd = device_open_locked(cd, device, O_RDONLY);
+       if (devfd < 0)
+               return devfd == -1 ? -EIO : devfd;
+
+       /*
+        * Read binary header and run sanity check before reading
+        * JSON area and validating checksum.
+        */
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                                device_alignment(device), hdr_disk,
+                                LUKS2_HDR_BIN_LEN, offset) != LUKS2_HDR_BIN_LEN) {
+               return -EIO;
+       }
+
+       r = hdr_disk_sanity_check_pre(cd, hdr_disk, &hdr_json_size, secondary, offset);
+       if (r < 0) {
+               return r;
+       }
+
+       /*
+        * Allocate and read JSON area. Always the whole area must be read.
+        */
+       *json_area = malloc(hdr_json_size);
+       if (!*json_area) {
+               return -ENOMEM;
+       }
+
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                                device_alignment(device), *json_area, hdr_json_size,
+                                offset + LUKS2_HDR_BIN_LEN) != (ssize_t)hdr_json_size) {
+               free(*json_area);
+               *json_area = NULL;
+               return -EIO;
+       }
+
+       /*
+        * Calculate and validate checksum and zero it afterwards.
+        */
+       if (hdr_checksum_check(cd, hdr_disk->checksum_alg, hdr_disk,
+                               *json_area, hdr_json_size)) {
+               log_dbg(cd, "LUKS2 header checksum error (offset %" PRIu64 ").", offset);
+               r = -EINVAL;
+       }
+       memset(hdr_disk->csum, 0, LUKS2_CHECKSUM_L);
+
+       return r;
+}
+
+/*
+ * Write LUKS2 header to disk at specific offset.
+ */
+static int hdr_write_disk(struct crypt_device *cd,
+                         struct device *device, struct luks2_hdr *hdr,
+                         const char *json_area, int secondary)
+{
+       struct luks2_hdr_disk hdr_disk;
+       uint64_t offset = secondary ? hdr->hdr_size : 0;
+       size_t hdr_json_len;
+       int devfd, r;
+
+       log_dbg(cd, "Trying to write LUKS2 header (%zu bytes) at offset %" PRIu64 ".",
+               hdr->hdr_size, offset);
+
+       /* FIXME: read-only device silent fail? */
+
+       devfd = device_open_locked(cd, device, O_RDWR);
+       if (devfd < 0)
+               return devfd == -1 ? -EINVAL : devfd;
+
+       hdr_json_len = hdr->hdr_size - LUKS2_HDR_BIN_LEN;
+
+       hdr_to_disk(hdr, &hdr_disk, secondary, offset);
+
+       /*
+        * Write header without checksum but with proper seqid.
+        */
+       if (write_lseek_blockwise(devfd, device_block_size(cd, device),
+                                 device_alignment(device), (char *)&hdr_disk,
+                                 LUKS2_HDR_BIN_LEN, offset) < (ssize_t)LUKS2_HDR_BIN_LEN) {
+               return -EIO;
+       }
+
+       /*
+        * Write json area.
+        */
+       if (write_lseek_blockwise(devfd, device_block_size(cd, device),
+                                 device_alignment(device),
+                                 CONST_CAST(char*)json_area, hdr_json_len,
+                                 LUKS2_HDR_BIN_LEN + offset) < (ssize_t)hdr_json_len) {
+               return -EIO;
+       }
+
+       /*
+        * Calculate checksum and write header with checksum.
+        */
+       r = hdr_checksum_calculate(hdr_disk.checksum_alg, &hdr_disk,
+                                  json_area, hdr_json_len);
+       if (r < 0) {
+               return r;
+       }
+       log_dbg_checksum(cd, hdr_disk.csum, hdr_disk.checksum_alg, "in-memory");
+
+       if (write_lseek_blockwise(devfd, device_block_size(cd, device),
+                                 device_alignment(device), (char *)&hdr_disk,
+                                 LUKS2_HDR_BIN_LEN, offset) < (ssize_t)LUKS2_HDR_BIN_LEN)
+               r = -EIO;
+
+       device_sync(cd, device);
+       return r;
+}
+
+static int LUKS2_check_sequence_id(struct crypt_device *cd, struct luks2_hdr *hdr, struct device *device)
+{
+       int devfd;
+       struct luks2_hdr_disk dhdr;
+
+       if (!hdr)
+               return -EINVAL;
+
+       devfd = device_open_locked(cd, device, O_RDONLY);
+       if (devfd < 0)
+               return devfd == -1 ? -EINVAL : devfd;
+
+       /* we need only first 512 bytes, see luks2_hdr_disk structure */
+       if ((read_lseek_blockwise(devfd, device_block_size(cd, device),
+            device_alignment(device), &dhdr, 512, 0) != 512))
+               return -EIO;
+
+       /* there's nothing to check if there's no LUKS2 header */
+       if ((be16_to_cpu(dhdr.version) != 2) ||
+           memcmp(dhdr.magic, LUKS2_MAGIC_1ST, LUKS2_MAGIC_L) ||
+           strcmp(dhdr.uuid, hdr->uuid))
+               return 0;
+
+       return hdr->seqid != be64_to_cpu(dhdr.seqid);
+}
+
+int LUKS2_device_write_lock(struct crypt_device *cd, struct luks2_hdr *hdr, struct device *device)
+{
+       int r = device_write_lock(cd, device);
+
+       if (r < 0) {
+               log_err(cd, _("Failed to acquire write lock on device %s."), device_path(device));
+               return r;
+       }
+
+       /* 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)) {
+               log_dbg(cd, "Checking context sequence id matches value stored on disk.");
+               if (LUKS2_check_sequence_id(cd, hdr, device)) {
+                       device_write_unlock(cd, device);
+                       log_err(cd, _("Detected attempt for concurrent LUKS2 metadata update. Aborting operation."));
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
+/*
+ * Convert in-memory LUKS2 header and write it to disk.
+ * This will increase sequence id, write both header copies and calculate checksum.
+ */
+int LUKS2_disk_hdr_write(struct crypt_device *cd, struct luks2_hdr *hdr, struct device *device, bool seqid_check)
+{
+       char *json_area;
+       const char *json_text;
+       size_t json_area_len;
+       int r;
+
+       if (hdr->version != 2) {
+               log_dbg(cd, "Unsupported LUKS2 header version (%u).", hdr->version);
+               return -EINVAL;
+       }
+
+       r = device_check_size(cd, crypt_metadata_device(cd), LUKS2_hdr_and_areas_size(hdr->jobj), 1);
+       if (r)
+               return r;
+
+       /*
+        * Allocate and zero JSON area (of proper header size).
+        */
+       json_area_len = hdr->hdr_size - LUKS2_HDR_BIN_LEN;
+       json_area = crypt_zalloc(json_area_len);
+       if (!json_area)
+               return -ENOMEM;
+
+       /*
+        * Generate text space-efficient JSON representation to json area.
+        */
+       json_text = json_object_to_json_string_ext(hdr->jobj,
+                       JSON_C_TO_STRING_PLAIN | JSON_C_TO_STRING_NOSLASHESCAPE);
+       if (!json_text || !*json_text) {
+               log_dbg(cd, "Cannot parse JSON object to text representation.");
+               free(json_area);
+               return -ENOMEM;
+       }
+       if (strlen(json_text) > (json_area_len - 1)) {
+               log_dbg(cd, "JSON is too large (%zu > %zu).", strlen(json_text), json_area_len);
+               free(json_area);
+               return -EINVAL;
+       }
+       strncpy(json_area, json_text, json_area_len);
+
+       if (seqid_check)
+               r = LUKS2_device_write_lock(cd, hdr, device);
+       else
+               r = device_write_lock(cd, device);
+       if (r < 0) {
+               free(json_area);
+               return r;
+       }
+
+       /* Increase sequence id before writing it to disk. */
+       hdr->seqid++;
+
+       /* Write primary and secondary header */
+       r = hdr_write_disk(cd, device, hdr, json_area, 0);
+       if (!r)
+               r = hdr_write_disk(cd, device, hdr, json_area, 1);
+
+       if (r)
+               log_dbg(cd, "LUKS2 header write failed (%d).", r);
+
+       device_write_unlock(cd, device);
+
+       free(json_area);
+       return r;
+}
+static int validate_json_area(struct crypt_device *cd, const char *json_area,
+                             uint64_t json_len, uint64_t max_length)
+{
+       char c;
+
+       /* Enforce there are no needless opening bytes */
+       if (*json_area != '{') {
+               log_dbg(cd, "ERROR: Opening character must be left curly bracket: '{'.");
+               return -EINVAL;
+       }
+
+       if (json_len >= max_length) {
+               log_dbg(cd, "ERROR: Missing trailing null byte beyond parsed json data string.");
+               return -EINVAL;
+       }
+
+       /*
+        * TODO:
+        *      validate there are legal json format characters between
+        *      'json_area' and 'json_area + json_len'
+        */
+
+       do {
+               c = *(json_area + json_len);
+               if (c != '\0') {
+                       log_dbg(cd, "ERROR: Forbidden ascii code 0x%02hhx found beyond json data string at offset %" PRIu64,
+                               c, json_len);
+                       return -EINVAL;
+               }
+       } while (++json_len < max_length);
+
+       return 0;
+}
+
+static int validate_luks2_json_object(struct crypt_device *cd, json_object *jobj_hdr, uint64_t length)
+{
+       int r;
+
+       /* we require top level object to be of json_type_object */
+       r = !json_object_is_type(jobj_hdr, json_type_object);
+       if (r) {
+               log_dbg(cd, "ERROR: Resulting object is not a json object type");
+               return r;
+       }
+
+       r = LUKS2_hdr_validate(cd, jobj_hdr, length);
+       if (r) {
+               log_dbg(cd, "Repairing JSON metadata.");
+               /* try to correct known glitches */
+               LUKS2_hdr_repair(cd, jobj_hdr);
+
+               /* run validation again */
+               r = LUKS2_hdr_validate(cd, jobj_hdr, length);
+       }
+
+       if (r)
+               log_dbg(cd, "ERROR: LUKS2 validation failed");
+
+       return r;
+}
+
+static json_object *parse_and_validate_json(struct crypt_device *cd,
+                                           const char *json_area, uint64_t max_length)
+{
+       int json_len, r;
+       json_object *jobj = parse_json_len(cd, json_area, max_length, &json_len);
+
+       if (!jobj)
+               return NULL;
+
+       /* successful parse_json_len must not return offset <= 0 */
+       assert(json_len > 0);
+
+       r = validate_json_area(cd, json_area, json_len, max_length);
+       if (!r)
+               r = validate_luks2_json_object(cd, jobj, max_length);
+
+       if (r) {
+               json_object_put(jobj);
+               jobj = NULL;
+       }
+
+       return jobj;
+}
+
+static int detect_device_signatures(struct crypt_device *cd, const char *path)
+{
+       blk_probe_status prb_state;
+       int r;
+       struct blkid_handle *h;
+
+       if (!blk_supported()) {
+               log_dbg(cd, "Blkid probing of device signatures disabled.");
+               return 0;
+       }
+
+       if ((r = blk_init_by_path(&h, path))) {
+               log_dbg(cd, "Failed to initialize blkid_handle by path.");
+               return -EINVAL;
+       }
+
+       /* We don't care about details. Be fast. */
+       blk_set_chains_for_fast_detection(h);
+
+       /* Filter out crypto_LUKS. we don't care now */
+       blk_superblocks_filter_luks(h);
+
+       prb_state = blk_safeprobe(h);
+
+       switch (prb_state) {
+       case PRB_AMBIGUOUS:
+               log_dbg(cd, "Blkid probe couldn't decide device type unambiguously.");
+               /* fall through */
+       case PRB_FAIL:
+               log_dbg(cd, "Blkid probe failed.");
+               r = -EINVAL;
+               break;
+       case PRB_OK: /* crypto_LUKS type is filtered out */
+               r = -EINVAL;
+
+               if (blk_is_partition(h))
+                       log_dbg(cd, "Blkid probe detected partition type '%s'", blk_get_partition_type(h));
+               else if (blk_is_superblock(h))
+                       log_dbg(cd, "blkid probe detected superblock type '%s'", blk_get_superblock_type(h));
+               break;
+       case PRB_EMPTY:
+               log_dbg(cd, "Blkid probe detected no foreign device signature.");
+       }
+       blk_free(h);
+       return r;
+}
+
+/*
+ * Read and convert on-disk LUKS2 header to in-memory representation..
+ * Try to do recovery if on-disk state is not consistent.
+ */
+int LUKS2_disk_hdr_read(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       struct device *device, int do_recovery, int do_blkprobe)
+{
+       enum { HDR_OK, HDR_OBSOLETE, HDR_FAIL, HDR_FAIL_IO } state_hdr1, state_hdr2;
+       struct luks2_hdr_disk hdr_disk1, hdr_disk2;
+       char *json_area1 = NULL, *json_area2 = NULL;
+       json_object *jobj_hdr1 = NULL, *jobj_hdr2 = NULL;
+       unsigned int i;
+       int r;
+       uint64_t hdr_size;
+       uint64_t hdr2_offsets[] = LUKS2_HDR2_OFFSETS;
+
+       /* Skip auto-recovery if locks are disabled and we're not doing LUKS2 explicit repair */
+       if (do_recovery && do_blkprobe && !crypt_metadata_locking_enabled()) {
+               do_recovery = 0;
+               log_dbg(cd, "Disabling header auto-recovery due to locking being disabled.");
+       }
+
+       /*
+        * Read primary LUKS2 header (offset 0).
+        */
+       state_hdr1 = HDR_FAIL;
+       r = hdr_read_disk(cd, device, &hdr_disk1, &json_area1, 0, 0);
+       if (r == 0) {
+               jobj_hdr1 = parse_and_validate_json(cd, json_area1, be64_to_cpu(hdr_disk1.hdr_size) - LUKS2_HDR_BIN_LEN);
+               state_hdr1 = jobj_hdr1 ? HDR_OK : HDR_OBSOLETE;
+       } else if (r == -EIO)
+               state_hdr1 = HDR_FAIL_IO;
+
+       /*
+        * Read secondary LUKS2 header (follows primary).
+        */
+       state_hdr2 = HDR_FAIL;
+       if (state_hdr1 != HDR_FAIL && state_hdr1 != HDR_FAIL_IO) {
+               r = hdr_read_disk(cd, device, &hdr_disk2, &json_area2, be64_to_cpu(hdr_disk1.hdr_size), 1);
+               if (r == 0) {
+                       jobj_hdr2 = parse_and_validate_json(cd, json_area2, be64_to_cpu(hdr_disk2.hdr_size) - LUKS2_HDR_BIN_LEN);
+                       state_hdr2 = jobj_hdr2 ? HDR_OK : HDR_OBSOLETE;
+               } else if (r == -EIO)
+                       state_hdr2 = HDR_FAIL_IO;
+       } else {
+               /*
+                * No header size, check all known offsets.
+                */
+               for (r = -EINVAL,i = 0; r < 0 && i < ARRAY_SIZE(hdr2_offsets); i++)
+                       r = hdr_read_disk(cd, device, &hdr_disk2, &json_area2, hdr2_offsets[i], 1);
+
+               if (r == 0) {
+                       jobj_hdr2 = parse_and_validate_json(cd, json_area2, be64_to_cpu(hdr_disk2.hdr_size) - LUKS2_HDR_BIN_LEN);
+                       state_hdr2 = jobj_hdr2 ? HDR_OK : HDR_OBSOLETE;
+               } else if (r == -EIO)
+                       state_hdr2 = HDR_FAIL_IO;
+       }
+
+       /*
+        * Check sequence id if both headers are read correctly.
+        */
+       if (state_hdr1 == HDR_OK && state_hdr2 == HDR_OK) {
+               if (be64_to_cpu(hdr_disk1.seqid) > be64_to_cpu(hdr_disk2.seqid))
+                       state_hdr2 = HDR_OBSOLETE;
+               else if (be64_to_cpu(hdr_disk1.seqid) < be64_to_cpu(hdr_disk2.seqid))
+                       state_hdr1 = HDR_OBSOLETE;
+       }
+
+       /* check header with keyslots to fit the device */
+       if (state_hdr1 == HDR_OK)
+               hdr_size = LUKS2_hdr_and_areas_size(jobj_hdr1);
+       else if (state_hdr2 == HDR_OK)
+               hdr_size = LUKS2_hdr_and_areas_size(jobj_hdr2);
+       else {
+               r = (state_hdr1 == HDR_FAIL_IO && state_hdr2 == HDR_FAIL_IO) ? -EIO : -EINVAL;
+               goto err;
+       }
+
+       r = device_check_size(cd, device, hdr_size, 0);
+       if (r)
+               goto err;
+
+       /*
+        * Try to rewrite (recover) bad header. Always regenerate salt for bad header.
+        */
+       if (state_hdr1 == HDR_OK && state_hdr2 != HDR_OK) {
+               log_dbg(cd, "Secondary LUKS2 header requires recovery.");
+
+               if (do_blkprobe && (r = detect_device_signatures(cd, device_path(device)))) {
+                       log_err(cd, _("Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+                                     "Please run \"cryptsetup repair\" for recovery."));
+                       goto err;
+               }
+
+               if (do_recovery) {
+                       memcpy(&hdr_disk2, &hdr_disk1, LUKS2_HDR_BIN_LEN);
+                       r = crypt_random_get(cd, (char*)hdr_disk2.salt, sizeof(hdr_disk2.salt), CRYPT_RND_SALT);
+                       if (r)
+                               log_dbg(cd, "Cannot generate master salt.");
+                       else {
+                               hdr_from_disk(&hdr_disk1, &hdr_disk2, hdr, 0);
+                               r = hdr_write_disk(cd, device, hdr, json_area1, 1);
+                       }
+                       if (r)
+                               log_dbg(cd, "Secondary LUKS2 header recovery failed.");
+               }
+       } else if (state_hdr1 != HDR_OK && state_hdr2 == HDR_OK) {
+               log_dbg(cd, "Primary LUKS2 header requires recovery.");
+
+               if (do_blkprobe && (r = detect_device_signatures(cd, device_path(device)))) {
+                       log_err(cd, _("Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+                                     "Please run \"cryptsetup repair\" for recovery."));
+                       goto err;
+               }
+
+               if (do_recovery) {
+                       memcpy(&hdr_disk1, &hdr_disk2, LUKS2_HDR_BIN_LEN);
+                       r = crypt_random_get(cd, (char*)hdr_disk1.salt, sizeof(hdr_disk1.salt), CRYPT_RND_SALT);
+                       if (r)
+                               log_dbg(cd, "Cannot generate master salt.");
+                       else {
+                               hdr_from_disk(&hdr_disk2, &hdr_disk1, hdr, 1);
+                               r = hdr_write_disk(cd, device, hdr, json_area2, 0);
+                       }
+                       if (r)
+                               log_dbg(cd, "Primary LUKS2 header recovery failed.");
+               }
+       }
+
+       free(json_area1);
+       json_area1 = NULL;
+       free(json_area2);
+       json_area2 = NULL;
+
+       /* wrong lock for write mode during recovery attempt */
+       if (r == -EAGAIN)
+               goto err;
+
+       /*
+        * Even if status is failed, the second header includes salt.
+        */
+       if (state_hdr1 == HDR_OK) {
+               hdr_from_disk(&hdr_disk1, &hdr_disk2, hdr, 0);
+               hdr->jobj = jobj_hdr1;
+               json_object_put(jobj_hdr2);
+       } else if (state_hdr2 == HDR_OK) {
+               hdr_from_disk(&hdr_disk2, &hdr_disk1, hdr, 1);
+               hdr->jobj = jobj_hdr2;
+               json_object_put(jobj_hdr1);
+       }
+
+       /*
+        * FIXME: should this fail? At least one header was read correctly.
+        * r = (state_hdr1 == HDR_FAIL_IO || state_hdr2 == HDR_FAIL_IO) ? -EIO : -EINVAL;
+        */
+       return 0;
+err:
+       log_dbg(cd, "LUKS2 header read failed (%d).", r);
+
+       free(json_area1);
+       free(json_area2);
+       json_object_put(jobj_hdr1);
+       json_object_put(jobj_hdr2);
+       hdr->jobj = NULL;
+       return r;
+}
+
+int LUKS2_hdr_version_unlocked(struct crypt_device *cd, const char *backup_file)
+{
+       struct {
+               char magic[LUKS2_MAGIC_L];
+               uint16_t version;
+       }  __attribute__ ((packed)) hdr;
+       struct device *device = NULL;
+       int r = 0, devfd = -1, flags;
+
+       if (!backup_file)
+               device = crypt_metadata_device(cd);
+       else if (device_alloc(cd, &device, backup_file) < 0)
+               return 0;
+
+       if (!device)
+               return 0;
+
+       flags = O_RDONLY;
+       if (device_direct_io(device))
+               flags |= O_DIRECT;
+
+       devfd = open(device_path(device), flags);
+       if (devfd < 0)
+               goto err;
+
+       if ((read_lseek_blockwise(devfd, device_block_size(cd, device),
+            device_alignment(device), &hdr, sizeof(hdr), 0) == sizeof(hdr)) &&
+           !memcmp(hdr.magic, LUKS2_MAGIC_1ST, LUKS2_MAGIC_L))
+               r = (int)be16_to_cpu(hdr.version);
+err:
+       if (devfd != -1)
+               close(devfd);
+
+       if (backup_file)
+               device_free(cd, device);
+
+       return r;
+}
diff --git a/lib/luks2/luks2_internal.h b/lib/luks2/luks2_internal.h
new file mode 100644 (file)
index 0000000..a5bcb1f
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * LUKS - Linux Unified Key Setup v2
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _CRYPTSETUP_LUKS2_INTERNAL_H
+#define _CRYPTSETUP_LUKS2_INTERNAL_H
+
+#include <stdio.h>
+#include <errno.h>
+#include <json-c/json.h>
+
+#include "internal.h"
+#include "base64.h"
+#include "luks2.h"
+
+#define UNUSED(x) (void)(x)
+
+/* override useless forward slash escape when supported by json-c */
+#ifndef JSON_C_TO_STRING_NOSLASHESCAPE
+#define JSON_C_TO_STRING_NOSLASHESCAPE 0
+#endif
+
+/*
+ * On-disk access function prototypes
+ */
+int LUKS2_disk_hdr_read(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       struct device *device, int do_recovery, int do_blkprobe);
+int LUKS2_disk_hdr_write(struct crypt_device *cd, struct luks2_hdr *hdr,
+                        struct device *device, bool seqid_check);
+
+/*
+ * JSON struct access helpers
+ */
+json_object *LUKS2_get_keyslot_jobj(struct luks2_hdr *hdr, int keyslot);
+json_object *LUKS2_get_token_jobj(struct luks2_hdr *hdr, int token);
+json_object *LUKS2_get_digest_jobj(struct luks2_hdr *hdr, int digest);
+json_object *LUKS2_get_segment_jobj(struct luks2_hdr *hdr, int segment);
+json_object *LUKS2_get_tokens_jobj(struct luks2_hdr *hdr);
+json_object *LUKS2_get_segments_jobj(struct luks2_hdr *hdr);
+
+void hexprint_base64(struct crypt_device *cd, json_object *jobj,
+                    const char *sep, const char *line_sep);
+
+uint64_t crypt_jobj_get_uint64(json_object *jobj);
+uint32_t crypt_jobj_get_uint32(json_object *jobj);
+json_object *crypt_jobj_new_uint64(uint64_t value);
+
+int json_object_object_add_by_uint(json_object *jobj, unsigned key, json_object *jobj_val);
+void json_object_object_del_by_uint(json_object *jobj, unsigned key);
+int json_object_copy(json_object *jobj_src, json_object **jobj_dst);
+
+void JSON_DBG(struct crypt_device *cd, json_object *jobj, const char *desc);
+
+/*
+ * LUKS2 JSON validation
+ */
+
+/* validation helper */
+json_bool validate_json_uint32(json_object *jobj);
+json_object *json_contains(struct crypt_device *cd, json_object *jobj, const char *name,
+                          const char *section, const char *key, json_type type);
+
+int LUKS2_hdr_validate(struct crypt_device *cd, json_object *hdr_jobj, uint64_t json_size);
+int LUKS2_check_json_size(struct crypt_device *cd, const struct luks2_hdr *hdr);
+int LUKS2_token_validate(struct crypt_device *cd, json_object *hdr_jobj,
+                        json_object *jobj_token, const char *key);
+void LUKS2_token_dump(struct crypt_device *cd, int token);
+
+/*
+ * LUKS2 JSON repair for known glitches
+ */
+void LUKS2_hdr_repair(struct crypt_device *cd, json_object *jobj_hdr);
+void LUKS2_keyslots_repair(struct crypt_device *cd, json_object *jobj_hdr);
+
+/*
+ * JSON array helpers
+ */
+struct json_object *LUKS2_array_jobj(struct json_object *array, const char *num);
+struct json_object *LUKS2_array_remove(struct json_object *array, const char *num);
+
+/*
+ * Plugins API
+ */
+
+/**
+ * LUKS2 keyslots handlers (EXPERIMENTAL)
+ */
+typedef int (*keyslot_alloc_func)(struct crypt_device *cd, int keyslot,
+                                 size_t volume_key_len,
+                                 const struct luks2_keyslot_params *params);
+typedef int (*keyslot_update_func)(struct crypt_device *cd, int keyslot,
+                                  const struct luks2_keyslot_params *params);
+typedef int (*keyslot_open_func) (struct crypt_device *cd, int keyslot,
+                                 const char *password, size_t password_len,
+                                 char *volume_key, size_t volume_key_len);
+typedef int (*keyslot_store_func)(struct crypt_device *cd, int keyslot,
+                                 const char *password, size_t password_len,
+                                 const char *volume_key, size_t volume_key_len);
+typedef int (*keyslot_wipe_func) (struct crypt_device *cd, int keyslot);
+typedef int (*keyslot_dump_func) (struct crypt_device *cd, int keyslot);
+typedef int (*keyslot_validate_func) (struct crypt_device *cd, json_object *jobj_keyslot);
+typedef void(*keyslot_repair_func) (struct crypt_device *cd, json_object *jobj_keyslot);
+
+/* see LUKS2_luks2_to_luks1 */
+int placeholder_keyslot_alloc(struct crypt_device *cd,
+       int keyslot,
+       uint64_t area_offset,
+       uint64_t area_length,
+       size_t volume_key_len);
+
+/* validate all keyslot implementations in hdr json */
+int LUKS2_keyslots_validate(struct crypt_device *cd, json_object *hdr_jobj);
+
+typedef struct  {
+       const char *name;
+       keyslot_alloc_func alloc;
+       keyslot_update_func update;
+       keyslot_open_func  open;
+       keyslot_store_func store;
+       keyslot_wipe_func  wipe;
+       keyslot_dump_func  dump;
+       keyslot_validate_func validate;
+       keyslot_repair_func repair;
+} keyslot_handler;
+
+/* can not fit prototype alloc function */
+int reenc_keyslot_alloc(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const struct crypt_params_reencrypt *params);
+
+/**
+ * LUKS2 digest handlers (EXPERIMENTAL)
+ */
+typedef int (*digest_verify_func)(struct crypt_device *cd, int digest,
+                                 const char *volume_key, size_t volume_key_len);
+typedef int (*digest_store_func) (struct crypt_device *cd, int digest,
+                                 const char *volume_key, size_t volume_key_len);
+typedef int (*digest_dump_func)  (struct crypt_device *cd, int digest);
+
+typedef struct  {
+       const char *name;
+       digest_verify_func verify;
+       digest_store_func  store;
+       digest_dump_func   dump;
+} digest_handler;
+
+/**
+ * LUKS2 token handlers (internal use only)
+ */
+typedef int (*builtin_token_get_func) (json_object *jobj_token, void *params);
+typedef int (*builtin_token_set_func) (json_object **jobj_token, const void *params);
+
+typedef struct {
+       /* internal only section used by builtin tokens */
+       builtin_token_get_func get;
+       builtin_token_set_func set;
+       /* public token handler */
+       const crypt_token_handler *h;
+} token_handler;
+
+int token_keyring_set(json_object **, const void *);
+int token_keyring_get(json_object *, void *);
+
+int LUKS2_find_area_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       size_t keylength, uint64_t *area_offset, uint64_t *area_length);
+int LUKS2_find_area_max_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
+                           uint64_t *area_offset, uint64_t *area_length);
+
+int LUKS2_check_cipher(struct crypt_device *cd,
+                     size_t keylength,
+                     const char *cipher,
+                     const char *cipher_mode);
+
+static inline const char *crypt_reencrypt_mode_to_str(crypt_reencrypt_mode_info mi)
+{
+       if (mi == CRYPT_REENCRYPT_REENCRYPT)
+               return "reencrypt";
+       if (mi == CRYPT_REENCRYPT_ENCRYPT)
+               return "encrypt";
+       if (mi == CRYPT_REENCRYPT_DECRYPT)
+               return "decrypt";
+       return "<unknown>";
+}
+
+#endif
diff --git a/lib/luks2/luks2_json_format.c b/lib/luks2/luks2_json_format.c
new file mode 100644 (file)
index 0000000..1416766
--- /dev/null
@@ -0,0 +1,405 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, LUKS2 header format code
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+#include <uuid/uuid.h>
+#include <assert.h>
+
+struct area {
+       uint64_t offset;
+       uint64_t length;
+};
+
+static size_t get_area_size(size_t keylength)
+{
+       //FIXME: calculate this properly, for now it is AF_split_sectors
+       return size_round_up(keylength * 4000, 4096);
+}
+
+static size_t get_min_offset(struct luks2_hdr *hdr)
+{
+       return 2 * hdr->hdr_size;
+}
+
+static size_t get_max_offset(struct luks2_hdr *hdr)
+{
+       return LUKS2_hdr_and_areas_size(hdr->jobj);
+}
+
+int LUKS2_find_area_max_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       uint64_t *area_offset, uint64_t *area_length)
+{
+       struct area areas[LUKS2_KEYSLOTS_MAX], sorted_areas[LUKS2_KEYSLOTS_MAX+1] = {};
+       int i, j, k, area_i;
+       size_t valid_offset, offset, length;
+
+       /* fill area offset + length table */
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++) {
+               if (!LUKS2_keyslot_area(hdr, i, &areas[i].offset, &areas[i].length))
+                       continue;
+               areas[i].length = 0;
+               areas[i].offset = 0;
+       }
+
+       /* sort table */
+       k = 0; /* index in sorted table */
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++) {
+               offset = get_max_offset(hdr) ?: UINT64_MAX;
+               area_i = -1;
+               /* search for the smallest offset in table */
+               for (j = 0; j < LUKS2_KEYSLOTS_MAX; j++)
+                       if (areas[j].offset && areas[j].offset <= offset) {
+                               area_i = j;
+                               offset = areas[j].offset;
+                       }
+
+               if (area_i >= 0) {
+                       sorted_areas[k].length = areas[area_i].length;
+                       sorted_areas[k].offset = areas[area_i].offset;
+                       areas[area_i].length = 0;
+                       areas[area_i].offset = 0;
+                       k++;
+               }
+       }
+
+       sorted_areas[LUKS2_KEYSLOTS_MAX].offset = get_max_offset(hdr);
+       sorted_areas[LUKS2_KEYSLOTS_MAX].length = 1;
+
+       /* search for the gap we can use */
+       length = valid_offset = 0;
+       offset = get_min_offset(hdr);
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX+1; i++) {
+               /* skip empty */
+               if (sorted_areas[i].offset == 0 || sorted_areas[i].length == 0)
+                       continue;
+
+               /* found bigger gap than the last one */
+               if ((offset < sorted_areas[i].offset) && (sorted_areas[i].offset - offset) > length) {
+                       length = sorted_areas[i].offset - offset;
+                       valid_offset = offset;
+               }
+
+               /* move beyond allocated area */
+               offset = sorted_areas[i].offset + sorted_areas[i].length;
+       }
+
+       /* this search 'algorithm' does not work with unaligned areas */
+       assert(length == size_round_up(length, 4096));
+       assert(valid_offset == size_round_up(valid_offset, 4096));
+
+       if (!length) {
+               log_dbg(cd, "Not enough space in header keyslot area.");
+               return -EINVAL;
+       }
+
+       log_dbg(cd, "Found largest free area %zu -> %zu", valid_offset, length + valid_offset);
+
+       *area_offset = valid_offset;
+       *area_length = length;
+
+       return 0;
+}
+
+int LUKS2_find_area_gap(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       size_t keylength, uint64_t *area_offset, uint64_t *area_length)
+{
+       struct area areas[LUKS2_KEYSLOTS_MAX], sorted_areas[LUKS2_KEYSLOTS_MAX] = {};
+       int i, j, k, area_i;
+       size_t offset, length;
+
+       /* fill area offset + length table */
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++) {
+               if (!LUKS2_keyslot_area(hdr, i, &areas[i].offset, &areas[i].length))
+                       continue;
+               areas[i].length = 0;
+               areas[i].offset = 0;
+       }
+
+       /* sort table */
+       k = 0; /* index in sorted table */
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++) {
+               offset = get_max_offset(hdr) ?: UINT64_MAX;
+               area_i = -1;
+               /* search for the smallest offset in table */
+               for (j = 0; j < LUKS2_KEYSLOTS_MAX; j++)
+                       if (areas[j].offset && areas[j].offset <= offset) {
+                               area_i = j;
+                               offset = areas[j].offset;
+                       }
+
+               if (area_i >= 0) {
+                       sorted_areas[k].length = areas[area_i].length;
+                       sorted_areas[k].offset = areas[area_i].offset;
+                       areas[area_i].length = 0;
+                       areas[area_i].offset = 0;
+                       k++;
+               }
+       }
+
+       /* search for the gap we can use */
+       offset = get_min_offset(hdr);
+       length = get_area_size(keylength);
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++) {
+               /* skip empty */
+               if (sorted_areas[i].offset == 0 || sorted_areas[i].length == 0)
+                       continue;
+
+               /* enough space before the used area */
+               if ((offset < sorted_areas[i].offset) && ((offset + length) <= sorted_areas[i].offset))
+                       break;
+
+               /* both offset and length are already aligned to 4096 bytes */
+               offset = sorted_areas[i].offset + sorted_areas[i].length;
+       }
+
+       if ((offset + length) > get_max_offset(hdr)) {
+               log_dbg(cd, "Not enough space in header keyslot area.");
+               return -EINVAL;
+       }
+
+       log_dbg(cd, "Found area %zu -> %zu", offset, length + offset);
+
+       *area_offset = offset;
+       *area_length = length;
+       return 0;
+}
+
+int LUKS2_check_metadata_area_size(uint64_t metadata_size)
+{
+       /* see LUKS2_HDR2_OFFSETS */
+       return (metadata_size != 0x004000 &&
+               metadata_size != 0x008000 && metadata_size != 0x010000 &&
+               metadata_size != 0x020000 && metadata_size != 0x040000 &&
+               metadata_size != 0x080000 && metadata_size != 0x100000 &&
+               metadata_size != 0x200000 && metadata_size != 0x400000);
+}
+
+int LUKS2_check_keyslots_area_size(uint64_t keyslots_size)
+{
+       return (MISALIGNED_4K(keyslots_size) ||
+               keyslots_size > LUKS2_MAX_KEYSLOTS_SIZE);
+}
+
+int LUKS2_generate_hdr(
+       struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const struct volume_key *vk,
+       const char *cipherName,
+       const char *cipherMode,
+       const char *integrity,
+       const char *uuid,
+       unsigned int sector_size,  /* in bytes */
+       uint64_t data_offset,      /* in bytes */
+       uint64_t align_offset,     /* in bytes */
+       uint64_t required_alignment,
+       uint64_t metadata_size,
+       uint64_t keyslots_size)
+{
+       struct json_object *jobj_segment, *jobj_integrity, *jobj_keyslots, *jobj_segments, *jobj_config;
+       char cipher[128];
+       uuid_t partitionUuid;
+       int digest;
+       uint64_t mdev_size;
+
+       if (!metadata_size)
+               metadata_size = LUKS2_HDR_16K_LEN;
+       hdr->hdr_size = metadata_size;
+
+       if (data_offset && data_offset < get_min_offset(hdr)) {
+               log_err(cd, _("Requested data offset is too small."));
+               return -EINVAL;
+       }
+
+       /* Increase keyslot size according to data offset */
+       if (!keyslots_size && data_offset)
+               keyslots_size = data_offset - get_min_offset(hdr);
+
+       /* keyslots size has to be 4 KiB aligned */
+       keyslots_size -= (keyslots_size % 4096);
+
+       if (keyslots_size > LUKS2_MAX_KEYSLOTS_SIZE)
+               keyslots_size = LUKS2_MAX_KEYSLOTS_SIZE;
+
+       if (!keyslots_size) {
+               assert(LUKS2_DEFAULT_HDR_SIZE > 2 * LUKS2_HDR_OFFSET_MAX);
+               keyslots_size = LUKS2_DEFAULT_HDR_SIZE - get_min_offset(hdr);
+               /* Decrease keyslots_size due to metadata device being too small */
+               if (!device_size(crypt_metadata_device(cd), &mdev_size) &&
+                   ((keyslots_size + get_min_offset(hdr)) > mdev_size) &&
+                   device_fallocate(crypt_metadata_device(cd), keyslots_size + get_min_offset(hdr)))
+                       keyslots_size = mdev_size - get_min_offset(hdr);
+       }
+
+       /* Decrease keyslots_size if we have smaller data_offset */
+       if (data_offset && (keyslots_size + get_min_offset(hdr)) > data_offset) {
+               keyslots_size = data_offset - get_min_offset(hdr);
+               log_dbg(cd, "Decreasing keyslot area size to %" PRIu64
+                       " bytes due to the requested data offset %"
+                       PRIu64 " bytes.", keyslots_size, data_offset);
+       }
+
+       /* Data offset has priority */
+       if (!data_offset && required_alignment) {
+               data_offset = size_round_up(get_min_offset(hdr) + keyslots_size,
+                                           (size_t)required_alignment);
+               data_offset += align_offset;
+       }
+
+       log_dbg(cd, "Formatting LUKS2 with JSON metadata area %" PRIu64
+               " bytes and keyslots area %" PRIu64 " bytes.",
+               metadata_size - LUKS2_HDR_BIN_LEN, keyslots_size);
+
+       if (keyslots_size < (LUKS2_HDR_OFFSET_MAX - 2*LUKS2_HDR_16K_LEN))
+               log_std(cd, _("WARNING: keyslots area (%" PRIu64 " bytes) is very small,"
+                       " available LUKS2 keyslot count is very limited.\n"),
+                       keyslots_size);
+
+       hdr->seqid = 1;
+       hdr->version = 2;
+       memset(hdr->label, 0, LUKS2_LABEL_L);
+       strcpy(hdr->checksum_alg, "sha256");
+       crypt_random_get(cd, (char*)hdr->salt1, LUKS2_SALT_L, CRYPT_RND_SALT);
+       crypt_random_get(cd, (char*)hdr->salt2, LUKS2_SALT_L, CRYPT_RND_SALT);
+
+       if (uuid && uuid_parse(uuid, partitionUuid) == -1) {
+               log_err(cd, _("Wrong LUKS UUID format provided."));
+               return -EINVAL;
+       }
+       if (!uuid)
+               uuid_generate(partitionUuid);
+
+       uuid_unparse(partitionUuid, hdr->uuid);
+
+       if (*cipherMode != '\0')
+               snprintf(cipher, sizeof(cipher), "%s-%s", cipherName, cipherMode);
+       else
+               snprintf(cipher, sizeof(cipher), "%s", cipherName);
+
+       hdr->jobj = json_object_new_object();
+
+       jobj_keyslots = json_object_new_object();
+       json_object_object_add(hdr->jobj, "keyslots", jobj_keyslots);
+       json_object_object_add(hdr->jobj, "tokens", json_object_new_object());
+       jobj_segments = json_object_new_object();
+       json_object_object_add(hdr->jobj, "segments", jobj_segments);
+       json_object_object_add(hdr->jobj, "digests", json_object_new_object());
+       jobj_config = json_object_new_object();
+       json_object_object_add(hdr->jobj, "config", jobj_config);
+
+       digest = LUKS2_digest_create(cd, "pbkdf2", hdr, vk);
+       if (digest < 0)
+               goto err;
+
+       if (LUKS2_digest_segment_assign(cd, hdr, 0, digest, 1, 0) < 0)
+               goto err;
+
+       jobj_segment = json_segment_create_crypt(data_offset, 0, NULL, cipher, sector_size, 0);
+       if (!jobj_segment)
+               goto err;
+
+       if (integrity) {
+               jobj_integrity = json_object_new_object();
+               json_object_object_add(jobj_integrity, "type", json_object_new_string(integrity));
+               json_object_object_add(jobj_integrity, "journal_encryption", json_object_new_string("none"));
+               json_object_object_add(jobj_integrity, "journal_integrity", json_object_new_string("none"));
+               json_object_object_add(jobj_segment, "integrity", jobj_integrity);
+       }
+
+       json_object_object_add_by_uint(jobj_segments, 0, jobj_segment);
+
+       json_object_object_add(jobj_config, "json_size", crypt_jobj_new_uint64(metadata_size - LUKS2_HDR_BIN_LEN));
+       json_object_object_add(jobj_config, "keyslots_size", crypt_jobj_new_uint64(keyslots_size));
+
+       JSON_DBG(cd, hdr->jobj, "Header JSON:");
+       return 0;
+err:
+       json_object_put(hdr->jobj);
+       hdr->jobj = NULL;
+       return -EINVAL;
+}
+
+int LUKS2_wipe_header_areas(struct crypt_device *cd,
+       struct luks2_hdr *hdr)
+{
+       int r;
+       uint64_t offset, length;
+       size_t wipe_block;
+
+       /* Wipe complete header, keyslots and padding areas with zeroes. */
+       offset = 0;
+       length = LUKS2_get_data_offset(hdr) * SECTOR_SIZE;
+       wipe_block = 1024 * 1024;
+
+       if (LUKS2_hdr_validate(cd, hdr->jobj, hdr->hdr_size - LUKS2_HDR_BIN_LEN))
+               return -EINVAL;
+
+       /* On detached header wipe at least the first 4k */
+       if (length == 0) {
+               length = 4096;
+               wipe_block = 4096;
+       }
+
+       log_dbg(cd, "Wiping LUKS areas (0x%06" PRIx64 " - 0x%06" PRIx64") with zeroes.",
+               offset, length + offset);
+
+       r = crypt_wipe_device(cd, crypt_metadata_device(cd), CRYPT_WIPE_ZERO,
+                             offset, length, wipe_block, NULL, NULL);
+       if (r < 0)
+               return r;
+
+       /* Wipe keyslot area */
+       wipe_block = 1024 * 1024;
+       offset = get_min_offset(hdr);
+       length = LUKS2_keyslots_size(hdr->jobj);
+
+       log_dbg(cd, "Wiping keyslots area (0x%06" PRIx64 " - 0x%06" PRIx64") with random data.",
+               offset, length + offset);
+
+       return crypt_wipe_device(cd, crypt_metadata_device(cd), CRYPT_WIPE_RANDOM,
+                                offset, length, wipe_block, NULL, NULL);
+}
+
+/* FIXME: what if user wanted to keep original keyslots size? */
+int LUKS2_set_keyslots_size(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               uint64_t data_offset)
+{
+       json_object *jobj_config;
+       uint64_t keyslots_size;
+
+       if (data_offset < get_min_offset(hdr))
+               return 1;
+
+       keyslots_size = data_offset - get_min_offset(hdr);
+
+       /* keep keyslots_size reasonable for custom data alignments */
+       if (keyslots_size > LUKS2_MAX_KEYSLOTS_SIZE)
+               keyslots_size = LUKS2_MAX_KEYSLOTS_SIZE;
+
+       /* keyslots size has to be 4 KiB aligned */
+       keyslots_size -= (keyslots_size % 4096);
+
+       if (!json_object_object_get_ex(hdr->jobj, "config", &jobj_config))
+               return 1;
+
+       json_object_object_add(jobj_config, "keyslots_size", crypt_jobj_new_uint64(keyslots_size));
+       return 0;
+}
diff --git a/lib/luks2/luks2_json_metadata.c b/lib/luks2/luks2_json_metadata.c
new file mode 100644 (file)
index 0000000..e346067
--- /dev/null
@@ -0,0 +1,2414 @@
+/*
+ * LUKS - Linux Unified Key Setup v2
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ * Copyright (C) 2015-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+#include "../integrity/integrity.h"
+#include <assert.h>
+#include <ctype.h>
+#include <uuid/uuid.h>
+
+#define LUKS_STRIPES 4000
+
+struct interval {
+       uint64_t offset;
+       uint64_t length;
+};
+
+void hexprint_base64(struct crypt_device *cd, json_object *jobj,
+                    const char *sep, const char *line_sep)
+{
+       char *buf = NULL;
+       size_t buf_len;
+       unsigned int i;
+
+       if (!base64_decode_alloc(json_object_get_string(jobj),
+                                json_object_get_string_len(jobj),
+                                &buf, &buf_len))
+               return;
+
+       for (i = 0; i < buf_len; i++) {
+               if (i && !(i % 16))
+                       log_std(cd, "\n\t%s", line_sep);
+               log_std(cd, "%02hhx%s", buf[i], sep);
+       }
+       log_std(cd, "\n");
+       free(buf);
+}
+
+void JSON_DBG(struct crypt_device *cd, json_object *jobj, const char *desc)
+{
+       if (desc)
+               crypt_log(cd, CRYPT_LOG_DEBUG_JSON, desc);
+       crypt_log(cd, CRYPT_LOG_DEBUG_JSON, json_object_to_json_string_ext(jobj,
+               JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE));
+}
+
+/*
+ * JSON array helpers
+ */
+struct json_object *LUKS2_array_jobj(struct json_object *array, const char *num)
+{
+       struct json_object *jobj1;
+       int i;
+
+       for (i = 0; i < (int) json_object_array_length(array); i++) {
+               jobj1 = json_object_array_get_idx(array, i);
+               if (!strcmp(num, json_object_get_string(jobj1)))
+                       return jobj1;
+       }
+
+       return NULL;
+}
+
+struct json_object *LUKS2_array_remove(struct json_object *array, const char *num)
+{
+       struct json_object *jobj1, *jobj_removing = NULL, *array_new;
+       int i;
+
+       jobj_removing = LUKS2_array_jobj(array, num);
+       if (!jobj_removing)
+               return NULL;
+
+       /* Create new array without jobj_removing. */
+       array_new = json_object_new_array();
+       for (i = 0; i < (int) json_object_array_length(array); i++) {
+               jobj1 = json_object_array_get_idx(array, i);
+               if (jobj1 != jobj_removing)
+                       json_object_array_add(array_new, json_object_get(jobj1));
+       }
+
+       return array_new;
+}
+
+/*
+ * JSON struct access helpers
+ */
+json_object *LUKS2_get_keyslot_jobj(struct luks2_hdr *hdr, int keyslot)
+{
+       json_object *jobj1, *jobj2;
+       char keyslot_name[16];
+
+       if (!hdr || keyslot < 0)
+               return NULL;
+
+       if (snprintf(keyslot_name, sizeof(keyslot_name), "%u", keyslot) < 1)
+               return NULL;
+
+       if (!json_object_object_get_ex(hdr->jobj, "keyslots", &jobj1))
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj1, keyslot_name, &jobj2))
+               return NULL;
+
+       return jobj2;
+}
+
+json_object *LUKS2_get_tokens_jobj(struct luks2_hdr *hdr)
+{
+       json_object *jobj_tokens;
+
+       if (!hdr || !json_object_object_get_ex(hdr->jobj, "tokens", &jobj_tokens))
+               return NULL;
+
+       return jobj_tokens;
+}
+
+json_object *LUKS2_get_token_jobj(struct luks2_hdr *hdr, int token)
+{
+       json_object *jobj1, *jobj2;
+       char token_name[16];
+
+       if (!hdr || token < 0)
+               return NULL;
+
+       jobj1 = LUKS2_get_tokens_jobj(hdr);
+       if (!jobj1)
+               return NULL;
+
+       if (snprintf(token_name, sizeof(token_name), "%u", token) < 1)
+               return NULL;
+
+       json_object_object_get_ex(jobj1, token_name, &jobj2);
+       return jobj2;
+}
+
+json_object *LUKS2_get_digest_jobj(struct luks2_hdr *hdr, int digest)
+{
+       json_object *jobj1, *jobj2;
+       char digest_name[16];
+
+       if (!hdr || digest < 0)
+               return NULL;
+
+       if (snprintf(digest_name, sizeof(digest_name), "%u", digest) < 1)
+               return NULL;
+
+       if (!json_object_object_get_ex(hdr->jobj, "digests", &jobj1))
+               return NULL;
+
+       json_object_object_get_ex(jobj1, digest_name, &jobj2);
+       return jobj2;
+}
+
+static json_object *json_get_segments_jobj(json_object *hdr_jobj)
+{
+       json_object *jobj_segments;
+
+       if (!hdr_jobj || !json_object_object_get_ex(hdr_jobj, "segments", &jobj_segments))
+               return NULL;
+
+       return jobj_segments;
+}
+
+json_object *LUKS2_get_segment_jobj(struct luks2_hdr *hdr, int segment)
+{
+       if (!hdr)
+               return NULL;
+
+       if (segment == CRYPT_DEFAULT_SEGMENT)
+               segment = LUKS2_get_default_segment(hdr);
+
+       return json_segments_get_segment(json_get_segments_jobj(hdr->jobj), segment);
+}
+
+json_object *LUKS2_get_segments_jobj(struct luks2_hdr *hdr)
+{
+       return hdr ? json_get_segments_jobj(hdr->jobj) : NULL;
+}
+
+int LUKS2_segments_count(struct luks2_hdr *hdr)
+{
+       if (!hdr)
+               return -EINVAL;
+
+       return json_segments_count(LUKS2_get_segments_jobj(hdr));
+}
+
+int LUKS2_get_default_segment(struct luks2_hdr *hdr)
+{
+       int s = LUKS2_get_segment_id_by_flag(hdr, "backup-final");
+       if (s >= 0)
+               return s;
+
+       if (LUKS2_segments_count(hdr) == 1)
+               return 0;
+
+       return -EINVAL;
+}
+
+/*
+ * json_type_int needs to be validated first.
+ * See validate_json_uint32()
+ */
+uint32_t crypt_jobj_get_uint32(json_object *jobj)
+{
+       return json_object_get_int64(jobj);
+}
+
+/* jobj has to be json_type_string and numbered */
+static json_bool json_str_to_uint64(json_object *jobj, uint64_t *value)
+{
+       char *endptr;
+       unsigned long long tmp;
+
+       errno = 0;
+       tmp = strtoull(json_object_get_string(jobj), &endptr, 10);
+       if (*endptr || errno) {
+               *value = 0;
+               return 0;
+       }
+
+       *value = tmp;
+       return 1;
+}
+
+uint64_t crypt_jobj_get_uint64(json_object *jobj)
+{
+       uint64_t r;
+       json_str_to_uint64(jobj, &r);
+       return r;
+}
+
+json_object *crypt_jobj_new_uint64(uint64_t value)
+{
+       /* 18446744073709551615 */
+       char num[21];
+       int r;
+       json_object *jobj;
+
+       r = snprintf(num, sizeof(num), "%" PRIu64, value);
+       if (r < 0 || (size_t)r >= sizeof(num))
+               return NULL;
+
+       jobj = json_object_new_string(num);
+       return jobj;
+}
+
+/*
+ * Validate helpers
+ */
+static json_bool numbered(struct crypt_device *cd, const char *name, const char *key)
+{
+       int i;
+
+       for (i = 0; key[i]; i++)
+               if (!isdigit(key[i])) {
+                       log_dbg(cd, "%s \"%s\" is not in numbered form.", name, key);
+                       return 0;
+               }
+       return 1;
+}
+
+json_object *json_contains(struct crypt_device *cd, json_object *jobj, const char *name,
+                          const char *section, const char *key, json_type type)
+{
+       json_object *sobj;
+
+       if (!json_object_object_get_ex(jobj, key, &sobj) ||
+           !json_object_is_type(sobj, type)) {
+               log_dbg(cd, "%s \"%s\" is missing \"%s\" (%s) specification.",
+                       section, name, key, json_type_to_name(type));
+               return NULL;
+       }
+
+       return sobj;
+}
+
+json_bool validate_json_uint32(json_object *jobj)
+{
+       int64_t tmp;
+
+       errno = 0;
+       tmp = json_object_get_int64(jobj);
+
+       return (errno || tmp < 0 || tmp > UINT32_MAX) ? 0 : 1;
+}
+
+static json_bool validate_keyslots_array(struct crypt_device *cd,
+                                        json_object *jarr, json_object *jobj_keys)
+{
+       json_object *jobj;
+       int i = 0, length = (int) json_object_array_length(jarr);
+
+       while (i < length) {
+               jobj = json_object_array_get_idx(jarr, i);
+               if (!json_object_is_type(jobj, json_type_string)) {
+                       log_dbg(cd, "Illegal value type in keyslots array at index %d.", i);
+                       return 0;
+               }
+
+               if (!json_contains(cd, jobj_keys, "", "Keyslots section",
+                                  json_object_get_string(jobj), json_type_object))
+                       return 0;
+
+               i++;
+       }
+
+       return 1;
+}
+
+static json_bool validate_segments_array(struct crypt_device *cd,
+                                        json_object *jarr, json_object *jobj_segments)
+{
+       json_object *jobj;
+       int i = 0, length = (int) json_object_array_length(jarr);
+
+       while (i < length) {
+               jobj = json_object_array_get_idx(jarr, i);
+               if (!json_object_is_type(jobj, json_type_string)) {
+                       log_dbg(cd, "Illegal value type in segments array at index %d.", i);
+                       return 0;
+               }
+
+               if (!json_contains(cd, jobj_segments, "", "Segments section",
+                                  json_object_get_string(jobj), json_type_object))
+                       return 0;
+
+               i++;
+       }
+
+       return 1;
+}
+
+static json_bool segment_has_digest(const char *segment_name, json_object *jobj_digests)
+{
+       json_object *jobj_segments;
+
+       json_object_object_foreach(jobj_digests, key, val) {
+               UNUSED(key);
+               json_object_object_get_ex(val, "segments", &jobj_segments);
+               if (LUKS2_array_jobj(jobj_segments, segment_name))
+                       return 1;
+       }
+
+       return 0;
+}
+
+static json_bool validate_intervals(struct crypt_device *cd,
+                                   int length, const struct interval *ix,
+                                   uint64_t metadata_size, uint64_t keyslots_area_end)
+{
+       int j, i = 0;
+
+       while (i < length) {
+               if (ix[i].offset < 2 * metadata_size) {
+                       log_dbg(cd, "Illegal area offset: %" PRIu64 ".", ix[i].offset);
+                       return 0;
+               }
+
+               if (!ix[i].length) {
+                       log_dbg(cd, "Area length must be greater than zero.");
+                       return 0;
+               }
+
+               if ((ix[i].offset + ix[i].length) > keyslots_area_end) {
+                       log_dbg(cd, "Area [%" PRIu64 ", %" PRIu64 "] overflows binary keyslots area (ends at offset: %" PRIu64 ").",
+                               ix[i].offset, ix[i].offset + ix[i].length, keyslots_area_end);
+                       return 0;
+               }
+
+               for (j = 0; j < length; j++) {
+                       if (i == j)
+                               continue;
+                       if ((ix[i].offset >= ix[j].offset) && (ix[i].offset < (ix[j].offset + ix[j].length))) {
+                               log_dbg(cd, "Overlapping areas [%" PRIu64 ",%" PRIu64 "] and [%" PRIu64 ",%" PRIu64 "].",
+                                       ix[i].offset, ix[i].offset + ix[i].length,
+                                       ix[j].offset, ix[j].offset + ix[j].length);
+                               return 0;
+                       }
+               }
+
+               i++;
+       }
+
+       return 1;
+}
+
+static int LUKS2_keyslot_validate(struct crypt_device *cd, json_object *hdr_jobj, json_object *hdr_keyslot, const char *key)
+{
+       json_object *jobj_key_size;
+
+       if (!json_contains(cd, hdr_keyslot, key, "Keyslot", "type", json_type_string))
+               return 1;
+       if (!(jobj_key_size = json_contains(cd, hdr_keyslot, key, "Keyslot", "key_size", json_type_int)))
+               return 1;
+
+       /* enforce uint32_t type */
+       if (!validate_json_uint32(jobj_key_size)) {
+               log_dbg(cd, "Illegal field \"key_size\":%s.",
+                       json_object_get_string(jobj_key_size));
+               return 1;
+       }
+
+       return 0;
+}
+
+int LUKS2_token_validate(struct crypt_device *cd,
+                        json_object *hdr_jobj, json_object *jobj_token, const char *key)
+{
+       json_object *jarr, *jobj_keyslots;
+
+       /* keyslots are not yet validated, but we need to know token doesn't reference missing keyslot */
+       if (!json_object_object_get_ex(hdr_jobj, "keyslots", &jobj_keyslots))
+               return 1;
+
+       if (!json_contains(cd, jobj_token, key, "Token", "type", json_type_string))
+               return 1;
+
+       jarr = json_contains(cd, jobj_token, key, "Token", "keyslots", json_type_array);
+       if (!jarr)
+               return 1;
+
+       if (!validate_keyslots_array(cd, jarr, jobj_keyslots))
+               return 1;
+
+       return 0;
+}
+
+static int hdr_validate_json_size(struct crypt_device *cd, json_object *hdr_jobj, uint64_t hdr_json_size)
+{
+       json_object *jobj, *jobj1;
+       const char *json;
+       uint64_t json_area_size, json_size;
+
+       json_object_object_get_ex(hdr_jobj, "config", &jobj);
+       json_object_object_get_ex(jobj, "json_size", &jobj1);
+
+       json = json_object_to_json_string_ext(hdr_jobj,
+               JSON_C_TO_STRING_PLAIN | JSON_C_TO_STRING_NOSLASHESCAPE);
+       json_area_size = crypt_jobj_get_uint64(jobj1);
+       json_size = (uint64_t)strlen(json);
+
+       if (hdr_json_size != json_area_size) {
+               log_dbg(cd, "JSON area size does not match value in binary header.");
+               return 1;
+       }
+
+       if (json_size > json_area_size) {
+               log_dbg(cd, "JSON does not fit in the designated area.");
+               return 1;
+       }
+
+       return 0;
+}
+
+int LUKS2_check_json_size(struct crypt_device *cd, const struct luks2_hdr *hdr)
+{
+       return hdr_validate_json_size(cd, hdr->jobj, hdr->hdr_size - LUKS2_HDR_BIN_LEN);
+}
+
+static int hdr_validate_keyslots(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       json_object *jobj;
+
+       if (!json_object_object_get_ex(hdr_jobj, "keyslots", &jobj)) {
+               log_dbg(cd, "Missing keyslots section.");
+               return 1;
+       }
+
+       json_object_object_foreach(jobj, key, val) {
+               if (!numbered(cd, "Keyslot", key))
+                       return 1;
+               if (LUKS2_keyslot_validate(cd, hdr_jobj, val, key))
+                       return 1;
+       }
+
+       return 0;
+}
+
+static int hdr_validate_tokens(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       json_object *jobj;
+
+       if (!json_object_object_get_ex(hdr_jobj, "tokens", &jobj)) {
+               log_dbg(cd, "Missing tokens section.");
+               return 1;
+       }
+
+       json_object_object_foreach(jobj, key, val) {
+               if (!numbered(cd, "Token", key))
+                       return 1;
+               if (LUKS2_token_validate(cd, hdr_jobj, val, key))
+                       return 1;
+       }
+
+       return 0;
+}
+
+static int hdr_validate_crypt_segment(struct crypt_device *cd,
+                                     json_object *jobj, const char *key, json_object *jobj_digests,
+       uint64_t offset, uint64_t size)
+{
+       json_object *jobj_ivoffset, *jobj_sector_size, *jobj_integrity;
+       uint32_t sector_size;
+       uint64_t ivoffset;
+
+       if (!(jobj_ivoffset = json_contains(cd, jobj, key, "Segment", "iv_tweak", json_type_string)) ||
+           !json_contains(cd, jobj, key, "Segment", "encryption", json_type_string) ||
+           !(jobj_sector_size = json_contains(cd, jobj, key, "Segment", "sector_size", json_type_int)))
+               return 1;
+
+       /* integrity */
+       if (json_object_object_get_ex(jobj, "integrity", &jobj_integrity)) {
+               if (!json_contains(cd, jobj, key, "Segment", "integrity", json_type_object) ||
+                   !json_contains(cd, jobj_integrity, key, "Segment integrity", "type", json_type_string) ||
+                   !json_contains(cd, jobj_integrity, key, "Segment integrity", "journal_encryption", json_type_string) ||
+                   !json_contains(cd, jobj_integrity, key, "Segment integrity", "journal_integrity", json_type_string))
+                       return 1;
+       }
+
+       /* enforce uint32_t type */
+       if (!validate_json_uint32(jobj_sector_size)) {
+               log_dbg(cd, "Illegal field \"sector_size\":%s.",
+                       json_object_get_string(jobj_sector_size));
+               return 1;
+       }
+
+       sector_size = crypt_jobj_get_uint32(jobj_sector_size);
+       if (!sector_size || MISALIGNED_512(sector_size)) {
+               log_dbg(cd, "Illegal sector size: %" PRIu32, sector_size);
+               return 1;
+       }
+
+       if (!numbered(cd, "iv_tweak", json_object_get_string(jobj_ivoffset)) ||
+           !json_str_to_uint64(jobj_ivoffset, &ivoffset)) {
+               log_dbg(cd, "Illegal iv_tweak value.");
+               return 1;
+       }
+
+       if (size % sector_size) {
+               log_dbg(cd, "Size field has to be aligned to sector size: %" PRIu32, sector_size);
+               return 1;
+       }
+
+       return !segment_has_digest(key, jobj_digests);
+}
+
+static bool validate_segment_intervals(struct crypt_device *cd,
+                                   int length, const struct interval *ix)
+{
+       int j, i = 0;
+
+       while (i < length) {
+               if (ix[i].length == UINT64_MAX && (i != (length - 1))) {
+                       log_dbg(cd, "Only last regular segment is allowed to have 'dynamic' size.");
+                       return false;
+               }
+
+               for (j = 0; j < length; j++) {
+                       if (i == j)
+                               continue;
+                       if ((ix[i].offset >= ix[j].offset) && (ix[j].length == UINT64_MAX || (ix[i].offset < (ix[j].offset + ix[j].length)))) {
+                               log_dbg(cd, "Overlapping segments [%" PRIu64 ",%" PRIu64 "]%s and [%" PRIu64 ",%" PRIu64 "]%s.",
+                                       ix[i].offset, ix[i].offset + ix[i].length, ix[i].length == UINT64_MAX ? "(dynamic)" : "",
+                                       ix[j].offset, ix[j].offset + ix[j].length, ix[j].length == UINT64_MAX ? "(dynamic)" : "");
+                               return false;
+                       }
+               }
+
+               i++;
+       }
+
+       return true;
+}
+
+static int hdr_validate_segments(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       json_object *jobj_segments, *jobj_digests, *jobj_offset, *jobj_size, *jobj_type, *jobj_flags, *jobj;
+       struct interval *intervals;
+       uint64_t offset, size;
+       int i, r, count, first_backup = -1;
+
+       if (!json_object_object_get_ex(hdr_jobj, "segments", &jobj_segments)) {
+               log_dbg(cd, "Missing segments section.");
+               return 1;
+       }
+
+       count = json_object_object_length(jobj_segments);
+       if (count < 1) {
+               log_dbg(cd, "Empty segments section.");
+               return 1;
+       }
+
+       /* digests should already be validated */
+       if (!json_object_object_get_ex(hdr_jobj, "digests", &jobj_digests))
+               return 1;
+
+       json_object_object_foreach(jobj_segments, key, val) {
+               if (!numbered(cd, "Segment", key))
+                       return 1;
+
+               /* those fields are mandatory for all segment types */
+               if (!(jobj_type =   json_contains(cd, val, key, "Segment", "type",   json_type_string)) ||
+                   !(jobj_offset = json_contains(cd, val, key, "Segment", "offset", json_type_string)) ||
+                   !(jobj_size =   json_contains(cd, val, key, "Segment", "size",   json_type_string)))
+                       return 1;
+
+               if (!numbered(cd, "offset", json_object_get_string(jobj_offset)) ||
+                   !json_str_to_uint64(jobj_offset, &offset))
+                       return 1;
+
+               /* size "dynamic" means whole device starting at 'offset' */
+               if (strcmp(json_object_get_string(jobj_size), "dynamic")) {
+                       if (!numbered(cd, "size", json_object_get_string(jobj_size)) ||
+                           !json_str_to_uint64(jobj_size, &size) || !size)
+                               return 1;
+               } else
+                       size = 0;
+
+               /* all device-mapper devices are aligned to 512 sector size */
+               if (MISALIGNED_512(offset)) {
+                       log_dbg(cd, "Offset field has to be aligned to sector size: %" PRIu32, SECTOR_SIZE);
+                       return 1;
+               }
+               if (MISALIGNED_512(size)) {
+                       log_dbg(cd, "Size field has to be aligned to sector size: %" PRIu32, SECTOR_SIZE);
+                       return 1;
+               }
+
+               /* flags array is optional and must contain strings */
+               if (json_object_object_get_ex(val, "flags", NULL)) {
+                       if (!(jobj_flags = json_contains(cd, val, key, "Segment", "flags", json_type_array)))
+                               return 1;
+                       for (i = 0; i < (int) json_object_array_length(jobj_flags); i++)
+                               if (!json_object_is_type(json_object_array_get_idx(jobj_flags, i), json_type_string))
+                                       return 1;
+               }
+
+               i = atoi(key);
+               if (json_segment_is_backup(val)) {
+                       if (first_backup < 0 || i < first_backup)
+                               first_backup = i;
+               } else {
+                       if ((first_backup >= 0) && i >= first_backup) {
+                               log_dbg(cd, "Regular segment at %d is behind backup segment at %d", i, first_backup);
+                               return 1;
+                       }
+               }
+
+               /* crypt */
+               if (!strcmp(json_object_get_string(jobj_type), "crypt") &&
+                   hdr_validate_crypt_segment(cd, val, key, jobj_digests, offset, size))
+                       return 1;
+       }
+
+       if (first_backup == 0) {
+               log_dbg(cd, "No regular segment.");
+               return 1;
+       }
+
+       if (first_backup < 0)
+               first_backup = count;
+
+       intervals = malloc(first_backup * sizeof(*intervals));
+       if (!intervals) {
+               log_dbg(cd, "Not enough memory.");
+               return 1;
+       }
+
+       for (i = 0; i < first_backup; i++) {
+               jobj = json_segments_get_segment(jobj_segments, i);
+               if (!jobj) {
+                       log_dbg(cd, "Gap at key %d in segments object.", i);
+                       free(intervals);
+                       return 1;
+               }
+               intervals[i].offset = json_segment_get_offset(jobj, 0);
+               intervals[i].length = json_segment_get_size(jobj, 0) ?: UINT64_MAX;
+       }
+
+       r = !validate_segment_intervals(cd, first_backup, intervals);
+       free(intervals);
+
+       if (r)
+               return 1;
+
+       for (; i < count; i++) {
+               if (!json_segments_get_segment(jobj_segments, i)) {
+                       log_dbg(cd, "Gap at key %d in segments object.", i);
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+
+uint64_t LUKS2_metadata_size(json_object *jobj)
+{
+       json_object *jobj1, *jobj2;
+       uint64_t json_size;
+
+       json_object_object_get_ex(jobj, "config", &jobj1);
+       json_object_object_get_ex(jobj1, "json_size", &jobj2);
+       json_str_to_uint64(jobj2, &json_size);
+
+       return json_size + LUKS2_HDR_BIN_LEN;
+}
+
+static int hdr_validate_areas(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       struct interval *intervals;
+       json_object *jobj_keyslots, *jobj_offset, *jobj_length, *jobj_segments, *jobj_area;
+       int length, ret, i = 0;
+       uint64_t metadata_size;
+
+       if (!json_object_object_get_ex(hdr_jobj, "keyslots", &jobj_keyslots))
+               return 1;
+
+       /* segments are already validated */
+       if (!json_object_object_get_ex(hdr_jobj, "segments", &jobj_segments))
+               return 1;
+
+       /* config is already validated */
+       metadata_size = LUKS2_metadata_size(hdr_jobj);
+
+       length = json_object_object_length(jobj_keyslots);
+
+       /* Empty section */
+       if (length == 0)
+               return 0;
+
+       if (length < 0) {
+               log_dbg(cd, "Invalid keyslot areas specification.");
+               return 1;
+       }
+
+       intervals = malloc(length * sizeof(*intervals));
+       if (!intervals) {
+               log_dbg(cd, "Not enough memory.");
+               return -ENOMEM;
+       }
+
+       json_object_object_foreach(jobj_keyslots, key, val) {
+
+               if (!(jobj_area = json_contains(cd, val, key, "Keyslot", "area", json_type_object)) ||
+                   !json_contains(cd, jobj_area, key, "Keyslot area", "type", json_type_string) ||
+                   !(jobj_offset = json_contains(cd, jobj_area, key, "Keyslot", "offset", json_type_string)) ||
+                   !(jobj_length = json_contains(cd, jobj_area, key, "Keyslot", "size", json_type_string)) ||
+                   !numbered(cd, "offset", json_object_get_string(jobj_offset)) ||
+                   !numbered(cd, "size", json_object_get_string(jobj_length))) {
+                       free(intervals);
+                       return 1;
+               }
+
+               /* rule out values > UINT64_MAX */
+               if (!json_str_to_uint64(jobj_offset, &intervals[i].offset) ||
+                   !json_str_to_uint64(jobj_length, &intervals[i].length)) {
+                       free(intervals);
+                       return 1;
+               }
+
+               i++;
+       }
+
+       if (length != i) {
+               free(intervals);
+               return 1;
+       }
+
+       ret = validate_intervals(cd, length, intervals, metadata_size, LUKS2_hdr_and_areas_size(hdr_jobj)) ? 0 : 1;
+
+       free(intervals);
+
+       return ret;
+}
+
+static int hdr_validate_digests(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       json_object *jarr_keys, *jarr_segs, *jobj, *jobj_keyslots, *jobj_segments;
+
+       if (!json_object_object_get_ex(hdr_jobj, "digests", &jobj)) {
+               log_dbg(cd, "Missing digests section.");
+               return 1;
+       }
+
+       /* keyslots are not yet validated, but we need to know digest doesn't reference missing keyslot */
+       if (!json_object_object_get_ex(hdr_jobj, "keyslots", &jobj_keyslots))
+               return 1;
+
+       /* segments are not yet validated, but we need to know digest doesn't reference missing segment */
+       if (!json_object_object_get_ex(hdr_jobj, "segments", &jobj_segments))
+               return 1;
+
+       json_object_object_foreach(jobj, key, val) {
+               if (!numbered(cd, "Digest", key))
+                       return 1;
+
+               if (!json_contains(cd, val, key, "Digest", "type", json_type_string) ||
+                   !(jarr_keys = json_contains(cd, val, key, "Digest", "keyslots", json_type_array)) ||
+                   !(jarr_segs = json_contains(cd, val, key, "Digest", "segments", json_type_array)))
+                       return 1;
+
+               if (!validate_keyslots_array(cd, jarr_keys, jobj_keyslots))
+                       return 1;
+               if (!validate_segments_array(cd, jarr_segs, jobj_segments))
+                       return 1;
+       }
+
+       return 0;
+}
+
+static int hdr_validate_config(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       json_object *jobj_config, *jobj, *jobj1;
+       int i;
+       uint64_t keyslots_size, metadata_size, segment_offset;
+
+       if (!json_object_object_get_ex(hdr_jobj, "config", &jobj_config)) {
+               log_dbg(cd, "Missing config section.");
+               return 1;
+       }
+
+       if (!(jobj = json_contains(cd, jobj_config, "section", "Config", "json_size", json_type_string)) ||
+           !json_str_to_uint64(jobj, &metadata_size))
+               return 1;
+
+       /* single metadata instance is assembled from json area size plus
+        * binary header size */
+       metadata_size += LUKS2_HDR_BIN_LEN;
+
+       if (!(jobj = json_contains(cd, jobj_config, "section", "Config", "keyslots_size", json_type_string)) ||
+           !json_str_to_uint64(jobj, &keyslots_size))
+               return 1;
+
+       if (LUKS2_check_metadata_area_size(metadata_size)) {
+               log_dbg(cd, "Unsupported LUKS2 header size (%" PRIu64 ").", metadata_size);
+               return 1;
+       }
+
+       if (LUKS2_check_keyslots_area_size(keyslots_size)) {
+               log_dbg(cd, "Unsupported LUKS2 keyslots size (%" PRIu64 ").", keyslots_size);
+               return 1;
+       }
+
+       /*
+        * validate keyslots_size fits in between (2 * metadata_size) and first
+        * segment_offset (except detached header)
+        */
+       segment_offset = json_segments_get_minimal_offset(json_get_segments_jobj(hdr_jobj), 0);
+       if (segment_offset &&
+           (segment_offset < keyslots_size ||
+            (segment_offset - keyslots_size) < (2 * metadata_size))) {
+               log_dbg(cd, "keyslots_size is too large %" PRIu64 " (bytes). Data offset: %" PRIu64
+                       ", keyslots offset: %" PRIu64, keyslots_size, segment_offset, 2 * metadata_size);
+               return 1;
+       }
+
+       /* Flags array is optional */
+       if (json_object_object_get_ex(jobj_config, "flags", &jobj)) {
+               if (!json_contains(cd, jobj_config, "section", "Config", "flags", json_type_array))
+                       return 1;
+
+               /* All array members must be strings */
+               for (i = 0; i < (int) json_object_array_length(jobj); i++)
+                       if (!json_object_is_type(json_object_array_get_idx(jobj, i), json_type_string))
+                               return 1;
+       }
+
+       /* Requirements object is optional */
+       if (json_object_object_get_ex(jobj_config, "requirements", &jobj)) {
+               if (!json_contains(cd, jobj_config, "section", "Config", "requirements", json_type_object))
+                       return 1;
+
+               /* Mandatory array is optional */
+               if (json_object_object_get_ex(jobj, "mandatory", &jobj1)) {
+                       if (!json_contains(cd, jobj, "section", "Requirements", "mandatory", json_type_array))
+                               return 1;
+
+                       /* All array members must be strings */
+                       for (i = 0; i < (int) json_object_array_length(jobj1); i++)
+                               if (!json_object_is_type(json_object_array_get_idx(jobj1, i), json_type_string))
+                                       return 1;
+               }
+       }
+
+       return 0;
+}
+
+int LUKS2_hdr_validate(struct crypt_device *cd, json_object *hdr_jobj, uint64_t json_size)
+{
+       struct {
+               int (*validate)(struct crypt_device *, json_object *);
+       } checks[] = {
+               { hdr_validate_tokens   },
+               { hdr_validate_digests  },
+               { hdr_validate_segments },
+               { hdr_validate_keyslots },
+               { hdr_validate_config   },
+               { hdr_validate_areas    },
+               { NULL }
+       };
+       int i;
+
+       if (!hdr_jobj)
+               return 1;
+
+       for (i = 0; checks[i].validate; i++)
+               if (checks[i].validate && checks[i].validate(cd, hdr_jobj))
+                       return 1;
+
+       if (hdr_validate_json_size(cd, hdr_jobj, json_size))
+               return 1;
+
+       /* validate keyslot implementations */
+       if (LUKS2_keyslots_validate(cd, hdr_jobj))
+               return 1;
+
+       return 0;
+}
+
+/* FIXME: should we expose do_recovery parameter explicitly? */
+int LUKS2_hdr_read(struct crypt_device *cd, struct luks2_hdr *hdr, int repair)
+{
+       int r;
+
+       r = device_read_lock(cd, crypt_metadata_device(cd));
+       if (r) {
+               log_err(cd, _("Failed to acquire read lock on device %s."),
+                       device_path(crypt_metadata_device(cd)));
+               return r;
+       }
+
+       r = LUKS2_disk_hdr_read(cd, hdr, crypt_metadata_device(cd), 1, !repair);
+       if (r == -EAGAIN) {
+               /* unlikely: auto-recovery is required and failed due to read lock being held */
+               device_read_unlock(cd, crypt_metadata_device(cd));
+
+               /* Do not use LUKS2_device_write lock. Recovery. */
+               r = device_write_lock(cd, crypt_metadata_device(cd));
+               if (r < 0) {
+                       log_err(cd, _("Failed to acquire write lock on device %s."),
+                               device_path(crypt_metadata_device(cd)));
+                       return r;
+               }
+
+               r = LUKS2_disk_hdr_read(cd, hdr, crypt_metadata_device(cd), 1, !repair);
+
+               device_write_unlock(cd, crypt_metadata_device(cd));
+       } else
+               device_read_unlock(cd, crypt_metadata_device(cd));
+
+       return r;
+}
+
+static int hdr_cleanup_and_validate(struct crypt_device *cd, struct luks2_hdr *hdr)
+{
+       LUKS2_digests_erase_unused(cd, hdr);
+
+       return LUKS2_hdr_validate(cd, hdr->jobj, hdr->hdr_size - LUKS2_HDR_BIN_LEN);
+}
+
+int LUKS2_hdr_write_force(struct crypt_device *cd, struct luks2_hdr *hdr)
+{
+       if (hdr_cleanup_and_validate(cd, hdr))
+               return -EINVAL;
+
+       return LUKS2_disk_hdr_write(cd, hdr, crypt_metadata_device(cd), false);
+}
+
+int LUKS2_hdr_write(struct crypt_device *cd, struct luks2_hdr *hdr)
+{
+       if (hdr_cleanup_and_validate(cd, hdr))
+               return -EINVAL;
+
+       return LUKS2_disk_hdr_write(cd, hdr, crypt_metadata_device(cd), true);
+}
+
+int LUKS2_hdr_uuid(struct crypt_device *cd, struct luks2_hdr *hdr, const char *uuid)
+{
+       uuid_t partitionUuid;
+
+       if (uuid && uuid_parse(uuid, partitionUuid) == -1) {
+               log_err(cd, _("Wrong LUKS UUID format provided."));
+               return -EINVAL;
+       }
+       if (!uuid)
+               uuid_generate(partitionUuid);
+
+       uuid_unparse(partitionUuid, hdr->uuid);
+
+       return LUKS2_hdr_write(cd, hdr);
+}
+
+int LUKS2_hdr_labels(struct crypt_device *cd, struct luks2_hdr *hdr,
+                    const char *label, const char *subsystem, int commit)
+{
+       //FIXME: check if the labels are the same and skip this.
+
+       memset(hdr->label, 0, LUKS2_LABEL_L);
+       if (label)
+               strncpy(hdr->label, label, LUKS2_LABEL_L-1);
+
+       memset(hdr->subsystem, 0, LUKS2_LABEL_L);
+       if (subsystem)
+               strncpy(hdr->subsystem, subsystem, LUKS2_LABEL_L-1);
+
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+}
+
+void LUKS2_hdr_free(struct crypt_device *cd, struct luks2_hdr *hdr)
+{
+       if (json_object_put(hdr->jobj))
+               hdr->jobj = NULL;
+       else if (hdr->jobj)
+               log_dbg(cd, "LUKS2 header still in use");
+}
+
+uint64_t LUKS2_keyslots_size(json_object *jobj)
+{
+       json_object *jobj1, *jobj2;
+       uint64_t keyslots_size;
+
+       json_object_object_get_ex(jobj, "config", &jobj1);
+       json_object_object_get_ex(jobj1, "keyslots_size", &jobj2);
+       json_str_to_uint64(jobj2, &keyslots_size);
+
+       return keyslots_size;
+}
+
+uint64_t LUKS2_hdr_and_areas_size(json_object *jobj)
+{
+       return 2 * LUKS2_metadata_size(jobj) + LUKS2_keyslots_size(jobj);
+}
+
+int LUKS2_hdr_backup(struct crypt_device *cd, struct luks2_hdr *hdr,
+                    const char *backup_file)
+{
+       struct device *device = crypt_metadata_device(cd);
+       int fd, devfd, r = 0;
+       ssize_t hdr_size;
+       ssize_t ret, buffer_size;
+       char *buffer = NULL;
+
+       hdr_size = LUKS2_hdr_and_areas_size(hdr->jobj);
+       buffer_size = size_round_up(hdr_size, crypt_getpagesize());
+
+       buffer = crypt_safe_alloc(buffer_size);
+       if (!buffer)
+               return -ENOMEM;
+
+       log_dbg(cd, "Storing backup of header (%zu bytes).", hdr_size);
+       log_dbg(cd, "Output backup file size: %zu bytes.", buffer_size);
+
+       r = device_read_lock(cd, device);
+       if (r) {
+               log_err(cd, _("Failed to acquire read lock on device %s."),
+                       device_path(crypt_metadata_device(cd)));
+               crypt_safe_free(buffer);
+               return r;
+       }
+
+       devfd = device_open_locked(cd, device, O_RDONLY);
+       if (devfd < 0) {
+               device_read_unlock(cd, device);
+               log_err(cd, _("Device %s is not a valid LUKS device."), device_path(device));
+               crypt_safe_free(buffer);
+               return devfd == -1 ? -EINVAL : devfd;
+       }
+
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                          device_alignment(device), buffer, hdr_size, 0) < hdr_size) {
+               device_read_unlock(cd, device);
+               crypt_safe_free(buffer);
+               return -EIO;
+       }
+
+       device_read_unlock(cd, device);
+
+       fd = open(backup_file, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR);
+       if (fd == -1) {
+               if (errno == EEXIST)
+                       log_err(cd, _("Requested header backup file %s already exists."), backup_file);
+               else
+                       log_err(cd, _("Cannot create header backup file %s."), backup_file);
+               crypt_safe_free(buffer);
+               return -EINVAL;
+       }
+       ret = write_buffer(fd, buffer, buffer_size);
+       close(fd);
+       if (ret < buffer_size) {
+               log_err(cd, _("Cannot write header backup file %s."), backup_file);
+               r = -EIO;
+       } else
+               r = 0;
+
+       crypt_safe_free(buffer);
+       return r;
+}
+
+static int reqs_unknown(uint32_t reqs)
+{
+       return reqs & CRYPT_REQUIREMENT_UNKNOWN;
+}
+
+static int reqs_reencrypt(uint32_t reqs)
+{
+       return reqs & CRYPT_REQUIREMENT_OFFLINE_REENCRYPT;
+}
+
+static int reqs_reencrypt_online(uint32_t reqs)
+{
+       return reqs & CRYPT_REQUIREMENT_ONLINE_REENCRYPT;
+}
+
+int LUKS2_hdr_restore(struct crypt_device *cd, struct luks2_hdr *hdr,
+                    const char *backup_file)
+{
+       struct device *backup_device, *device = crypt_metadata_device(cd);
+       int r, fd, devfd = -1, diff_uuid = 0;
+       ssize_t ret, buffer_size = 0;
+       char *buffer = NULL, msg[1024];
+       struct luks2_hdr hdr_file;
+       struct luks2_hdr tmp_hdr = {};
+       uint32_t reqs = 0;
+
+       r = device_alloc(cd, &backup_device, backup_file);
+       if (r < 0)
+               return r;
+
+       r = device_read_lock(cd, backup_device);
+       if (r) {
+               log_err(cd, _("Failed to acquire read lock on device %s."),
+                       device_path(backup_device));
+               device_free(cd, backup_device);
+               return r;
+       }
+
+       r = LUKS2_disk_hdr_read(cd, &hdr_file, backup_device, 0, 0);
+       device_read_unlock(cd, backup_device);
+       device_free(cd, backup_device);
+
+       if (r < 0) {
+               log_err(cd, _("Backup file does not contain valid LUKS header."));
+               goto out;
+       }
+
+       /* do not allow header restore from backup with unmet requirements */
+       if (LUKS2_unmet_requirements(cd, &hdr_file, CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 1)) {
+               log_err(cd, _("Forbidden LUKS2 requirements detected in backup %s."),
+                       backup_file);
+               r = -ETXTBSY;
+               goto out;
+       }
+
+       buffer_size = LUKS2_hdr_and_areas_size(hdr_file.jobj);
+       buffer = crypt_safe_alloc(buffer_size);
+       if (!buffer) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       fd = open(backup_file, O_RDONLY);
+       if (fd == -1) {
+               log_err(cd, _("Cannot open header backup file %s."), backup_file);
+               r = -EINVAL;
+               goto out;
+       }
+
+       ret = read_buffer(fd, buffer, buffer_size);
+       close(fd);
+       if (ret < buffer_size) {
+               log_err(cd, _("Cannot read header backup file %s."), backup_file);
+               r = -EIO;
+               goto out;
+       }
+
+       r = LUKS2_hdr_read(cd, &tmp_hdr, 0);
+       if (r == 0) {
+               log_dbg(cd, "Device %s already contains LUKS2 header, checking UUID and requirements.", device_path(device));
+               r = LUKS2_config_get_requirements(cd, &tmp_hdr, &reqs);
+               if (r)
+                       goto out;
+
+               if (memcmp(tmp_hdr.uuid, hdr_file.uuid, LUKS2_UUID_L))
+                       diff_uuid = 1;
+
+               if (!reqs_reencrypt(reqs)) {
+                       log_dbg(cd, "Checking LUKS2 header size and offsets.");
+                       if (LUKS2_get_data_offset(&tmp_hdr) != LUKS2_get_data_offset(&hdr_file)) {
+                               log_err(cd, _("Data offset differ on device and backup, restore failed."));
+                               r = -EINVAL;
+                               goto out;
+                       }
+                       /* FIXME: what could go wrong? Erase if we're fine with consequences */
+                       if (buffer_size != (ssize_t) LUKS2_hdr_and_areas_size(tmp_hdr.jobj)) {
+                               log_err(cd, _("Binary header with keyslot areas size differ on device and backup, restore failed."));
+                               r = -EINVAL;
+                               goto out;
+                       }
+               }
+       }
+
+       r = snprintf(msg, sizeof(msg), _("Device %s %s%s%s%s"), device_path(device),
+                    r ? _("does not contain LUKS2 header. Replacing header can destroy data on that device.") :
+                        _("already contains LUKS2 header. Replacing header will destroy existing keyslots."),
+                    diff_uuid ? _("\nWARNING: real device header has different UUID than backup!") : "",
+                    reqs_unknown(reqs) ? _("\nWARNING: unknown LUKS2 requirements detected in real device header!"
+                                           "\nReplacing header with backup may corrupt the data on that device!") : "",
+                    reqs_reencrypt(reqs) ? _("\nWARNING: Unfinished offline reencryption detected on the device!"
+                                             "\nReplacing header with backup may corrupt data.") : "");
+       if (r < 0 || (size_t) r >= sizeof(msg)) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       if (!crypt_confirm(cd, msg)) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       log_dbg(cd, "Storing backup of header (%zu bytes) to device %s.", buffer_size, device_path(device));
+
+       /* Do not use LUKS2_device_write lock for checking sequence id on restore */
+       r = device_write_lock(cd, device);
+       if (r < 0) {
+               log_err(cd, _("Failed to acquire write lock on device %s."),
+                       device_path(device));
+               goto out;
+       }
+
+       devfd = device_open_locked(cd, device, O_RDWR);
+       if (devfd < 0) {
+               if (errno == EACCES)
+                       log_err(cd, _("Cannot write to device %s, permission denied."),
+                               device_path(device));
+               else
+                       log_err(cd, _("Cannot open device %s."), device_path(device));
+               device_write_unlock(cd, device);
+               r = -EINVAL;
+               goto out;
+       }
+
+       if (write_lseek_blockwise(devfd, device_block_size(cd, device),
+                           device_alignment(device), buffer, buffer_size, 0) < buffer_size)
+               r = -EIO;
+       else
+               r = 0;
+
+       device_write_unlock(cd, device);
+out:
+       LUKS2_hdr_free(cd, hdr);
+       LUKS2_hdr_free(cd, &hdr_file);
+       LUKS2_hdr_free(cd, &tmp_hdr);
+       crypt_safe_memzero(&hdr_file, sizeof(hdr_file));
+       crypt_safe_memzero(&tmp_hdr, sizeof(tmp_hdr));
+       crypt_safe_free(buffer);
+
+       device_sync(cd, device);
+
+       return r;
+}
+
+/*
+ * Persistent config flags
+ */
+static const struct  {
+       uint32_t flag;
+       const char *description;
+} persistent_flags[] = {
+       { CRYPT_ACTIVATE_ALLOW_DISCARDS,         "allow-discards" },
+       { CRYPT_ACTIVATE_SAME_CPU_CRYPT,         "same-cpu-crypt" },
+       { CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS, "submit-from-crypt-cpus" },
+       { CRYPT_ACTIVATE_NO_JOURNAL,             "no-journal" },
+       { 0, NULL }
+};
+
+int LUKS2_config_get_flags(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t *flags)
+{
+       json_object *jobj1, *jobj_config, *jobj_flags;
+       int i, j, found;
+
+       if (!hdr || !flags)
+               return -EINVAL;
+
+       *flags = 0;
+
+       if (!json_object_object_get_ex(hdr->jobj, "config", &jobj_config))
+               return 0;
+
+       if (!json_object_object_get_ex(jobj_config, "flags", &jobj_flags))
+               return 0;
+
+       for (i = 0; i < (int) json_object_array_length(jobj_flags); i++) {
+               jobj1 = json_object_array_get_idx(jobj_flags, i);
+               found = 0;
+               for (j = 0; persistent_flags[j].description && !found; j++)
+                       if (!strcmp(persistent_flags[j].description,
+                                   json_object_get_string(jobj1))) {
+                               *flags |= persistent_flags[j].flag;
+                               log_dbg(cd, "Using persistent flag %s.",
+                                       json_object_get_string(jobj1));
+                               found = 1;
+                       }
+               if (!found)
+                       log_verbose(cd, _("Ignored unknown flag %s."),
+                                   json_object_get_string(jobj1));
+       }
+
+       return 0;
+}
+
+int LUKS2_config_set_flags(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t flags)
+{
+       json_object *jobj_config, *jobj_flags;
+       int i;
+
+       if (!json_object_object_get_ex(hdr->jobj, "config", &jobj_config))
+               return 0;
+
+       jobj_flags = json_object_new_array();
+
+       for (i = 0; persistent_flags[i].description; i++) {
+               if (flags & persistent_flags[i].flag) {
+                       log_dbg(cd, "Setting persistent flag: %s.", persistent_flags[i].description);
+                       json_object_array_add(jobj_flags,
+                               json_object_new_string(persistent_flags[i].description));
+               }
+       }
+
+       /* Replace or add new flags array */
+       json_object_object_add(jobj_config, "flags", jobj_flags);
+
+       return LUKS2_hdr_write(cd, hdr);
+}
+
+/*
+ * json format example (mandatory array must not be ignored,
+ * all other future fields may be added later)
+ *
+ * "requirements": {
+ *       mandatory : [],
+ *       optional0 : [],
+ *       optional1 : "lala"
+ * }
+ */
+
+/* LUKS2 library requirements */
+static const struct  {
+       uint32_t flag;
+       const char *description;
+} requirements_flags[] = {
+       { CRYPT_REQUIREMENT_OFFLINE_REENCRYPT, "offline-reencrypt" },
+       { CRYPT_REQUIREMENT_ONLINE_REENCRYPT, "online-reencrypt" },
+       { 0, NULL }
+};
+
+static uint32_t get_requirement_by_name(const char *requirement)
+{
+       int i;
+
+       for (i = 0; requirements_flags[i].description; i++)
+               if (!strcmp(requirement, requirements_flags[i].description))
+                       return requirements_flags[i].flag;
+
+       return CRYPT_REQUIREMENT_UNKNOWN;
+}
+
+/*
+ * returns count of requirements (past cryptsetup 2.0 release)
+ */
+int LUKS2_config_get_requirements(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t *reqs)
+{
+       json_object *jobj_config, *jobj_requirements, *jobj_mandatory, *jobj;
+       int i, len;
+       uint32_t req;
+
+       assert(hdr);
+       if (!hdr || !reqs)
+               return -EINVAL;
+
+       *reqs = 0;
+
+       if (!json_object_object_get_ex(hdr->jobj, "config", &jobj_config))
+               return 0;
+
+       if (!json_object_object_get_ex(jobj_config, "requirements", &jobj_requirements))
+               return 0;
+
+       if (!json_object_object_get_ex(jobj_requirements, "mandatory", &jobj_mandatory))
+               return 0;
+
+       len = (int) json_object_array_length(jobj_mandatory);
+       if (len <= 0)
+               return 0;
+
+       log_dbg(cd, "LUKS2 requirements detected:");
+
+       for (i = 0; i < len; i++) {
+               jobj = json_object_array_get_idx(jobj_mandatory, i);
+               req = get_requirement_by_name(json_object_get_string(jobj));
+               log_dbg(cd, "%s - %sknown", json_object_get_string(jobj),
+                                       reqs_unknown(req) ? "un" : "");
+               *reqs |= req;
+       }
+
+       return 0;
+}
+
+int LUKS2_config_set_requirements(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t reqs, bool commit)
+{
+       json_object *jobj_config, *jobj_requirements, *jobj_mandatory, *jobj;
+       int i, r = -EINVAL;
+
+       if (!hdr)
+               return -EINVAL;
+
+       jobj_mandatory = json_object_new_array();
+       if (!jobj_mandatory)
+               return -ENOMEM;
+
+       for (i = 0; requirements_flags[i].description; i++) {
+               if (reqs & requirements_flags[i].flag) {
+                       jobj = json_object_new_string(requirements_flags[i].description);
+                       if (!jobj) {
+                               r = -ENOMEM;
+                               goto err;
+                       }
+                       json_object_array_add(jobj_mandatory, jobj);
+                       /* erase processed flag from input set */
+                       reqs &= ~(requirements_flags[i].flag);
+               }
+       }
+
+       /* any remaining bit in requirements is unknown therefore illegal */
+       if (reqs) {
+               log_dbg(cd, "Illegal requirement flag(s) requested");
+               goto err;
+       }
+
+       if (!json_object_object_get_ex(hdr->jobj, "config", &jobj_config))
+               goto err;
+
+       if (!json_object_object_get_ex(jobj_config, "requirements", &jobj_requirements)) {
+               jobj_requirements = json_object_new_object();
+               if (!jobj_requirements) {
+                       r = -ENOMEM;
+                       goto err;
+               }
+               json_object_object_add(jobj_config, "requirements", jobj_requirements);
+       }
+
+       if (json_object_array_length(jobj_mandatory) > 0) {
+               /* replace mandatory field with new values */
+               json_object_object_add(jobj_requirements, "mandatory", jobj_mandatory);
+       } else {
+               /* new mandatory field was empty, delete old one */
+               json_object_object_del(jobj_requirements, "mandatory");
+               json_object_put(jobj_mandatory);
+       }
+
+       /* remove empty requirements object */
+       if (!json_object_object_length(jobj_requirements))
+               json_object_object_del(jobj_config, "requirements");
+
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+err:
+       json_object_put(jobj_mandatory);
+       return r;
+}
+
+/*
+ * Header dump
+ */
+static void hdr_dump_config(struct crypt_device *cd, json_object *hdr_jobj)
+{
+
+       json_object *jobj1, *jobj_config, *jobj_flags, *jobj_requirements, *jobj_mandatory;
+       int i = 0, flags = 0, reqs = 0;
+
+       log_std(cd, "Flags:       \t");
+
+       if (json_object_object_get_ex(hdr_jobj, "config", &jobj_config)) {
+               if (json_object_object_get_ex(jobj_config, "flags", &jobj_flags))
+                       flags = (int) json_object_array_length(jobj_flags);
+               if (json_object_object_get_ex(jobj_config, "requirements", &jobj_requirements) &&
+                   json_object_object_get_ex(jobj_requirements, "mandatory", &jobj_mandatory))
+                       reqs = (int) json_object_array_length(jobj_mandatory);
+       }
+
+       for (i = 0; i < flags; i++) {
+               jobj1 = json_object_array_get_idx(jobj_flags, i);
+               log_std(cd, "%s ", json_object_get_string(jobj1));
+       }
+
+       log_std(cd, "%s\n%s", flags > 0 ? "" : "(no flags)", reqs > 0 ? "" : "\n");
+
+       if (reqs > 0) {
+               log_std(cd, "Requirements:\t");
+               for (i = 0; i < reqs; i++) {
+                       jobj1 = json_object_array_get_idx(jobj_mandatory, i);
+                       log_std(cd, "%s ", json_object_get_string(jobj1));
+               }
+               log_std(cd, "\n\n");
+       }
+}
+
+static const char *get_priority_desc(json_object *jobj)
+{
+       crypt_keyslot_priority priority;
+       json_object *jobj_priority;
+       const char *text;
+
+       if (json_object_object_get_ex(jobj, "priority", &jobj_priority))
+               priority = (crypt_keyslot_priority)(int)json_object_get_int(jobj_priority);
+       else
+               priority = CRYPT_SLOT_PRIORITY_NORMAL;
+
+       switch (priority) {
+               case CRYPT_SLOT_PRIORITY_IGNORE: text = "ignored"; break;
+               case CRYPT_SLOT_PRIORITY_PREFER: text = "preferred"; break;
+               case CRYPT_SLOT_PRIORITY_NORMAL: text = "normal"; break;
+               default: text = "invalid";
+       }
+
+       return text;
+}
+
+static void hdr_dump_keyslots(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       char slot[16];
+       json_object *keyslots_jobj, *digests_jobj, *jobj2, *jobj3, *val;
+       const char *tmps;
+       int i, j, r;
+
+       log_std(cd, "Keyslots:\n");
+       json_object_object_get_ex(hdr_jobj, "keyslots", &keyslots_jobj);
+
+       for (j = 0; j < LUKS2_KEYSLOTS_MAX; j++) {
+               (void) snprintf(slot, sizeof(slot), "%i", j);
+               json_object_object_get_ex(keyslots_jobj, slot, &val);
+               if (!val)
+                       continue;
+
+               json_object_object_get_ex(val, "type", &jobj2);
+               tmps = json_object_get_string(jobj2);
+
+               r = LUKS2_keyslot_for_segment(crypt_get_hdr(cd, CRYPT_LUKS2), j, CRYPT_ONE_SEGMENT);
+               log_std(cd, "  %s: %s%s\n", slot, tmps, r == -ENOENT ? " (unbound)" : "");
+
+               if (json_object_object_get_ex(val, "key_size", &jobj2))
+                       log_std(cd, "\tKey:        %u bits\n", crypt_jobj_get_uint32(jobj2) * 8);
+
+               log_std(cd, "\tPriority:   %s\n", get_priority_desc(val));
+
+               LUKS2_keyslot_dump(cd, j);
+
+               json_object_object_get_ex(hdr_jobj, "digests", &digests_jobj);
+               json_object_object_foreach(digests_jobj, key2, val2) {
+                       json_object_object_get_ex(val2, "keyslots", &jobj2);
+                       for (i = 0; i < (int) json_object_array_length(jobj2); i++) {
+                               jobj3 = json_object_array_get_idx(jobj2, i);
+                               if (!strcmp(slot, json_object_get_string(jobj3))) {
+                                       log_std(cd, "\tDigest ID:  %s\n", key2);
+                               }
+                       }
+               }
+       }
+}
+
+static void hdr_dump_tokens(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       char token[16];
+       json_object *tokens_jobj, *jobj2, *jobj3, *val;
+       const char *tmps;
+       int i, j;
+
+       log_std(cd, "Tokens:\n");
+       json_object_object_get_ex(hdr_jobj, "tokens", &tokens_jobj);
+
+       for (j = 0; j < LUKS2_TOKENS_MAX; j++) {
+               (void) snprintf(token, sizeof(token), "%i", j);
+               json_object_object_get_ex(tokens_jobj, token, &val);
+               if (!val)
+                       continue;
+
+               json_object_object_get_ex(val, "type", &jobj2);
+               tmps = json_object_get_string(jobj2);
+               log_std(cd, "  %s: %s\n", token, tmps);
+
+               LUKS2_token_dump(cd, j);
+
+               json_object_object_get_ex(val, "keyslots", &jobj2);
+               for (i = 0; i < (int) json_object_array_length(jobj2); i++) {
+                       jobj3 = json_object_array_get_idx(jobj2, i);
+                       log_std(cd, "\tKeyslot:  %s\n", json_object_get_string(jobj3));
+               }
+       }
+}
+
+static void hdr_dump_segments(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       char segment[16];
+       json_object *jobj_segments, *jobj_segment, *jobj1, *jobj2;
+       int i, j, flags;
+       uint64_t value;
+
+       log_std(cd, "Data segments:\n");
+       json_object_object_get_ex(hdr_jobj, "segments", &jobj_segments);
+
+       for (i = 0; i < LUKS2_SEGMENT_MAX; i++) {
+               (void) snprintf(segment, sizeof(segment), "%i", i);
+               if (!json_object_object_get_ex(jobj_segments, segment, &jobj_segment))
+                       continue;
+
+               json_object_object_get_ex(jobj_segment, "type", &jobj1);
+               log_std(cd, "  %s: %s\n", segment, json_object_get_string(jobj1));
+
+               json_object_object_get_ex(jobj_segment, "offset", &jobj1);
+               json_str_to_uint64(jobj1, &value);
+               log_std(cd, "\toffset: %" PRIu64 " [bytes]\n", value);
+
+               json_object_object_get_ex(jobj_segment, "size", &jobj1);
+               if (!(strcmp(json_object_get_string(jobj1), "dynamic")))
+                       log_std(cd, "\tlength: (whole device)\n");
+               else {
+                       json_str_to_uint64(jobj1, &value);
+                       log_std(cd, "\tlength: %" PRIu64 " [bytes]\n", value);
+               }
+
+               if (json_object_object_get_ex(jobj_segment, "encryption", &jobj1))
+                       log_std(cd, "\tcipher: %s\n", json_object_get_string(jobj1));
+
+               if (json_object_object_get_ex(jobj_segment, "sector_size", &jobj1))
+                       log_std(cd, "\tsector: %" PRIu32 " [bytes]\n", crypt_jobj_get_uint32(jobj1));
+
+               if (json_object_object_get_ex(jobj_segment, "integrity", &jobj1) &&
+                   json_object_object_get_ex(jobj1, "type", &jobj2))
+                       log_std(cd, "\tintegrity: %s\n", json_object_get_string(jobj2));
+
+               if (json_object_object_get_ex(jobj_segment, "flags", &jobj1) &&
+                   (flags = (int)json_object_array_length(jobj1)) > 0) {
+                       jobj2 = json_object_array_get_idx(jobj1, 0);
+                       log_std(cd, "\tflags : %s", json_object_get_string(jobj2));
+                       for (j = 1; j < flags; j++) {
+                               jobj2 = json_object_array_get_idx(jobj1, j);
+                               log_std(cd, ", %s", json_object_get_string(jobj2));
+                       }
+                       log_std(cd, "\n");
+               }
+
+               log_std(cd, "\n");
+       }
+}
+
+static void hdr_dump_digests(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       char key[16];
+       json_object *jobj1, *jobj2, *val;
+       const char *tmps;
+       int i;
+
+       log_std(cd, "Digests:\n");
+       json_object_object_get_ex(hdr_jobj, "digests", &jobj1);
+
+       for (i = 0; i < LUKS2_DIGEST_MAX; i++) {
+               (void) snprintf(key, sizeof(key), "%i", i);
+               json_object_object_get_ex(jobj1, key, &val);
+               if (!val)
+                       continue;
+
+               json_object_object_get_ex(val, "type", &jobj2);
+               tmps = json_object_get_string(jobj2);
+               log_std(cd, "  %s: %s\n", key, tmps);
+
+               LUKS2_digest_dump(cd, i);
+       }
+}
+
+int LUKS2_hdr_dump(struct crypt_device *cd, struct luks2_hdr *hdr)
+{
+       if (!hdr->jobj)
+               return -EINVAL;
+
+       JSON_DBG(cd, hdr->jobj, NULL);
+
+       log_std(cd, "LUKS header information\n");
+       log_std(cd, "Version:       \t%u\n", hdr->version);
+       log_std(cd, "Epoch:         \t%" PRIu64 "\n", hdr->seqid);
+       log_std(cd, "Metadata area: \t%" PRIu64 " [bytes]\n", LUKS2_metadata_size(hdr->jobj));
+       log_std(cd, "Keyslots area: \t%" PRIu64 " [bytes]\n", LUKS2_keyslots_size(hdr->jobj));
+       log_std(cd, "UUID:          \t%s\n", *hdr->uuid ? hdr->uuid : "(no UUID)");
+       log_std(cd, "Label:         \t%s\n", *hdr->label ? hdr->label : "(no label)");
+       log_std(cd, "Subsystem:     \t%s\n", *hdr->subsystem ? hdr->subsystem : "(no subsystem)");
+
+       hdr_dump_config(cd, hdr->jobj);
+       hdr_dump_segments(cd, hdr->jobj);
+       hdr_dump_keyslots(cd, hdr->jobj);
+       hdr_dump_tokens(cd, hdr->jobj);
+       hdr_dump_digests(cd, hdr->jobj);
+
+       return 0;
+}
+
+int LUKS2_get_data_size(struct luks2_hdr *hdr, uint64_t *size, bool *dynamic)
+{
+       int sector_size;
+       json_object *jobj_segments, *jobj_size;
+       uint64_t tmp = 0;
+
+       if (!size || !json_object_object_get_ex(hdr->jobj, "segments", &jobj_segments))
+               return -EINVAL;
+
+       json_object_object_foreach(jobj_segments, key, val) {
+               UNUSED(key);
+               if (json_segment_is_backup(val))
+                       continue;
+
+               json_object_object_get_ex(val, "size", &jobj_size);
+               if (!strcmp(json_object_get_string(jobj_size), "dynamic")) {
+                       sector_size = json_segment_get_sector_size(val);
+                       /* last dynamic segment must have at least one sector in size */
+                       if (tmp)
+                               *size = tmp + (sector_size > 0 ? sector_size : SECTOR_SIZE);
+                       else
+                               *size = 0;
+                       if (dynamic)
+                               *dynamic = true;
+                       return 0;
+               }
+
+               tmp += crypt_jobj_get_uint64(jobj_size);
+       }
+
+       /* impossible, real device size must not be zero */
+       if (!tmp)
+               return -EINVAL;
+
+       *size = tmp;
+       if (dynamic)
+               *dynamic = false;
+       return 0;
+}
+
+uint64_t LUKS2_get_data_offset(struct luks2_hdr *hdr)
+{
+       crypt_reencrypt_info ri;
+       json_object *jobj;
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri == CRYPT_REENCRYPT_CLEAN || ri == CRYPT_REENCRYPT_CRASH) {
+               jobj = LUKS2_get_segment_by_flag(hdr, "backup-final");
+               if (jobj)
+                       return json_segment_get_offset(jobj, 1);
+       }
+
+       return json_segments_get_minimal_offset(LUKS2_get_segments_jobj(hdr), 1);
+}
+
+const char *LUKS2_get_cipher(struct luks2_hdr *hdr, int segment)
+{
+       json_object *jobj_segment;
+
+       if (!hdr)
+               return NULL;
+
+       if (segment == CRYPT_DEFAULT_SEGMENT)
+               segment = LUKS2_get_default_segment(hdr);
+
+       jobj_segment = json_segments_get_segment(json_get_segments_jobj(hdr->jobj), segment);
+       if (!jobj_segment)
+               return NULL;
+
+       /* FIXME: default encryption (for other segment types) must be string here. */
+       return json_segment_get_cipher(jobj_segment) ?: "null";
+}
+
+crypt_reencrypt_info LUKS2_reenc_status(struct luks2_hdr *hdr)
+{
+       uint32_t reqs;
+
+       /*
+        * Any unknown requirement or offline reencryption should abort
+        * anything related to online-reencryption handling
+        */
+       if (LUKS2_config_get_requirements(NULL, hdr, &reqs))
+               return CRYPT_REENCRYPT_INVALID;
+
+       if (!reqs_reencrypt_online(reqs))
+               return CRYPT_REENCRYPT_NONE;
+
+       if (json_segments_segment_in_reencrypt(LUKS2_get_segments_jobj(hdr)) < 0)
+               return CRYPT_REENCRYPT_CLEAN;
+
+       return CRYPT_REENCRYPT_CRASH;
+}
+
+const char *LUKS2_get_keyslot_cipher(struct luks2_hdr *hdr, int keyslot, size_t *key_size)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj1;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return NULL;
+
+       /* currently we only support raw length preserving area encryption */
+       json_object_object_get_ex(jobj_area, "type", &jobj1);
+       if (strcmp(json_object_get_string(jobj1), "raw"))
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj_area, "key_size", &jobj1))
+               return NULL;
+       *key_size = json_object_get_int(jobj1);
+
+       if (!json_object_object_get_ex(jobj_area, "encryption", &jobj1))
+               return NULL;
+
+       return json_object_get_string(jobj1);
+}
+
+const char *LUKS2_get_integrity(struct luks2_hdr *hdr, int segment)
+{
+       json_object *jobj1, *jobj2, *jobj3;
+
+       jobj1 = LUKS2_get_segment_jobj(hdr, segment);
+       if (!jobj1)
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj1, "integrity", &jobj2))
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj2, "type", &jobj3))
+               return NULL;
+
+       return json_object_get_string(jobj3);
+}
+
+/* FIXME: this only ensures that once we have journal encryption, it is not ignored. */
+/* implement segment count and type restrictions (crypt and only single crypt) */
+static int LUKS2_integrity_compatible(struct luks2_hdr *hdr)
+{
+       json_object *jobj1, *jobj2, *jobj3, *jobj4;
+       const char *str;
+
+       if (!json_object_object_get_ex(hdr->jobj, "segments", &jobj1))
+               return 0;
+
+       if (!(jobj2 = LUKS2_get_segment_jobj(hdr, CRYPT_DEFAULT_SEGMENT)))
+               return 0;
+
+       if (!json_object_object_get_ex(jobj2, "integrity", &jobj3))
+               return 0;
+
+       if (!json_object_object_get_ex(jobj3, "journal_encryption", &jobj4) ||
+           !(str = json_object_get_string(jobj4)) ||
+           strcmp(str, "none"))
+               return 0;
+
+       if (!json_object_object_get_ex(jobj3, "journal_integrity", &jobj4) ||
+           !(str = json_object_get_string(jobj4)) ||
+           strcmp(str, "none"))
+               return 0;
+
+       return 1;
+}
+
+static int LUKS2_keyslot_get_volume_key_size(struct luks2_hdr *hdr, const char *keyslot)
+{
+       json_object *jobj1, *jobj2, *jobj3;
+
+       if (!json_object_object_get_ex(hdr->jobj, "keyslots", &jobj1))
+               return -1;
+
+       if (!json_object_object_get_ex(jobj1, keyslot, &jobj2))
+               return -1;
+
+       if (!json_object_object_get_ex(jobj2, "key_size", &jobj3))
+               return -1;
+
+       return json_object_get_int(jobj3);
+}
+
+/* Key size used for encryption of keyslot */
+int LUKS2_get_keyslot_stored_key_size(struct luks2_hdr *hdr, int keyslot)
+{
+       char keyslot_name[16];
+
+       if (snprintf(keyslot_name, sizeof(keyslot_name), "%u", keyslot) < 1)
+               return -1;
+
+       return LUKS2_keyslot_get_volume_key_size(hdr, keyslot_name);
+}
+
+int LUKS2_get_volume_key_size(struct luks2_hdr *hdr, int segment)
+{
+       json_object *jobj_digests, *jobj_digest_segments, *jobj_digest_keyslots, *jobj1;
+       char buf[16];
+
+       if (segment == CRYPT_DEFAULT_SEGMENT)
+               segment = LUKS2_get_default_segment(hdr);
+
+       if (snprintf(buf, sizeof(buf), "%u", segment) < 1)
+               return -1;
+
+       json_object_object_get_ex(hdr->jobj, "digests", &jobj_digests);
+
+       json_object_object_foreach(jobj_digests, key, val) {
+               UNUSED(key);
+               json_object_object_get_ex(val, "segments", &jobj_digest_segments);
+               json_object_object_get_ex(val, "keyslots", &jobj_digest_keyslots);
+
+               if (!LUKS2_array_jobj(jobj_digest_segments, buf))
+                       continue;
+               if (json_object_array_length(jobj_digest_keyslots) <= 0)
+                       continue;
+
+               jobj1 = json_object_array_get_idx(jobj_digest_keyslots, 0);
+
+               return LUKS2_keyslot_get_volume_key_size(hdr, json_object_get_string(jobj1));
+       }
+
+       return -1;
+}
+
+int LUKS2_get_sector_size(struct luks2_hdr *hdr)
+{
+       json_object *jobj_segment;
+
+       jobj_segment = LUKS2_get_segment_jobj(hdr, CRYPT_DEFAULT_SEGMENT);
+       if (!jobj_segment)
+               return SECTOR_SIZE;
+
+       return json_segment_get_sector_size(jobj_segment) ?: SECTOR_SIZE;
+}
+
+int LUKS2_assembly_multisegment_dmd(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct volume_key *vks,
+       json_object *jobj_segments,
+       struct crypt_dm_active_device *dmd)
+{
+       struct volume_key *vk;
+       json_object *jobj;
+       enum devcheck device_check;
+       int r;
+       unsigned s = 0;
+       uint64_t data_offset, segment_size, segment_offset, segment_start = 0;
+       struct dm_target *t = &dmd->segment;
+
+       if (dmd->flags & CRYPT_ACTIVATE_SHARED)
+               device_check = DEV_OK;
+       else
+               device_check = DEV_EXCL;
+
+       data_offset = LUKS2_reencrypt_data_offset(hdr, true);
+
+       r = device_block_adjust(cd, crypt_data_device(cd), device_check,
+                                                       data_offset, &dmd->size, &dmd->flags);
+       if (r)
+               return r;
+
+       r = dm_targets_allocate(&dmd->segment, json_segments_count(jobj_segments));
+       if (r)
+               goto err;
+
+       r = -EINVAL;
+
+       while (t) {
+               jobj = json_segments_get_segment(jobj_segments, s);
+               if (!jobj) {
+                       log_dbg(cd, "Internal error. Segment %u is null.", s);
+                       r = -EINVAL;
+                       goto err;
+               }
+
+               segment_offset = json_segment_get_offset(jobj, 1);
+               segment_size = json_segment_get_size(jobj, 1);
+               /* 'dynamic' length allowed in last segment only */
+               if (!segment_size && !t->next)
+                       segment_size = dmd->size - segment_start;
+               if (!segment_size) {
+                       log_dbg(cd, "Internal error. Wrong segment size %u", s);
+                       r = -EINVAL;
+                       goto err;
+               }
+
+               if (!strcmp(json_segment_type(jobj), "crypt")) {
+                       vk = crypt_volume_key_by_id(vks, LUKS2_digest_by_segment(hdr, s));
+                       if (!vk) {
+                               log_err(cd, _("Missing key for dm-crypt segment %u"), s);
+                               r = -EINVAL;
+                               goto err;
+                       }
+
+                       r = dm_crypt_target_set(t, segment_start, segment_size,
+                                       crypt_data_device(cd), vk,
+                                       json_segment_get_cipher(jobj),
+                                       json_segment_get_iv_offset(jobj),
+                                       segment_offset, "none", 0,
+                                       json_segment_get_sector_size(jobj));
+                       if (r) {
+                               log_err(cd, _("Failed to set dm-crypt segment."));
+                               goto err;
+                       }
+               } else if (!strcmp(json_segment_type(jobj), "linear")) {
+                       r = dm_linear_target_set(t, segment_start, segment_size, crypt_data_device(cd), segment_offset);
+                       if (r) {
+                               log_err(cd, _("Failed to set dm-linear segment."));
+                               goto err;
+                       }
+               } else {
+                       r = -EINVAL;
+                       goto err;
+               }
+
+               segment_start += segment_size;
+               t = t->next;
+               s++;
+       }
+
+       return r;
+err:
+       dm_targets_free(cd, dmd);
+       return r;
+}
+
+/* FIXME: This shares almost all code with activate_multi_custom */
+static int _reload_custom_multi(struct crypt_device *cd,
+       const char *name,
+       struct volume_key *vks,
+       json_object *jobj_segments,
+       uint64_t device_size,
+       uint32_t flags)
+{
+       int r;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+       struct crypt_dm_active_device dmd =  {
+               .uuid   = crypt_get_uuid(cd),
+               .size = device_size >> SECTOR_SHIFT
+       };
+
+       /* do not allow activation when particular requirements detected */
+       if ((r = LUKS2_unmet_requirements(cd, hdr, CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0)))
+               return r;
+
+       /* Add persistent activation flags */
+       if (!(flags & CRYPT_ACTIVATE_IGNORE_PERSISTENT))
+               LUKS2_config_get_flags(cd, hdr, &dmd.flags);
+
+       dmd.flags |= (flags | CRYPT_ACTIVATE_SHARED);
+
+       r = LUKS2_assembly_multisegment_dmd(cd, hdr, vks, jobj_segments, &dmd);
+       if (!r)
+               r = dm_reload_device(cd, name, &dmd, 0, 0);
+
+       dm_targets_free(cd, &dmd);
+       return r;
+}
+
+int LUKS2_reload(struct crypt_device *cd,
+       const char *name,
+       struct volume_key *vks,
+       uint64_t device_size,
+       uint32_t flags)
+{
+       if (crypt_get_integrity_tag_size(cd))
+               return -ENOTSUP;
+
+       return _reload_custom_multi(cd, name, vks,
+                       LUKS2_get_segments_jobj(crypt_get_hdr(cd, CRYPT_LUKS2)), device_size, flags);
+}
+
+int LUKS2_activate_multi(struct crypt_device *cd,
+       const char *name,
+       struct volume_key *vks,
+       uint64_t device_size,
+       uint32_t flags)
+{
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+       json_object *jobj_segments = LUKS2_get_segments_jobj(hdr);
+       int r;
+       struct crypt_dm_active_device dmd = {
+               .size   = device_size,
+               .uuid   = crypt_get_uuid(cd)
+       };
+
+       /* do not allow activation when particular requirements detected */
+       if ((r = LUKS2_unmet_requirements(cd, hdr, CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0)))
+               return r;
+
+       /* Add persistent activation flags */
+       if (!(flags & CRYPT_ACTIVATE_IGNORE_PERSISTENT))
+               LUKS2_config_get_flags(cd, hdr, &dmd.flags);
+
+       dmd.flags |= flags;
+
+       r = LUKS2_assembly_multisegment_dmd(cd, hdr, vks, jobj_segments, &dmd);
+       if (!r)
+               r = dm_create_device(cd, name, CRYPT_LUKS2, &dmd);
+
+       dm_targets_free(cd, &dmd);
+       return r;
+}
+
+int LUKS2_activate(struct crypt_device *cd,
+       const char *name,
+       struct volume_key *vk,
+       uint32_t flags)
+{
+       int r;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+       struct crypt_dm_active_device dmdi = {}, dmd = {
+               .uuid   = crypt_get_uuid(cd)
+       };
+
+       /* do not allow activation when particular requirements detected */
+       if ((r = LUKS2_unmet_requirements(cd, hdr, 0, 0)))
+               return r;
+
+       r = dm_crypt_target_set(&dmd.segment, 0, dmd.size, crypt_data_device(cd),
+                       vk, crypt_get_cipher_spec(cd), crypt_get_iv_offset(cd),
+                       crypt_get_data_offset(cd), crypt_get_integrity(cd) ?: "none",
+                       crypt_get_integrity_tag_size(cd), crypt_get_sector_size(cd));
+       if (r < 0)
+               return r;
+
+       /* Add persistent activation flags */
+       if (!(flags & CRYPT_ACTIVATE_IGNORE_PERSISTENT))
+               LUKS2_config_get_flags(cd, hdr, &dmd.flags);
+
+       dmd.flags |= flags;
+
+       if (crypt_get_integrity_tag_size(cd)) {
+               if (!LUKS2_integrity_compatible(hdr)) {
+                       log_err(cd, _("Unsupported device integrity configuration."));
+                       return -EINVAL;
+               }
+
+               if (dmd.flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) {
+                       log_err(cd, _("Discard/TRIM is not supported."));
+                       return -EINVAL;
+               }
+
+               r = INTEGRITY_create_dmd_device(cd, NULL, NULL, NULL, NULL, &dmdi, dmd.flags, 0);
+               if (r)
+                       return r;
+
+               dmdi.flags |= CRYPT_ACTIVATE_PRIVATE;
+               dmdi.uuid = dmd.uuid;
+               dmd.segment.u.crypt.offset = 0;
+               dmd.segment.size = dmdi.segment.size;
+
+               r = create_or_reload_device_with_integrity(cd, name, CRYPT_LUKS2, &dmd, &dmdi);
+       } else
+               r = create_or_reload_device(cd, name, CRYPT_LUKS2, &dmd);
+
+       dm_targets_free(cd, &dmd);
+       dm_targets_free(cd, &dmdi);
+
+       return r;
+}
+
+static bool is_reencryption_helper(const char *name)
+{
+       size_t len;
+
+       if (!name)
+               return false;
+
+       len = strlen(name);
+       return (len >= 9 && (!strncmp(name + len - 8, "-hotzone-", 9) ||
+                            !strcmp(name + len - 8, "-overlay")));
+
+}
+
+static bool contains_reencryption_helper(char **names)
+{
+       while (*names) {
+               if (is_reencryption_helper(*names++))
+                       return true;
+       }
+
+       return false;
+}
+
+int LUKS2_deactivate(struct crypt_device *cd, const char *name, struct luks2_hdr *hdr, struct crypt_dm_active_device *dmd, uint32_t flags)
+{
+       int r, ret;
+       struct dm_target *tgt;
+       crypt_status_info ci;
+       struct crypt_dm_active_device dmdc;
+       char **dep, deps_uuid_prefix[40], *deps[MAX_DM_DEPS+1] = { 0 };
+       const char *namei = NULL;
+       struct crypt_lock_handle *reencrypt_lock = NULL;
+
+       if (!dmd || !dmd->uuid || strncmp(CRYPT_LUKS2, dmd->uuid, sizeof(CRYPT_LUKS2)-1))
+               return -EINVAL;
+
+       /* uuid mismatch with metadata (if available) */
+       if (hdr && crypt_uuid_cmp(dmd->uuid, hdr->uuid))
+               return -EINVAL;
+
+       r = snprintf(deps_uuid_prefix, sizeof(deps_uuid_prefix), CRYPT_SUBDEV "-%.32s", dmd->uuid + 6);
+       if (r < 0 || (size_t)r != (sizeof(deps_uuid_prefix) - 1))
+               return -EINVAL;
+
+       tgt = &dmd->segment;
+
+       /* TODO: We have LUKS2 dependencies now */
+       if (hdr && single_segment(dmd) && tgt->type == DM_CRYPT && crypt_get_integrity_tag_size(cd))
+               namei = device_dm_name(tgt->data_device);
+
+       r = dm_device_deps(cd, name, deps_uuid_prefix, deps, ARRAY_SIZE(deps));
+       if (r < 0)
+               goto out;
+
+       if (contains_reencryption_helper(deps)) {
+               r = crypt_reencrypt_lock_by_dm_uuid(cd, dmd->uuid, &reencrypt_lock);
+               if (r) {
+                       if (r == -EBUSY)
+                               log_err(cd, _("Reencryption in-progress. Cannot deactivate device."));
+                       else
+                               log_err(cd, _("Failed to get reencryption lock."));
+                       goto out;
+               }
+       }
+
+       dep = deps;
+       while (*dep) {
+               if (is_reencryption_helper(*dep) && (dm_status_suspended(cd, *dep) > 0)) {
+                       if (dm_error_device(cd, *dep))
+                               log_err(cd, _("Failed to replace suspended device %s with dm-error target."), *dep);
+               }
+               dep++;
+       }
+
+       r = dm_query_device(cd, name, DM_ACTIVE_CRYPT_KEY | DM_ACTIVE_CRYPT_KEYSIZE, &dmdc);
+       if (r < 0) {
+               memset(&dmdc, 0, sizeof(dmdc));
+               dmdc.segment.type = DM_UNKNOWN;
+       }
+
+       /* Remove top level device first */
+       r = dm_remove_device(cd, name, flags);
+       if (!r) {
+               tgt = &dmdc.segment;
+               while (tgt) {
+                       if (tgt->type == DM_CRYPT)
+                               crypt_drop_keyring_key_by_description(cd, tgt->u.crypt.vk->key_description, LOGON_KEY);
+                       tgt = tgt->next;
+               }
+       }
+       dm_targets_free(cd, &dmdc);
+
+       /* TODO: We have LUKS2 dependencies now */
+       if (r >= 0 && namei) {
+               log_dbg(cd, "Deactivating integrity device %s.", namei);
+               r = dm_remove_device(cd, namei, 0);
+       }
+
+       if (!r) {
+               ret = 0;
+               dep = deps;
+               while (*dep) {
+                       log_dbg(cd, "Deactivating LUKS2 dependent device %s.", *dep);
+                       r = dm_query_device(cd, *dep, DM_ACTIVE_CRYPT_KEY | DM_ACTIVE_CRYPT_KEYSIZE, &dmdc);
+                       if (r < 0) {
+                               memset(&dmdc, 0, sizeof(dmdc));
+                               dmdc.segment.type = DM_UNKNOWN;
+                       }
+
+                       r = dm_remove_device(cd, *dep, flags);
+                       if (r < 0) {
+                               ci = crypt_status(cd, *dep);
+                               if (ci == CRYPT_BUSY)
+                                       log_err(cd, _("Device %s is still in use."), *dep);
+                               if (ci == CRYPT_INACTIVE)
+                                       r = 0;
+                       }
+                       if (!r) {
+                               tgt = &dmdc.segment;
+                               while (tgt) {
+                                       if (tgt->type == DM_CRYPT)
+                                               crypt_drop_keyring_key_by_description(cd, tgt->u.crypt.vk->key_description, LOGON_KEY);
+                                       tgt = tgt->next;
+                               }
+                       }
+                       dm_targets_free(cd, &dmdc);
+                       if (r && !ret)
+                               ret = r;
+                       dep++;
+               }
+               r = ret;
+       }
+
+out:
+       crypt_reencrypt_unlock(cd, reencrypt_lock);
+       dep = deps;
+       while (*dep)
+               free(*dep++);
+
+       return r;
+}
+
+int LUKS2_unmet_requirements(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t reqs_mask, int quiet)
+{
+       uint32_t reqs;
+       int r = LUKS2_config_get_requirements(cd, hdr, &reqs);
+
+       if (r) {
+               if (!quiet)
+                       log_err(cd, _("Failed to read LUKS2 requirements."));
+               return r;
+       }
+
+       /* do not mask unknown requirements check */
+       if (reqs_unknown(reqs)) {
+               if (!quiet)
+                       log_err(cd, _("Unmet LUKS2 requirements detected."));
+               return -ETXTBSY;
+       }
+
+       /* mask out permitted requirements */
+       reqs &= ~reqs_mask;
+
+       if (reqs_reencrypt(reqs) && !quiet)
+               log_err(cd, _("Operation incompatible with device marked for legacy reencryption. Aborting."));
+       if (reqs_reencrypt_online(reqs) && !quiet)
+               log_err(cd, _("Operation incompatible with device marked for LUKS2 reencryption. Aborting."));
+
+       /* any remaining unmasked requirement fails the check */
+       return reqs ? -EINVAL : 0;
+}
+
+/*
+ * NOTE: this routine is called on json object that failed validation.
+ *      Proceed with caution :)
+ *
+ * known glitches so far:
+ *
+ * any version < 2.0.3:
+ *  - luks2 keyslot pbkdf params change via crypt_keyslot_change_by_passphrase()
+ *    could leave previous type parameters behind. Correct this by purging
+ *    all params not needed by current type.
+ */
+void LUKS2_hdr_repair(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       json_object *jobj_keyslots;
+
+       if (!json_object_object_get_ex(hdr_jobj, "keyslots", &jobj_keyslots))
+               return;
+       if (!json_object_is_type(jobj_keyslots, json_type_object))
+               return;
+
+       LUKS2_keyslots_repair(cd, jobj_keyslots);
+}
+
+void json_object_object_del_by_uint(json_object *jobj, unsigned key)
+{
+       char key_name[16];
+
+       if (snprintf(key_name, sizeof(key_name), "%u", key) < 1)
+               return;
+       json_object_object_del(jobj, key_name);
+}
+
+int json_object_object_add_by_uint(json_object *jobj, unsigned key, json_object *jobj_val)
+{
+       char key_name[16];
+
+       if (snprintf(key_name, sizeof(key_name), "%u", key) < 1)
+               return -EINVAL;
+
+#if HAVE_DECL_JSON_OBJECT_OBJECT_ADD_EX
+       return json_object_object_add_ex(jobj, key_name, jobj_val, 0) ? -ENOMEM : 0;
+#else
+       json_object_object_add(jobj, key_name, jobj_val);
+       return 0;
+#endif
+}
+
+/* jobj_dst must contain pointer initialized to NULL (see json-c json_object_deep_copy API) */
+int json_object_copy(json_object *jobj_src, json_object **jobj_dst)
+{
+       if (!jobj_src || !jobj_dst || *jobj_dst)
+               return -1;
+
+#if HAVE_DECL_JSON_OBJECT_DEEP_COPY
+       return json_object_deep_copy(jobj_src, jobj_dst, NULL);
+#else
+       *jobj_dst = json_tokener_parse(json_object_get_string(jobj_src));
+       return *jobj_dst ? 0 : -1;
+#endif
+}
diff --git a/lib/luks2/luks2_keyslot.c b/lib/luks2/luks2_keyslot.c
new file mode 100644 (file)
index 0000000..3b8c889
--- /dev/null
@@ -0,0 +1,937 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, keyslot handling
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+
+/* Internal implementations */
+extern const keyslot_handler luks2_keyslot;
+extern const keyslot_handler reenc_keyslot;
+
+static const keyslot_handler *keyslot_handlers[LUKS2_KEYSLOTS_MAX] = {
+       &luks2_keyslot,
+       &reenc_keyslot,
+       NULL
+};
+
+static const keyslot_handler
+*LUKS2_keyslot_handler_type(struct crypt_device *cd, const char *type)
+{
+       int i;
+
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX && keyslot_handlers[i]; i++) {
+               if (!strcmp(keyslot_handlers[i]->name, type))
+                       return keyslot_handlers[i];
+       }
+
+       return NULL;
+}
+
+static const keyslot_handler
+*LUKS2_keyslot_handler(struct crypt_device *cd, int keyslot)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj1, *jobj2;
+
+       if (keyslot < 0)
+               return NULL;
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return NULL;
+
+       if (!(jobj1 = LUKS2_get_keyslot_jobj(hdr, keyslot)))
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj1, "type", &jobj2))
+               return NULL;
+
+       return LUKS2_keyslot_handler_type(cd, json_object_get_string(jobj2));
+}
+
+int LUKS2_keyslot_find_empty(struct luks2_hdr *hdr)
+{
+       int i;
+
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++)
+               if (!LUKS2_get_keyslot_jobj(hdr, i))
+                       return i;
+
+       return -EINVAL;
+}
+
+/* Check if a keyslot is assigned to specific segment */
+static int _keyslot_for_segment(struct luks2_hdr *hdr, int keyslot, int segment)
+{
+       int keyslot_digest, count = 0;
+       unsigned s;
+
+       keyslot_digest = LUKS2_digest_by_keyslot(hdr, keyslot);
+       if (keyslot_digest < 0)
+               return keyslot_digest;
+
+       if (segment >= 0)
+               return keyslot_digest == LUKS2_digest_by_segment(hdr, segment);
+
+       for (s = 0; s < json_segments_count(LUKS2_get_segments_jobj(hdr)); s++) {
+               if (keyslot_digest == LUKS2_digest_by_segment(hdr, s))
+                       count++;
+       }
+
+       return count;
+}
+
+static int _keyslot_for_digest(struct luks2_hdr *hdr, int keyslot, int digest)
+{
+       int r = -EINVAL;
+
+       r = LUKS2_digest_by_keyslot(hdr, keyslot);
+       if (r < 0)
+               return r;
+       return r == digest ? 0 : -ENOENT;
+}
+
+int LUKS2_keyslot_for_segment(struct luks2_hdr *hdr, int keyslot, int segment)
+{
+       int r = -EINVAL;
+
+       /* no need to check anything */
+       if (segment == CRYPT_ANY_SEGMENT)
+               return 0; /* ok */
+       if (segment == CRYPT_DEFAULT_SEGMENT) {
+               segment = LUKS2_get_default_segment(hdr);
+               if (segment < 0)
+                       return segment;
+       }
+
+       r = _keyslot_for_segment(hdr, keyslot, segment);
+       if (r < 0)
+               return r;
+
+       return r >= 1 ? 0 : -ENOENT;
+}
+
+/* Number of keyslots assigned to a segment or all keyslots for CRYPT_ANY_SEGMENT */
+int LUKS2_keyslot_active_count(struct luks2_hdr *hdr, int segment)
+{
+       int num = 0;
+       json_object *jobj_keyslots;
+
+       json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots);
+
+       json_object_object_foreach(jobj_keyslots, slot, val) {
+               UNUSED(val);
+               if (!LUKS2_keyslot_for_segment(hdr, atoi(slot), segment))
+                       num++;
+       }
+
+       return num;
+}
+
+int LUKS2_keyslot_cipher_incompatible(struct crypt_device *cd, const char *cipher_spec)
+{
+       char cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
+
+       if (!cipher_spec || !strcmp(cipher_spec, "null") || !strcmp(cipher_spec, "cipher_null"))
+               return 1;
+
+       if (crypt_parse_name_and_mode(cipher_spec, cipher, NULL, cipher_mode) < 0)
+               return 1;
+
+       /* Keyslot is already authenticated; we cannot use integrity tags here */
+       if (crypt_get_integrity_tag_size(cd))
+               return 1;
+
+       /* Wrapped key schemes cannot be used for keyslot encryption */
+       if (crypt_cipher_wrapped_key(cipher, cipher_mode))
+               return 1;
+
+       /* Check if crypto backend can use the cipher */
+       if (crypt_cipher_ivsize(cipher, cipher_mode) < 0)
+               return 1;
+
+       return 0;
+}
+
+int LUKS2_keyslot_params_default(struct crypt_device *cd, struct luks2_hdr *hdr,
+                                struct luks2_keyslot_params *params)
+{
+       const struct crypt_pbkdf_type *pbkdf = crypt_get_pbkdf_type(cd);
+       const char *cipher_spec;
+       size_t key_size;
+       int r;
+
+       if (!hdr || !pbkdf || !params)
+               return -EINVAL;
+
+       /*
+        * set keyslot area encryption parameters
+        */
+       params->area_type = LUKS2_KEYSLOT_AREA_RAW;
+       cipher_spec = crypt_keyslot_get_encryption(cd, CRYPT_ANY_SLOT, &key_size);
+       if (!cipher_spec || !key_size)
+               return -EINVAL;
+
+       params->area.raw.key_size = key_size;
+       r = snprintf(params->area.raw.encryption, sizeof(params->area.raw.encryption), "%s", cipher_spec);
+       if (r < 0 || (size_t)r >= sizeof(params->area.raw.encryption))
+               return -EINVAL;
+
+       /*
+        * set keyslot AF parameters
+        */
+       params->af_type = LUKS2_KEYSLOT_AF_LUKS1;
+       /* currently we use hash for AF from pbkdf settings */
+       r = snprintf(params->af.luks1.hash, sizeof(params->af.luks1.hash), "%s", pbkdf->hash ?: DEFAULT_LUKS1_HASH);
+       if (r < 0 || (size_t)r >= sizeof(params->af.luks1.hash))
+               return -EINVAL;
+       params->af.luks1.stripes = 4000;
+
+       return 0;
+}
+
+int LUKS2_keyslot_pbkdf(struct luks2_hdr *hdr, int keyslot, struct crypt_pbkdf_type *pbkdf)
+{
+       json_object *jobj_keyslot, *jobj_kdf, *jobj;
+
+       if (!hdr || !pbkdf)
+               return -EINVAL;
+
+       if (LUKS2_keyslot_info(hdr, keyslot) == CRYPT_SLOT_INVALID)
+               return -EINVAL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -ENOENT;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf))
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_kdf, "type", &jobj))
+               return -EINVAL;
+
+       memset(pbkdf, 0, sizeof(*pbkdf));
+
+       pbkdf->type = json_object_get_string(jobj);
+       if (json_object_object_get_ex(jobj_kdf, "hash", &jobj))
+               pbkdf->hash = json_object_get_string(jobj);
+       if (json_object_object_get_ex(jobj_kdf, "iterations", &jobj))
+               pbkdf->iterations = json_object_get_int(jobj);
+       if (json_object_object_get_ex(jobj_kdf, "time", &jobj))
+               pbkdf->iterations = json_object_get_int(jobj);
+       if (json_object_object_get_ex(jobj_kdf, "memory", &jobj))
+               pbkdf->max_memory_kb = json_object_get_int(jobj);
+       if (json_object_object_get_ex(jobj_kdf, "cpus", &jobj))
+               pbkdf->parallel_threads = json_object_get_int(jobj);
+
+       return 0;
+}
+
+static int LUKS2_keyslot_unbound(struct luks2_hdr *hdr, int keyslot)
+{
+       json_object *jobj_digest, *jobj_segments;
+       int digest = LUKS2_digest_by_keyslot(hdr, keyslot);
+
+       if (digest < 0)
+               return 0;
+
+       if (!(jobj_digest = LUKS2_get_digest_jobj(hdr, digest)))
+               return 0;
+
+       json_object_object_get_ex(jobj_digest, "segments", &jobj_segments);
+       if (!jobj_segments || !json_object_is_type(jobj_segments, json_type_array) ||
+           json_object_array_length(jobj_segments) == 0)
+               return 1;
+
+       return 0;
+}
+
+crypt_keyslot_info LUKS2_keyslot_info(struct luks2_hdr *hdr, int keyslot)
+{
+       if(keyslot >= LUKS2_KEYSLOTS_MAX || keyslot < 0)
+               return CRYPT_SLOT_INVALID;
+
+       if (!LUKS2_get_keyslot_jobj(hdr, keyslot))
+               return CRYPT_SLOT_INACTIVE;
+
+       if (LUKS2_digest_by_keyslot(hdr, keyslot) < 0 ||
+           LUKS2_keyslot_unbound(hdr, keyslot))
+               return CRYPT_SLOT_UNBOUND;
+
+       if (LUKS2_keyslot_active_count(hdr, CRYPT_DEFAULT_SEGMENT) == 1 &&
+           !LUKS2_keyslot_for_segment(hdr, keyslot, CRYPT_DEFAULT_SEGMENT))
+               return CRYPT_SLOT_ACTIVE_LAST;
+
+       return CRYPT_SLOT_ACTIVE;
+}
+
+int LUKS2_keyslot_area(struct luks2_hdr *hdr,
+       int keyslot,
+       uint64_t *offset,
+       uint64_t *length)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj;
+
+       if(LUKS2_keyslot_info(hdr, keyslot) == CRYPT_SLOT_INVALID)
+               return -EINVAL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -ENOENT;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_area, "offset", &jobj))
+               return -EINVAL;
+       *offset = crypt_jobj_get_uint64(jobj);
+
+       if (!json_object_object_get_ex(jobj_area, "size", &jobj))
+               return -EINVAL;
+       *length = crypt_jobj_get_uint64(jobj);
+
+       return 0;
+}
+
+static int _open_and_verify(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const keyslot_handler *h,
+       int keyslot,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vk)
+{
+       int r, key_size = LUKS2_get_keyslot_stored_key_size(hdr, keyslot);
+
+       if (key_size < 0)
+               return -EINVAL;
+
+       *vk = crypt_alloc_volume_key(key_size, NULL);
+       if (!*vk)
+               return -ENOMEM;
+
+       r = h->open(cd, keyslot, password, password_len, (*vk)->key, (*vk)->keylength);
+       if (r < 0)
+               log_dbg(cd, "Keyslot %d (%s) open failed with %d.", keyslot, h->name, r);
+       else
+               r = LUKS2_digest_verify(cd, hdr, *vk, keyslot);
+
+       if (r < 0) {
+               crypt_free_volume_key(*vk);
+               *vk = NULL;
+       }
+
+       crypt_volume_key_set_id(*vk, r);
+
+       return r < 0 ? r : keyslot;
+}
+
+static int LUKS2_open_and_verify_by_digest(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int digest,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vk)
+{
+       const keyslot_handler *h;
+       int r;
+
+       if (!(h = LUKS2_keyslot_handler(cd, keyslot)))
+               return -ENOENT;
+
+       r = h->validate(cd, LUKS2_get_keyslot_jobj(hdr, keyslot));
+       if (r) {
+               log_dbg(cd, "Keyslot %d validation failed.", keyslot);
+               return r;
+       }
+
+       r = _keyslot_for_digest(hdr, keyslot, digest);
+       if (r) {
+               if (r == -ENOENT)
+                       log_dbg(cd, "Keyslot %d unusable for digest %d.", keyslot, digest);
+               return r;
+       }
+
+       return _open_and_verify(cd, hdr, h, keyslot, password, password_len, vk);
+}
+
+static int LUKS2_open_and_verify(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int segment,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vk)
+{
+       const keyslot_handler *h;
+       int r;
+
+       if (!(h = LUKS2_keyslot_handler(cd, keyslot)))
+               return -ENOENT;
+
+       r = h->validate(cd, LUKS2_get_keyslot_jobj(hdr, keyslot));
+       if (r) {
+               log_dbg(cd, "Keyslot %d validation failed.", keyslot);
+               return r;
+       }
+
+       r = LUKS2_keyslot_for_segment(hdr, keyslot, segment);
+       if (r) {
+               if (r == -ENOENT)
+                       log_dbg(cd, "Keyslot %d unusable for segment %d.", keyslot, segment);
+               return r;
+       }
+
+       return _open_and_verify(cd, hdr, h, keyslot, password, password_len, vk);
+}
+
+static int LUKS2_keyslot_open_priority_digest(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       crypt_keyslot_priority priority,
+       const char *password,
+       size_t password_len,
+       int digest,
+       struct volume_key **vk)
+{
+       json_object *jobj_keyslots, *jobj;
+       crypt_keyslot_priority slot_priority;
+       int keyslot, r = -ENOENT;
+
+       json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots);
+
+       json_object_object_foreach(jobj_keyslots, slot, val) {
+               if (!json_object_object_get_ex(val, "priority", &jobj))
+                       slot_priority = CRYPT_SLOT_PRIORITY_NORMAL;
+               else
+                       slot_priority = json_object_get_int(jobj);
+
+               keyslot = atoi(slot);
+               if (slot_priority != priority) {
+                       log_dbg(cd, "Keyslot %d priority %d != %d (required), skipped.",
+                               keyslot, slot_priority, priority);
+                       continue;
+               }
+
+               r = LUKS2_open_and_verify_by_digest(cd, hdr, keyslot, digest, password, password_len, vk);
+
+               /* Do not retry for errors that are no -EPERM or -ENOENT,
+                  former meaning password wrong, latter key slot unusable for segment */
+               if ((r != -EPERM) && (r != -ENOENT))
+                       break;
+       }
+
+       return r;
+}
+
+static int LUKS2_keyslot_open_priority(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       crypt_keyslot_priority priority,
+       const char *password,
+       size_t password_len,
+       int segment,
+       struct volume_key **vk)
+{
+       json_object *jobj_keyslots, *jobj;
+       crypt_keyslot_priority slot_priority;
+       int keyslot, r = -ENOENT;
+
+       json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots);
+
+       json_object_object_foreach(jobj_keyslots, slot, val) {
+               if (!json_object_object_get_ex(val, "priority", &jobj))
+                       slot_priority = CRYPT_SLOT_PRIORITY_NORMAL;
+               else
+                       slot_priority = json_object_get_int(jobj);
+
+               keyslot = atoi(slot);
+               if (slot_priority != priority) {
+                       log_dbg(cd, "Keyslot %d priority %d != %d (required), skipped.",
+                               keyslot, slot_priority, priority);
+                       continue;
+               }
+
+               r = LUKS2_open_and_verify(cd, hdr, keyslot, segment, password, password_len, vk);
+
+               /* Do not retry for errors that are no -EPERM or -ENOENT,
+                  former meaning password wrong, latter key slot unusable for segment */
+               if ((r != -EPERM) && (r != -ENOENT))
+                       break;
+       }
+
+       return r;
+}
+
+static int LUKS2_keyslot_open_by_digest(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int digest,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vk)
+{
+       int r_prio, r = -EINVAL;
+
+       if (digest < 0)
+               return r;
+
+       if (keyslot == CRYPT_ANY_SLOT) {
+               r_prio = LUKS2_keyslot_open_priority_digest(cd, hdr, CRYPT_SLOT_PRIORITY_PREFER,
+                       password, password_len, digest, vk);
+               if (r_prio >= 0)
+                       r = r_prio;
+               else if (r_prio != -EPERM && r_prio != -ENOENT)
+                       r = r_prio;
+               else
+                       r = LUKS2_keyslot_open_priority_digest(cd, hdr, CRYPT_SLOT_PRIORITY_NORMAL,
+                               password, password_len, digest, vk);
+               /* Prefer password wrong to no entry from priority slot */
+               if (r_prio == -EPERM && r == -ENOENT)
+                       r = r_prio;
+       } else
+               r = LUKS2_open_and_verify_by_digest(cd, hdr, keyslot, digest, password, password_len, vk);
+
+       return r;
+}
+
+int LUKS2_keyslot_open_all_segments(struct crypt_device *cd,
+       int keyslot_old,
+       int keyslot_new,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vks)
+{
+       struct volume_key *vk = NULL;
+       int digest_old, digest_new, r = -EINVAL;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       digest_old = LUKS2_reencrypt_digest_old(hdr);
+       if (digest_old >= 0) {
+               log_dbg(cd, "Trying to unlock volume key (digest: %d) using keyslot %d.", digest_old, keyslot_old);
+               r = LUKS2_keyslot_open_by_digest(cd, hdr, keyslot_old, digest_old, password, password_len, &vk);
+               if (r < 0)
+                       goto out;
+               crypt_volume_key_add_next(vks, vk);
+       }
+
+       digest_new = LUKS2_reencrypt_digest_new(hdr);
+       if (digest_new >= 0 && digest_old != digest_new) {
+               log_dbg(cd, "Trying to unlock volume key (digest: %d) using keyslot %d.", digest_new, keyslot_new);
+               r = LUKS2_keyslot_open_by_digest(cd, hdr, keyslot_new, digest_new, password, password_len, &vk);
+               if (r < 0)
+                       goto out;
+               crypt_volume_key_add_next(vks, vk);
+       }
+out:
+       if (r < 0) {
+               crypt_free_volume_key(*vks);
+               *vks = NULL;
+
+               if (r == -ENOMEM)
+                       log_err(cd, _("Not enough available memory to open a keyslot."));
+               else if (r != -EPERM)
+                       log_err(cd, _("Keyslot open failed."));
+       }
+       return r;
+}
+
+int LUKS2_keyslot_open(struct crypt_device *cd,
+       int keyslot,
+       int segment,
+       const char *password,
+       size_t password_len,
+       struct volume_key **vk)
+{
+       struct luks2_hdr *hdr;
+       int r_prio, r = -EINVAL;
+
+       hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       if (keyslot == CRYPT_ANY_SLOT) {
+               r_prio = LUKS2_keyslot_open_priority(cd, hdr, CRYPT_SLOT_PRIORITY_PREFER,
+                       password, password_len, segment, vk);
+               if (r_prio >= 0)
+                       r = r_prio;
+               else if (r_prio != -EPERM && r_prio != -ENOENT)
+                       r = r_prio;
+               else
+                       r = LUKS2_keyslot_open_priority(cd, hdr, CRYPT_SLOT_PRIORITY_NORMAL,
+                               password, password_len, segment, vk);
+               /* Prefer password wrong to no entry from priority slot */
+               if (r_prio == -EPERM && r == -ENOENT)
+                       r = r_prio;
+       } else
+               r = LUKS2_open_and_verify(cd, hdr, keyslot, segment, password, password_len, vk);
+
+       if (r < 0) {
+               if (r == -ENOMEM)
+                       log_err(cd, _("Not enough available memory to open a keyslot."));
+               else if (r != -EPERM)
+                       log_err(cd, _("Keyslot open failed."));
+       }
+
+       return r;
+}
+
+int LUKS2_keyslot_reencrypt_create(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const struct crypt_params_reencrypt *params)
+{
+       const keyslot_handler *h;
+       int r;
+
+       if (keyslot == CRYPT_ANY_SLOT)
+               return -EINVAL;
+
+       /* FIXME: find keyslot by type */
+       h = LUKS2_keyslot_handler_type(cd, "reencrypt");
+       if (!h)
+               return -EINVAL;
+
+       r = reenc_keyslot_alloc(cd, hdr, keyslot, params);
+       if (r < 0)
+               return r;
+
+       r = LUKS2_keyslot_priority_set(cd, hdr, keyslot, CRYPT_SLOT_PRIORITY_IGNORE, 0);
+       if (r < 0)
+               return r;
+
+       r = h->validate(cd, LUKS2_get_keyslot_jobj(hdr, keyslot));
+       if (r) {
+               log_dbg(cd, "Keyslot validation failed.");
+               return r;
+       }
+
+       if (LUKS2_hdr_validate(cd, hdr->jobj, hdr->hdr_size - LUKS2_HDR_BIN_LEN))
+               return -EINVAL;
+
+       return 0;
+}
+
+int LUKS2_keyslot_reencrypt_store(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const void *buffer,
+       size_t buffer_length)
+{
+       const keyslot_handler *h;
+       int r;
+
+       if (!(h = LUKS2_keyslot_handler(cd, keyslot)) || strcmp(h->name, "reencrypt"))
+               return -EINVAL;
+
+       r = h->validate(cd, LUKS2_get_keyslot_jobj(hdr, keyslot));
+       if (r) {
+               log_dbg(cd, "Keyslot validation failed.");
+               return r;
+       }
+
+       return h->store(cd, keyslot, NULL, 0,
+                       buffer, buffer_length);
+}
+
+int LUKS2_keyslot_store(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const char *password,
+       size_t password_len,
+       const struct volume_key *vk,
+       const struct luks2_keyslot_params *params)
+{
+       const keyslot_handler *h;
+       int r;
+
+       if (keyslot == CRYPT_ANY_SLOT)
+               return -EINVAL;
+
+       if (!LUKS2_get_keyslot_jobj(hdr, keyslot)) {
+               /* Try to allocate default and empty keyslot type */
+               h = LUKS2_keyslot_handler_type(cd, "luks2");
+               if (!h)
+                       return -EINVAL;
+
+               r = h->alloc(cd, keyslot, vk->keylength, params);
+               if (r)
+                       return r;
+       } else {
+               if (!(h = LUKS2_keyslot_handler(cd, keyslot)))
+                       return -EINVAL;
+
+               r = h->update(cd, keyslot, params);
+               if (r) {
+                       log_dbg(cd, "Failed to update keyslot %d json.", keyslot);
+                       return r;
+               }
+       }
+
+       r = h->validate(cd, LUKS2_get_keyslot_jobj(hdr, keyslot));
+       if (r) {
+               log_dbg(cd, "Keyslot validation failed.");
+               return r;
+       }
+
+       if (LUKS2_hdr_validate(cd, hdr->jobj, hdr->hdr_size - LUKS2_HDR_BIN_LEN))
+               return -EINVAL;
+
+       return h->store(cd, keyslot, password, password_len,
+                       vk->key, vk->keylength);
+}
+
+int LUKS2_keyslot_wipe(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       int wipe_area_only)
+{
+       struct device *device = crypt_metadata_device(cd);
+       uint64_t area_offset, area_length;
+       int r;
+       json_object *jobj_keyslot, *jobj_keyslots;
+       const keyslot_handler *h;
+
+       h = LUKS2_keyslot_handler(cd, keyslot);
+
+       if (!json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots))
+               return -EINVAL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -ENOENT;
+
+       if (wipe_area_only)
+               log_dbg(cd, "Wiping keyslot %d area only.", keyslot);
+
+       r = LUKS2_device_write_lock(cd, hdr, device);
+       if (r)
+               return r;
+
+       /* secure deletion of possible key material in keyslot area */
+       r = crypt_keyslot_area(cd, keyslot, &area_offset, &area_length);
+       if (r && r != -ENOENT)
+               goto out;
+
+       if (!r) {
+               r = crypt_wipe_device(cd, device, CRYPT_WIPE_SPECIAL, area_offset,
+                             area_length, area_length, NULL, NULL);
+               if (r) {
+                       if (r == -EACCES) {
+                               log_err(cd, _("Cannot write to device %s, permission denied."),
+                                       device_path(device));
+                               r = -EINVAL;
+                       } else
+                               log_err(cd, _("Cannot wipe device %s."), device_path(device));
+                       goto out;
+               }
+       }
+
+       if (wipe_area_only)
+               goto out;
+
+       /* Slot specific wipe */
+       if (h) {
+               r = h->wipe(cd, keyslot);
+               if (r < 0)
+                       goto out;
+       } else
+               log_dbg(cd, "Wiping keyslot %d without specific-slot handler loaded.", keyslot);
+
+       json_object_object_del_by_uint(jobj_keyslots, keyslot);
+
+       r = LUKS2_hdr_write(cd, hdr);
+out:
+       device_write_unlock(cd, crypt_metadata_device(cd));
+       return r;
+}
+
+int LUKS2_keyslot_dump(struct crypt_device *cd, int keyslot)
+{
+       const keyslot_handler *h;
+
+       if (!(h = LUKS2_keyslot_handler(cd, keyslot)))
+               return -EINVAL;
+
+       return h->dump(cd, keyslot);
+}
+
+crypt_keyslot_priority LUKS2_keyslot_priority_get(struct crypt_device *cd,
+         struct luks2_hdr *hdr, int keyslot)
+{
+       json_object *jobj_keyslot, *jobj_priority;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return CRYPT_SLOT_PRIORITY_INVALID;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "priority", &jobj_priority))
+               return CRYPT_SLOT_PRIORITY_NORMAL;
+
+       return json_object_get_int(jobj_priority);
+}
+
+int LUKS2_keyslot_priority_set(struct crypt_device *cd, struct luks2_hdr *hdr,
+                              int keyslot, crypt_keyslot_priority priority, int commit)
+{
+       json_object *jobj_keyslot;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       if (priority == CRYPT_SLOT_PRIORITY_NORMAL)
+               json_object_object_del(jobj_keyslot, "priority");
+       else
+               json_object_object_add(jobj_keyslot, "priority", json_object_new_int(priority));
+
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+}
+
+int placeholder_keyslot_alloc(struct crypt_device *cd,
+       int keyslot,
+       uint64_t area_offset,
+       uint64_t area_length,
+       size_t volume_key_len)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj_keyslots, *jobj_keyslot, *jobj_area;
+
+       log_dbg(cd, "Allocating placeholder keyslot %d for LUKS1 down conversion.", keyslot);
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       if (keyslot < 0 || keyslot >= LUKS2_KEYSLOTS_MAX)
+               return -EINVAL;
+
+       if (LUKS2_get_keyslot_jobj(hdr, keyslot))
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots))
+               return -EINVAL;
+
+       jobj_keyslot = json_object_new_object();
+       json_object_object_add(jobj_keyslot, "type", json_object_new_string("placeholder"));
+       /*
+        * key_size = -1 makes placeholder keyslot impossible to pass validation.
+        * It's a safeguard against accidentally storing temporary conversion
+        * LUKS2 header.
+        */
+       json_object_object_add(jobj_keyslot, "key_size", json_object_new_int(-1));
+
+       /* Area object */
+       jobj_area = json_object_new_object();
+       json_object_object_add(jobj_area, "offset", crypt_jobj_new_uint64(area_offset));
+       json_object_object_add(jobj_area, "size", crypt_jobj_new_uint64(area_length));
+       json_object_object_add(jobj_keyslot, "area", jobj_area);
+
+       json_object_object_add_by_uint(jobj_keyslots, keyslot, jobj_keyslot);
+
+       return 0;
+}
+
+static unsigned LUKS2_get_keyslot_digests_count(json_object *hdr_jobj, int keyslot)
+{
+       char num[16];
+       json_object *jobj_digests, *jobj_keyslots;
+       unsigned count = 0;
+
+       if (!json_object_object_get_ex(hdr_jobj, "digests", &jobj_digests))
+               return 0;
+
+       if (snprintf(num, sizeof(num), "%u", keyslot) < 0)
+               return 0;
+
+       json_object_object_foreach(jobj_digests, key, val) {
+               UNUSED(key);
+               json_object_object_get_ex(val, "keyslots", &jobj_keyslots);
+               if (LUKS2_array_jobj(jobj_keyslots, num))
+                       count++;
+       }
+
+       return count;
+}
+
+/* run only on header that passed basic format validation */
+int LUKS2_keyslots_validate(struct crypt_device *cd, json_object *hdr_jobj)
+{
+       const keyslot_handler *h;
+       int keyslot;
+       json_object *jobj_keyslots, *jobj_type;
+
+       if (!json_object_object_get_ex(hdr_jobj, "keyslots", &jobj_keyslots))
+               return -EINVAL;
+
+       json_object_object_foreach(jobj_keyslots, slot, val) {
+               keyslot = atoi(slot);
+               json_object_object_get_ex(val, "type", &jobj_type);
+               h = LUKS2_keyslot_handler_type(cd, json_object_get_string(jobj_type));
+               if (!h)
+                       continue;
+               if (h->validate && h->validate(cd, val)) {
+                       log_dbg(cd, "Keyslot type %s validation failed on keyslot %d.", h->name, keyslot);
+                       return -EINVAL;
+               }
+
+               if (!strcmp(h->name, "luks2") && LUKS2_get_keyslot_digests_count(hdr_jobj, keyslot) != 1) {
+                       log_dbg(cd, "Keyslot %d is not assigned to exactly 1 digest.", keyslot);
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
+void LUKS2_keyslots_repair(struct crypt_device *cd, json_object *jobj_keyslots)
+{
+       const keyslot_handler *h;
+       json_object *jobj_type;
+
+       json_object_object_foreach(jobj_keyslots, slot, val) {
+               UNUSED(slot);
+               if (!json_object_is_type(val, json_type_object) ||
+                   !json_object_object_get_ex(val, "type", &jobj_type) ||
+                   !json_object_is_type(jobj_type, json_type_string))
+                       continue;
+
+               h = LUKS2_keyslot_handler_type(cd, json_object_get_string(jobj_type));
+               if (h && h->repair)
+                       h->repair(cd, val);
+       }
+}
+
+/* assumes valid header */
+int LUKS2_find_keyslot(struct luks2_hdr *hdr, const char *type)
+{
+       int i;
+       json_object *jobj_keyslot, *jobj_type;
+
+       if (!type)
+               return -EINVAL;
+
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++) {
+               jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, i);
+               if (!jobj_keyslot)
+                       continue;
+
+               json_object_object_get_ex(jobj_keyslot, "type", &jobj_type);
+               if (!strcmp(json_object_get_string(jobj_type), type))
+                       return i;
+       }
+
+       return -ENOENT;
+}
diff --git a/lib/luks2/luks2_keyslot_luks2.c b/lib/luks2/luks2_keyslot_luks2.c
new file mode 100644 (file)
index 0000000..156f0c1
--- /dev/null
@@ -0,0 +1,785 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, LUKS2 type keyslot handler
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+
+/* FIXME: move keyslot encryption to crypto backend */
+#include "../luks1/af.h"
+
+#define LUKS_SALTSIZE 32
+#define LUKS_SLOT_ITERATIONS_MIN 1000
+#define LUKS_STRIPES 4000
+
+/* Serialize memory-hard keyslot access: optional workaround for parallel processing */
+#define MIN_MEMORY_FOR_SERIALIZE_LOCK_KB 32*1024 /* 32MB */
+
+static int luks2_encrypt_to_storage(char *src, size_t srcLength,
+       const char *cipher, const char *cipher_mode,
+       struct volume_key *vk, unsigned int sector,
+       struct crypt_device *cd)
+{
+#ifndef ENABLE_AF_ALG /* Support for old kernel without Crypto API */
+       return LUKS_encrypt_to_storage(src, srcLength, cipher, cipher_mode, vk, sector, cd);
+#else
+       struct crypt_storage *s;
+       int devfd, r;
+       struct device *device = crypt_metadata_device(cd);
+
+       /* Only whole sector writes supported */
+       if (MISALIGNED_512(srcLength))
+               return -EINVAL;
+
+       /* Encrypt buffer */
+       r = crypt_storage_init(&s, SECTOR_SIZE, cipher, cipher_mode, vk->key, vk->keylength);
+       if (r) {
+               log_err(cd, _("Cannot use %s-%s cipher for keyslot encryption."), cipher, cipher_mode);
+               return r;
+       }
+
+       r = crypt_storage_encrypt(s, 0, srcLength, src);
+       crypt_storage_destroy(s);
+       if (r) {
+               log_err(cd, _("IO error while encrypting keyslot."));
+               return r;
+       }
+
+       devfd = device_open_locked(cd, device, O_RDWR);
+       if (devfd >= 0) {
+               if (write_lseek_blockwise(devfd, device_block_size(cd, device),
+                                         device_alignment(device), src,
+                                         srcLength, sector * SECTOR_SIZE) < 0)
+                       r = -EIO;
+               else
+                       r = 0;
+
+               device_sync(cd, device);
+       } else
+               r = -EIO;
+
+       if (r)
+               log_err(cd, _("IO error while encrypting keyslot."));
+
+       return r;
+#endif
+}
+
+static int luks2_decrypt_from_storage(char *dst, size_t dstLength,
+       const char *cipher, const char *cipher_mode, struct volume_key *vk,
+       unsigned int sector, struct crypt_device *cd)
+{
+       struct device *device = crypt_metadata_device(cd);
+#ifndef ENABLE_AF_ALG /* Support for old kernel without Crypto API */
+       int r = device_read_lock(cd, device);
+       if (r) {
+               log_err(cd, _("Failed to acquire read lock on device %s."), device_path(device));
+               return r;
+       }
+       r = LUKS_decrypt_from_storage(dst, dstLength, cipher, cipher_mode, vk, sector, cd);
+       device_read_unlock(cd, crypt_metadata_device(cd));
+       return r;
+#else
+       struct crypt_storage *s;
+       int devfd, r;
+
+       /* Only whole sector writes supported */
+       if (MISALIGNED_512(dstLength))
+               return -EINVAL;
+
+       r = crypt_storage_init(&s, SECTOR_SIZE, cipher, cipher_mode, vk->key, vk->keylength);
+       if (r) {
+               log_err(cd, _("Cannot use %s-%s cipher for keyslot encryption."), cipher, cipher_mode);
+               return r;
+       }
+
+       r = device_read_lock(cd, device);
+       if (r) {
+               log_err(cd, _("Failed to acquire read lock on device %s."),
+                       device_path(device));
+               crypt_storage_destroy(s);
+               return r;
+       }
+
+       devfd = device_open_locked(cd, device, O_RDONLY);
+       if (devfd >= 0) {
+               if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                                        device_alignment(device), dst,
+                                        dstLength, sector * SECTOR_SIZE) < 0)
+                       r = -EIO;
+               else
+                       r = 0;
+       } else
+               r = -EIO;
+
+       device_read_unlock(cd, device);
+
+       /* Decrypt buffer */
+       if (!r)
+               r = crypt_storage_decrypt(s, 0, dstLength, dst);
+       else
+               log_err(cd, _("IO error while decrypting keyslot."));
+
+       crypt_storage_destroy(s);
+       return r;
+#endif
+}
+
+static int luks2_keyslot_get_pbkdf_params(json_object *jobj_keyslot,
+                               struct crypt_pbkdf_type *pbkdf, char *salt)
+{
+       json_object *jobj_kdf, *jobj1, *jobj2;
+       size_t salt_len;
+
+       if (!jobj_keyslot || !pbkdf)
+               return -EINVAL;
+
+       memset(pbkdf, 0, sizeof(*pbkdf));
+
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf))
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_kdf, "type", &jobj1))
+               return -EINVAL;
+       pbkdf->type = json_object_get_string(jobj1);
+       if (!strcmp(pbkdf->type, CRYPT_KDF_PBKDF2)) {
+               if (!json_object_object_get_ex(jobj_kdf, "hash", &jobj2))
+                       return -EINVAL;
+               pbkdf->hash = json_object_get_string(jobj2);
+               if (!json_object_object_get_ex(jobj_kdf, "iterations", &jobj2))
+                       return -EINVAL;
+               pbkdf->iterations = json_object_get_int(jobj2);
+               pbkdf->max_memory_kb = 0;
+               pbkdf->parallel_threads = 0;
+       } else {
+               if (!json_object_object_get_ex(jobj_kdf, "time", &jobj2))
+                       return -EINVAL;
+               pbkdf->iterations = json_object_get_int(jobj2);
+               if (!json_object_object_get_ex(jobj_kdf, "memory", &jobj2))
+                       return -EINVAL;
+               pbkdf->max_memory_kb = json_object_get_int(jobj2);
+               if (!json_object_object_get_ex(jobj_kdf, "cpus", &jobj2))
+                       return -EINVAL;
+               pbkdf->parallel_threads = json_object_get_int(jobj2);
+       }
+
+       if (!json_object_object_get_ex(jobj_kdf, "salt", &jobj2))
+               return -EINVAL;
+       salt_len = LUKS_SALTSIZE;
+       if (!base64_decode(json_object_get_string(jobj2),
+                          json_object_get_string_len(jobj2),
+                          salt, &salt_len))
+               return -EINVAL;
+       if (salt_len != LUKS_SALTSIZE)
+               return -EINVAL;
+
+       return 0;
+}
+
+static int luks2_keyslot_set_key(struct crypt_device *cd,
+       json_object *jobj_keyslot,
+       const char *password, size_t passwordLen,
+       const char *volume_key, size_t volume_key_len)
+{
+       struct volume_key *derived_key;
+       char salt[LUKS_SALTSIZE], cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
+       char *AfKey = NULL;
+       const char *af_hash = NULL;
+       size_t AFEKSize, keyslot_key_len;
+       json_object *jobj2, *jobj_kdf, *jobj_af, *jobj_area;
+       uint64_t area_offset;
+       struct crypt_pbkdf_type pbkdf;
+       int r;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf) ||
+           !json_object_object_get_ex(jobj_keyslot, "af", &jobj_af) ||
+           !json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return -EINVAL;
+
+       /* prevent accidental volume key size change after allocation */
+       if (!json_object_object_get_ex(jobj_keyslot, "key_size", &jobj2))
+               return -EINVAL;
+       if (json_object_get_int(jobj2) != (int)volume_key_len)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_area, "offset", &jobj2))
+               return -EINVAL;
+       area_offset = crypt_jobj_get_uint64(jobj2);
+
+       if (!json_object_object_get_ex(jobj_area, "encryption", &jobj2))
+               return -EINVAL;
+       r = crypt_parse_name_and_mode(json_object_get_string(jobj2), cipher, NULL, cipher_mode);
+       if (r < 0)
+               return r;
+
+       if (!json_object_object_get_ex(jobj_area, "key_size", &jobj2))
+               return -EINVAL;
+       keyslot_key_len = json_object_get_int(jobj2);
+
+       if (!json_object_object_get_ex(jobj_af, "hash", &jobj2))
+               return -EINVAL;
+       af_hash = json_object_get_string(jobj2);
+
+       if (luks2_keyslot_get_pbkdf_params(jobj_keyslot, &pbkdf, salt))
+               return -EINVAL;
+
+       /*
+        * Allocate derived key storage.
+        */
+       derived_key = crypt_alloc_volume_key(keyslot_key_len, NULL);
+       if (!derived_key)
+               return -ENOMEM;
+       /*
+        * Calculate keyslot content, split and store it to keyslot area.
+        */
+       r = crypt_pbkdf(pbkdf.type, pbkdf.hash, password, passwordLen,
+                       salt, LUKS_SALTSIZE,
+                       derived_key->key, derived_key->keylength,
+                       pbkdf.iterations, pbkdf.max_memory_kb,
+                       pbkdf.parallel_threads);
+       if (r < 0) {
+               crypt_free_volume_key(derived_key);
+               return r;
+       }
+
+       // FIXME: verity key_size to AFEKSize
+       AFEKSize = AF_split_sectors(volume_key_len, LUKS_STRIPES) * SECTOR_SIZE;
+       AfKey = crypt_safe_alloc(AFEKSize);
+       if (!AfKey) {
+               crypt_free_volume_key(derived_key);
+               return -ENOMEM;
+       }
+
+       r = AF_split(cd, volume_key, AfKey, volume_key_len, LUKS_STRIPES, af_hash);
+
+       if (r == 0) {
+               log_dbg(cd, "Updating keyslot area [0x%04x].", (unsigned)area_offset);
+               /* FIXME: sector_offset should be size_t, fix LUKS_encrypt... accordingly */
+               r = luks2_encrypt_to_storage(AfKey, AFEKSize, cipher, cipher_mode,
+                                   derived_key, (unsigned)(area_offset / SECTOR_SIZE), cd);
+       }
+
+       crypt_safe_free(AfKey);
+       crypt_free_volume_key(derived_key);
+       if (r < 0)
+               return r;
+
+       return 0;
+}
+
+static int luks2_keyslot_get_key(struct crypt_device *cd,
+       json_object *jobj_keyslot,
+       const char *password, size_t passwordLen,
+       char *volume_key, size_t volume_key_len)
+{
+       struct volume_key *derived_key;
+       struct crypt_pbkdf_type pbkdf;
+       char *AfKey;
+       size_t AFEKSize;
+       const char *af_hash = NULL;
+       char salt[LUKS_SALTSIZE], cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
+       json_object *jobj2, *jobj_af, *jobj_area;
+       uint64_t area_offset;
+       size_t keyslot_key_len;
+       bool try_serialize_lock = false;
+       int r;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "af", &jobj_af) ||
+           !json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return -EINVAL;
+
+       if (luks2_keyslot_get_pbkdf_params(jobj_keyslot, &pbkdf, salt))
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_af, "hash", &jobj2))
+               return -EINVAL;
+       af_hash = json_object_get_string(jobj2);
+
+       if (!json_object_object_get_ex(jobj_area, "offset", &jobj2))
+               return -EINVAL;
+       area_offset = crypt_jobj_get_uint64(jobj2);
+
+       if (!json_object_object_get_ex(jobj_area, "encryption", &jobj2))
+               return -EINVAL;
+       r = crypt_parse_name_and_mode(json_object_get_string(jobj2), cipher, NULL, cipher_mode);
+       if (r < 0)
+               return r;
+
+       if (!json_object_object_get_ex(jobj_area, "key_size", &jobj2))
+               return -EINVAL;
+       keyslot_key_len = json_object_get_int(jobj2);
+
+       /*
+        * If requested, serialize unlocking for memory-hard KDF. Usually NOOP.
+        */
+       if (pbkdf.max_memory_kb > MIN_MEMORY_FOR_SERIALIZE_LOCK_KB)
+               try_serialize_lock = true;
+       if (try_serialize_lock && crypt_serialize_lock(cd))
+               return -EINVAL;
+       /*
+        * Allocate derived key storage space.
+        */
+       derived_key = crypt_alloc_volume_key(keyslot_key_len, NULL);
+       if (!derived_key)
+               return -ENOMEM;
+
+       AFEKSize = AF_split_sectors(volume_key_len, LUKS_STRIPES) * SECTOR_SIZE;
+       AfKey = crypt_safe_alloc(AFEKSize);
+       if (!AfKey) {
+               crypt_free_volume_key(derived_key);
+               return -ENOMEM;
+       }
+       /*
+        * Calculate derived key, decrypt keyslot content and merge it.
+        */
+       r = crypt_pbkdf(pbkdf.type, pbkdf.hash, password, passwordLen,
+                       salt, LUKS_SALTSIZE,
+                       derived_key->key, derived_key->keylength,
+                       pbkdf.iterations, pbkdf.max_memory_kb,
+                       pbkdf.parallel_threads);
+
+       if (try_serialize_lock)
+               crypt_serialize_unlock(cd);
+
+       if (r == 0) {
+               log_dbg(cd, "Reading keyslot area [0x%04x].", (unsigned)area_offset);
+               /* FIXME: sector_offset should be size_t, fix LUKS_decrypt... accordingly */
+               r = luks2_decrypt_from_storage(AfKey, AFEKSize, cipher, cipher_mode,
+                                     derived_key, (unsigned)(area_offset / SECTOR_SIZE), cd);
+       }
+
+       if (r == 0)
+               r = AF_merge(cd, AfKey, volume_key, volume_key_len, LUKS_STRIPES, af_hash);
+
+       crypt_free_volume_key(derived_key);
+       crypt_safe_free(AfKey);
+
+       return r;
+}
+
+/*
+ * currently we support update of only:
+ *
+ * - af hash function
+ * - kdf params
+ */
+static int luks2_keyslot_update_json(struct crypt_device *cd,
+       json_object *jobj_keyslot,
+       const struct luks2_keyslot_params *params)
+{
+       const struct crypt_pbkdf_type *pbkdf;
+       json_object *jobj_af, *jobj_area, *jobj_kdf;
+       char salt[LUKS_SALTSIZE], *salt_base64 = NULL;
+       int r;
+
+       /* jobj_keyslot is not yet validated */
+
+       if (!json_object_object_get_ex(jobj_keyslot, "af", &jobj_af) ||
+           !json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return -EINVAL;
+
+       /* update area encryption parameters */
+       json_object_object_add(jobj_area, "encryption", json_object_new_string(params->area.raw.encryption));
+       json_object_object_add(jobj_area, "key_size", json_object_new_int(params->area.raw.key_size));
+
+       pbkdf = crypt_get_pbkdf_type(cd);
+       if (!pbkdf)
+               return -EINVAL;
+
+       r = crypt_benchmark_pbkdf_internal(cd, CONST_CAST(struct crypt_pbkdf_type *)pbkdf, params->area.raw.key_size);
+       if (r < 0)
+               return r;
+
+       /* refresh whole 'kdf' object */
+       jobj_kdf = json_object_new_object();
+       if (!jobj_kdf)
+               return -ENOMEM;
+       json_object_object_add(jobj_kdf, "type", json_object_new_string(pbkdf->type));
+       if (!strcmp(pbkdf->type, CRYPT_KDF_PBKDF2)) {
+               json_object_object_add(jobj_kdf, "hash", json_object_new_string(pbkdf->hash));
+               json_object_object_add(jobj_kdf, "iterations", json_object_new_int(pbkdf->iterations));
+       } else {
+               json_object_object_add(jobj_kdf, "time", json_object_new_int(pbkdf->iterations));
+               json_object_object_add(jobj_kdf, "memory", json_object_new_int(pbkdf->max_memory_kb));
+               json_object_object_add(jobj_kdf, "cpus", json_object_new_int(pbkdf->parallel_threads));
+       }
+       json_object_object_add(jobj_keyslot, "kdf", jobj_kdf);
+
+       /*
+        * Regenerate salt and add it in 'kdf' object
+        */
+       r = crypt_random_get(cd, salt, LUKS_SALTSIZE, CRYPT_RND_SALT);
+       if (r < 0)
+               return r;
+       base64_encode_alloc(salt, LUKS_SALTSIZE, &salt_base64);
+       if (!salt_base64)
+               return -ENOMEM;
+       json_object_object_add(jobj_kdf, "salt", json_object_new_string(salt_base64));
+       free(salt_base64);
+
+       /* update 'af' hash */
+       json_object_object_add(jobj_af, "hash", json_object_new_string(params->af.luks1.hash));
+
+       JSON_DBG(cd, jobj_keyslot, "Keyslot JSON:");
+       return 0;
+}
+
+static int luks2_keyslot_alloc(struct crypt_device *cd,
+       int keyslot,
+       size_t volume_key_len,
+       const struct luks2_keyslot_params *params)
+{
+       struct luks2_hdr *hdr;
+       uint64_t area_offset, area_length;
+       json_object *jobj_keyslots, *jobj_keyslot, *jobj_af, *jobj_area;
+       int r;
+
+       log_dbg(cd, "Trying to allocate LUKS2 keyslot %d.", keyslot);
+
+       if (!params || params->area_type != LUKS2_KEYSLOT_AREA_RAW ||
+           params->af_type != LUKS2_KEYSLOT_AF_LUKS1) {
+               log_dbg(cd, "Invalid LUKS2 keyslot parameters.");
+               return -EINVAL;
+       }
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       if (keyslot == CRYPT_ANY_SLOT)
+               keyslot = LUKS2_keyslot_find_empty(hdr);
+
+       if (keyslot < 0 || keyslot >= LUKS2_KEYSLOTS_MAX)
+               return -ENOMEM;
+
+       if (LUKS2_get_keyslot_jobj(hdr, keyslot)) {
+               log_dbg(cd, "Cannot modify already active keyslot %d.", keyslot);
+               return -EINVAL;
+       }
+
+       if (!json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots))
+               return -EINVAL;
+
+       r = LUKS2_find_area_gap(cd, hdr, volume_key_len, &area_offset, &area_length);
+       if (r < 0) {
+               log_err(cd, _("No space for new keyslot."));
+               return r;
+       }
+
+       jobj_keyslot = json_object_new_object();
+       json_object_object_add(jobj_keyslot, "type", json_object_new_string("luks2"));
+       json_object_object_add(jobj_keyslot, "key_size", json_object_new_int(volume_key_len));
+
+       /* AF object */
+       jobj_af = json_object_new_object();
+       json_object_object_add(jobj_af, "type", json_object_new_string("luks1"));
+       json_object_object_add(jobj_af, "stripes", json_object_new_int(params->af.luks1.stripes));
+       json_object_object_add(jobj_keyslot, "af", jobj_af);
+
+       /* Area object */
+       jobj_area = json_object_new_object();
+       json_object_object_add(jobj_area, "type", json_object_new_string("raw"));
+       json_object_object_add(jobj_area, "offset", crypt_jobj_new_uint64(area_offset));
+       json_object_object_add(jobj_area, "size", crypt_jobj_new_uint64(area_length));
+       json_object_object_add(jobj_keyslot, "area", jobj_area);
+
+       json_object_object_add_by_uint(jobj_keyslots, keyslot, jobj_keyslot);
+
+       r = luks2_keyslot_update_json(cd, jobj_keyslot, params);
+
+       if (!r && LUKS2_check_json_size(cd, hdr)) {
+               log_dbg(cd, "Not enough space in header json area for new keyslot.");
+               r = -ENOSPC;
+       }
+
+       if (r)
+               json_object_object_del_by_uint(jobj_keyslots, keyslot);
+
+       return r;
+}
+
+static int luks2_keyslot_open(struct crypt_device *cd,
+       int keyslot,
+       const char *password,
+       size_t password_len,
+       char *volume_key,
+       size_t volume_key_len)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj_keyslot;
+
+       log_dbg(cd, "Trying to open LUKS2 keyslot %d.", keyslot);
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       return luks2_keyslot_get_key(cd, jobj_keyslot,
+                                    password, password_len,
+                                    volume_key, volume_key_len);
+}
+
+/*
+ * This function must not modify json.
+ * It's called after luks2 keyslot validation.
+ */
+static int luks2_keyslot_store(struct crypt_device *cd,
+       int keyslot,
+       const char *password,
+       size_t password_len,
+       const char *volume_key,
+       size_t volume_key_len)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj_keyslot;
+       int r;
+
+       log_dbg(cd, "Calculating attributes for LUKS2 keyslot %d.", keyslot);
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       r = LUKS2_device_write_lock(cd, hdr, crypt_metadata_device(cd));
+       if(r)
+               return r;
+
+       r = luks2_keyslot_set_key(cd, jobj_keyslot,
+                                 password, password_len,
+                                 volume_key, volume_key_len);
+       if (!r)
+               r = LUKS2_hdr_write(cd, hdr);
+
+       device_write_unlock(cd, crypt_metadata_device(cd));
+
+       return r < 0 ? r : keyslot;
+}
+
+static int luks2_keyslot_wipe(struct crypt_device *cd, int keyslot)
+{
+       struct luks2_hdr *hdr;
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       /* Remove any reference of deleted keyslot from digests and tokens */
+       LUKS2_digest_assign(cd, hdr, keyslot, CRYPT_ANY_DIGEST, 0, 0);
+       LUKS2_token_assign(cd, hdr, keyslot, CRYPT_ANY_TOKEN, 0, 0);
+
+       return 0;
+}
+
+static int luks2_keyslot_dump(struct crypt_device *cd, int keyslot)
+{
+       json_object *jobj_keyslot, *jobj1, *jobj_kdf, *jobj_af, *jobj_area;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(crypt_get_hdr(cd, CRYPT_LUKS2), keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf) ||
+           !json_object_object_get_ex(jobj_keyslot, "af", &jobj_af) ||
+           !json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_area, "encryption", &jobj1);
+       log_std(cd, "\tCipher:     %s\n", json_object_get_string(jobj1));
+
+       json_object_object_get_ex(jobj_area, "key_size", &jobj1);
+       log_std(cd, "\tCipher key: %u bits\n", crypt_jobj_get_uint32(jobj1) * 8);
+
+       json_object_object_get_ex(jobj_kdf, "type", &jobj1);
+       log_std(cd, "\tPBKDF:      %s\n", json_object_get_string(jobj1));
+
+       if (!strcmp(json_object_get_string(jobj1), CRYPT_KDF_PBKDF2)) {
+               json_object_object_get_ex(jobj_kdf, "hash", &jobj1);
+               log_std(cd, "\tHash:       %s\n", json_object_get_string(jobj1));
+
+               json_object_object_get_ex(jobj_kdf, "iterations", &jobj1);
+               log_std(cd, "\tIterations: %" PRIu64 "\n", crypt_jobj_get_uint64(jobj1));
+       } else {
+               json_object_object_get_ex(jobj_kdf, "time", &jobj1);
+               log_std(cd, "\tTime cost:  %" PRIu64 "\n", json_object_get_int64(jobj1));
+
+               json_object_object_get_ex(jobj_kdf, "memory", &jobj1);
+               log_std(cd, "\tMemory:     %" PRIu64 "\n", json_object_get_int64(jobj1));
+
+               json_object_object_get_ex(jobj_kdf, "cpus", &jobj1);
+               log_std(cd, "\tThreads:    %" PRIu64 "\n", json_object_get_int64(jobj1));
+       }
+       json_object_object_get_ex(jobj_kdf, "salt", &jobj1);
+       log_std(cd, "\tSalt:       ");
+       hexprint_base64(cd, jobj1, " ", "            ");
+
+
+       json_object_object_get_ex(jobj_af, "stripes", &jobj1);
+       log_std(cd, "\tAF stripes: %u\n", json_object_get_int(jobj1));
+
+       json_object_object_get_ex(jobj_af, "hash", &jobj1);
+       log_std(cd, "\tAF hash:    %s\n", json_object_get_string(jobj1));
+
+       json_object_object_get_ex(jobj_area, "offset", &jobj1);
+       log_std(cd, "\tArea offset:%" PRIu64 " [bytes]\n", crypt_jobj_get_uint64(jobj1));
+
+       json_object_object_get_ex(jobj_area, "size", &jobj1);
+       log_std(cd, "\tArea length:%" PRIu64 " [bytes]\n", crypt_jobj_get_uint64(jobj1));
+
+       return 0;
+}
+
+static int luks2_keyslot_validate(struct crypt_device *cd, json_object *jobj_keyslot)
+{
+       json_object *jobj_kdf, *jobj_af, *jobj_area, *jobj1;
+       const char *type;
+       int count;
+
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf) ||
+           !json_object_object_get_ex(jobj_keyslot, "af", &jobj_af) ||
+           !json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return -EINVAL;
+
+       count = json_object_object_length(jobj_kdf);
+
+       jobj1 = json_contains(cd, jobj_kdf, "", "kdf section", "type", json_type_string);
+       if (!jobj1)
+               return -EINVAL;
+       type = json_object_get_string(jobj1);
+
+       if (!strcmp(type, CRYPT_KDF_PBKDF2)) {
+               if (count != 4 || /* type, salt, hash, iterations only */
+                   !json_contains(cd, jobj_kdf, "kdf type", type, "hash", json_type_string) ||
+                   !json_contains(cd, jobj_kdf, "kdf type", type, "iterations", json_type_int) ||
+                   !json_contains(cd, jobj_kdf, "kdf type", type, "salt", json_type_string))
+                       return -EINVAL;
+       } else if (!strcmp(type, CRYPT_KDF_ARGON2I) || !strcmp(type, CRYPT_KDF_ARGON2ID)) {
+               if (count != 5 || /* type, salt, time, memory, cpus only */
+                   !json_contains(cd, jobj_kdf, "kdf type", type, "time", json_type_int) ||
+                   !json_contains(cd, jobj_kdf, "kdf type", type, "memory", json_type_int) ||
+                   !json_contains(cd, jobj_kdf, "kdf type", type, "cpus", json_type_int) ||
+                   !json_contains(cd, jobj_kdf, "kdf type", type, "salt", json_type_string))
+                       return -EINVAL;
+       }
+
+       if (!json_object_object_get_ex(jobj_af, "type", &jobj1))
+               return -EINVAL;
+       if (!strcmp(json_object_get_string(jobj1), "luks1")) {
+               if (!json_contains(cd, jobj_af, "", "luks1 af", "hash", json_type_string) ||
+                   !json_contains(cd, jobj_af, "", "luks1 af", "stripes", json_type_int))
+                       return -EINVAL;
+       } else
+               return -EINVAL;
+
+       // FIXME check numbered
+       if (!json_object_object_get_ex(jobj_area, "type", &jobj1))
+               return -EINVAL;
+       if (!strcmp(json_object_get_string(jobj1), "raw")) {
+               if (!json_contains(cd, jobj_area, "area", "raw type", "encryption", json_type_string) ||
+                   !json_contains(cd, jobj_area, "area", "raw type", "key_size", json_type_int) ||
+                   !json_contains(cd, jobj_area, "area", "raw type", "offset", json_type_string) ||
+                   !json_contains(cd, jobj_area, "area", "raw type", "size", json_type_string))
+                       return -EINVAL;
+       } else
+               return -EINVAL;
+
+       return 0;
+}
+
+static int luks2_keyslot_update(struct crypt_device *cd,
+       int keyslot,
+       const struct luks2_keyslot_params *params)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj_keyslot;
+       int r;
+
+       log_dbg(cd, "Updating LUKS2 keyslot %d.", keyslot);
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       r = luks2_keyslot_update_json(cd, jobj_keyslot, params);
+
+       if (!r && LUKS2_check_json_size(cd, hdr)) {
+               log_dbg(cd, "Not enough space in header json area for updated keyslot %d.", keyslot);
+               r = -ENOSPC;
+       }
+
+       return r;
+}
+
+static void luks2_keyslot_repair(struct crypt_device *cd, json_object *jobj_keyslot)
+{
+       const char *type;
+       json_object *jobj_kdf, *jobj_type;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf) ||
+           !json_object_is_type(jobj_kdf, json_type_object))
+               return;
+
+       if (!json_object_object_get_ex(jobj_kdf, "type", &jobj_type) ||
+           !json_object_is_type(jobj_type, json_type_string))
+               return;
+
+       type = json_object_get_string(jobj_type);
+
+       if (!strcmp(type, CRYPT_KDF_PBKDF2)) {
+               /* type, salt, hash, iterations only */
+               json_object_object_foreach(jobj_kdf, key, val) {
+                       UNUSED(val);
+                       if (!strcmp(key, "type") || !strcmp(key, "salt") ||
+                           !strcmp(key, "hash") || !strcmp(key, "iterations"))
+                                       continue;
+                       json_object_object_del(jobj_kdf, key);
+               }
+       } else if (!strcmp(type, CRYPT_KDF_ARGON2I) || !strcmp(type, CRYPT_KDF_ARGON2ID)) {
+               /* type, salt, time, memory, cpus only */
+               json_object_object_foreach(jobj_kdf, key, val) {
+                       UNUSED(val);
+                       if (!strcmp(key, "type") || !strcmp(key, "salt") ||
+                           !strcmp(key, "time") || !strcmp(key, "memory") ||
+                           !strcmp(key, "cpus"))
+                                       continue;
+                       json_object_object_del(jobj_kdf, key);
+               }
+       }
+}
+
+const keyslot_handler luks2_keyslot = {
+       .name  = "luks2",
+       .alloc  = luks2_keyslot_alloc,
+       .update = luks2_keyslot_update,
+       .open  = luks2_keyslot_open,
+       .store = luks2_keyslot_store,
+       .wipe  = luks2_keyslot_wipe,
+       .dump  = luks2_keyslot_dump,
+       .validate = luks2_keyslot_validate,
+       .repair = luks2_keyslot_repair
+};
diff --git a/lib/luks2/luks2_keyslot_reenc.c b/lib/luks2/luks2_keyslot_reenc.c
new file mode 100644 (file)
index 0000000..b939467
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, reencryption keyslot handler
+ *
+ * Copyright (C) 2016-2020, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020, Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+
+static int reenc_keyslot_open(struct crypt_device *cd,
+       int keyslot,
+       const char *password,
+       size_t password_len,
+       char *volume_key,
+       size_t volume_key_len)
+{
+       return -ENOENT;
+}
+
+int reenc_keyslot_alloc(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const struct crypt_params_reencrypt *params)
+{
+       int r;
+       json_object *jobj_keyslots, *jobj_keyslot, *jobj_area;
+       uint64_t area_offset, area_length;
+
+       log_dbg(cd, "Allocating reencrypt keyslot %d.", keyslot);
+
+       if (keyslot < 0 || keyslot >= LUKS2_KEYSLOTS_MAX)
+               return -ENOMEM;
+
+       if (!json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots))
+               return -EINVAL;
+
+       /* encryption doesn't require area (we shift data and backup will be available) */
+       if (!params->data_shift) {
+               r = LUKS2_find_area_max_gap(cd, hdr, &area_offset, &area_length);
+               if (r < 0)
+                       return r;
+       } else { /* we can't have keyslot w/o area...bug? */
+               r = LUKS2_find_area_gap(cd, hdr, 1, &area_offset, &area_length);
+               if (r < 0)
+                       return r;
+       }
+
+       jobj_keyslot = json_object_new_object();
+       if (!jobj_keyslot)
+               return -ENOMEM;
+
+       jobj_area = json_object_new_object();
+
+       if (params->data_shift) {
+               json_object_object_add(jobj_area, "type", json_object_new_string("datashift"));
+               json_object_object_add(jobj_area, "shift_size", crypt_jobj_new_uint64(params->data_shift << SECTOR_SHIFT));
+       } else
+               /* except data shift protection, initial setting is irrelevant. Type can be changed during reencryption */
+               json_object_object_add(jobj_area, "type", json_object_new_string("none"));
+
+       json_object_object_add(jobj_area, "offset", crypt_jobj_new_uint64(area_offset));
+       json_object_object_add(jobj_area, "size", crypt_jobj_new_uint64(area_length));
+
+       json_object_object_add(jobj_keyslot, "type", json_object_new_string("reencrypt"));
+       json_object_object_add(jobj_keyslot, "key_size", json_object_new_int(1)); /* useless but mandatory */
+       json_object_object_add(jobj_keyslot, "mode", json_object_new_string(crypt_reencrypt_mode_to_str(params->mode)));
+       if (params->direction == CRYPT_REENCRYPT_FORWARD)
+               json_object_object_add(jobj_keyslot, "direction", json_object_new_string("forward"));
+       else if (params->direction == CRYPT_REENCRYPT_BACKWARD)
+               json_object_object_add(jobj_keyslot, "direction", json_object_new_string("backward"));
+       else
+               return -EINVAL;
+
+       json_object_object_add(jobj_keyslot, "area", jobj_area);
+
+       json_object_object_add_by_uint(jobj_keyslots, keyslot, jobj_keyslot);
+       if (LUKS2_check_json_size(cd, hdr)) {
+               log_dbg(cd, "New keyslot too large to fit in free metadata space.");
+               json_object_object_del_by_uint(jobj_keyslots, keyslot);
+               return -ENOSPC;
+       }
+
+       JSON_DBG(cd, hdr->jobj, "JSON:");
+
+       return 0;
+}
+
+static int reenc_keyslot_store_data(struct crypt_device *cd,
+       json_object *jobj_keyslot,
+       const void *buffer, size_t buffer_len)
+{
+       int devfd, r;
+       json_object *jobj_area, *jobj_offset, *jobj_length;
+       uint64_t area_offset, area_length;
+       struct device *device = crypt_metadata_device(cd);
+
+       if (!json_object_object_get_ex(jobj_keyslot, "area", &jobj_area) ||
+           !json_object_object_get_ex(jobj_area, "offset", &jobj_offset) ||
+           !json_object_object_get_ex(jobj_area, "size", &jobj_length))
+               return -EINVAL;
+
+       area_offset = crypt_jobj_get_uint64(jobj_offset);
+       area_length = crypt_jobj_get_uint64(jobj_length);
+
+       if (!area_offset || !area_length || ((uint64_t)buffer_len > area_length))
+               return -EINVAL;
+
+       devfd = device_open_locked(cd, device, O_RDWR);
+       if (devfd >= 0) {
+               if (write_lseek_blockwise(devfd, device_block_size(cd, device),
+                                         device_alignment(device), CONST_CAST(void *)buffer,
+                                         buffer_len, area_offset) < 0)
+                       r = -EIO;
+               else
+                       r = 0;
+       } else
+               r = -EINVAL;
+
+       if (r)
+               log_err(cd, _("IO error while encrypting keyslot."));
+
+       return r;
+}
+
+static int reenc_keyslot_store(struct crypt_device *cd,
+       int keyslot,
+       const char *password __attribute__((unused)),
+       size_t password_len __attribute__((unused)),
+       const char *buffer,
+       size_t buffer_len)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj_keyslot;
+       int r = 0;
+
+       if (!cd || !buffer || !buffer_len)
+               return -EINVAL;
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       log_dbg(cd, "Reencrypt keyslot %d store.", keyslot);
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       r = LUKS2_device_write_lock(cd, hdr, crypt_metadata_device(cd));
+       if (r)
+               return r;
+
+       r = reenc_keyslot_store_data(cd, jobj_keyslot, buffer, buffer_len);
+       if (r < 0) {
+               device_write_unlock(cd, crypt_metadata_device(cd));
+               return r;
+       }
+
+       r = LUKS2_hdr_write(cd, hdr);
+
+       device_write_unlock(cd, crypt_metadata_device(cd));
+
+       return r < 0 ? r : keyslot;
+}
+
+int reenc_keyslot_update(struct crypt_device *cd,
+       const struct luks2_reenc_context *rh)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj_area_type;
+       struct luks2_hdr *hdr;
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, rh->reenc_keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_keyslot, "area", &jobj_area);
+       json_object_object_get_ex(jobj_area, "type", &jobj_area_type);
+
+       if (rh->rp.type == REENC_PROTECTION_CHECKSUM) {
+               log_dbg(cd, "Updating reencrypt keyslot for checksum protection.");
+               json_object_object_add(jobj_area, "type", json_object_new_string("checksum"));
+               json_object_object_add(jobj_area, "hash", json_object_new_string(rh->rp.p.csum.hash));
+               json_object_object_add(jobj_area, "sector_size", json_object_new_int64(rh->alignment));
+       } else if (rh->rp.type == REENC_PROTECTION_NONE) {
+               log_dbg(cd, "Updating reencrypt keyslot for none protection.");
+               json_object_object_add(jobj_area, "type", json_object_new_string("none"));
+               json_object_object_del(jobj_area, "hash");
+       } else if (rh->rp.type == REENC_PROTECTION_JOURNAL) {
+               log_dbg(cd, "Updating reencrypt keyslot for journal protection.");
+               json_object_object_add(jobj_area, "type", json_object_new_string("journal"));
+               json_object_object_del(jobj_area, "hash");
+       } else
+               log_dbg(cd, "No update of reencrypt keyslot needed.");
+
+       return 0;
+}
+
+static int reenc_keyslot_wipe(struct crypt_device *cd, int keyslot)
+{
+       return 0;
+}
+
+static int reenc_keyslot_dump(struct crypt_device *cd, int keyslot)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj_direction, *jobj_mode, *jobj_resilience,
+                   *jobj1;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(crypt_get_hdr(cd, CRYPT_LUKS2), keyslot);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "direction", &jobj_direction) ||
+           !json_object_object_get_ex(jobj_keyslot, "mode", &jobj_mode) ||
+           !json_object_object_get_ex(jobj_keyslot, "area", &jobj_area) ||
+           !json_object_object_get_ex(jobj_area, "type", &jobj_resilience))
+               return -EINVAL;
+
+       log_std(cd, "\t%-12s%s\n", "Mode:", json_object_get_string(jobj_mode));
+       log_std(cd, "\t%-12s%s\n", "Direction:", json_object_get_string(jobj_direction));
+       log_std(cd, "\t%-12s%s\n", "Resilience:", json_object_get_string(jobj_resilience));
+
+       if (!strcmp(json_object_get_string(jobj_resilience), "checksum")) {
+               json_object_object_get_ex(jobj_area, "hash", &jobj1);
+               log_std(cd, "\t%-12s%s\n", "Hash:", json_object_get_string(jobj1));
+               json_object_object_get_ex(jobj_area, "sector_size", &jobj1);
+               log_std(cd, "\t%-12s%d [bytes]\n", "Hash data:", json_object_get_int(jobj1));
+       } else if (!strcmp(json_object_get_string(jobj_resilience), "datashift")) {
+               json_object_object_get_ex(jobj_area, "shift_size", &jobj1);
+               log_std(cd, "\t%-12s%" PRIu64 "[bytes]\n", "Shift size:", crypt_jobj_get_uint64(jobj1));
+       }
+
+       json_object_object_get_ex(jobj_area, "offset", &jobj1);
+       log_std(cd, "\tArea offset:%" PRIu64 " [bytes]\n", crypt_jobj_get_uint64(jobj1));
+
+       json_object_object_get_ex(jobj_area, "size", &jobj1);
+       log_std(cd, "\tArea length:%" PRIu64 " [bytes]\n", crypt_jobj_get_uint64(jobj1));
+
+       return 0;
+}
+
+static int reenc_keyslot_validate(struct crypt_device *cd, json_object *jobj_keyslot)
+{
+       json_object *jobj_mode, *jobj_area, *jobj_type, *jobj_shift_size, *jobj_hash, *jobj_sector_size, *jobj_direction;
+       const char *mode, *type, *direction;
+       uint32_t sector_size;
+       uint64_t shift_size;
+
+       /* mode (string: encrypt,reencrypt,decrypt)
+        * direction (string:)
+        * area {
+        *   type: (string: datashift, journal, checksum, none)
+        *      hash: (string: checksum only)
+        *      sector_size (uint32: checksum only)
+        *      shift_size (uint64: datashift only)
+        * }
+        */
+
+       /* area and area type are validated in general validation code */
+       if (!jobj_keyslot || !json_object_object_get_ex(jobj_keyslot, "area", &jobj_area) ||
+           !json_object_object_get_ex(jobj_area, "type", &jobj_type))
+               return -EINVAL;
+
+       jobj_mode = json_contains(cd, jobj_keyslot, "", "reencrypt keyslot", "mode", json_type_string);
+       jobj_direction = json_contains(cd, jobj_keyslot, "", "reencrypt keyslot", "direction", json_type_string);
+
+       if (!jobj_mode || !jobj_direction)
+               return -EINVAL;
+
+       mode = json_object_get_string(jobj_mode);
+       type = json_object_get_string(jobj_type);
+       direction = json_object_get_string(jobj_direction);
+
+       if (strcmp(mode, "reencrypt") && strcmp(mode, "encrypt") &&
+           strcmp(mode, "decrypt")) {
+               log_dbg(cd, "Illegal reencrypt mode %s.", mode);
+               return -EINVAL;
+       }
+
+       if (strcmp(direction, "forward") && strcmp(direction, "backward")) {
+               log_dbg(cd, "Illegal reencrypt direction %s.", direction);
+               return -EINVAL;
+       }
+
+       if (!strcmp(type, "checksum")) {
+               jobj_hash = json_contains(cd, jobj_area, "type:checksum", "Keyslot area", "hash", json_type_string);
+               jobj_sector_size = json_contains(cd, jobj_area, "type:checksum", "Keyslot area", "sector_size", json_type_int);
+               if (!jobj_hash || !jobj_sector_size)
+                       return -EINVAL;
+               if (!validate_json_uint32(jobj_sector_size))
+                       return -EINVAL;
+               sector_size = crypt_jobj_get_uint32(jobj_sector_size);
+               if (sector_size < SECTOR_SIZE || NOTPOW2(sector_size)) {
+                       log_dbg(cd, "Invalid sector_size (%" PRIu32 ") for checksum resilience mode.", sector_size);
+                       return -EINVAL;
+               }
+       } else if (!strcmp(type, "datashift")) {
+               if (!(jobj_shift_size = json_contains(cd, jobj_area, "type:datashift", "Keyslot area", "shift_size", json_type_string)))
+                       return -EINVAL;
+
+               shift_size = crypt_jobj_get_uint64(jobj_shift_size);
+               if (!shift_size)
+                       return -EINVAL;
+
+               if (MISALIGNED_512(shift_size)) {
+                       log_dbg(cd, "Shift size field has to be aligned to sector size: %" PRIu32, SECTOR_SIZE);
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
+const keyslot_handler reenc_keyslot = {
+       .name  = "reencrypt",
+       .open  = reenc_keyslot_open,
+       .store = reenc_keyslot_store, /* initialization only or also per every chunk write */
+       .wipe  = reenc_keyslot_wipe,
+       .dump  = reenc_keyslot_dump,
+       .validate  = reenc_keyslot_validate
+};
diff --git a/lib/luks2/luks2_luks1_convert.c b/lib/luks2/luks2_luks1_convert.c
new file mode 100644 (file)
index 0000000..603c44d
--- /dev/null
@@ -0,0 +1,896 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, LUKS1 conversion code
+ *
+ * Copyright (C) 2015-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Ondrej Kozina
+ * Copyright (C) 2015-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+#include "../luks1/luks.h"
+#include "../luks1/af.h"
+
+int LUKS2_check_cipher(struct crypt_device *cd,
+                     size_t keylength,
+                     const char *cipher,
+                     const char *cipher_mode)
+{
+       return LUKS_check_cipher(cd, keylength, cipher, cipher_mode);
+}
+
+static int json_luks1_keyslot(const struct luks_phdr *hdr_v1, int keyslot, struct json_object **keyslot_object)
+{
+       char *base64_str, cipher[LUKS_CIPHERNAME_L+LUKS_CIPHERMODE_L];
+       size_t base64_len;
+       struct json_object *keyslot_obj, *field, *jobj_kdf, *jobj_af, *jobj_area;
+       uint64_t offset, area_size, offs_a, offs_b, length;
+
+       keyslot_obj = json_object_new_object();
+       json_object_object_add(keyslot_obj, "type", json_object_new_string("luks2"));
+       json_object_object_add(keyslot_obj, "key_size", json_object_new_int64(hdr_v1->keyBytes));
+
+       /* KDF */
+       jobj_kdf = json_object_new_object();
+       json_object_object_add(jobj_kdf, "type", json_object_new_string(CRYPT_KDF_PBKDF2));
+       json_object_object_add(jobj_kdf, "hash", json_object_new_string(hdr_v1->hashSpec));
+       json_object_object_add(jobj_kdf, "iterations", json_object_new_int64(hdr_v1->keyblock[keyslot].passwordIterations));
+       /* salt field */
+       base64_len = base64_encode_alloc(hdr_v1->keyblock[keyslot].passwordSalt, LUKS_SALTSIZE, &base64_str);
+       if (!base64_str) {
+               json_object_put(keyslot_obj);
+               json_object_put(jobj_kdf);
+               if (!base64_len)
+                       return -EINVAL;
+               return -ENOMEM;
+       }
+       field = json_object_new_string_len(base64_str, base64_len);
+       free(base64_str);
+       json_object_object_add(jobj_kdf, "salt", field);
+       json_object_object_add(keyslot_obj, "kdf", jobj_kdf);
+
+       /* AF */
+       jobj_af = json_object_new_object();
+       json_object_object_add(jobj_af, "type", json_object_new_string("luks1"));
+       json_object_object_add(jobj_af, "hash", json_object_new_string(hdr_v1->hashSpec));
+       /* stripes field ignored, fixed to LUKS_STRIPES (4000) */
+       json_object_object_add(jobj_af, "stripes", json_object_new_int(4000));
+       json_object_object_add(keyslot_obj, "af", jobj_af);
+
+       /* Area */
+       jobj_area = json_object_new_object();
+       json_object_object_add(jobj_area, "type", json_object_new_string("raw"));
+
+       /* encryption algorithm field */
+       if (*hdr_v1->cipherMode != '\0') {
+               (void) snprintf(cipher, sizeof(cipher), "%s-%s", hdr_v1->cipherName, hdr_v1->cipherMode);
+               json_object_object_add(jobj_area, "encryption", json_object_new_string(cipher));
+       } else
+               json_object_object_add(jobj_area, "encryption", json_object_new_string(hdr_v1->cipherName));
+
+       /* area */
+       if (LUKS_keyslot_area(hdr_v1, 0, &offs_a, &length) ||
+           LUKS_keyslot_area(hdr_v1, 1, &offs_b, &length) ||
+           LUKS_keyslot_area(hdr_v1, keyslot, &offset, &length)) {
+               json_object_put(keyslot_obj);
+               json_object_put(jobj_area);
+               return -EINVAL;
+       }
+       area_size = offs_b - offs_a;
+       json_object_object_add(jobj_area, "key_size", json_object_new_int(hdr_v1->keyBytes));
+       json_object_object_add(jobj_area, "offset", crypt_jobj_new_uint64(offset));
+       json_object_object_add(jobj_area, "size", crypt_jobj_new_uint64(area_size));
+       json_object_object_add(keyslot_obj, "area", jobj_area);
+
+       *keyslot_object = keyslot_obj;
+       return 0;
+}
+
+static int json_luks1_keyslots(const struct luks_phdr *hdr_v1, struct json_object **keyslots_object)
+{
+       int keyslot, r;
+       struct json_object *keyslot_obj, *field;
+
+       keyslot_obj = json_object_new_object();
+       if (!keyslot_obj)
+               return -ENOMEM;
+
+       for (keyslot = 0; keyslot < LUKS_NUMKEYS; keyslot++) {
+               if (hdr_v1->keyblock[keyslot].active != LUKS_KEY_ENABLED)
+                       continue;
+               r = json_luks1_keyslot(hdr_v1, keyslot, &field);
+               if (r) {
+                       json_object_put(keyslot_obj);
+                       return r;
+               }
+               json_object_object_add_by_uint(keyslot_obj, keyslot, field);
+       }
+
+       *keyslots_object = keyslot_obj;
+       return 0;
+}
+
+static int json_luks1_segment(const struct luks_phdr *hdr_v1, struct json_object **segment_object)
+{
+       const char *c;
+       char cipher[LUKS_CIPHERNAME_L+LUKS_CIPHERMODE_L];
+       struct json_object *segment_obj, *field;
+       uint64_t number;
+
+       segment_obj = json_object_new_object();
+       if (!segment_obj)
+               return -ENOMEM;
+
+       /* type field */
+       field = json_object_new_string("crypt");
+       if (!field) {
+               json_object_put(segment_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(segment_obj, "type", field);
+
+       /* offset field */
+       number = (uint64_t)hdr_v1->payloadOffset * SECTOR_SIZE;
+
+       field = crypt_jobj_new_uint64(number);
+       if (!field) {
+               json_object_put(segment_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(segment_obj, "offset", field);
+
+       /* iv_tweak field */
+       field = json_object_new_string("0");
+       if (!field) {
+               json_object_put(segment_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(segment_obj, "iv_tweak", field);
+
+       /* length field */
+       field = json_object_new_string("dynamic");
+       if (!field) {
+               json_object_put(segment_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(segment_obj, "size", field);
+
+       /* cipher field */
+       if (*hdr_v1->cipherMode != '\0') {
+               (void) snprintf(cipher, sizeof(cipher), "%s-%s", hdr_v1->cipherName, hdr_v1->cipherMode);
+               c = cipher;
+       } else
+               c = hdr_v1->cipherName;
+
+       field = json_object_new_string(c);
+       if (!field) {
+               json_object_put(segment_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(segment_obj, "encryption", field);
+
+       /* block field */
+       field = json_object_new_int(SECTOR_SIZE);
+       if (!field) {
+               json_object_put(segment_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(segment_obj, "sector_size", field);
+
+       *segment_object = segment_obj;
+       return 0;
+}
+
+static int json_luks1_segments(const struct luks_phdr *hdr_v1, struct json_object **segments_object)
+{
+       int r;
+       struct json_object *segments_obj, *field;
+
+       segments_obj = json_object_new_object();
+       if (!segments_obj)
+               return -ENOMEM;
+
+       r = json_luks1_segment(hdr_v1, &field);
+       if (r) {
+               json_object_put(segments_obj);
+               return r;
+       }
+       json_object_object_add_by_uint(segments_obj, 0, field);
+
+       *segments_object = segments_obj;
+       return 0;
+}
+
+static int json_luks1_digest(const struct luks_phdr *hdr_v1, struct json_object **digest_object)
+{
+       char keyslot_str[2], *base64_str;
+       int ks;
+       size_t base64_len;
+       struct json_object *digest_obj, *array, *field;
+
+       digest_obj = json_object_new_object();
+       if (!digest_obj)
+               return -ENOMEM;
+
+       /* type field */
+       field = json_object_new_string("pbkdf2");
+       if (!field) {
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(digest_obj, "type", field);
+
+       /* keyslots array */
+       array = json_object_new_array();
+       if (!array) {
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(digest_obj, "keyslots", json_object_get(array));
+
+       for (ks = 0; ks < LUKS_NUMKEYS; ks++) {
+               if (hdr_v1->keyblock[ks].active != LUKS_KEY_ENABLED)
+                       continue;
+               (void) snprintf(keyslot_str, sizeof(keyslot_str), "%d", ks);
+
+               field = json_object_new_string(keyslot_str);
+               if (!field || json_object_array_add(array, field) < 0) {
+                       json_object_put(field);
+                       json_object_put(array);
+                       json_object_put(digest_obj);
+                       return -ENOMEM;
+               }
+       }
+
+       json_object_put(array);
+
+       /* segments array */
+       array = json_object_new_array();
+       if (!array) {
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(digest_obj, "segments", json_object_get(array));
+
+       field = json_object_new_string("0");
+       if (!field || json_object_array_add(array, field) < 0) {
+               json_object_put(field);
+               json_object_put(array);
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+
+       json_object_put(array);
+
+       /* hash field */
+       field = json_object_new_string(hdr_v1->hashSpec);
+       if (!field) {
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(digest_obj, "hash", field);
+
+       /* salt field */
+       base64_len = base64_encode_alloc(hdr_v1->mkDigestSalt, LUKS_SALTSIZE, &base64_str);
+       if (!base64_str) {
+               json_object_put(digest_obj);
+               if (!base64_len)
+                       return -EINVAL;
+               return -ENOMEM;
+       }
+
+       field = json_object_new_string_len(base64_str, base64_len);
+       free(base64_str);
+       if (!field) {
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(digest_obj, "salt", field);
+
+       /* digest field */
+       base64_len = base64_encode_alloc(hdr_v1->mkDigest, LUKS_DIGESTSIZE, &base64_str);
+       if (!base64_str) {
+               json_object_put(digest_obj);
+               if (!base64_len)
+                       return -EINVAL;
+               return -ENOMEM;
+       }
+
+       field = json_object_new_string_len(base64_str, base64_len);
+       free(base64_str);
+       if (!field) {
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(digest_obj, "digest", field);
+
+       /* iterations field */
+       field = json_object_new_int64(hdr_v1->mkDigestIterations);
+       if (!field) {
+               json_object_put(digest_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(digest_obj, "iterations", field);
+
+       *digest_object = digest_obj;
+       return 0;
+}
+
+static int json_luks1_digests(const struct luks_phdr *hdr_v1, struct json_object **digests_object)
+{
+       int r;
+       struct json_object *digests_obj, *field;
+
+       digests_obj = json_object_new_object();
+       if (!digests_obj)
+               return -ENOMEM;
+
+       r = json_luks1_digest(hdr_v1, &field);
+       if (r) {
+               json_object_put(digests_obj);
+               return r;
+       }
+       json_object_object_add(digests_obj, "0", field);
+
+       *digests_object = digests_obj;
+       return 0;
+}
+
+static int json_luks1_object(struct luks_phdr *hdr_v1, struct json_object **luks1_object, uint64_t keyslots_size)
+{
+       int r;
+       struct json_object *luks1_obj, *field;
+       uint64_t json_size;
+
+       luks1_obj = json_object_new_object();
+       if (!luks1_obj)
+               return -ENOMEM;
+
+       /* keyslots field */
+       r = json_luks1_keyslots(hdr_v1, &field);
+       if (r) {
+               json_object_put(luks1_obj);
+               return r;
+       }
+       json_object_object_add(luks1_obj, "keyslots", field);
+
+       /* tokens field */
+       field = json_object_new_object();
+       if (!field) {
+               json_object_put(luks1_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(luks1_obj, "tokens", field);
+
+       /* segments field */
+       r = json_luks1_segments(hdr_v1, &field);
+       if (r) {
+               json_object_put(luks1_obj);
+               return r;
+       }
+       json_object_object_add(luks1_obj, "segments", field);
+
+       /* digests field */
+       r = json_luks1_digests(hdr_v1, &field);
+       if (r) {
+               json_object_put(luks1_obj);
+               return r;
+       }
+       json_object_object_add(luks1_obj, "digests", field);
+
+       /* config field */
+       /* anything else? */
+       field = json_object_new_object();
+       if (!field) {
+               json_object_put(luks1_obj);
+               return -ENOMEM;
+       }
+       json_object_object_add(luks1_obj, "config", field);
+
+       json_size = LUKS2_HDR_16K_LEN - LUKS2_HDR_BIN_LEN;
+       json_object_object_add(field, "json_size", crypt_jobj_new_uint64(json_size));
+       keyslots_size -= (keyslots_size % 4096);
+       json_object_object_add(field, "keyslots_size", crypt_jobj_new_uint64(keyslots_size));
+
+       *luks1_object = luks1_obj;
+       return 0;
+}
+
+static void move_keyslot_offset(json_object *jobj, int offset_add)
+{
+       json_object *jobj1, *jobj2, *jobj_area;
+       uint64_t offset = 0;
+
+       json_object_object_get_ex(jobj, "keyslots", &jobj1);
+       json_object_object_foreach(jobj1, key, val) {
+               UNUSED(key);
+               json_object_object_get_ex(val, "area", &jobj_area);
+               json_object_object_get_ex(jobj_area, "offset", &jobj2);
+               offset = crypt_jobj_get_uint64(jobj2) + offset_add;
+               json_object_object_add(jobj_area, "offset", crypt_jobj_new_uint64(offset));
+       }
+}
+
+/* FIXME: return specific error code for partial write error (aka keyslots are gone) */
+static int move_keyslot_areas(struct crypt_device *cd, off_t offset_from,
+                             off_t offset_to, size_t buf_size)
+{
+       int devfd, r = -EIO;
+       struct device *device = crypt_metadata_device(cd);
+       void *buf = NULL;
+
+       log_dbg(cd, "Moving keyslot areas of size %zu from %jd to %jd.",
+               buf_size, (intmax_t)offset_from, (intmax_t)offset_to);
+
+       if (posix_memalign(&buf, crypt_getpagesize(), buf_size))
+               return -ENOMEM;
+
+       devfd = device_open(cd, device, O_RDWR);
+       if (devfd < 0) {
+               free(buf);
+               return -EIO;
+       }
+
+       /* This can safely fail (for block devices). It only allocates space if it is possible. */
+       if (posix_fallocate(devfd, offset_to, buf_size))
+               log_dbg(cd, "Preallocation (fallocate) of new keyslot area not available.");
+
+       /* Try to read *new* area to check that area is there (trimmed backup). */
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                                device_alignment(device), buf, buf_size,
+                                offset_to)!= (ssize_t)buf_size)
+               goto out;
+
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                                device_alignment(device), buf, buf_size,
+                                offset_from)!= (ssize_t)buf_size)
+               goto out;
+
+       if (write_lseek_blockwise(devfd, device_block_size(cd, device),
+                                 device_alignment(device), buf, buf_size,
+                                 offset_to) != (ssize_t)buf_size)
+               goto out;
+
+       r = 0;
+out:
+       device_sync(cd, device);
+       crypt_safe_memzero(buf, buf_size);
+       free(buf);
+
+       return r;
+}
+
+static int luks_header_in_use(struct crypt_device *cd)
+{
+       int r;
+
+       r = lookup_dm_dev_by_uuid(cd, crypt_get_uuid(cd), crypt_get_type(cd));
+       if (r < 0)
+               log_err(cd, _("Cannot check status of device with uuid: %s."), crypt_get_uuid(cd));
+
+       return r;
+}
+
+/* Check if there is a luksmeta area (foreign metadata created by the luksmeta package) */
+static int luksmeta_header_present(struct crypt_device *cd, off_t luks1_size)
+{
+       int devfd, r = 0;
+       static const uint8_t LM_MAGIC[] = { 'L', 'U', 'K', 'S', 'M', 'E', 'T', 'A' };
+       struct device *device = crypt_metadata_device(cd);
+       void *buf = NULL;
+
+       if (posix_memalign(&buf, crypt_getpagesize(), sizeof(LM_MAGIC)))
+               return -ENOMEM;
+
+       devfd = device_open(cd, device, O_RDONLY);
+       if (devfd < 0) {
+               free(buf);
+               return -EIO;
+       }
+
+       /* Note: we must not detect failure as problem here, header can be trimmed. */
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device), device_alignment(device),
+               buf, sizeof(LM_MAGIC), luks1_size) == (ssize_t)sizeof(LM_MAGIC) &&
+               !memcmp(LM_MAGIC, buf, sizeof(LM_MAGIC))) {
+                       log_err(cd, _("Unable to convert header with LUKSMETA additional metadata."));
+                       r = -EBUSY;
+       }
+
+       free(buf);
+       return r;
+}
+
+/* Convert LUKS1 -> LUKS2 */
+int LUKS2_luks1_to_luks2(struct crypt_device *cd, struct luks_phdr *hdr1, struct luks2_hdr *hdr2)
+{
+       int r;
+       json_object *jobj = NULL;
+       size_t buf_size, buf_offset, luks1_size, luks1_shift = 2 * LUKS2_HDR_16K_LEN - LUKS_ALIGN_KEYSLOTS;
+       uint64_t required_size, max_size = crypt_get_data_offset(cd) * SECTOR_SIZE;
+
+       /* for detached headers max size == device size */
+       if (!max_size && (r = device_size(crypt_metadata_device(cd), &max_size)))
+               return r;
+
+       luks1_size = LUKS_device_sectors(hdr1) << SECTOR_SHIFT;
+       luks1_size = size_round_up(luks1_size, LUKS_ALIGN_KEYSLOTS);
+       if (!luks1_size)
+               return -EINVAL;
+
+       if (LUKS_keyslots_offset(hdr1) != (LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE)) {
+               log_dbg(cd, "Unsupported keyslots material offset: %zu.", LUKS_keyslots_offset(hdr1));
+               return -EINVAL;
+       }
+
+       if (luksmeta_header_present(cd, luks1_size))
+               return -EINVAL;
+
+       log_dbg(cd, "Max size: %" PRIu64 ", LUKS1 (full) header size %zu , required shift: %zu",
+               max_size, luks1_size, luks1_shift);
+
+       required_size = luks1_size + luks1_shift;
+
+       if ((max_size < required_size) &&
+           device_fallocate(crypt_metadata_device(cd), required_size)) {
+               log_err(cd, _("Unable to move keyslot area. Not enough space."));
+               return -EINVAL;
+       }
+
+       if (max_size < required_size)
+               max_size = required_size;
+
+       r = json_luks1_object(hdr1, &jobj, max_size - 2 * LUKS2_HDR_16K_LEN);
+       if (r < 0)
+               return r;
+
+       move_keyslot_offset(jobj, luks1_shift);
+
+       // fill hdr2
+       memset(hdr2, 0, sizeof(*hdr2));
+       hdr2->hdr_size = LUKS2_HDR_16K_LEN;
+       hdr2->seqid = 1;
+       hdr2->version = 2;
+       strncpy(hdr2->checksum_alg, "sha256", LUKS2_CHECKSUM_ALG_L);
+       crypt_random_get(cd, (char*)hdr2->salt1, sizeof(hdr2->salt1), CRYPT_RND_SALT);
+       crypt_random_get(cd, (char*)hdr2->salt2, sizeof(hdr2->salt2), CRYPT_RND_SALT);
+       strncpy(hdr2->uuid, crypt_get_uuid(cd), LUKS2_UUID_L-1); /* UUID should be max 36 chars */
+       hdr2->jobj = jobj;
+
+       /*
+        * It duplicates check in LUKS2_hdr_write() but we don't want to move
+        * keyslot areas in case it would fail later
+        */
+       if (max_size < LUKS2_hdr_and_areas_size(hdr2->jobj)) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       /* check future LUKS2 metadata before moving keyslots area */
+       if (LUKS2_hdr_validate(cd, hdr2->jobj, hdr2->hdr_size - LUKS2_HDR_BIN_LEN)) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       if ((r = luks_header_in_use(cd))) {
+               if (r > 0)
+                       r = -EBUSY;
+               goto out;
+       }
+
+       // move keyslots 4k -> 32k offset
+       buf_offset = 2 * LUKS2_HDR_16K_LEN;
+       buf_size   = luks1_size - LUKS_ALIGN_KEYSLOTS;
+
+       /* check future LUKS2 keyslots area is at least as large as LUKS1 keyslots area */
+       if (buf_size > LUKS2_keyslots_size(hdr2->jobj)) {
+               log_err(cd, _("Unable to move keyslot area. LUKS2 keyslots area too small."));
+               r = -EINVAL;
+               goto out;
+       }
+
+       if ((r = move_keyslot_areas(cd, 8 * SECTOR_SIZE, buf_offset, buf_size)) < 0) {
+               log_err(cd, _("Unable to move keyslot area."));
+               goto out;
+       }
+
+       // Write JSON hdr2
+       r = LUKS2_hdr_write(cd, hdr2);
+out:
+       LUKS2_hdr_free(cd, hdr2);
+
+       return r;
+}
+
+static int keyslot_LUKS1_compatible(struct crypt_device *cd, struct luks2_hdr *hdr,
+                                   int keyslot, uint32_t key_size, const char *hash)
+{
+       json_object *jobj_keyslot, *jobj, *jobj_kdf, *jobj_af;
+       uint64_t l2_offset, l2_length;
+       size_t ks_key_size;
+       const char *ks_cipher, *data_cipher;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
+       if (!jobj_keyslot)
+               return 1;
+
+       if (!json_object_object_get_ex(jobj_keyslot, "type", &jobj) ||
+           strcmp(json_object_get_string(jobj), "luks2"))
+               return 0;
+
+       /* Using PBKDF2, this implies memory and parallel is not used. */
+       jobj = NULL;
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf) ||
+           !json_object_object_get_ex(jobj_kdf, "type", &jobj) ||
+           strcmp(json_object_get_string(jobj), CRYPT_KDF_PBKDF2) ||
+           !json_object_object_get_ex(jobj_kdf, "hash", &jobj) ||
+           strcmp(json_object_get_string(jobj), hash))
+               return 0;
+
+       jobj = NULL;
+       if (!json_object_object_get_ex(jobj_keyslot, "af", &jobj_af) ||
+           !json_object_object_get_ex(jobj_af, "stripes", &jobj) ||
+           json_object_get_int(jobj) != LUKS_STRIPES)
+               return 0;
+
+       jobj = NULL;
+       if (!json_object_object_get_ex(jobj_af, "hash", &jobj) ||
+           (crypt_hash_size(json_object_get_string(jobj)) < 0) ||
+           strcmp(json_object_get_string(jobj), hash))
+               return 0;
+
+       /* FIXME: should this go to validation code instead (aka invalid luks2 header if assigned to segment 0)? */
+       /* FIXME: check all keyslots are assigned to segment id 0, and segments count == 1 */
+       ks_cipher = LUKS2_get_keyslot_cipher(hdr, keyslot, &ks_key_size);
+       data_cipher = LUKS2_get_cipher(hdr, CRYPT_DEFAULT_SEGMENT);
+       if (!ks_cipher || !data_cipher || key_size != ks_key_size || strcmp(ks_cipher, data_cipher)) {
+               log_dbg(cd, "Cipher in keyslot %d is different from volume key encryption.", keyslot);
+               return 0;
+       }
+
+       if (LUKS2_keyslot_area(hdr, keyslot, &l2_offset, &l2_length))
+               return 0;
+
+       if (l2_length != (size_round_up(AF_split_sectors(key_size, LUKS_STRIPES) * SECTOR_SIZE, 4096))) {
+               log_dbg(cd, "Area length in LUKS2 keyslot (%d) is not compatible with LUKS1", keyslot);
+               return 0;
+       }
+
+       return 1;
+}
+
+/* Convert LUKS2 -> LUKS1 */
+int LUKS2_luks2_to_luks1(struct crypt_device *cd, struct luks2_hdr *hdr2, struct luks_phdr *hdr1)
+{
+       size_t buf_size, buf_offset;
+       char cipher[LUKS_CIPHERNAME_L-1], cipher_mode[LUKS_CIPHERMODE_L-1];
+       char digest[LUKS_DIGESTSIZE], digest_salt[LUKS_SALTSIZE];
+       const char *hash;
+       size_t len;
+       json_object *jobj_keyslot, *jobj_digest, *jobj_segment, *jobj_kdf, *jobj_area, *jobj1, *jobj2;
+       uint32_t key_size;
+       int i, r, last_active = 0;
+       uint64_t offset, area_length;
+       char buf[256], luksMagic[] = LUKS_MAGIC;
+
+       jobj_digest  = LUKS2_get_digest_jobj(hdr2, 0);
+       if (!jobj_digest)
+               return -EINVAL;
+
+       jobj_segment = LUKS2_get_segment_jobj(hdr2, CRYPT_DEFAULT_SEGMENT);
+       if (!jobj_segment)
+               return -EINVAL;
+
+       if (json_segment_get_sector_size(jobj_segment) != SECTOR_SIZE) {
+               log_err(cd, _("Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."));
+               return -EINVAL;
+       }
+
+       json_object_object_get_ex(hdr2->jobj, "digests", &jobj1);
+       if (!json_object_object_get_ex(jobj_digest, "type", &jobj2) ||
+           strcmp(json_object_get_string(jobj2), "pbkdf2") ||
+           json_object_object_length(jobj1) != 1) {
+               log_err(cd, _("Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."));
+               return -EINVAL;
+       }
+       if (!json_object_object_get_ex(jobj_digest, "hash", &jobj2))
+               return -EINVAL;
+       hash = json_object_get_string(jobj2);
+
+       r = crypt_parse_name_and_mode(LUKS2_get_cipher(hdr2, CRYPT_DEFAULT_SEGMENT), cipher, NULL, cipher_mode);
+       if (r < 0)
+               return r;
+
+       if (crypt_cipher_wrapped_key(cipher, cipher_mode)) {
+               log_err(cd, _("Cannot convert to LUKS1 format - device uses wrapped key cipher %s."), cipher);
+               return -EINVAL;
+       }
+
+       r = LUKS2_tokens_count(hdr2);
+       if (r < 0)
+               return r;
+       if (r > 0) {
+               log_err(cd, _("Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."), r);
+               return -EINVAL;
+       }
+
+       r = LUKS2_get_volume_key_size(hdr2, 0);
+       if (r < 0)
+               return -EINVAL;
+       key_size = r;
+
+       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++) {
+               if (LUKS2_keyslot_info(hdr2, i) == CRYPT_SLOT_INACTIVE)
+                       continue;
+
+               if (LUKS2_keyslot_info(hdr2, i) == CRYPT_SLOT_INVALID) {
+                       log_err(cd, _("Cannot convert to LUKS1 format - keyslot %u is in invalid state."), i);
+                       return -EINVAL;
+               }
+
+               if (i >= LUKS_NUMKEYS) {
+                       log_err(cd, _("Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."), i);
+                       return -EINVAL;
+               }
+
+               if (!keyslot_LUKS1_compatible(cd, hdr2, i, key_size, hash)) {
+                       log_err(cd, _("Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."), i);
+                       return -EINVAL;
+               }
+       }
+
+       memset(hdr1, 0, sizeof(*hdr1));
+
+       for (i = 0; i < LUKS_NUMKEYS; i++) {
+               hdr1->keyblock[i].active = LUKS_KEY_DISABLED;
+               hdr1->keyblock[i].stripes = LUKS_STRIPES;
+
+               jobj_keyslot = LUKS2_get_keyslot_jobj(hdr2, i);
+
+               if (jobj_keyslot) {
+                       if (!json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+                               return -EINVAL;
+                       if (!json_object_object_get_ex(jobj_area, "offset", &jobj1))
+                               return -EINVAL;
+                       offset = crypt_jobj_get_uint64(jobj1);
+               } else {
+                       if (LUKS2_find_area_gap(cd, hdr2, key_size, &offset, &area_length))
+                               return -EINVAL;
+                       /*
+                        * We have to create placeholder luks2 keyslots in place of all
+                        * inactive keyslots. Otherwise we would allocate all
+                        * inactive luks1 keyslots over same binary keyslot area.
+                        */
+                       if (placeholder_keyslot_alloc(cd, i, offset, area_length, key_size))
+                               return -EINVAL;
+               }
+
+               offset /= SECTOR_SIZE;
+               if (offset > UINT32_MAX)
+                       return -EINVAL;
+
+               hdr1->keyblock[i].keyMaterialOffset = offset;
+               hdr1->keyblock[i].keyMaterialOffset -=
+                               ((2 * LUKS2_HDR_16K_LEN - LUKS_ALIGN_KEYSLOTS) / SECTOR_SIZE);
+
+               if (!jobj_keyslot)
+                       continue;
+
+               hdr1->keyblock[i].active = LUKS_KEY_ENABLED;
+               last_active = i;
+
+               if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf))
+                       continue;
+
+               if (!json_object_object_get_ex(jobj_kdf, "iterations", &jobj1))
+                       continue;
+               hdr1->keyblock[i].passwordIterations = crypt_jobj_get_uint32(jobj1);
+
+               if (!json_object_object_get_ex(jobj_kdf, "salt", &jobj1))
+                       continue;
+               len = sizeof(buf);
+               memset(buf, 0, len);
+               if (!base64_decode(json_object_get_string(jobj1),
+                                  json_object_get_string_len(jobj1), buf, &len))
+                       continue;
+               if (len > 0 && len != LUKS_SALTSIZE)
+                       continue;
+               memcpy(hdr1->keyblock[i].passwordSalt, buf, LUKS_SALTSIZE);
+       }
+
+       if (!jobj_keyslot) {
+               jobj_keyslot = LUKS2_get_keyslot_jobj(hdr2, last_active);
+               if (!jobj_keyslot)
+                       return -EINVAL;
+       }
+
+       if (!json_object_object_get_ex(jobj_keyslot, "area", &jobj_area))
+               return -EINVAL;
+       if (!json_object_object_get_ex(jobj_area, "encryption", &jobj1))
+               return -EINVAL;
+       r = crypt_parse_name_and_mode(json_object_get_string(jobj1), cipher, NULL, cipher_mode);
+       if (r < 0)
+               return r;
+
+       strncpy(hdr1->cipherName, cipher, sizeof(hdr1->cipherName) - 1);
+       strncpy(hdr1->cipherMode, cipher_mode, sizeof(hdr1->cipherMode) - 1);
+
+       if (!json_object_object_get_ex(jobj_keyslot, "kdf", &jobj_kdf))
+               return -EINVAL;
+       if (!json_object_object_get_ex(jobj_kdf, "hash", &jobj1))
+               return -EINVAL;
+       strncpy(hdr1->hashSpec, json_object_get_string(jobj1), sizeof(hdr1->hashSpec) - 1);
+
+       hdr1->keyBytes = key_size;
+
+       if (!json_object_object_get_ex(jobj_digest, "iterations", &jobj1))
+               return -EINVAL;
+       hdr1->mkDigestIterations = crypt_jobj_get_uint32(jobj1);
+
+       if (!json_object_object_get_ex(jobj_digest, "digest", &jobj1))
+               return -EINVAL;
+       len = sizeof(digest);
+       if (!base64_decode(json_object_get_string(jobj1),
+                          json_object_get_string_len(jobj1), digest, &len))
+               return -EINVAL;
+       /* We can store full digest here, not only sha1 length */
+       if (len < LUKS_DIGESTSIZE)
+               return -EINVAL;
+       memcpy(hdr1->mkDigest, digest, LUKS_DIGESTSIZE);
+
+       if (!json_object_object_get_ex(jobj_digest, "salt", &jobj1))
+               return -EINVAL;
+       len = sizeof(digest_salt);
+       if (!base64_decode(json_object_get_string(jobj1),
+                          json_object_get_string_len(jobj1), digest_salt, &len))
+               return -EINVAL;
+       if (len != LUKS_SALTSIZE)
+               return -EINVAL;
+       memcpy(hdr1->mkDigestSalt, digest_salt, LUKS_SALTSIZE);
+
+       if (!json_object_object_get_ex(jobj_segment, "offset", &jobj1))
+               return -EINVAL;
+       offset = crypt_jobj_get_uint64(jobj1) / SECTOR_SIZE;
+       if (offset > UINT32_MAX)
+               return -EINVAL;
+       /* FIXME: LUKS1 requires offset == 0 || offset >= luks1_hdr_size */
+       hdr1->payloadOffset = offset;
+
+       strncpy(hdr1->uuid, hdr2->uuid, UUID_STRING_L); /* max 36 chars */
+       hdr1->uuid[UUID_STRING_L-1] = '\0';
+
+       memcpy(hdr1->magic, luksMagic, LUKS_MAGIC_L);
+
+       hdr1->version = 1;
+
+       r = luks_header_in_use(cd);
+       if (r)
+               return r > 0 ? -EBUSY : r;
+
+       // move keyslots 32k -> 4k offset
+       buf_offset = 2 * LUKS2_HDR_16K_LEN;
+       buf_size   = LUKS2_keyslots_size(hdr2->jobj);
+       r = move_keyslot_areas(cd, buf_offset, 8 * SECTOR_SIZE, buf_size);
+       if (r < 0) {
+               log_err(cd, _("Unable to move keyslot area."));
+               return r;
+       }
+
+       crypt_wipe_device(cd, crypt_metadata_device(cd), CRYPT_WIPE_ZERO, 0,
+                         8 * SECTOR_SIZE, 8 * SECTOR_SIZE, NULL, NULL);
+
+       // Write LUKS1 hdr
+       return LUKS_write_phdr(hdr1, cd);
+}
diff --git a/lib/luks2/luks2_reencrypt.c b/lib/luks2/luks2_reencrypt.c
new file mode 100644 (file)
index 0000000..68d3194
--- /dev/null
@@ -0,0 +1,3445 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, reencryption helpers
+ *
+ * Copyright (C) 2015-2020, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2015-2020, Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+#include "utils_device_locking.h"
+
+static json_object *reencrypt_segment(struct luks2_hdr *hdr, unsigned new)
+{
+       return LUKS2_get_segment_by_flag(hdr, new ? "backup-final" : "backup-previous");
+}
+
+static json_object *reencrypt_segment_new(struct luks2_hdr *hdr)
+{
+       return reencrypt_segment(hdr, 1);
+}
+
+static json_object *reencrypt_segment_old(struct luks2_hdr *hdr)
+{
+       return reencrypt_segment(hdr, 0);
+}
+
+static const char *reencrypt_segment_cipher_new(struct luks2_hdr *hdr)
+{
+       return json_segment_get_cipher(reencrypt_segment(hdr, 1));
+}
+
+static const char *reencrypt_segment_cipher_old(struct luks2_hdr *hdr)
+{
+       return json_segment_get_cipher(reencrypt_segment(hdr, 0));
+}
+
+static int reencrypt_get_sector_size_new(struct luks2_hdr *hdr)
+{
+       return json_segment_get_sector_size(reencrypt_segment(hdr, 1));
+}
+
+static int reencrypt_get_sector_size_old(struct luks2_hdr *hdr)
+{
+       return json_segment_get_sector_size(reencrypt_segment(hdr, 0));
+}
+
+static uint64_t reencrypt_data_offset(struct luks2_hdr *hdr, unsigned new)
+{
+       json_object *jobj = reencrypt_segment(hdr, new);
+       if (jobj)
+               return json_segment_get_offset(jobj, 0);
+
+       return LUKS2_get_data_offset(hdr) << SECTOR_SHIFT;
+}
+
+static uint64_t LUKS2_reencrypt_get_data_offset_moved(struct luks2_hdr *hdr)
+{
+       json_object *jobj_segment = LUKS2_get_segment_by_flag(hdr, "backup-moved-segment");
+
+       if (!jobj_segment)
+               return 0;
+
+       return json_segment_get_offset(jobj_segment, 0);
+}
+
+static uint64_t reencrypt_get_data_offset_new(struct luks2_hdr *hdr)
+{
+       return reencrypt_data_offset(hdr, 1);
+}
+
+static uint64_t reencrypt_get_data_offset_old(struct luks2_hdr *hdr)
+{
+       return reencrypt_data_offset(hdr, 0);
+}
+
+static int reencrypt_digest(struct luks2_hdr *hdr, unsigned new)
+{
+       int segment = LUKS2_get_segment_id_by_flag(hdr, new ? "backup-final" : "backup-previous");
+
+       if (segment < 0)
+               return segment;
+
+       return LUKS2_digest_by_segment(hdr, segment);
+}
+
+int LUKS2_reencrypt_digest_new(struct luks2_hdr *hdr)
+{
+       return reencrypt_digest(hdr, 1);
+}
+
+int LUKS2_reencrypt_digest_old(struct luks2_hdr *hdr)
+{
+       return reencrypt_digest(hdr, 0);
+}
+
+/* none, checksums, journal or shift */
+static const char *reencrypt_resilience_type(struct luks2_hdr *hdr)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj_type;
+       int ks = LUKS2_find_keyslot(hdr, "reencrypt");
+
+       if (ks < 0)
+               return NULL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, ks);
+
+       json_object_object_get_ex(jobj_keyslot, "area", &jobj_area);
+       if (!json_object_object_get_ex(jobj_area, "type", &jobj_type))
+               return NULL;
+
+       return json_object_get_string(jobj_type);
+}
+
+static const char *reencrypt_resilience_hash(struct luks2_hdr *hdr)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj_type, *jobj_hash;
+       int ks = LUKS2_find_keyslot(hdr, "reencrypt");
+
+       if (ks < 0)
+               return NULL;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, ks);
+
+       json_object_object_get_ex(jobj_keyslot, "area", &jobj_area);
+       if (!json_object_object_get_ex(jobj_area, "type", &jobj_type))
+               return NULL;
+       if (strcmp(json_object_get_string(jobj_type), "checksum"))
+               return NULL;
+       if (!json_object_object_get_ex(jobj_area, "hash", &jobj_hash))
+               return NULL;
+
+       return json_object_get_string(jobj_hash);
+}
+
+static uint32_t reencrypt_alignment(struct luks2_hdr *hdr)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj_type, *jobj_hash, *jobj_sector_size;
+       int ks = LUKS2_find_keyslot(hdr, "reencrypt");
+
+       if (ks < 0)
+               return 0;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, ks);
+
+       json_object_object_get_ex(jobj_keyslot, "area", &jobj_area);
+       if (!json_object_object_get_ex(jobj_area, "type", &jobj_type))
+               return 0;
+       if (strcmp(json_object_get_string(jobj_type), "checksum"))
+               return 0;
+       if (!json_object_object_get_ex(jobj_area, "hash", &jobj_hash))
+               return 0;
+       if (!json_object_object_get_ex(jobj_area, "sector_size", &jobj_sector_size))
+               return 0;
+
+       return crypt_jobj_get_uint32(jobj_sector_size);
+}
+
+static json_object *_enc_create_segments_shift_after(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct luks2_reenc_context *rh,
+       uint64_t data_offset)
+{
+       int reenc_seg, i = 0;
+       json_object *jobj_copy, *jobj_seg_new = NULL, *jobj_segs_post = json_object_new_object();
+       uint64_t tmp;
+
+       if (!rh->jobj_segs_hot || !jobj_segs_post)
+               goto err;
+
+       if (json_segments_count(rh->jobj_segs_hot) == 0)
+               return jobj_segs_post;
+
+       reenc_seg = json_segments_segment_in_reencrypt(rh->jobj_segs_hot);
+       if (reenc_seg < 0)
+               goto err;
+
+       while (i < reenc_seg) {
+               jobj_copy = json_segments_get_segment(rh->jobj_segs_hot, i);
+               if (!jobj_copy)
+                       goto err;
+               json_object_object_add_by_uint(jobj_segs_post, i++, json_object_get(jobj_copy));
+       }
+
+       if (json_object_copy(json_segments_get_segment(rh->jobj_segs_hot, reenc_seg + 1), &jobj_seg_new)) {
+               if (json_object_copy(json_segments_get_segment(rh->jobj_segs_hot, reenc_seg), &jobj_seg_new))
+                       goto err;
+               json_segment_remove_flag(jobj_seg_new, "in-reencryption");
+               tmp = rh->length;
+       } else {
+               json_object_object_add(jobj_seg_new, "offset", crypt_jobj_new_uint64(rh->offset + data_offset));
+               json_object_object_add(jobj_seg_new, "iv_tweak", crypt_jobj_new_uint64(rh->offset >> SECTOR_SHIFT));
+               tmp = json_segment_get_size(jobj_seg_new, 0) + rh->length;
+       }
+
+       /* alter size of new segment, reenc_seg == 0 we're finished */
+       json_object_object_add(jobj_seg_new, "size", reenc_seg > 0 ? crypt_jobj_new_uint64(tmp) : json_object_new_string("dynamic"));
+       json_object_object_add_by_uint(jobj_segs_post, reenc_seg, jobj_seg_new);
+
+       return jobj_segs_post;
+err:
+       json_object_put(jobj_segs_post);
+       return NULL;
+}
+
+static json_object *reencrypt_make_hot_segments_encrypt_shift(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct luks2_reenc_context *rh,
+       uint64_t data_offset)
+{
+       int sg, crypt_seg, i = 0;
+       uint64_t segment_size;
+       json_object *jobj_seg_shrunk, *jobj_seg_new, *jobj_copy, *jobj_enc_seg = NULL,
+                    *jobj_segs_hot = json_object_new_object();
+
+       if (!jobj_segs_hot)
+               return NULL;
+
+       crypt_seg = LUKS2_segment_by_type(hdr, "crypt");
+
+       /* FIXME: This is hack. Find proper way to fix it. */
+       sg = LUKS2_last_segment_by_type(hdr, "linear");
+       if (rh->offset && sg < 0)
+               goto err;
+       if (sg < 0)
+               return jobj_segs_hot;
+
+       jobj_enc_seg = json_segment_create_crypt(data_offset + rh->offset,
+                                                     rh->offset >> SECTOR_SHIFT,
+                                                     &rh->length,
+                                                     reencrypt_segment_cipher_new(hdr),
+                                                     reencrypt_get_sector_size_new(hdr),
+                                                     1);
+
+       while (i < sg) {
+               jobj_copy = LUKS2_get_segment_jobj(hdr, i);
+               if (!jobj_copy)
+                       goto err;
+               json_object_object_add_by_uint(jobj_segs_hot, i++, json_object_get(jobj_copy));
+       }
+
+       segment_size = LUKS2_segment_size(hdr, sg, 0);
+       if (segment_size > rh->length) {
+               jobj_seg_shrunk = NULL;
+               if (json_object_copy(LUKS2_get_segment_jobj(hdr, sg), &jobj_seg_shrunk))
+                       goto err;
+               json_object_object_add(jobj_seg_shrunk, "size", crypt_jobj_new_uint64(segment_size - rh->length));
+               json_object_object_add_by_uint(jobj_segs_hot, sg++, jobj_seg_shrunk);
+       }
+
+       json_object_object_add_by_uint(jobj_segs_hot, sg++, jobj_enc_seg);
+       jobj_enc_seg = NULL; /* see err: label */
+
+       /* first crypt segment after encryption ? */
+       if (crypt_seg >= 0) {
+               jobj_seg_new = LUKS2_get_segment_jobj(hdr, crypt_seg);
+               if (!jobj_seg_new)
+                       goto err;
+               json_object_object_add_by_uint(jobj_segs_hot, sg, json_object_get(jobj_seg_new));
+       }
+
+       return jobj_segs_hot;
+err:
+       json_object_put(jobj_enc_seg);
+       json_object_put(jobj_segs_hot);
+
+       return NULL;
+}
+
+static json_object *reencrypt_make_segment_new(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               const struct luks2_reenc_context *rh,
+               uint64_t data_offset,
+               uint64_t segment_offset,
+               uint64_t iv_offset,
+               const uint64_t *segment_length)
+{
+       switch (rh->mode) {
+       case CRYPT_REENCRYPT_REENCRYPT:
+       case CRYPT_REENCRYPT_ENCRYPT:
+               return json_segment_create_crypt(data_offset + segment_offset,
+                                                 crypt_get_iv_offset(cd) + (iv_offset >> SECTOR_SHIFT),
+                                                 segment_length,
+                                                 reencrypt_segment_cipher_new(hdr),
+                                                 reencrypt_get_sector_size_new(hdr), 0);
+       case CRYPT_REENCRYPT_DECRYPT:
+               return json_segment_create_linear(data_offset + segment_offset, segment_length, 0);
+       }
+
+       return NULL;
+}
+
+static json_object *reencrypt_make_post_segments_forward(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct luks2_reenc_context *rh,
+       uint64_t data_offset)
+{
+       int reenc_seg;
+       json_object *jobj_new_seg_after, *jobj_old_seg, *jobj_old_seg_copy = NULL,
+                   *jobj_segs_post = json_object_new_object();
+       uint64_t fixed_length = rh->offset + rh->length;
+
+       if (!rh->jobj_segs_hot || !jobj_segs_post)
+               goto err;
+
+       reenc_seg = json_segments_segment_in_reencrypt(rh->jobj_segs_hot);
+       if (reenc_seg < 0)
+               return NULL;
+
+       jobj_old_seg = json_segments_get_segment(rh->jobj_segs_hot, reenc_seg + 1);
+
+       /*
+        * if there's no old segment after reencryption, we're done.
+        * Set size to 'dynamic' again.
+        */
+       jobj_new_seg_after = reencrypt_make_segment_new(cd, hdr, rh, data_offset, 0, 0, jobj_old_seg ? &fixed_length : NULL);
+       if (!jobj_new_seg_after)
+               goto err;
+       json_object_object_add_by_uint(jobj_segs_post, 0, jobj_new_seg_after);
+
+       if (jobj_old_seg) {
+               if (rh->fixed_length) {
+                       if (json_object_copy(jobj_old_seg, &jobj_old_seg_copy))
+                               goto err;
+                       jobj_old_seg = jobj_old_seg_copy;
+                       fixed_length = rh->device_size - fixed_length;
+                       json_object_object_add(jobj_old_seg, "size", crypt_jobj_new_uint64(fixed_length));
+               } else
+                       json_object_get(jobj_old_seg);
+               json_object_object_add_by_uint(jobj_segs_post, 1, jobj_old_seg);
+       }
+
+       return jobj_segs_post;
+err:
+       json_object_put(jobj_segs_post);
+       return NULL;
+}
+
+static json_object *reencrypt_make_post_segments_backward(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct luks2_reenc_context *rh,
+       uint64_t data_offset)
+{
+       int reenc_seg;
+       uint64_t fixed_length;
+
+       json_object *jobj_new_seg_after, *jobj_old_seg,
+                   *jobj_segs_post = json_object_new_object();
+
+       if (!rh->jobj_segs_hot || !jobj_segs_post)
+               goto err;
+
+       reenc_seg = json_segments_segment_in_reencrypt(rh->jobj_segs_hot);
+       if (reenc_seg < 0)
+               return NULL;
+
+       jobj_old_seg = json_segments_get_segment(rh->jobj_segs_hot, reenc_seg - 1);
+       if (jobj_old_seg)
+               json_object_object_add_by_uint(jobj_segs_post, reenc_seg - 1, json_object_get(jobj_old_seg));
+       if (rh->fixed_length && rh->offset) {
+               fixed_length = rh->device_size - rh->offset;
+               jobj_new_seg_after = reencrypt_make_segment_new(cd, hdr, rh, data_offset, rh->offset, rh->offset, &fixed_length);
+       } else
+               jobj_new_seg_after = reencrypt_make_segment_new(cd, hdr, rh, data_offset, rh->offset, rh->offset, NULL);
+       if (!jobj_new_seg_after)
+               goto err;
+       json_object_object_add_by_uint(jobj_segs_post, reenc_seg, jobj_new_seg_after);
+
+       return jobj_segs_post;
+err:
+       json_object_put(jobj_segs_post);
+       return NULL;
+}
+
+static json_object *reencrypt_make_segment_reencrypt(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               const struct luks2_reenc_context *rh,
+               uint64_t data_offset,
+               uint64_t segment_offset,
+               uint64_t iv_offset,
+               const uint64_t *segment_length)
+{
+       switch (rh->mode) {
+       case CRYPT_REENCRYPT_REENCRYPT:
+       case CRYPT_REENCRYPT_ENCRYPT:
+               return json_segment_create_crypt(data_offset + segment_offset,
+                               crypt_get_iv_offset(cd) + (iv_offset >> SECTOR_SHIFT),
+                               segment_length,
+                               reencrypt_segment_cipher_new(hdr),
+                               reencrypt_get_sector_size_new(hdr), 1);
+       case CRYPT_REENCRYPT_DECRYPT:
+               return json_segment_create_linear(data_offset + segment_offset, segment_length, 1);
+       }
+
+       return NULL;
+}
+
+static json_object *reencrypt_make_segment_old(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               const struct luks2_reenc_context *rh,
+               uint64_t data_offset,
+               uint64_t segment_offset,
+               const uint64_t *segment_length)
+{
+       json_object *jobj_old_seg = NULL;
+
+       switch (rh->mode) {
+       case CRYPT_REENCRYPT_REENCRYPT:
+       case CRYPT_REENCRYPT_DECRYPT:
+               jobj_old_seg = json_segment_create_crypt(data_offset + segment_offset,
+                                                   crypt_get_iv_offset(cd) + (segment_offset >> SECTOR_SHIFT),
+                                                   segment_length,
+                                                   reencrypt_segment_cipher_old(hdr),
+                                                   reencrypt_get_sector_size_old(hdr),
+                                                   0);
+               break;
+       case CRYPT_REENCRYPT_ENCRYPT:
+               jobj_old_seg = json_segment_create_linear(data_offset + segment_offset, segment_length, 0);
+       }
+
+       return jobj_old_seg;
+}
+
+static json_object *reencrypt_make_hot_segments_forward(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               uint64_t device_size,
+               uint64_t data_offset)
+{
+       json_object *jobj_segs_hot, *jobj_reenc_seg, *jobj_old_seg, *jobj_new_seg;
+       uint64_t fixed_length, tmp = rh->offset + rh->length;
+       unsigned int sg = 0;
+
+       jobj_segs_hot = json_object_new_object();
+       if (!jobj_segs_hot)
+               return NULL;
+
+       if (rh->offset) {
+               jobj_new_seg = reencrypt_make_segment_new(cd, hdr, rh, data_offset, 0, 0, &rh->offset);
+               if (!jobj_new_seg)
+                       goto err;
+               json_object_object_add_by_uint(jobj_segs_hot, sg++, jobj_new_seg);
+       }
+
+       jobj_reenc_seg = reencrypt_make_segment_reencrypt(cd, hdr, rh, data_offset, rh->offset, rh->offset, &rh->length);
+       if (!jobj_reenc_seg)
+               goto err;
+
+       json_object_object_add_by_uint(jobj_segs_hot, sg++, jobj_reenc_seg);
+
+       if (tmp < device_size) {
+               fixed_length = device_size - tmp;
+               jobj_old_seg = reencrypt_make_segment_old(cd, hdr, rh, data_offset + rh->data_shift, rh->offset + rh->length, rh->fixed_length ? &fixed_length : NULL);
+               if (!jobj_old_seg)
+                       goto err;
+               json_object_object_add_by_uint(jobj_segs_hot, sg, jobj_old_seg);
+       }
+
+       return jobj_segs_hot;
+err:
+       json_object_put(jobj_segs_hot);
+       return NULL;
+}
+
+static json_object *reencrypt_make_hot_segments_backward(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               uint64_t device_size,
+               uint64_t data_offset)
+{
+       json_object *jobj_reenc_seg, *jobj_new_seg, *jobj_old_seg = NULL,
+                   *jobj_segs_hot = json_object_new_object();
+       int sg = 0;
+       uint64_t fixed_length, tmp = rh->offset + rh->length;
+
+       if (!jobj_segs_hot)
+               return NULL;
+
+       if (rh->offset) {
+               if (json_object_copy(LUKS2_get_segment_jobj(hdr, 0), &jobj_old_seg))
+                       goto err;
+               json_object_object_add(jobj_old_seg, "size", crypt_jobj_new_uint64(rh->offset));
+
+               json_object_object_add_by_uint(jobj_segs_hot, sg++, jobj_old_seg);
+       }
+
+       jobj_reenc_seg = reencrypt_make_segment_reencrypt(cd, hdr, rh, data_offset, rh->offset, rh->offset, &rh->length);
+       if (!jobj_reenc_seg)
+               goto err;
+
+       json_object_object_add_by_uint(jobj_segs_hot, sg++, jobj_reenc_seg);
+
+       if (tmp < device_size) {
+               fixed_length = device_size - tmp;
+               jobj_new_seg = reencrypt_make_segment_new(cd, hdr, rh, data_offset, rh->offset + rh->length, rh->offset + rh->length, rh->fixed_length ? &fixed_length : NULL);
+               if (!jobj_new_seg)
+                       goto err;
+               json_object_object_add_by_uint(jobj_segs_hot, sg, jobj_new_seg);
+       }
+
+       return jobj_segs_hot;
+err:
+       json_object_put(jobj_segs_hot);
+       return NULL;
+}
+
+static int reencrypt_make_hot_segments(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               uint64_t device_size,
+               uint64_t data_offset)
+{
+       rh->jobj_segs_hot = NULL;
+
+       if (rh->mode == CRYPT_REENCRYPT_ENCRYPT && rh->direction == CRYPT_REENCRYPT_BACKWARD &&
+           rh->data_shift && rh->jobj_segment_moved) {
+               log_dbg(cd, "Calculating hot segments for encryption with data move.");
+               rh->jobj_segs_hot = reencrypt_make_hot_segments_encrypt_shift(cd, hdr, rh, data_offset);
+       } else if (rh->direction == CRYPT_REENCRYPT_FORWARD) {
+               log_dbg(cd, "Calculating hot segments (forward direction).");
+               rh->jobj_segs_hot = reencrypt_make_hot_segments_forward(cd, hdr, rh, device_size, data_offset);
+       } else if (rh->direction == CRYPT_REENCRYPT_BACKWARD) {
+               log_dbg(cd, "Calculating hot segments (backward direction).");
+               rh->jobj_segs_hot = reencrypt_make_hot_segments_backward(cd, hdr, rh, device_size, data_offset);
+       }
+
+       return rh->jobj_segs_hot ? 0 : -EINVAL;
+}
+
+static int reencrypt_make_post_segments(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               uint64_t data_offset)
+{
+       rh->jobj_segs_post = NULL;
+
+       if (rh->mode == CRYPT_REENCRYPT_ENCRYPT && rh->direction == CRYPT_REENCRYPT_BACKWARD &&
+           rh->data_shift && rh->jobj_segment_moved) {
+               log_dbg(cd, "Calculating post segments for encryption with data move.");
+               rh->jobj_segs_post = _enc_create_segments_shift_after(cd, hdr, rh, data_offset);
+       } else if (rh->direction == CRYPT_REENCRYPT_FORWARD) {
+               log_dbg(cd, "Calculating post segments (forward direction).");
+               rh->jobj_segs_post = reencrypt_make_post_segments_forward(cd, hdr, rh, data_offset);
+       } else if (rh->direction == CRYPT_REENCRYPT_BACKWARD) {
+               log_dbg(cd, "Calculating segments (backward direction).");
+               rh->jobj_segs_post = reencrypt_make_post_segments_backward(cd, hdr, rh, data_offset);
+       }
+
+       return rh->jobj_segs_post ? 0 : -EINVAL;
+}
+
+static uint64_t reencrypt_data_shift(struct luks2_hdr *hdr)
+{
+       json_object *jobj_keyslot, *jobj_area, *jobj_data_shift;
+       int ks = LUKS2_find_keyslot(hdr, "reencrypt");
+
+       if (ks < 0)
+               return 0;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, ks);
+
+       json_object_object_get_ex(jobj_keyslot, "area", &jobj_area);
+       if (!json_object_object_get_ex(jobj_area, "shift_size", &jobj_data_shift))
+               return 0;
+
+       return crypt_jobj_get_uint64(jobj_data_shift);
+}
+
+static crypt_reencrypt_mode_info reencrypt_mode(struct luks2_hdr *hdr)
+{
+       const char *mode;
+       crypt_reencrypt_mode_info mi = CRYPT_REENCRYPT_REENCRYPT;
+       json_object *jobj_keyslot, *jobj_mode;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, LUKS2_find_keyslot(hdr, "reencrypt"));
+       if (!jobj_keyslot)
+               return mi;
+
+       json_object_object_get_ex(jobj_keyslot, "mode", &jobj_mode);
+       mode = json_object_get_string(jobj_mode);
+
+       /* validation enforces allowed values */
+       if (!strcmp(mode, "encrypt"))
+               mi = CRYPT_REENCRYPT_ENCRYPT;
+       else if (!strcmp(mode, "decrypt"))
+               mi = CRYPT_REENCRYPT_DECRYPT;
+
+       return mi;
+}
+
+static crypt_reencrypt_direction_info reencrypt_direction(struct luks2_hdr *hdr)
+{
+       const char *value;
+       json_object *jobj_keyslot, *jobj_mode;
+       crypt_reencrypt_direction_info di = CRYPT_REENCRYPT_FORWARD;
+
+       jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, LUKS2_find_keyslot(hdr, "reencrypt"));
+       if (!jobj_keyslot)
+               return di;
+
+       json_object_object_get_ex(jobj_keyslot, "direction", &jobj_mode);
+       value = json_object_get_string(jobj_mode);
+
+       /* validation enforces allowed values */
+       if (strcmp(value, "forward"))
+               di = CRYPT_REENCRYPT_BACKWARD;
+
+       return di;
+}
+
+typedef enum { REENC_OK = 0, REENC_ERR, REENC_ROLLBACK, REENC_FATAL } reenc_status_t;
+
+void LUKS2_reenc_context_free(struct crypt_device *cd, struct luks2_reenc_context *rh)
+{
+       if (!rh)
+               return;
+
+       if (rh->rp.type == REENC_PROTECTION_CHECKSUM) {
+               if (rh->rp.p.csum.ch) {
+                       crypt_hash_destroy(rh->rp.p.csum.ch);
+                       rh->rp.p.csum.ch = NULL;
+               }
+               if (rh->rp.p.csum.checksums) {
+                       memset(rh->rp.p.csum.checksums, 0, rh->rp.p.csum.checksums_len);
+                       free(rh->rp.p.csum.checksums);
+                       rh->rp.p.csum.checksums = NULL;
+               }
+       }
+
+       json_object_put(rh->jobj_segs_hot);
+       rh->jobj_segs_hot = NULL;
+       json_object_put(rh->jobj_segs_post);
+       rh->jobj_segs_post = NULL;
+       json_object_put(rh->jobj_segment_old);
+       rh->jobj_segment_old = NULL;
+       json_object_put(rh->jobj_segment_new);
+       rh->jobj_segment_new = NULL;
+       json_object_put(rh->jobj_segment_moved);
+       rh->jobj_segment_moved = NULL;
+
+       free(rh->reenc_buffer);
+       rh->reenc_buffer = NULL;
+       crypt_storage_wrapper_destroy(rh->cw1);
+       rh->cw1 = NULL;
+       crypt_storage_wrapper_destroy(rh->cw2);
+       rh->cw2 = NULL;
+
+       free(rh->device_name);
+       free(rh->overlay_name);
+       free(rh->hotzone_name);
+       crypt_drop_keyring_key(cd, rh->vks);
+       crypt_free_volume_key(rh->vks);
+       device_release_excl(cd, crypt_data_device(cd));
+       crypt_unlock_internal(cd, rh->reenc_lock);
+       free(rh);
+}
+
+static size_t reencrypt_get_alignment(struct crypt_device *cd,
+               struct luks2_hdr *hdr)
+{
+       int ss;
+       size_t alignment = device_block_size(cd, crypt_data_device(cd));
+
+       ss = reencrypt_get_sector_size_old(hdr);
+       if (ss > 0 && (size_t)ss > alignment)
+               alignment = ss;
+       ss = reencrypt_get_sector_size_new(hdr);
+       if (ss > 0 && (size_t)ss > alignment)
+               alignment = (size_t)ss;
+
+       return alignment;
+}
+
+/* returns void because it must not fail on valid LUKS2 header */
+static void _load_backup_segments(struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh)
+{
+       int segment = LUKS2_get_segment_id_by_flag(hdr, "backup-final");
+
+       if (segment >= 0) {
+               rh->jobj_segment_new = json_object_get(LUKS2_get_segment_jobj(hdr, segment));
+               rh->digest_new = LUKS2_digest_by_segment(hdr, segment);
+       } else {
+               rh->jobj_segment_new = NULL;
+               rh->digest_new = -ENOENT;
+       }
+
+       segment = LUKS2_get_segment_id_by_flag(hdr, "backup-previous");
+       if (segment >= 0) {
+               rh->jobj_segment_old = json_object_get(LUKS2_get_segment_jobj(hdr, segment));
+               rh->digest_old = LUKS2_digest_by_segment(hdr, segment);
+       } else {
+               rh->jobj_segment_old = NULL;
+               rh->digest_old = -ENOENT;
+       }
+
+       segment = LUKS2_get_segment_id_by_flag(hdr, "backup-moved-segment");
+       if (segment >= 0)
+               rh->jobj_segment_moved = json_object_get(LUKS2_get_segment_jobj(hdr, segment));
+       else
+               rh->jobj_segment_moved = NULL;
+}
+
+static int reencrypt_offset_backward_moved(struct luks2_hdr *hdr, json_object *jobj_segments, uint64_t *reencrypt_length, uint64_t data_shift, uint64_t *offset)
+{
+       uint64_t tmp, linear_length = 0;
+       int sg, segs = json_segments_count(jobj_segments);
+
+       /* find reencrypt offset with data shift */
+       for (sg = 0; sg < segs; sg++)
+               if (LUKS2_segment_is_type(hdr, sg, "linear"))
+                       linear_length += LUKS2_segment_size(hdr, sg, 0);
+
+       /* all active linear segments length */
+       if (linear_length) {
+               if (linear_length < data_shift)
+                       return -EINVAL;
+               tmp = linear_length - data_shift;
+               if (tmp && tmp < data_shift) {
+                       *offset = data_shift;
+                       *reencrypt_length = tmp;
+               } else
+                       *offset = tmp;
+               return 0;
+       }
+
+       if (segs == 1) {
+               *offset = 0;
+               return 0;
+       }
+
+       /* should be unreachable */
+
+       return -EINVAL;
+}
+
+static int _offset_forward(struct luks2_hdr *hdr, json_object *jobj_segments, uint64_t *offset)
+{
+       int segs = json_segments_count(jobj_segments);
+
+       if (segs == 1)
+               *offset = 0;
+       else if (segs == 2) {
+               *offset = json_segment_get_size(json_segments_get_segment(jobj_segments, 0), 0);
+               if (!*offset)
+                       return -EINVAL;
+       } else
+               return -EINVAL;
+
+       return 0;
+}
+
+static int _offset_backward(struct luks2_hdr *hdr, json_object *jobj_segments, uint64_t device_size, uint64_t *length, uint64_t *offset)
+{
+       int segs = json_segments_count(jobj_segments);
+       uint64_t tmp;
+
+       if (segs == 1) {
+               if (device_size < *length)
+                       *length = device_size;
+               *offset = device_size - *length;
+       } else if (segs == 2) {
+               tmp = json_segment_get_size(json_segments_get_segment(jobj_segments, 0), 0);
+               if (tmp < *length)
+                       *length = tmp;
+               *offset =  tmp - *length;
+       } else
+               return -EINVAL;
+
+       return 0;
+}
+
+/* must be always relative to data offset */
+/* the LUKS2 header MUST be valid */
+static int reencrypt_offset(struct luks2_hdr *hdr,
+               crypt_reencrypt_direction_info di,
+               uint64_t device_size,
+               uint64_t *reencrypt_length,
+               uint64_t *offset)
+{
+       int sg;
+       json_object *jobj_segments;
+       uint64_t data_shift = reencrypt_data_shift(hdr);
+
+       if (!offset)
+               return -EINVAL;
+
+       /* if there's segment in reencryption return directly offset of it */
+       json_object_object_get_ex(hdr->jobj, "segments", &jobj_segments);
+       sg = json_segments_segment_in_reencrypt(jobj_segments);
+       if (sg >= 0) {
+               *offset = LUKS2_segment_offset(hdr, sg, 0) - (reencrypt_get_data_offset_new(hdr));
+               return 0;
+       }
+
+       if (di == CRYPT_REENCRYPT_FORWARD)
+               return _offset_forward(hdr, jobj_segments, offset);
+       else if (di == CRYPT_REENCRYPT_BACKWARD) {
+               if (reencrypt_mode(hdr) == CRYPT_REENCRYPT_ENCRYPT &&
+                   LUKS2_get_segment_id_by_flag(hdr, "backup-moved-segment") >= 0)
+                       return reencrypt_offset_backward_moved(hdr, jobj_segments, reencrypt_length, data_shift, offset);
+               return _offset_backward(hdr, jobj_segments, device_size, reencrypt_length, offset);
+       }
+
+       return -EINVAL;
+}
+
+static uint64_t reencrypt_length(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               uint64_t keyslot_area_length,
+               uint64_t length_max)
+{
+       unsigned long dummy, optimal_alignment;
+       uint64_t length, soft_mem_limit;
+
+       if (rh->rp.type == REENC_PROTECTION_NONE)
+               length = length_max ?: LUKS2_DEFAULT_NONE_REENCRYPTION_LENGTH;
+       else if (rh->rp.type == REENC_PROTECTION_CHECKSUM)
+               length = (keyslot_area_length / rh->rp.p.csum.hash_size) * rh->alignment;
+       else if (rh->rp.type == REENC_PROTECTION_DATASHIFT)
+               return reencrypt_data_shift(hdr);
+       else
+               length = keyslot_area_length;
+
+       /* hard limit */
+       if (length > LUKS2_REENCRYPT_MAX_HOTZONE_LENGTH)
+               length = LUKS2_REENCRYPT_MAX_HOTZONE_LENGTH;
+
+       /* soft limit is 1/4 of system memory */
+       soft_mem_limit = crypt_getphysmemory_kb() << 8; /* multiply by (1024/4) */
+
+       if (soft_mem_limit && length > soft_mem_limit)
+               length = soft_mem_limit;
+
+       if (length_max && length > length_max)
+               length = length_max;
+
+       length -= (length % rh->alignment);
+
+       /* Emits error later */
+       if (!length)
+               return length;
+
+       device_topology_alignment(cd, crypt_data_device(cd), &optimal_alignment, &dummy, length);
+
+       /* we have to stick with encryption sector size alignment */
+       if (optimal_alignment % rh->alignment)
+               return length;
+
+       /* align to opt-io size only if remaining size allows it */
+       if (length > optimal_alignment)
+               length -= (length % optimal_alignment);
+
+       return length;
+}
+
+static int reencrypt_context_init(struct crypt_device *cd, struct luks2_hdr *hdr, struct luks2_reenc_context *rh, uint64_t device_size, const struct crypt_params_reencrypt *params)
+{
+       int r;
+       uint64_t dummy, area_length;
+
+       rh->reenc_keyslot = LUKS2_find_keyslot(hdr, "reencrypt");
+       if (rh->reenc_keyslot < 0)
+               return -EINVAL;
+       if (LUKS2_keyslot_area(hdr, rh->reenc_keyslot, &dummy, &area_length) < 0)
+               return -EINVAL;
+
+       rh->mode = reencrypt_mode(hdr);
+
+       rh->alignment = reencrypt_get_alignment(cd, hdr);
+       if (!rh->alignment)
+               return -EINVAL;
+
+       log_dbg(cd, "Hotzone size: %" PRIu64 ", device size: %" PRIu64 ", alignment: %zu.",
+               params->max_hotzone_size << SECTOR_SHIFT,
+               params->device_size << SECTOR_SHIFT, rh->alignment);
+
+       if ((params->max_hotzone_size << SECTOR_SHIFT) % rh->alignment) {
+               log_err(cd, _("Hotzone size must be multiple of calculated zone alignment (%zu bytes)."), rh->alignment);
+               return -EINVAL;
+       }
+
+       if ((params->device_size << SECTOR_SHIFT) % rh->alignment) {
+               log_err(cd, _("Device size must be multiple of calculated zone alignment (%zu bytes)."), rh->alignment);
+               return -EINVAL;
+       }
+
+       rh->direction = reencrypt_direction(hdr);
+
+       if (!strcmp(params->resilience, "datashift")) {
+               log_dbg(cd, "Initializing reencryption context with data_shift resilience.");
+               rh->rp.type = REENC_PROTECTION_DATASHIFT;
+               rh->data_shift = reencrypt_data_shift(hdr);
+       } else if (!strcmp(params->resilience, "journal")) {
+               log_dbg(cd, "Initializing reencryption context with journal resilience.");
+               rh->rp.type = REENC_PROTECTION_JOURNAL;
+       } else if (!strcmp(params->resilience, "checksum")) {
+               log_dbg(cd, "Initializing reencryption context with checksum resilience.");
+               rh->rp.type = REENC_PROTECTION_CHECKSUM;
+
+               r = snprintf(rh->rp.p.csum.hash,
+                       sizeof(rh->rp.p.csum.hash), "%s", params->hash);
+               if (r < 0 || (size_t)r >= sizeof(rh->rp.p.csum.hash)) {
+                       log_dbg(cd, "Invalid hash parameter");
+                       return -EINVAL;
+               }
+
+               if (crypt_hash_init(&rh->rp.p.csum.ch, params->hash)) {
+                       log_dbg(cd, "Failed to initialize checksum resilience hash %s", params->hash);
+                       return -EINVAL;
+               }
+
+               r = crypt_hash_size(params->hash);
+               if (r < 1) {
+                       log_dbg(cd, "Invalid hash size");
+                       return -EINVAL;
+               }
+               rh->rp.p.csum.hash_size = r;
+
+               rh->rp.p.csum.checksums_len = area_length;
+               if (posix_memalign(&rh->rp.p.csum.checksums, device_alignment(crypt_metadata_device(cd)),
+                                  rh->rp.p.csum.checksums_len))
+                       return -ENOMEM;
+       } else if (!strcmp(params->resilience, "none")) {
+               log_dbg(cd, "Initializing reencryption context with none resilience.");
+               rh->rp.type = REENC_PROTECTION_NONE;
+       } else {
+               log_err(cd, _("Unsupported resilience mode %s"), params->resilience);
+               return -EINVAL;
+       }
+
+       if (params->device_size) {
+               log_dbg(cd, "Switching reencryption to fixed size mode.");
+               device_size = params->device_size << SECTOR_SHIFT;
+               rh->fixed_length = true;
+       } else
+               rh->fixed_length = false;
+
+       rh->length = reencrypt_length(cd, hdr, rh, area_length, params->max_hotzone_size << SECTOR_SHIFT);
+       if (!rh->length) {
+               log_dbg(cd, "Invalid reencryption length.");
+               return -EINVAL;
+       }
+
+       if (reencrypt_offset(hdr, rh->direction, device_size, &rh->length, &rh->offset)) {
+               log_dbg(cd, "Failed to get reencryption offset.");
+               return -EINVAL;
+       }
+
+       if (rh->offset > device_size)
+               return -EINVAL;
+       if (rh->length > device_size - rh->offset)
+               rh->length = device_size - rh->offset;
+
+       log_dbg(cd, "reencrypt-direction: %s", rh->direction == CRYPT_REENCRYPT_FORWARD ? "forward" : "backward");
+
+       _load_backup_segments(hdr, rh);
+
+       if (rh->direction == CRYPT_REENCRYPT_BACKWARD)
+               rh->progress = device_size - rh->offset - rh->length;
+       else
+               rh->progress = rh->offset;
+
+       log_dbg(cd, "backup-previous digest id: %d", rh->digest_old);
+       log_dbg(cd, "backup-final digest id: %d", rh->digest_new);
+       log_dbg(cd, "reencrypt length: %" PRIu64, rh->length);
+       log_dbg(cd, "reencrypt offset: %" PRIu64, rh->offset);
+       log_dbg(cd, "reencrypt shift: %s%" PRIu64, (rh->data_shift && rh->direction == CRYPT_REENCRYPT_BACKWARD ? "-" : ""), rh->data_shift);
+       log_dbg(cd, "reencrypt alignment: %zu", rh->alignment);
+       log_dbg(cd, "reencrypt progress: %" PRIu64, rh->progress);
+
+       rh->device_size = device_size;
+
+       return rh->length < 512 ? -EINVAL : 0;
+}
+
+static size_t reencrypt_buffer_length(struct luks2_reenc_context *rh)
+{
+       if (rh->data_shift)
+               return rh->data_shift;
+       return rh->length;
+}
+
+static int reencrypt_load_clean(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       uint64_t device_size,
+       struct luks2_reenc_context **rh,
+       const struct crypt_params_reencrypt *params)
+{
+       int r;
+       const struct crypt_params_reencrypt hdr_reenc_params = {
+               .resilience = reencrypt_resilience_type(hdr),
+               .hash = reencrypt_resilience_hash(hdr),
+               .device_size = params ? params->device_size : 0
+       };
+       struct luks2_reenc_context *tmp = crypt_zalloc(sizeof (*tmp));
+
+       if (!tmp)
+               return -ENOMEM;
+
+       r = -EINVAL;
+       if (!hdr_reenc_params.resilience)
+               goto err;
+
+       /* skip context update if data shift is detected in header */
+       if (!strcmp(hdr_reenc_params.resilience, "datashift"))
+               params = NULL;
+
+       log_dbg(cd, "Initializing reencryption context (%s).", params ? "update" : "load");
+
+       if (!params || !params->resilience)
+               params = &hdr_reenc_params;
+
+       r = reencrypt_context_init(cd, hdr, tmp, device_size, params);
+       if (r)
+               goto err;
+
+       if (posix_memalign(&tmp->reenc_buffer, device_alignment(crypt_data_device(cd)),
+                          reencrypt_buffer_length(tmp))) {
+               r = -ENOMEM;
+               goto err;
+       }
+
+       *rh = tmp;
+
+       return 0;
+err:
+       LUKS2_reenc_context_free(cd, tmp);
+
+       return r;
+}
+
+static int reencrypt_make_segments(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct luks2_reenc_context *rh,
+       uint64_t device_size)
+{
+       int r;
+       uint64_t data_offset = reencrypt_get_data_offset_new(hdr);
+
+       log_dbg(cd, "Calculating segments.");
+
+       r = reencrypt_make_hot_segments(cd, hdr, rh, device_size, data_offset);
+       if (!r) {
+               r = reencrypt_make_post_segments(cd, hdr, rh, data_offset);
+               if (r)
+                       json_object_put(rh->jobj_segs_hot);
+       }
+
+       if (r)
+               log_dbg(cd, "Failed to make reencryption segments.");
+
+       return r;
+}
+
+static int reencrypt_make_segments_crashed(struct crypt_device *cd,
+                               struct luks2_hdr *hdr,
+                               struct luks2_reenc_context *rh)
+{
+       int r;
+       uint64_t data_offset = crypt_get_data_offset(cd) << SECTOR_SHIFT;
+
+       if (!rh)
+               return -EINVAL;
+
+       rh->jobj_segs_hot = json_object_new_object();
+       if (!rh->jobj_segs_hot)
+               return -ENOMEM;
+
+       json_object_object_foreach(LUKS2_get_segments_jobj(hdr), key, val) {
+               if (json_segment_is_backup(val))
+                       continue;
+               json_object_object_add(rh->jobj_segs_hot, key, json_object_get(val));
+       }
+
+       r = reencrypt_make_post_segments(cd, hdr, rh, data_offset);
+       if (r) {
+               json_object_put(rh->jobj_segs_hot);
+               rh->jobj_segs_hot = NULL;
+       }
+
+       return r;
+}
+
+static int reencrypt_load_crashed(struct crypt_device *cd,
+       struct luks2_hdr *hdr, uint64_t device_size, struct luks2_reenc_context **rh)
+{
+       bool dynamic;
+       uint64_t minimal_size;
+       int r, reenc_seg;
+       struct crypt_params_reencrypt params = {};
+
+       if (LUKS2_get_data_size(hdr, &minimal_size, &dynamic))
+               return -EINVAL;
+
+       if (!dynamic)
+               params.device_size = minimal_size >> SECTOR_SHIFT;
+
+       r = reencrypt_load_clean(cd, hdr, device_size, rh, &params);
+
+       if (!r) {
+               reenc_seg = json_segments_segment_in_reencrypt(LUKS2_get_segments_jobj(hdr));
+               if (reenc_seg < 0)
+                       r = -EINVAL;
+               else
+                       (*rh)->length = LUKS2_segment_size(hdr, reenc_seg, 0);
+       }
+
+       if (!r && ((*rh)->rp.type == REENC_PROTECTION_CHECKSUM)) {
+               /* we have to override calculated alignment with value stored in mda */
+               (*rh)->alignment = reencrypt_alignment(hdr);
+               if (!(*rh)->alignment) {
+                       log_dbg(cd, "Failed to get read resilience sector_size from metadata.");
+                       r = -EINVAL;
+               }
+       }
+
+       if (!r)
+               r = reencrypt_make_segments_crashed(cd, hdr, *rh);
+
+       if (r) {
+               LUKS2_reenc_context_free(cd, *rh);
+               *rh = NULL;
+       }
+       return r;
+}
+
+static int reencrypt_init_storage_wrappers(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               struct volume_key *vks)
+{
+       int r;
+       struct volume_key *vk;
+       uint32_t wrapper_flags = (getuid() || geteuid()) ? 0 : DISABLE_KCAPI;
+
+       vk = crypt_volume_key_by_id(vks, rh->digest_old);
+       r = crypt_storage_wrapper_init(cd, &rh->cw1, crypt_data_device(cd),
+                       reencrypt_get_data_offset_old(hdr),
+                       crypt_get_iv_offset(cd),
+                       reencrypt_get_sector_size_old(hdr),
+                       reencrypt_segment_cipher_old(hdr),
+                       vk, wrapper_flags | OPEN_READONLY);
+       if (r) {
+               log_err(cd, _("Failed to initialize old segment storage wrapper."));
+               return r;
+       }
+       rh->wflags1 = wrapper_flags | OPEN_READONLY;
+       log_dbg(cd, "Old cipher storage wrapper type: %d.", crypt_storage_wrapper_get_type(rh->cw1));
+
+       vk = crypt_volume_key_by_id(vks, rh->digest_new);
+       r = crypt_storage_wrapper_init(cd, &rh->cw2, crypt_data_device(cd),
+                       reencrypt_get_data_offset_new(hdr),
+                       crypt_get_iv_offset(cd),
+                       reencrypt_get_sector_size_new(hdr),
+                       reencrypt_segment_cipher_new(hdr),
+                       vk, wrapper_flags);
+       if (r) {
+               log_err(cd, _("Failed to initialize new segment storage wrapper."));
+               return r;
+       }
+       rh->wflags2 = wrapper_flags;
+       log_dbg(cd, "New cipher storage wrapper type: %d", crypt_storage_wrapper_get_type(rh->cw2));
+
+       return 0;
+}
+
+static int reencrypt_context_set_names(struct luks2_reenc_context *rh, const char *name)
+{
+       if (!rh | !name)
+               return -EINVAL;
+
+       if (*name == '/') {
+               if (!(rh->device_name = dm_device_name(name)))
+                       return -EINVAL;
+       } else if (!(rh->device_name = strdup(name)))
+               return -ENOMEM;
+
+       if (asprintf(&rh->hotzone_name, "%s-hotzone-%s", rh->device_name,
+                    rh->direction == CRYPT_REENCRYPT_FORWARD ? "forward" : "backward") < 0) {
+               rh->hotzone_name = NULL;
+               return -ENOMEM;
+       }
+       if (asprintf(&rh->overlay_name, "%s-overlay", rh->device_name) < 0) {
+               rh->overlay_name = NULL;
+               return -ENOMEM;
+       }
+
+       rh->online = true;
+       return 0;
+}
+
+static int modify_offset(uint64_t *offset, uint64_t data_shift, crypt_reencrypt_direction_info di)
+{
+       int r = -EINVAL;
+
+       if (!offset)
+               return r;
+
+       if (di == CRYPT_REENCRYPT_FORWARD) {
+               if (*offset >= data_shift) {
+                       *offset -= data_shift;
+                       r = 0;
+               }
+       } else if (di == CRYPT_REENCRYPT_BACKWARD) {
+               *offset += data_shift;
+               r = 0;
+       }
+
+       return r;
+}
+
+static int reencrypt_update_flag(struct crypt_device *cd, int enable, bool commit)
+{
+       uint32_t reqs;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       if (LUKS2_config_get_requirements(cd, hdr, &reqs))
+               return -EINVAL;
+
+       /* nothing to do */
+       if (enable && (reqs & CRYPT_REQUIREMENT_ONLINE_REENCRYPT))
+               return -EINVAL;
+
+       /* nothing to do */
+       if (!enable && !(reqs & CRYPT_REQUIREMENT_ONLINE_REENCRYPT))
+               return -EINVAL;
+
+       if (enable)
+               reqs |= CRYPT_REQUIREMENT_ONLINE_REENCRYPT;
+       else
+               reqs &= ~CRYPT_REQUIREMENT_ONLINE_REENCRYPT;
+
+       log_dbg(cd, "Going to %s reencryption requirement flag.", enable ? "store" : "wipe");
+
+       return LUKS2_config_set_requirements(cd, hdr, reqs, commit);
+}
+
+static int reencrypt_recover_segment(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct luks2_reenc_context *rh,
+       struct volume_key *vks)
+{
+       struct volume_key *vk_old, *vk_new;
+       size_t count, s;
+       ssize_t read, w;
+       unsigned resilience;
+       uint64_t area_offset, area_length, area_length_read, crash_iv_offset,
+                data_offset = crypt_get_data_offset(cd) << SECTOR_SHIFT;
+       int devfd, r, new_sector_size, old_sector_size, rseg = json_segments_segment_in_reencrypt(rh->jobj_segs_hot);
+       char *checksum_tmp = NULL, *data_buffer = NULL;
+       struct crypt_storage_wrapper *cw1 = NULL, *cw2 = NULL;
+
+       resilience = rh->rp.type;
+
+       if (rseg < 0 || rh->length < 512)
+               return -EINVAL;
+
+       vk_new = crypt_volume_key_by_id(vks, rh->digest_new);
+       if (!vk_new && rh->mode != CRYPT_REENCRYPT_DECRYPT)
+               return -EINVAL;
+       vk_old = crypt_volume_key_by_id(vks, rh->digest_old);
+       if (!vk_old && rh->mode != CRYPT_REENCRYPT_ENCRYPT)
+               return -EINVAL;
+       old_sector_size = json_segment_get_sector_size(reencrypt_segment_old(hdr));
+       new_sector_size = json_segment_get_sector_size(reencrypt_segment_new(hdr));
+       if (rh->mode == CRYPT_REENCRYPT_DECRYPT)
+               crash_iv_offset = rh->offset >> SECTOR_SHIFT; /* TODO: + old iv_tweak */
+       else
+               crash_iv_offset = json_segment_get_iv_offset(json_segments_get_segment(rh->jobj_segs_hot, rseg));
+
+       log_dbg(cd, "crash_offset: %" PRIu64 ", crash_length: %" PRIu64 ",  crash_iv_offset: %" PRIu64, data_offset + rh->offset, rh->length, crash_iv_offset);
+
+       r = crypt_storage_wrapper_init(cd, &cw2, crypt_data_device(cd),
+                       data_offset + rh->offset, crash_iv_offset, new_sector_size,
+                       reencrypt_segment_cipher_new(hdr), vk_new, 0);
+       if (r) {
+               log_err(cd, _("Failed to initialize new segment storage wrapper."));
+               return r;
+       }
+
+       if (LUKS2_keyslot_area(hdr, rh->reenc_keyslot, &area_offset, &area_length)) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       if (posix_memalign((void**)&data_buffer, device_alignment(crypt_data_device(cd)), rh->length)) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       switch (resilience) {
+       case  REENC_PROTECTION_CHECKSUM:
+               log_dbg(cd, "Checksums based recovery.");
+
+               r = crypt_storage_wrapper_init(cd, &cw1, crypt_data_device(cd),
+                               data_offset + rh->offset, crash_iv_offset, old_sector_size,
+                               reencrypt_segment_cipher_old(hdr), vk_old, 0);
+               if (r) {
+                       log_err(cd, _("Failed to initialize old segment storage wrapper."));
+                       goto out;
+               }
+
+               count = rh->length / rh->alignment;
+               area_length_read = count * rh->rp.p.csum.hash_size;
+               if (area_length_read > area_length) {
+                       log_dbg(cd, "Internal error in calculated area_length.");
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               checksum_tmp = malloc(rh->rp.p.csum.hash_size);
+               if (!checksum_tmp) {
+                       r = -ENOMEM;
+                       goto out;
+               }
+
+               /* TODO: lock for read */
+               devfd = device_open(cd, crypt_metadata_device(cd), O_RDONLY);
+               if (devfd < 0)
+                       goto out;
+
+               /* read old data checksums */
+               read = read_lseek_blockwise(devfd, device_block_size(cd, crypt_metadata_device(cd)),
+                                       device_alignment(crypt_metadata_device(cd)), rh->rp.p.csum.checksums, area_length_read, area_offset);
+               if (read < 0 || (size_t)read != area_length_read) {
+                       log_err(cd, _("Failed to read checksums for current hotzone."));
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               read = crypt_storage_wrapper_read(cw2, 0, data_buffer, rh->length);
+               if (read < 0 || (size_t)read != rh->length) {
+                       log_err(cd, _("Failed to read hotzone area starting at %" PRIu64 "."), rh->offset + data_offset);
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               for (s = 0; s < count; s++) {
+                       if (crypt_hash_write(rh->rp.p.csum.ch, data_buffer + (s * rh->alignment), rh->alignment)) {
+                               log_dbg(cd, "Failed to write hash.");
+                               r = EINVAL;
+                               goto out;
+                       }
+                       if (crypt_hash_final(rh->rp.p.csum.ch, checksum_tmp, rh->rp.p.csum.hash_size)) {
+                               log_dbg(cd, "Failed to finalize hash.");
+                               r = EINVAL;
+                               goto out;
+                       }
+                       if (!memcmp(checksum_tmp, (char *)rh->rp.p.csum.checksums + (s * rh->rp.p.csum.hash_size), rh->rp.p.csum.hash_size)) {
+                               log_dbg(cd, "Sector %zu (size %zu, offset %zu) needs recovery", s, rh->alignment, s * rh->alignment);
+                               if (crypt_storage_wrapper_decrypt(cw1, s * rh->alignment, data_buffer + (s * rh->alignment), rh->alignment)) {
+                                       log_err(cd, _("Failed to decrypt sector %zu."), s);
+                                       r = -EINVAL;
+                                       goto out;
+                               }
+                               w = crypt_storage_wrapper_encrypt_write(cw2, s * rh->alignment, data_buffer + (s * rh->alignment), rh->alignment);
+                               if (w < 0 || (size_t)w != rh->alignment) {
+                                       log_err(cd, _("Failed to recover sector %zu."), s);
+                                       r = -EINVAL;
+                                       goto out;
+                               }
+                       }
+               }
+
+               r = 0;
+               break;
+       case  REENC_PROTECTION_JOURNAL:
+               log_dbg(cd, "Journal based recovery.");
+
+               /* FIXME: validation candidate */
+               if (rh->length > area_length) {
+                       r = -EINVAL;
+                       log_dbg(cd, "Invalid journal size.");
+                       goto out;
+               }
+
+               /* TODO locking */
+               r = crypt_storage_wrapper_init(cd, &cw1, crypt_metadata_device(cd),
+                               area_offset, crash_iv_offset, old_sector_size,
+                               reencrypt_segment_cipher_old(hdr), vk_old, 0);
+               if (r) {
+                       log_err(cd, _("Failed to initialize old segment storage wrapper."));
+                       goto out;
+               }
+               read = crypt_storage_wrapper_read_decrypt(cw1, 0, data_buffer, rh->length);
+               if (read < 0 || (size_t)read != rh->length) {
+                       log_dbg(cd, "Failed to read journaled data.");
+                       r = -EIO;
+                       /* may content plaintext */
+                       crypt_safe_memzero(data_buffer, rh->length);
+                       goto out;
+               }
+               read = crypt_storage_wrapper_encrypt_write(cw2, 0, data_buffer, rh->length);
+               /* may content plaintext */
+               crypt_safe_memzero(data_buffer, rh->length);
+               if (read < 0 || (size_t)read != rh->length) {
+                       log_dbg(cd, "recovery write failed.");
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               r = 0;
+               break;
+       case  REENC_PROTECTION_DATASHIFT:
+               log_dbg(cd, "Data shift based recovery.");
+
+               if (rseg == 0) {
+                       r = crypt_storage_wrapper_init(cd, &cw1, crypt_data_device(cd),
+                                       json_segment_get_offset(rh->jobj_segment_moved, 0), 0, 0,
+                                       reencrypt_segment_cipher_old(hdr), NULL, 0);
+               } else
+                       r = crypt_storage_wrapper_init(cd, &cw1, crypt_data_device(cd),
+                                       data_offset + rh->offset - rh->data_shift, 0, 0,
+                                       reencrypt_segment_cipher_old(hdr), NULL, 0);
+               if (r) {
+                       log_err(cd, _("Failed to initialize old segment storage wrapper."));
+                       goto out;
+               }
+
+               read = crypt_storage_wrapper_read_decrypt(cw1, 0, data_buffer, rh->length);
+               if (read < 0 || (size_t)read != rh->length) {
+                       log_dbg(cd, "Failed to read data.");
+                       r = -EIO;
+                       /* may content plaintext */
+                       crypt_safe_memzero(data_buffer, rh->length);
+                       goto out;
+               }
+
+               read = crypt_storage_wrapper_encrypt_write(cw2, 0, data_buffer, rh->length);
+               /* may content plaintext */
+               crypt_safe_memzero(data_buffer, rh->length);
+               if (read < 0 || (size_t)read != rh->length) {
+                       log_dbg(cd, "recovery write failed.");
+                       r = -EINVAL;
+                       goto out;
+               }
+               r = 0;
+               break;
+       default:
+               r = -EINVAL;
+       }
+
+       if (!r)
+               rh->read = rh->length;
+out:
+       free(data_buffer);
+       free(checksum_tmp);
+       crypt_storage_wrapper_destroy(cw1);
+       crypt_storage_wrapper_destroy(cw2);
+
+       return r;
+}
+
+static int reencrypt_add_moved_segment(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh)
+{
+       int s = LUKS2_segment_first_unused_id(hdr);
+
+       if (!rh->jobj_segment_moved)
+               return 0;
+
+       if (s < 0)
+               return s;
+
+       if (json_object_object_add_by_uint(LUKS2_get_segments_jobj(hdr), s, json_object_get(rh->jobj_segment_moved))) {
+               json_object_put(rh->jobj_segment_moved);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int reencrypt_add_backup_segment(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               unsigned final)
+{
+       int digest, s = LUKS2_segment_first_unused_id(hdr);
+       json_object *jobj;
+
+       if (s < 0)
+               return s;
+
+       digest = final ? rh->digest_new : rh->digest_old;
+       jobj = final ? rh->jobj_segment_new : rh->jobj_segment_old;
+
+       if (json_object_object_add_by_uint(LUKS2_get_segments_jobj(hdr), s, json_object_get(jobj))) {
+               json_object_put(jobj);
+               return -EINVAL;
+       }
+
+       if (strcmp(json_segment_type(jobj), "crypt"))
+               return 0;
+
+       return LUKS2_digest_segment_assign(cd, hdr, s, digest, 1, 0);
+}
+
+static int reencrypt_assign_segments_simple(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       struct luks2_reenc_context *rh,
+       unsigned hot,
+       unsigned commit)
+{
+       int r, sg;
+
+       if (hot && json_segments_count(rh->jobj_segs_hot) > 0) {
+               log_dbg(cd, "Setting 'hot' segments.");
+
+               r = LUKS2_segments_set(cd, hdr, rh->jobj_segs_hot, 0);
+               if (!r)
+                       rh->jobj_segs_hot = NULL;
+       } else if (!hot && json_segments_count(rh->jobj_segs_post) > 0) {
+               log_dbg(cd, "Setting 'post' segments.");
+               r = LUKS2_segments_set(cd, hdr, rh->jobj_segs_post, 0);
+               if (!r)
+                       rh->jobj_segs_post = NULL;
+       } else {
+               log_dbg(cd, "No segments to set.");
+               return -EINVAL;
+       }
+
+       if (r) {
+               log_dbg(cd, "Failed to assign new enc segments.");
+               return r;
+       }
+
+       r = reencrypt_add_backup_segment(cd, hdr, rh, 0);
+       if (r) {
+               log_dbg(cd, "Failed to assign reencryption previous backup segment.");
+               return r;
+       }
+
+       r = reencrypt_add_backup_segment(cd, hdr, rh, 1);
+       if (r) {
+               log_dbg(cd, "Failed to assign reencryption final backup segment.");
+               return r;
+       }
+
+       r = reencrypt_add_moved_segment(cd, hdr, rh);
+       if (r) {
+               log_dbg(cd, "Failed to assign reencryption moved backup segment.");
+               return r;
+       }
+
+       for (sg = 0; sg < LUKS2_segments_count(hdr); sg++) {
+               if (LUKS2_segment_is_type(hdr, sg, "crypt") &&
+                   LUKS2_digest_segment_assign(cd, hdr, sg, rh->mode == CRYPT_REENCRYPT_ENCRYPT ? rh->digest_new : rh->digest_old, 1, 0)) {
+                       log_dbg(cd, "Failed to assign digest %u to segment %u.", rh->digest_new, sg);
+                       return -EINVAL;
+               }
+       }
+
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+}
+
+static int reencrypt_assign_segments(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               unsigned hot,
+               unsigned commit)
+{
+       bool forward;
+       int rseg, scount, r = -EINVAL;
+
+       /* FIXME: validate in reencrypt context load */
+       if (rh->digest_new < 0 && rh->mode != CRYPT_REENCRYPT_DECRYPT)
+               return -EINVAL;
+
+       if (LUKS2_digest_segment_assign(cd, hdr, CRYPT_ANY_SEGMENT, CRYPT_ANY_DIGEST, 0, 0))
+               return -EINVAL;
+
+       if (rh->mode == CRYPT_REENCRYPT_ENCRYPT || rh->mode == CRYPT_REENCRYPT_DECRYPT)
+               return reencrypt_assign_segments_simple(cd, hdr, rh, hot, commit);
+
+       if (hot && rh->jobj_segs_hot) {
+               log_dbg(cd, "Setting 'hot' segments.");
+
+               r = LUKS2_segments_set(cd, hdr, rh->jobj_segs_hot, 0);
+               if (!r)
+                       rh->jobj_segs_hot = NULL;
+       } else if (!hot && rh->jobj_segs_post) {
+               log_dbg(cd, "Setting 'post' segments.");
+               r = LUKS2_segments_set(cd, hdr, rh->jobj_segs_post, 0);
+               if (!r)
+                       rh->jobj_segs_post = NULL;
+       }
+
+       if (r)
+               return r;
+
+       scount = LUKS2_segments_count(hdr);
+
+       /* segment in reencryption has to hold reference on both digests */
+       rseg = json_segments_segment_in_reencrypt(LUKS2_get_segments_jobj(hdr));
+       if (rseg < 0 && hot)
+               return -EINVAL;
+
+       if (rseg >= 0) {
+               LUKS2_digest_segment_assign(cd, hdr, rseg, rh->digest_new, 1, 0);
+               LUKS2_digest_segment_assign(cd, hdr, rseg, rh->digest_old, 1, 0);
+       }
+
+       forward = (rh->direction == CRYPT_REENCRYPT_FORWARD);
+       if (hot) {
+               if (rseg > 0)
+                       LUKS2_digest_segment_assign(cd, hdr, 0, forward ? rh->digest_new : rh->digest_old, 1, 0);
+               if (scount > rseg + 1)
+                       LUKS2_digest_segment_assign(cd, hdr, rseg + 1, forward ? rh->digest_old : rh->digest_new, 1, 0);
+       } else {
+               LUKS2_digest_segment_assign(cd, hdr, 0, forward || scount == 1 ? rh->digest_new : rh->digest_old, 1, 0);
+               if (scount > 1)
+                       LUKS2_digest_segment_assign(cd, hdr, 1, forward ? rh->digest_old : rh->digest_new, 1, 0);
+       }
+
+       r = reencrypt_add_backup_segment(cd, hdr, rh, 0);
+       if (r) {
+               log_dbg(cd, "Failed to assign hot reencryption backup segment.");
+               return r;
+       }
+       r = reencrypt_add_backup_segment(cd, hdr, rh, 1);
+       if (r) {
+               log_dbg(cd, "Failed to assign post reencryption backup segment.");
+               return r;
+       }
+
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+}
+
+static int reencrypt_set_encrypt_segments(struct crypt_device *cd, struct luks2_hdr *hdr, uint64_t dev_size, uint64_t data_shift, bool move_first_segment, crypt_reencrypt_direction_info di)
+{
+       int r;
+       uint64_t first_segment_offset, first_segment_length,
+                second_segment_offset, second_segment_length,
+                data_offset = LUKS2_get_data_offset(hdr) << SECTOR_SHIFT;
+       json_object *jobj_segment_first = NULL, *jobj_segment_second = NULL, *jobj_segments;
+
+       if (dev_size < data_shift)
+               return -EINVAL;
+
+       if (data_shift && (di == CRYPT_REENCRYPT_FORWARD))
+               return -ENOTSUP;
+
+       if (move_first_segment) {
+               /*
+                * future data_device layout:
+                * [future LUKS2 header (data shift size)][second data segment][gap (data shift size)][first data segment (data shift size)]
+                */
+               first_segment_offset = dev_size;
+               first_segment_length = data_shift;
+               second_segment_offset = data_shift;
+               second_segment_length = dev_size - 2 * data_shift;
+       } else if (data_shift) {
+               first_segment_offset = data_offset;
+               first_segment_length = dev_size;
+       } else {
+               /* future data_device layout with detached header: [first data segment] */
+               first_segment_offset = data_offset;
+               first_segment_length = 0; /* dynamic */
+       }
+
+       jobj_segments = json_object_new_object();
+       if (!jobj_segments)
+               return -ENOMEM;
+
+       r = -EINVAL;
+       if (move_first_segment) {
+               jobj_segment_first =  json_segment_create_linear(first_segment_offset, &first_segment_length, 0);
+               if (second_segment_length &&
+                   !(jobj_segment_second = json_segment_create_linear(second_segment_offset, &second_segment_length, 0))) {
+                       log_dbg(cd, "Failed generate 2nd segment.");
+                       goto err;
+               }
+       } else
+               jobj_segment_first =  json_segment_create_linear(first_segment_offset, first_segment_length ? &first_segment_length : NULL, 0);
+
+       if (!jobj_segment_first) {
+               log_dbg(cd, "Failed generate 1st segment.");
+               goto err;
+       }
+
+       json_object_object_add(jobj_segments, "0", jobj_segment_first);
+       if (jobj_segment_second)
+               json_object_object_add(jobj_segments, "1", jobj_segment_second);
+
+       r = LUKS2_digest_segment_assign(cd, hdr, CRYPT_ANY_SEGMENT, CRYPT_ANY_DIGEST, 0, 0);
+
+       if (!r)
+               r = LUKS2_segments_set(cd, hdr, jobj_segments, 0);
+err:
+       return r;
+}
+
+static int reencrypt_make_targets(struct crypt_device *cd,
+                               struct luks2_hdr *hdr,
+                               struct device *hz_device,
+                               struct volume_key *vks,
+                               struct dm_target *result,
+                               uint64_t size)
+{
+       bool reenc_seg;
+       struct volume_key *vk;
+       uint64_t segment_size, segment_offset, segment_start = 0;
+       int r;
+       int s = 0;
+       json_object *jobj, *jobj_segments = LUKS2_get_segments_jobj(hdr);
+
+       while (result) {
+               jobj = json_segments_get_segment(jobj_segments, s);
+               if (!jobj) {
+                       log_dbg(cd, "Internal error. Segment %u is null.", s);
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               reenc_seg = (s == json_segments_segment_in_reencrypt(jobj_segments));
+
+               segment_offset = json_segment_get_offset(jobj, 1);
+               segment_size = json_segment_get_size(jobj, 1);
+               /* 'dynamic' length allowed in last segment only */
+               if (!segment_size && !result->next)
+                       segment_size = (size >> SECTOR_SHIFT) - segment_start;
+               if (!segment_size) {
+                       log_dbg(cd, "Internal error. Wrong segment size %u", s);
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               if (!strcmp(json_segment_type(jobj), "crypt")) {
+                       vk = crypt_volume_key_by_id(vks, reenc_seg ? LUKS2_reencrypt_digest_new(hdr) : LUKS2_digest_by_segment(hdr, s));
+                       if (!vk) {
+                               log_err(cd, _("Missing key for dm-crypt segment %u"), s);
+                               r = -EINVAL;
+                               goto out;
+                       }
+
+                       if (reenc_seg)
+                               segment_offset -= crypt_get_data_offset(cd);
+
+                       r = dm_crypt_target_set(result, segment_start, segment_size,
+                                               reenc_seg ? hz_device : crypt_data_device(cd),
+                                               vk,
+                                               json_segment_get_cipher(jobj),
+                                               json_segment_get_iv_offset(jobj),
+                                               segment_offset,
+                                               "none",
+                                               0,
+                                               json_segment_get_sector_size(jobj));
+                       if (r) {
+                               log_err(cd, _("Failed to set dm-crypt segment."));
+                               goto out;
+                       }
+               } else if (!strcmp(json_segment_type(jobj), "linear")) {
+                       r = dm_linear_target_set(result, segment_start, segment_size, reenc_seg ? hz_device : crypt_data_device(cd), segment_offset);
+                       if (r) {
+                               log_err(cd, _("Failed to set dm-linear segment."));
+                               goto out;
+                       }
+               } else {
+                       r = -EINVAL;
+                       goto out;
+               }
+
+               segment_start += segment_size;
+               s++;
+               result = result->next;
+       }
+
+       return s;
+out:
+       return r;
+}
+
+/* GLOBAL FIXME: audit function names and parameters names */
+
+/* FIXME:
+ *     1) audit log routines
+ *     2) can't we derive hotzone device name from crypt context? (unlocked name, device uuid, etc?)
+ */
+static int reencrypt_load_overlay_device(struct crypt_device *cd, struct luks2_hdr *hdr,
+       const char *overlay, const char *hotzone, struct volume_key *vks, uint64_t size,
+       uint32_t flags)
+{
+       char hz_path[PATH_MAX];
+       int r;
+
+       struct device *hz_dev = NULL;
+       struct crypt_dm_active_device dmd = {
+               .flags = flags,
+       };
+
+       log_dbg(cd, "Loading new table for overlay device %s.", overlay);
+
+       r = snprintf(hz_path, PATH_MAX, "%s/%s", dm_get_dir(), hotzone);
+       if (r < 0 || r >= PATH_MAX) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       r = device_alloc(cd, &hz_dev, hz_path);
+       if (r)
+               goto out;
+
+       r = dm_targets_allocate(&dmd.segment, LUKS2_segments_count(hdr));
+       if (r)
+               goto out;
+
+       r = reencrypt_make_targets(cd, hdr, hz_dev, vks, &dmd.segment, size);
+       if (r < 0)
+               goto out;
+
+       r = dm_reload_device(cd, overlay, &dmd, 0, 0);
+
+       /* what else on error here ? */
+out:
+       dm_targets_free(cd, &dmd);
+       device_free(cd, hz_dev);
+
+       return r;
+}
+
+static int reencrypt_replace_device(struct crypt_device *cd, const char *target, const char *source, uint32_t flags)
+{
+       int r, exists = 1;
+       struct crypt_dm_active_device dmd_source, dmd_target = {};
+       uint32_t dmflags = DM_SUSPEND_SKIP_LOCKFS | DM_SUSPEND_NOFLUSH;
+
+       log_dbg(cd, "Replacing table in device %s with table from device %s.", target, source);
+
+       /* check only whether target device exists */
+       r = dm_status_device(cd, target);
+       if (r < 0) {
+               if (r == -ENODEV)
+                       exists = 0;
+               else
+                       return r;
+       }
+
+       r = dm_query_device(cd, source, DM_ACTIVE_DEVICE | DM_ACTIVE_CRYPT_CIPHER |
+                           DM_ACTIVE_CRYPT_KEYSIZE | DM_ACTIVE_CRYPT_KEY, &dmd_source);
+
+       if (r < 0)
+               return r;
+
+       if (exists && ((r = dm_query_device(cd, target, 0, &dmd_target)) < 0))
+               goto err;
+
+       dmd_source.flags |= flags;
+       dmd_source.uuid = crypt_get_uuid(cd);
+
+       if (exists) {
+               if (dmd_target.size != dmd_source.size) {
+                       log_err(cd, _("Source and target device sizes don't match. Source %" PRIu64 ", target: %" PRIu64 "."),
+                               dmd_source.size, dmd_target.size);
+                       r = -EINVAL;
+                       goto err;
+               }
+               r = dm_reload_device(cd, target, &dmd_source, 0, 0);
+               if (!r) {
+                       log_dbg(cd, "Resuming device %s", target);
+                       r = dm_resume_device(cd, target, dmflags | act2dmflags(dmd_source.flags));
+               }
+       } else
+               r = dm_create_device(cd, target, CRYPT_SUBDEV, &dmd_source);
+err:
+       dm_targets_free(cd, &dmd_source);
+       dm_targets_free(cd, &dmd_target);
+
+       return r;
+}
+
+static int reencrypt_swap_backing_device(struct crypt_device *cd, const char *name,
+                             const char *new_backend_name)
+{
+       int r;
+       struct device *overlay_dev = NULL;
+       char overlay_path[PATH_MAX] = { 0 };
+       struct crypt_dm_active_device dmd = {};
+
+       log_dbg(cd, "Redirecting %s mapping to new backing device: %s.", name, new_backend_name);
+
+       r = snprintf(overlay_path, PATH_MAX, "%s/%s", dm_get_dir(), new_backend_name);
+       if (r < 0 || r >= PATH_MAX) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       r = device_alloc(cd, &overlay_dev, overlay_path);
+       if (r)
+               goto out;
+
+       r = device_block_adjust(cd, overlay_dev, DEV_OK,
+                               0, &dmd.size, &dmd.flags);
+       if (r)
+               goto out;
+
+       r = dm_linear_target_set(&dmd.segment, 0, dmd.size, overlay_dev, 0);
+       if (r)
+               goto out;
+
+       r = dm_reload_device(cd, name, &dmd, 0, 0);
+       if (!r) {
+               log_dbg(cd, "Resuming device %s", name);
+               r = dm_resume_device(cd, name, DM_SUSPEND_SKIP_LOCKFS | DM_SUSPEND_NOFLUSH);
+       }
+
+out:
+       dm_targets_free(cd, &dmd);
+       device_free(cd, overlay_dev);
+
+       return r;
+}
+
+static int reencrypt_activate_hotzone_device(struct crypt_device *cd, const char *name, uint64_t device_size, uint32_t flags)
+{
+       int r;
+       uint64_t new_offset = reencrypt_get_data_offset_new(crypt_get_hdr(cd, CRYPT_LUKS2)) >> SECTOR_SHIFT;
+
+       struct crypt_dm_active_device dmd = {
+               .flags = flags,
+               .uuid = crypt_get_uuid(cd),
+               .size = device_size >> SECTOR_SHIFT
+       };
+
+       log_dbg(cd, "Activating hotzone device %s.", name);
+
+       r = device_block_adjust(cd, crypt_data_device(cd), DEV_OK,
+                               new_offset, &dmd.size, &dmd.flags);
+       if (r)
+               goto err;
+
+       r = dm_linear_target_set(&dmd.segment, 0, dmd.size, crypt_data_device(cd), new_offset);
+       if (r)
+               goto err;
+
+       r = dm_create_device(cd, name, CRYPT_SUBDEV, &dmd);
+err:
+       dm_targets_free(cd, &dmd);
+
+       return r;
+}
+
+static int reencrypt_init_device_stack(struct crypt_device *cd,
+                                    const struct luks2_reenc_context *rh)
+{
+       int r;
+
+       /* Activate hotzone device 1:1 linear mapping to data_device */
+       r = reencrypt_activate_hotzone_device(cd, rh->hotzone_name, rh->device_size, CRYPT_ACTIVATE_PRIVATE);
+       if (r) {
+               log_err(cd, _("Failed to activate hotzone device %s."), rh->hotzone_name);
+               return r;
+       }
+
+       /*
+        * Activate overlay device with exactly same table as original 'name' mapping.
+        * Note that within this step the 'name' device may already include a table
+        * constructed from more than single dm-crypt segment. Therefore transfer
+        * mapping as is.
+        *
+        * If we're about to resume reencryption orig mapping has to be already validated for
+        * abrupt shutdown and rchunk_offset has to point on next chunk to reencrypt!
+        *
+        * TODO: in crypt_activate_by*
+        */
+       r = reencrypt_replace_device(cd, rh->overlay_name, rh->device_name, CRYPT_ACTIVATE_PRIVATE);
+       if (r) {
+               log_err(cd, _("Failed to activate overlay device %s with actual origin table."), rh->overlay_name);
+               goto err;
+       }
+
+       /* swap origin mapping to overlay device */
+       r = reencrypt_swap_backing_device(cd, rh->device_name, rh->overlay_name);
+       if (r) {
+               log_err(cd, _("Failed to load new mapping for device %s."), rh->device_name);
+               goto err;
+       }
+
+       /*
+        * Now the 'name' (unlocked luks) device is mapped via dm-linear to an overlay dev.
+        * The overlay device has a original live table of 'name' device in-before the swap.
+        */
+
+       return 0;
+err:
+       /* TODO: force error helper devices on error path */
+       dm_remove_device(cd, rh->overlay_name, 0);
+       dm_remove_device(cd, rh->hotzone_name, 0);
+
+       return r;
+}
+
+/* TODO:
+ *     1) audit error path. any error in this routine is fatal and should be unlikely.
+ *        usually it would hint some collision with another userspace process touching
+ *        dm devices directly.
+ */
+static int reenc_refresh_helper_devices(struct crypt_device *cd, const char *overlay, const char *hotzone)
+{
+       int r;
+
+       /*
+        * we have to explicitly suspend the overlay device before suspending
+        * the hotzone one. Resuming overlay device (aka switching tables) only
+        * after suspending the hotzone may lead to deadlock.
+        *
+        * In other words: always suspend the stack from top to bottom!
+        */
+       r = dm_suspend_device(cd, overlay, DM_SUSPEND_SKIP_LOCKFS | DM_SUSPEND_NOFLUSH);
+       if (r) {
+               log_err(cd, _("Failed to suspend device %s."), overlay);
+               return r;
+       }
+
+       /* suspend HZ device */
+       r = dm_suspend_device(cd, hotzone, DM_SUSPEND_SKIP_LOCKFS | DM_SUSPEND_NOFLUSH);
+       if (r) {
+               log_err(cd, _("Failed to suspend device %s."), hotzone);
+               return r;
+       }
+
+       /* resume overlay device: inactive table (with hotozne) -> live */
+       r = dm_resume_device(cd, overlay, DM_RESUME_PRIVATE);
+       if (r)
+               log_err(cd, _("Failed to resume device %s."), overlay);
+
+       return r;
+}
+
+static int reencrypt_refresh_overlay_devices(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               const char *overlay,
+               const char *hotzone,
+               struct volume_key *vks,
+               uint64_t device_size,
+               uint32_t flags)
+{
+       int r = reencrypt_load_overlay_device(cd, hdr, overlay, hotzone, vks, device_size, flags);
+       if (r) {
+               log_err(cd, _("Failed to reload device %s."), overlay);
+               return REENC_ERR;
+       }
+
+       r = reenc_refresh_helper_devices(cd, overlay, hotzone);
+       if (r) {
+               log_err(cd, _("Failed to refresh reencryption devices stack."));
+               return REENC_ROLLBACK;
+       }
+
+       return REENC_OK;
+}
+
+static int reencrypt_move_data(struct crypt_device *cd, int devfd, uint64_t data_shift)
+{
+       void *buffer;
+       int r;
+       ssize_t ret;
+       uint64_t buffer_len, offset;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       log_dbg(cd, "Going to move data from head of data device.");
+
+       buffer_len = data_shift;
+       if (!buffer_len)
+               return -EINVAL;
+
+       offset = json_segment_get_offset(LUKS2_get_segment_jobj(hdr, 0), 0);
+
+       /* this is nonsense anyway */
+       if (buffer_len != json_segment_get_size(LUKS2_get_segment_jobj(hdr, 0), 0)) {
+               log_dbg(cd, "buffer_len %" PRIu64", segment size %" PRIu64, buffer_len, json_segment_get_size(LUKS2_get_segment_jobj(hdr, 0), 0));
+               return -EINVAL;
+       }
+
+       if (posix_memalign(&buffer, device_alignment(crypt_data_device(cd)), buffer_len))
+               return -ENOMEM;
+
+       ret = read_lseek_blockwise(devfd,
+                       device_block_size(cd, crypt_data_device(cd)),
+                       device_alignment(crypt_data_device(cd)),
+                       buffer, buffer_len, 0);
+       if (ret < 0 || (uint64_t)ret != buffer_len) {
+               r = -EIO;
+               goto err;
+       }
+
+       log_dbg(cd, "Going to write %" PRIu64 " bytes at offset %" PRIu64, buffer_len, offset);
+       ret = write_lseek_blockwise(devfd,
+                       device_block_size(cd, crypt_data_device(cd)),
+                       device_alignment(crypt_data_device(cd)),
+                       buffer, buffer_len, offset);
+       if (ret < 0 || (uint64_t)ret != buffer_len) {
+               r = -EIO;
+               goto err;
+       }
+
+       r = 0;
+err:
+       memset(buffer, 0, buffer_len);
+       free(buffer);
+       return r;
+}
+
+static int reencrypt_make_backup_segments(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               int keyslot_new,
+               const char *cipher,
+               uint64_t data_offset,
+               const struct crypt_params_reencrypt *params)
+{
+       int r, segment, moved_segment = -1, digest_old = -1, digest_new = -1;
+       json_object *jobj_segment_new = NULL, *jobj_segment_old = NULL, *jobj_segment_bcp = NULL;
+       uint32_t sector_size = params->luks2 ? params->luks2->sector_size : SECTOR_SIZE;
+       uint64_t segment_offset, tmp, data_shift = params->data_shift << SECTOR_SHIFT;
+
+       if (params->mode != CRYPT_REENCRYPT_DECRYPT) {
+               digest_new = LUKS2_digest_by_keyslot(hdr, keyslot_new);
+               if (digest_new < 0)
+                       return -EINVAL;
+       }
+
+       if (params->mode != CRYPT_REENCRYPT_ENCRYPT) {
+               digest_old = LUKS2_digest_by_segment(hdr, CRYPT_DEFAULT_SEGMENT);
+               if (digest_old < 0)
+                       return -EINVAL;
+       }
+
+       segment = LUKS2_segment_first_unused_id(hdr);
+       if (segment < 0)
+               return -EINVAL;
+
+       if (params->mode == CRYPT_REENCRYPT_ENCRYPT &&
+           (params->flags & CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT)) {
+               json_object_copy(LUKS2_get_segment_jobj(hdr, 0), &jobj_segment_bcp);
+               r = LUKS2_segment_set_flag(jobj_segment_bcp, "backup-moved-segment");
+               if (r)
+                       goto err;
+               moved_segment = segment++;
+               json_object_object_add_by_uint(LUKS2_get_segments_jobj(hdr), moved_segment, jobj_segment_bcp);
+       }
+
+       /* FIXME: Add detection for case (digest old == digest new && old segment == new segment) */
+       if (digest_old >= 0)
+               json_object_copy(LUKS2_get_segment_jobj(hdr, CRYPT_DEFAULT_SEGMENT), &jobj_segment_old);
+       else if (params->mode == CRYPT_REENCRYPT_ENCRYPT) {
+               r = LUKS2_get_data_size(hdr, &tmp, NULL);
+               if (r)
+                       goto err;
+               jobj_segment_old = json_segment_create_linear(0, tmp ? &tmp : NULL, 0);
+       }
+
+       if (!jobj_segment_old) {
+               r = -EINVAL;
+               goto err;
+       }
+
+       r = LUKS2_segment_set_flag(jobj_segment_old, "backup-previous");
+       if (r)
+               goto err;
+       json_object_object_add_by_uint(LUKS2_get_segments_jobj(hdr), segment, jobj_segment_old);
+       jobj_segment_old = NULL;
+       if (digest_old >= 0)
+               LUKS2_digest_segment_assign(cd, hdr, segment, digest_old, 1, 0);
+       segment++;
+
+       if (digest_new >= 0) {
+               segment_offset = data_offset;
+               if (params->mode != CRYPT_REENCRYPT_ENCRYPT &&
+                   modify_offset(&segment_offset, data_shift, params->direction)) {
+                       r = -EINVAL;
+                       goto err;
+               }
+               jobj_segment_new = json_segment_create_crypt(segment_offset,
+                                                       crypt_get_iv_offset(cd),
+                                                       NULL, cipher, sector_size, 0);
+       } else if (params->mode == CRYPT_REENCRYPT_DECRYPT) {
+               segment_offset = data_offset;
+               if (modify_offset(&segment_offset, data_shift, params->direction)) {
+                       r = -EINVAL;
+                       goto err;
+               }
+               jobj_segment_new = json_segment_create_linear(segment_offset, NULL, 0);
+       }
+
+       if (!jobj_segment_new) {
+               r = -EINVAL;
+               goto err;
+       }
+
+       r = LUKS2_segment_set_flag(jobj_segment_new, "backup-final");
+       if (r)
+               goto err;
+       json_object_object_add_by_uint(LUKS2_get_segments_jobj(hdr), segment, jobj_segment_new);
+       jobj_segment_new = NULL;
+       if (digest_new >= 0)
+               LUKS2_digest_segment_assign(cd, hdr, segment, digest_new, 1, 0);
+
+       /* FIXME: also check occupied space by keyslot in shrunk area */
+       if (params->direction == CRYPT_REENCRYPT_FORWARD && data_shift &&
+           crypt_metadata_device(cd) == crypt_data_device(cd) &&
+           LUKS2_set_keyslots_size(cd, hdr, json_segment_get_offset(reencrypt_segment_new(hdr), 0))) {
+               log_err(cd, _("Failed to set new keyslots area size."));
+               r = -EINVAL;
+               goto err;
+       }
+
+       return 0;
+err:
+       json_object_put(jobj_segment_new);
+       json_object_put(jobj_segment_old);
+       return r;
+}
+
+static int reencrypt_verify_and_upload_keys(struct crypt_device *cd, struct luks2_hdr *hdr, int digest_old, int digest_new, struct volume_key *vks)
+{
+       int r;
+       struct volume_key *vk;
+
+       if (digest_new >= 0) {
+               vk = crypt_volume_key_by_id(vks, digest_new);
+               if (!vk)
+                       return -ENOENT;
+               else {
+                       if (LUKS2_digest_verify_by_digest(cd, hdr, digest_new, vk) != digest_new)
+                               return -EINVAL;
+
+                       if (crypt_use_keyring_for_vk(cd) &&
+                           (r = LUKS2_volume_key_load_in_keyring_by_digest(cd, hdr, vk, crypt_volume_key_get_id(vk))))
+                               return r;
+               }
+       }
+
+       if (digest_old >= 0 && digest_old != digest_new) {
+               vk = crypt_volume_key_by_id(vks, digest_old);
+               if (!vk) {
+                       r = -ENOENT;
+                       goto err;
+               } else {
+                       if (LUKS2_digest_verify_by_digest(cd, hdr, digest_old, vk) != digest_old) {
+                               r = -EINVAL;
+                               goto err;
+                       }
+                       if (crypt_use_keyring_for_vk(cd) &&
+                           (r = LUKS2_volume_key_load_in_keyring_by_digest(cd, hdr, vk, crypt_volume_key_get_id(vk))))
+                               goto err;
+               }
+       }
+
+       return 0;
+err:
+       crypt_drop_keyring_key(cd, vks);
+       return r;
+}
+
+/* This function must be called with metadata lock held */
+static int reencrypt_init(struct crypt_device *cd,
+               const char *name,
+               struct luks2_hdr *hdr,
+               const char *passphrase,
+               size_t passphrase_size,
+               int keyslot_old,
+               int keyslot_new,
+               const char *cipher,
+               const char *cipher_mode,
+               const struct crypt_params_reencrypt *params,
+               struct volume_key **vks)
+{
+       bool move_first_segment;
+       char _cipher[128];
+       uint32_t sector_size;
+       int r, reencrypt_keyslot, devfd = -1;
+       uint64_t data_offset, dev_size = 0;
+       struct crypt_dm_active_device dmd_target, dmd_source = {
+               .uuid = crypt_get_uuid(cd),
+               .flags = CRYPT_ACTIVATE_SHARED /* turn off exclusive open checks */
+       };
+
+       if (!params || params->mode > CRYPT_REENCRYPT_DECRYPT)
+               return -EINVAL;
+
+       if (params->mode != CRYPT_REENCRYPT_DECRYPT &&
+           (!params->luks2 || !(cipher && cipher_mode) || keyslot_new < 0))
+               return -EINVAL;
+
+       log_dbg(cd, "Initializing reencryption (mode: %s) in LUKS2 metadata.",
+                   crypt_reencrypt_mode_to_str(params->mode));
+
+       move_first_segment = (params->flags & CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT);
+
+       /* implicit sector size 512 for decryption */
+       sector_size = params->luks2 ? params->luks2->sector_size : SECTOR_SIZE;
+       if (sector_size < SECTOR_SIZE || sector_size > MAX_SECTOR_SIZE ||
+           NOTPOW2(sector_size)) {
+               log_err(cd, _("Unsupported encryption sector size."));
+               return -EINVAL;
+       }
+
+       if (!cipher_mode || *cipher_mode == '\0')
+               snprintf(_cipher, sizeof(_cipher), "%s", cipher);
+       else
+               snprintf(_cipher, sizeof(_cipher), "%s-%s", cipher, cipher_mode);
+
+       if (MISALIGNED(params->data_shift, sector_size >> SECTOR_SHIFT)) {
+               log_err(cd, _("Data shift is not aligned to requested encryption sector size (%" PRIu32 " bytes)."), sector_size);
+               return -EINVAL;
+       }
+
+       data_offset = LUKS2_get_data_offset(hdr) << SECTOR_SHIFT;
+
+       r = device_check_access(cd, crypt_data_device(cd), DEV_OK);
+       if (r)
+               return r;
+
+       r = device_check_size(cd, crypt_data_device(cd), data_offset, 1);
+       if (r)
+               return r;
+
+       r = device_size(crypt_data_device(cd), &dev_size);
+       if (r)
+               return r;
+
+       dev_size -= data_offset;
+
+       if (MISALIGNED(dev_size, sector_size)) {
+               log_err(cd, _("Data device is not aligned to requested encryption sector size (%" PRIu32 " bytes)."), sector_size);
+               return -EINVAL;
+       }
+
+       reencrypt_keyslot = LUKS2_keyslot_find_empty(hdr);
+       if (reencrypt_keyslot < 0) {
+               log_err(cd, _("All key slots full."));
+               return -EINVAL;
+       }
+
+       /*
+        * We must perform data move with exclusive open data device
+        * to exclude another cryptsetup process to colide with
+        * encryption initialization (or mount)
+        */
+       if (move_first_segment) {
+               if (dev_size < 2 * (params->data_shift << SECTOR_SHIFT)) {
+                       log_err(cd, _("Device %s is too small."), device_path(crypt_data_device(cd)));
+                       return -EINVAL;
+               }
+               if (params->data_shift < LUKS2_get_data_offset(hdr)) {
+                       log_err(cd, _("Data shift (%" PRIu64 " sectors) is less than future data offset (%" PRIu64 " sectors)."), params->data_shift, LUKS2_get_data_offset(hdr));
+                       return -EINVAL;
+               }
+               devfd = device_open_excl(cd, crypt_data_device(cd), O_RDWR);
+               if (devfd < 0) {
+                       if (devfd == -EBUSY)
+                               log_err(cd,_("Failed to open %s in exclusive mode (already mapped or mounted)."), device_path(crypt_data_device(cd)));
+                       return -EINVAL;
+               }
+       }
+
+       if (params->mode == CRYPT_REENCRYPT_ENCRYPT) {
+               /* in-memory only */
+               r = reencrypt_set_encrypt_segments(cd, hdr, dev_size, params->data_shift << SECTOR_SHIFT, move_first_segment, params->direction);
+               if (r)
+                       goto err;
+       }
+
+       r = LUKS2_keyslot_reencrypt_create(cd, hdr, reencrypt_keyslot,
+                                          params);
+       if (r < 0)
+               goto err;
+
+       r = reencrypt_make_backup_segments(cd, hdr, keyslot_new, _cipher, data_offset, params);
+       if (r) {
+               log_dbg(cd, "Failed to create reencryption backup device segments.");
+               goto err;
+       }
+
+       r = LUKS2_keyslot_open_all_segments(cd, keyslot_old, keyslot_new, passphrase, passphrase_size, vks);
+       if (r < 0)
+               goto err;
+
+       if (name && params->mode != CRYPT_REENCRYPT_ENCRYPT) {
+               r = reencrypt_verify_and_upload_keys(cd, hdr, LUKS2_reencrypt_digest_old(hdr), LUKS2_reencrypt_digest_new(hdr), *vks);
+               if (r)
+                       goto err;
+
+               r = dm_query_device(cd, name, DM_ACTIVE_UUID | DM_ACTIVE_DEVICE |
+                                   DM_ACTIVE_CRYPT_KEYSIZE | DM_ACTIVE_CRYPT_KEY |
+                                   DM_ACTIVE_CRYPT_CIPHER, &dmd_target);
+               if (r < 0)
+                       goto err;
+
+               r = LUKS2_assembly_multisegment_dmd(cd, hdr, *vks, LUKS2_get_segments_jobj(hdr), &dmd_source);
+               if (!r) {
+                       r = crypt_compare_dm_devices(cd, &dmd_source, &dmd_target);
+                       if (r)
+                               log_err(cd, _("Mismatching parameters on device %s."), name);
+               }
+
+               dm_targets_free(cd, &dmd_source);
+               dm_targets_free(cd, &dmd_target);
+               free(CONST_CAST(void*)dmd_target.uuid);
+
+               if (r)
+                       goto err;
+       }
+
+       if (move_first_segment && reencrypt_move_data(cd, devfd, params->data_shift << SECTOR_SHIFT)) {
+               r = -EIO;
+               goto err;
+       }
+
+       /* This must be first and only write in LUKS2 metadata during _reencrypt_init */
+       r = reencrypt_update_flag(cd, 1, true);
+       if (r) {
+               log_dbg(cd, "Failed to set online-reencryption requirement.");
+               r = -EINVAL;
+       } else
+               r = reencrypt_keyslot;
+err:
+       device_release_excl(cd, crypt_data_device(cd));
+       if (r < 0)
+               crypt_load(cd, CRYPT_LUKS2, NULL);
+
+       return r;
+}
+
+static int reencrypt_hotzone_protect_final(struct crypt_device *cd,
+       struct luks2_hdr *hdr, struct luks2_reenc_context *rh,
+       const void *buffer, size_t buffer_len)
+{
+       const void *pbuffer;
+       size_t data_offset, len;
+       int r;
+
+       if (rh->rp.type == REENC_PROTECTION_NONE)
+               return 0;
+
+       if (rh->rp.type == REENC_PROTECTION_CHECKSUM) {
+               log_dbg(cd, "Checksums hotzone resilience.");
+
+               for (data_offset = 0, len = 0; data_offset < buffer_len; data_offset += rh->alignment, len += rh->rp.p.csum.hash_size) {
+                       if (crypt_hash_write(rh->rp.p.csum.ch, (const char *)buffer + data_offset, rh->alignment)) {
+                               log_dbg(cd, "Failed to hash sector at offset %zu.", data_offset);
+                               return -EINVAL;
+                       }
+                       if (crypt_hash_final(rh->rp.p.csum.ch, (char *)rh->rp.p.csum.checksums + len, rh->rp.p.csum.hash_size)) {
+                               log_dbg(cd, "Failed to finalize hash.");
+                               return -EINVAL;
+                       }
+               }
+               pbuffer = rh->rp.p.csum.checksums;
+       } else if (rh->rp.type == REENC_PROTECTION_JOURNAL) {
+               log_dbg(cd, "Journal hotzone resilience.");
+               len = buffer_len;
+               pbuffer = buffer;
+       } else if (rh->rp.type == REENC_PROTECTION_DATASHIFT) {
+               log_dbg(cd, "Data shift hotzone resilience.");
+               return LUKS2_hdr_write(cd, hdr);
+       } else
+               return -EINVAL;
+
+       log_dbg(cd, "Going to store %zu bytes in reencrypt keyslot.", len);
+
+       r = LUKS2_keyslot_reencrypt_store(cd, hdr, rh->reenc_keyslot, pbuffer, len);
+
+       return r > 0 ? 0 : r;
+}
+
+static int reencrypt_context_update(struct crypt_device *cd,
+       struct luks2_reenc_context *rh)
+{
+       if (rh->read < 0)
+               return -EINVAL;
+
+       if (rh->direction == CRYPT_REENCRYPT_BACKWARD) {
+               if (rh->data_shift && rh->mode == CRYPT_REENCRYPT_ENCRYPT) {
+                       if (rh->offset)
+                               rh->offset -= rh->data_shift;
+                       if (rh->offset && (rh->offset < rh->data_shift)) {
+                               rh->length = rh->offset;
+                               rh->offset = rh->data_shift;
+                       }
+                       if (!rh->offset)
+                               rh->length = rh->data_shift;
+               } else {
+                       if (rh->offset < rh->length)
+                               rh->length = rh->offset;
+                       rh->offset -= rh->length;
+               }
+       } else if (rh->direction == CRYPT_REENCRYPT_FORWARD) {
+               rh->offset += (uint64_t)rh->read;
+               /* it fails in-case of device_size < rh->offset later */
+               if (rh->device_size - rh->offset < rh->length)
+                       rh->length = rh->device_size - rh->offset;
+       } else
+               return -EINVAL;
+
+       if (rh->device_size < rh->offset) {
+               log_dbg(cd, "Calculated reencryption offset %" PRIu64 " is beyond device size %" PRIu64 ".", rh->offset, rh->device_size);
+               return -EINVAL;
+       }
+
+       rh->progress += (uint64_t)rh->read;
+
+       return 0;
+}
+
+static int reencrypt_load(struct crypt_device *cd, struct luks2_hdr *hdr,
+               uint64_t device_size,
+               const struct crypt_params_reencrypt *params,
+               struct luks2_reenc_context **rh)
+{
+       int r;
+       struct luks2_reenc_context *tmp = NULL;
+       crypt_reencrypt_info ri = LUKS2_reenc_status(hdr);
+
+       if (ri == CRYPT_REENCRYPT_CLEAN)
+               r = reencrypt_load_clean(cd, hdr, device_size, &tmp, params);
+       else if (ri == CRYPT_REENCRYPT_CRASH)
+               r = reencrypt_load_crashed(cd, hdr, device_size, &tmp);
+       else if (ri == CRYPT_REENCRYPT_NONE) {
+               log_err(cd, _("Device not marked for LUKS2 reencryption."));
+               return -EINVAL;
+       } else
+               r = -EINVAL;
+
+       if (r < 0 || !tmp) {
+               log_err(cd, _("Failed to load LUKS2 reencryption context."));
+               return r;
+       }
+
+       *rh = tmp;
+
+       return 0;
+}
+
+static int reencrypt_lock_internal(struct crypt_device *cd, const char *uuid, struct crypt_lock_handle **reencrypt_lock)
+{
+       int r;
+       char *lock_resource;
+
+       if (!crypt_metadata_locking_enabled()) {
+               *reencrypt_lock = NULL;
+               return 0;
+       }
+
+       r = asprintf(&lock_resource, "LUKS2-reencryption-%s", uuid);
+       if (r < 0)
+               return -ENOMEM;
+       if (r < 20) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       r = crypt_write_lock(cd, lock_resource, false, reencrypt_lock);
+out:
+       free(lock_resource);
+
+       return r;
+}
+
+/* internal only */
+int crypt_reencrypt_lock_by_dm_uuid(struct crypt_device *cd, const char *dm_uuid, struct crypt_lock_handle **reencrypt_lock)
+{
+       int r;
+       char hdr_uuid[37];
+       const char *uuid = crypt_get_uuid(cd);
+
+       if (!dm_uuid)
+               return -EINVAL;
+
+       if (!uuid) {
+               r = snprintf(hdr_uuid, sizeof(hdr_uuid), "%.8s-%.4s-%.4s-%.4s-%.12s",
+                        dm_uuid + 6, dm_uuid + 14, dm_uuid + 18, dm_uuid + 22, dm_uuid + 26);
+               if (r < 0 || (size_t)r != (sizeof(hdr_uuid) - 1))
+                       return -EINVAL;
+       } else if (crypt_uuid_cmp(dm_uuid, uuid))
+               return -EINVAL;
+
+       return reencrypt_lock_internal(cd, uuid, reencrypt_lock);
+}
+
+/* internal only */
+int crypt_reencrypt_lock(struct crypt_device *cd, struct crypt_lock_handle **reencrypt_lock)
+{
+       if (!cd || !crypt_get_type(cd) || strcmp(crypt_get_type(cd), CRYPT_LUKS2))
+               return -EINVAL;
+
+       return reencrypt_lock_internal(cd, crypt_get_uuid(cd), reencrypt_lock);
+}
+
+/* internal only */
+void crypt_reencrypt_unlock(struct crypt_device *cd, struct crypt_lock_handle *reencrypt_lock)
+{
+       crypt_unlock_internal(cd, reencrypt_lock);
+}
+
+static int reencrypt_lock_and_verify(struct crypt_device *cd, struct luks2_hdr *hdr,
+               struct crypt_lock_handle **reencrypt_lock)
+{
+       int r;
+       crypt_reencrypt_info ri;
+       struct crypt_lock_handle *h;
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri == CRYPT_REENCRYPT_INVALID) {
+               log_err(cd, _("Failed to get reencryption state."));
+               return -EINVAL;
+       }
+       if (ri < CRYPT_REENCRYPT_CLEAN) {
+               log_err(cd, _("Device is not in reencryption."));
+               return -EINVAL;
+       }
+
+       r = crypt_reencrypt_lock(cd, &h);
+       if (r < 0) {
+               if (r == -EBUSY)
+                       log_err(cd, _("Reencryption process is already running."));
+               else
+                       log_err(cd, _("Failed to acquire reencryption lock."));
+               return r;
+       }
+
+       /* With reencryption lock held, reload device context and verify metadata state */
+       r = crypt_load(cd, CRYPT_LUKS2, NULL);
+       if (r) {
+               crypt_reencrypt_unlock(cd, h);
+               return r;
+       }
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri == CRYPT_REENCRYPT_CLEAN) {
+               *reencrypt_lock = h;
+               return 0;
+       }
+
+       crypt_reencrypt_unlock(cd, h);
+       log_err(cd, _("Cannot proceed with reencryption. Run reencryption recovery first."));
+       return -EINVAL;
+}
+
+static int reencrypt_load_by_passphrase(struct crypt_device *cd,
+               const char *name,
+               const char *passphrase,
+               size_t passphrase_size,
+               int keyslot_old,
+               int keyslot_new,
+               struct volume_key **vks,
+               const struct crypt_params_reencrypt *params)
+{
+       int r, old_ss, new_ss;
+       struct luks2_hdr *hdr;
+       struct crypt_lock_handle *reencrypt_lock;
+       struct luks2_reenc_context *rh;
+       struct crypt_dm_active_device dmd_target, dmd_source = {
+               .uuid = crypt_get_uuid(cd),
+               .flags = CRYPT_ACTIVATE_SHARED /* turn off exclusive open checks */
+       };
+       uint64_t minimal_size, device_size, mapping_size = 0, required_size = 0;
+       bool dynamic;
+       struct crypt_params_reencrypt rparams = {};
+       uint32_t flags = 0;
+
+       if (params) {
+               rparams = *params;
+               required_size = params->device_size;
+       }
+
+       log_dbg(cd, "Loading LUKS2 reencryption context.");
+
+       rh = crypt_get_reenc_context(cd);
+       if (rh) {
+               LUKS2_reenc_context_free(cd, rh);
+               crypt_set_reenc_context(cd, NULL);
+               rh = NULL;
+       }
+
+       hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       r = reencrypt_lock_and_verify(cd, hdr, &reencrypt_lock);
+       if (r)
+               return r;
+
+       /* From now on we hold reencryption lock */
+
+       if (LUKS2_get_data_size(hdr, &minimal_size, &dynamic))
+               return -EINVAL;
+
+       /* some configurations provides fixed device size */
+       r = luks2_check_device_size(cd, hdr, minimal_size, &device_size, false, dynamic);
+       if (r) {
+               r = -EINVAL;
+               goto err;
+       }
+
+       minimal_size >>= SECTOR_SHIFT;
+
+       old_ss = reencrypt_get_sector_size_old(hdr);
+       new_ss = reencrypt_get_sector_size_new(hdr);
+
+       r = reencrypt_verify_and_upload_keys(cd, hdr, LUKS2_reencrypt_digest_old(hdr), LUKS2_reencrypt_digest_new(hdr), *vks);
+       if (r == -ENOENT) {
+               log_dbg(cd, "Keys are not ready. Unlocking all volume keys.");
+               r = LUKS2_keyslot_open_all_segments(cd, keyslot_old, keyslot_new, passphrase, passphrase_size, vks);
+               if (r < 0)
+                       goto err;
+               r = reencrypt_verify_and_upload_keys(cd, hdr, LUKS2_reencrypt_digest_old(hdr), LUKS2_reencrypt_digest_new(hdr), *vks);
+       }
+
+       if (r < 0)
+               goto err;
+
+       if (name) {
+               r = dm_query_device(cd, name, DM_ACTIVE_UUID | DM_ACTIVE_DEVICE |
+                                   DM_ACTIVE_CRYPT_KEYSIZE | DM_ACTIVE_CRYPT_KEY |
+                                   DM_ACTIVE_CRYPT_CIPHER, &dmd_target);
+               if (r < 0)
+                       goto err;
+               flags = dmd_target.flags;
+
+               r = LUKS2_assembly_multisegment_dmd(cd, hdr, *vks, LUKS2_get_segments_jobj(hdr), &dmd_source);
+               if (!r) {
+                       r = crypt_compare_dm_devices(cd, &dmd_source, &dmd_target);
+                       if (r)
+                               log_err(cd, _("Mismatching parameters on device %s."), name);
+               }
+
+               dm_targets_free(cd, &dmd_source);
+               dm_targets_free(cd, &dmd_target);
+               free(CONST_CAST(void*)dmd_target.uuid);
+               if (r)
+                       goto err;
+               mapping_size = dmd_target.size;
+       }
+
+       r = -EINVAL;
+       if (required_size && mapping_size && (required_size != mapping_size)) {
+               log_err(cd, _("Active device size and requested reencryption size don't match."));
+               goto err;
+       }
+
+       if (mapping_size)
+               required_size = mapping_size;
+
+       if (required_size) {
+               /* TODO: Add support for changing fixed minimal size in reencryption mda where possible */
+               if ((minimal_size && (required_size < minimal_size)) ||
+                   (required_size > (device_size >> SECTOR_SHIFT)) ||
+                   (!dynamic && (required_size != minimal_size)) ||
+                   (old_ss > 0 && MISALIGNED(required_size, old_ss >> SECTOR_SHIFT)) ||
+                   (new_ss > 0 && MISALIGNED(required_size, new_ss >> SECTOR_SHIFT))) {
+                       log_err(cd, _("Illegal device size requested in reencryption parameters."));
+                       goto err;
+               }
+               rparams.device_size = required_size;
+       }
+
+       r = reencrypt_load(cd, hdr, device_size, &rparams, &rh);
+       if (r < 0 || !rh)
+               goto err;
+
+       if (name && (r = reencrypt_context_set_names(rh, name)))
+               goto err;
+
+       /* Reassure device is not mounted and there's no dm mapping active */
+       if (!name && (device_open_excl(cd, crypt_data_device(cd), O_RDONLY) < 0)) {
+               log_err(cd,_("Failed to open %s in exclusive mode (already mapped or mounted)."), device_path(crypt_data_device(cd)));
+               r = -EBUSY;
+               goto err;
+       }
+       device_release_excl(cd, crypt_data_device(cd));
+
+       /* FIXME: There's a race for dm device activation not managed by cryptsetup.
+        *
+        * 1) excl close
+        * 2) rogue dm device activation
+        * 3) one or more dm-crypt based wrapper activation
+        * 4) next excl open get's skipped due to 3) device from 2) remains undetected.
+        */
+       r = reencrypt_init_storage_wrappers(cd, hdr, rh, *vks);
+       if (r)
+               goto err;
+
+       /* If one of wrappers is based on dmcrypt fallback it already blocked mount */
+       if (!name && crypt_storage_wrapper_get_type(rh->cw1) != DMCRYPT &&
+           crypt_storage_wrapper_get_type(rh->cw2) != DMCRYPT) {
+               if (device_open_excl(cd, crypt_data_device(cd), O_RDONLY) < 0) {
+                       log_err(cd,_("Failed to open %s in exclusive mode (already mapped or mounted)."), device_path(crypt_data_device(cd)));
+                       r = -EBUSY;
+                       goto err;
+               }
+       }
+
+       rh->flags = flags;
+
+       MOVE_REF(rh->vks, *vks);
+       MOVE_REF(rh->reenc_lock, reencrypt_lock);
+
+       crypt_set_reenc_context(cd, rh);
+
+       return 0;
+err:
+       crypt_reencrypt_unlock(cd, reencrypt_lock);
+       LUKS2_reenc_context_free(cd, rh);
+       return r;
+}
+
+static int reencrypt_recovery_by_passphrase(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot_old,
+       int keyslot_new,
+       const char *passphrase,
+       size_t passphrase_size)
+{
+       int r;
+       crypt_reencrypt_info ri;
+       struct crypt_lock_handle *reencrypt_lock;
+
+       r = crypt_reencrypt_lock(cd, &reencrypt_lock);
+       if (r) {
+               if (r == -EBUSY)
+                       log_err(cd, _("Reencryption in-progress. Cannot perform recovery."));
+               else
+                       log_err(cd, _("Failed to get reencryption lock."));
+               return r;
+       }
+
+       if ((r = crypt_load(cd, CRYPT_LUKS2, NULL))) {
+               crypt_reencrypt_unlock(cd, reencrypt_lock);
+               return r;
+       }
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri == CRYPT_REENCRYPT_INVALID) {
+               crypt_reencrypt_unlock(cd, reencrypt_lock);
+               return -EINVAL;
+       }
+
+       if (ri == CRYPT_REENCRYPT_CRASH) {
+               r = LUKS2_reencrypt_locked_recovery_by_passphrase(cd, keyslot_old, keyslot_new,
+                               passphrase, passphrase_size, 0, NULL);
+               if (r < 0)
+                       log_err(cd, _("LUKS2 reencryption recovery failed."));
+       } else {
+               log_dbg(cd, "No LUKS2 reencryption recovery needed.");
+               r = 0;
+       }
+
+       crypt_reencrypt_unlock(cd, reencrypt_lock);
+       return r;
+}
+
+static int reencrypt_init_by_passphrase(struct crypt_device *cd,
+       const char *name,
+       const char *passphrase,
+       size_t passphrase_size,
+       int keyslot_old,
+       int keyslot_new,
+       const char *cipher,
+       const char *cipher_mode,
+       const struct crypt_params_reencrypt *params)
+{
+       int r;
+       crypt_reencrypt_info ri;
+       struct volume_key *vks = NULL;
+       uint32_t flags = params ? params->flags : 0;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       /* short-circuit in recovery and finish immediately. */
+       if (flags & CRYPT_REENCRYPT_RECOVERY)
+               return reencrypt_recovery_by_passphrase(cd, hdr, keyslot_old, keyslot_new, passphrase, passphrase_size);
+
+       if (cipher) {
+               r = crypt_keyslot_get_key_size(cd, keyslot_new);
+               if (r < 0)
+                       return r;
+               r = LUKS2_check_cipher(cd, r, cipher, cipher_mode);
+               if (r < 0)
+                       return r;
+       }
+
+       r = LUKS2_device_write_lock(cd, hdr, crypt_metadata_device(cd));
+       if (r)
+               return r;
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri == CRYPT_REENCRYPT_INVALID) {
+               device_write_unlock(cd, crypt_metadata_device(cd));
+               return -EINVAL;
+       }
+
+       if ((ri > CRYPT_REENCRYPT_NONE) && (flags & CRYPT_REENCRYPT_INITIALIZE_ONLY)) {
+               device_write_unlock(cd, crypt_metadata_device(cd));
+               log_err(cd, _("LUKS2 reencryption already initialized in metadata."));
+               return -EBUSY;
+       }
+
+       if (ri == CRYPT_REENCRYPT_NONE && !(flags & CRYPT_REENCRYPT_RESUME_ONLY)) {
+               r = reencrypt_init(cd, name, hdr, passphrase, passphrase_size, keyslot_old, keyslot_new, cipher, cipher_mode, params, &vks);
+               if (r < 0)
+                       log_err(cd, _("Failed to initialize LUKS2 reencryption in metadata."));
+       } else if (ri > CRYPT_REENCRYPT_NONE) {
+               log_dbg(cd, "LUKS2 reencryption already initialized.");
+               r = 0;
+       }
+
+       device_write_unlock(cd, crypt_metadata_device(cd));
+
+       if (r < 0 || (flags & CRYPT_REENCRYPT_INITIALIZE_ONLY))
+               goto out;
+
+       r = reencrypt_load_by_passphrase(cd, name, passphrase, passphrase_size, keyslot_old, keyslot_new, &vks, params);
+out:
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vks);
+       crypt_free_volume_key(vks);
+       return r < 0 ? r : LUKS2_find_keyslot(hdr, "reencrypt");
+}
+
+int crypt_reencrypt_init_by_keyring(struct crypt_device *cd,
+       const char *name,
+       const char *passphrase_description,
+       int keyslot_old,
+       int keyslot_new,
+       const char *cipher,
+       const char *cipher_mode,
+       const struct crypt_params_reencrypt *params)
+{
+       int r;
+       char *passphrase;
+       size_t passphrase_size;
+
+       if (onlyLUKS2mask(cd, CRYPT_REQUIREMENT_ONLINE_REENCRYPT) || !passphrase_description)
+               return -EINVAL;
+       if (params && (params->flags & CRYPT_REENCRYPT_INITIALIZE_ONLY) && (params->flags & CRYPT_REENCRYPT_RESUME_ONLY))
+               return -EINVAL;
+
+       r = keyring_get_passphrase(passphrase_description, &passphrase, &passphrase_size);
+       if (r < 0) {
+               log_err(cd, _("Failed to read passphrase from keyring (error %d)."), r);
+               return -EINVAL;
+       }
+
+       r = reencrypt_init_by_passphrase(cd, name, passphrase, passphrase_size, keyslot_old, keyslot_new, cipher, cipher_mode, params);
+
+       crypt_safe_memzero(passphrase, passphrase_size);
+       free(passphrase);
+
+       return r;
+}
+
+int crypt_reencrypt_init_by_passphrase(struct crypt_device *cd,
+       const char *name,
+       const char *passphrase,
+       size_t passphrase_size,
+       int keyslot_old,
+       int keyslot_new,
+       const char *cipher,
+       const char *cipher_mode,
+       const struct crypt_params_reencrypt *params)
+{
+       if (onlyLUKS2mask(cd, CRYPT_REQUIREMENT_ONLINE_REENCRYPT) || !passphrase)
+               return -EINVAL;
+       if (params && (params->flags & CRYPT_REENCRYPT_INITIALIZE_ONLY) && (params->flags & CRYPT_REENCRYPT_RESUME_ONLY))
+               return -EINVAL;
+
+       return reencrypt_init_by_passphrase(cd, name, passphrase, passphrase_size, keyslot_old, keyslot_new, cipher, cipher_mode, params);
+}
+
+static reenc_status_t reencrypt_step(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh,
+               uint64_t device_size,
+               bool online)
+{
+       int r;
+
+       /* update reencrypt keyslot protection parameters in memory only */
+       r = reenc_keyslot_update(cd, rh);
+       if (r < 0) {
+               log_dbg(cd, "Keyslot update failed.");
+               return REENC_ERR;
+       }
+
+       /* in memory only */
+       r = reencrypt_make_segments(cd, hdr, rh, device_size);
+       if (r)
+               return REENC_ERR;
+
+       r = reencrypt_assign_segments(cd, hdr, rh, 1, 0);
+       if (r) {
+               log_err(cd, _("Failed to set device segments for next reencryption hotzone."));
+               return REENC_ERR;
+       }
+
+       if (online) {
+               r = reencrypt_refresh_overlay_devices(cd, hdr, rh->overlay_name, rh->hotzone_name, rh->vks, rh->device_size, rh->flags);
+               /* Teardown overlay devices with dm-error. None bio shall pass! */
+               if (r != REENC_OK)
+                       return r;
+       }
+
+       log_dbg(cd, "Reencrypting chunk starting at offset: %" PRIu64 ", size :%" PRIu64 ".", rh->offset, rh->length);
+       log_dbg(cd, "data_offset: %" PRIu64, crypt_get_data_offset(cd) << SECTOR_SHIFT);
+
+       if (!rh->offset && rh->mode == CRYPT_REENCRYPT_ENCRYPT && rh->data_shift &&
+           rh->jobj_segment_moved) {
+               crypt_storage_wrapper_destroy(rh->cw1);
+               log_dbg(cd, "Reinitializing old segment storage wrapper for moved segment.");
+               r = crypt_storage_wrapper_init(cd, &rh->cw1, crypt_data_device(cd),
+                               LUKS2_reencrypt_get_data_offset_moved(hdr),
+                               crypt_get_iv_offset(cd),
+                               reencrypt_get_sector_size_old(hdr),
+                               reencrypt_segment_cipher_old(hdr),
+                               crypt_volume_key_by_id(rh->vks, rh->digest_old),
+                               rh->wflags1);
+               if (r) {
+                       log_err(cd, _("Failed to initialize old segment storage wrapper."));
+                       return REENC_ROLLBACK;
+               }
+       }
+
+       rh->read = crypt_storage_wrapper_read(rh->cw1, rh->offset, rh->reenc_buffer, rh->length);
+       if (rh->read < 0) {
+               /* severity normal */
+               log_err(cd, _("Failed to read hotzone area starting at %" PRIu64 "."), rh->offset);
+               return REENC_ROLLBACK;
+       }
+
+       /* metadata commit point */
+       r = reencrypt_hotzone_protect_final(cd, hdr, rh, rh->reenc_buffer, rh->read);
+       if (r < 0) {
+               /* severity normal */
+               log_err(cd, _("Failed to write reencryption resilience metadata."));
+               return REENC_ROLLBACK;
+       }
+
+       r = crypt_storage_wrapper_decrypt(rh->cw1, rh->offset, rh->reenc_buffer, rh->read);
+       if (r) {
+               /* severity normal */
+               log_err(cd, _("Decryption failed."));
+               return REENC_ROLLBACK;
+       }
+       if (rh->read != crypt_storage_wrapper_encrypt_write(rh->cw2, rh->offset, rh->reenc_buffer, rh->read)) {
+               /* severity fatal */
+               log_err(cd, _("Failed to write hotzone area starting at %" PRIu64 "."), rh->offset);
+               return REENC_FATAL;
+       }
+
+       if (rh->rp.type != REENC_PROTECTION_NONE && crypt_storage_wrapper_datasync(rh->cw2)) {
+               log_err(cd, _("Failed to sync data."));
+               return REENC_FATAL;
+       }
+
+       /* metadata commit safe point */
+       r = reencrypt_assign_segments(cd, hdr, rh, 0, rh->rp.type != REENC_PROTECTION_NONE);
+       if (r) {
+               /* severity fatal */
+               log_err(cd, _("Failed to update metadata after current reencryption hotzone completed."));
+               return REENC_FATAL;
+       }
+
+       if (online) {
+               /* severity normal */
+               log_dbg(cd, "Resuming device %s", rh->hotzone_name);
+               r = dm_resume_device(cd, rh->hotzone_name, DM_RESUME_PRIVATE);
+               if (r) {
+                       log_err(cd, _("Failed to resume device %s."), rh->hotzone_name);
+                       return REENC_ERR;
+               }
+       }
+
+       return REENC_OK;
+}
+
+static int reencrypt_erase_backup_segments(struct crypt_device *cd,
+               struct luks2_hdr *hdr)
+{
+       int segment = LUKS2_get_segment_id_by_flag(hdr, "backup-previous");
+       if (segment >= 0) {
+               if (LUKS2_digest_segment_assign(cd, hdr, segment, CRYPT_ANY_DIGEST, 0, 0))
+                       return -EINVAL;
+               json_object_object_del_by_uint(LUKS2_get_segments_jobj(hdr), segment);
+       }
+       segment = LUKS2_get_segment_id_by_flag(hdr, "backup-final");
+       if (segment >= 0) {
+               if (LUKS2_digest_segment_assign(cd, hdr, segment, CRYPT_ANY_DIGEST, 0, 0))
+                       return -EINVAL;
+               json_object_object_del_by_uint(LUKS2_get_segments_jobj(hdr), segment);
+       }
+       segment = LUKS2_get_segment_id_by_flag(hdr, "backup-moved-segment");
+       if (segment >= 0) {
+               if (LUKS2_digest_segment_assign(cd, hdr, segment, CRYPT_ANY_DIGEST, 0, 0))
+                       return -EINVAL;
+               json_object_object_del_by_uint(LUKS2_get_segments_jobj(hdr), segment);
+       }
+
+       return 0;
+}
+
+static int reencrypt_wipe_moved_segment(struct crypt_device *cd, struct luks2_hdr *hdr, struct luks2_reenc_context *rh)
+{
+       int r = 0;
+       uint64_t offset, length;
+
+       if (rh->jobj_segment_moved) {
+               offset = json_segment_get_offset(rh->jobj_segment_moved, 0);
+               length = json_segment_get_size(rh->jobj_segment_moved, 0);
+               log_dbg(cd, "Wiping %" PRIu64 " bytes of backup segment data at offset %" PRIu64,
+                       length, offset);
+               r = crypt_wipe_device(cd, crypt_data_device(cd), CRYPT_WIPE_RANDOM,
+                               offset, length, 1024 * 1024, NULL, NULL);
+       }
+
+       return r;
+}
+
+static int reencrypt_teardown_ok(struct crypt_device *cd, struct luks2_hdr *hdr, struct luks2_reenc_context *rh)
+{
+       int i, r;
+       uint32_t dmt_flags;
+       bool finished = !(rh->device_size > rh->progress);
+
+       if (rh->rp.type == REENC_PROTECTION_NONE &&
+           LUKS2_hdr_write(cd, hdr)) {
+               log_err(cd, _("Failed to write LUKS2 metadata."));
+               return -EINVAL;
+       }
+
+       if (rh->online) {
+               r = LUKS2_reload(cd, rh->device_name, rh->vks, rh->device_size, rh->flags);
+               if (r)
+                       log_err(cd, _("Failed to reload device %s."), rh->device_name);
+               if (!r) {
+                       r = dm_resume_device(cd, rh->device_name, DM_SUSPEND_SKIP_LOCKFS | DM_SUSPEND_NOFLUSH);
+                       if (r)
+                               log_err(cd, _("Failed to resume device %s."), rh->device_name);
+               }
+               dm_remove_device(cd, rh->overlay_name, 0);
+               dm_remove_device(cd, rh->hotzone_name, 0);
+
+               if (!r && finished && rh->mode == CRYPT_REENCRYPT_DECRYPT &&
+                   !dm_flags(cd, DM_LINEAR, &dmt_flags) && (dmt_flags & DM_DEFERRED_SUPPORTED))
+                   dm_remove_device(cd, rh->device_name, CRYPT_DEACTIVATE_DEFERRED);
+       }
+
+       if (finished) {
+               if (reencrypt_wipe_moved_segment(cd, hdr, rh))
+                       log_err(cd, _("Failed to wipe backup segment data."));
+               if (reencrypt_get_data_offset_new(hdr) && LUKS2_set_keyslots_size(cd, hdr, reencrypt_get_data_offset_new(hdr)))
+                       log_dbg(cd, "Failed to set new keyslots area size.");
+               if (rh->digest_old >= 0 && rh->digest_new != rh->digest_old)
+                       for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++)
+                               if (LUKS2_digest_by_keyslot(hdr, i) == rh->digest_old)
+                                       crypt_keyslot_destroy(cd, i);
+               crypt_keyslot_destroy(cd, rh->reenc_keyslot);
+               if (reencrypt_erase_backup_segments(cd, hdr))
+                       log_dbg(cd, "Failed to erase backup segments");
+
+               /* do we need atomic erase? */
+               if (reencrypt_update_flag(cd, 0, true))
+                       log_err(cd, _("Failed to disable reencryption requirement flag."));
+       }
+
+       return 0;
+}
+
+static void reencrypt_teardown_fatal(struct crypt_device *cd, struct luks2_hdr *hdr, struct luks2_reenc_context *rh)
+{
+       log_err(cd, _("Fatal error while reencrypting chunk starting at %" PRIu64 ", %" PRIu64 " sectors long."),
+               (rh->offset >> SECTOR_SHIFT) + crypt_get_data_offset(cd), rh->length >> SECTOR_SHIFT);
+
+       if (rh->online) {
+               log_err(cd, "Reencryption was run in online mode.");
+               if (dm_status_suspended(cd, rh->hotzone_name) > 0) {
+                       log_dbg(cd, "Hotzone device %s suspended, replacing with dm-error.", rh->hotzone_name);
+                       if (dm_error_device(cd, rh->hotzone_name)) {
+                               log_err(cd, _("Failed to replace suspended device %s with dm-error target."), rh->hotzone_name);
+                               log_err(cd, _("Do not resume the device unless replaced with error target manually."));
+                       }
+               }
+       }
+}
+
+static int reencrypt_teardown(struct crypt_device *cd, struct luks2_hdr *hdr,
+               struct luks2_reenc_context *rh, reenc_status_t rs, bool interrupted,
+               int (*progress)(uint64_t size, uint64_t offset, void *usrptr))
+{
+       int r;
+
+       switch (rs) {
+       case REENC_OK:
+               if (progress && !interrupted)
+                       progress(rh->device_size, rh->progress, NULL);
+               r = reencrypt_teardown_ok(cd, hdr, rh);
+               break;
+       case REENC_FATAL:
+               reencrypt_teardown_fatal(cd, hdr, rh);
+               /* fall-through */
+       default:
+               r = -EIO;
+       }
+
+       /* this frees reencryption lock */
+       LUKS2_reenc_context_free(cd, rh);
+       crypt_set_reenc_context(cd, NULL);
+
+       return r;
+}
+
+int crypt_reencrypt(struct crypt_device *cd,
+                   int (*progress)(uint64_t size, uint64_t offset, void *usrptr))
+{
+       int r;
+       crypt_reencrypt_info ri;
+       struct luks2_hdr *hdr;
+       struct luks2_reenc_context *rh;
+       reenc_status_t rs;
+       bool quit = false;
+
+       if (onlyLUKS2mask(cd, CRYPT_REQUIREMENT_ONLINE_REENCRYPT))
+               return -EINVAL;
+
+       hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri > CRYPT_REENCRYPT_CLEAN) {
+               log_err(cd, _("Cannot proceed with reencryption. Unexpected reencryption status."));
+               return -EINVAL;
+       }
+
+       rh = crypt_get_reenc_context(cd);
+       if (!rh || (!rh->reenc_lock && crypt_metadata_locking_enabled())) {
+               log_err(cd, _("Missing or invalid reencrypt context."));
+               return -EINVAL;
+       }
+
+       log_dbg(cd, "Resuming LUKS2 reencryption.");
+
+       if (rh->online && reencrypt_init_device_stack(cd, rh)) {
+               log_err(cd, _("Failed to initialize reencryption device stack."));
+               return -EINVAL;
+       }
+
+       log_dbg(cd, "Progress %" PRIu64 ", device_size %" PRIu64, rh->progress, rh->device_size);
+
+       rs = REENC_OK;
+
+       while (!quit && (rh->device_size > rh->progress)) {
+               rs = reencrypt_step(cd, hdr, rh, rh->device_size, rh->online);
+               if (rs != REENC_OK)
+                       break;
+
+               log_dbg(cd, "Progress %" PRIu64 ", device_size %" PRIu64, rh->progress, rh->device_size);
+               if (progress && progress(rh->device_size, rh->progress, NULL))
+                       quit = true;
+
+               r = reencrypt_context_update(cd, rh);
+               if (r) {
+                       log_err(cd, _("Failed to update reencryption context."));
+                       rs = REENC_ERR;
+                       break;
+               }
+
+               log_dbg(cd, "Next reencryption offset will be %" PRIu64 " sectors.", rh->offset);
+               log_dbg(cd, "Next reencryption chunk size will be %" PRIu64 " sectors).", rh->length);
+       }
+
+       r = reencrypt_teardown(cd, hdr, rh, rs, quit, progress);
+       return r;
+}
+
+static int reencrypt_recovery(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               uint64_t device_size,
+               struct volume_key *vks)
+{
+       int r;
+       struct luks2_reenc_context *rh = NULL;
+
+       r = reencrypt_load(cd, hdr, device_size, NULL, &rh);
+       if (r < 0) {
+               log_err(cd, _("Failed to load LUKS2 reencryption context."));
+               return r;
+       }
+
+       r = reencrypt_recover_segment(cd, hdr, rh, vks);
+       if (r < 0)
+               goto err;
+
+       if ((r = reencrypt_assign_segments(cd, hdr, rh, 0, 0)))
+               goto err;
+
+       r = reencrypt_context_update(cd, rh);
+       if (r) {
+               log_err(cd, _("Failed to update reencryption context."));
+               goto err;
+       }
+
+       r = reencrypt_teardown_ok(cd, hdr, rh);
+       if (!r)
+               r = LUKS2_hdr_write(cd, hdr);
+err:
+       LUKS2_reenc_context_free(cd, rh);
+
+       return r;
+}
+
+/*
+ * use only for calculation of minimal data device size.
+ * The real data offset is taken directly from segments!
+ */
+int LUKS2_reencrypt_data_offset(struct luks2_hdr *hdr, bool blockwise)
+{
+       crypt_reencrypt_info ri = LUKS2_reenc_status(hdr);
+       uint64_t data_offset = LUKS2_get_data_offset(hdr);
+
+       if (ri == CRYPT_REENCRYPT_CLEAN && reencrypt_direction(hdr) == CRYPT_REENCRYPT_FORWARD)
+               data_offset += reencrypt_data_shift(hdr) >> SECTOR_SHIFT;
+
+       return blockwise ? data_offset : data_offset << SECTOR_SHIFT;
+}
+
+/* internal only */
+int luks2_check_device_size(struct crypt_device *cd, struct luks2_hdr *hdr, uint64_t check_size, uint64_t *dev_size, bool activation, bool dynamic)
+{
+       int r;
+       uint64_t data_offset, real_size = 0;
+
+       if (reencrypt_direction(hdr) == CRYPT_REENCRYPT_BACKWARD &&
+           (LUKS2_get_segment_by_flag(hdr, "backup-moved-segment") || dynamic))
+               check_size += reencrypt_data_shift(hdr);
+
+       r = device_check_access(cd, crypt_data_device(cd), activation ? DEV_EXCL : DEV_OK);
+       if (r)
+               return r;
+
+       data_offset = LUKS2_reencrypt_data_offset(hdr, false);
+
+       r = device_check_size(cd, crypt_data_device(cd), data_offset, 1);
+       if (r)
+               return r;
+
+       r = device_size(crypt_data_device(cd), &real_size);
+       if (r)
+               return r;
+
+       log_dbg(cd, "Required minimal device size: %" PRIu64 " (%" PRIu64 " sectors)"
+                   ", real device size: %" PRIu64 " (%" PRIu64 " sectors)\n"
+                   "calculated device size: %" PRIu64 " (%" PRIu64 " sectors)",
+                   check_size, check_size >> SECTOR_SHIFT, real_size, real_size >> SECTOR_SHIFT,
+                   real_size - data_offset, (real_size - data_offset) >> SECTOR_SHIFT);
+
+       if (real_size < data_offset || (check_size && (real_size - data_offset) < check_size)) {
+               log_err(cd, _("Device %s is too small."), device_path(crypt_data_device(cd)));
+               return -EINVAL;
+       }
+
+       *dev_size = real_size - data_offset;
+
+       return 0;
+}
+
+/* returns keyslot number on success (>= 0) or negative errnor otherwise */
+int LUKS2_reencrypt_locked_recovery_by_passphrase(struct crypt_device *cd,
+       int keyslot_old,
+       int keyslot_new,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags,
+       struct volume_key **vks)
+{
+       uint64_t minimal_size, device_size;
+       int keyslot, r = -EINVAL;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+       struct volume_key *vk = NULL, *_vks = NULL;
+
+       log_dbg(cd, "Entering reencryption crash recovery.");
+
+       if (LUKS2_get_data_size(hdr, &minimal_size, NULL))
+               return r;
+
+       r = LUKS2_keyslot_open_all_segments(cd, keyslot_old, keyslot_new,
+                       passphrase, passphrase_size, &_vks);
+       if (r < 0)
+               goto err;
+       keyslot = r;
+
+       if (crypt_use_keyring_for_vk(cd))
+               vk = _vks;
+
+       while (vk) {
+               r = LUKS2_volume_key_load_in_keyring_by_digest(cd, hdr, vk, crypt_volume_key_get_id(vk));
+               if (r < 0)
+                       goto err;
+               vk = crypt_volume_key_next(vk);
+       }
+
+       if (luks2_check_device_size(cd, hdr, minimal_size, &device_size, true, false))
+               goto err;
+
+       r = reencrypt_recovery(cd, hdr, device_size, _vks);
+
+       if (!r && vks)
+               MOVE_REF(*vks, _vks);
+err:
+       if (r < 0)
+               crypt_drop_keyring_key(cd, _vks);
+       crypt_free_volume_key(_vks);
+
+       return r < 0 ? r : keyslot;
+}
+
+crypt_reencrypt_info LUKS2_reencrypt_status(struct crypt_device *cd, struct crypt_params_reencrypt *params)
+{
+       crypt_reencrypt_info ri;
+       struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri == CRYPT_REENCRYPT_NONE || ri == CRYPT_REENCRYPT_INVALID || !params)
+               return ri;
+
+       params->mode = reencrypt_mode(hdr);
+       params->direction = reencrypt_direction(hdr);
+       params->resilience = reencrypt_resilience_type(hdr);
+       params->hash = reencrypt_resilience_hash(hdr);
+       params->data_shift = reencrypt_data_shift(hdr) >> SECTOR_SHIFT;
+       params->max_hotzone_size = 0;
+       if (LUKS2_get_segment_id_by_flag(hdr, "backup-moved-segment") >= 0)
+               params->flags |= CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT;
+
+       return ri;
+}
diff --git a/lib/luks2/luks2_segment.c b/lib/luks2/luks2_segment.c
new file mode 100644 (file)
index 0000000..8708ba5
--- /dev/null
@@ -0,0 +1,412 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, internal segment handling
+ *
+ * Copyright (C) 2018-2020, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2018-2020, Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "luks2_internal.h"
+
+/* use only on already validated 'segments' object */
+uint64_t json_segments_get_minimal_offset(json_object *jobj_segments, unsigned blockwise)
+{
+       uint64_t tmp, min = blockwise ? UINT64_MAX >> SECTOR_SHIFT : UINT64_MAX;
+
+       if (!jobj_segments)
+               return 0;
+
+       json_object_object_foreach(jobj_segments, key, val) {
+               UNUSED(key);
+
+               if (json_segment_is_backup(val))
+                       continue;
+
+               tmp = json_segment_get_offset(val, blockwise);
+
+               if (!tmp)
+                       return tmp;
+
+               if (tmp < min)
+                       min = tmp;
+       }
+
+       return min;
+}
+
+uint64_t json_segment_get_offset(json_object *jobj_segment, unsigned blockwise)
+{
+       json_object *jobj;
+
+       if (!jobj_segment ||
+           !json_object_object_get_ex(jobj_segment, "offset", &jobj))
+               return 0;
+
+       return blockwise ? crypt_jobj_get_uint64(jobj) >> SECTOR_SHIFT : crypt_jobj_get_uint64(jobj);
+}
+
+const char *json_segment_type(json_object *jobj_segment)
+{
+       json_object *jobj;
+
+       if (!jobj_segment ||
+           !json_object_object_get_ex(jobj_segment, "type", &jobj))
+               return NULL;
+
+       return json_object_get_string(jobj);
+}
+
+uint64_t json_segment_get_iv_offset(json_object *jobj_segment)
+{
+       json_object *jobj;
+
+       if (!jobj_segment ||
+           !json_object_object_get_ex(jobj_segment, "iv_tweak", &jobj))
+               return 0;
+
+       return crypt_jobj_get_uint64(jobj);
+}
+
+uint64_t json_segment_get_size(json_object *jobj_segment, unsigned blockwise)
+{
+       json_object *jobj;
+
+       if (!jobj_segment ||
+           !json_object_object_get_ex(jobj_segment, "size", &jobj))
+               return 0;
+
+       return blockwise ? crypt_jobj_get_uint64(jobj) >> SECTOR_SHIFT : crypt_jobj_get_uint64(jobj);
+}
+
+const char *json_segment_get_cipher(json_object *jobj_segment)
+{
+       json_object *jobj;
+
+       /* FIXME: Pseudo "null" cipher should be handled elsewhere */
+       if (!jobj_segment ||
+           !json_object_object_get_ex(jobj_segment, "encryption", &jobj))
+               return "null";
+
+       return json_object_get_string(jobj);
+}
+
+int json_segment_get_sector_size(json_object *jobj_segment)
+{
+       json_object *jobj;
+
+       if (!jobj_segment ||
+            !json_object_object_get_ex(jobj_segment, "sector_size", &jobj))
+               return -1;
+
+       return json_object_get_int(jobj);
+}
+
+static json_object *json_segment_get_flags(json_object *jobj_segment)
+{
+       json_object *jobj;
+
+       if (!jobj_segment || !(json_object_object_get_ex(jobj_segment, "flags", &jobj)))
+               return NULL;
+       return jobj;
+}
+
+static bool json_segment_contains_flag(json_object *jobj_segment, const char *flag_str, size_t len)
+{
+       int r, i;
+       json_object *jobj, *jobj_flags = json_segment_get_flags(jobj_segment);
+
+       if (!jobj_flags)
+               return false;
+
+       for (i = 0; i < (int)json_object_array_length(jobj_flags); i++) {
+               jobj = json_object_array_get_idx(jobj_flags, i);
+               if (len)
+                       r = strncmp(json_object_get_string(jobj), flag_str, len);
+               else
+                       r = strcmp(json_object_get_string(jobj), flag_str);
+               if (!r)
+                       return true;
+       }
+
+       return false;
+}
+
+bool json_segment_is_backup(json_object *jobj_segment)
+{
+       return json_segment_contains_flag(jobj_segment, "backup-", 7);
+}
+
+json_object *json_segments_get_segment(json_object *jobj_segments, int segment)
+{
+       json_object *jobj;
+       char segment_name[16];
+
+       if (snprintf(segment_name, sizeof(segment_name), "%u", segment) < 1)
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj_segments, segment_name, &jobj))
+               return NULL;
+
+       return jobj;
+}
+
+unsigned json_segments_count(json_object *jobj_segments)
+{
+       unsigned count = 0;
+
+       if (!jobj_segments)
+               return 0;
+
+       json_object_object_foreach(jobj_segments, slot, val) {
+               UNUSED(slot);
+               if (!json_segment_is_backup(val))
+                       count++;
+       }
+
+       return count;
+}
+
+static void _get_segment_or_id_by_flag(json_object *jobj_segments, const char *flag, unsigned id, void *retval)
+{
+       json_object *jobj_flags, **jobj_ret = (json_object **)retval;
+       int *ret = (int *)retval;
+
+       if (!flag)
+               return;
+
+       json_object_object_foreach(jobj_segments, key, value) {
+               if (!json_object_object_get_ex(value, "flags", &jobj_flags))
+                       continue;
+               if (LUKS2_array_jobj(jobj_flags, flag)) {
+                       if (id)
+                               *ret = atoi(key);
+                       else
+                               *jobj_ret = value;
+                       return;
+               }
+       }
+}
+
+void json_segment_remove_flag(json_object *jobj_segment, const char *flag)
+{
+       json_object *jobj_flags, *jobj_flags_new;
+
+       if (!jobj_segment)
+               return;
+
+       jobj_flags = json_segment_get_flags(jobj_segment);
+       if (!jobj_flags)
+               return;
+
+       jobj_flags_new = LUKS2_array_remove(jobj_flags, flag);
+       if (!jobj_flags_new)
+               return;
+
+       if (json_object_array_length(jobj_flags_new) <= 0) {
+               json_object_put(jobj_flags_new);
+               json_object_object_del(jobj_segment, "flags");
+       } else
+               json_object_object_add(jobj_segment, "flags", jobj_flags_new);
+}
+
+static json_object *_segment_create_generic(const char *type, uint64_t offset, const uint64_t *length)
+{
+       json_object *jobj = json_object_new_object();
+       if (!jobj)
+               return NULL;
+
+       json_object_object_add(jobj, "type",            json_object_new_string(type));
+       json_object_object_add(jobj, "offset",          crypt_jobj_new_uint64(offset));
+       json_object_object_add(jobj, "size",            length ? crypt_jobj_new_uint64(*length) : json_object_new_string("dynamic"));
+
+       return jobj;
+}
+
+json_object *json_segment_create_linear(uint64_t offset, const uint64_t *length, unsigned reencryption)
+{
+       json_object *jobj = _segment_create_generic("linear", offset, length);
+       if (reencryption)
+               LUKS2_segment_set_flag(jobj, "in-reencryption");
+       return jobj;
+}
+
+json_object *json_segment_create_crypt(uint64_t offset,
+                                 uint64_t iv_offset, const uint64_t *length,
+                                 const char *cipher, uint32_t sector_size,
+                                 unsigned reencryption)
+{
+       json_object *jobj = _segment_create_generic("crypt", offset, length);
+       if (!jobj)
+               return NULL;
+
+       json_object_object_add(jobj, "iv_tweak",        crypt_jobj_new_uint64(iv_offset));
+       json_object_object_add(jobj, "encryption",      json_object_new_string(cipher));
+       json_object_object_add(jobj, "sector_size",     json_object_new_int(sector_size));
+       if (reencryption)
+               LUKS2_segment_set_flag(jobj, "in-reencryption");
+
+       return jobj;
+}
+
+uint64_t LUKS2_segment_offset(struct luks2_hdr *hdr, int segment, unsigned blockwise)
+{
+       return json_segment_get_offset(LUKS2_get_segment_jobj(hdr, segment), blockwise);
+}
+
+int json_segments_segment_in_reencrypt(json_object *jobj_segments)
+{
+       json_object *jobj_flags;
+
+       json_object_object_foreach(jobj_segments, slot, val) {
+               if (!json_object_object_get_ex(val, "flags", &jobj_flags) ||
+                   !LUKS2_array_jobj(jobj_flags, "in-reencryption"))
+                       continue;
+
+               return atoi(slot);
+       }
+
+       return -1;
+}
+
+uint64_t LUKS2_segment_size(struct luks2_hdr *hdr, int segment, unsigned blockwise)
+{
+       return json_segment_get_size(LUKS2_get_segment_jobj(hdr, segment), blockwise);
+}
+
+int LUKS2_segment_is_type(struct luks2_hdr *hdr, int segment, const char *type)
+{
+       return !strcmp(json_segment_type(LUKS2_get_segment_jobj(hdr, segment)) ?: "", type);
+}
+
+int LUKS2_last_segment_by_type(struct luks2_hdr *hdr, const char *type)
+{
+       json_object *jobj_segments;
+       int last_found = -1;
+
+       if (!type)
+               return -1;
+
+       if (!json_object_object_get_ex(hdr->jobj, "segments", &jobj_segments))
+               return -1;
+
+       json_object_object_foreach(jobj_segments, slot, val) {
+               if (json_segment_is_backup(val))
+                       continue;
+               if (strcmp(type, json_segment_type(val) ?: ""))
+                       continue;
+
+               if (atoi(slot) > last_found)
+                       last_found = atoi(slot);
+       }
+
+       return last_found;
+}
+
+int LUKS2_segment_by_type(struct luks2_hdr *hdr, const char *type)
+{
+       json_object *jobj_segments;
+       int first_found = -1;
+
+       if (!type)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(hdr->jobj, "segments", &jobj_segments))
+               return -EINVAL;
+
+       json_object_object_foreach(jobj_segments, slot, val) {
+               if (json_segment_is_backup(val))
+                       continue;
+               if (strcmp(type, json_segment_type(val) ?: ""))
+                       continue;
+
+               if (first_found < 0)
+                       first_found = atoi(slot);
+               else if (atoi(slot) < first_found)
+                       first_found = atoi(slot);
+       }
+
+       return first_found;
+}
+
+int LUKS2_segment_first_unused_id(struct luks2_hdr *hdr)
+{
+       json_object *jobj_segments;
+       int id, last_id = -1;
+
+       if (!json_object_object_get_ex(hdr->jobj, "segments", &jobj_segments))
+               return -EINVAL;
+
+       json_object_object_foreach(jobj_segments, slot, val) {
+               UNUSED(val);
+               id = atoi(slot);
+               if (id > last_id)
+                       last_id = id;
+       }
+
+       return last_id + 1;
+}
+
+int LUKS2_segment_set_flag(json_object *jobj_segment, const char *flag)
+{
+       json_object *jobj_flags;
+
+       if (!jobj_segment || !flag)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(jobj_segment, "flags", &jobj_flags)) {
+               jobj_flags = json_object_new_array();
+               if (!jobj_flags)
+                       return -ENOMEM;
+               json_object_object_add(jobj_segment, "flags", jobj_flags);
+       }
+
+       if (LUKS2_array_jobj(jobj_flags, flag))
+               return 0;
+
+       json_object_array_add(jobj_flags, json_object_new_string(flag));
+
+       return 0;
+}
+
+int LUKS2_segments_set(struct crypt_device *cd, struct luks2_hdr *hdr,
+                      json_object *jobj_segments, int commit)
+{
+       json_object_object_add(hdr->jobj, "segments", jobj_segments);
+
+       return commit ? LUKS2_hdr_write(cd, hdr) : 0;
+}
+
+int LUKS2_get_segment_id_by_flag(struct luks2_hdr *hdr, const char *flag)
+{
+       int ret = -ENOENT;
+       json_object *jobj_segments = LUKS2_get_segments_jobj(hdr);
+
+       if (jobj_segments)
+               _get_segment_or_id_by_flag(jobj_segments, flag, 1, &ret);
+
+       return ret;
+}
+
+json_object *LUKS2_get_segment_by_flag(struct luks2_hdr *hdr, const char *flag)
+{
+       json_object *jobj_segment = NULL,
+                   *jobj_segments = LUKS2_get_segments_jobj(hdr);
+
+       if (jobj_segments)
+               _get_segment_or_id_by_flag(jobj_segments, flag, 0, &jobj_segment);
+
+       return jobj_segment;
+}
diff --git a/lib/luks2/luks2_token.c b/lib/luks2/luks2_token.c
new file mode 100644 (file)
index 0000000..ad6722a
--- /dev/null
@@ -0,0 +1,610 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, token handling
+ *
+ * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <assert.h>
+
+#include "luks2_internal.h"
+
+/* Builtin tokens */
+extern const crypt_token_handler keyring_handler;
+
+static token_handler token_handlers[LUKS2_TOKENS_MAX] = {
+       /* keyring builtin token */
+       {
+         .get = token_keyring_get,
+         .set = token_keyring_set,
+         .h = &keyring_handler
+       },
+};
+
+static int is_builtin_candidate(const char *type)
+{
+       return !strncmp(type, LUKS2_BUILTIN_TOKEN_PREFIX, LUKS2_BUILTIN_TOKEN_PREFIX_LEN);
+}
+
+int crypt_token_register(const crypt_token_handler *handler)
+{
+       int i;
+
+       if (is_builtin_candidate(handler->name)) {
+               log_dbg(NULL, "'" LUKS2_BUILTIN_TOKEN_PREFIX "' is reserved prefix for builtin tokens.");
+               return -EINVAL;
+       }
+
+       for (i = 0; i < LUKS2_TOKENS_MAX && token_handlers[i].h; i++) {
+               if (!strcmp(token_handlers[i].h->name, handler->name)) {
+                       log_dbg(NULL, "Keyslot handler %s is already registered.", handler->name);
+                       return -EINVAL;
+               }
+       }
+
+       if (i == LUKS2_TOKENS_MAX)
+               return -EINVAL;
+
+       token_handlers[i].h = handler;
+       return 0;
+}
+
+static const token_handler
+*LUKS2_token_handler_type_internal(struct crypt_device *cd, const char *type)
+{
+       int i;
+
+       for (i = 0; i < LUKS2_TOKENS_MAX && token_handlers[i].h; i++)
+               if (!strcmp(token_handlers[i].h->name, type))
+                       return token_handlers + i;
+
+       return NULL;
+}
+
+static const crypt_token_handler
+*LUKS2_token_handler_type(struct crypt_device *cd, const char *type)
+{
+       const token_handler *th = LUKS2_token_handler_type_internal(cd, type);
+
+       return th ? th->h : NULL;
+}
+
+static const token_handler
+*LUKS2_token_handler_internal(struct crypt_device *cd, int token)
+{
+       struct luks2_hdr *hdr;
+       json_object *jobj1, *jobj2;
+
+       if (token < 0)
+               return NULL;
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return NULL;
+
+       if (!(jobj1 = LUKS2_get_token_jobj(hdr, token)))
+               return NULL;
+
+       if (!json_object_object_get_ex(jobj1, "type", &jobj2))
+               return NULL;
+
+       return LUKS2_token_handler_type_internal(cd, json_object_get_string(jobj2));
+}
+
+static const crypt_token_handler
+*LUKS2_token_handler(struct crypt_device *cd, int token)
+{
+       const token_handler *th = LUKS2_token_handler_internal(cd, token);
+
+       return th ? th->h : NULL;
+}
+
+static int LUKS2_token_find_free(struct luks2_hdr *hdr)
+{
+       int i;
+
+       for (i = 0; i < LUKS2_TOKENS_MAX; i++)
+               if (!LUKS2_get_token_jobj(hdr, i))
+                       return i;
+
+       return -EINVAL;
+}
+
+int LUKS2_token_create(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char *json,
+       int commit)
+{
+       const crypt_token_handler *h;
+       const token_handler *th;
+       json_object *jobj_tokens, *jobj_type, *jobj;
+       enum json_tokener_error jerr;
+       char num[16];
+
+       if (token == CRYPT_ANY_TOKEN) {
+               if (!json)
+                       return -EINVAL;
+               token = LUKS2_token_find_free(hdr);
+       }
+
+       if (token < 0 || token >= LUKS2_TOKENS_MAX)
+               return -EINVAL;
+
+       if (!json_object_object_get_ex(hdr->jobj, "tokens", &jobj_tokens))
+               return -EINVAL;
+
+       snprintf(num, sizeof(num), "%d", token);
+
+       /* Remove token */
+       if (!json)
+               json_object_object_del(jobj_tokens, num);
+       else {
+
+               jobj = json_tokener_parse_verbose(json, &jerr);
+               if (!jobj) {
+                       log_dbg(cd, "Token JSON parse failed.");
+                       return -EINVAL;
+               }
+
+               if (LUKS2_token_validate(cd, hdr->jobj, jobj, num)) {
+                       json_object_put(jobj);
+                       return -EINVAL;
+               }
+
+               json_object_object_get_ex(jobj, "type", &jobj_type);
+               if (is_builtin_candidate(json_object_get_string(jobj_type))) {
+                       th = LUKS2_token_handler_type_internal(cd, json_object_get_string(jobj_type));
+                       if (!th || !th->set) {
+                               log_dbg(cd, "%s is builtin token candidate with missing handler", json_object_get_string(jobj_type));
+                               json_object_put(jobj);
+                               return -EINVAL;
+                       }
+                       h = th->h;
+               } else
+                       h = LUKS2_token_handler_type(cd, json_object_get_string(jobj_type));
+
+               if (h && h->validate && h->validate(cd, json)) {
+                       json_object_put(jobj);
+                       log_dbg(cd, "Token type %s validation failed.", h->name);
+                       return -EINVAL;
+               }
+
+               json_object_object_add(jobj_tokens, num, jobj);
+               if (LUKS2_check_json_size(cd, hdr)) {
+                       log_dbg(cd, "Not enough space in header json area for new token.");
+                       json_object_object_del(jobj_tokens, num);
+                       return -ENOSPC;
+               }
+       }
+
+       if (commit)
+               return LUKS2_hdr_write(cd, hdr) ?: token;
+
+       return token;
+}
+
+crypt_token_info LUKS2_token_status(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char **type)
+{
+       const char *tmp;
+       const token_handler *th;
+       json_object *jobj_type, *jobj_token;
+
+       if (token < 0 || token >= LUKS2_TOKENS_MAX)
+               return CRYPT_TOKEN_INVALID;
+
+       if (!(jobj_token = LUKS2_get_token_jobj(hdr, token)))
+               return CRYPT_TOKEN_INACTIVE;
+
+       json_object_object_get_ex(jobj_token, "type", &jobj_type);
+       tmp = json_object_get_string(jobj_type);
+
+       if ((th = LUKS2_token_handler_type_internal(cd, tmp))) {
+               if (type)
+                       *type = th->h->name;
+               return th->set ? CRYPT_TOKEN_INTERNAL : CRYPT_TOKEN_EXTERNAL;
+       }
+
+       if (type)
+               *type = tmp;
+
+       return is_builtin_candidate(tmp) ? CRYPT_TOKEN_INTERNAL_UNKNOWN : CRYPT_TOKEN_EXTERNAL_UNKNOWN;
+}
+
+int LUKS2_builtin_token_get(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char *type,
+       void *params)
+{
+       const token_handler *th = LUKS2_token_handler_type_internal(cd, type);
+
+       // internal error
+       assert(th && th->get);
+
+       return th->get(LUKS2_get_token_jobj(hdr, token), params) ?: token;
+}
+
+int LUKS2_builtin_token_create(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       const char *type,
+       const void *params,
+       int commit)
+{
+       const token_handler *th;
+       int r;
+       json_object *jobj_token, *jobj_tokens;
+
+       th = LUKS2_token_handler_type_internal(cd, type);
+
+       // at this point all builtin handlers must exist and have validate fn defined
+       assert(th && th->set && th->h->validate);
+
+       if (token == CRYPT_ANY_TOKEN) {
+               if ((token = LUKS2_token_find_free(hdr)) < 0)
+                       log_err(cd, _("No free token slot."));
+       }
+       if (token < 0 || token >= LUKS2_TOKENS_MAX)
+               return -EINVAL;
+
+       r = th->set(&jobj_token, params);
+       if (r) {
+               log_err(cd, _("Failed to create builtin token %s."), type);
+               return r;
+       }
+
+       // builtin tokens must produce valid json
+       r = LUKS2_token_validate(cd, hdr->jobj, jobj_token, "new");
+       assert(!r);
+       r = th->h->validate(cd, json_object_to_json_string_ext(jobj_token,
+               JSON_C_TO_STRING_PLAIN | JSON_C_TO_STRING_NOSLASHESCAPE));
+       assert(!r);
+
+       json_object_object_get_ex(hdr->jobj, "tokens", &jobj_tokens);
+       json_object_object_add_by_uint(jobj_tokens, token, jobj_token);
+       if (LUKS2_check_json_size(cd, hdr)) {
+               log_dbg(cd, "Not enough space in header json area for new %s token.", type);
+               json_object_object_del_by_uint(jobj_tokens, token);
+               return -ENOSPC;
+       }
+
+       if (commit)
+               return LUKS2_hdr_write(cd, hdr) ?: token;
+
+       return token;
+}
+
+static int LUKS2_token_open(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       char **buffer,
+       size_t *buffer_len,
+       void *usrptr)
+{
+       const char *json;
+       const crypt_token_handler *h;
+       int r;
+
+       if (!(h = LUKS2_token_handler(cd, token)))
+               return -ENOENT;
+
+       if (h->validate) {
+               if (LUKS2_token_json_get(cd, hdr, token, &json))
+                       return -EINVAL;
+
+               if (h->validate(cd, json)) {
+                       log_dbg(cd, "Token %d (%s) validation failed.", token, h->name);
+                       return -EINVAL;
+               }
+       }
+
+       r = h->open(cd, token, buffer, buffer_len, usrptr);
+       if (r < 0)
+               log_dbg(cd, "Token %d (%s) open failed with %d.", token, h->name, r);
+
+       return r;
+}
+
+static void LUKS2_token_buffer_free(struct crypt_device *cd,
+               int token,
+               void *buffer,
+               size_t buffer_len)
+{
+       const crypt_token_handler *h = LUKS2_token_handler(cd, token);
+
+       if (h->buffer_free)
+               h->buffer_free(buffer, buffer_len);
+       else {
+               crypt_safe_memzero(buffer, buffer_len);
+               free(buffer);
+       }
+}
+
+static int LUKS2_keyslot_open_by_token(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int token,
+       int segment,
+       const char *buffer,
+       size_t buffer_len,
+       struct volume_key **vk)
+{
+       const crypt_token_handler *h;
+       json_object *jobj_token, *jobj_token_keyslots, *jobj;
+       unsigned int num = 0;
+       int i, r;
+
+       if (!(h = LUKS2_token_handler(cd, token)))
+               return -ENOENT;
+
+       jobj_token = LUKS2_get_token_jobj(hdr, token);
+       if (!jobj_token)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_token, "keyslots", &jobj_token_keyslots);
+       if (!jobj_token_keyslots)
+               return -EINVAL;
+
+       /* Try to open keyslot referenced in token */
+       r = -EINVAL;
+       for (i = 0; i < (int) json_object_array_length(jobj_token_keyslots) && r < 0; i++) {
+               jobj = json_object_array_get_idx(jobj_token_keyslots, i);
+               num = atoi(json_object_get_string(jobj));
+               log_dbg(cd, "Trying to open keyslot %u with token %d (type %s).", num, token, h->name);
+               r = LUKS2_keyslot_open(cd, num, segment, buffer, buffer_len, vk);
+       }
+
+       if (r < 0)
+               return r;
+
+       return num;
+}
+
+int LUKS2_token_open_and_activate(struct crypt_device *cd,
+               struct luks2_hdr *hdr,
+               int token,
+               const char *name,
+               uint32_t flags,
+               void *usrptr)
+{
+       int keyslot, r;
+       char *buffer;
+       size_t buffer_len;
+       struct volume_key *vk = NULL;
+
+       r = LUKS2_token_open(cd, hdr, token, &buffer, &buffer_len, usrptr);
+       if (r < 0)
+               return r;
+
+       r = LUKS2_keyslot_open_by_token(cd, hdr, token,
+                                       (flags & CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY) ?
+                                       CRYPT_ANY_SEGMENT : CRYPT_DEFAULT_SEGMENT,
+                                       buffer, buffer_len, &vk);
+
+       LUKS2_token_buffer_free(cd, token, buffer, buffer_len);
+
+       if (r < 0)
+               return r;
+
+       keyslot = r;
+
+       if ((name || (flags & CRYPT_ACTIVATE_KEYRING_KEY)) && crypt_use_keyring_for_vk(cd)) {
+               if (!(r = LUKS2_volume_key_load_in_keyring_by_keyslot(cd, hdr, vk, keyslot)))
+                       flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+       }
+
+       if (r >= 0 && name)
+               r = LUKS2_activate(cd, name, vk, flags);
+
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
+       crypt_free_volume_key(vk);
+
+       return r < 0 ? r : keyslot;
+}
+
+int LUKS2_token_open_and_activate_any(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       const char *name,
+       uint32_t flags)
+{
+       char *buffer;
+       json_object *tokens_jobj;
+       size_t buffer_len;
+       int keyslot, token, r = -EINVAL;
+       struct volume_key *vk = NULL;
+
+       json_object_object_get_ex(hdr->jobj, "tokens", &tokens_jobj);
+
+       json_object_object_foreach(tokens_jobj, slot, val) {
+               UNUSED(val);
+               token = atoi(slot);
+
+               r = LUKS2_token_open(cd, hdr, token, &buffer, &buffer_len, NULL);
+               if (r < 0)
+                       continue;
+
+               r = LUKS2_keyslot_open_by_token(cd, hdr, token,
+                                               (flags & CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY) ?
+                                               CRYPT_ANY_SEGMENT : CRYPT_DEFAULT_SEGMENT,
+                                               buffer, buffer_len, &vk);
+               LUKS2_token_buffer_free(cd, token, buffer, buffer_len);
+               if (r >= 0)
+                       break;
+       }
+
+       keyslot = r;
+
+       if (r >= 0 && (name || (flags & CRYPT_ACTIVATE_KEYRING_KEY)) && crypt_use_keyring_for_vk(cd)) {
+               if (!(r = LUKS2_volume_key_load_in_keyring_by_keyslot(cd, hdr, vk, keyslot)))
+                       flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+       }
+
+       if (r >= 0 && name)
+               r = LUKS2_activate(cd, name, vk, flags);
+
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
+       crypt_free_volume_key(vk);
+
+       return r < 0 ? r : keyslot;
+}
+
+void LUKS2_token_dump(struct crypt_device *cd, int token)
+{
+       const crypt_token_handler *h;
+       json_object *jobj_token;
+
+       h = LUKS2_token_handler(cd, token);
+       if (h && h->dump) {
+               jobj_token = LUKS2_get_token_jobj(crypt_get_hdr(cd, CRYPT_LUKS2), token);
+               if (jobj_token)
+                       h->dump(cd, json_object_to_json_string_ext(jobj_token,
+                               JSON_C_TO_STRING_PLAIN | JSON_C_TO_STRING_NOSLASHESCAPE));
+       }
+}
+
+int LUKS2_token_json_get(struct crypt_device *cd, struct luks2_hdr *hdr,
+                          int token, const char **json)
+{
+       json_object *jobj_token;
+
+       jobj_token = LUKS2_get_token_jobj(hdr, token);
+       if (!jobj_token)
+               return -EINVAL;
+
+       *json = json_object_to_json_string_ext(jobj_token,
+               JSON_C_TO_STRING_PLAIN | JSON_C_TO_STRING_NOSLASHESCAPE);
+       return 0;
+}
+
+static int assign_one_keyslot(struct crypt_device *cd, struct luks2_hdr *hdr,
+                             int token, int keyslot, int assign)
+{
+       json_object *jobj1, *jobj_token, *jobj_token_keyslots;
+       char num[16];
+
+       log_dbg(cd, "Keyslot %i %s token %i.", keyslot, assign ? "assigned to" : "unassigned from", token);
+
+       jobj_token = LUKS2_get_token_jobj(hdr, token);
+       if (!jobj_token)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_token, "keyslots", &jobj_token_keyslots);
+       if (!jobj_token_keyslots)
+               return -EINVAL;
+
+       snprintf(num, sizeof(num), "%d", keyslot);
+       if (assign) {
+               jobj1 = LUKS2_array_jobj(jobj_token_keyslots, num);
+               if (!jobj1)
+                       json_object_array_add(jobj_token_keyslots, json_object_new_string(num));
+       } else {
+               jobj1 = LUKS2_array_remove(jobj_token_keyslots, num);
+               if (jobj1)
+                       json_object_object_add(jobj_token, "keyslots", jobj1);
+       }
+
+       return 0;
+}
+
+static int assign_one_token(struct crypt_device *cd, struct luks2_hdr *hdr,
+                           int keyslot, int token, int assign)
+{
+       json_object *jobj_keyslots;
+       int r = 0;
+
+       if (!LUKS2_get_token_jobj(hdr, token))
+               return -EINVAL;
+
+       if (keyslot == CRYPT_ANY_SLOT) {
+               json_object_object_get_ex(hdr->jobj, "keyslots", &jobj_keyslots);
+
+               json_object_object_foreach(jobj_keyslots, key, val) {
+                       UNUSED(val);
+                       r = assign_one_keyslot(cd, hdr, token, atoi(key), assign);
+                       if (r < 0)
+                               break;
+               }
+       } else
+               r = assign_one_keyslot(cd, hdr, token, keyslot, assign);
+
+       return r;
+}
+
+int LUKS2_token_assign(struct crypt_device *cd, struct luks2_hdr *hdr,
+                       int keyslot, int token, int assign, int commit)
+{
+       json_object *jobj_tokens;
+       int r = 0;
+
+       if (token == CRYPT_ANY_TOKEN) {
+               json_object_object_get_ex(hdr->jobj, "tokens", &jobj_tokens);
+
+               json_object_object_foreach(jobj_tokens, key, val) {
+                       UNUSED(val);
+                       r = assign_one_token(cd, hdr, keyslot, atoi(key), assign);
+                       if (r < 0)
+                               break;
+               }
+       } else
+               r = assign_one_token(cd, hdr, keyslot, token, assign);
+
+       if (r < 0)
+               return r;
+
+       // FIXME: do not write header in nothing changed
+       if (commit)
+               return LUKS2_hdr_write(cd, hdr) ?: token;
+
+       return token;
+}
+
+int LUKS2_token_is_assigned(struct crypt_device *cd, struct luks2_hdr *hdr,
+                           int keyslot, int token)
+{
+       int i;
+       json_object *jobj_token, *jobj_token_keyslots, *jobj;
+
+       if (keyslot < 0 || keyslot >= LUKS2_KEYSLOTS_MAX || token < 0 || token >= LUKS2_TOKENS_MAX)
+               return -EINVAL;
+
+       jobj_token = LUKS2_get_token_jobj(hdr, token);
+       if (!jobj_token)
+               return -ENOENT;
+
+       json_object_object_get_ex(jobj_token, "keyslots", &jobj_token_keyslots);
+
+       for (i = 0; i < (int) json_object_array_length(jobj_token_keyslots); i++) {
+               jobj = json_object_array_get_idx(jobj_token_keyslots, i);
+               if (keyslot == atoi(json_object_get_string(jobj)))
+                       return 0;
+       }
+
+       return -ENOENT;
+}
+
+int LUKS2_tokens_count(struct luks2_hdr *hdr)
+{
+       json_object *jobj_tokens = LUKS2_get_tokens_jobj(hdr);
+       if (!jobj_tokens)
+               return -EINVAL;
+
+       return json_object_object_length(jobj_tokens);
+}
diff --git a/lib/luks2/luks2_token_keyring.c b/lib/luks2/luks2_token_keyring.c
new file mode 100644 (file)
index 0000000..448ad45
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * LUKS - Linux Unified Key Setup v2, kernel keyring token
+ *
+ * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <assert.h>
+
+#include "luks2_internal.h"
+
+static int keyring_open(struct crypt_device *cd,
+                               int token,
+                               char **buffer,
+                               size_t *buffer_len,
+                               void *usrptr __attribute__((unused)))
+{
+       json_object *jobj_token, *jobj_key;
+       struct luks2_hdr *hdr;
+       int r;
+
+       if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
+               return -EINVAL;
+
+       jobj_token = LUKS2_get_token_jobj(hdr, token);
+       if (!jobj_token)
+               return -EINVAL;
+
+       json_object_object_get_ex(jobj_token, "key_description", &jobj_key);
+
+       r = keyring_get_passphrase(json_object_get_string(jobj_key), buffer, buffer_len);
+       if (r == -ENOTSUP) {
+               log_dbg(cd, "Kernel keyring features disabled.");
+               return -EINVAL;
+       } else if (r < 0) {
+               log_dbg(cd, "keyring_get_passphrase failed (error %d)", r);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int keyring_validate(struct crypt_device *cd __attribute__((unused)),
+                                   const char *json)
+{
+       enum json_tokener_error jerr;
+       json_object *jobj_token, *jobj_key;
+       int r = 1;
+
+       log_dbg(cd, "Validating keyring token json");
+
+       jobj_token = json_tokener_parse_verbose(json, &jerr);
+       if (!jobj_token) {
+               log_dbg(cd, "Keyring token JSON parse failed.");
+               return r;
+       }
+
+       if (json_object_object_length(jobj_token) != 3) {
+               log_dbg(cd, "Keyring token is expected to have exactly 3 fields.");
+               goto out;
+       }
+
+       if (!json_object_object_get_ex(jobj_token, "key_description", &jobj_key)) {
+               log_dbg(cd, "missing key_description field.");
+               goto out;
+       }
+
+       if (!json_object_is_type(jobj_key, json_type_string)) {
+               log_dbg(cd, "key_description is not a string.");
+               goto out;
+       }
+
+       /* TODO: perhaps check that key description is in '%s:%s'
+        * format where both strings are not empty */
+       r = !strlen(json_object_get_string(jobj_key));
+out:
+       json_object_put(jobj_token);
+       return r;
+}
+
+static void keyring_dump(struct crypt_device *cd, const char *json)
+{
+       enum json_tokener_error jerr;
+       json_object *jobj_token, *jobj_key;
+
+       jobj_token = json_tokener_parse_verbose(json, &jerr);
+       if (!jobj_token)
+               return;
+
+       if (!json_object_object_get_ex(jobj_token, "key_description", &jobj_key)) {
+               json_object_put(jobj_token);
+               return;
+       }
+
+       log_std(cd, "\tKey description: %s\n", json_object_get_string(jobj_key));
+
+       json_object_put(jobj_token);
+}
+
+int token_keyring_set(json_object **jobj_builtin_token,
+       const void *params)
+{
+       json_object *jobj_token, *jobj;
+       const struct crypt_token_params_luks2_keyring *keyring_params = (const struct crypt_token_params_luks2_keyring *) params;
+
+       jobj_token = json_object_new_object();
+       if (!jobj_token)
+               return -ENOMEM;
+
+       jobj = json_object_new_string(LUKS2_TOKEN_KEYRING);
+       if (!jobj) {
+               json_object_put(jobj_token);
+               return -ENOMEM;
+       }
+       json_object_object_add(jobj_token, "type", jobj);
+
+       jobj = json_object_new_array();
+       if (!jobj) {
+               json_object_put(jobj_token);
+               return -ENOMEM;
+       }
+       json_object_object_add(jobj_token, "keyslots", jobj);
+
+       jobj = json_object_new_string(keyring_params->key_description);
+       if (!jobj) {
+               json_object_put(jobj_token);
+               return -ENOMEM;
+       }
+       json_object_object_add(jobj_token, "key_description", jobj);
+
+       *jobj_builtin_token = jobj_token;
+       return 0;
+}
+
+int token_keyring_get(json_object *jobj_token,
+       void *params)
+{
+       json_object *jobj;
+       struct crypt_token_params_luks2_keyring *keyring_params = (struct crypt_token_params_luks2_keyring *) params;
+
+       json_object_object_get_ex(jobj_token, "type", &jobj);
+       assert(!strcmp(json_object_get_string(jobj), LUKS2_TOKEN_KEYRING));
+
+       json_object_object_get_ex(jobj_token, "key_description", &jobj);
+
+       keyring_params->key_description = json_object_get_string(jobj);
+
+       return 0;
+}
+
+const crypt_token_handler keyring_handler = {
+       .name = LUKS2_TOKEN_KEYRING,
+       .open = keyring_open,
+       .validate = keyring_validate,
+       .dump = keyring_dump
+};
index 25c8a2c..060be4f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * cryptsetup kernel RNG access functions
  *
- * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -20,7 +20,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <assert.h>
 #include <sys/select.h>
@@ -152,21 +151,24 @@ int crypt_random_init(struct crypt_device *ctx)
 
        /* Used for CRYPT_RND_NORMAL */
        if(urandom_fd == -1)
-               urandom_fd = open(URANDOM_DEVICE, O_RDONLY);
+               urandom_fd = open(URANDOM_DEVICE, O_RDONLY | O_CLOEXEC);
        if(urandom_fd == -1)
                goto fail;
 
        /* Used for CRYPT_RND_KEY */
        if(random_fd == -1)
-               random_fd = open(RANDOM_DEVICE, O_RDONLY | O_NONBLOCK);
+               random_fd = open(RANDOM_DEVICE, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
        if(random_fd == -1)
                goto fail;
 
+       if (crypt_fips_mode())
+               log_verbose(ctx, _("Running in FIPS mode."));
+
        random_initialised = 1;
        return 0;
 fail:
        crypt_random_exit();
-       log_err(ctx, _("Fatal error during RNG initialisation.\n"));
+       log_err(ctx, _("Fatal error during RNG initialisation."));
        return -ENOSYS;
 }
 
@@ -203,13 +205,12 @@ int crypt_random_get(struct crypt_device *ctx, char *buf, size_t len, int qualit
                }
                break;
        default:
-               log_err(ctx, _("Unknown RNG quality requested.\n"));
+               log_err(ctx, _("Unknown RNG quality requested."));
                return -EINVAL;
        }
 
        if (status)
-               log_err(ctx, _("Error %d reading from RNG: %s\n"),
-                       errno, strerror(errno));
+               log_err(ctx, _("Error reading from RNG."));
 
        return status;
 }
@@ -231,9 +232,11 @@ void crypt_random_exit(void)
 
 int crypt_random_default_key_rng(void)
 {
+       /* coverity[pointless_string_compare] */
        if (!strcmp(DEFAULT_RNG, RANDOM_DEVICE))
                return CRYPT_RNG_RANDOM;
 
+       /* coverity[pointless_string_compare] */
        if (!strcmp(DEFAULT_RNG, URANDOM_DEVICE))
                return CRYPT_RNG_URANDOM;
 
index 01e2c80..567f262 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * libcryptsetup - cryptsetup library
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2014, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #include <stdlib.h>
 #include <stdarg.h>
 #include <sys/utsname.h>
-#include <fcntl.h>
 #include <errno.h>
 
 #include "libcryptsetup.h"
 #include "luks.h"
+#include "luks2.h"
 #include "loopaes.h"
 #include "verity.h"
 #include "tcrypt.h"
+#include "integrity.h"
+#include "bitlk.h"
+#include "utils_device_locking.h"
 #include "internal.h"
 
+#define CRYPT_CD_UNRESTRICTED  (1 << 0)
+#define CRYPT_CD_QUIET         (1 << 1)
+
 struct crypt_device {
        char *type;
 
@@ -43,11 +49,20 @@ struct crypt_device {
        struct device *metadata_device;
 
        struct volume_key *volume_key;
-       uint64_t timeout;
-       uint64_t iteration_time;
-       int tries;
-       int password_verify;
        int rng_type;
+       uint32_t compatibility;
+       struct crypt_pbkdf_type pbkdf;
+
+       /* global context scope settings */
+       unsigned key_in_keyring:1;
+
+       uint64_t data_offset;
+       uint64_t metadata_size; /* Used in LUKS2 format */
+       uint64_t keyslots_size; /* Used in LUKS2 format */
+
+       /* Workaround for OOM during parallel activation (like in systemd) */
+       bool memory_hard_pbkdf_lock_enabled;
+       struct crypt_lock_handle *pbkdf_memory_hard_lock;
 
        // FIXME: private binary headers and access it properly
        // through sub-library (LUKS1, TCRYPT)
@@ -55,35 +70,57 @@ struct crypt_device {
        union {
        struct { /* used in CRYPT_LUKS1 */
                struct luks_phdr hdr;
-               uint64_t PBKDF2_per_sec;
+               char *cipher_spec;
        } luks1;
+       struct { /* used in CRYPT_LUKS2 */
+               struct luks2_hdr hdr;
+               char cipher[MAX_CIPHER_LEN];      /* only for compatibility */
+               char cipher_mode[MAX_CIPHER_LEN]; /* only for compatibility */
+               char *keyslot_cipher;
+               unsigned int keyslot_key_size;
+               struct luks2_reenc_context *rh;
+       } luks2;
        struct { /* used in CRYPT_PLAIN */
                struct crypt_params_plain hdr;
+               char *cipher_spec;
                char *cipher;
-               char *cipher_mode;
+               const char *cipher_mode;
                unsigned int key_size;
        } plain;
        struct { /* used in CRYPT_LOOPAES */
                struct crypt_params_loopaes hdr;
+               char *cipher_spec;
                char *cipher;
-               char *cipher_mode;
+               const char *cipher_mode;
                unsigned int key_size;
        } loopaes;
        struct { /* used in CRYPT_VERITY */
                struct crypt_params_verity hdr;
-               char *root_hash;
+               const char *root_hash;
                unsigned int root_hash_size;
                char *uuid;
+               struct device *fec_device;
        } verity;
        struct { /* used in CRYPT_TCRYPT */
                struct crypt_params_tcrypt params;
                struct tcrypt_phdr hdr;
        } tcrypt;
+       struct { /* used in CRYPT_INTEGRITY */
+               struct crypt_params_integrity params;
+               struct volume_key *journal_mac_key;
+               struct volume_key *journal_crypt_key;
+               uint32_t sb_flags;
+       } integrity;
+       struct { /* used in CRYPT_BITLK */
+               struct bitlk_metadata params;
+               char *cipher_spec;
+       } bitlk;
        struct { /* used if initialized without header by name */
                char *active_name;
                /* buffers, must refresh from kernel on every query */
+               char cipher_spec[MAX_CIPHER_LEN*2+1];
                char cipher[MAX_CIPHER_LEN];
-               char cipher_mode[MAX_CIPHER_LEN];
+               const char *cipher_mode;
                unsigned int key_size;
        } none;
        } u;
@@ -93,24 +130,24 @@ struct crypt_device {
        void *log_usrptr;
        int (*confirm)(const char *msg, void *usrptr);
        void *confirm_usrptr;
-       int (*password)(const char *msg, char *buf, size_t length, void *usrptr);
-       void *password_usrptr;
-
-       /* last error message */
-       char error[MAX_ERROR_LENGTH];
 };
 
 /* Just to suppress redundant messages about crypto backend */
 static int _crypto_logged = 0;
 
-/* Global error */
-/* FIXME: not thread safe, remove this later */
-static char global_error[MAX_ERROR_LENGTH] = {0};
-
 /* Log helper */
 static void (*_default_log)(int level, const char *msg, void *usrptr) = NULL;
 static int _debug_level = 0;
 
+/* Library can do metadata locking  */
+static int _metadata_locking = 1;
+
+/* Library scope detection for kernel keyring support */
+static int _kernel_keyring_supported;
+
+/* Library allowed to use kernel keyring for loading VK in kernel crypto layer */
+static int _vk_via_keyring = 1;
+
 void crypt_set_debug_level(int level)
 {
        _debug_level = level;
@@ -121,32 +158,21 @@ int crypt_get_debug_level(void)
        return _debug_level;
 }
 
-static void crypt_set_error(struct crypt_device *cd, const char *error)
+void crypt_log(struct crypt_device *cd, int level, const char *msg)
 {
-       size_t size = strlen(error);
-
-       /* Set global error, ugly hack... */
-       strncpy(global_error, error, MAX_ERROR_LENGTH - 2);
-       if (size < MAX_ERROR_LENGTH && global_error[size - 1] == '\n')
-               global_error[size - 1] = '\0';
+       if (!msg)
+               return;
 
-       /* Set error string per context */
-       if (cd) {
-               strncpy(cd->error, error, MAX_ERROR_LENGTH - 2);
-               if (size < MAX_ERROR_LENGTH && cd->error[size - 1] == '\n')
-                       cd->error[size - 1] = '\0';
-       }
-}
+       if (level < _debug_level)
+               return;
 
-void crypt_log(struct crypt_device *cd, int level, const char *msg)
-{
        if (cd && cd->log)
                cd->log(level, msg, cd->log_usrptr);
        else if (_default_log)
                _default_log(level, msg, NULL);
-
-       if (level == CRYPT_LOG_ERROR)
-               crypt_set_error(cd, msg);
+       /* Default to stdout/stderr if there is no callback. */
+       else
+               fprintf(level == CRYPT_LOG_ERROR ? stderr : stdout, "%s", msg);
 }
 
 __attribute__((format(printf, 5, 6)))
@@ -154,24 +180,22 @@ void logger(struct crypt_device *cd, int level, const char *file,
            int line, const char *format, ...)
 {
        va_list argp;
-       char *target = NULL;
+       char target[LOG_MAX_LEN + 2];
+       int len;
 
        va_start(argp, format);
 
-       if (vasprintf(&target, format, argp) > 0 ) {
-               if (level >= 0) {
-                       crypt_log(cd, level, target);
-#ifdef CRYPT_DEBUG
-               } else if (_debug_level)
-                       printf("# %s:%d %s\n", file ?: "?", line, target);
-#else
-               } else if (_debug_level)
-                       printf("# %s\n", target);
-#endif
+       len = vsnprintf(&target[0], LOG_MAX_LEN, format, argp);
+       if (len > 0 && len < LOG_MAX_LEN) {
+               /* All verbose and error messages in tools end with EOL. */
+               if (level == CRYPT_LOG_VERBOSE || level == CRYPT_LOG_ERROR ||
+                   level == CRYPT_LOG_DEBUG || level == CRYPT_LOG_DEBUG_JSON)
+                       strncat(target, "\n", LOG_MAX_LEN);
+
+               crypt_log(cd, level, target);
        }
 
        va_end(argp);
-       free(target);
 }
 
 static const char *mdata_device_path(struct crypt_device *cd)
@@ -179,6 +203,11 @@ static const char *mdata_device_path(struct crypt_device *cd)
        return device_path(cd->metadata_device ?: cd->device);
 }
 
+static const char *data_device_path(struct crypt_device *cd)
+{
+       return device_path(cd->device);
+}
+
 /* internal only */
 struct device *crypt_metadata_device(struct crypt_device *cd)
 {
@@ -197,18 +226,19 @@ int init_crypto(struct crypt_device *ctx)
 
        r = crypt_random_init(ctx);
        if (r < 0) {
-               log_err(ctx, _("Cannot initialize crypto RNG backend.\n"));
+               log_err(ctx, _("Cannot initialize crypto RNG backend."));
                return r;
        }
 
-       r = crypt_backend_init(ctx);
+       r = crypt_backend_init();
        if (r < 0)
-               log_err(ctx, _("Cannot initialize crypto backend.\n"));
+               log_err(ctx, _("Cannot initialize crypto backend."));
 
        if (!r && !_crypto_logged) {
-               log_dbg("Crypto backend (%s) initialized.", crypt_backend_version());
+               log_dbg(ctx, "Crypto backend (%s) initialized in cryptsetup library version %s.",
+                       crypt_backend_version(), PACKAGE_VERSION);
                if (!uname(&uts))
-                       log_dbg("Detected kernel %s %s %s.",
+                       log_dbg(ctx, "Detected kernel %s %s %s.",
                                uts.sysname, uts.release, uts.machine);
                _crypto_logged = 1;
        }
@@ -233,10 +263,10 @@ static int process_key(struct crypt_device *cd, const char *hash_name,
                r = crypt_plain_hash(cd, hash_name, (*vk)->key, key_size, pass, passLen);
                if (r < 0) {
                        if (r == -ENOENT)
-                               log_err(cd, _("Hash algorithm %s not supported.\n"),
+                               log_err(cd, _("Hash algorithm %s not supported."),
                                        hash_name);
                        else
-                               log_err(cd, _("Key processing error (using hash %s).\n"),
+                               log_err(cd, _("Key processing error (using hash %s)."),
                                        hash_name);
                        crypt_free_volume_key(*vk);
                        *vk = NULL;
@@ -256,11 +286,21 @@ static int isPLAIN(const char *type)
        return (type && !strcmp(CRYPT_PLAIN, type));
 }
 
-static int isLUKS(const char *type)
+static int isLUKS1(const char *type)
 {
        return (type && !strcmp(CRYPT_LUKS1, type));
 }
 
+static int isLUKS2(const char *type)
+{
+       return (type && !strcmp(CRYPT_LUKS2, type));
+}
+
+static int isLUKS(const char *type)
+{
+       return (isLUKS2(type) || isLUKS1(type));
+}
+
 static int isLOOPAES(const char *type)
 {
        return (type && !strcmp(CRYPT_LOOPAES, type));
@@ -276,20 +316,75 @@ static int isTCRYPT(const char *type)
        return (type && !strcmp(CRYPT_TCRYPT, type));
 }
 
-static int onlyLUKS(struct crypt_device *cd)
+static int isINTEGRITY(const char *type)
+{
+       return (type && !strcmp(CRYPT_INTEGRITY, type));
+}
+
+static int isBITLK(const char *type)
+{
+       return (type && !strcmp(CRYPT_BITLK, type));
+}
+
+static int _onlyLUKS(struct crypt_device *cd, uint32_t cdflags)
 {
        int r = 0;
 
        if (cd && !cd->type) {
-               log_err(cd, _("Cannot determine device type. Incompatible activation of device?\n"));
+               if (!(cdflags & CRYPT_CD_QUIET))
+                       log_err(cd, _("Cannot determine device type. Incompatible activation of device?"));
                r = -EINVAL;
        }
+
        if (!cd || !isLUKS(cd->type)) {
-               log_err(cd, _("This operation is supported only for LUKS device.\n"));
+               if (!(cdflags & CRYPT_CD_QUIET))
+                       log_err(cd, _("This operation is supported only for LUKS device."));
                r = -EINVAL;
        }
 
-       return r;
+       if (r || (cdflags & CRYPT_CD_UNRESTRICTED) || isLUKS1(cd->type))
+               return r;
+
+       return LUKS2_unmet_requirements(cd, &cd->u.luks2.hdr, 0, cdflags & CRYPT_CD_QUIET);
+}
+
+static int onlyLUKS(struct crypt_device *cd)
+{
+       return _onlyLUKS(cd, 0);
+}
+
+static int _onlyLUKS2(struct crypt_device *cd, uint32_t cdflags, uint32_t mask)
+{
+       int r = 0;
+
+       if (cd && !cd->type) {
+               if (!(cdflags & CRYPT_CD_QUIET))
+                       log_err(cd, _("Cannot determine device type. Incompatible activation of device?"));
+               r = -EINVAL;
+       }
+
+       if (!cd || !isLUKS2(cd->type)) {
+               if (!(cdflags & CRYPT_CD_QUIET))
+                       log_err(cd, _("This operation is supported only for LUKS2 device."));
+               r = -EINVAL;
+       }
+
+       if (r || (cdflags & CRYPT_CD_UNRESTRICTED))
+               return r;
+
+       return LUKS2_unmet_requirements(cd, &cd->u.luks2.hdr, mask, cdflags & CRYPT_CD_QUIET);
+}
+
+/* Internal only */
+int onlyLUKS2(struct crypt_device *cd)
+{
+       return _onlyLUKS2(cd, 0, 0);
+}
+
+/* Internal only */
+int onlyLUKS2mask(struct crypt_device *cd, uint32_t mask)
+{
+       return _onlyLUKS2(cd, 0, mask);
 }
 
 static void crypt_set_null_type(struct crypt_device *cd)
@@ -300,6 +395,9 @@ static void crypt_set_null_type(struct crypt_device *cd)
        free(cd->type);
        cd->type = NULL;
        cd->u.none.active_name = NULL;
+       cd->data_offset = 0;
+       cd->metadata_size = 0;
+       cd->keyslots_size = 0;
 }
 
 static void crypt_reset_null_type(struct crypt_device *cd)
@@ -314,34 +412,44 @@ static void crypt_reset_null_type(struct crypt_device *cd)
 /* keyslot helpers */
 static int keyslot_verify_or_find_empty(struct crypt_device *cd, int *keyslot)
 {
+       crypt_keyslot_info ki;
+
        if (*keyslot == CRYPT_ANY_SLOT) {
-               *keyslot = LUKS_keyslot_find_empty(&cd->u.luks1.hdr);
+               if (isLUKS1(cd->type))
+                       *keyslot = LUKS_keyslot_find_empty(&cd->u.luks1.hdr);
+               else
+                       *keyslot = LUKS2_keyslot_find_empty(&cd->u.luks2.hdr);
                if (*keyslot < 0) {
-                       log_err(cd, _("All key slots full.\n"));
+                       log_err(cd, _("All key slots full."));
                        return -EINVAL;
                }
        }
 
-       switch (LUKS_keyslot_info(&cd->u.luks1.hdr, *keyslot)) {
+       if (isLUKS1(cd->type))
+               ki = LUKS_keyslot_info(&cd->u.luks1.hdr, *keyslot);
+       else
+               ki = LUKS2_keyslot_info(&cd->u.luks2.hdr, *keyslot);
+       switch (ki) {
                case CRYPT_SLOT_INVALID:
-                       log_err(cd, _("Key slot %d is invalid, please select between 0 and %d.\n"),
+                       log_err(cd, _("Key slot %d is invalid, please select between 0 and %d."),
                                *keyslot, LUKS_NUMKEYS - 1);
                        return -EINVAL;
                case CRYPT_SLOT_INACTIVE:
                        break;
                default:
-                       log_err(cd, _("Key slot %d is full, please select another one.\n"),
+                       log_err(cd, _("Key slot %d is full, please select another one."),
                                *keyslot);
                        return -EINVAL;
        }
 
+       log_dbg(cd, "Selected keyslot %d.", *keyslot);
        return 0;
 }
 
 /*
  * compares UUIDs returned by device-mapper (striped by cryptsetup) and uuid in header
  */
-static int crypt_uuid_cmp(const char *dm_uuid, const char *hdr_uuid)
+int crypt_uuid_cmp(const char *dm_uuid, const char *hdr_uuid)
 {
        int i, j;
        char *str;
@@ -373,7 +481,7 @@ static int crypt_uuid_cmp(const char *dm_uuid, const char *hdr_uuid)
  */
 static int crypt_uuid_type_cmp(struct crypt_device *cd, const char *type)
 {
-       struct crypt_dm_active_device dmd = {};
+       struct crypt_dm_active_device dmd;
        size_t len;
        int r;
 
@@ -381,7 +489,7 @@ static int crypt_uuid_type_cmp(struct crypt_device *cd, const char *type)
        if (cd->type || !cd->u.none.active_name)
                return -EINVAL;
 
-       log_dbg("Checking if active device %s without header has UUID type %s.",
+       log_dbg(cd, "Checking if active device %s without header has UUID type %s.",
                cd->u.none.active_name, type);
 
        r = dm_query_device(cd, cd->u.none.active_name, DM_ACTIVE_UUID, &dmd);
@@ -405,45 +513,29 @@ int PLAIN_activate(struct crypt_device *cd,
                     uint32_t flags)
 {
        int r;
-       char *dm_cipher = NULL;
-       enum devcheck device_check;
        struct crypt_dm_active_device dmd = {
-               .target = DM_CRYPT,
-               .size   = size,
-               .flags  = flags,
-               .data_device = crypt_data_device(cd),
-               .u.crypt  = {
-                       .cipher = NULL,
-                       .vk     = vk,
-                       .offset = crypt_get_data_offset(cd),
-                       .iv_offset = crypt_get_iv_offset(cd),
-               }
+               .flags = flags,
+               .size = size,
        };
 
-       if (dmd.flags & CRYPT_ACTIVATE_SHARED)
-               device_check = DEV_SHARED;
-       else
-               device_check = DEV_EXCL;
+       log_dbg(cd, "Trying to activate PLAIN device %s using cipher %s.",
+               name, crypt_get_cipher_spec(cd));
 
-       r = device_block_adjust(cd, dmd.data_device, device_check,
-                               dmd.u.crypt.offset, &dmd.size, &dmd.flags);
-       if (r)
-               return r;
+       if (MISALIGNED(size, device_block_size(cd, crypt_data_device(cd)) >> SECTOR_SHIFT)) {
+               log_err(cd, _("Device size is not aligned to device logical block size."));
+               return -EINVAL;
+       }
 
-       if (crypt_get_cipher_mode(cd))
-               r = asprintf(&dm_cipher, "%s-%s", crypt_get_cipher(cd), crypt_get_cipher_mode(cd));
-       else
-               r = asprintf(&dm_cipher, "%s", crypt_get_cipher(cd));
+       r = dm_crypt_target_set(&dmd.segment, 0, dmd.size, crypt_data_device(cd),
+                       vk, crypt_get_cipher_spec(cd), crypt_get_iv_offset(cd),
+                       crypt_get_data_offset(cd), crypt_get_integrity(cd),
+                       crypt_get_integrity_tag_size(cd), crypt_get_sector_size(cd));
        if (r < 0)
-               return -ENOMEM;
-
-       dmd.u.crypt.cipher = dm_cipher;
-       log_dbg("Trying to activate PLAIN device %s using cipher %s.",
-               name, dmd.u.crypt.cipher);
+               return r;
 
-       r = dm_create_device(cd, name, CRYPT_PLAIN, &dmd, 0);
+       r = create_or_reload_device(cd, name, CRYPT_PLAIN, &dmd);
 
-       free(dm_cipher);
+       dm_targets_free(cd, &dmd);
        return r;
 }
 
@@ -455,98 +547,6 @@ int crypt_confirm(struct crypt_device *cd, const char *msg)
                return cd->confirm(msg, cd->confirm_usrptr);
 }
 
-static int key_from_terminal(struct crypt_device *cd, char *msg, char **key,
-                             size_t *key_len, int force_verify)
-{
-       char *prompt = NULL, *device_name;
-       int r;
-
-       *key = NULL;
-       if(!msg) {
-               if (crypt_loop_device(crypt_get_device_name(cd)))
-                       device_name = crypt_loop_backing_file(crypt_get_device_name(cd));
-               else
-                       device_name = strdup(crypt_get_device_name(cd));
-               if (!device_name)
-                       return -ENOMEM;
-               r = asprintf(&prompt, _("Enter passphrase for %s: "), device_name);
-               free(device_name);
-               if (r < 0)
-                       return -ENOMEM;
-               msg = prompt;
-       }
-
-       if (cd->password) {
-               *key = crypt_safe_alloc(DEFAULT_PASSPHRASE_SIZE_MAX);
-               if (!*key) {
-                       r = -ENOMEM;
-                       goto out;
-               }
-               r = cd->password(msg, *key, DEFAULT_PASSPHRASE_SIZE_MAX,
-                                cd->password_usrptr);
-               if (r < 0) {
-                       crypt_safe_free(*key);
-                       *key = NULL;
-               } else
-                       *key_len = r;
-       } else
-               r = crypt_get_key(msg, key, key_len, 0, 0, NULL, cd->timeout,
-                                 (force_verify || cd->password_verify), cd);
-out:
-       free(prompt);
-       return (r < 0) ? r: 0;
-}
-
-static int volume_key_by_terminal_passphrase(struct crypt_device *cd, int keyslot,
-                                            struct volume_key **vk)
-{
-       char *passphrase_read = NULL;
-       size_t passphrase_size_read;
-       int r = -EINVAL, eperm = 0, tries = cd->tries;
-
-       *vk = NULL;
-       do {
-               crypt_free_volume_key(*vk);
-               *vk = NULL;
-
-               r = key_from_terminal(cd, NULL, &passphrase_read,
-                                     &passphrase_size_read, 0);
-               /* Continue if it is just passphrase verify mismatch */
-               if (r == -EPERM)
-                       continue;
-               if(r < 0)
-                       goto out;
-
-               r = LUKS_open_key_with_hdr(keyslot, passphrase_read,
-                                          passphrase_size_read, &cd->u.luks1.hdr, vk, cd);
-               if (r == -EPERM)
-                       eperm = 1;
-               crypt_safe_free(passphrase_read);
-               passphrase_read = NULL;
-       } while (r == -EPERM && (--tries > 0));
-out:
-       if (r < 0) {
-               crypt_free_volume_key(*vk);
-               *vk = NULL;
-
-               /* Report wrong passphrase if at least one try failed */
-               if (eperm && r == -EPIPE)
-                       r = -EPERM;
-       }
-
-       crypt_safe_free(passphrase_read);
-       return r;
-}
-
-static int key_from_file(struct crypt_device *cd, char *msg,
-                         char **key, size_t *key_len,
-                         const char *key_file, size_t key_offset,
-                         size_t key_size)
-{
-       return crypt_get_key(msg, key, key_len, key_offset, key_size, key_file,
-                            cd->timeout, 0, cd);
-}
-
 void crypt_set_log_callback(struct crypt_device *cd,
        void (*log)(int level, const char *msg, void *usrptr),
        void *usrptr)
@@ -563,40 +563,10 @@ void crypt_set_confirm_callback(struct crypt_device *cd,
        int (*confirm)(const char *msg, void *usrptr),
        void *usrptr)
 {
-       cd->confirm = confirm;
-       cd->confirm_usrptr = usrptr;
-}
-
-void crypt_set_password_callback(struct crypt_device *cd,
-       int (*password)(const char *msg, char *buf, size_t length, void *usrptr),
-       void *usrptr)
-{
-       cd->password = password;
-       cd->password_usrptr = usrptr;
-}
-
-static void _get_error(char *error, char *buf, size_t size)
-{
-       if (!buf || size < 1)
-               error[0] = '\0';
-       else if (*error) {
-               strncpy(buf, error, size - 1);
-               buf[size - 1] = '\0';
-               error[0] = '\0';
-       } else
-               buf[0] = '\0';
-}
-
-void crypt_last_error(struct crypt_device *cd, char *buf, size_t size)
-{
-       if (cd)
-               return _get_error(cd->error, buf, size);
-}
-
-/* Deprecated global error interface */
-void crypt_get_error(char *buf, size_t size)
-{
-       return _get_error(global_error, buf, size);
+       if (cd) {
+               cd->confirm = confirm;
+               cd->confirm_usrptr = usrptr;
+       }
 }
 
 const char *crypt_get_dir(void)
@@ -612,27 +582,28 @@ int crypt_init(struct crypt_device **cd, const char *device)
        if (!cd)
                return -EINVAL;
 
-       log_dbg("Allocating crypt device %s context.", device);
+       log_dbg(NULL, "Allocating context for crypt device %s.", device ?: "(none)");
+#if !HAVE_DECL_O_CLOEXEC
+       log_dbg(NULL, "Running without O_CLOEXEC.");
+#endif
 
        if (!(h = malloc(sizeof(struct crypt_device))))
                return -ENOMEM;
 
        memset(h, 0, sizeof(*h));
 
-       r = device_alloc(&h->device, device);
+       r = device_alloc(NULL, &h->device, device);
        if (r < 0)
                goto bad;
 
-       dm_backend_init();
+       dm_backend_init(NULL);
 
-       h->iteration_time = 1000;
-       h->password_verify = 0;
-       h->tries = 3;
        h->rng_type = crypt_random_default_key_rng();
+
        *cd = h;
        return 0;
 bad:
-       device_free(h->device);
+       device_free(NULL, h->device);
        free(h);
        return r;
 }
@@ -642,7 +613,7 @@ static int crypt_check_data_device_size(struct crypt_device *cd)
        int r;
        uint64_t size, size_min;
 
-       /* Check data device size, require at least one sector */
+       /* Check data device size, require at least header or one sector */
        size_min = crypt_get_data_offset(cd) << SECTOR_SHIFT ?: SECTOR_SIZE;
 
        r = device_size(cd->device, &size);
@@ -650,7 +621,7 @@ static int crypt_check_data_device_size(struct crypt_device *cd)
                return r;
 
        if (size < size_min) {
-               log_err(cd, _("Header detected but device %s is too small.\n"),
+               log_err(cd, _("Header detected but device %s is too small."),
                        device_path(cd->device));
                return -EINVAL;
        }
@@ -658,53 +629,211 @@ static int crypt_check_data_device_size(struct crypt_device *cd)
        return r;
 }
 
-int crypt_set_data_device(struct crypt_device *cd, const char *device)
+static int _crypt_set_data_device(struct crypt_device *cd, const char *device)
 {
        struct device *dev = NULL;
        int r;
 
-       log_dbg("Setting ciphertext data device to %s.", device ?: "(none)");
-
-       if (!isLUKS(cd->type) && !isVERITY(cd->type)) {
-               log_err(cd, _("This operation is not supported for this device type.\n"));
-               return  -EINVAL;
-       }
-
-       /* metadata device must be set */
-       if (!cd->device || !device)
-               return -EINVAL;
-
-       r = device_alloc(&dev, device);
+       r = device_alloc(cd, &dev, device);
        if (r < 0)
                return r;
 
        if (!cd->metadata_device) {
                cd->metadata_device = cd->device;
        } else
-               device_free(cd->device);
+               device_free(cd, cd->device);
 
        cd->device = dev;
 
        return crypt_check_data_device_size(cd);
 }
 
-static int _crypt_load_luks1(struct crypt_device *cd, int require_header, int repair)
+int crypt_set_data_device(struct crypt_device *cd, const char *device)
+{
+       /* metadata device must be set */
+       if (!cd || !cd->device || !device)
+               return -EINVAL;
+
+       log_dbg(cd, "Setting ciphertext data device to %s.", device ?: "(none)");
+
+       if (!isLUKS1(cd->type) && !isLUKS2(cd->type) && !isVERITY(cd->type) &&
+           !isINTEGRITY(cd->type)) {
+               log_err(cd, _("This operation is not supported for this device type."));
+               return -EINVAL;
+       }
+
+       if (isLUKS2(cd->type) && crypt_get_reenc_context(cd)) {
+               log_err(cd, _("Illegal operation with reencryption in-progress."));
+               return -EINVAL;
+       }
+
+       return _crypt_set_data_device(cd, device);
+}
+
+int crypt_init_data_device(struct crypt_device **cd, const char *device, const char *data_device)
 {
-       struct luks_phdr hdr;
        int r;
 
-       r = init_crypto(cd);
-       if (r < 0)
+       if (!cd)
+               return -EINVAL;
+
+       r = crypt_init(cd, device);
+       if (r || !data_device || !strcmp(device, data_device))
+               return r;
+
+       log_dbg(NULL, "Setting ciphertext data device to %s.", data_device);
+       r = _crypt_set_data_device(*cd, data_device);
+       if (r) {
+               crypt_free(*cd);
+               *cd = NULL;
+       }
+
+       return r;
+}
+
+
+/* internal only */
+struct crypt_pbkdf_type *crypt_get_pbkdf(struct crypt_device *cd)
+{
+       return &cd->pbkdf;
+}
+
+/*
+ * crypt_load() helpers
+ */
+static int _crypt_load_luks2(struct crypt_device *cd, int reload, int repair)
+{
+       int r;
+       char *type = NULL;
+       struct luks2_hdr hdr2 = {};
+
+       log_dbg(cd, "%soading LUKS2 header (repair %sabled).", reload ? "Rel" : "L", repair ? "en" : "dis");
+
+       r = LUKS2_hdr_read(cd, &hdr2, repair);
+       if (r)
                return r;
 
-       r = LUKS_read_phdr(&hdr, require_header, repair, cd);
+       if (!reload && !(type = strdup(CRYPT_LUKS2))) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       if (verify_pbkdf_params(cd, &cd->pbkdf)) {
+               r = init_pbkdf_type(cd, NULL, CRYPT_LUKS2);
+               if (r)
+                       goto out;
+       }
+
+       if (reload) {
+               LUKS2_hdr_free(cd, &cd->u.luks2.hdr);
+               free(cd->u.luks2.keyslot_cipher);
+       } else
+               cd->type = type;
+
+       r = 0;
+       memcpy(&cd->u.luks2.hdr, &hdr2, sizeof(hdr2));
+       cd->u.luks2.keyslot_cipher = NULL;
+       cd->u.luks2.rh = NULL;
+
+out:
+       if (r) {
+               free(type);
+               LUKS2_hdr_free(cd, &hdr2);
+       }
+       return r;
+}
+
+static void _luks2_reload(struct crypt_device *cd)
+{
+       if (!cd || !isLUKS2(cd->type))
+               return;
+
+       (void) _crypt_load_luks2(cd, 1, 0);
+}
+
+static int _crypt_load_luks(struct crypt_device *cd, const char *requested_type,
+                           int require_header, int repair)
+{
+       char *cipher_spec;
+       struct luks_phdr hdr = {};
+       int r, version;
+
+       r = init_crypto(cd);
        if (r < 0)
                return r;
 
-       if (!cd->type && !(cd->type = strdup(CRYPT_LUKS1)))
-               return -ENOMEM;
+       /* This will return 0 if primary LUKS2 header is damaged */
+       version = LUKS2_hdr_version_unlocked(cd, NULL);
+
+       if ((isLUKS1(requested_type) && version == 2) ||
+           (isLUKS2(requested_type) && version == 1))
+               return -EINVAL;
+
+       if (requested_type)
+               version = 0;
+
+       if (isLUKS1(requested_type) || version == 1) {
+               if (cd->type && isLUKS2(cd->type)) {
+                       log_dbg(cd, "Context is already initialized to type %s", cd->type);
+                       return -EINVAL;
+               }
 
-       memcpy(&cd->u.luks1.hdr, &hdr, sizeof(hdr));
+               if (verify_pbkdf_params(cd, &cd->pbkdf)) {
+                       r = init_pbkdf_type(cd, NULL, CRYPT_LUKS1);
+                       if (r)
+                               return r;
+               }
+
+               r = LUKS_read_phdr(&hdr, require_header, repair, cd);
+               if (r)
+                       goto out;
+
+               if (!cd->type && !(cd->type = strdup(CRYPT_LUKS1))) {
+                       r = -ENOMEM;
+                       goto out;
+               }
+
+               /* Set hash to the same as in the loaded header */
+               if (!cd->pbkdf.hash || strcmp(cd->pbkdf.hash, hdr.hashSpec)) {
+                       free(CONST_CAST(void*)cd->pbkdf.hash);
+                       cd->pbkdf.hash = strdup(hdr.hashSpec);
+                       if (!cd->pbkdf.hash) {
+                               r = -ENOMEM;
+                               goto out;
+                       }
+               }
+
+               if (asprintf(&cipher_spec, "%s-%s", hdr.cipherName, hdr.cipherMode) < 0) {
+                       r = -ENOMEM;
+                       goto out;
+               }
+
+               free(cd->u.luks1.cipher_spec);
+               cd->u.luks1.cipher_spec = cipher_spec;
+
+               memcpy(&cd->u.luks1.hdr, &hdr, sizeof(hdr));
+       } else if (isLUKS2(requested_type) || version == 2 || version == 0) {
+               if (cd->type && isLUKS1(cd->type)) {
+                       log_dbg(cd, "Context is already initialized to type %s", cd->type);
+                       return -EINVAL;
+               }
+
+               /*
+                * Current LUKS2 repair just overrides blkid probes
+                * and perform auto-recovery if possible. This is safe
+                * unless future LUKS2 repair code do something more
+                * sophisticated. In such case we would need to check
+                * for LUKS2 requirements and decide if it's safe to
+                * perform repair.
+                */
+               r =  _crypt_load_luks2(cd, cd->type != NULL, repair);
+       } else {
+               if (version > 2)
+                       log_err(cd, _("Unsupported LUKS version %d."), version);
+               r = -EINVAL;
+       }
+out:
+       crypt_safe_memzero(&hdr, sizeof(hdr));
 
        return r;
 }
@@ -716,6 +845,11 @@ static int _crypt_load_tcrypt(struct crypt_device *cd, struct crypt_params_tcryp
        if (!params)
                return -EINVAL;
 
+       if (cd->metadata_device) {
+               log_err(cd, _("Detached metadata device is not supported for this crypt type."));
+               return -EINVAL;
+       }
+
        r = init_crypto(cd);
        if (r < 0)
                return r;
@@ -728,6 +862,7 @@ static int _crypt_load_tcrypt(struct crypt_device *cd, struct crypt_params_tcryp
        cd->u.tcrypt.params.passphrase_size = 0;
        cd->u.tcrypt.params.keyfiles = NULL;
        cd->u.tcrypt.params.keyfiles_count = 0;
+       cd->u.tcrypt.params.veracrypt_pim = 0;
 
        if (r < 0)
                return r;
@@ -757,29 +892,270 @@ static int _crypt_load_verity(struct crypt_device *cd, struct crypt_params_verit
        if (r < 0)
                return r;
 
-       if (params)
-               cd->u.verity.hdr.flags = params->flags;
+       //FIXME: use crypt_free
+       if (!cd->type && !(cd->type = strdup(CRYPT_VERITY))) {
+               free(CONST_CAST(void*)cd->u.verity.hdr.hash_name);
+               free(CONST_CAST(void*)cd->u.verity.hdr.salt);
+               free(cd->u.verity.uuid);
+               crypt_safe_memzero(&cd->u.verity.hdr, sizeof(cd->u.verity.hdr));
+               return -ENOMEM;
+       }
+
+       if (params)
+               cd->u.verity.hdr.flags = params->flags;
 
        /* Hash availability checked in sb load */
        cd->u.verity.root_hash_size = crypt_hash_size(cd->u.verity.hdr.hash_name);
        if (cd->u.verity.root_hash_size > 4096)
                return -EINVAL;
 
-       if (!cd->type && !(cd->type = strdup(CRYPT_VERITY)))
-               return -ENOMEM;
-
        if (params && params->data_device &&
            (r = crypt_set_data_device(cd, params->data_device)) < 0)
                return r;
 
+       if (params && params->fec_device) {
+               r = device_alloc(cd, &cd->u.verity.fec_device, params->fec_device);
+               if (r < 0)
+                       return r;
+               cd->u.verity.hdr.fec_area_offset = params->fec_area_offset;
+               cd->u.verity.hdr.fec_roots = params->fec_roots;
+       }
+
+       return r;
+}
+
+static int _crypt_load_integrity(struct crypt_device *cd,
+                                struct crypt_params_integrity *params)
+{
+       int r;
+
+       r = init_crypto(cd);
+       if (r < 0)
+               return r;
+
+       r = INTEGRITY_read_sb(cd, &cd->u.integrity.params, &cd->u.integrity.sb_flags);
+       if (r < 0)
+               return r;
+
+       // FIXME: add checks for fields in integrity sb vs params
+
+       if (params) {
+               cd->u.integrity.params.journal_watermark = params->journal_watermark;
+               cd->u.integrity.params.journal_commit_time = params->journal_commit_time;
+               cd->u.integrity.params.buffer_sectors = params->buffer_sectors;
+               // FIXME: check ENOMEM
+               if (params->integrity)
+                       cd->u.integrity.params.integrity = strdup(params->integrity);
+               cd->u.integrity.params.integrity_key_size = params->integrity_key_size;
+               if (params->journal_integrity)
+                       cd->u.integrity.params.journal_integrity = strdup(params->journal_integrity);
+               if (params->journal_crypt)
+                       cd->u.integrity.params.journal_crypt = strdup(params->journal_crypt);
+
+               if (params->journal_crypt_key) {
+                       cd->u.integrity.journal_crypt_key =
+                               crypt_alloc_volume_key(params->journal_crypt_key_size,
+                                                      params->journal_crypt_key);
+                       if (!cd->u.integrity.journal_crypt_key)
+                               return -ENOMEM;
+               }
+               if (params->journal_integrity_key) {
+                       cd->u.integrity.journal_mac_key =
+                               crypt_alloc_volume_key(params->journal_integrity_key_size,
+                                                      params->journal_integrity_key);
+                       if (!cd->u.integrity.journal_mac_key)
+                               return -ENOMEM;
+               }
+       }
+
+       if (!cd->type && !(cd->type = strdup(CRYPT_INTEGRITY))) {
+               free(CONST_CAST(void*)cd->u.integrity.params.integrity);
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
+static int _crypt_load_bitlk(struct crypt_device *cd,
+                            struct bitlk_metadata *params)
+{
+       int r;
+
+       r = init_crypto(cd);
+       if (r < 0)
+               return r;
+
+       r = BITLK_read_sb(cd, &cd->u.bitlk.params);
+       if (r < 0)
+               return r;
+
+       if (asprintf(&cd->u.bitlk.cipher_spec, "%s-%s",
+                    cd->u.bitlk.params.cipher, cd->u.bitlk.params.cipher_mode) < 0) {
+               cd->u.bitlk.cipher_spec = NULL;
+               return -ENOMEM;
+       }
+
+       if (!cd->type && !(cd->type = strdup(CRYPT_BITLK)))
+               return -ENOMEM;
+
+       return 0;
+}
+
+int crypt_load(struct crypt_device *cd,
+              const char *requested_type,
+              void *params)
+{
+       int r;
+
+       if (!cd)
+               return -EINVAL;
+
+       log_dbg(cd, "Trying to load %s crypt type from device %s.",
+               requested_type ?: "any", mdata_device_path(cd) ?: "(none)");
+
+       if (!crypt_metadata_device(cd))
+               return -EINVAL;
+
+       crypt_reset_null_type(cd);
+       cd->data_offset = 0;
+       cd->metadata_size = 0;
+       cd->keyslots_size = 0;
+
+       if (!requested_type || isLUKS1(requested_type) || isLUKS2(requested_type)) {
+               if (cd->type && !isLUKS1(cd->type) && !isLUKS2(cd->type)) {
+                       log_dbg(cd, "Context is already initialized to type %s", cd->type);
+                       return -EINVAL;
+               }
+
+               r = _crypt_load_luks(cd, requested_type, 1, 0);
+       } else if (isVERITY(requested_type)) {
+               if (cd->type && !isVERITY(cd->type)) {
+                       log_dbg(cd, "Context is already initialized to type %s", cd->type);
+                       return -EINVAL;
+               }
+               r = _crypt_load_verity(cd, params);
+       } else if (isTCRYPT(requested_type)) {
+               if (cd->type && !isTCRYPT(cd->type)) {
+                       log_dbg(cd, "Context is already initialized to type %s", cd->type);
+                       return -EINVAL;
+               }
+               r = _crypt_load_tcrypt(cd, params);
+       } else if (isINTEGRITY(requested_type)) {
+               if (cd->type && !isINTEGRITY(cd->type)) {
+                       log_dbg(cd, "Context is already initialized to type %s", cd->type);
+                       return -EINVAL;
+               }
+               r = _crypt_load_integrity(cd, params);
+       } else if (isBITLK(requested_type)) {
+               if (cd->type && !isBITLK(cd->type)) {
+                       log_dbg(cd, "Context is already initialized to type %s", cd->type);
+                       return -EINVAL;
+               }
+               r = _crypt_load_bitlk(cd, params);
+       } else
+               return -EINVAL;
+
+       return r;
+}
+
+/*
+ * crypt_init() helpers
+ */
+static int _init_by_name_crypt_none(struct crypt_device *cd)
+{
+       int r;
+       char _mode[MAX_CIPHER_LEN];
+       struct crypt_dm_active_device dmd;
+       struct dm_target *tgt = &dmd.segment;
+
+       if (cd->type || !cd->u.none.active_name)
+               return -EINVAL;
+
+       r = dm_query_device(cd, cd->u.none.active_name,
+                       DM_ACTIVE_CRYPT_CIPHER |
+                       DM_ACTIVE_CRYPT_KEYSIZE, &dmd);
+       if (r < 0)
+               return r;
+       if (!single_segment(&dmd) || tgt->type != DM_CRYPT)
+               r = -EINVAL;
+       if (r >= 0)
+               r = crypt_parse_name_and_mode(tgt->u.crypt.cipher,
+                                             cd->u.none.cipher, NULL,
+                                             _mode);
+
+       if (!r) {
+               snprintf(cd->u.none.cipher_spec, sizeof(cd->u.none.cipher_spec),
+                        "%s-%s", cd->u.none.cipher, _mode);
+               cd->u.none.cipher_mode = cd->u.none.cipher_spec + strlen(cd->u.none.cipher) + 1;
+               cd->u.none.key_size = tgt->u.crypt.vk->keylength;
+       }
+
+       dm_targets_free(cd, &dmd);
        return r;
 }
 
+static const char *LUKS_UUID(struct crypt_device *cd)
+{
+       if (!cd)
+               return NULL;
+       else if (isLUKS1(cd->type))
+               return cd->u.luks1.hdr.uuid;
+       else if (isLUKS2(cd->type))
+               return cd->u.luks2.hdr.uuid;
+
+       return NULL;
+}
+
+static void crypt_free_type(struct crypt_device *cd)
+{
+       if (isPLAIN(cd->type)) {
+               free(CONST_CAST(void*)cd->u.plain.hdr.hash);
+               free(cd->u.plain.cipher);
+               free(cd->u.plain.cipher_spec);
+       } else if (isLUKS2(cd->type)) {
+               LUKS2_reenc_context_free(cd, cd->u.luks2.rh);
+               LUKS2_hdr_free(cd, &cd->u.luks2.hdr);
+               free(cd->u.luks2.keyslot_cipher);
+       } else if (isLUKS1(cd->type)) {
+               free(cd->u.luks1.cipher_spec);
+       } else if (isLOOPAES(cd->type)) {
+               free(CONST_CAST(void*)cd->u.loopaes.hdr.hash);
+               free(cd->u.loopaes.cipher);
+               free(cd->u.loopaes.cipher_spec);
+       } else if (isVERITY(cd->type)) {
+               free(CONST_CAST(void*)cd->u.verity.hdr.hash_name);
+               free(CONST_CAST(void*)cd->u.verity.hdr.data_device);
+               free(CONST_CAST(void*)cd->u.verity.hdr.hash_device);
+               free(CONST_CAST(void*)cd->u.verity.hdr.fec_device);
+               free(CONST_CAST(void*)cd->u.verity.hdr.salt);
+               free(CONST_CAST(void*)cd->u.verity.root_hash);
+               free(cd->u.verity.uuid);
+               device_free(cd, cd->u.verity.fec_device);
+       } else if (isINTEGRITY(cd->type)) {
+               free(CONST_CAST(void*)cd->u.integrity.params.integrity);
+               free(CONST_CAST(void*)cd->u.integrity.params.journal_integrity);
+               free(CONST_CAST(void*)cd->u.integrity.params.journal_crypt);
+               crypt_free_volume_key(cd->u.integrity.journal_crypt_key);
+               crypt_free_volume_key(cd->u.integrity.journal_mac_key);
+       } else if (isBITLK(cd->type)) {
+               free(cd->u.bitlk.cipher_spec);
+               BITLK_bitlk_metadata_free(&cd->u.bitlk.params);
+       } else if (!cd->type) {
+               free(cd->u.none.active_name);
+               cd->u.none.active_name = NULL;
+       }
+
+       crypt_set_null_type(cd);
+}
+
 static int _init_by_name_crypt(struct crypt_device *cd, const char *name)
 {
-       struct crypt_dm_active_device dmd = {};
-       char cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
+       bool found = false;
+       char **dep, *cipher_spec = NULL, cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN], deps_uuid_prefix[40], *deps[MAX_DM_DEPS+1] = {};
+       const char *dev, *namei;
        int key_nums, r;
+       struct crypt_dm_active_device dmd, dmdi = {}, dmdep = {};
+       struct dm_target *tgt = &dmd.segment, *tgti = &dmdi.segment;
 
        r = dm_query_device(cd, name,
                        DM_ACTIVE_DEVICE |
@@ -787,106 +1163,245 @@ static int _init_by_name_crypt(struct crypt_device *cd, const char *name)
                        DM_ACTIVE_CRYPT_CIPHER |
                        DM_ACTIVE_CRYPT_KEYSIZE, &dmd);
        if (r < 0)
+               return r;
+
+       if (tgt->type != DM_CRYPT && tgt->type != DM_LINEAR) {
+               log_dbg(cd, "Unsupported device table detected in %s.", name);
+               r = -EINVAL;
                goto out;
-       if (r > 0)
-               r = 0;
+       }
 
-       if (isPLAIN(cd->type)) {
-               cd->u.plain.hdr.hash = NULL; /* no way to get this */
-               cd->u.plain.hdr.offset = dmd.u.crypt.offset;
-               cd->u.plain.hdr.skip = dmd.u.crypt.iv_offset;
-               cd->u.plain.key_size = dmd.u.crypt.vk->keylength;
+       r = -EINVAL;
 
-               r = crypt_parse_name_and_mode(dmd.u.crypt.cipher, cipher, NULL, cipher_mode);
-               if (!r) {
-                       cd->u.plain.cipher = strdup(cipher);
-                       cd->u.plain.cipher_mode = strdup(cipher_mode);
+       if (dmd.uuid) {
+               r = snprintf(deps_uuid_prefix, sizeof(deps_uuid_prefix), CRYPT_SUBDEV "-%.32s", dmd.uuid + 6);
+               if (r < 0 || (size_t)r != (sizeof(deps_uuid_prefix) - 1))
+                       r = -EINVAL;
+       }
+
+       if (r >= 0) {
+               r = dm_device_deps(cd, name, deps_uuid_prefix, deps, ARRAY_SIZE(deps));
+               if (r)
+                       goto out;
+       }
+
+       r = crypt_parse_name_and_mode(tgt->type == DM_LINEAR ? "null" : tgt->u.crypt.cipher, cipher,
+                                     &key_nums, cipher_mode);
+       if (r < 0) {
+               log_dbg(cd, "Cannot parse cipher and mode from active device.");
+               goto out;
+       }
+
+       dep = deps;
+
+       if (tgt->type == DM_CRYPT && tgt->u.crypt.integrity && (namei = device_dm_name(tgt->data_device))) {
+               r = dm_query_device(cd, namei, DM_ACTIVE_DEVICE, &dmdi);
+               if (r < 0)
+                       goto out;
+               if (!single_segment(&dmdi) || tgti->type != DM_INTEGRITY) {
+                       log_dbg(cd, "Unsupported device table detected in %s.", namei);
+                       r = -EINVAL;
+                       goto out;
                }
-       } else if (isLOOPAES(cd->type)) {
-               cd->u.loopaes.hdr.offset = dmd.u.crypt.offset;
+               if (!cd->metadata_device) {
+                       device_free(cd, cd->device);
+                       MOVE_REF(cd->device, tgti->data_device);
+               }
+       }
 
-               r = crypt_parse_name_and_mode(dmd.u.crypt.cipher, cipher,
-                                             &key_nums, cipher_mode);
-               if (!r) {
-                       cd->u.loopaes.cipher = strdup(cipher);
-                       cd->u.loopaes.cipher_mode = strdup(cipher_mode);
-                       /* version 3 uses last key for IV */
-                       if (dmd.u.crypt.vk->keylength % key_nums)
-                               key_nums++;
-                       cd->u.loopaes.key_size = dmd.u.crypt.vk->keylength / key_nums;
+       /* do not try to lookup LUKS2 header in detached header mode */
+       if (!cd->metadata_device && !found) {
+               while (*dep && !found) {
+                       r = dm_query_device(cd, *dep, DM_ACTIVE_DEVICE, &dmdep);
+                       if (r < 0)
+                               goto out;
+
+                       tgt = &dmdep.segment;
+
+                       while (tgt && !found) {
+                               dev = device_path(tgt->data_device);
+                               if (!dev) {
+                                       tgt = tgt->next;
+                                       continue;
+                               }
+                               if (!strstr(dev, dm_get_dir()) ||
+                                   !crypt_string_in(dev + strlen(dm_get_dir()) + 1, deps, ARRAY_SIZE(deps))) {
+                                       device_free(cd, cd->device);
+                                       MOVE_REF(cd->device, tgt->data_device);
+                                       found = true;
+                               }
+                               tgt = tgt->next;
+                       }
+                       dep++;
+                       dm_targets_free(cd, &dmdep);
                }
-       } else if (isLUKS(cd->type)) {
+       }
+
+       if (asprintf(&cipher_spec, "%s-%s", cipher, cipher_mode) < 0) {
+               cipher_spec = NULL;
+               r = -ENOMEM;
+               goto out;
+       }
+
+       tgt = &dmd.segment;
+       r = 0;
+
+       if (isPLAIN(cd->type) && single_segment(&dmd) && tgt->type == DM_CRYPT) {
+               cd->u.plain.hdr.hash = NULL; /* no way to get this */
+               cd->u.plain.hdr.offset = tgt->u.crypt.offset;
+               cd->u.plain.hdr.skip = tgt->u.crypt.iv_offset;
+               cd->u.plain.hdr.sector_size = tgt->u.crypt.sector_size;
+               cd->u.plain.key_size = tgt->u.crypt.vk->keylength;
+               cd->u.plain.cipher = strdup(cipher);
+               MOVE_REF(cd->u.plain.cipher_spec, cipher_spec);
+               cd->u.plain.cipher_mode = cd->u.plain.cipher_spec + strlen(cipher) + 1;
+       } else if (isLOOPAES(cd->type) && single_segment(&dmd) && tgt->type == DM_CRYPT) {
+               cd->u.loopaes.hdr.offset = tgt->u.crypt.offset;
+               cd->u.loopaes.cipher = strdup(cipher);
+               MOVE_REF(cd->u.loopaes.cipher_spec, cipher_spec);
+               cd->u.loopaes.cipher_mode = cd->u.loopaes.cipher_spec + strlen(cipher) + 1;
+               /* version 3 uses last key for IV */
+               if (tgt->u.crypt.vk->keylength % key_nums)
+                       key_nums++;
+               cd->u.loopaes.key_size = tgt->u.crypt.vk->keylength / key_nums;
+       } else if (isLUKS1(cd->type) || isLUKS2(cd->type)) {
                if (crypt_metadata_device(cd)) {
-                       r = _crypt_load_luks1(cd, 0, 0);
+                       r = _crypt_load_luks(cd, cd->type, 0, 0);
                        if (r < 0) {
-                               log_dbg("LUKS device header does not match active device.");
+                               log_dbg(cd, "LUKS device header does not match active device.");
                                crypt_set_null_type(cd);
+                               device_close(cd, cd->metadata_device);
+                               device_close(cd, cd->device);
                                r = 0;
                                goto out;
                        }
                        /* check whether UUIDs match each other */
-                       r = crypt_uuid_cmp(dmd.uuid, cd->u.luks1.hdr.uuid);
+                       r = crypt_uuid_cmp(dmd.uuid, LUKS_UUID(cd));
                        if (r < 0) {
-                               log_dbg("LUKS device header uuid: %s mismatches DM returned uuid %s",
-                                       cd->u.luks1.hdr.uuid, dmd.uuid);
-                               crypt_set_null_type(cd);
+                               log_dbg(cd, "LUKS device header uuid: %s mismatches DM returned uuid %s",
+                                       LUKS_UUID(cd), dmd.uuid);
+                               crypt_free_type(cd);
                                r = 0;
+                               goto out;
                        }
                } else {
-                       log_dbg("LUKS device header not available.");
+                       log_dbg(cd, "LUKS device header not available.");
                        crypt_set_null_type(cd);
                        r = 0;
                }
-       } else if (isTCRYPT(cd->type)) {
-               r = TCRYPT_init_by_name(cd, name, &dmd, &cd->device,
+       } else if (isTCRYPT(cd->type) && single_segment(&dmd) && tgt->type == DM_CRYPT) {
+               r = TCRYPT_init_by_name(cd, name, dmd.uuid, tgt, &cd->device,
                                        &cd->u.tcrypt.params, &cd->u.tcrypt.hdr);
+       } else if (isBITLK(cd->type)) {
+               r = _crypt_load_bitlk(cd, NULL);
+               if (r < 0) {
+                       log_dbg(cd, "BITLK device header not available.");
+                       crypt_set_null_type(cd);
+                       r = 0;
+               }
        }
 out:
-       crypt_free_volume_key(dmd.u.crypt.vk);
-       device_free(dmd.data_device);
-       free(CONST_CAST(void*)dmd.u.crypt.cipher);
+       dm_targets_free(cd, &dmd);
+       dm_targets_free(cd, &dmdi);
+       dm_targets_free(cd, &dmdep);
        free(CONST_CAST(void*)dmd.uuid);
+       free(cipher_spec);
+       dep = deps;
+       while (*dep)
+               free(*dep++);
        return r;
 }
 
 static int _init_by_name_verity(struct crypt_device *cd, const char *name)
 {
-       struct crypt_params_verity params = {};
-       struct crypt_dm_active_device dmd = {
-               .target = DM_VERITY,
-               .u.verity.vp = &params,
-       };
+       struct crypt_dm_active_device dmd;
+       struct dm_target *tgt = &dmd.segment;
        int r;
 
        r = dm_query_device(cd, name,
                                DM_ACTIVE_DEVICE |
                                DM_ACTIVE_VERITY_HASH_DEVICE |
+                               DM_ACTIVE_VERITY_ROOT_HASH |
                                DM_ACTIVE_VERITY_PARAMS, &dmd);
        if (r < 0)
+               return r;
+       if (!single_segment(&dmd) || tgt->type != DM_VERITY) {
+               log_dbg(cd, "Unsupported device table detected in %s.", name);
+               r = -EINVAL;
                goto out;
+       }
        if (r > 0)
                r = 0;
 
        if (isVERITY(cd->type)) {
                cd->u.verity.uuid = NULL; // FIXME
                cd->u.verity.hdr.flags = CRYPT_VERITY_NO_HEADER; //FIXME
-               cd->u.verity.hdr.data_size = params.data_size;
-               cd->u.verity.root_hash_size = dmd.u.verity.root_hash_size;
-               cd->u.verity.root_hash = NULL;
-               cd->u.verity.hdr.hash_name = params.hash_name;
+               cd->u.verity.hdr.data_size = tgt->u.verity.vp->data_size;
+               cd->u.verity.root_hash_size = tgt->u.verity.root_hash_size;
+               MOVE_REF(cd->u.verity.hdr.hash_name, tgt->u.verity.vp->hash_name);
                cd->u.verity.hdr.data_device = NULL;
                cd->u.verity.hdr.hash_device = NULL;
-               cd->u.verity.hdr.data_block_size = params.data_block_size;
-               cd->u.verity.hdr.hash_block_size = params.hash_block_size;
-               cd->u.verity.hdr.hash_area_offset = dmd.u.verity.hash_offset;
-               cd->u.verity.hdr.hash_type = params.hash_type;
-               cd->u.verity.hdr.flags = params.flags;
-               cd->u.verity.hdr.salt_size = params.salt_size;
-               cd->u.verity.hdr.salt = params.salt;
-               cd->metadata_device = dmd.u.verity.hash_device;
+               cd->u.verity.hdr.data_block_size = tgt->u.verity.vp->data_block_size;
+               cd->u.verity.hdr.hash_block_size = tgt->u.verity.vp->hash_block_size;
+               cd->u.verity.hdr.hash_area_offset = tgt->u.verity.hash_offset;
+               cd->u.verity.hdr.fec_area_offset = tgt->u.verity.fec_offset;
+               cd->u.verity.hdr.hash_type = tgt->u.verity.vp->hash_type;
+               cd->u.verity.hdr.flags = tgt->u.verity.vp->flags;
+               cd->u.verity.hdr.salt_size = tgt->u.verity.vp->salt_size;
+               MOVE_REF(cd->u.verity.hdr.salt, tgt->u.verity.vp->salt);
+               MOVE_REF(cd->u.verity.hdr.fec_device, tgt->u.verity.vp->fec_device);
+               cd->u.verity.hdr.fec_roots = tgt->u.verity.vp->fec_roots;
+               MOVE_REF(cd->u.verity.fec_device, tgt->u.verity.fec_device);
+               MOVE_REF(cd->metadata_device, tgt->u.verity.hash_device);
+               MOVE_REF(cd->u.verity.root_hash, tgt->u.verity.root_hash);
+       }
+out:
+       dm_targets_free(cd, &dmd);
+       return r;
+}
+
+static int _init_by_name_integrity(struct crypt_device *cd, const char *name)
+{
+       struct crypt_dm_active_device dmd;
+       struct dm_target *tgt = &dmd.segment;
+       int r;
+
+       r = dm_query_device(cd, name, DM_ACTIVE_DEVICE |
+                                     DM_ACTIVE_CRYPT_KEY |
+                                     DM_ACTIVE_CRYPT_KEYSIZE |
+                                     DM_ACTIVE_INTEGRITY_PARAMS, &dmd);
+       if (r < 0)
+               return r;
+       if (!single_segment(&dmd) || tgt->type != DM_INTEGRITY) {
+               log_dbg(cd, "Unsupported device table detected in %s.", name);
+               r = -EINVAL;
+               goto out;
+       }
+       if (r > 0)
+               r = 0;
+
+       if (isINTEGRITY(cd->type)) {
+               cd->u.integrity.params.tag_size = tgt->u.integrity.tag_size;
+               cd->u.integrity.params.sector_size = tgt->u.integrity.sector_size;
+               cd->u.integrity.params.journal_size = tgt->u.integrity.journal_size;
+               cd->u.integrity.params.journal_watermark = tgt->u.integrity.journal_watermark;
+               cd->u.integrity.params.journal_commit_time = tgt->u.integrity.journal_commit_time;
+               cd->u.integrity.params.interleave_sectors = tgt->u.integrity.interleave_sectors;
+               cd->u.integrity.params.buffer_sectors = tgt->u.integrity.buffer_sectors;
+               MOVE_REF(cd->u.integrity.params.integrity, tgt->u.integrity.integrity);
+               MOVE_REF(cd->u.integrity.params.journal_integrity, tgt->u.integrity.journal_integrity);
+               MOVE_REF(cd->u.integrity.params.journal_crypt, tgt->u.integrity.journal_crypt);
+
+               if (tgt->u.integrity.vk)
+                       cd->u.integrity.params.integrity_key_size = tgt->u.integrity.vk->keylength;
+               if (tgt->u.integrity.journal_integrity_key)
+                       cd->u.integrity.params.journal_integrity_key_size = tgt->u.integrity.journal_integrity_key->keylength;
+               if (tgt->u.integrity.journal_crypt_key)
+                       cd->u.integrity.params.integrity_key_size = tgt->u.integrity.journal_crypt_key->keylength;
+               MOVE_REF(cd->metadata_device, tgt->u.integrity.meta_device);
        }
 out:
-       device_free(dmd.data_device);
+       dm_targets_free(cd, &dmd);
        return r;
 }
 
@@ -896,41 +1411,42 @@ int crypt_init_by_name_and_header(struct crypt_device **cd,
 {
        crypt_status_info ci;
        struct crypt_dm_active_device dmd;
+       struct dm_target *tgt = &dmd.segment;
        int r;
 
-       log_dbg("Allocating crypt device context by device %s.", name);
+       if (!cd || !name)
+               return -EINVAL;
+
+       log_dbg(NULL, "Allocating crypt device context by device %s.", name);
 
        ci = crypt_status(NULL, name);
        if (ci == CRYPT_INVALID)
                return -ENODEV;
 
        if (ci < CRYPT_ACTIVE) {
-               log_err(NULL, _("Device %s is not active.\n"), name);
+               log_err(NULL, _("Device %s is not active."), name);
                return -ENODEV;
        }
 
        r = dm_query_device(NULL, name, DM_ACTIVE_DEVICE | DM_ACTIVE_UUID, &dmd);
        if (r < 0)
-               goto out;
+               return r;
 
        *cd = NULL;
 
        if (header_device) {
                r = crypt_init(cd, header_device);
        } else {
-               r = crypt_init(cd, device_path(dmd.data_device));
+               r = crypt_init(cd, device_path(tgt->data_device));
 
                /* Underlying device disappeared but mapping still active */
-               if (!dmd.data_device || r == -ENOTBLK)
-                       log_verbose(NULL, _("Underlying device for crypt device %s disappeared.\n"),
+               if (!tgt->data_device || r == -ENOTBLK)
+                       log_verbose(NULL, _("Underlying device for crypt device %s disappeared."),
                                    name);
 
                /* Underlying device is not readable but crypt mapping exists */
-               if (r == -ENOTBLK) {
-                       device_free(dmd.data_device);
-                       dmd.data_device = NULL;
+               if (r == -ENOTBLK)
                        r = crypt_init(cd, NULL);
-               }
        }
 
        if (r < 0)
@@ -943,38 +1459,46 @@ int crypt_init_by_name_and_header(struct crypt_device **cd,
                        (*cd)->type = strdup(CRYPT_LOOPAES);
                else if (!strncmp(CRYPT_LUKS1, dmd.uuid, sizeof(CRYPT_LUKS1)-1))
                        (*cd)->type = strdup(CRYPT_LUKS1);
+               else if (!strncmp(CRYPT_LUKS2, dmd.uuid, sizeof(CRYPT_LUKS2)-1))
+                       (*cd)->type = strdup(CRYPT_LUKS2);
                else if (!strncmp(CRYPT_VERITY, dmd.uuid, sizeof(CRYPT_VERITY)-1))
                        (*cd)->type = strdup(CRYPT_VERITY);
                else if (!strncmp(CRYPT_TCRYPT, dmd.uuid, sizeof(CRYPT_TCRYPT)-1))
                        (*cd)->type = strdup(CRYPT_TCRYPT);
+               else if (!strncmp(CRYPT_INTEGRITY, dmd.uuid, sizeof(CRYPT_INTEGRITY)-1))
+                       (*cd)->type = strdup(CRYPT_INTEGRITY);
+               else if (!strncmp(CRYPT_BITLK, dmd.uuid, sizeof(CRYPT_BITLK)-1))
+                       (*cd)->type = strdup(CRYPT_BITLK);
                else
-                       log_dbg("Unknown UUID set, some parameters are not set.");
+                       log_dbg(NULL, "Unknown UUID set, some parameters are not set.");
        } else
-               log_dbg("Active device has no UUID set, some parameters are not set.");
+               log_dbg(NULL, "Active device has no UUID set, some parameters are not set.");
 
        if (header_device) {
-               r = crypt_set_data_device(*cd, device_path(dmd.data_device));
+               r = crypt_set_data_device(*cd, device_path(tgt->data_device));
                if (r < 0)
                        goto out;
        }
 
-       /* Try to initialise basic parameters from active device */
+       /* Try to initialize basic parameters from active device */
 
-       if (dmd.target == DM_CRYPT)
+       if (tgt->type == DM_CRYPT || tgt->type == DM_LINEAR)
                r = _init_by_name_crypt(*cd, name);
-       else if (dmd.target == DM_VERITY)
+       else if (tgt->type == DM_VERITY)
                r = _init_by_name_verity(*cd, name);
+       else if (tgt->type == DM_INTEGRITY)
+               r = _init_by_name_integrity(*cd, name);
 out:
        if (r < 0) {
                crypt_free(*cd);
                *cd = NULL;
-       } else if (!(*cd)->type && name) {
+       } else if (!(*cd)->type) {
                /* For anonymous device (no header found) remember initialized name */
                (*cd)->u.none.active_name = strdup(name);
        }
 
-       device_free(dmd.data_device);
        free(CONST_CAST(void*)dmd.uuid);
+       dm_targets_free(NULL, &dmd);
        return r;
 }
 
@@ -983,6 +1507,9 @@ int crypt_init_by_name(struct crypt_device **cd, const char *name)
        return crypt_init_by_name_and_header(cd, name, NULL);
 }
 
+/*
+ * crypt_format() helpers
+ */
 static int _crypt_format_plain(struct crypt_device *cd,
                               const char *cipher,
                               const char *cipher_mode,
@@ -990,21 +1517,48 @@ static int _crypt_format_plain(struct crypt_device *cd,
                               size_t volume_key_size,
                               struct crypt_params_plain *params)
 {
+       unsigned int sector_size = params ? params->sector_size : SECTOR_SIZE;
+       uint64_t dev_size;
+
        if (!cipher || !cipher_mode) {
-               log_err(cd, _("Invalid plain crypt parameters.\n"));
+               log_err(cd, _("Invalid plain crypt parameters."));
                return -EINVAL;
        }
 
        if (volume_key_size > 1024) {
-               log_err(cd, _("Invalid key size.\n"));
+               log_err(cd, _("Invalid key size."));
                return -EINVAL;
        }
 
        if (uuid) {
-               log_err(cd, _("UUID is not supported for this crypt type.\n"));
+               log_err(cd, _("UUID is not supported for this crypt type."));
+               return -EINVAL;
+       }
+
+       if (cd->metadata_device) {
+               log_err(cd, _("Detached metadata device is not supported for this crypt type."));
+               return -EINVAL;
+       }
+
+       /* For compatibility with old params structure */
+       if (!sector_size)
+               sector_size = SECTOR_SIZE;
+
+       if (sector_size < SECTOR_SIZE || sector_size > MAX_SECTOR_SIZE ||
+           NOTPOW2(sector_size)) {
+               log_err(cd, _("Unsupported encryption sector size."));
                return -EINVAL;
        }
 
+       if (sector_size > SECTOR_SIZE && !device_size(cd->device, &dev_size)) {
+               if (params && params->offset)
+                       dev_size -= (params->offset * SECTOR_SIZE);
+               if (dev_size % sector_size) {
+                       log_err(cd, _("Device size is not aligned to requested sector size."));
+                       return -EINVAL;
+               }
+       }
+
        if (!(cd->type = strdup(CRYPT_PLAIN)))
                return -ENOMEM;
 
@@ -1013,9 +1567,12 @@ static int _crypt_format_plain(struct crypt_device *cd,
        if (!cd->volume_key)
                return -ENOMEM;
 
+       if (asprintf(&cd->u.plain.cipher_spec, "%s-%s", cipher, cipher_mode) < 0) {
+               cd->u.plain.cipher_spec = NULL;
+               return -ENOMEM;
+       }
        cd->u.plain.cipher = strdup(cipher);
-       cd->u.plain.cipher_mode = strdup(cipher_mode);
-
+       cd->u.plain.cipher_mode = cd->u.plain.cipher_spec + strlen(cipher) + 1;
 
        if (params && params->hash)
                cd->u.plain.hdr.hash = strdup(params->hash);
@@ -1023,8 +1580,9 @@ static int _crypt_format_plain(struct crypt_device *cd,
        cd->u.plain.hdr.offset = params ? params->offset : 0;
        cd->u.plain.hdr.skip = params ? params->skip : 0;
        cd->u.plain.hdr.size = params ? params->size : 0;
+       cd->u.plain.hdr.sector_size = sector_size;
 
-       if (!cd->u.plain.cipher || !cd->u.plain.cipher_mode)
+       if (!cd->u.plain.cipher)
                return -ENOMEM;
 
        return 0;
@@ -1041,9 +1599,19 @@ static int _crypt_format_luks1(struct crypt_device *cd,
        int r;
        unsigned long required_alignment = DEFAULT_DISK_ALIGNMENT;
        unsigned long alignment_offset = 0;
+       uint64_t dev_size;
+
+       if (!cipher || !cipher_mode)
+               return -EINVAL;
 
        if (!crypt_metadata_device(cd)) {
-               log_err(cd, _("Can't format LUKS without device.\n"));
+               log_err(cd, _("Can't format LUKS without device."));
+               return -EINVAL;
+       }
+
+       if (params && cd->data_offset && params->data_alignment &&
+          (cd->data_offset % params->data_alignment)) {
+               log_err(cd, _("Requested data alignment is not compatible with data offset."));
                return -EINVAL;
        }
 
@@ -1056,50 +1624,312 @@ static int _crypt_format_luks1(struct crypt_device *cd,
        else
                cd->volume_key = crypt_generate_volume_key(cd, volume_key_size);
 
-       if(!cd->volume_key)
+       if (!cd->volume_key)
                return -ENOMEM;
 
+       if (verify_pbkdf_params(cd, &cd->pbkdf)) {
+               r = init_pbkdf_type(cd, NULL, CRYPT_LUKS1);
+               if (r)
+                       return r;
+       }
+
+       if (params && params->hash && strcmp(params->hash, cd->pbkdf.hash)) {
+               free(CONST_CAST(void*)cd->pbkdf.hash);
+               cd->pbkdf.hash = strdup(params->hash);
+               if (!cd->pbkdf.hash)
+                       return -ENOMEM;
+       }
+
        if (params && params->data_device) {
-               cd->metadata_device = cd->device;
+               if (!cd->metadata_device)
+                       cd->metadata_device = cd->device;
+               else
+                       device_free(cd, cd->device);
                cd->device = NULL;
-               if (device_alloc(&cd->device, params->data_device) < 0)
+               if (device_alloc(cd, &cd->device, params->data_device) < 0)
                        return -ENOMEM;
+       }
+
+       if (params && cd->metadata_device) {
+               /* For detached header the alignment is used directly as data offset */
+               if (!cd->data_offset)
+                       cd->data_offset = params->data_alignment;
                required_alignment = params->data_alignment * SECTOR_SIZE;
        } else if (params && params->data_alignment) {
                required_alignment = params->data_alignment * SECTOR_SIZE;
        } else
-               device_topology_alignment(cd->device,
+               device_topology_alignment(cd, cd->device,
                                       &required_alignment,
                                       &alignment_offset, DEFAULT_DISK_ALIGNMENT);
 
-       r = LUKS_generate_phdr(&cd->u.luks1.hdr, cd->volume_key, cipher, cipher_mode,
-                              (params && params->hash) ? params->hash : "sha1",
-                              uuid, LUKS_STRIPES,
-                              required_alignment / SECTOR_SIZE,
-                              alignment_offset / SECTOR_SIZE,
-                              cd->iteration_time, &cd->u.luks1.PBKDF2_per_sec,
-                              cd->metadata_device ? 1 : 0, cd);
-       if(r < 0)
+       r = LUKS_check_cipher(cd, volume_key_size, cipher, cipher_mode);
+       if (r < 0)
                return r;
 
-       /* Wipe first 8 sectors - fs magic numbers etc. */
-       r = crypt_wipe(crypt_metadata_device(cd), 0, 8 * SECTOR_SIZE, CRYPT_WIPE_ZERO, 1);
-       if(r < 0) {
-               if (r == -EBUSY)
-                       log_err(cd, _("Cannot format device %s which is still in use.\n"),
-                               mdata_device_path(cd));
-               else if (r == -EACCES) {
-                       log_err(cd, _("Cannot format device %s, permission denied.\n"),
-                               mdata_device_path(cd));
-                       r = -EINVAL;
-               } else
-                       log_err(cd, _("Cannot wipe header on device %s.\n"),
-                               mdata_device_path(cd));
-
+       r = LUKS_generate_phdr(&cd->u.luks1.hdr, cd->volume_key, cipher, cipher_mode,
+                              cd->pbkdf.hash, uuid,
+                              cd->data_offset * SECTOR_SIZE,
+                              alignment_offset, required_alignment, cd);
+       if (r < 0)
                return r;
-       }
+
+       r = device_check_access(cd, crypt_metadata_device(cd), DEV_EXCL);
+       if (r < 0)
+               return r;
+
+       if (!device_size(crypt_data_device(cd), &dev_size) &&
+           dev_size < (crypt_get_data_offset(cd) * SECTOR_SIZE))
+               log_std(cd, _("WARNING: Data offset is outside of currently available data device.\n"));
+
+       if (asprintf(&cd->u.luks1.cipher_spec, "%s-%s", cipher, cipher_mode) < 0) {
+               cd->u.luks1.cipher_spec = NULL;
+               return -ENOMEM;
+       }
+
+       r = LUKS_wipe_header_areas(&cd->u.luks1.hdr, cd);
+       if (r < 0) {
+               free(cd->u.luks1.cipher_spec);
+               log_err(cd, _("Cannot wipe header on device %s."),
+                       mdata_device_path(cd));
+               return r;
+       }
 
        r = LUKS_write_phdr(&cd->u.luks1.hdr, cd);
+       if (r)
+               free(cd->u.luks1.cipher_spec);
+
+       return r;
+}
+
+static int _crypt_format_luks2(struct crypt_device *cd,
+                              const char *cipher,
+                              const char *cipher_mode,
+                              const char *uuid,
+                              const char *volume_key,
+                              size_t volume_key_size,
+                              struct crypt_params_luks2 *params)
+{
+       int r, integrity_key_size = 0;
+       unsigned long required_alignment = DEFAULT_DISK_ALIGNMENT;
+       unsigned long alignment_offset = 0;
+       unsigned int sector_size = params ? params->sector_size : SECTOR_SIZE;
+       const char *integrity = params ? params->integrity : NULL;
+       uint64_t dev_size;
+       uint32_t dmc_flags;
+
+       cd->u.luks2.hdr.jobj = NULL;
+       cd->u.luks2.keyslot_cipher = NULL;
+
+       if (!cipher || !cipher_mode)
+               return -EINVAL;
+
+       if (!crypt_metadata_device(cd)) {
+               log_err(cd, _("Can't format LUKS without device."));
+               return -EINVAL;
+       }
+
+       if (params && cd->data_offset && params->data_alignment &&
+          (cd->data_offset % params->data_alignment)) {
+               log_err(cd, _("Requested data alignment is not compatible with data offset."));
+               return -EINVAL;
+       }
+
+       if (sector_size < SECTOR_SIZE || sector_size > MAX_SECTOR_SIZE ||
+           NOTPOW2(sector_size)) {
+               log_err(cd, _("Unsupported encryption sector size."));
+               return -EINVAL;
+       }
+       if (sector_size != SECTOR_SIZE && !dm_flags(cd, DM_CRYPT, &dmc_flags) &&
+           !(dmc_flags & DM_SECTOR_SIZE_SUPPORTED))
+               log_std(cd, _("WARNING: The device activation will fail, dm-crypt is missing "
+                             "support for requested encryption sector size.\n"));
+
+       if (integrity) {
+               if (params->integrity_params) {
+                       /* Standalone dm-integrity must not be used */
+                       if (params->integrity_params->integrity ||
+                           params->integrity_params->integrity_key_size)
+                               return -EINVAL;
+                       /* FIXME: journal encryption and MAC is here not yet supported */
+                       if (params->integrity_params->journal_crypt ||
+                       params->integrity_params->journal_integrity)
+                               return -ENOTSUP;
+               }
+               if (!INTEGRITY_tag_size(cd, integrity, cipher, cipher_mode)) {
+                       if (!strcmp(integrity, "none"))
+                               integrity = NULL;
+                       else
+                               return -EINVAL;
+               }
+               integrity_key_size = INTEGRITY_key_size(cd, integrity);
+               if ((integrity_key_size < 0) || (integrity_key_size >= (int)volume_key_size)) {
+                       log_err(cd, _("Volume key is too small for encryption with integrity extensions."));
+                       return -EINVAL;
+               }
+       }
+
+       r = device_check_access(cd, crypt_metadata_device(cd), DEV_EXCL);
+       if (r < 0)
+               return r;
+
+       if (!(cd->type = strdup(CRYPT_LUKS2)))
+               return -ENOMEM;
+
+       if (volume_key)
+               cd->volume_key = crypt_alloc_volume_key(volume_key_size,
+                                                     volume_key);
+       else
+               cd->volume_key = crypt_generate_volume_key(cd, volume_key_size);
+
+       if (!cd->volume_key)
+               return -ENOMEM;
+
+       if (params && params->pbkdf)
+               r = crypt_set_pbkdf_type(cd, params->pbkdf);
+       else if (verify_pbkdf_params(cd, &cd->pbkdf))
+               r = init_pbkdf_type(cd, NULL, CRYPT_LUKS2);
+
+       if (r < 0)
+               return r;
+
+       if (params && params->data_device) {
+               if (!cd->metadata_device)
+                       cd->metadata_device = cd->device;
+               else
+                       device_free(cd, cd->device);
+               cd->device = NULL;
+               if (device_alloc(cd, &cd->device, params->data_device) < 0)
+                       return -ENOMEM;
+       }
+
+       if (params && cd->metadata_device) {
+               /* For detached header the alignment is used directly as data offset */
+               if (!cd->data_offset)
+                       cd->data_offset = params->data_alignment;
+               required_alignment = params->data_alignment * SECTOR_SIZE;
+       } else if (params && params->data_alignment) {
+               required_alignment = params->data_alignment * SECTOR_SIZE;
+       } else
+               device_topology_alignment(cd, cd->device,
+                                      &required_alignment,
+                                      &alignment_offset, DEFAULT_DISK_ALIGNMENT);
+
+       /* FIXME: allow this later also for normal ciphers (check AF_ALG availability. */
+       if (integrity && !integrity_key_size) {
+               r = crypt_cipher_check_kernel(cipher, cipher_mode, integrity, volume_key_size);
+               if (r < 0) {
+                       log_err(cd, _("Cipher %s-%s (key size %zd bits) is not available."),
+                               cipher, cipher_mode, volume_key_size * 8);
+                       goto out;
+               }
+       }
+
+       if ((!integrity || integrity_key_size) && !crypt_cipher_wrapped_key(cipher, cipher_mode) &&
+           !INTEGRITY_tag_size(cd, NULL, cipher, cipher_mode)) {
+               r = LUKS_check_cipher(cd, volume_key_size - integrity_key_size,
+                                     cipher, cipher_mode);
+               if (r < 0)
+                       goto out;
+       }
+
+       r = LUKS2_generate_hdr(cd, &cd->u.luks2.hdr, cd->volume_key,
+                              cipher, cipher_mode,
+                              integrity, uuid,
+                              sector_size,
+                              cd->data_offset * SECTOR_SIZE,
+                              alignment_offset,
+                              required_alignment,
+                              cd->metadata_size, cd->keyslots_size);
+       if (r < 0)
+               goto out;
+
+       r = device_size(crypt_data_device(cd), &dev_size);
+       if (r < 0)
+               goto out;
+
+       if (dev_size < (crypt_get_data_offset(cd) * SECTOR_SIZE))
+               log_std(cd, _("WARNING: Data offset is outside of currently available data device.\n"));
+
+       if (cd->metadata_size && (cd->metadata_size != LUKS2_metadata_size(cd->u.luks2.hdr.jobj)))
+               log_std(cd, _("WARNING: LUKS2 metadata size changed to %" PRIu64 " bytes.\n"),
+                       LUKS2_metadata_size(cd->u.luks2.hdr.jobj));
+
+       if (cd->keyslots_size && (cd->keyslots_size != LUKS2_keyslots_size(cd->u.luks2.hdr.jobj)))
+               log_std(cd, _("WARNING: LUKS2 keyslots area size changed to %" PRIu64 " bytes.\n"),
+                       LUKS2_keyslots_size(cd->u.luks2.hdr.jobj));
+
+       if (!integrity && sector_size > SECTOR_SIZE) {
+               dev_size -= (crypt_get_data_offset(cd) * SECTOR_SIZE);
+               if (dev_size % sector_size) {
+                       log_err(cd, _("Device size is not aligned to requested sector size."));
+                       r = -EINVAL;
+                       goto out;
+               }
+       }
+
+       if (params && (params->label || params->subsystem)) {
+               r = LUKS2_hdr_labels(cd, &cd->u.luks2.hdr,
+                                    params->label, params->subsystem, 0);
+               if (r < 0)
+                       goto out;
+       }
+
+       r = LUKS2_wipe_header_areas(cd, &cd->u.luks2.hdr);
+       if (r < 0) {
+               log_err(cd, _("Cannot wipe header on device %s."),
+                       mdata_device_path(cd));
+               if (dev_size < LUKS2_hdr_and_areas_size(cd->u.luks2.hdr.jobj))
+                       log_err(cd, _("Device %s is too small."), device_path(crypt_metadata_device(cd)));
+               goto out;
+       }
+
+       /* Wipe integrity superblock and create integrity superblock */
+       if (crypt_get_integrity_tag_size(cd)) {
+               r = crypt_wipe_device(cd, crypt_data_device(cd), CRYPT_WIPE_ZERO,
+                                     crypt_get_data_offset(cd) * SECTOR_SIZE,
+                                     8 * SECTOR_SIZE, 8 * SECTOR_SIZE, NULL, NULL);
+               if (r < 0) {
+                       if (r == -EBUSY)
+                               log_err(cd, _("Cannot format device %s in use."),
+                                       data_device_path(cd));
+                       else if (r == -EACCES) {
+                               log_err(cd, _("Cannot format device %s, permission denied."),
+                                       data_device_path(cd));
+                               r = -EINVAL;
+                       } else
+                               log_err(cd, _("Cannot wipe header on device %s."),
+                                       data_device_path(cd));
+
+                       goto out;
+               }
+
+               r = INTEGRITY_format(cd, params ? params->integrity_params : NULL, NULL, NULL);
+               if (r)
+                       log_err(cd, _("Cannot format integrity for device %s."),
+                               data_device_path(cd));
+       }
+
+       if (r < 0)
+               goto out;
+
+       /* override sequence id check with format */
+       r = LUKS2_hdr_write_force(cd, &cd->u.luks2.hdr);
+       if (r < 0) {
+               if (r == -EBUSY)
+                       log_err(cd, _("Cannot format device %s in use."),
+                               mdata_device_path(cd));
+               else if (r == -EACCES) {
+                       log_err(cd, _("Cannot format device %s, permission denied."),
+                               mdata_device_path(cd));
+                       r = -EINVAL;
+               } else
+                       log_err(cd, _("Cannot format device %s."),
+                               mdata_device_path(cd));
+       }
+
+out:
+       if (r)
+               LUKS2_hdr_free(cd, &cd->u.luks2.hdr);
 
        return r;
 }
@@ -1111,17 +1941,22 @@ static int _crypt_format_loopaes(struct crypt_device *cd,
                                 struct crypt_params_loopaes *params)
 {
        if (!crypt_metadata_device(cd)) {
-               log_err(cd, _("Can't format LOOPAES without device.\n"));
+               log_err(cd, _("Can't format LOOPAES without device."));
                return -EINVAL;
        }
 
        if (volume_key_size > 1024) {
-               log_err(cd, _("Invalid key size.\n"));
+               log_err(cd, _("Invalid key size."));
                return -EINVAL;
        }
 
        if (uuid) {
-               log_err(cd, _("UUID is not supported for this crypt type.\n"));
+               log_err(cd, _("UUID is not supported for this crypt type."));
+               return -EINVAL;
+       }
+
+       if (cd->metadata_device) {
+               log_err(cd, _("Detached metadata device is not supported for this crypt type."));
                return -EINVAL;
        }
 
@@ -1146,38 +1981,51 @@ static int _crypt_format_verity(struct crypt_device *cd,
                                 struct crypt_params_verity *params)
 {
        int r = 0, hash_size;
-       uint64_t data_device_size;
+       uint64_t data_device_size, hash_blocks_size;
+       struct device *fec_device = NULL;
+       char *fec_device_path = NULL, *hash_name = NULL, *root_hash = NULL, *salt = NULL;
 
        if (!crypt_metadata_device(cd)) {
-               log_err(cd, _("Can't format VERITY without device.\n"));
+               log_err(cd, _("Can't format VERITY without device."));
                return -EINVAL;
        }
 
-       if (!params || !params->data_device)
+       if (!params)
+               return -EINVAL;
+
+       if (!params->data_device && !cd->metadata_device)
                return -EINVAL;
 
        if (params->hash_type > VERITY_MAX_HASH_TYPE) {
-               log_err(cd, _("Unsupported VERITY hash type %d.\n"), params->hash_type);
+               log_err(cd, _("Unsupported VERITY hash type %d."), params->hash_type);
                return -EINVAL;
        }
 
        if (VERITY_BLOCK_SIZE_OK(params->data_block_size) ||
            VERITY_BLOCK_SIZE_OK(params->hash_block_size)) {
-               log_err(cd, _("Unsupported VERITY block size.\n"));
+               log_err(cd, _("Unsupported VERITY block size."));
+               return -EINVAL;
+       }
+
+       if (MISALIGNED_512(params->hash_area_offset)) {
+               log_err(cd, _("Unsupported VERITY hash offset."));
                return -EINVAL;
        }
 
-       if (params->hash_area_offset % 512) {
-               log_err(cd, _("Unsupported VERITY hash offset.\n"));
+       if (MISALIGNED_512(params->fec_area_offset)) {
+               log_err(cd, _("Unsupported VERITY FEC offset."));
                return -EINVAL;
        }
 
        if (!(cd->type = strdup(CRYPT_VERITY)))
                return -ENOMEM;
 
-       r = crypt_set_data_device(cd, params->data_device);
-       if (r)
-               return r;
+       if (params->data_device) {
+               r = crypt_set_data_device(cd, params->data_device);
+               if (r)
+                       return r;
+       }
+
        if (!params->data_size) {
                r = device_size(cd->device, &data_device_size);
                if (r < 0)
@@ -1187,60 +2035,208 @@ static int _crypt_format_verity(struct crypt_device *cd,
        } else
                cd->u.verity.hdr.data_size = params->data_size;
 
+       if (device_is_identical(crypt_metadata_device(cd), crypt_data_device(cd)) &&
+          (cd->u.verity.hdr.data_size * params->data_block_size) > params->hash_area_offset) {
+               log_err(cd, _("Data area overlaps with hash area."));
+               return -EINVAL;
+       }
+
        hash_size = crypt_hash_size(params->hash_name);
        if (hash_size <= 0) {
-               log_err(cd, _("Hash algorithm %s not supported.\n"),
+               log_err(cd, _("Hash algorithm %s not supported."),
                        params->hash_name);
                return -EINVAL;
        }
        cd->u.verity.root_hash_size = hash_size;
 
-       cd->u.verity.root_hash = malloc(cd->u.verity.root_hash_size);
-       if (!cd->u.verity.root_hash)
-               return -ENOMEM;
+       if (params->fec_device) {
+               fec_device_path = strdup(params->fec_device);
+               if (!fec_device_path)
+                       return -ENOMEM;
+               r = device_alloc(cd, &fec_device, params->fec_device);
+               if (r < 0) {
+                       r = -ENOMEM;
+                       goto err;
+               }
+
+               hash_blocks_size = VERITY_hash_blocks(cd, params) * params->hash_block_size;
+               if (device_is_identical(crypt_metadata_device(cd), fec_device) &&
+                   (params->hash_area_offset + hash_blocks_size) > params->fec_area_offset) {
+                       log_err(cd, _("Hash area overlaps with FEC area."));
+                       r = -EINVAL;
+                       goto err;
+               }
+
+               if (device_is_identical(crypt_data_device(cd), fec_device) &&
+                   (cd->u.verity.hdr.data_size * params->data_block_size) > params->fec_area_offset) {
+                       log_err(cd, _("Data area overlaps with FEC area."));
+                       r = -EINVAL;
+                       goto err;
+               }
+       }
+
+       root_hash = malloc(cd->u.verity.root_hash_size);
+       hash_name = strdup(params->hash_name);
+       salt = malloc(params->salt_size);
+
+       if (!root_hash || !hash_name || !salt) {
+               r = -ENOMEM;
+               goto err;
+       }
 
        cd->u.verity.hdr.flags = params->flags;
-       if (!(cd->u.verity.hdr.hash_name = strdup(params->hash_name)))
-               return -ENOMEM;
+       cd->u.verity.root_hash = root_hash;
+       cd->u.verity.hdr.hash_name = hash_name;
        cd->u.verity.hdr.data_device = NULL;
+       cd->u.verity.fec_device = fec_device;
+       cd->u.verity.hdr.fec_device = fec_device_path;
+       cd->u.verity.hdr.fec_roots = params->fec_roots;
        cd->u.verity.hdr.data_block_size = params->data_block_size;
        cd->u.verity.hdr.hash_block_size = params->hash_block_size;
        cd->u.verity.hdr.hash_area_offset = params->hash_area_offset;
+       cd->u.verity.hdr.fec_area_offset = params->fec_area_offset;
        cd->u.verity.hdr.hash_type = params->hash_type;
        cd->u.verity.hdr.flags = params->flags;
        cd->u.verity.hdr.salt_size = params->salt_size;
-       if (!(cd->u.verity.hdr.salt = malloc(params->salt_size)))
-               return -ENOMEM;
+       cd->u.verity.hdr.salt = salt;
 
        if (params->salt)
-               memcpy(CONST_CAST(char*)cd->u.verity.hdr.salt, params->salt,
-                      params->salt_size);
+               memcpy(salt, params->salt, params->salt_size);
        else
-               r = crypt_random_get(cd, CONST_CAST(char*)cd->u.verity.hdr.salt,
-                                    params->salt_size, CRYPT_RND_SALT);
+               r = crypt_random_get(cd, salt, params->salt_size, CRYPT_RND_SALT);
        if (r)
-               return r;
+               goto err;
 
        if (params->flags & CRYPT_VERITY_CREATE_HASH) {
                r = VERITY_create(cd, &cd->u.verity.hdr,
                                  cd->u.verity.root_hash, cd->u.verity.root_hash_size);
+               if (!r && params->fec_device)
+                       r = VERITY_FEC_process(cd, &cd->u.verity.hdr, cd->u.verity.fec_device, 0, NULL);
                if (r)
-                       return r;
+                       goto err;
        }
 
        if (!(params->flags & CRYPT_VERITY_NO_HEADER)) {
-               if (uuid)
-                       cd->u.verity.uuid = strdup(uuid);
-               else {
+               if (uuid) {
+                       if (!(cd->u.verity.uuid = strdup(uuid)))
+                               r = -ENOMEM;
+               } else
                        r = VERITY_UUID_generate(cd, &cd->u.verity.uuid);
-                       if (r)
-                               return r;
+
+               if (!r)
+                       r = VERITY_write_sb(cd, cd->u.verity.hdr.hash_area_offset,
+                                           cd->u.verity.uuid,
+                                           &cd->u.verity.hdr);
+       }
+
+err:
+       if (r) {
+               device_free(cd, fec_device);
+               free(root_hash);
+               free(hash_name);
+               free(fec_device_path);
+               free(salt);
+       }
+
+       return r;
+}
+
+static int _crypt_format_integrity(struct crypt_device *cd,
+                                  const char *uuid,
+                                  struct crypt_params_integrity *params)
+{
+       int r;
+       uint32_t integrity_tag_size;
+       char *integrity = NULL, *journal_integrity = NULL, *journal_crypt = NULL;
+       struct volume_key *journal_crypt_key = NULL, *journal_mac_key = NULL;
+
+       if (!params)
+               return -EINVAL;
+
+       if (uuid) {
+               log_err(cd, _("UUID is not supported for this crypt type."));
+               return -EINVAL;
+       }
+
+       r = device_check_access(cd, crypt_metadata_device(cd), DEV_EXCL);
+       if (r < 0)
+               return r;
+
+       /* Wipe first 8 sectors - fs magic numbers etc. */
+       r = crypt_wipe_device(cd, crypt_metadata_device(cd), CRYPT_WIPE_ZERO, 0,
+                             8 * SECTOR_SIZE, 8 * SECTOR_SIZE, NULL, NULL);
+       if (r < 0) {
+               log_err(cd, _("Cannot wipe header on device %s."),
+                       mdata_device_path(cd));
+               return r;
+       }
+
+       if (!(cd->type = strdup(CRYPT_INTEGRITY)))
+               return -ENOMEM;
+
+       if (params->journal_crypt_key) {
+               journal_crypt_key = crypt_alloc_volume_key(params->journal_crypt_key_size,
+                                                          params->journal_crypt_key);
+               if (!journal_crypt_key)
+                       return -ENOMEM;
+       }
+
+       if (params->journal_integrity_key) {
+               journal_mac_key = crypt_alloc_volume_key(params->journal_integrity_key_size,
+                                                        params->journal_integrity_key);
+               if (!journal_mac_key) {
+                       r = -ENOMEM;
+                       goto err;
                }
+       }
+
+       if (params->integrity && !(integrity = strdup(params->integrity))) {
+               r = -ENOMEM;
+               goto err;
+       }
+       if (params->journal_integrity && !(journal_integrity = strdup(params->journal_integrity))) {
+               r = -ENOMEM;
+               goto err;
+       }
+       if (params->journal_crypt && !(journal_crypt = strdup(params->journal_crypt))) {
+               r = -ENOMEM;
+               goto err;
+       }
 
-               r = VERITY_write_sb(cd, cd->u.verity.hdr.hash_area_offset,
-                                   cd->u.verity.uuid,
-                                   &cd->u.verity.hdr);
+       integrity_tag_size = INTEGRITY_hash_tag_size(integrity);
+       if (integrity_tag_size > 0 && params->tag_size && integrity_tag_size != params->tag_size)
+               log_std(cd, _("WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"),
+                       params->tag_size, integrity, integrity_tag_size);
+
+       if (params->tag_size)
+               integrity_tag_size = params->tag_size;
+
+       cd->u.integrity.journal_crypt_key = journal_crypt_key;
+       cd->u.integrity.journal_mac_key = journal_mac_key;
+       cd->u.integrity.params.journal_size = params->journal_size;
+       cd->u.integrity.params.journal_watermark = params->journal_watermark;
+       cd->u.integrity.params.journal_commit_time = params->journal_commit_time;
+       cd->u.integrity.params.interleave_sectors = params->interleave_sectors;
+       cd->u.integrity.params.buffer_sectors = params->buffer_sectors;
+       cd->u.integrity.params.sector_size = params->sector_size;
+       cd->u.integrity.params.tag_size = integrity_tag_size;
+       cd->u.integrity.params.integrity = integrity;
+       cd->u.integrity.params.journal_integrity = journal_integrity;
+       cd->u.integrity.params.journal_crypt = journal_crypt;
+
+       r = INTEGRITY_format(cd, params, cd->u.integrity.journal_crypt_key, cd->u.integrity.journal_mac_key);
+       if (r)
+               log_err(cd, _("Cannot format integrity for device %s."),
+                       mdata_device_path(cd));
+err:
+       if (r) {
+               crypt_free_volume_key(journal_crypt_key);
+               crypt_free_volume_key(journal_mac_key);
+               free(integrity);
+               free(journal_integrity);
+               free(journal_crypt);
        }
+
        return r;
 }
 
@@ -1255,15 +2251,15 @@ int crypt_format(struct crypt_device *cd,
 {
        int r;
 
-       if (!type)
+       if (!cd || !type)
                return -EINVAL;
 
        if (cd->type) {
-               log_dbg("Context already formatted as %s.", cd->type);
+               log_dbg(cd, "Context already formatted as %s.", cd->type);
                return -EINVAL;
        }
 
-       log_dbg("Formatting device %s as type %s.", mdata_device_path(cd) ?: "(none)", type);
+       log_dbg(cd, "Formatting device %s as type %s.", mdata_device_path(cd) ?: "(none)", type);
 
        crypt_reset_null_type(cd);
 
@@ -1274,15 +2270,20 @@ int crypt_format(struct crypt_device *cd,
        if (isPLAIN(type))
                r = _crypt_format_plain(cd, cipher, cipher_mode,
                                        uuid, volume_key_size, params);
-       else if (isLUKS(type))
+       else if (isLUKS1(type))
                r = _crypt_format_luks1(cd, cipher, cipher_mode,
                                        uuid, volume_key, volume_key_size, params);
+       else if (isLUKS2(type))
+               r = _crypt_format_luks2(cd, cipher, cipher_mode,
+                                       uuid, volume_key, volume_key_size, params);
        else if (isLOOPAES(type))
                r = _crypt_format_loopaes(cd, cipher, uuid, volume_key_size, params);
        else if (isVERITY(type))
                r = _crypt_format_verity(cd, uuid, params);
+       else if (isINTEGRITY(type))
+               r = _crypt_format_integrity(cd, uuid, params);
        else {
-               log_err(cd, _("Unknown crypt device type %s requested.\n"), type);
+               log_err(cd, _("Unknown crypt device type %s requested."), type);
                r = -EINVAL;
        }
 
@@ -1295,52 +2296,16 @@ int crypt_format(struct crypt_device *cd,
        return r;
 }
 
-int crypt_load(struct crypt_device *cd,
-              const char *requested_type,
-              void *params)
-{
-       int r;
-
-       log_dbg("Trying to load %s crypt type from device %s.",
-               requested_type ?: "any", mdata_device_path(cd) ?: "(none)");
-
-       if (!crypt_metadata_device(cd))
-               return -EINVAL;
-
-       crypt_reset_null_type(cd);
-
-       if (!requested_type || isLUKS(requested_type)) {
-               if (cd->type && !isLUKS(cd->type)) {
-                       log_dbg("Context is already initialised to type %s", cd->type);
-                       return -EINVAL;
-               }
-
-               r = _crypt_load_luks1(cd, 1, 0);
-       } else if (isVERITY(requested_type)) {
-               if (cd->type && !isVERITY(cd->type)) {
-                       log_dbg("Context is already initialised to type %s", cd->type);
-                       return -EINVAL;
-               }
-               r = _crypt_load_verity(cd, params);
-       } else if (isTCRYPT(requested_type)) {
-               if (cd->type && !isTCRYPT(cd->type)) {
-                       log_dbg("Context is already initialised to type %s", cd->type);
-                       return -EINVAL;
-               }
-               r = _crypt_load_tcrypt(cd, params);
-       } else
-               return -EINVAL;
-
-       return r;
-}
-
 int crypt_repair(struct crypt_device *cd,
                 const char *requested_type,
                 void *params __attribute__((unused)))
 {
        int r;
 
-       log_dbg("Trying to repair %s crypt type from device %s.",
+       if (!cd)
+               return -EINVAL;
+
+       log_dbg(cd, "Trying to repair %s crypt type from device %s.",
                requested_type ?: "any", mdata_device_path(cd) ?: "(none)");
 
        if (!crypt_metadata_device(cd))
@@ -1349,9 +2314,8 @@ int crypt_repair(struct crypt_device *cd,
        if (requested_type && !isLUKS(requested_type))
                return -EINVAL;
 
-
        /* Load with repair */
-       r = _crypt_load_luks1(cd, 1, 1);
+       r = _crypt_load_luks(cd, requested_type, 1, 1);
        if (r < 0)
                return r;
 
@@ -1363,1367 +2327,3723 @@ int crypt_repair(struct crypt_device *cd,
        return r;
 }
 
-int crypt_resize(struct crypt_device *cd, const char *name, uint64_t new_size)
+/* compare volume keys */
+static int _compare_volume_keys(struct volume_key *svk, unsigned skeyring_only, struct volume_key *tvk, unsigned tkeyring_only)
 {
-       struct crypt_dm_active_device dmd;
-       int r;
+       if (!svk && !tvk)
+               return 0;
+       else if (!svk || !tvk)
+               return 1;
 
-       /* Device context type must be initialised */
-       if (!cd->type)
-               return -EINVAL;
+       if (svk->keylength != tvk->keylength)
+               return 1;
 
-       log_dbg("Resizing device %s to %" PRIu64 " sectors.", name, new_size);
+       if (!skeyring_only && !tkeyring_only)
+               return memcmp(svk->key, tvk->key, svk->keylength);
 
-       r = dm_query_device(cd, name, DM_ACTIVE_DEVICE | DM_ACTIVE_CRYPT_CIPHER |
-                                 DM_ACTIVE_UUID | DM_ACTIVE_CRYPT_KEYSIZE |
-                                 DM_ACTIVE_CRYPT_KEY, &dmd);
-       if (r < 0) {
-               log_err(NULL, _("Device %s is not active.\n"), name);
+       if (svk->key_description && tvk->key_description)
+               return strcmp(svk->key_description, tvk->key_description);
+
+       return 0;
+}
+
+static int _compare_device_types(struct crypt_device *cd,
+                              const struct crypt_dm_active_device *src,
+                              const struct crypt_dm_active_device *tgt)
+{
+       if (!tgt->uuid) {
+               log_dbg(cd, "Missing device uuid in target device.");
                return -EINVAL;
        }
 
-       if (!dmd.uuid || dmd.target != DM_CRYPT) {
-               r = -EINVAL;
-               goto out;
+       if (isLUKS2(cd->type) && !strncmp("INTEGRITY-", tgt->uuid, strlen("INTEGRITY-"))) {
+               if (crypt_uuid_cmp(tgt->uuid, src->uuid)) {
+                       log_dbg(cd, "LUKS UUID mismatch.");
+                       return -EINVAL;
+               }
+       } else if (isLUKS(cd->type)) {
+               if (!src->uuid || strncmp(cd->type, tgt->uuid, strlen(cd->type)) ||
+                   crypt_uuid_cmp(tgt->uuid, src->uuid)) {
+                       log_dbg(cd, "LUKS UUID mismatch.");
+                       return -EINVAL;
+               }
+       } else if (isPLAIN(cd->type) || isLOOPAES(cd->type)) {
+               if (strncmp(cd->type, tgt->uuid, strlen(cd->type))) {
+                       log_dbg(cd, "Unexpected uuid prefix %s in target device.", tgt->uuid);
+                       return -EINVAL;
+               }
+       } else {
+               log_dbg(cd, "Unsupported device type %s for reload.", cd->type ?: "<empty>");
+               return -ENOTSUP;
        }
 
-       r = device_block_adjust(cd, dmd.data_device, DEV_OK,
-                               dmd.u.crypt.offset, &new_size, &dmd.flags);
-       if (r)
-               goto out;
+       return 0;
+}
 
-       if (new_size == dmd.size) {
-               log_dbg("Device has already requested size %" PRIu64
-                       " sectors.", dmd.size);
-               r = 0;
-       } else {
-               dmd.size = new_size;
-               if (isTCRYPT(cd->type))
-                       r = -ENOTSUP;
-               else
-                       r = dm_create_device(cd, name, cd->type, &dmd, 1);
+static int _compare_crypt_devices(struct crypt_device *cd,
+                              const struct dm_target *src,
+                              const struct dm_target *tgt)
+{
+       /* for crypt devices keys are mandatory */
+       if (!src->u.crypt.vk || !tgt->u.crypt.vk)
+               return -EINVAL;
+
+       if (_compare_volume_keys(src->u.crypt.vk, 0, tgt->u.crypt.vk, tgt->u.crypt.vk->key_description != NULL)) {
+               log_dbg(cd, "Keys in context and target device do not match.");
+               return -EINVAL;
        }
-out:
-       if (dmd.target == DM_CRYPT) {
-               crypt_free_volume_key(dmd.u.crypt.vk);
-               free(CONST_CAST(void*)dmd.u.crypt.cipher);
+
+       /* CIPHER checks */
+       if (!src->u.crypt.cipher || !tgt->u.crypt.cipher)
+               return -EINVAL;
+       if (strcmp(src->u.crypt.cipher, tgt->u.crypt.cipher)) {
+               log_dbg(cd, "Cipher specs do not match.");
+               return -EINVAL;
+       }
+       if (crypt_strcmp(src->u.crypt.integrity, tgt->u.crypt.integrity)) {
+               log_dbg(cd, "Integrity parameters do not match.");
+               return -EINVAL;
        }
-       free(CONST_CAST(void*)dmd.data_device);
-       free(CONST_CAST(void*)dmd.uuid);
 
-       return r;
+       if (src->u.crypt.offset      != tgt->u.crypt.offset ||
+           src->u.crypt.sector_size != tgt->u.crypt.sector_size ||
+           src->u.crypt.iv_offset   != tgt->u.crypt.iv_offset ||
+           src->u.crypt.tag_size    != tgt->u.crypt.tag_size) {
+               log_dbg(cd, "Integer parameters do not match.");
+               return -EINVAL;
+       }
+
+       if (!device_is_identical(src->data_device, tgt->data_device)) {
+               log_dbg(cd, "Data devices do not match.");
+               return -EINVAL;
+       }
+
+       return 0;
 }
 
-int crypt_set_uuid(struct crypt_device *cd, const char *uuid)
+static int _compare_integrity_devices(struct crypt_device *cd,
+                              const struct dm_target *src,
+                              const struct dm_target *tgt)
 {
-       if (!isLUKS(cd->type)) {
-               log_err(cd, _("This operation is not supported for this device type.\n"));
-               return  -EINVAL;
+       /*
+        * some parameters may be implicit (and set in dm-integrity ctor)
+        *
+        *      journal_size
+        *      journal_watermark
+        *      journal_commit_time
+        *      buffer_sectors
+        *      interleave_sectors
+        */
+
+       /* check remaining integer values that makes sense */
+       if (src->u.integrity.tag_size     != tgt->u.integrity.tag_size ||
+           src->u.integrity.offset       != tgt->u.integrity.offset   ||
+           src->u.integrity.sector_size  != tgt->u.integrity.sector_size) {
+               log_dbg(cd, "Integer parameters do not match.");
+               return -EINVAL;
        }
 
-       if (uuid && !strncmp(uuid, cd->u.luks1.hdr.uuid, sizeof(cd->u.luks1.hdr.uuid))) {
-               log_dbg("UUID is the same as requested (%s) for device %s.",
-                       uuid, mdata_device_path(cd));
-               return 0;
+       if (crypt_strcmp(src->u.integrity.integrity,         tgt->u.integrity.integrity) ||
+           crypt_strcmp(src->u.integrity.journal_integrity, tgt->u.integrity.journal_integrity) ||
+           crypt_strcmp(src->u.integrity.journal_crypt,     tgt->u.integrity.journal_crypt)) {
+               log_dbg(cd, "Journal parameters do not match.");
+               return -EINVAL;
        }
 
-       if (uuid)
-               log_dbg("Requested new UUID change to %s for %s.", uuid, mdata_device_path(cd));
-       else
-               log_dbg("Requested new UUID refresh for %s.", mdata_device_path(cd));
+       /* unfortunately dm-integrity doesn't support keyring */
+       if (_compare_volume_keys(src->u.integrity.vk, 0, tgt->u.integrity.vk, 0) ||
+           _compare_volume_keys(src->u.integrity.journal_integrity_key, 0, tgt->u.integrity.journal_integrity_key, 0) ||
+           _compare_volume_keys(src->u.integrity.journal_crypt_key, 0, tgt->u.integrity.journal_crypt_key, 0)) {
+               log_dbg(cd, "Journal keys do not match.");
+               return -EINVAL;
+       }
 
-       if (!crypt_confirm(cd, _("Do you really want to change UUID of device?")))
-               return -EPERM;
+       /* unsupported underneath dm-crypt with auth. encryption */
+       if (src->u.integrity.meta_device || tgt->u.integrity.meta_device)
+               return -ENOTSUP;
+
+       if (src->size != tgt->size) {
+               log_dbg(cd, "Device size parameters do not match.");
+               return -EINVAL;
+       }
 
-       return LUKS_hdr_uuid_set(&cd->u.luks1.hdr, uuid, cd);
+       if (!device_is_identical(src->data_device, tgt->data_device)) {
+               log_dbg(cd, "Data devices do not match.");
+               return -EINVAL;
+       }
+
+       return 0;
 }
 
-int crypt_header_backup(struct crypt_device *cd,
-                       const char *requested_type,
-                       const char *backup_file)
+int crypt_compare_dm_devices(struct crypt_device *cd,
+                              const struct crypt_dm_active_device *src,
+                              const struct crypt_dm_active_device *tgt)
 {
        int r;
+       const struct dm_target *s, *t;
 
-       if ((requested_type && !isLUKS(requested_type)) || !backup_file)
-               return -EINVAL;
-
-       if (cd->type && !isLUKS(cd->type))
+       if (!src || !tgt)
                return -EINVAL;
 
-       r = init_crypto(cd);
-       if (r < 0)
+       r = _compare_device_types(cd, src, tgt);
+       if (r)
                return r;
 
-       log_dbg("Requested header backup of device %s (%s) to "
-               "file %s.", mdata_device_path(cd), requested_type, backup_file);
+       s = &src->segment;
+       t = &tgt->segment;
+
+       while (s || t) {
+               if (!s || !t) {
+                       log_dbg(cd, "segments count mismatch.");
+                       return -EINVAL;
+               }
+               if (s->type != t->type) {
+                       log_dbg(cd, "segment type mismatch.");
+                       r = -EINVAL;
+                       break;
+               }
+
+               switch (s->type) {
+               case DM_CRYPT:
+                       r = _compare_crypt_devices(cd, s, t);
+                       break;
+               case DM_INTEGRITY:
+                       r = _compare_integrity_devices(cd, s, t);
+                       break;
+               case DM_LINEAR:
+                       r = (s->u.linear.offset == t->u.linear.offset) ? 0 : -EINVAL;
+                       break;
+               default:
+                       r = -ENOTSUP;
+               }
+
+               if (r)
+                       break;
+
+               s = s->next;
+               t = t->next;
+       }
 
-       r = LUKS_hdr_backup(backup_file, cd);
        return r;
 }
 
-int crypt_header_restore(struct crypt_device *cd,
-                        const char *requested_type,
-                        const char *backup_file)
+static int _reload_device(struct crypt_device *cd, const char *name,
+                         struct crypt_dm_active_device *sdmd)
 {
-       struct luks_phdr hdr;
        int r;
+       struct crypt_dm_active_device tdmd;
+       struct dm_target *src, *tgt = &tdmd.segment;
 
-       if (requested_type && !isLUKS(requested_type))
+       if (!cd || !cd->type || !name || !(sdmd->flags & CRYPT_ACTIVATE_REFRESH))
                return -EINVAL;
 
-       if (cd->type && !isLUKS(cd->type))
+       r = dm_query_device(cd, name, DM_ACTIVE_DEVICE | DM_ACTIVE_CRYPT_CIPHER |
+                                 DM_ACTIVE_UUID | DM_ACTIVE_CRYPT_KEYSIZE |
+                                 DM_ACTIVE_CRYPT_KEY, &tdmd);
+       if (r < 0) {
+               log_err(cd, _("Device %s is not active."), name);
                return -EINVAL;
+       }
 
-       r = init_crypto(cd);
-       if (r < 0)
-               return r;
+       if (!single_segment(&tdmd) || tgt->type != DM_CRYPT || tgt->u.crypt.tag_size) {
+               r = -ENOTSUP;
+               log_err(cd, _("Unsupported parameters on device %s."), name);
+               goto out;
+       }
 
-       log_dbg("Requested header restore to device %s (%s) from "
-               "file %s.", mdata_device_path(cd), requested_type, backup_file);
+       r = crypt_compare_dm_devices(cd, sdmd, &tdmd);
+       if (r) {
+               log_err(cd, _("Mismatching parameters on device %s."), name);
+               goto out;
+       }
 
-       r = LUKS_hdr_restore(backup_file, isLUKS(cd->type) ? &cd->u.luks1.hdr : &hdr, cd);
+       src = &sdmd->segment;
 
-       crypt_memzero(&hdr, sizeof(hdr));
-       return r;
-}
+       /* Changing read only flag for active device makes no sense */
+       if (tdmd.flags & CRYPT_ACTIVATE_READONLY)
+               sdmd->flags |= CRYPT_ACTIVATE_READONLY;
+       else
+               sdmd->flags &= ~CRYPT_ACTIVATE_READONLY;
 
-void crypt_free(struct crypt_device *cd)
-{
-       if (cd) {
-               log_dbg("Releasing crypt device %s context.", mdata_device_path(cd));
+       if (sdmd->flags & CRYPT_ACTIVATE_KEYRING_KEY) {
+               r = crypt_volume_key_set_description(tgt->u.crypt.vk, src->u.crypt.vk->key_description);
+               if (r)
+                       goto out;
+       } else {
+               crypt_free_volume_key(tgt->u.crypt.vk);
+               tgt->u.crypt.vk = crypt_alloc_volume_key(src->u.crypt.vk->keylength, src->u.crypt.vk->key);
+               if (!tgt->u.crypt.vk) {
+                       r = -ENOMEM;
+                       goto out;
+               }
+       }
 
-               dm_backend_exit();
-               crypt_free_volume_key(cd->volume_key);
+       r = device_block_adjust(cd, src->data_device, DEV_OK,
+                               src->u.crypt.offset, &sdmd->size, NULL);
+       if (r)
+               goto out;
 
-               device_free(cd->device);
-               device_free(cd->metadata_device);
-
-               if (isPLAIN(cd->type)) {
-                       free(CONST_CAST(void*)cd->u.plain.hdr.hash);
-                       free(cd->u.plain.cipher);
-                       free(cd->u.plain.cipher_mode);
-               } else if (isLOOPAES(cd->type)) {
-                       free(CONST_CAST(void*)cd->u.loopaes.hdr.hash);
-                       free(cd->u.loopaes.cipher);
-               } else if (isVERITY(cd->type)) {
-                       free(CONST_CAST(void*)cd->u.verity.hdr.hash_name);
-                       free(CONST_CAST(void*)cd->u.verity.hdr.salt);
-                       free(cd->u.verity.root_hash);
-                       free(cd->u.verity.uuid);
-               } else if (!cd->type) {
-                       free(cd->u.none.active_name);
-               }
+       tdmd.flags = sdmd->flags;
+       tgt->size = tdmd.size = sdmd->size;
 
-               free(cd->type);
-               /* Some structures can contain keys (TCRYPT), wipe it */
-               crypt_memzero(cd, sizeof(*cd));
-               free(cd);
-       }
+       r = dm_reload_device(cd, name, &tdmd, 0, 1);
+out:
+       dm_targets_free(cd, &tdmd);
+       free(CONST_CAST(void*)tdmd.uuid);
+
+       return r;
 }
 
-int crypt_suspend(struct crypt_device *cd,
-                 const char *name)
+static int _reload_device_with_integrity(struct crypt_device *cd,
+       const char *name,
+       const char *iname,
+       const char *ipath,
+       struct crypt_dm_active_device *sdmd,
+       struct crypt_dm_active_device *sdmdi)
 {
-       crypt_status_info ci;
        int r;
+       struct crypt_dm_active_device tdmd, tdmdi = {};
+       struct dm_target *src, *srci, *tgt = &tdmd.segment, *tgti = &tdmdi.segment;
+       struct device *data_device = NULL;
 
-       log_dbg("Suspending volume %s.", name);
+       if (!cd || !cd->type || !name || !iname || !(sdmd->flags & CRYPT_ACTIVATE_REFRESH))
+               return -EINVAL;
 
-       if (cd->type) {
-               r = onlyLUKS(cd);
-       } else {
-               r = crypt_uuid_type_cmp(cd, CRYPT_LUKS1);
-               if (r < 0)
-                       log_err(cd, _("This operation is supported only for LUKS device.\n"));
+       r = dm_query_device(cd, name, DM_ACTIVE_DEVICE | DM_ACTIVE_CRYPT_CIPHER |
+                                 DM_ACTIVE_UUID | DM_ACTIVE_CRYPT_KEYSIZE |
+                                 DM_ACTIVE_CRYPT_KEY, &tdmd);
+       if (r < 0) {
+               log_err(cd, _("Device %s is not active."), name);
+               return -EINVAL;
        }
 
-       if (r < 0)
-               return r;
+       if (!single_segment(&tdmd) || tgt->type != DM_CRYPT || !tgt->u.crypt.tag_size) {
+               r = -ENOTSUP;
+               log_err(cd, _("Unsupported parameters on device %s."), name);
+               goto out;
+       }
 
-       ci = crypt_status(NULL, name);
-       if (ci < CRYPT_ACTIVE) {
-               log_err(cd, _("Volume %s is not active.\n"), name);
-               return -EINVAL;
+       r = dm_query_device(cd, iname, DM_ACTIVE_DEVICE | DM_ACTIVE_UUID, &tdmdi);
+       if (r < 0) {
+               log_err(cd, _("Device %s is not active."), iname);
+               r = -EINVAL;
+               goto out;
        }
 
-       dm_backend_init();
+       if (!single_segment(&tdmdi) || tgti->type != DM_INTEGRITY) {
+               r = -ENOTSUP;
+               log_err(cd, _("Unsupported parameters on device %s."), iname);
+               goto out;
+       }
 
-       r = dm_status_suspended(cd, name);
+       r = crypt_compare_dm_devices(cd, sdmdi, &tdmdi);
+       if (r) {
+               log_err(cd, _("Mismatching parameters on device %s."), iname);
+               goto out;
+       }
+
+       src = &sdmd->segment;
+       srci = &sdmdi->segment;
+
+       r = device_alloc(cd, &data_device, ipath);
        if (r < 0)
                goto out;
 
+       r = device_block_adjust(cd, srci->data_device, DEV_OK,
+                               srci->u.integrity.offset, &sdmdi->size, NULL);
+       if (r)
+               goto out;
+
+       src->data_device = data_device;
+
+       r = crypt_compare_dm_devices(cd, sdmd, &tdmd);
        if (r) {
-               log_err(cd, _("Volume %s is already suspended.\n"), name);
-               r = -EINVAL;
+               log_err(cd, _("Crypt devices mismatch."));
                goto out;
        }
 
-       r = dm_suspend_and_wipe_key(cd, name);
-       if (r == -ENOTSUP)
-               log_err(cd, _("Suspend is not supported for device %s.\n"), name);
-       else if (r)
-               log_err(cd, _("Error during suspending device %s.\n"), name);
-out:
-       dm_backend_exit();
-       return r;
-}
+       /* Changing read only flag for active device makes no sense */
+       if (tdmd.flags & CRYPT_ACTIVATE_READONLY)
+               sdmd->flags |= CRYPT_ACTIVATE_READONLY;
+       else
+               sdmd->flags &= ~CRYPT_ACTIVATE_READONLY;
 
-int crypt_resume_by_passphrase(struct crypt_device *cd,
-                              const char *name,
-                              int keyslot,
-                              const char *passphrase,
-                              size_t passphrase_size)
-{
-       struct volume_key *vk = NULL;
-       int r;
+       if (tdmdi.flags & CRYPT_ACTIVATE_READONLY)
+               sdmdi->flags |= CRYPT_ACTIVATE_READONLY;
+       else
+               sdmdi->flags &= ~CRYPT_ACTIVATE_READONLY;
 
-       log_dbg("Resuming volume %s.", name);
+       if (sdmd->flags & CRYPT_ACTIVATE_KEYRING_KEY) {
+               r = crypt_volume_key_set_description(tgt->u.crypt.vk, src->u.crypt.vk->key_description);
+               if (r)
+                       goto out;
+       } else {
+               crypt_free_volume_key(tgt->u.crypt.vk);
+               tgt->u.crypt.vk = crypt_alloc_volume_key(src->u.crypt.vk->keylength, src->u.crypt.vk->key);
+               if (!tgt->u.crypt.vk) {
+                       r = -ENOMEM;
+                       goto out;
+               }
+       }
 
-       r = onlyLUKS(cd);
-       if (r < 0)
-               return r;
+       r = device_block_adjust(cd, src->data_device, DEV_OK,
+                               src->u.crypt.offset, &sdmd->size, NULL);
+       if (r)
+               goto out;
 
-       r = dm_status_suspended(cd, name);
-       if (r < 0)
-               return r;
+       tdmd.flags = sdmd->flags;
+       tdmd.size = sdmd->size;
 
-       if (!r) {
-               log_err(cd, _("Volume %s is not suspended.\n"), name);
-               return -EINVAL;
+       if ((r = dm_reload_device(cd, iname, sdmdi, 0, 0))) {
+               log_err(cd, _("Failed to reload device %s."), iname);
+               goto out;
        }
 
-       if (passphrase) {
-               r = LUKS_open_key_with_hdr(keyslot, passphrase, passphrase_size,
-                                          &cd->u.luks1.hdr, &vk, cd);
-       } else
-               r = volume_key_by_terminal_passphrase(cd, keyslot, &vk);
+       if ((r = dm_reload_device(cd, name, &tdmd, 0, 0))) {
+               log_err(cd, _("Failed to reload device %s."), name);
+               goto err_clear;
+       }
 
-       if (r >= 0) {
-               keyslot = r;
-               r = dm_resume_and_reinstate_key(cd, name, vk->keylength, vk->key);
-               if (r == -ENOTSUP)
-                       log_err(cd, _("Resume is not supported for device %s.\n"), name);
-               else if (r)
-                       log_err(cd, _("Error during resuming device %s.\n"), name);
-       } else
-               r = keyslot;
+       if ((r = dm_suspend_device(cd, name, 0))) {
+               log_err(cd, _("Failed to suspend device %s."), name);
+               goto err_clear;
+       }
 
-       crypt_free_volume_key(vk);
-       return r < 0 ? r : keyslot;
+       if ((r = dm_suspend_device(cd, iname, 0))) {
+               log_err(cd, _("Failed to suspend device %s."), iname);
+               goto err_clear;
+       }
+
+       if ((r = dm_resume_device(cd, iname, act2dmflags(sdmdi->flags)))) {
+               log_err(cd, _("Failed to resume device %s."), iname);
+               goto err_clear;
+       }
+
+       r = dm_resume_device(cd, name, act2dmflags(tdmd.flags));
+       if (!r)
+               goto out;
+
+       /*
+        * This is worst case scenario. We have active underlying dm-integrity device with
+        * new table but dm-crypt resume failed for some reason. Tear everything down and
+        * burn it for good.
+        */
+
+       log_err(cd, _("Fatal error while reloading device %s (on top of device %s)."), name, iname);
+
+       if (dm_error_device(cd, name))
+               log_err(cd, _("Failed to switch device %s to dm-error."), name);
+       if (dm_error_device(cd, iname))
+               log_err(cd, _("Failed to switch device %s to dm-error."), iname);
+       goto out;
+
+err_clear:
+       dm_clear_device(cd, name);
+       dm_clear_device(cd, iname);
+
+       if (dm_status_suspended(cd, name) > 0)
+               dm_resume_device(cd, name, 0);
+       if (dm_status_suspended(cd, iname) > 0)
+               dm_resume_device(cd, iname, 0);
+out:
+       dm_targets_free(cd, &tdmd);
+       dm_targets_free(cd, &tdmdi);
+       free(CONST_CAST(void*)tdmdi.uuid);
+       free(CONST_CAST(void*)tdmd.uuid);
+       device_free(cd, data_device);
+
+       return r;
 }
 
-int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
-                                  const char *name,
-                                  int keyslot,
-                                  const char *keyfile,
-                                  size_t keyfile_size,
-                                  size_t keyfile_offset)
+int crypt_resize(struct crypt_device *cd, const char *name, uint64_t new_size)
 {
-       struct volume_key *vk = NULL;
-       char *passphrase_read = NULL;
-       size_t passphrase_size_read;
+       struct crypt_dm_active_device dmdq, dmd = {};
+       struct dm_target *tgt = &dmdq.segment;
        int r;
 
-       log_dbg("Resuming volume %s.", name);
+       /*
+        * FIXME: Also with LUKS2 we must not allow resize when there's
+        *        explicit size stored in metadata (length != "dynamic")
+        */
 
-       r = onlyLUKS(cd);
-       if (r < 0)
-               return r;
+       /* Device context type must be initialized */
+       if (!cd || !cd->type || !name)
+               return -EINVAL;
 
-       r = dm_status_suspended(cd, name);
-       if (r < 0)
-               return r;
+       log_dbg(cd, "Resizing device %s to %" PRIu64 " sectors.", name, new_size);
 
-       if (!r) {
-               log_err(cd, _("Volume %s is not suspended.\n"), name);
+       r = dm_query_device(cd, name, DM_ACTIVE_CRYPT_KEYSIZE | DM_ACTIVE_CRYPT_KEY, &dmdq);
+       if (r < 0) {
+               log_err(cd, _("Device %s is not active."), name);
                return -EINVAL;
        }
-
-       if (!keyfile)
-               return -EINVAL;
-
-       r = key_from_file(cd, _("Enter passphrase: "), &passphrase_read,
-                         &passphrase_size_read, keyfile, keyfile_offset,
-                         keyfile_size);
-       if (r < 0)
+       if (!single_segment(&dmdq) || tgt->type != DM_CRYPT) {
+               log_dbg(cd, "Unsupported device table detected in %s.", name);
+               r = -EINVAL;
                goto out;
+       }
 
-       r = LUKS_open_key_with_hdr(keyslot, passphrase_read,
-                                  passphrase_size_read, &cd->u.luks1.hdr, &vk, cd);
-       if (r < 0)
+       if ((dmdq.flags & CRYPT_ACTIVATE_KEYRING_KEY) && !crypt_key_in_keyring(cd)) {
+               r = -EPERM;
                goto out;
+       }
 
-       keyslot = r;
-       r = dm_resume_and_reinstate_key(cd, name, vk->keylength, vk->key);
-       if (r)
-               log_err(cd, _("Error during resuming device %s.\n"), name);
-out:
-       crypt_safe_free(passphrase_read);
-       crypt_free_volume_key(vk);
-       return r < 0 ? r : keyslot;
-}
-
-int crypt_resume_by_keyfile(struct crypt_device *cd,
-                           const char *name,
-                           int keyslot,
-                           const char *keyfile,
-                           size_t keyfile_size)
-{
-       return crypt_resume_by_keyfile_offset(cd, name, keyslot,
-                                             keyfile, keyfile_size, 0);
-}
-
-// slot manipulation
-int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
-       int keyslot, // -1 any
-       const char *passphrase, // NULL -> terminal
-       size_t passphrase_size,
-       const char *new_passphrase, // NULL -> terminal
-       size_t new_passphrase_size)
-{
-       struct volume_key *vk = NULL;
-       char *password = NULL, *new_password = NULL;
-       size_t passwordLen, new_passwordLen;
-       int r;
+       if (crypt_key_in_keyring(cd)) {
+               if (!isLUKS2(cd->type)) {
+                       r = -EINVAL;
+                       goto out;
+               }
+               r = LUKS2_key_description_by_segment(cd, &cd->u.luks2.hdr,
+                                       tgt->u.crypt.vk, CRYPT_DEFAULT_SEGMENT);
+               if (r)
+                       goto out;
 
-       log_dbg("Adding new keyslot, existing passphrase %sprovided,"
-               "new passphrase %sprovided.",
-               passphrase ? "" : "not ", new_passphrase  ? "" : "not ");
+               dmdq.flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+       }
 
-       r = onlyLUKS(cd);
-       if (r < 0)
-               return r;
+       if (crypt_loop_device(crypt_get_device_name(cd))) {
+               log_dbg(cd, "Trying to resize underlying loop device %s.",
+                       crypt_get_device_name(cd));
+               /* Here we always use default size not new_size */
+               if (crypt_loop_resize(crypt_get_device_name(cd)))
+                       log_err(cd, _("Cannot resize loop device."));
+       }
 
-       r = keyslot_verify_or_find_empty(cd, &keyslot);
+       r = device_block_adjust(cd, crypt_data_device(cd), DEV_OK,
+                               crypt_get_data_offset(cd), &new_size, &dmdq.flags);
        if (r)
-               return r;
-
-       if (!LUKS_keyslot_active_count(&cd->u.luks1.hdr)) {
-               /* No slots used, try to use pre-generated key in header */
-               if (cd->volume_key) {
-                       vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
-                       r = vk ? 0 : -ENOMEM;
-               } else {
-                       log_err(cd, _("Cannot add key slot, all slots disabled and no volume key provided.\n"));
-                       return -EINVAL;
-               }
-       } else if (passphrase) {
-               /* Passphrase provided, use it to unlock existing keyslot */
-               r = LUKS_open_key_with_hdr(CRYPT_ANY_SLOT, passphrase,
-                                          passphrase_size, &cd->u.luks1.hdr, &vk, cd);
-       } else {
-               /* Passphrase not provided, ask first and use it to unlock existing keyslot */
-               r = key_from_terminal(cd, _("Enter any passphrase: "),
-                                     &password, &passwordLen, 0);
-               if (r < 0)
-                       goto out;
+               goto out;
 
-               r = LUKS_open_key_with_hdr(CRYPT_ANY_SLOT, password,
-                                          passwordLen, &cd->u.luks1.hdr, &vk, cd);
-               crypt_safe_free(password);
+       if (MISALIGNED(new_size, tgt->u.crypt.sector_size >> SECTOR_SHIFT)) {
+               log_err(cd, _("Device size is not aligned to requested sector size."));
+               r = -EINVAL;
+               goto out;
        }
 
-       if(r < 0)
+       if (MISALIGNED(new_size, device_block_size(cd, crypt_data_device(cd)) >> SECTOR_SHIFT)) {
+               log_err(cd, _("Device size is not aligned to device logical block size."));
+               r = -EINVAL;
                goto out;
-
-       if (new_passphrase) {
-               new_password = CONST_CAST(char*)new_passphrase;
-               new_passwordLen = new_passphrase_size;
-       } else {
-               r = key_from_terminal(cd, _("Enter new passphrase for key slot: "),
-                                     &new_password, &new_passwordLen, 1);
-               if(r < 0)
-                       goto out;
        }
 
-       r = LUKS_set_key(keyslot, new_password, new_passwordLen,
-                        &cd->u.luks1.hdr, vk, cd->iteration_time, &cd->u.luks1.PBKDF2_per_sec, cd);
-       if(r < 0)
+       dmd.uuid = crypt_get_uuid(cd);
+       dmd.size = new_size;
+       dmd.flags = dmdq.flags | CRYPT_ACTIVATE_REFRESH;
+       r = dm_crypt_target_set(&dmd.segment, 0, new_size, crypt_data_device(cd),
+                       tgt->u.crypt.vk, crypt_get_cipher_spec(cd),
+                       crypt_get_iv_offset(cd), crypt_get_data_offset(cd),
+                       crypt_get_integrity(cd), crypt_get_integrity_tag_size(cd),
+                       crypt_get_sector_size(cd));
+       if (r < 0)
                goto out;
 
-       r = 0;
+       if (new_size == dmdq.size) {
+               log_dbg(cd, "Device has already requested size %" PRIu64
+                       " sectors.", dmdq.size);
+               r = 0;
+       } else {
+               if (isTCRYPT(cd->type))
+                       r = -ENOTSUP;
+               else if (isLUKS2(cd->type))
+                       r = LUKS2_unmet_requirements(cd, &cd->u.luks2.hdr, 0, 0);
+               if (!r)
+                       r = _reload_device(cd, name, &dmd);
+       }
 out:
-       if (!new_passphrase)
-               crypt_safe_free(new_password);
-       crypt_free_volume_key(vk);
-       return r < 0 ? r : keyslot;
+       dm_targets_free(cd, &dmd);
+       dm_targets_free(cd, &dmdq);
+
+       return r;
 }
 
-int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
-       int keyslot_old,
-       int keyslot_new,
-       const char *passphrase,
-       size_t passphrase_size,
-       const char *new_passphrase,
-       size_t new_passphrase_size)
+int crypt_set_uuid(struct crypt_device *cd, const char *uuid)
 {
-       struct volume_key *vk = NULL;
+       const char *active_uuid;
        int r;
 
-       log_dbg("Changing passphrase from old keyslot %d to new %d.",
-               keyslot_old, keyslot_new);
+       log_dbg(cd, "%s device uuid.", uuid ? "Setting new" : "Refreshing");
 
-       r = onlyLUKS(cd);
-       if (r < 0)
+       if ((r = onlyLUKS(cd)))
                return r;
 
-       r = LUKS_open_key_with_hdr(keyslot_old, passphrase, passphrase_size,
-                                  &cd->u.luks1.hdr, &vk, cd);
-       if (r < 0)
-               goto out;
-
-       if (keyslot_old != CRYPT_ANY_SLOT && keyslot_old != r) {
-               log_dbg("Keyslot mismatch.");
-               goto out;
-       }
-       keyslot_old = r;
+       active_uuid = crypt_get_uuid(cd);
 
-       if (keyslot_new == CRYPT_ANY_SLOT) {
-               keyslot_new = LUKS_keyslot_find_empty(&cd->u.luks1.hdr);
-               if (keyslot_new < 0)
-                       keyslot_new = keyslot_old;
+       if (uuid && active_uuid && !strncmp(uuid, active_uuid, UUID_STRING_L)) {
+               log_dbg(cd, "UUID is the same as requested (%s) for device %s.",
+                       uuid, mdata_device_path(cd));
+               return 0;
        }
 
-       if (keyslot_old == keyslot_new) {
-               log_dbg("Key slot %d is going to be overwritten.", keyslot_old);
-               (void)crypt_keyslot_destroy(cd, keyslot_old);
-       }
+       if (uuid)
+               log_dbg(cd, "Requested new UUID change to %s for %s.", uuid, mdata_device_path(cd));
+       else
+               log_dbg(cd, "Requested new UUID refresh for %s.", mdata_device_path(cd));
 
-       r = LUKS_set_key(keyslot_new, new_passphrase, new_passphrase_size,
-                        &cd->u.luks1.hdr, vk, cd->iteration_time,
-                        &cd->u.luks1.PBKDF2_per_sec, cd);
+       if (!crypt_confirm(cd, _("Do you really want to change UUID of device?")))
+               return -EPERM;
 
-       if (keyslot_old == keyslot_new) {
-               if (r >= 0)
-                       log_verbose(cd, _("Key slot %d changed.\n"), keyslot_new);
-       } else {
-               if (r >= 0) {
-                       log_verbose(cd, _("Replaced with key slot %d.\n"), keyslot_new);
-                       r = crypt_keyslot_destroy(cd, keyslot_old);
-               }
-       }
-       if (r < 0)
-               log_err(cd, _("Failed to swap new key slot.\n"));
-out:
-       crypt_free_volume_key(vk);
-       return r < 0 ? r : keyslot_new;
+       if (isLUKS1(cd->type))
+               return LUKS_hdr_uuid_set(&cd->u.luks1.hdr, uuid, cd);
+       else
+               return LUKS2_hdr_uuid(cd, &cd->u.luks2.hdr, uuid);
 }
 
-int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
-       int keyslot,
-       const char *keyfile,
-       size_t keyfile_size,
-       size_t keyfile_offset,
-       const char *new_keyfile,
-       size_t new_keyfile_size,
-       size_t new_keyfile_offset)
+int crypt_set_label(struct crypt_device *cd, const char *label, const char *subsystem)
 {
-       struct volume_key *vk = NULL;
-       char *password = NULL; size_t passwordLen;
-       char *new_password = NULL; size_t new_passwordLen;
        int r;
 
-       log_dbg("Adding new keyslot, existing keyfile %s, new keyfile %s.",
-               keyfile ?: "[none]", new_keyfile ?: "[none]");
+       log_dbg(cd, "Setting new labels.");
 
-       r = onlyLUKS(cd);
-       if (r < 0)
+       if ((r = onlyLUKS2(cd)))
                return r;
 
-       r = keyslot_verify_or_find_empty(cd, &keyslot);
-       if (r)
-               return r;
+       return LUKS2_hdr_labels(cd, &cd->u.luks2.hdr, label, subsystem, 1);
+}
 
-       if (!LUKS_keyslot_active_count(&cd->u.luks1.hdr)) {
-               /* No slots used, try to use pre-generated key in header */
-               if (cd->volume_key) {
-                       vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
-                       r = vk ? 0 : -ENOMEM;
-               } else {
-                       log_err(cd, _("Cannot add key slot, all slots disabled and no volume key provided.\n"));
-                       return -EINVAL;
-               }
-       } else {
-               /* Read password from file of (if NULL) from terminal */
-               if (keyfile)
-                       r = key_from_file(cd, _("Enter any passphrase: "),
-                                         &password, &passwordLen,
-                                         keyfile, keyfile_offset, keyfile_size);
-               else
-                       r = key_from_terminal(cd, _("Enter any passphrase: "),
-                                             &password, &passwordLen, 0);
-               if (r < 0)
-                       goto out;
+int crypt_header_backup(struct crypt_device *cd,
+                       const char *requested_type,
+                       const char *backup_file)
+{
+       int r;
 
-               r = LUKS_open_key_with_hdr(CRYPT_ANY_SLOT, password, passwordLen,
-                                          &cd->u.luks1.hdr, &vk, cd);
-       }
+       if (requested_type && !isLUKS(requested_type))
+               return -EINVAL;
 
-       if(r < 0)
-               goto out;
+       if (!backup_file)
+               return -EINVAL;
 
-       if (new_keyfile)
-               r = key_from_file(cd, _("Enter new passphrase for key slot: "),
-                                 &new_password, &new_passwordLen, new_keyfile,
-                                 new_keyfile_offset, new_keyfile_size);
-       else
-               r = key_from_terminal(cd, _("Enter new passphrase for key slot: "),
-                                     &new_password, &new_passwordLen, 1);
+       /* Load with repair */
+       r = _crypt_load_luks(cd, requested_type, 1, 0);
        if (r < 0)
-               goto out;
+               return r;
 
-       r = LUKS_set_key(keyslot, new_password, new_passwordLen,
-                        &cd->u.luks1.hdr, vk, cd->iteration_time, &cd->u.luks1.PBKDF2_per_sec, cd);
-out:
-       crypt_safe_free(password);
-       crypt_safe_free(new_password);
-       crypt_free_volume_key(vk);
-       return r < 0 ? r : keyslot;
-}
+       log_dbg(cd, "Requested header backup of device %s (%s) to "
+               "file %s.", mdata_device_path(cd), requested_type ?: "any type", backup_file);
 
-int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
-       int keyslot,
-       const char *keyfile,
-       size_t keyfile_size,
-       const char *new_keyfile,
-       size_t new_keyfile_size)
-{
-       return crypt_keyslot_add_by_keyfile_offset(cd, keyslot,
-                               keyfile, keyfile_size, 0,
-                               new_keyfile, new_keyfile_size, 0);
+       if (isLUKS1(cd->type) && (!requested_type || isLUKS1(requested_type)))
+               r = LUKS_hdr_backup(backup_file, cd);
+       else if (isLUKS2(cd->type) && (!requested_type || isLUKS2(requested_type)))
+               r = LUKS2_hdr_backup(cd, &cd->u.luks2.hdr, backup_file);
+       else
+               r = -EINVAL;
+
+       return r;
 }
 
-int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
-       int keyslot,
-       const char *volume_key,
-       size_t volume_key_size,
-       const char *passphrase,
-       size_t passphrase_size)
+int crypt_header_restore(struct crypt_device *cd,
+                        const char *requested_type,
+                        const char *backup_file)
 {
-       struct volume_key *vk = NULL;
-       int r;
-       char *new_password = NULL; size_t new_passwordLen;
+       struct luks_phdr hdr1;
+       struct luks2_hdr hdr2;
+       int r, version;
+
+       if (requested_type && !isLUKS(requested_type))
+               return -EINVAL;
 
-       log_dbg("Adding new keyslot %d using volume key.", keyslot);
+       if (!cd || (cd->type && !isLUKS(cd->type)) || !backup_file)
+               return -EINVAL;
 
-       r = onlyLUKS(cd);
+       r = init_crypto(cd);
        if (r < 0)
                return r;
 
-       if (volume_key)
-               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
-       else if (cd->volume_key)
-               vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
+       log_dbg(cd, "Requested header restore to device %s (%s) from "
+               "file %s.", mdata_device_path(cd), requested_type ?: "any type", backup_file);
 
-       if (!vk)
-               return -ENOMEM;
-
-       r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
-       if (r < 0) {
-               log_err(cd, _("Volume key does not match the volume.\n"));
-               goto out;
+       version = LUKS2_hdr_version_unlocked(cd, backup_file);
+       if (!version ||
+          (requested_type && version == 1 && !isLUKS1(requested_type)) ||
+          (requested_type && version == 2 && !isLUKS2(requested_type))) {
+               log_err(cd, _("Header backup file does not contain compatible LUKS header."));
+               return -EINVAL;
        }
 
-       r = keyslot_verify_or_find_empty(cd, &keyslot);
-       if (r)
-               goto out;
+       memset(&hdr2, 0, sizeof(hdr2));
 
-       if (!passphrase) {
-               r = key_from_terminal(cd, _("Enter new passphrase for key slot: "),
-                                     &new_password, &new_passwordLen, 1);
-               if (r < 0)
-                       goto out;
-               passphrase = new_password;
-               passphrase_size = new_passwordLen;
-       }
+       if (!cd->type) {
+               if (version == 1)
+                       r = LUKS_hdr_restore(backup_file, &hdr1, cd);
+               else
+                       r = LUKS2_hdr_restore(cd, &hdr2, backup_file);
 
-       r = LUKS_set_key(keyslot, passphrase, passphrase_size,
-                        &cd->u.luks1.hdr, vk, cd->iteration_time, &cd->u.luks1.PBKDF2_per_sec, cd);
-out:
-       crypt_safe_free(new_password);
-       crypt_free_volume_key(vk);
-       return (r < 0) ? r : keyslot;
+               crypt_safe_memzero(&hdr1, sizeof(hdr1));
+               crypt_safe_memzero(&hdr2, sizeof(hdr2));
+       } else if (isLUKS2(cd->type) && (!requested_type || isLUKS2(requested_type))) {
+               r = LUKS2_hdr_restore(cd, &cd->u.luks2.hdr, backup_file);
+               if (r)
+                       _luks2_reload(cd);
+       } else if (isLUKS1(cd->type) && (!requested_type || isLUKS1(requested_type)))
+               r = LUKS_hdr_restore(backup_file, &cd->u.luks1.hdr, cd);
+       else
+               r = -EINVAL;
+
+       if (!r)
+               r = _crypt_load_luks(cd, version == 1 ? CRYPT_LUKS1 : CRYPT_LUKS2, 1, 1);
+
+       return r;
 }
 
-int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot)
+void crypt_free(struct crypt_device *cd)
 {
-       crypt_keyslot_info ki;
-       int r;
+       if (!cd)
+               return;
 
-       log_dbg("Destroying keyslot %d.", keyslot);
+       log_dbg(cd, "Releasing crypt device %s context.", mdata_device_path(cd));
 
-       r = onlyLUKS(cd);
-       if (r < 0)
-               return r;
+       dm_backend_exit(cd);
+       crypt_free_volume_key(cd->volume_key);
 
-       ki = crypt_keyslot_status(cd, keyslot);
-       if (ki == CRYPT_SLOT_INVALID) {
-               log_err(cd, _("Key slot %d is invalid.\n"), keyslot);
-               return -EINVAL;
-       }
+       crypt_free_type(cd);
 
-       if (ki == CRYPT_SLOT_INACTIVE) {
-               log_err(cd, _("Key slot %d is not used.\n"), keyslot);
-               return -EINVAL;
-       }
+       device_free(cd, cd->device);
+       device_free(cd, cd->metadata_device);
+
+       free(CONST_CAST(void*)cd->pbkdf.type);
+       free(CONST_CAST(void*)cd->pbkdf.hash);
 
-       return LUKS_del_key(keyslot, &cd->u.luks1.hdr, cd);
+       /* Some structures can contain keys (TCRYPT), wipe it */
+       crypt_safe_memzero(cd, sizeof(*cd));
+       free(cd);
 }
 
-// activation/deactivation of device mapping
-int crypt_activate_by_passphrase(struct crypt_device *cd,
-       const char *name,
-       int keyslot,
-       const char *passphrase,
-       size_t passphrase_size,
-       uint32_t flags)
+static char *crypt_get_device_key_description(struct crypt_device *cd, const char *name)
+{
+       char *desc = NULL;
+       struct crypt_dm_active_device dmd;
+       struct dm_target *tgt = &dmd.segment;
+
+       if (dm_query_device(cd, name, DM_ACTIVE_CRYPT_KEY | DM_ACTIVE_CRYPT_KEYSIZE, &dmd) < 0)
+               return NULL;
+
+       if (single_segment(&dmd) && tgt->type == DM_CRYPT &&
+           (dmd.flags & CRYPT_ACTIVATE_KEYRING_KEY) && tgt->u.crypt.vk->key_description)
+               desc = strdup(tgt->u.crypt.vk->key_description);
+
+       dm_targets_free(cd, &dmd);
+
+       return desc;
+}
+
+int crypt_suspend(struct crypt_device *cd,
+                 const char *name)
 {
+       char *key_desc;
        crypt_status_info ci;
-       struct volume_key *vk = NULL;
-       char *read_passphrase = NULL;
-       size_t passphraseLen = 0;
        int r;
+       uint32_t dmflags = DM_SUSPEND_WIPE_KEY;
 
-       log_dbg("%s volume %s [keyslot %d] using %spassphrase.",
-               name ? "Activating" : "Checking", name ?: "",
-               keyslot, passphrase ? "" : "[none] ");
+       /* FIXME: check context uuid matches the dm-crypt device uuid (onlyLUKS branching) */
 
-       if (name) {
-               ci = crypt_status(NULL, name);
-               if (ci == CRYPT_INVALID)
-                       return -EINVAL;
-               else if (ci >= CRYPT_ACTIVE) {
-                       log_err(cd, _("Device %s already exists.\n"), name);
-                       return -EEXIST;
-               }
-       }
+       if (!cd || !name)
+               return -EINVAL;
 
-       /* plain, use hashed passphrase */
-       if (isPLAIN(cd->type)) {
-               if (!name)
-                       return -EINVAL;
+       log_dbg(cd, "Suspending volume %s.", name);
 
-               if (!passphrase) {
-                       r = key_from_terminal(cd, NULL, &read_passphrase,
-                                             &passphraseLen, 0);
-                       if (r < 0)
-                               goto out;
-                       passphrase = read_passphrase;
-                       passphrase_size = passphraseLen;
-               }
+       if (cd->type)
+               r = onlyLUKS(cd);
+       else {
+               r = crypt_uuid_type_cmp(cd, CRYPT_LUKS1);
+               if (r < 0)
+                       r = crypt_uuid_type_cmp(cd, CRYPT_LUKS2);
+               if (r < 0)
+                       log_err(cd, _("This operation is supported only for LUKS device."));
+       }
 
-               r = process_key(cd, cd->u.plain.hdr.hash,
-                               cd->u.plain.key_size,
-                               passphrase, passphrase_size, &vk);
+       if (r < 0)
+               return r;
+
+       ci = crypt_status(NULL, name);
+       if (ci < CRYPT_ACTIVE) {
+               log_err(cd, _("Volume %s is not active."), name);
+               return -EINVAL;
+       }
+
+       dm_backend_init(cd);
+
+       r = dm_status_suspended(cd, name);
+       if (r < 0)
+               goto out;
+
+       if (r) {
+               log_err(cd, _("Volume %s is already suspended."), name);
+               r = -EINVAL;
+               goto out;
+       }
+
+       key_desc = crypt_get_device_key_description(cd, name);
+
+       /* we can't simply wipe wrapped keys */
+       if (crypt_cipher_wrapped_key(crypt_get_cipher(cd), crypt_get_cipher_mode(cd)))
+               dmflags &= ~DM_SUSPEND_WIPE_KEY;
+
+       r = dm_suspend_device(cd, name, dmflags);
+       if (r == -ENOTSUP)
+               log_err(cd, _("Suspend is not supported for device %s."), name);
+       else if (r)
+               log_err(cd, _("Error during suspending device %s."), name);
+       else
+               crypt_drop_keyring_key_by_description(cd, key_desc, LOGON_KEY);
+       free(key_desc);
+out:
+       dm_backend_exit(cd);
+       return r;
+}
+
+int crypt_resume_by_passphrase(struct crypt_device *cd,
+                              const char *name,
+                              int keyslot,
+                              const char *passphrase,
+                              size_t passphrase_size)
+{
+       struct volume_key *vk = NULL;
+       int r;
+
+       /* FIXME: check context uuid matches the dm-crypt device uuid */
+
+       if (!passphrase || !name)
+               return -EINVAL;
+
+       log_dbg(cd, "Resuming volume %s.", name);
+
+       if ((r = onlyLUKS(cd)))
+               return r;
+
+       r = dm_status_suspended(cd, name);
+       if (r < 0)
+               return r;
+
+       if (!r) {
+               log_err(cd, _("Volume %s is not suspended."), name);
+               return -EINVAL;
+       }
+
+       if (isLUKS1(cd->type))
+               r = LUKS_open_key_with_hdr(keyslot, passphrase, passphrase_size,
+                                          &cd->u.luks1.hdr, &vk, cd);
+       else
+               r = LUKS2_keyslot_open(cd, keyslot, CRYPT_DEFAULT_SEGMENT, passphrase, passphrase_size, &vk);
+
+       if  (r < 0)
+               goto out;
+
+       keyslot = r;
+
+       if (crypt_use_keyring_for_vk(cd)) {
+               if (!isLUKS2(cd->type)) {
+                       r = -EINVAL;
+                       goto out;
+               }
+               r = LUKS2_volume_key_load_in_keyring_by_keyslot(cd,
+                                       &cd->u.luks2.hdr, vk, keyslot);
                if (r < 0)
                        goto out;
+       }
 
-               r = PLAIN_activate(cd, name, vk, cd->u.plain.hdr.size, flags);
-               keyslot = 0;
-       } else if (isLUKS(cd->type)) {
-               /* provided passphrase, do not retry */
-               if (passphrase) {
-                       r = LUKS_open_key_with_hdr(keyslot, passphrase,
-                                                  passphrase_size, &cd->u.luks1.hdr, &vk, cd);
-               } else
-                       r = volume_key_by_terminal_passphrase(cd, keyslot, &vk);
+       r = dm_resume_and_reinstate_key(cd, name, vk);
 
-               if (r >= 0) {
-                       keyslot = r;
-                       if (name)
-                               r = LUKS1_activate(cd, name, vk, flags);
-               }
-       } else
-               r = -EINVAL;
+       if (r == -ENOTSUP)
+               log_err(cd, _("Resume is not supported for device %s."), name);
+       else if (r)
+               log_err(cd, _("Error during resuming device %s."), name);
 out:
-       crypt_safe_free(read_passphrase);
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
        crypt_free_volume_key(vk);
 
-       return r < 0  ? r : keyslot;
+       return r < 0 ? r : keyslot;
 }
 
-int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
-       const char *name,
-       int keyslot,
-       const char *keyfile,
-       size_t keyfile_size,
-       size_t keyfile_offset,
-       uint32_t flags)
+int crypt_resume_by_keyfile_device_offset(struct crypt_device *cd,
+                                         const char *name,
+                                         int keyslot,
+                                         const char *keyfile,
+                                         size_t keyfile_size,
+                                         uint64_t keyfile_offset)
 {
-       crypt_status_info ci;
        struct volume_key *vk = NULL;
        char *passphrase_read = NULL;
        size_t passphrase_size_read;
-       unsigned int key_count = 0;
        int r;
 
-       log_dbg("Activating volume %s [keyslot %d] using keyfile %s.",
-               name ?: "", keyslot, keyfile ?: "[none]");
-
-       if (name) {
-               ci = crypt_status(NULL, name);
-               if (ci == CRYPT_INVALID)
-                       return -EINVAL;
-               else if (ci >= CRYPT_ACTIVE) {
-                       log_err(cd, _("Device %s already exists.\n"), name);
-                       return -EEXIST;
-               }
-       }
+       /* FIXME: check context uuid matches the dm-crypt device uuid */
 
-       if (!keyfile)
+       if (!name || !keyfile)
                return -EINVAL;
 
-       if (isPLAIN(cd->type)) {
-               if (!name)
-                       return -EINVAL;
+       log_dbg(cd, "Resuming volume %s.", name);
 
-               r = key_from_file(cd, _("Enter passphrase: "),
-                                 &passphrase_read, &passphrase_size_read,
-                                 keyfile, keyfile_offset, keyfile_size);
-               if (r < 0)
-                       goto out;
+       if ((r = onlyLUKS(cd)))
+               return r;
 
-               r = process_key(cd, cd->u.plain.hdr.hash,
-                               cd->u.plain.key_size,
-                               passphrase_read, passphrase_size_read, &vk);
-               if (r < 0)
-                       goto out;
+       r = dm_status_suspended(cd, name);
+       if (r < 0)
+               return r;
 
-               r = PLAIN_activate(cd, name, vk, cd->u.plain.hdr.size, flags);
-       } else if (isLUKS(cd->type)) {
-               r = key_from_file(cd, _("Enter passphrase: "), &passphrase_read,
-                         &passphrase_size_read, keyfile, keyfile_offset, keyfile_size);
-               if (r < 0)
-                       goto out;
-               r = LUKS_open_key_with_hdr(keyslot, passphrase_read,
-                                          passphrase_size_read, &cd->u.luks1.hdr, &vk, cd);
-               if (r < 0)
-                       goto out;
-               keyslot = r;
+       if (!r) {
+               log_err(cd, _("Volume %s is not suspended."), name);
+               return -EINVAL;
+       }
 
-               if (name) {
-                       r = LUKS1_activate(cd, name, vk, flags);
-                       if (r < 0)
-                               goto out;
-               }
-               r = keyslot;
-       } else if (isLOOPAES(cd->type)) {
-               r = key_from_file(cd, NULL, &passphrase_read, &passphrase_size_read,
-                                 keyfile, keyfile_offset, keyfile_size);
-               if (r < 0)
+       r = crypt_keyfile_device_read(cd, keyfile,
+                                     &passphrase_read, &passphrase_size_read,
+                                     keyfile_offset, keyfile_size, 0);
+       if (r < 0)
+               goto out;
+
+       if (isLUKS1(cd->type))
+               r = LUKS_open_key_with_hdr(keyslot, passphrase_read, passphrase_size_read,
+                                          &cd->u.luks1.hdr, &vk, cd);
+       else
+               r = LUKS2_keyslot_open(cd, keyslot, CRYPT_DEFAULT_SEGMENT, passphrase_read, passphrase_size_read, &vk);
+       if (r < 0)
+               goto out;
+       keyslot = r;
+
+       if (crypt_use_keyring_for_vk(cd)) {
+               if (!isLUKS2(cd->type)) {
+                       r = -EINVAL;
                        goto out;
-               r = LOOPAES_parse_keyfile(cd, &vk, cd->u.loopaes.hdr.hash, &key_count,
-                                         passphrase_read, passphrase_size_read);
+               }
+               r = LUKS2_volume_key_load_in_keyring_by_keyslot(cd,
+                                       &cd->u.luks2.hdr, vk, keyslot);
                if (r < 0)
                        goto out;
-               if (name)
-                       r = LOOPAES_activate(cd, name, cd->u.loopaes.cipher,
-                                            key_count, vk, flags);
-       } else
-               r = -EINVAL;
+       }
 
+       r = dm_resume_and_reinstate_key(cd, name, vk);
+       if (r < 0)
+               log_err(cd, _("Error during resuming device %s."), name);
 out:
        crypt_safe_free(passphrase_read);
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
        crypt_free_volume_key(vk);
+       return r < 0 ? r : keyslot;
+}
 
-       return r;
+int crypt_resume_by_keyfile(struct crypt_device *cd,
+                           const char *name,
+                           int keyslot,
+                           const char *keyfile,
+                           size_t keyfile_size)
+{
+       return crypt_resume_by_keyfile_device_offset(cd, name, keyslot,
+                                             keyfile, keyfile_size, 0);
 }
 
-int crypt_activate_by_keyfile(struct crypt_device *cd,
-       const char *name,
-       int keyslot,
-       const char *keyfile,
-       size_t keyfile_size,
-       uint32_t flags)
+int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
+                                  const char *name,
+                                  int keyslot,
+                                  const char *keyfile,
+                                  size_t keyfile_size,
+                                  size_t keyfile_offset)
 {
-       return crypt_activate_by_keyfile_offset(cd, name, keyslot, keyfile,
-                                               keyfile_size, 0, flags);
+       return crypt_resume_by_keyfile_device_offset(cd, name, keyslot,
+                                     keyfile, keyfile_size, keyfile_offset);
 }
 
-int crypt_activate_by_volume_key(struct crypt_device *cd,
+int crypt_resume_by_volume_key(struct crypt_device *cd,
        const char *name,
        const char *volume_key,
-       size_t volume_key_size,
-       uint32_t flags)
+       size_t volume_key_size)
 {
-       crypt_status_info ci;
        struct volume_key *vk = NULL;
-       int r = -EINVAL;
+       int r;
 
-       log_dbg("Activating volume %s by volume key.", name ?: "[none]");
+       if (!name || !volume_key)
+               return -EINVAL;
 
-       if (name) {
-               ci = crypt_status(NULL, name);
-               if (ci == CRYPT_INVALID)
-                       return -EINVAL;
-               else if (ci >= CRYPT_ACTIVE) {
-                       log_err(cd, _("Device %s already exists.\n"), name);
-                       return -EEXIST;
-               }
-       }
+       log_dbg(cd, "Resuming volume %s by volume key.", name);
 
-       /* use key directly, no hash */
-       if (isPLAIN(cd->type)) {
-               if (!name)
-                       return -EINVAL;
+       if ((r = onlyLUKS(cd)))
+               return r;
 
-               if (!volume_key || !volume_key_size || volume_key_size != cd->u.plain.key_size) {
-                       log_err(cd, _("Incorrect volume key specified for plain device.\n"));
-                       return -EINVAL;
-               }
+       r = dm_status_suspended(cd, name);
+       if (r < 0)
+               return r;
 
-               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
-               if (!vk)
-                       return -ENOMEM;
+       if (!r) {
+               log_err(cd, _("Volume %s is not suspended."), name);
+               return -EINVAL;
+       }
 
-               r = PLAIN_activate(cd, name, vk, cd->u.plain.hdr.size, flags);
-       } else if (isLUKS(cd->type)) {
-               /* If key is not provided, try to use internal key */
-               if (!volume_key) {
-                       if (!cd->volume_key) {
-                               log_err(cd, _("Volume key does not match the volume.\n"));
-                               return -EINVAL;
-                       }
-                       volume_key_size = cd->volume_key->keylength;
-                       volume_key = cd->volume_key->key;
-               }
+       vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+       if (!vk)
+               return -ENOMEM;
 
-               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
-               if (!vk)
-                       return -ENOMEM;
+       if (isLUKS1(cd->type))
                r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
+       else if (isLUKS2(cd->type))
+               r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
+       else
+               r = -EINVAL;
+       if (r == -EPERM || r == -ENOENT)
+               log_err(cd, _("Volume key does not match the volume."));
+       if  (r < 0)
+               goto out;
+       r = 0;
 
-               if (r == -EPERM)
-                       log_err(cd, _("Volume key does not match the volume.\n"));
+       if (crypt_use_keyring_for_vk(cd)) {
+               r = LUKS2_key_description_by_segment(cd, &cd->u.luks2.hdr, vk, CRYPT_DEFAULT_SEGMENT);
+               if (!r)
+                       r = crypt_volume_key_load_in_keyring(cd, vk);
+       }
+       if  (r < 0)
+               goto out;
 
-               if (!r && name)
-                       r = LUKS1_activate(cd, name, vk, flags);
-       } else if (isVERITY(cd->type)) {
-               /* volume_key == root hash */
-               if (!volume_key || !volume_key_size) {
-                       log_err(cd, _("Incorrect root hash specified for verity device.\n"));
-                       return -EINVAL;
-               }
+       r = dm_resume_and_reinstate_key(cd, name, vk);
+       if (r < 0)
+               log_err(cd, _("Error during resuming device %s."), name);
+out:
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
+       crypt_free_volume_key(vk);
+       return r;
+}
 
-               r = VERITY_activate(cd, name, volume_key, volume_key_size,
-                                   &cd->u.verity.hdr, CRYPT_ACTIVATE_READONLY);
-
-               if (r == -EPERM) {
-                       free(cd->u.verity.root_hash);
-                       cd->u.verity.root_hash = NULL;
-               } if (!r) {
-                       cd->u.verity.root_hash_size = volume_key_size;
-                       if (!cd->u.verity.root_hash)
-                               cd->u.verity.root_hash = malloc(volume_key_size);
-                       if (cd->u.verity.root_hash)
-                               memcpy(cd->u.verity.root_hash, volume_key, volume_key_size);
+/*
+ * Keyslot manipulation
+ */
+int crypt_keyslot_add_by_passphrase(struct crypt_device *cd,
+       int keyslot, // -1 any
+       const char *passphrase,
+       size_t passphrase_size,
+       const char *new_passphrase,
+       size_t new_passphrase_size)
+{
+       int digest, r, active_slots;
+       struct luks2_keyslot_params params;
+       struct volume_key *vk = NULL;
+
+       log_dbg(cd, "Adding new keyslot, existing passphrase %sprovided,"
+               "new passphrase %sprovided.",
+               passphrase ? "" : "not ", new_passphrase  ? "" : "not ");
+
+       if ((r = onlyLUKS(cd)))
+               return r;
+
+       if (!passphrase || !new_passphrase)
+               return -EINVAL;
+
+       r = keyslot_verify_or_find_empty(cd, &keyslot);
+       if (r)
+               return r;
+
+       if (isLUKS1(cd->type))
+               active_slots = LUKS_keyslot_active_count(&cd->u.luks1.hdr);
+       else
+               active_slots = LUKS2_keyslot_active_count(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
+       if (active_slots == 0) {
+               /* No slots used, try to use pre-generated key in header */
+               if (cd->volume_key) {
+                       vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
+                       r = vk ? 0 : -ENOMEM;
+               } else {
+                       log_err(cd, _("Cannot add key slot, all slots disabled and no volume key provided."));
+                       return -EINVAL;
                }
-       } else if (isTCRYPT(cd->type)) {
-               if (!name)
-                       return 0;
+       } else if (active_slots < 0)
+               return -EINVAL;
+       else {
+               /* Passphrase provided, use it to unlock existing keyslot */
+               if (isLUKS1(cd->type))
+                       r = LUKS_open_key_with_hdr(CRYPT_ANY_SLOT, passphrase,
+                                                  passphrase_size, &cd->u.luks1.hdr, &vk, cd);
+               else
+                       r = LUKS2_keyslot_open(cd, CRYPT_ANY_SLOT, CRYPT_DEFAULT_SEGMENT, passphrase,
+                                               passphrase_size, &vk);
+       }
+
+       if (r < 0)
+               goto out;
+
+       if (isLUKS1(cd->type))
+               r = LUKS_set_key(keyslot, CONST_CAST(char*)new_passphrase,
+                                new_passphrase_size, &cd->u.luks1.hdr, vk, cd);
+       else {
+               r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
+               digest = r;
+
+               if (r >= 0)
+                       r = LUKS2_keyslot_params_default(cd, &cd->u.luks2.hdr, &params);
+
+               if (r >= 0)
+                       r = LUKS2_digest_assign(cd, &cd->u.luks2.hdr, keyslot, digest, 1, 0);
+
+               if (r >= 0)
+                       r = LUKS2_keyslot_store(cd,  &cd->u.luks2.hdr, keyslot,
+                                               CONST_CAST(char*)new_passphrase,
+                                               new_passphrase_size, vk, &params);
+       }
+
+       if (r < 0)
+               goto out;
+
+       r = 0;
+out:
+       crypt_free_volume_key(vk);
+       if (r < 0) {
+               _luks2_reload(cd);
+               return r;
+       }
+       return keyslot;
+}
+
+int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
+       int keyslot_old,
+       int keyslot_new,
+       const char *passphrase,
+       size_t passphrase_size,
+       const char *new_passphrase,
+       size_t new_passphrase_size)
+{
+       int digest = -1, r;
+       struct luks2_keyslot_params params;
+       struct volume_key *vk = NULL;
+
+       if (!passphrase || !new_passphrase)
+               return -EINVAL;
+
+       log_dbg(cd, "Changing passphrase from old keyslot %d to new %d.",
+               keyslot_old, keyslot_new);
+
+       if ((r = onlyLUKS(cd)))
+               return r;
+
+       if (isLUKS1(cd->type))
+               r = LUKS_open_key_with_hdr(keyslot_old, passphrase, passphrase_size,
+                                          &cd->u.luks1.hdr, &vk, cd);
+       else if (isLUKS2(cd->type)) {
+               r = LUKS2_keyslot_open(cd, keyslot_old, CRYPT_ANY_SEGMENT, passphrase, passphrase_size, &vk);
+               /* will fail for keyslots w/o digest. fix if supported in a future */
+               if (r >= 0) {
+                       digest = LUKS2_digest_by_keyslot(&cd->u.luks2.hdr, r);
+                       if (digest < 0)
+                               r = -EINVAL;
+               }
+       } else
+               r = -EINVAL;
+       if (r < 0)
+               goto out;
+
+       if (keyslot_old != CRYPT_ANY_SLOT && keyslot_old != r) {
+               log_dbg(cd, "Keyslot mismatch.");
+               goto out;
+       }
+       keyslot_old = r;
+
+       if (keyslot_new == CRYPT_ANY_SLOT) {
+               if (isLUKS1(cd->type))
+                       keyslot_new = LUKS_keyslot_find_empty(&cd->u.luks1.hdr);
+               else if (isLUKS2(cd->type))
+                       keyslot_new = LUKS2_keyslot_find_empty(&cd->u.luks2.hdr);
+               if (keyslot_new < 0)
+                       keyslot_new = keyslot_old;
+       }
+       log_dbg(cd, "Key change, old slot %d, new slot %d.", keyslot_old, keyslot_new);
+
+       if (isLUKS1(cd->type)) {
+               if (keyslot_old == keyslot_new) {
+                       log_dbg(cd, "Key slot %d is going to be overwritten.", keyslot_old);
+                       (void)crypt_keyslot_destroy(cd, keyslot_old);
+               }
+               r = LUKS_set_key(keyslot_new, new_passphrase, new_passphrase_size,
+                                &cd->u.luks1.hdr, vk, cd);
+       } else if (isLUKS2(cd->type)) {
+               r = LUKS2_keyslot_params_default(cd, &cd->u.luks2.hdr, &params);
+               if (r)
+                       goto out;
+
+               if (keyslot_old != keyslot_new) {
+                       r = LUKS2_digest_assign(cd, &cd->u.luks2.hdr, keyslot_new, digest, 1, 0);
+                       if (r < 0)
+                               goto out;
+               } else {
+                       log_dbg(cd, "Key slot %d is going to be overwritten.", keyslot_old);
+                       /* FIXME: improve return code so that we can detect area is damaged */
+                       r = LUKS2_keyslot_wipe(cd, &cd->u.luks2.hdr, keyslot_old, 1);
+                       if (r) {
+                               /* (void)crypt_keyslot_destroy(cd, keyslot_old); */
+                               r = -EINVAL;
+                               goto out;
+                       }
+               }
+
+               r = LUKS2_keyslot_store(cd,  &cd->u.luks2.hdr,
+                                       keyslot_new, new_passphrase,
+                                       new_passphrase_size, vk, &params);
+       } else
+               r = -EINVAL;
+
+       if (r >= 0 && keyslot_old != keyslot_new)
+               r = crypt_keyslot_destroy(cd, keyslot_old);
+
+       if (r < 0)
+               log_err(cd, _("Failed to swap new key slot."));
+out:
+       crypt_free_volume_key(vk);
+       if (r < 0) {
+               _luks2_reload(cd);
+               return r;
+       }
+       return keyslot_new;
+}
+
+int crypt_keyslot_add_by_keyfile_device_offset(struct crypt_device *cd,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       uint64_t keyfile_offset,
+       const char *new_keyfile,
+       size_t new_keyfile_size,
+       uint64_t new_keyfile_offset)
+{
+       int digest, r, active_slots;
+       size_t passwordLen, new_passwordLen;
+       struct luks2_keyslot_params params;
+       char *password = NULL, *new_password = NULL;
+       struct volume_key *vk = NULL;
+
+       if (!keyfile || !new_keyfile)
+               return -EINVAL;
+
+       log_dbg(cd, "Adding new keyslot, existing keyfile %s, new keyfile %s.",
+               keyfile, new_keyfile);
+
+       if ((r = onlyLUKS(cd)))
+               return r;
+
+       r = keyslot_verify_or_find_empty(cd, &keyslot);
+       if (r)
+               return r;
+
+       if (isLUKS1(cd->type))
+               active_slots = LUKS_keyslot_active_count(&cd->u.luks1.hdr);
+       else
+               active_slots = LUKS2_keyslot_active_count(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
+       if (active_slots == 0) {
+               /* No slots used, try to use pre-generated key in header */
+               if (cd->volume_key) {
+                       vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
+                       r = vk ? 0 : -ENOMEM;
+               } else {
+                       log_err(cd, _("Cannot add key slot, all slots disabled and no volume key provided."));
+                       return -EINVAL;
+               }
+       } else {
+               r = crypt_keyfile_device_read(cd, keyfile,
+                                      &password, &passwordLen,
+                                      keyfile_offset, keyfile_size, 0);
+               if (r < 0)
+                       goto out;
+
+               if (isLUKS1(cd->type))
+                       r = LUKS_open_key_with_hdr(CRYPT_ANY_SLOT, password, passwordLen,
+                                                  &cd->u.luks1.hdr, &vk, cd);
+               else
+                       r = LUKS2_keyslot_open(cd, CRYPT_ANY_SLOT, CRYPT_DEFAULT_SEGMENT, password, passwordLen, &vk);
+       }
+
+       if (r < 0)
+               goto out;
+
+       r = crypt_keyfile_device_read(cd, new_keyfile,
+                              &new_password, &new_passwordLen,
+                              new_keyfile_offset, new_keyfile_size, 0);
+       if (r < 0)
+               goto out;
+
+       if (isLUKS1(cd->type))
+               r = LUKS_set_key(keyslot, new_password, new_passwordLen,
+                                &cd->u.luks1.hdr, vk, cd);
+       else {
+               r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
+               digest = r;
+
+               if (r >= 0)
+                       r = LUKS2_keyslot_params_default(cd, &cd->u.luks2.hdr, &params);
+
+               if (r >= 0)
+                       r = LUKS2_digest_assign(cd, &cd->u.luks2.hdr, keyslot, digest, 1, 0);
+
+               if (r >= 0)
+                       r = LUKS2_keyslot_store(cd,  &cd->u.luks2.hdr, keyslot,
+                                               new_password, new_passwordLen, vk, &params);
+       }
+out:
+       crypt_safe_free(password);
+       crypt_safe_free(new_password);
+       crypt_free_volume_key(vk);
+       if (r < 0) {
+               _luks2_reload(cd);
+               return r;
+       }
+       return keyslot;
+}
+
+int crypt_keyslot_add_by_keyfile(struct crypt_device *cd,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       const char *new_keyfile,
+       size_t new_keyfile_size)
+{
+       return crypt_keyslot_add_by_keyfile_device_offset(cd, keyslot,
+                               keyfile, keyfile_size, 0,
+                               new_keyfile, new_keyfile_size, 0);
+}
+
+int crypt_keyslot_add_by_keyfile_offset(struct crypt_device *cd,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       size_t keyfile_offset,
+       const char *new_keyfile,
+       size_t new_keyfile_size,
+       size_t new_keyfile_offset)
+{
+       return crypt_keyslot_add_by_keyfile_device_offset(cd, keyslot,
+                               keyfile, keyfile_size, keyfile_offset,
+                               new_keyfile, new_keyfile_size, new_keyfile_offset);
+}
+
+int crypt_keyslot_add_by_volume_key(struct crypt_device *cd,
+       int keyslot,
+       const char *volume_key,
+       size_t volume_key_size,
+       const char *passphrase,
+       size_t passphrase_size)
+{
+       struct volume_key *vk = NULL;
+       int r;
+
+       if (!passphrase)
+               return -EINVAL;
+
+       log_dbg(cd, "Adding new keyslot %d using volume key.", keyslot);
+
+       if ((r = onlyLUKS(cd)))
+               return r;
+
+       if (isLUKS2(cd->type))
+               return crypt_keyslot_add_by_key(cd, keyslot,
+                               volume_key, volume_key_size, passphrase,
+                               passphrase_size, 0);
+
+       r = keyslot_verify_or_find_empty(cd, &keyslot);
+       if (r < 0)
+               return r;
+
+       if (volume_key)
+               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+       else if (cd->volume_key)
+               vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
+
+       if (!vk)
+               return -ENOMEM;
+
+       r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
+       if (r < 0)
+               log_err(cd, _("Volume key does not match the volume."));
+       else
+               r = LUKS_set_key(keyslot, passphrase, passphrase_size,
+                       &cd->u.luks1.hdr, vk, cd);
+
+       crypt_free_volume_key(vk);
+       return (r < 0) ? r : keyslot;
+}
+
+int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot)
+{
+       crypt_keyslot_info ki;
+       int r;
+
+       log_dbg(cd, "Destroying keyslot %d.", keyslot);
+
+       if ((r = _onlyLUKS(cd, CRYPT_CD_UNRESTRICTED)))
+               return r;
+
+       ki = crypt_keyslot_status(cd, keyslot);
+       if (ki == CRYPT_SLOT_INVALID) {
+               log_err(cd, _("Key slot %d is invalid."), keyslot);
+               return -EINVAL;
+       }
+
+       if (isLUKS1(cd->type)) {
+               if (ki == CRYPT_SLOT_INACTIVE) {
+                       log_err(cd, _("Keyslot %d is not active."), keyslot);
+                       return -EINVAL;
+               }
+               return LUKS_del_key(keyslot, &cd->u.luks1.hdr, cd);
+       }
+
+       return LUKS2_keyslot_wipe(cd, &cd->u.luks2.hdr, keyslot, 0);
+}
+
+static int _check_header_data_overlap(struct crypt_device *cd, const char *name)
+{
+       if (!name || !isLUKS(cd->type))
+               return 0;
+
+       if (!device_is_identical(crypt_data_device(cd), crypt_metadata_device(cd)))
+               return 0;
+
+       /* FIXME: check real header size */
+       if (crypt_get_data_offset(cd) == 0) {
+               log_err(cd, _("Device header overlaps with data area."));
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int check_devices(struct crypt_device *cd, const char *name, const char *iname, uint32_t *flags)
+{
+       int r;
+
+       if (!flags || !name)
+               return -EINVAL;
+
+       if (iname) {
+               r = dm_status_device(cd, iname);
+               if (r >= 0 && !(*flags & CRYPT_ACTIVATE_REFRESH))
+                       return -EBUSY;
+               if (r < 0 && r != -ENODEV)
+                       return r;
+               if (r == -ENODEV)
+                       *flags &= ~CRYPT_ACTIVATE_REFRESH;
+       }
+
+       r = dm_status_device(cd, name);
+       if (r >= 0 && !(*flags & CRYPT_ACTIVATE_REFRESH))
+               return -EBUSY;
+       if (r < 0 && r != -ENODEV)
+               return r;
+       if (r == -ENODEV)
+               *flags &= ~CRYPT_ACTIVATE_REFRESH;
+
+       return 0;
+}
+
+static int _create_device_with_integrity(struct crypt_device *cd,
+       const char *type, const char *name, const char *iname,
+       const char *ipath, struct crypt_dm_active_device *dmd,
+       struct crypt_dm_active_device *dmdi)
+{
+       int r;
+       enum devcheck device_check;
+       struct dm_target *tgt;
+       struct device *device = NULL;
+
+       if (!single_segment(dmd))
+               return -EINVAL;
+
+       tgt = &dmd->segment;
+       if (tgt->type != DM_CRYPT)
+               return -EINVAL;
+
+       device_check = dmd->flags & CRYPT_ACTIVATE_SHARED ? DEV_OK : DEV_EXCL;
+
+       r = INTEGRITY_activate_dmd_device(cd, iname, CRYPT_INTEGRITY, dmdi, 0);
+       if (r)
+               return r;
+
+       r = device_alloc(cd, &device, ipath);
+       if (r < 0)
+               goto out;
+       tgt->data_device = device;
+
+       r = device_block_adjust(cd, tgt->data_device, device_check,
+                               tgt->u.crypt.offset, &dmd->size, &dmd->flags);
+
+       if (!r)
+               r = dm_create_device(cd, name, type, dmd);
+out:
+       if (r < 0)
+               dm_remove_device(cd, iname, 0);
+
+       device_free(cd, device);
+       return r;
+}
+
+static int kernel_keyring_support(void)
+{
+       static unsigned _checked = 0;
+
+       if (!_checked) {
+               _kernel_keyring_supported = keyring_check();
+               _checked = 1;
+       }
+
+       return _kernel_keyring_supported;
+}
+
+static int dmcrypt_keyring_bug(void)
+{
+       uint64_t kversion;
+
+       if (kernel_version(&kversion))
+               return 1;
+       return kversion < version(4,15,0,0);
+}
+
+int create_or_reload_device(struct crypt_device *cd, const char *name,
+                    const char *type, struct crypt_dm_active_device *dmd)
+{
+       int r;
+       enum devcheck device_check;
+       struct dm_target *tgt;
+
+       if (!type || !name || !single_segment(dmd))
+               return -EINVAL;
+
+       tgt = &dmd->segment;
+       if (tgt->type != DM_CRYPT)
+               return -EINVAL;
+
+       /* drop CRYPT_ACTIVATE_REFRESH flag if any device is inactive */
+       r = check_devices(cd, name, NULL, &dmd->flags);
+       if (r)
+               return r;
+
+       if (dmd->flags & CRYPT_ACTIVATE_REFRESH)
+               r = _reload_device(cd, name, dmd);
+       else {
+               device_check = dmd->flags & CRYPT_ACTIVATE_SHARED ? DEV_OK : DEV_EXCL;
+
+               r = device_block_adjust(cd, tgt->data_device, device_check,
+                                       tgt->u.crypt.offset, &dmd->size, &dmd->flags);
+               if (!r) {
+                       tgt->size = dmd->size;
+                       r = dm_create_device(cd, name, type, dmd);
+               }
+       }
+
+       return r;
+}
+
+int create_or_reload_device_with_integrity(struct crypt_device *cd, const char *name,
+                    const char *type, struct crypt_dm_active_device *dmd,
+                    struct crypt_dm_active_device *dmdi)
+{
+       int r;
+       const char *iname = NULL;
+       char *ipath = NULL;
+
+       if (!type || !name || !dmd || !dmdi)
+               return -EINVAL;
+
+       if (asprintf(&ipath, "%s/%s_dif", dm_get_dir(), name) < 0)
+               return -ENOMEM;
+       iname = ipath + strlen(dm_get_dir()) + 1;
+
+       /* drop CRYPT_ACTIVATE_REFRESH flag if any device is inactive */
+       r = check_devices(cd, name, iname, &dmd->flags);
+       if (r)
+               goto out;
+
+       if (dmd->flags & CRYPT_ACTIVATE_REFRESH)
+               r = _reload_device_with_integrity(cd, name, iname, ipath, dmd, dmdi);
+       else
+               r = _create_device_with_integrity(cd, type, name, iname, ipath, dmd, dmdi);
+out:
+       free(ipath);
+
+       return r;
+}
+
+static int load_all_keys(struct crypt_device *cd, struct luks2_hdr *hdr, struct volume_key *vks)
+{
+       int r;
+       struct volume_key *vk = vks;
+
+       while (vk) {
+               r = LUKS2_volume_key_load_in_keyring_by_digest(cd, hdr, vk, crypt_volume_key_get_id(vk));
+               if (r < 0)
+                       return r;
+               vk = crypt_volume_key_next(vk);
+       }
+
+       return 0;
+}
+
+/* See fixmes in _open_and_activate_luks2 */
+int update_reencryption_flag(struct crypt_device *cd, int enable, bool commit);
+
+/* TODO: This function should 1:1 with pre-reencryption code */
+static int _open_and_activate(struct crypt_device *cd,
+       int keyslot,
+       const char *name,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags)
+{
+       int r;
+       struct volume_key *vk = NULL;
+
+       r = LUKS2_keyslot_open(cd, keyslot,
+                              (flags & CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY) ?
+                              CRYPT_ANY_SEGMENT : CRYPT_DEFAULT_SEGMENT,
+                              passphrase, passphrase_size, &vk);
+       if (r < 0)
+               return r;
+       keyslot = r;
+
+       if ((name || (flags & CRYPT_ACTIVATE_KEYRING_KEY)) &&
+           crypt_use_keyring_for_vk(cd)) {
+               r = LUKS2_volume_key_load_in_keyring_by_keyslot(cd,
+                               &cd->u.luks2.hdr, vk, keyslot);
+               if (r < 0)
+                       goto out;
+               flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+       }
+
+       if (name)
+               r = LUKS2_activate(cd, name, vk, flags);
+out:
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
+       crypt_free_volume_key(vk);
+
+       return r < 0 ? r : keyslot;
+}
+
+static int _open_all_keys(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags,
+       struct volume_key **vks)
+{
+       int r, segment;
+       struct volume_key *_vks = NULL;
+       crypt_reencrypt_info ri = LUKS2_reenc_status(hdr);
+
+       segment = (flags & CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY) ? CRYPT_ANY_SEGMENT : CRYPT_DEFAULT_SEGMENT;
+
+       switch (ri) {
+       case CRYPT_REENCRYPT_NONE:
+               r = LUKS2_keyslot_open(cd, keyslot, segment, passphrase, passphrase_size, &_vks);
+               break;
+       case CRYPT_REENCRYPT_CLEAN:
+       case CRYPT_REENCRYPT_CRASH:
+               if (segment == CRYPT_ANY_SEGMENT)
+                       r = LUKS2_keyslot_open(cd, keyslot, segment, passphrase,
+                                              passphrase_size, &_vks);
+               else
+                       r = LUKS2_keyslot_open_all_segments(cd, keyslot,
+                                       keyslot, passphrase, passphrase_size,
+                                       &_vks);
+               break;
+       default:
+               r = -EINVAL;
+       }
+
+       if (keyslot == CRYPT_ANY_SLOT)
+               keyslot = r;
+
+       if (r >= 0 && (flags & CRYPT_ACTIVATE_KEYRING_KEY))
+               r = load_all_keys(cd, hdr, _vks);
+
+       if (r >= 0 && vks)
+               MOVE_REF(*vks, _vks);
+
+       if (r < 0)
+               crypt_drop_keyring_key(cd, _vks);
+       crypt_free_volume_key(_vks);
+
+       return r < 0 ? r : keyslot;
+}
+
+static int _open_and_activate_reencrypt_device(struct crypt_device *cd,
+       struct luks2_hdr *hdr,
+       int keyslot,
+       const char *name,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags)
+{
+       bool dynamic_size;
+       crypt_reencrypt_info ri;
+       uint64_t minimal_size, device_size;
+       struct volume_key *vks = NULL;
+       int r = 0;
+       struct crypt_lock_handle *reencrypt_lock = NULL;
+
+       if (crypt_use_keyring_for_vk(cd))
+               flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+
+       r = crypt_reencrypt_lock(cd, &reencrypt_lock);
+       if (r) {
+               if (r == -EBUSY)
+                       log_err(cd, _("Reencryption in-progress. Cannot activate device."));
+               else
+                       log_err(cd, _("Failed to get reencryption lock."));
+               return r;
+       }
+
+       if ((r = crypt_load(cd, CRYPT_LUKS2, NULL)))
+               goto err;
+
+       ri = LUKS2_reenc_status(hdr);
+
+       if (ri == CRYPT_REENCRYPT_CRASH) {
+               r = LUKS2_reencrypt_locked_recovery_by_passphrase(cd, keyslot,
+                               keyslot, passphrase, passphrase_size, flags, &vks);
+               if (r < 0) {
+                       log_err(cd, _("LUKS2 reencryption recovery failed."));
+                       goto err;
+               }
+               keyslot = r;
+
+               ri = LUKS2_reenc_status(hdr);
+       }
+
+       /* recovery finished reencryption or it's already finished */
+       if (ri == CRYPT_REENCRYPT_NONE) {
+               crypt_drop_keyring_key(cd, vks);
+               crypt_free_volume_key(vks);
+               crypt_reencrypt_unlock(cd, reencrypt_lock);
+               return _open_and_activate(cd, keyslot, name, passphrase, passphrase_size, flags);
+       }
+
+       if (ri > CRYPT_REENCRYPT_CLEAN) {
+               r = -EINVAL;
+               goto err;
+       }
+
+       if (LUKS2_get_data_size(hdr, &minimal_size, &dynamic_size))
+               goto err;
+
+       if (!vks) {
+               r = _open_all_keys(cd, hdr, keyslot, passphrase, passphrase_size, flags, &vks);
+               if (r >= 0)
+                       keyslot = r;
+       }
+
+       log_dbg(cd, "Entering clean reencryption state mode.");
+
+       if (r >= 0)
+               r = luks2_check_device_size(cd, hdr, minimal_size, &device_size, true, dynamic_size);
+
+       if (r >= 0)
+               r = LUKS2_activate_multi(cd, name, vks, device_size >> SECTOR_SHIFT, flags);
+err:
+       crypt_reencrypt_unlock(cd, reencrypt_lock);
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vks);
+       crypt_free_volume_key(vks);
+
+       return r < 0 ? r : keyslot;
+}
+
+/*
+ * Activation/deactivation of a device
+ */
+static int _open_and_activate_luks2(struct crypt_device *cd,
+       int keyslot,
+       const char *name,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags)
+{
+       crypt_reencrypt_info ri;
+       int r;
+       struct luks2_hdr *hdr = &cd->u.luks2.hdr;
+
+       ri = LUKS2_reenc_status(hdr);
+       if (ri == CRYPT_REENCRYPT_INVALID)
+               return -EINVAL;
+
+       if (ri > CRYPT_REENCRYPT_NONE) {
+               if (name)
+                       r = _open_and_activate_reencrypt_device(cd, hdr, keyslot, name, passphrase,
+                                       passphrase_size, flags);
+               else
+                       r = _open_all_keys(cd, hdr, keyslot, passphrase,
+                                          passphrase_size, flags, NULL);
+       } else
+               r = _open_and_activate(cd, keyslot, name, passphrase,
+                               passphrase_size, flags);
+
+       return r;
+}
+
+static int _activate_by_passphrase(struct crypt_device *cd,
+       const char *name,
+       int keyslot,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags)
+{
+       int r;
+       struct volume_key *vk = NULL;
+
+       if ((flags & CRYPT_ACTIVATE_KEYRING_KEY) && !crypt_use_keyring_for_vk(cd))
+               return -EINVAL;
+
+       if ((flags & CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY) && name)
+               return -EINVAL;
+
+       r = _check_header_data_overlap(cd, name);
+       if (r < 0)
+               return r;
+
+       if (flags & CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF)
+               cd->memory_hard_pbkdf_lock_enabled = true;
+
+       /* plain, use hashed passphrase */
+       if (isPLAIN(cd->type)) {
+               r = -EINVAL;
+               if (!name)
+                       goto out;
+
+               r = process_key(cd, cd->u.plain.hdr.hash,
+                               cd->u.plain.key_size,
+                               passphrase, passphrase_size, &vk);
+               if (r < 0)
+                       goto out;
+
+               r = PLAIN_activate(cd, name, vk, cd->u.plain.hdr.size, flags);
+               keyslot = 0;
+       } else if (isLUKS1(cd->type)) {
+               r = LUKS_open_key_with_hdr(keyslot, passphrase,
+                                          passphrase_size, &cd->u.luks1.hdr, &vk, cd);
+               if (r >= 0) {
+                       keyslot = r;
+                       if (name)
+                               r = LUKS1_activate(cd, name, vk, flags);
+               }
+       } else if (isLUKS2(cd->type)) {
+               r = _open_and_activate_luks2(cd, keyslot, name, passphrase, passphrase_size, flags);
+               keyslot = r;
+       } else if (isBITLK(cd->type)) {
+               r = BITLK_activate(cd, name, passphrase, passphrase_size,
+                                  &cd->u.bitlk.params, flags);
+               keyslot = 0;
+       } else {
+               log_err(cd, _("Device type is not properly initialized."));
+               r = -EINVAL;
+       }
+out:
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
+       crypt_free_volume_key(vk);
+
+       cd->memory_hard_pbkdf_lock_enabled = false;
+
+       return r < 0 ? r : keyslot;
+}
+
+static int _activate_loopaes(struct crypt_device *cd,
+       const char *name,
+       char *buffer,
+       size_t buffer_size,
+       uint32_t flags)
+{
+       int r;
+       unsigned int key_count = 0;
+       struct volume_key *vk = NULL;
+
+       r = LOOPAES_parse_keyfile(cd, &vk, cd->u.loopaes.hdr.hash, &key_count,
+                                 buffer, buffer_size);
+
+       if (!r && name)
+               r = LOOPAES_activate(cd, name, cd->u.loopaes.cipher, key_count,
+                                    vk, flags);
+
+       crypt_free_volume_key(vk);
+
+       return r;
+}
+
+static int _activate_check_status(struct crypt_device *cd, const char *name, unsigned reload)
+{
+       crypt_status_info ci;
+
+       if (!name)
+               return 0;
+
+       ci = crypt_status(cd, name);
+       if (ci == CRYPT_INVALID) {
+               log_err(cd, _("Cannot use device %s, name is invalid or still in use."), name);
+               return -EINVAL;
+       } else if (ci >= CRYPT_ACTIVE && !reload) {
+               log_err(cd, _("Device %s already exists."), name);
+               return -EEXIST;
+       }
+
+       return 0;
+}
+
+// activation/deactivation of device mapping
+int crypt_activate_by_passphrase(struct crypt_device *cd,
+       const char *name,
+       int keyslot,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags)
+{
+       int r;
+
+       if (!cd || !passphrase || (!name && (flags & CRYPT_ACTIVATE_REFRESH)))
+               return -EINVAL;
+
+       log_dbg(cd, "%s volume %s [keyslot %d] using passphrase.",
+               name ? "Activating" : "Checking", name ?: "passphrase",
+               keyslot);
+
+       r = _activate_check_status(cd, name, flags & CRYPT_ACTIVATE_REFRESH);
+       if (r < 0)
+               return r;
+
+       return _activate_by_passphrase(cd, name, keyslot, passphrase, passphrase_size, flags);
+}
+
+int crypt_activate_by_keyfile_device_offset(struct crypt_device *cd,
+       const char *name,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       uint64_t keyfile_offset,
+       uint32_t flags)
+{
+       char *passphrase_read = NULL;
+       size_t passphrase_size_read;
+       int r;
+
+       if (!cd || !keyfile ||
+           ((flags & CRYPT_ACTIVATE_KEYRING_KEY) && !crypt_use_keyring_for_vk(cd)))
+               return -EINVAL;
+
+       log_dbg(cd, "%s volume %s [keyslot %d] using keyfile %s.",
+               name ? "Activating" : "Checking", name ?: "passphrase", keyslot, keyfile);
+
+       r = _activate_check_status(cd, name, flags & CRYPT_ACTIVATE_REFRESH);
+       if (r < 0)
+               return r;
+
+       r = crypt_keyfile_device_read(cd, keyfile,
+                               &passphrase_read, &passphrase_size_read,
+                               keyfile_offset, keyfile_size, 0);
+       if (r < 0)
+               goto out;
+
+       if (isLOOPAES(cd->type))
+               r = _activate_loopaes(cd, name, passphrase_read, passphrase_size_read, flags);
+       else
+               r = _activate_by_passphrase(cd, name, keyslot, passphrase_read, passphrase_size_read, flags);
+
+out:
+       crypt_safe_free(passphrase_read);
+       return r;
+}
+
+int crypt_activate_by_keyfile(struct crypt_device *cd,
+       const char *name,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       uint32_t flags)
+{
+       return crypt_activate_by_keyfile_device_offset(cd, name, keyslot, keyfile,
+                                       keyfile_size, 0, flags);
+}
+
+int crypt_activate_by_keyfile_offset(struct crypt_device *cd,
+       const char *name,
+       int keyslot,
+       const char *keyfile,
+       size_t keyfile_size,
+       size_t keyfile_offset,
+       uint32_t flags)
+{
+       return crypt_activate_by_keyfile_device_offset(cd, name, keyslot, keyfile,
+                                       keyfile_size, keyfile_offset, flags);
+}
+int crypt_activate_by_volume_key(struct crypt_device *cd,
+       const char *name,
+       const char *volume_key,
+       size_t volume_key_size,
+       uint32_t flags)
+{
+       struct volume_key *vk = NULL;
+       int r;
+
+       if (!cd ||
+           ((flags & CRYPT_ACTIVATE_KEYRING_KEY) && !crypt_use_keyring_for_vk(cd)))
+               return -EINVAL;
+
+       log_dbg(cd, "%s volume %s by volume key.", name ? "Activating" : "Checking",
+               name ?: "");
+
+       r = _activate_check_status(cd, name, flags & CRYPT_ACTIVATE_REFRESH);
+       if (r < 0)
+               return r;
+
+       r = _check_header_data_overlap(cd, name);
+       if (r < 0)
+               return r;
+
+       /* use key directly, no hash */
+       if (isPLAIN(cd->type)) {
+               if (!name)
+                       return -EINVAL;
+
+               if (!volume_key || !volume_key_size || volume_key_size != cd->u.plain.key_size) {
+                       log_err(cd, _("Incorrect volume key specified for plain device."));
+                       return -EINVAL;
+               }
+
+               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+               if (!vk)
+                       return -ENOMEM;
+
+               r = PLAIN_activate(cd, name, vk, cd->u.plain.hdr.size, flags);
+       } else if (isLUKS1(cd->type)) {
+               /* If key is not provided, try to use internal key */
+               if (!volume_key) {
+                       if (!cd->volume_key) {
+                               log_err(cd, _("Volume key does not match the volume."));
+                               return -EINVAL;
+                       }
+                       volume_key_size = cd->volume_key->keylength;
+                       volume_key = cd->volume_key->key;
+               }
+
+               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+               if (!vk)
+                       return -ENOMEM;
+               r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
+
+               if (r == -EPERM)
+                       log_err(cd, _("Volume key does not match the volume."));
+
+               if (!r && name)
+                       r = LUKS1_activate(cd, name, vk, flags);
+       } else if (isLUKS2(cd->type)) {
+               /* If key is not provided, try to use internal key */
+               if (!volume_key) {
+                       if (!cd->volume_key) {
+                               log_err(cd, _("Volume key does not match the volume."));
+                               return -EINVAL;
+                       }
+                       volume_key_size = cd->volume_key->keylength;
+                       volume_key = cd->volume_key->key;
+               }
+
+               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+               if (!vk)
+                       return -ENOMEM;
+
+               r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
+               if (r == -EPERM || r == -ENOENT)
+                       log_err(cd, _("Volume key does not match the volume."));
+               if (r > 0)
+                       r = 0;
+
+               if (!r && (name || (flags & CRYPT_ACTIVATE_KEYRING_KEY)) &&
+                   crypt_use_keyring_for_vk(cd)) {
+                       r = LUKS2_key_description_by_segment(cd,
+                               &cd->u.luks2.hdr, vk, CRYPT_DEFAULT_SEGMENT);
+                       if (!r)
+                               r = crypt_volume_key_load_in_keyring(cd, vk);
+                       if (!r)
+                               flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+               }
+
+               if (!r && name)
+                       r = LUKS2_activate(cd, name, vk, flags);
+       } else if (isVERITY(cd->type)) {
+               r = crypt_activate_by_signed_key(cd, name, volume_key, volume_key_size, NULL, 0, flags);
+       } else if (isTCRYPT(cd->type)) {
+               if (!name)
+                       return 0;
                r = TCRYPT_activate(cd, name, &cd->u.tcrypt.hdr,
                                    &cd->u.tcrypt.params, flags);
+       } else if (isINTEGRITY(cd->type)) {
+               if (!name)
+                       return 0;
+               if (volume_key) {
+                       vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+                       if (!vk)
+                               return -ENOMEM;
+               }
+               r = INTEGRITY_activate(cd, name, &cd->u.integrity.params, vk,
+                                      cd->u.integrity.journal_crypt_key,
+                                      cd->u.integrity.journal_mac_key, flags,
+                                      cd->u.integrity.sb_flags);
+       } else {
+               log_err(cd, _("Device type is not properly initialized."));
+               r = -EINVAL;
+       }
+
+       if (r < 0)
+               crypt_drop_keyring_key(cd, vk);
+       crypt_free_volume_key(vk);
+
+       return r;
+}
+
+int crypt_activate_by_signed_key(struct crypt_device *cd,
+       const char *name,
+       const char *volume_key,
+       size_t volume_key_size,
+       const char *signature,
+       size_t signature_size,
+       uint32_t flags)
+{
+       char description[512];
+       int r;
+
+       if (!cd || !isVERITY(cd->type))
+               return -EINVAL;
+
+       if (!volume_key || !volume_key_size || (!name && signature)) {
+               log_err(cd, _("Incorrect root hash specified for verity device."));
+               return -EINVAL;
+       }
+
+       log_dbg(cd, "%s volume %s by signed key.", name ? "Activating" : "Checking", name ?: "");
+
+       if (cd->u.verity.hdr.flags & CRYPT_VERITY_ROOT_HASH_SIGNATURE && !signature) {
+               log_err(cd, _("Root hash signature required."));
+               return -EINVAL;
+       }
+
+       r = _activate_check_status(cd, name, flags & CRYPT_ACTIVATE_REFRESH);
+       if (r < 0)
+               return r;
+
+       if (signature && !kernel_keyring_support()) {
+               log_err(cd, _("Kernel keyring missing: required for passing signature to kernel."));
+               return -EINVAL;
+       }
+
+       /* volume_key == root hash */
+       free(CONST_CAST(void*)cd->u.verity.root_hash);
+       cd->u.verity.root_hash = NULL;
+
+       if (signature) {
+               r = snprintf(description, sizeof(description)-1, "cryptsetup:%s%s%s",
+                            crypt_get_uuid(cd) ?: "", crypt_get_uuid(cd) ? "-" : "", name);
+               if (r < 0)
+                       return -EINVAL;
+
+               log_dbg(cd, "Adding signature into keyring %s", description);
+               r = keyring_add_key_in_thread_keyring(USER_KEY, description, signature, signature_size);
+               if (r) {
+                       log_err(cd, _("Failed to load key in kernel keyring."));
+                       return r;
+               }
+       }
+
+       r = VERITY_activate(cd, name, volume_key, volume_key_size,
+                           signature ? description : NULL,
+                           cd->u.verity.fec_device,
+                           &cd->u.verity.hdr, flags | CRYPT_ACTIVATE_READONLY);
+
+       if (!r) {
+               cd->u.verity.root_hash_size = volume_key_size;
+               cd->u.verity.root_hash = malloc(volume_key_size);
+               if (cd->u.verity.root_hash)
+                       memcpy(CONST_CAST(void*)cd->u.verity.root_hash, volume_key, volume_key_size);
+       }
+
+       if (signature)
+               crypt_drop_keyring_key_by_description(cd, description, USER_KEY);
+
+       return r;
+}
+
+int crypt_deactivate_by_name(struct crypt_device *cd, const char *name, uint32_t flags)
+{
+       struct crypt_device *fake_cd = NULL;
+       struct luks2_hdr *hdr2 = NULL;
+       struct crypt_dm_active_device dmd = {};
+       int r;
+       uint32_t get_flags = DM_ACTIVE_DEVICE | DM_ACTIVE_UUID | DM_ACTIVE_HOLDERS;
+
+       if (!name)
+               return -EINVAL;
+
+       log_dbg(cd, "Deactivating volume %s.", name);
+
+       if (!cd) {
+               r = crypt_init_by_name(&fake_cd, name);
+               if (r < 0)
+                       return r;
+               cd = fake_cd;
+       }
+
+       /* skip holders detection and early abort when some flags raised */
+       if (flags & (CRYPT_DEACTIVATE_FORCE | CRYPT_DEACTIVATE_DEFERRED))
+               get_flags &= ~DM_ACTIVE_HOLDERS;
+
+       switch (crypt_status(cd, name)) {
+               case CRYPT_ACTIVE:
+               case CRYPT_BUSY:
+                       r = dm_query_device(cd, name, get_flags, &dmd);
+                       if (r >= 0) {
+                               if (dmd.holders) {
+                                       log_err(cd, _("Device %s is still in use."), name);
+                                       r = -EBUSY;
+                                       break;
+                               }
+                       }
+
+                       if (isLUKS2(cd->type))
+                               hdr2 = crypt_get_hdr(cd, CRYPT_LUKS2);
+
+                       if ((dmd.uuid && !strncmp(CRYPT_LUKS2, dmd.uuid, sizeof(CRYPT_LUKS2)-1)) || hdr2)
+                               r = LUKS2_deactivate(cd, name, hdr2, &dmd, flags);
+                       else if (isTCRYPT(cd->type))
+                               r = TCRYPT_deactivate(cd, name, flags);
+                       else
+                               r = dm_remove_device(cd, name, flags);
+                       if (r < 0 && crypt_status(cd, name) == CRYPT_BUSY) {
+                               log_err(cd, _("Device %s is still in use."), name);
+                               r = -EBUSY;
+                       }
+                       break;
+               case CRYPT_INACTIVE:
+                       log_err(cd, _("Device %s is not active."), name);
+                       r = -ENODEV;
+                       break;
+               default:
+                       log_err(cd, _("Invalid device %s."), name);
+                       r = -EINVAL;
+       }
+
+       dm_targets_free(cd, &dmd);
+       free(CONST_CAST(void*)dmd.uuid);
+       crypt_free(fake_cd);
+
+       return r;
+}
+
+int crypt_deactivate(struct crypt_device *cd, const char *name)
+{
+       return crypt_deactivate_by_name(cd, name, 0);
+}
+
+int crypt_get_active_device(struct crypt_device *cd, const char *name,
+                           struct crypt_active_device *cad)
+{
+       int r;
+       struct crypt_dm_active_device dmd, dmdi = {};
+       const char *namei = NULL;
+       struct dm_target *tgt = &dmd.segment;
+       uint64_t min_offset = UINT64_MAX;
+
+       if (!cd || !name || !cad)
+               return -EINVAL;
+
+       r = dm_query_device(cd, name, DM_ACTIVE_DEVICE, &dmd);
+       if (r < 0)
+               return r;
+
+       /* For LUKS2 with integrity we need flags from underlying dm-integrity */
+       if (isLUKS2(cd->type) && crypt_get_integrity_tag_size(cd) && single_segment(&dmd)) {
+               namei = device_dm_name(tgt->data_device);
+               if (namei && dm_query_device(cd, namei, 0, &dmdi) >= 0)
+                       dmd.flags |= dmdi.flags;
+       }
+
+       if (cd && isTCRYPT(cd->type)) {
+               cad->offset     = TCRYPT_get_data_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+               cad->iv_offset  = TCRYPT_get_iv_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+       } else {
+               while (tgt) {
+                       if (tgt->type == DM_CRYPT && (min_offset > tgt->u.crypt.offset)) {
+                               min_offset = tgt->u.crypt.offset;
+                               cad->iv_offset = tgt->u.crypt.iv_offset;
+                       } else if (tgt->type == DM_INTEGRITY && (min_offset > tgt->u.integrity.offset)) {
+                               min_offset = tgt->u.integrity.offset;
+                               cad->iv_offset = 0;
+                       } else if (tgt->type == DM_LINEAR && (min_offset > tgt->u.linear.offset)) {
+                               min_offset = tgt->u.linear.offset;
+                               cad->iv_offset = 0;
+                       }
+                       tgt = tgt->next;
+               }
+       }
+
+       if (min_offset != UINT64_MAX)
+               cad->offset = min_offset;
+
+       cad->size       = dmd.size;
+       cad->flags      = dmd.flags;
+
+       r = 0;
+       dm_targets_free(cd, &dmd);
+       dm_targets_free(cd, &dmdi);
+
+       return r;
+}
+
+uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd, const char *name)
+{
+       struct crypt_dm_active_device dmd;
+       uint64_t failures = 0;
+
+       if (!name)
+               return 0;
+
+       /* FIXME: LUKS2 / dm-crypt does not provide this count. */
+       if (dm_query_device(cd, name, 0, &dmd) < 0)
+               return 0;
+
+       if (single_segment(&dmd) && dmd.segment.type == DM_INTEGRITY)
+               (void)dm_status_integrity_failures(cd, name, &failures);
+
+       dm_targets_free(cd, &dmd);
+
+       return failures;
+}
+
+/*
+ * Volume key handling
+ */
+int crypt_volume_key_get(struct crypt_device *cd,
+       int keyslot,
+       char *volume_key,
+       size_t *volume_key_size,
+       const char *passphrase,
+       size_t passphrase_size)
+{
+       struct volume_key *vk = NULL;
+       int key_len, r = -EINVAL;
+
+       if (!cd || !volume_key || !volume_key_size || (!isTCRYPT(cd->type) && !isVERITY(cd->type) && !passphrase))
+               return -EINVAL;
+
+       if (isLUKS2(cd->type) && keyslot != CRYPT_ANY_SLOT)
+               key_len = LUKS2_get_keyslot_stored_key_size(&cd->u.luks2.hdr, keyslot);
+       else
+               key_len = crypt_get_volume_key_size(cd);
+
+       if (key_len < 0)
+               return -EINVAL;
+
+       if (key_len > (int)*volume_key_size) {
+               log_err(cd, _("Volume key buffer too small."));
+               return -ENOMEM;
+       }
+
+       if (isPLAIN(cd->type) && cd->u.plain.hdr.hash) {
+               r = process_key(cd, cd->u.plain.hdr.hash, key_len,
+                               passphrase, passphrase_size, &vk);
+               if (r < 0)
+                       log_err(cd, _("Cannot retrieve volume key for plain device."));
+       } else if (isLUKS1(cd->type)) {
+               r = LUKS_open_key_with_hdr(keyslot, passphrase,
+                                       passphrase_size, &cd->u.luks1.hdr, &vk, cd);
+       } else if (isLUKS2(cd->type)) {
+               r = LUKS2_keyslot_open(cd, keyslot,
+                               keyslot == CRYPT_ANY_SLOT ? CRYPT_DEFAULT_SEGMENT : CRYPT_ANY_SEGMENT,
+                               passphrase, passphrase_size, &vk);
+       } else if (isTCRYPT(cd->type)) {
+               r = TCRYPT_get_volume_key(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params, &vk);
+       } else if (isVERITY(cd->type)) {
+               /* volume_key == root hash */
+               if (cd->u.verity.root_hash) {
+                       memcpy(volume_key, cd->u.verity.root_hash, cd->u.verity.root_hash_size);
+                       *volume_key_size = cd->u.verity.root_hash_size;
+                       r = 0;
+               } else
+                       log_err(cd, _("Cannot retrieve root hash for verity device."));
+       } else
+               log_err(cd, _("This operation is not supported for %s crypt device."), cd->type ?: "(none)");
+
+       if (r >= 0 && vk) {
+               memcpy(volume_key, vk->key, vk->keylength);
+               *volume_key_size = vk->keylength;
+       }
+
+       crypt_free_volume_key(vk);
+       return r;
+}
+
+int crypt_volume_key_verify(struct crypt_device *cd,
+       const char *volume_key,
+       size_t volume_key_size)
+{
+       struct volume_key *vk;
+       int r;
+
+       if ((r = _onlyLUKS(cd, CRYPT_CD_UNRESTRICTED)))
+               return r;
+
+       vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+       if (!vk)
+               return -ENOMEM;
+
+       if (isLUKS1(cd->type))
+               r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
+       else if (isLUKS2(cd->type))
+               r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
+       else
+               r = -EINVAL;
+
+
+       if (r == -EPERM)
+               log_err(cd, _("Volume key does not match the volume."));
+
+       crypt_free_volume_key(vk);
+
+       return r >= 0 ? 0 : r;
+}
+
+/*
+ * RNG and memory locking
+ */
+void crypt_set_rng_type(struct crypt_device *cd, int rng_type)
+{
+       if (!cd)
+               return;
+
+       switch (rng_type) {
+       case CRYPT_RNG_URANDOM:
+       case CRYPT_RNG_RANDOM:
+               log_dbg(cd, "RNG set to %d (%s).", rng_type, rng_type ? "random" : "urandom");
+               cd->rng_type = rng_type;
+       }
+}
+
+int crypt_get_rng_type(struct crypt_device *cd)
+{
+       if (!cd)
+               return -EINVAL;
+
+       return cd->rng_type;
+}
+
+int crypt_memory_lock(struct crypt_device *cd, int lock)
+{
+       return lock ? crypt_memlock_inc(cd) : crypt_memlock_dec(cd);
+}
+
+void crypt_set_compatibility(struct crypt_device *cd, uint32_t flags)
+{
+       if (cd)
+               cd->compatibility = flags;
+}
+
+uint32_t crypt_get_compatibility(struct crypt_device *cd)
+{
+       if (cd)
+               return cd->compatibility;
+
+       return 0;
+}
+
+/*
+ * Reporting
+ */
+crypt_status_info crypt_status(struct crypt_device *cd, const char *name)
+{
+       int r;
+
+       if (!name)
+               return CRYPT_INVALID;
+
+       if (!cd)
+               dm_backend_init(cd);
+
+       r = dm_status_device(cd, name);
+
+       if (!cd)
+               dm_backend_exit(cd);
+
+       if (r < 0 && r != -ENODEV)
+               return CRYPT_INVALID;
+
+       if (r == 0)
+               return CRYPT_ACTIVE;
+
+       if (r > 0)
+               return CRYPT_BUSY;
+
+       return CRYPT_INACTIVE;
+}
+
+static void hexprint(struct crypt_device *cd, const char *d, int n, const char *sep)
+{
+       int i;
+       for(i = 0; i < n; i++)
+               log_std(cd, "%02hhx%s", (const char)d[i], sep);
+}
+
+static int _luks_dump(struct crypt_device *cd)
+{
+       int i;
+
+       log_std(cd, "LUKS header information for %s\n\n", mdata_device_path(cd));
+       log_std(cd, "Version:       \t%" PRIu16 "\n", cd->u.luks1.hdr.version);
+       log_std(cd, "Cipher name:   \t%s\n", cd->u.luks1.hdr.cipherName);
+       log_std(cd, "Cipher mode:   \t%s\n", cd->u.luks1.hdr.cipherMode);
+       log_std(cd, "Hash spec:     \t%s\n", cd->u.luks1.hdr.hashSpec);
+       log_std(cd, "Payload offset:\t%" PRIu32 "\n", cd->u.luks1.hdr.payloadOffset);
+       log_std(cd, "MK bits:       \t%" PRIu32 "\n", cd->u.luks1.hdr.keyBytes * 8);
+       log_std(cd, "MK digest:     \t");
+       hexprint(cd, cd->u.luks1.hdr.mkDigest, LUKS_DIGESTSIZE, " ");
+       log_std(cd, "\n");
+       log_std(cd, "MK salt:       \t");
+       hexprint(cd, cd->u.luks1.hdr.mkDigestSalt, LUKS_SALTSIZE/2, " ");
+       log_std(cd, "\n               \t");
+       hexprint(cd, cd->u.luks1.hdr.mkDigestSalt+LUKS_SALTSIZE/2, LUKS_SALTSIZE/2, " ");
+       log_std(cd, "\n");
+       log_std(cd, "MK iterations: \t%" PRIu32 "\n", cd->u.luks1.hdr.mkDigestIterations);
+       log_std(cd, "UUID:          \t%s\n\n", cd->u.luks1.hdr.uuid);
+       for(i = 0; i < LUKS_NUMKEYS; i++) {
+               if(cd->u.luks1.hdr.keyblock[i].active == LUKS_KEY_ENABLED) {
+                       log_std(cd, "Key Slot %d: ENABLED\n",i);
+                       log_std(cd, "\tIterations:         \t%" PRIu32 "\n",
+                               cd->u.luks1.hdr.keyblock[i].passwordIterations);
+                       log_std(cd, "\tSalt:               \t");
+                       hexprint(cd, cd->u.luks1.hdr.keyblock[i].passwordSalt,
+                                LUKS_SALTSIZE/2, " ");
+                       log_std(cd, "\n\t                      \t");
+                       hexprint(cd, cd->u.luks1.hdr.keyblock[i].passwordSalt +
+                                LUKS_SALTSIZE/2, LUKS_SALTSIZE/2, " ");
+                       log_std(cd, "\n");
+
+                       log_std(cd, "\tKey material offset:\t%" PRIu32 "\n",
+                               cd->u.luks1.hdr.keyblock[i].keyMaterialOffset);
+                       log_std(cd, "\tAF stripes:            \t%" PRIu32 "\n",
+                               cd->u.luks1.hdr.keyblock[i].stripes);
+               }
+               else
+                       log_std(cd, "Key Slot %d: DISABLED\n", i);
+       }
+       return 0;
+}
+
+static int _verity_dump(struct crypt_device *cd)
+{
+       log_std(cd, "VERITY header information for %s\n", mdata_device_path(cd));
+       log_std(cd, "UUID:            \t%s\n", cd->u.verity.uuid ?: "");
+       log_std(cd, "Hash type:       \t%u\n", cd->u.verity.hdr.hash_type);
+       log_std(cd, "Data blocks:     \t%" PRIu64 "\n", cd->u.verity.hdr.data_size);
+       log_std(cd, "Data block size: \t%u\n", cd->u.verity.hdr.data_block_size);
+       log_std(cd, "Hash block size: \t%u\n", cd->u.verity.hdr.hash_block_size);
+       log_std(cd, "Hash algorithm:  \t%s\n", cd->u.verity.hdr.hash_name);
+       log_std(cd, "Salt:            \t");
+       if (cd->u.verity.hdr.salt_size)
+               hexprint(cd, cd->u.verity.hdr.salt, cd->u.verity.hdr.salt_size, "");
+       else
+               log_std(cd, "-");
+       log_std(cd, "\n");
+       if (cd->u.verity.root_hash) {
+               log_std(cd, "Root hash:      \t");
+               hexprint(cd, cd->u.verity.root_hash, cd->u.verity.root_hash_size, "");
+               log_std(cd, "\n");
+       }
+       return 0;
+}
+
+int crypt_dump(struct crypt_device *cd)
+{
+       if (!cd)
+               return -EINVAL;
+       if (isLUKS1(cd->type))
+               return _luks_dump(cd);
+       else if (isLUKS2(cd->type))
+               return LUKS2_hdr_dump(cd, &cd->u.luks2.hdr);
+       else if (isVERITY(cd->type))
+               return _verity_dump(cd);
+       else if (isTCRYPT(cd->type))
+               return TCRYPT_dump(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+       else if (isINTEGRITY(cd->type))
+               return INTEGRITY_dump(cd, crypt_data_device(cd), 0);
+       else if (isBITLK(cd->type))
+               return BITLK_dump(cd, crypt_data_device(cd), &cd->u.bitlk.params);
+
+       log_err(cd, _("Dump operation is not supported for this device type."));
+       return -EINVAL;
+}
+
+/* internal only */
+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(struct crypt_device *cd)
+{
+       if (!cd)
+               return NULL;
+
+       if (isPLAIN(cd->type))
+               return cd->u.plain.cipher;
+
+       if (isLUKS1(cd->type))
+               return cd->u.luks1.hdr.cipherName;
+
+       if (isLUKS2(cd->type)) {
+               if (crypt_parse_name_and_mode(LUKS2_get_cipher(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT),
+                                             cd->u.luks2.cipher, NULL, cd->u.luks2.cipher_mode))
+                       return NULL;
+               return cd->u.luks2.cipher;
+       }
+
+       if (isLOOPAES(cd->type))
+               return cd->u.loopaes.cipher;
+
+       if (isTCRYPT(cd->type))
+               return cd->u.tcrypt.params.cipher;
+
+       if (isBITLK(cd->type))
+               return cd->u.bitlk.params.cipher;
+
+       if (!cd->type && !_init_by_name_crypt_none(cd))
+               return cd->u.none.cipher;
+
+       return NULL;
+}
+
+const char *crypt_get_cipher_mode(struct crypt_device *cd)
+{
+       if (!cd)
+               return NULL;
+
+       if (isPLAIN(cd->type))
+               return cd->u.plain.cipher_mode;
+
+       if (isLUKS1(cd->type))
+               return cd->u.luks1.hdr.cipherMode;
+
+       if (isLUKS2(cd->type)) {
+               if (crypt_parse_name_and_mode(LUKS2_get_cipher(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT),
+                                             cd->u.luks2.cipher, NULL, cd->u.luks2.cipher_mode))
+                       return NULL;
+               return cd->u.luks2.cipher_mode;
+       }
+
+       if (isLOOPAES(cd->type))
+               return cd->u.loopaes.cipher_mode;
+
+       if (isTCRYPT(cd->type))
+               return cd->u.tcrypt.params.mode;
+
+       if (isBITLK(cd->type))
+               return cd->u.bitlk.params.cipher_mode;
+
+       if (!cd->type && !_init_by_name_crypt_none(cd))
+               return cd->u.none.cipher_mode;
+
+       return NULL;
+}
+
+/* INTERNAL only */
+const char *crypt_get_integrity(struct crypt_device *cd)
+{
+       if (isINTEGRITY(cd->type))
+               return cd->u.integrity.params.integrity;
+
+       if (isLUKS2(cd->type))
+               return LUKS2_get_integrity(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
+
+       return NULL;
+}
+
+/* INTERNAL only */
+int crypt_get_integrity_key_size(struct crypt_device *cd)
+{
+       if (isINTEGRITY(cd->type))
+               return INTEGRITY_key_size(cd, crypt_get_integrity(cd));
+
+       if (isLUKS2(cd->type))
+               return INTEGRITY_key_size(cd, crypt_get_integrity(cd));
+
+       return 0;
+}
+
+/* INTERNAL only */
+int crypt_get_integrity_tag_size(struct crypt_device *cd)
+{
+       if (isINTEGRITY(cd->type))
+               return cd->u.integrity.params.tag_size;
+
+       if (isLUKS2(cd->type))
+               return INTEGRITY_tag_size(cd, crypt_get_integrity(cd),
+                                         crypt_get_cipher(cd),
+                                         crypt_get_cipher_mode(cd));
+       return 0;
+}
+
+int crypt_get_sector_size(struct crypt_device *cd)
+{
+       if (!cd)
+               return SECTOR_SIZE;
+
+       if (isPLAIN(cd->type))
+               return cd->u.plain.hdr.sector_size;
+
+       if (isINTEGRITY(cd->type))
+               return cd->u.integrity.params.sector_size;
+
+       if (isLUKS2(cd->type))
+               return LUKS2_get_sector_size(&cd->u.luks2.hdr);
+
+       return SECTOR_SIZE;
+}
+
+const char *crypt_get_uuid(struct crypt_device *cd)
+{
+       if (!cd)
+               return NULL;
+
+       if (isLUKS1(cd->type))
+               return cd->u.luks1.hdr.uuid;
+
+       if (isLUKS2(cd->type))
+               return cd->u.luks2.hdr.uuid;
+
+       if (isVERITY(cd->type))
+               return cd->u.verity.uuid;
+
+       if (isBITLK(cd->type))
+               return cd->u.bitlk.params.guid;
+
+       return NULL;
+}
+
+const char *crypt_get_device_name(struct crypt_device *cd)
+{
+       const char *path;
+
+       if (!cd)
+               return NULL;
+
+       path = device_block_path(cd->device);
+       if (!path)
+               path = device_path(cd->device);
+
+       return path;
+}
+
+const char *crypt_get_metadata_device_name(struct crypt_device *cd)
+{
+       const char *path;
+
+       if (!cd || !cd->metadata_device)
+               return NULL;
+
+       path = device_block_path(cd->metadata_device);
+       if (!path)
+               path = device_path(cd->metadata_device);
+
+       return path;
+}
+
+int crypt_get_volume_key_size(struct crypt_device *cd)
+{
+       int r;
+
+       if (!cd)
+               return 0;
+
+       if (isPLAIN(cd->type))
+               return cd->u.plain.key_size;
+
+       if (isLUKS1(cd->type))
+               return cd->u.luks1.hdr.keyBytes;
+
+       if (isLUKS2(cd->type)) {
+               r = LUKS2_get_volume_key_size(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
+               if (r < 0 && cd->volume_key)
+                       r = cd->volume_key->keylength;
+               return r < 0 ? 0 : r;
+       }
+
+       if (isLOOPAES(cd->type))
+               return cd->u.loopaes.key_size;
+
+       if (isVERITY(cd->type))
+               return cd->u.verity.root_hash_size;
+
+       if (isTCRYPT(cd->type))
+               return cd->u.tcrypt.params.key_size;
+
+       if (isBITLK(cd->type))
+               return cd->u.bitlk.params.key_size / 8;
+
+       if (!cd->type && !_init_by_name_crypt_none(cd))
+               return cd->u.none.key_size;
+
+       return 0;
+}
+
+int crypt_keyslot_get_key_size(struct crypt_device *cd, int keyslot)
+{
+       if (!cd || !isLUKS(cd->type))
+               return -EINVAL;
+
+       if (keyslot < 0 || keyslot >= crypt_keyslot_max(cd->type))
+               return -EINVAL;
+
+       if (isLUKS1(cd->type))
+               return cd->u.luks1.hdr.keyBytes;
+
+       if (isLUKS2(cd->type))
+               return LUKS2_get_keyslot_stored_key_size(&cd->u.luks2.hdr, keyslot);
+
+       return -EINVAL;
+}
+
+int crypt_keyslot_set_encryption(struct crypt_device *cd,
+       const char *cipher,
+       size_t key_size)
+{
+       char *tmp;
+
+       if (!cd || !cipher || ! key_size || !isLUKS2(cd->type))
+               return -EINVAL;
+
+       if (LUKS2_keyslot_cipher_incompatible(cd, cipher))
+               return -EINVAL;
+
+       tmp = strdup(cipher);
+       free(cd->u.luks2.keyslot_cipher);
+       cd->u.luks2.keyslot_cipher = tmp;
+       if (!cd->u.luks2.keyslot_cipher)
+               return -ENOMEM;
+       cd->u.luks2.keyslot_key_size = key_size;
+
+       return 0;
+}
+
+const char *crypt_keyslot_get_encryption(struct crypt_device *cd, int keyslot, size_t *key_size)
+{
+       const char *cipher;
+
+       if (!cd || !isLUKS(cd->type) || !key_size)
+               return NULL;
+
+       if (isLUKS1(cd->type)) {
+               if (keyslot != CRYPT_ANY_SLOT &&
+                   LUKS_keyslot_info(&cd->u.luks1.hdr, keyslot) < CRYPT_SLOT_ACTIVE)
+                       return NULL;
+               *key_size = crypt_get_volume_key_size(cd);
+               return cd->u.luks1.cipher_spec;
+       }
+
+       if (keyslot != CRYPT_ANY_SLOT)
+               return LUKS2_get_keyslot_cipher(&cd->u.luks2.hdr, keyslot, key_size);
+
+       /* Keyslot encryption was set through crypt_keyslot_set_encryption() */
+       if (cd->u.luks2.keyslot_cipher) {
+               *key_size = cd->u.luks2.keyslot_key_size;
+               return cd->u.luks2.keyslot_cipher;
+       }
+
+       /* Try to reuse volume encryption parameters */
+       cipher =  LUKS2_get_cipher(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
+       if (!LUKS2_keyslot_cipher_incompatible(cd, cipher)) {
+               *key_size = crypt_get_volume_key_size(cd);
+               if (*key_size)
+                       return cipher;
+       }
+
+       /* Fallback to default LUKS2 keyslot encryption */
+       *key_size = DEFAULT_LUKS2_KEYSLOT_KEYBITS / 8;
+       return DEFAULT_LUKS2_KEYSLOT_CIPHER;
+}
+
+int crypt_keyslot_get_pbkdf(struct crypt_device *cd, int keyslot, struct crypt_pbkdf_type *pbkdf)
+{
+       if (!cd || !pbkdf || keyslot == CRYPT_ANY_SLOT)
+               return -EINVAL;
+
+       if (isLUKS1(cd->type))
+               return LUKS_keyslot_pbkdf(&cd->u.luks1.hdr, keyslot, pbkdf);
+       else if (isLUKS2(cd->type))
+               return LUKS2_keyslot_pbkdf(&cd->u.luks2.hdr, keyslot, pbkdf);
+
+       return -EINVAL;
+}
+
+int crypt_set_data_offset(struct crypt_device *cd, uint64_t data_offset)
+{
+       if (!cd)
+               return -EINVAL;
+       if (data_offset % (MAX_SECTOR_SIZE >> SECTOR_SHIFT)) {
+               log_err(cd, _("Data offset is not multiple of %u bytes."), MAX_SECTOR_SIZE);
+               return -EINVAL;
+       }
+
+       cd->data_offset = data_offset;
+       log_dbg(cd, "Data offset set to %" PRIu64 " (512-byte) sectors.", data_offset);
+
+       return 0;
+}
+
+int crypt_set_metadata_size(struct crypt_device *cd,
+       uint64_t metadata_size,
+       uint64_t keyslots_size)
+{
+       if (!cd)
+               return -EINVAL;
+
+       if (cd->type && !isLUKS2(cd->type))
+               return -EINVAL;
+
+       if (metadata_size && LUKS2_check_metadata_area_size(metadata_size))
+               return -EINVAL;
+
+       if (keyslots_size && LUKS2_check_keyslots_area_size(keyslots_size))
+               return -EINVAL;
+
+       cd->metadata_size = metadata_size;
+       cd->keyslots_size = keyslots_size;
+
+       return 0;
+}
+
+int crypt_get_metadata_size(struct crypt_device *cd,
+       uint64_t *metadata_size,
+       uint64_t *keyslots_size)
+{
+       uint64_t msize, ksize;
+
+       if (!cd)
+               return -EINVAL;
+
+       if (!cd->type) {
+               msize = cd->metadata_size;
+               ksize = cd->keyslots_size;
+       } else if (isLUKS1(cd->type)) {
+               msize = LUKS_ALIGN_KEYSLOTS;
+               ksize = LUKS_device_sectors(&cd->u.luks1.hdr) * SECTOR_SIZE - msize;
+       } else if (isLUKS2(cd->type)) {
+               msize = LUKS2_metadata_size(cd->u.luks2.hdr.jobj);
+               ksize = LUKS2_keyslots_size(cd->u.luks2.hdr.jobj);
        } else
-               log_err(cd, _("Device type is not properly initialised.\n"));
+               return -EINVAL;
+
+       if (metadata_size)
+               *metadata_size = msize;
+       if (keyslots_size)
+               *keyslots_size = ksize;
+
+       return 0;
+}
+
+uint64_t crypt_get_data_offset(struct crypt_device *cd)
+{
+       if (!cd)
+               return 0;
+
+       if (isPLAIN(cd->type))
+               return cd->u.plain.hdr.offset;
+
+       if (isLUKS1(cd->type))
+               return cd->u.luks1.hdr.payloadOffset;
+
+       if (isLUKS2(cd->type))
+               return LUKS2_get_data_offset(&cd->u.luks2.hdr);
+
+       if (isLOOPAES(cd->type))
+               return cd->u.loopaes.hdr.offset;
+
+       if (isTCRYPT(cd->type))
+               return TCRYPT_get_data_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+
+       if (isBITLK(cd->type))
+               return cd->u.bitlk.params.volume_header_size / SECTOR_SIZE;
+
+       return cd->data_offset;
+}
+
+uint64_t crypt_get_iv_offset(struct crypt_device *cd)
+{
+       if (!cd)
+               return 0;
+
+       if (isPLAIN(cd->type))
+               return cd->u.plain.hdr.skip;
+
+       if (isLOOPAES(cd->type))
+               return cd->u.loopaes.hdr.skip;
+
+       if (isTCRYPT(cd->type))
+               return TCRYPT_get_iv_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+
+       return 0;
+}
+
+crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot)
+{
+       if (_onlyLUKS(cd, CRYPT_CD_QUIET | CRYPT_CD_UNRESTRICTED) < 0)
+               return CRYPT_SLOT_INVALID;
+
+       if (isLUKS1(cd->type))
+               return LUKS_keyslot_info(&cd->u.luks1.hdr, keyslot);
+       else if(isLUKS2(cd->type))
+               return LUKS2_keyslot_info(&cd->u.luks2.hdr, keyslot);
+
+       return CRYPT_SLOT_INVALID;
+}
+
+int crypt_keyslot_max(const char *type)
+{
+       if (type && isLUKS1(type))
+               return LUKS_NUMKEYS;
+
+       if (type && isLUKS2(type))
+               return LUKS2_KEYSLOTS_MAX;
+
+       return -EINVAL;
+}
+
+int crypt_keyslot_area(struct crypt_device *cd,
+       int keyslot,
+       uint64_t *offset,
+       uint64_t *length)
+{
+       if (_onlyLUKS(cd, CRYPT_CD_QUIET | CRYPT_CD_UNRESTRICTED) || !offset || !length)
+               return -EINVAL;
+
+       if (isLUKS2(cd->type))
+               return LUKS2_keyslot_area(&cd->u.luks2.hdr, keyslot, offset, length);
+
+       return LUKS_keyslot_area(&cd->u.luks1.hdr, keyslot, offset, length);
+}
+
+crypt_keyslot_priority crypt_keyslot_get_priority(struct crypt_device *cd, int keyslot)
+{
+       if (_onlyLUKS(cd, CRYPT_CD_QUIET | CRYPT_CD_UNRESTRICTED))
+               return CRYPT_SLOT_PRIORITY_INVALID;
+
+       if (keyslot < 0 || keyslot >= crypt_keyslot_max(cd->type))
+               return CRYPT_SLOT_PRIORITY_INVALID;
+
+       if (isLUKS2(cd->type))
+               return LUKS2_keyslot_priority_get(cd, &cd->u.luks2.hdr, keyslot);
+
+       return CRYPT_SLOT_PRIORITY_NORMAL;
+}
+
+int crypt_keyslot_set_priority(struct crypt_device *cd, int keyslot, crypt_keyslot_priority priority)
+{
+       int r;
+
+       log_dbg(cd, "Setting keyslot %d to priority %d.", keyslot, priority);
 
-       crypt_free_volume_key(vk);
+       if (priority == CRYPT_SLOT_PRIORITY_INVALID)
+               return -EINVAL;
 
-       return r;
+       if (keyslot < 0 || keyslot >= crypt_keyslot_max(cd->type))
+               return -EINVAL;
+
+       if ((r = onlyLUKS2(cd)))
+               return r;
+
+       return LUKS2_keyslot_priority_set(cd, &cd->u.luks2.hdr, keyslot, priority, 1);
 }
 
-int crypt_deactivate(struct crypt_device *cd, const char *name)
+const char *crypt_get_type(struct crypt_device *cd)
 {
-       struct crypt_device *fake_cd = NULL;
-       int r;
+       return cd ? cd->type : NULL;
+}
 
-       if (!name)
+const char *crypt_get_default_type(void)
+{
+       return DEFAULT_LUKS_FORMAT;
+}
+
+int crypt_get_verity_info(struct crypt_device *cd,
+       struct crypt_params_verity *vp)
+{
+       if (!cd || !isVERITY(cd->type) || !vp)
                return -EINVAL;
 
-       log_dbg("Deactivating volume %s.", name);
+       vp->data_device = device_path(cd->device);
+       vp->hash_device = mdata_device_path(cd);
+       vp->fec_device  = device_path(cd->u.verity.fec_device);
+       vp->fec_area_offset = cd->u.verity.hdr.fec_area_offset;
+       vp->fec_roots = cd->u.verity.hdr.fec_roots;
+       vp->hash_name = cd->u.verity.hdr.hash_name;
+       vp->salt = cd->u.verity.hdr.salt;
+       vp->salt_size = cd->u.verity.hdr.salt_size;
+       vp->data_block_size = cd->u.verity.hdr.data_block_size;
+       vp->hash_block_size = cd->u.verity.hdr.hash_block_size;
+       vp->data_size = cd->u.verity.hdr.data_size;
+       vp->hash_area_offset = cd->u.verity.hdr.hash_area_offset;
+       vp->hash_type = cd->u.verity.hdr.hash_type;
+       vp->flags = cd->u.verity.hdr.flags & (CRYPT_VERITY_NO_HEADER | CRYPT_VERITY_ROOT_HASH_SIGNATURE);
+       return 0;
+}
 
-       if (!cd) {
-               r = crypt_init_by_name(&fake_cd, name);
-               if (r < 0)
-                       return r;
-               cd = fake_cd;
-       }
+int crypt_get_integrity_info(struct crypt_device *cd,
+       struct crypt_params_integrity *ip)
+{
+       if (!cd || !ip)
+               return -EINVAL;
 
-       switch (crypt_status(cd, name)) {
-               case CRYPT_ACTIVE:
-               case CRYPT_BUSY:
-                       if (isTCRYPT(cd->type))
-                               r = TCRYPT_deactivate(cd, name);
-                       else
-                               r = dm_remove_device(cd, name, 0, 0);
-                       if (r < 0 && crypt_status(cd, name) == CRYPT_BUSY) {
-                               log_err(cd, _("Device %s is still in use.\n"), name);
-                               r = -EBUSY;
-                       }
-                       break;
-               case CRYPT_INACTIVE:
-                       log_err(cd, _("Device %s is not active.\n"), name);
-                       r = -ENODEV;
-                       break;
-               default:
-                       log_err(cd, _("Invalid device %s.\n"), name);
-                       r = -EINVAL;
+       if (isINTEGRITY(cd->type)) {
+               ip->journal_size = cd->u.integrity.params.journal_size;
+               ip->journal_watermark = cd->u.integrity.params.journal_watermark;
+               ip->journal_commit_time = cd->u.integrity.params.journal_commit_time;
+               ip->interleave_sectors = cd->u.integrity.params.interleave_sectors;
+               ip->tag_size = cd->u.integrity.params.tag_size;
+               ip->sector_size = cd->u.integrity.params.sector_size;
+               ip->buffer_sectors = cd->u.integrity.params.buffer_sectors;
+
+               ip->integrity = cd->u.integrity.params.integrity;
+               ip->integrity_key_size = crypt_get_integrity_key_size(cd);
+
+               ip->journal_integrity = cd->u.integrity.params.journal_integrity;
+               ip->journal_integrity_key_size = cd->u.integrity.params.journal_integrity_key_size;
+               ip->journal_integrity_key = NULL;
+
+               ip->journal_crypt = cd->u.integrity.params.journal_crypt;
+               ip->journal_crypt_key_size = cd->u.integrity.params.journal_crypt_key_size;
+               ip->journal_crypt_key = NULL;
+               return 0;
+       } else if (isLUKS2(cd->type)) {
+               ip->journal_size = 0; // FIXME
+               ip->journal_watermark = 0; // FIXME
+               ip->journal_commit_time = 0; // FIXME
+               ip->interleave_sectors = 0; // FIXME
+               ip->sector_size = crypt_get_sector_size(cd);
+               ip->buffer_sectors = 0; // FIXME
+
+               ip->integrity = LUKS2_get_integrity(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
+               ip->integrity_key_size = crypt_get_integrity_key_size(cd);
+               ip->tag_size = INTEGRITY_tag_size(cd, ip->integrity, crypt_get_cipher(cd), crypt_get_cipher_mode(cd));
+
+               ip->journal_integrity = NULL;
+               ip->journal_integrity_key_size = 0;
+               ip->journal_integrity_key = NULL;
+
+               ip->journal_crypt = NULL;
+               ip->journal_crypt_key_size = 0;
+               ip->journal_crypt_key = NULL;
+               return 0;
        }
 
-       crypt_free(fake_cd);
-
-       return r;
+       return -ENOTSUP;
 }
 
-int crypt_volume_key_get(struct crypt_device *cd,
-       int keyslot,
-       char *volume_key,
-       size_t *volume_key_size,
-       const char *passphrase,
-       size_t passphrase_size)
+int crypt_convert(struct crypt_device *cd,
+                 const char *type,
+                 void *params)
 {
-       struct volume_key *vk = NULL;
-       unsigned key_len;
-       int r = -EINVAL;
+       struct luks_phdr hdr1;
+       struct luks2_hdr hdr2;
+       int r;
 
-       if (crypt_fips_mode()) {
-               log_err(cd, _("Function not available in FIPS mode.\n"));
-               return -EACCES;
-       }
+       if (!type)
+               return -EINVAL;
 
-       key_len = crypt_get_volume_key_size(cd);
-       if (key_len > *volume_key_size) {
-               log_err(cd, _("Volume key buffer too small.\n"));
-               return -ENOMEM;
-       }
+       log_dbg(cd, "Converting LUKS device to type %s", type);
 
-       if (isPLAIN(cd->type) && cd->u.plain.hdr.hash) {
-               r = process_key(cd, cd->u.plain.hdr.hash, key_len,
-                               passphrase, passphrase_size, &vk);
-               if (r < 0)
-                       log_err(cd, _("Cannot retrieve volume key for plain device.\n"));
-       } else if (isLUKS(cd->type)) {
-               r = LUKS_open_key_with_hdr(keyslot, passphrase,
-                                       passphrase_size, &cd->u.luks1.hdr, &vk, cd);
-       } else if (isTCRYPT(cd->type)) {
-               r = TCRYPT_get_volume_key(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params, &vk);
-       } else
-               log_err(cd, _("This operation is not supported for %s crypt device.\n"), cd->type ?: "(none)");
+       if ((r = onlyLUKS(cd)))
+               return r;
 
-       if (r >= 0) {
-               memcpy(volume_key, vk->key, vk->keylength);
-               *volume_key_size = vk->keylength;
+       if (isLUKS1(cd->type) && isLUKS2(type))
+               r = LUKS2_luks1_to_luks2(cd, &cd->u.luks1.hdr, &hdr2);
+       else if (isLUKS2(cd->type) && isLUKS1(type))
+               r = LUKS2_luks2_to_luks1(cd, &cd->u.luks2.hdr, &hdr1);
+       else
+               return -EINVAL;
+
+       if (r < 0) {
+               /* in-memory header may be invalid after failed conversion */
+               _luks2_reload(cd);
+               if (r == -EBUSY)
+                       log_err(cd, _("Cannot convert device %s which is still in use."), mdata_device_path(cd));
+               return r;
        }
 
-       crypt_free_volume_key(vk);
-       return r;
+       crypt_free_type(cd);
+
+       return crypt_load(cd, type, params);
 }
 
-int crypt_volume_key_verify(struct crypt_device *cd,
-       const char *volume_key,
-       size_t volume_key_size)
+/* Internal access function to header pointer */
+void *crypt_get_hdr(struct crypt_device *cd, const char *type)
 {
-       struct volume_key *vk;
-       int r;
+       /* If requested type differs, ignore it */
+       if (strcmp(cd->type, type))
+               return NULL;
 
-       r = onlyLUKS(cd);
-       if (r < 0)
-               return r;
+       if (isPLAIN(cd->type))
+               return &cd->u.plain;
 
-       vk = crypt_alloc_volume_key(volume_key_size, volume_key);
-       if (!vk)
-               return -ENOMEM;
+       if (isLUKS1(cd->type))
+               return &cd->u.luks1.hdr;
 
-       r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
+       if (isLUKS2(cd->type))
+               return &cd->u.luks2.hdr;
 
-       if (r == -EPERM)
-               log_err(cd, _("Volume key does not match the volume.\n"));
+       if (isLOOPAES(cd->type))
+               return &cd->u.loopaes;
 
-       crypt_free_volume_key(vk);
+       if (isVERITY(cd->type))
+               return &cd->u.verity;
 
-       return r;
+       if (isTCRYPT(cd->type))
+               return &cd->u.tcrypt;
+
+       return NULL;
 }
 
-void crypt_set_timeout(struct crypt_device *cd, uint64_t timeout_sec)
+/* internal only */
+struct luks2_reenc_context *crypt_get_reenc_context(struct crypt_device *cd)
 {
-       log_dbg("Timeout set to %" PRIu64 " miliseconds.", timeout_sec);
-       cd->timeout = timeout_sec;
+       return cd->u.luks2.rh;
 }
 
-void crypt_set_password_retry(struct crypt_device *cd, int tries)
+/* internal only */
+void crypt_set_reenc_context(struct crypt_device *cd, struct luks2_reenc_context *rh)
 {
-       log_dbg("Password retry count set to %d.", tries);
-       cd->tries = tries;
+       cd->u.luks2.rh = rh;
 }
 
-void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms)
+/*
+ * Token handling
+ */
+int crypt_activate_by_token(struct crypt_device *cd,
+       const char *name, int token, void *usrptr, uint32_t flags)
 {
-       log_dbg("Iteration time set to %" PRIu64 " miliseconds.", iteration_time_ms);
-       cd->iteration_time = iteration_time_ms;
+       int r;
+
+       log_dbg(cd, "%s volume %s using token %d.",
+               name ? "Activating" : "Checking", name ?: "passphrase", token);
+
+       if ((r = _onlyLUKS2(cd, CRYPT_CD_QUIET | CRYPT_CD_UNRESTRICTED, 0)))
+               return r;
+
+       if ((flags & CRYPT_ACTIVATE_KEYRING_KEY) && !crypt_use_keyring_for_vk(cd))
+               return -EINVAL;
+
+       if ((flags & CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY) && name)
+               return -EINVAL;
+
+       if (token == CRYPT_ANY_TOKEN)
+               return LUKS2_token_open_and_activate_any(cd, &cd->u.luks2.hdr, name, flags);
+
+       return LUKS2_token_open_and_activate(cd, &cd->u.luks2.hdr, token, name, flags, usrptr);
 }
-void crypt_set_iterarion_time(struct crypt_device *cd, uint64_t iteration_time_ms)
+
+int crypt_token_json_get(struct crypt_device *cd, int token, const char **json)
 {
-       crypt_set_iteration_time(cd, iteration_time_ms);
+       int r;
+
+       if (!json)
+               return -EINVAL;
+
+       log_dbg(cd, "Requesting JSON for token %d.", token);
+
+       if ((r = _onlyLUKS2(cd, CRYPT_CD_UNRESTRICTED, 0)))
+               return r;
+
+       return LUKS2_token_json_get(cd, &cd->u.luks2.hdr, token, json) ?: token;
 }
 
-void crypt_set_password_verify(struct crypt_device *cd, int password_verify)
+int crypt_token_json_set(struct crypt_device *cd, int token, const char *json)
 {
-       log_dbg("Password verification %s.", password_verify ? "enabled" : "disabled");
-       cd->password_verify = password_verify ? 1 : 0;
+       int r;
+
+       log_dbg(cd, "Updating JSON for token %d.", token);
+
+       if ((r = onlyLUKS2(cd)))
+               return r;
+
+       return LUKS2_token_create(cd, &cd->u.luks2.hdr, token, json, 1);
 }
 
-void crypt_set_rng_type(struct crypt_device *cd, int rng_type)
+crypt_token_info crypt_token_status(struct crypt_device *cd, int token, const char **type)
 {
-       switch (rng_type) {
-       case CRYPT_RNG_URANDOM:
-       case CRYPT_RNG_RANDOM:
-               log_dbg("RNG set to %d (%s).", rng_type, rng_type ? "random" : "urandom");
-               cd->rng_type = rng_type;
-       }
+       if (_onlyLUKS2(cd, CRYPT_CD_QUIET | CRYPT_CD_UNRESTRICTED, 0))
+               return CRYPT_TOKEN_INVALID;
+
+       return LUKS2_token_status(cd, &cd->u.luks2.hdr, token, type);
 }
 
-int crypt_get_rng_type(struct crypt_device *cd)
+int crypt_token_luks2_keyring_get(struct crypt_device *cd,
+       int token,
+       struct crypt_token_params_luks2_keyring *params)
 {
-       if (!cd)
+       crypt_token_info token_info;
+       const char *type;
+       int r;
+
+       if (!params)
                return -EINVAL;
 
-       return cd->rng_type;
-}
+       log_dbg(cd, "Requesting LUKS2 keyring token %d.", token);
 
-int crypt_memory_lock(struct crypt_device *cd, int lock)
-{
-       return lock ? crypt_memlock_inc(cd) : crypt_memlock_dec(cd);
+       if ((r = _onlyLUKS2(cd, CRYPT_CD_UNRESTRICTED, 0)))
+               return r;
+
+       token_info = LUKS2_token_status(cd, &cd->u.luks2.hdr, token, &type);
+       switch (token_info) {
+       case CRYPT_TOKEN_INVALID:
+               log_dbg(cd, "Token %d is invalid.", token);
+               return -EINVAL;
+       case CRYPT_TOKEN_INACTIVE:
+               log_dbg(cd, "Token %d is inactive.", token);
+               return -EINVAL;
+       case CRYPT_TOKEN_INTERNAL:
+               if (!strcmp(type, LUKS2_TOKEN_KEYRING))
+                       break;
+               /* Fall through */
+       case CRYPT_TOKEN_INTERNAL_UNKNOWN:
+       case CRYPT_TOKEN_EXTERNAL:
+       case CRYPT_TOKEN_EXTERNAL_UNKNOWN:
+               log_dbg(cd, "Token %d has unexpected type %s.", token, type);
+               return -EINVAL;
+       }
+
+       return LUKS2_builtin_token_get(cd, &cd->u.luks2.hdr, token, LUKS2_TOKEN_KEYRING, params);
 }
 
-// reporting
-crypt_status_info crypt_status(struct crypt_device *cd, const char *name)
+int crypt_token_luks2_keyring_set(struct crypt_device *cd,
+       int token,
+       const struct crypt_token_params_luks2_keyring *params)
 {
        int r;
 
-       if (!cd)
-               dm_backend_init();
+       if (!params)
+               return -EINVAL;
 
-       r = dm_status_device(cd, name);
+       log_dbg(cd, "Creating new LUKS2 keyring token (%d).", token);
 
-       if (!cd)
-               dm_backend_exit();
+       if ((r = onlyLUKS2(cd)))
+               return r;
 
-       if (r < 0 && r != -ENODEV)
-               return CRYPT_INVALID;
+       return LUKS2_builtin_token_create(cd, &cd->u.luks2.hdr, token, LUKS2_TOKEN_KEYRING, params, 1);
+}
 
-       if (r == 0)
-               return CRYPT_ACTIVE;
+int crypt_token_assign_keyslot(struct crypt_device *cd, int token, int keyslot)
+{
+       int r;
 
-       if (r > 0)
-               return CRYPT_BUSY;
+       if ((r = onlyLUKS2(cd)))
+               return r;
 
-       return CRYPT_INACTIVE;
+       return LUKS2_token_assign(cd, &cd->u.luks2.hdr, keyslot, token, 1, 1);
 }
 
-static void hexprint(struct crypt_device *cd, const char *d, int n, const char *sep)
+int crypt_token_unassign_keyslot(struct crypt_device *cd, int token, int keyslot)
 {
-       int i;
-       for(i = 0; i < n; i++)
-               log_std(cd, "%02hhx%s", (const char)d[i], sep);
+       int r;
+
+       if ((r = onlyLUKS2(cd)))
+               return r;
+
+       return LUKS2_token_assign(cd, &cd->u.luks2.hdr, keyslot, token, 0, 1);
 }
 
-static int _luks_dump(struct crypt_device *cd)
+int crypt_token_is_assigned(struct crypt_device *cd, int token, int keyslot)
 {
-       int i;
+       int r;
 
-       log_std(cd, "LUKS header information for %s\n\n", mdata_device_path(cd));
-       log_std(cd, "Version:       \t%" PRIu16 "\n", cd->u.luks1.hdr.version);
-       log_std(cd, "Cipher name:   \t%s\n", cd->u.luks1.hdr.cipherName);
-       log_std(cd, "Cipher mode:   \t%s\n", cd->u.luks1.hdr.cipherMode);
-       log_std(cd, "Hash spec:     \t%s\n", cd->u.luks1.hdr.hashSpec);
-       log_std(cd, "Payload offset:\t%" PRIu32 "\n", cd->u.luks1.hdr.payloadOffset);
-       log_std(cd, "MK bits:       \t%" PRIu32 "\n", cd->u.luks1.hdr.keyBytes * 8);
-       log_std(cd, "MK digest:     \t");
-       hexprint(cd, cd->u.luks1.hdr.mkDigest, LUKS_DIGESTSIZE, " ");
-       log_std(cd, "\n");
-       log_std(cd, "MK salt:       \t");
-       hexprint(cd, cd->u.luks1.hdr.mkDigestSalt, LUKS_SALTSIZE/2, " ");
-       log_std(cd, "\n               \t");
-       hexprint(cd, cd->u.luks1.hdr.mkDigestSalt+LUKS_SALTSIZE/2, LUKS_SALTSIZE/2, " ");
-       log_std(cd, "\n");
-       log_std(cd, "MK iterations: \t%" PRIu32 "\n", cd->u.luks1.hdr.mkDigestIterations);
-       log_std(cd, "UUID:          \t%s\n\n", cd->u.luks1.hdr.uuid);
-       for(i = 0; i < LUKS_NUMKEYS; i++) {
-               if(cd->u.luks1.hdr.keyblock[i].active == LUKS_KEY_ENABLED) {
-                       log_std(cd, "Key Slot %d: ENABLED\n",i);
-                       log_std(cd, "\tIterations:         \t%" PRIu32 "\n",
-                               cd->u.luks1.hdr.keyblock[i].passwordIterations);
-                       log_std(cd, "\tSalt:               \t");
-                       hexprint(cd, cd->u.luks1.hdr.keyblock[i].passwordSalt,
-                                LUKS_SALTSIZE/2, " ");
-                       log_std(cd, "\n\t                      \t");
-                       hexprint(cd, cd->u.luks1.hdr.keyblock[i].passwordSalt +
-                                LUKS_SALTSIZE/2, LUKS_SALTSIZE/2, " ");
-                       log_std(cd, "\n");
+       if ((r = _onlyLUKS2(cd, CRYPT_CD_QUIET | CRYPT_CD_UNRESTRICTED, 0)))
+               return r;
 
-                       log_std(cd, "\tKey material offset:\t%" PRIu32 "\n",
-                               cd->u.luks1.hdr.keyblock[i].keyMaterialOffset);
-                       log_std(cd, "\tAF stripes:            \t%" PRIu32 "\n",
-                               cd->u.luks1.hdr.keyblock[i].stripes);
-               }
-               else 
-                       log_std(cd, "Key Slot %d: DISABLED\n", i);
-       }
-       return 0;
+       return LUKS2_token_is_assigned(cd, &cd->u.luks2.hdr, keyslot, token);
 }
 
-static int _verity_dump(struct crypt_device *cd)
+/* Internal only */
+int crypt_metadata_locking_enabled(void)
 {
-       log_std(cd, "VERITY header information for %s\n", mdata_device_path(cd));
-       log_std(cd, "UUID:            \t%s\n", cd->u.verity.uuid ?: "");
-       log_std(cd, "Hash type:       \t%u\n", cd->u.verity.hdr.hash_type);
-       log_std(cd, "Data blocks:     \t%" PRIu64 "\n", cd->u.verity.hdr.data_size);
-       log_std(cd, "Data block size: \t%u\n", cd->u.verity.hdr.data_block_size);
-       log_std(cd, "Hash block size: \t%u\n", cd->u.verity.hdr.hash_block_size);
-       log_std(cd, "Hash algorithm:  \t%s\n", cd->u.verity.hdr.hash_name);
-       log_std(cd, "Salt:            \t");
-       if (cd->u.verity.hdr.salt_size)
-               hexprint(cd, cd->u.verity.hdr.salt, cd->u.verity.hdr.salt_size, "");
-       else
-               log_std(cd, "-");
-       log_std(cd, "\n");
-       if (cd->u.verity.root_hash) {
-               log_std(cd, "Root hash:      \t");
-               hexprint(cd, cd->u.verity.root_hash, cd->u.verity.root_hash_size, "");
-               log_std(cd, "\n");
-       }
+       return _metadata_locking;
+}
+
+int crypt_metadata_locking(struct crypt_device *cd, int enable)
+{
+       if (enable && !_metadata_locking)
+               return -EPERM;
+
+       _metadata_locking = enable ? 1 : 0;
        return 0;
 }
 
-int crypt_dump(struct crypt_device *cd)
+int crypt_persistent_flags_set(struct crypt_device *cd, crypt_flags_type type, uint32_t flags)
 {
-       if (isLUKS(cd->type))
-               return _luks_dump(cd);
-       else if (isVERITY(cd->type))
-               return _verity_dump(cd);
-       else if (isTCRYPT(cd->type))
-               return TCRYPT_dump(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+       int r;
+
+       if ((r = onlyLUKS2(cd)))
+               return r;
+
+       if (type == CRYPT_FLAGS_ACTIVATION)
+               return LUKS2_config_set_flags(cd, &cd->u.luks2.hdr, flags);
+
+       if (type == CRYPT_FLAGS_REQUIREMENTS)
+               return LUKS2_config_set_requirements(cd, &cd->u.luks2.hdr, flags, true);
 
-       log_err(cd, _("Dump operation is not supported for this device type.\n"));
        return -EINVAL;
 }
 
-
-static int _init_by_name_crypt_none(struct crypt_device *cd)
+int crypt_persistent_flags_get(struct crypt_device *cd, crypt_flags_type type, uint32_t *flags)
 {
-       struct crypt_dm_active_device dmd = {};
        int r;
 
-       if (cd->type || !cd->u.none.active_name)
+       if (!flags)
                return -EINVAL;
 
-       r = dm_query_device(cd, cd->u.none.active_name,
-                       DM_ACTIVE_CRYPT_CIPHER |
-                       DM_ACTIVE_CRYPT_KEYSIZE, &dmd);
-       if (r >= 0)
-               r = crypt_parse_name_and_mode(dmd.u.crypt.cipher,
-                                             cd->u.none.cipher, NULL,
-                                             cd->u.none.cipher_mode);
+       if ((r = _onlyLUKS2(cd, CRYPT_CD_UNRESTRICTED, 0)))
+               return r;
 
-       if (!r)
-               cd->u.none.key_size = dmd.u.crypt.vk->keylength;
+       if (type == CRYPT_FLAGS_ACTIVATION)
+               return LUKS2_config_get_flags(cd, &cd->u.luks2.hdr, flags);
 
-       crypt_free_volume_key(dmd.u.crypt.vk);
-       free(CONST_CAST(void*)dmd.u.crypt.cipher);
-       return r;
+       if (type == CRYPT_FLAGS_REQUIREMENTS)
+               return LUKS2_config_get_requirements(cd, &cd->u.luks2.hdr, flags);
+
+       return -EINVAL;
 }
 
-const char *crypt_get_cipher(struct crypt_device *cd)
+static int update_volume_key_segment_digest(struct crypt_device *cd, struct luks2_hdr *hdr, int digest, int commit)
 {
-       if (isPLAIN(cd->type))
-               return cd->u.plain.cipher;
-
-       if (isLUKS(cd->type))
-               return cd->u.luks1.hdr.cipherName;
-
-       if (isLOOPAES(cd->type))
-               return cd->u.loopaes.cipher;
-
-       if (isTCRYPT(cd->type))
-               return cd->u.tcrypt.params.cipher;
+       int r;
 
-       if (!cd->type && !_init_by_name_crypt_none(cd))
-               return cd->u.none.cipher;
+       /* Remove any assignments in memory */
+       r = LUKS2_digest_segment_assign(cd, hdr, CRYPT_DEFAULT_SEGMENT, CRYPT_ANY_DIGEST, 0, 0);
+       if (r)
+               return r;
 
-       return NULL;
+       /* Assign it to the specific digest */
+       return LUKS2_digest_segment_assign(cd, hdr, CRYPT_DEFAULT_SEGMENT, digest, 1, commit);
 }
 
-const char *crypt_get_cipher_mode(struct crypt_device *cd)
+static int verify_and_update_segment_digest(struct crypt_device *cd,
+               struct luks2_hdr *hdr, int keyslot,
+               const char *volume_key, size_t volume_key_size,
+               const char *password, size_t password_size)
 {
-       if (isPLAIN(cd->type))
-               return cd->u.plain.cipher_mode;
-
-       if (isLUKS(cd->type))
-               return cd->u.luks1.hdr.cipherMode;
+       int digest, r;
+       struct volume_key *vk = NULL;
 
-       if (isLOOPAES(cd->type))
-               return cd->u.loopaes.cipher_mode;
+       if (keyslot < 0 || (volume_key && !volume_key_size))
+               return -EINVAL;
 
-       if (isTCRYPT(cd->type))
-               return cd->u.tcrypt.params.mode;
+       if (volume_key)
+               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+       else {
+               r = LUKS2_keyslot_open(cd, keyslot, CRYPT_ANY_SEGMENT, password, password_size, &vk);
+               if (r != keyslot) {
+                       r = -EINVAL;
+                       goto out;
+               }
+       }
 
-       if (!cd->type && !_init_by_name_crypt_none(cd))
-               return cd->u.none.cipher_mode;
+       if (!vk)
+               return -ENOMEM;
 
-       return NULL;
-}
+       /* check volume_key (param) digest matches keyslot digest */
+       r = LUKS2_digest_verify(cd, hdr, vk, keyslot);
+       if (r < 0)
+               goto out;
+       digest = r;
 
-const char *crypt_get_uuid(struct crypt_device *cd)
-{
-       if (isLUKS(cd->type))
-               return cd->u.luks1.hdr.uuid;
+       /* nothing to do, volume key in keyslot is already assigned to default segment */
+       r = LUKS2_digest_verify_by_segment(cd, hdr, CRYPT_DEFAULT_SEGMENT, vk);
+       if (r >= 0)
+               goto out;
 
-       if (isVERITY(cd->type))
-               return cd->u.verity.uuid;
+       /* FIXME: check new volume key is usable with current default segment */
 
-       return NULL;
+       r = update_volume_key_segment_digest(cd, &cd->u.luks2.hdr, digest, 1);
+       if (r)
+               log_err(cd, _("Failed to assign keyslot %u as the new volume key."), keyslot);
+out:
+       crypt_free_volume_key(vk);
+       return r < 0 ? r : keyslot;
 }
 
-const char *crypt_get_device_name(struct crypt_device *cd)
+
+int crypt_keyslot_add_by_key(struct crypt_device *cd,
+       int keyslot,
+       const char *volume_key,
+       size_t volume_key_size,
+       const char *passphrase,
+       size_t passphrase_size,
+       uint32_t flags)
 {
-       const char *path = device_block_path(cd->device);
+       int digest, r;
+       struct luks2_keyslot_params params;
+       struct volume_key *vk = NULL;
 
-       if (!path)
-               path = device_path(cd->device);
+       if (!passphrase || ((flags & CRYPT_VOLUME_KEY_NO_SEGMENT) &&
+                           (flags & CRYPT_VOLUME_KEY_SET)))
+               return -EINVAL;
 
-       return path;
-}
+       log_dbg(cd, "Adding new keyslot %d with volume key %sassigned to a crypt segment.",
+               keyslot, flags & CRYPT_VOLUME_KEY_NO_SEGMENT ? "un" : "");
 
-int crypt_get_volume_key_size(struct crypt_device *cd)
-{
-       if (isPLAIN(cd->type))
-               return cd->u.plain.key_size;
+       if ((r = onlyLUKS2(cd)))
+               return r;
 
-       if (isLUKS(cd->type))
-               return cd->u.luks1.hdr.keyBytes;
+       /* new volume key assignment */
+       if ((flags & CRYPT_VOLUME_KEY_SET) && crypt_keyslot_status(cd, keyslot) > CRYPT_SLOT_INACTIVE)
+               return verify_and_update_segment_digest(cd, &cd->u.luks2.hdr,
+                       keyslot, volume_key, volume_key_size, passphrase, passphrase_size);
 
-       if (isLOOPAES(cd->type))
-               return cd->u.loopaes.key_size;
+       r = keyslot_verify_or_find_empty(cd, &keyslot);
+       if (r < 0)
+               return r;
 
-       if (isVERITY(cd->type))
-               return cd->u.verity.root_hash_size;
+       if (volume_key)
+               vk = crypt_alloc_volume_key(volume_key_size, volume_key);
+       else if (flags & CRYPT_VOLUME_KEY_NO_SEGMENT)
+               vk = crypt_generate_volume_key(cd, volume_key_size);
+       else if (cd->volume_key)
+               vk = crypt_alloc_volume_key(cd->volume_key->keylength, cd->volume_key->key);
+       else
+               return -EINVAL;
 
-       if (isTCRYPT(cd->type))
-               return cd->u.tcrypt.params.key_size;
+       if (!vk)
+               return -ENOMEM;
 
-       if (!cd->type && !_init_by_name_crypt_none(cd))
-               return cd->u.none.key_size;
+       /* if key matches volume key digest tear down new vk flag */
+       digest = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
+       if (digest >= 0)
+               flags &= ~CRYPT_VOLUME_KEY_SET;
 
-       return 0;
-}
+       /* if key matches any existing digest, do not create new digest */
+       if (digest < 0 && (flags & CRYPT_VOLUME_KEY_DIGEST_REUSE))
+               digest = LUKS2_digest_any_matching(cd, &cd->u.luks2.hdr, vk);
 
-uint64_t crypt_get_data_offset(struct crypt_device *cd)
-{
-       if (isPLAIN(cd->type))
-               return cd->u.plain.hdr.offset;
+       /* no segment flag or new vk flag requires new key digest */
+       if (flags & (CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_SET)) {
+               if (digest < 0 || !(flags & CRYPT_VOLUME_KEY_DIGEST_REUSE))
+                       digest = LUKS2_digest_create(cd, "pbkdf2", &cd->u.luks2.hdr, vk);
+       }
 
-       if (isLUKS(cd->type))
-               return cd->u.luks1.hdr.payloadOffset;
+       r = digest;
+       if (r < 0) {
+               log_err(cd, _("Volume key does not match the volume."));
+               goto out;
+       }
 
-       if (isLOOPAES(cd->type))
-               return cd->u.loopaes.hdr.offset;
+       r = LUKS2_keyslot_params_default(cd, &cd->u.luks2.hdr, &params);
+       if (r < 0) {
+               log_err(cd, _("Failed to initialize default LUKS2 keyslot parameters."));
+               goto out;
+       }
 
-       if (isTCRYPT(cd->type))
-               return TCRYPT_get_data_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+       r = LUKS2_digest_assign(cd, &cd->u.luks2.hdr, keyslot, digest, 1, 0);
+       if (r < 0) {
+               log_err(cd, _("Failed to assign keyslot %d to digest."), keyslot);
+               goto out;
+       }
 
-       return 0;
+       r = LUKS2_keyslot_store(cd, &cd->u.luks2.hdr, keyslot,
+                               passphrase, passphrase_size, vk, &params);
+
+       if (r >= 0 && (flags & CRYPT_VOLUME_KEY_SET))
+               r = update_volume_key_segment_digest(cd, &cd->u.luks2.hdr, digest, 1);
+out:
+       crypt_free_volume_key(vk);
+       if (r < 0) {
+               _luks2_reload(cd);
+               return r;
+       }
+       return keyslot;
 }
 
-uint64_t crypt_get_iv_offset(struct crypt_device *cd)
+/*
+ * Keyring handling
+ */
+
+int crypt_use_keyring_for_vk(struct crypt_device *cd)
 {
-       if (isPLAIN(cd->type))
-               return cd->u.plain.hdr.skip;
+       uint32_t dmc_flags;
 
-       if (isLUKS(cd->type))
+       /* dm backend must be initialized */
+       if (!cd || !isLUKS2(cd->type))
                return 0;
 
-       if (isLOOPAES(cd->type))
-               return cd->u.loopaes.hdr.skip;
+       if (!_vk_via_keyring || !kernel_keyring_support())
+               return 0;
 
-       if (isTCRYPT(cd->type))
-               return TCRYPT_get_iv_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
+       if (dm_flags(cd, DM_CRYPT, &dmc_flags))
+               return dmcrypt_keyring_bug() ? 0 : 1;
+
+       return (dmc_flags & DM_KERNEL_KEYRING_SUPPORTED);
+}
 
+int crypt_volume_key_keyring(struct crypt_device *cd, int enable)
+{
+       _vk_via_keyring = enable ? 1 : 0;
        return 0;
 }
 
-crypt_keyslot_info crypt_keyslot_status(struct crypt_device *cd, int keyslot)
+/* internal only */
+int crypt_volume_key_load_in_keyring(struct crypt_device *cd, struct volume_key *vk)
 {
-       if (onlyLUKS(cd) < 0)
-               return CRYPT_SLOT_INVALID;
+       int r;
+       const char *type_name = key_type_name(LOGON_KEY);
+
+       if (!vk || !cd || !type_name)
+               return -EINVAL;
+
+       if (!vk->key_description) {
+               log_dbg(cd, "Invalid key description");
+               return -EINVAL;
+       }
+
+       log_dbg(cd, "Loading key (%zu bytes, type %s) in thread keyring.", vk->keylength, type_name);
+
+       r = keyring_add_key_in_thread_keyring(LOGON_KEY, vk->key_description, vk->key, vk->keylength);
+       if (r) {
+               log_dbg(cd, "keyring_add_key_in_thread_keyring failed (error %d)", r);
+               log_err(cd, _("Failed to load key in kernel keyring."));
+       } else
+               crypt_set_key_in_keyring(cd, 1);
 
-       return LUKS_keyslot_info(&cd->u.luks1.hdr, keyslot);
+       return r;
 }
 
-int crypt_keyslot_max(const char *type)
+/* internal only */
+int crypt_key_in_keyring(struct crypt_device *cd)
 {
-       if (type && isLUKS(type))
-               return LUKS_NUMKEYS;
-
-       return -EINVAL;
+       return cd ? cd->key_in_keyring : 0;
 }
 
-int crypt_keyslot_area(struct crypt_device *cd,
-       int keyslot,
-       uint64_t *offset,
-       uint64_t *length)
+/* internal only */
+void crypt_set_key_in_keyring(struct crypt_device *cd, unsigned key_in_keyring)
 {
-       if (!isLUKS(cd->type))
-               return -EINVAL;
+       if (!cd)
+               return;
 
-       return LUKS_keyslot_area(&cd->u.luks1.hdr, keyslot, offset, length);
+       cd->key_in_keyring = key_in_keyring;
 }
 
-const char *crypt_get_type(struct crypt_device *cd)
+/* internal only */
+void crypt_drop_keyring_key_by_description(struct crypt_device *cd, const char *key_description, key_type_t ktype)
 {
-       return cd->type;
+       int r;
+       const char *type_name = key_type_name(ktype);
+
+       if (!key_description || !type_name)
+               return;
+
+       log_dbg(cd, "Requesting keyring %s key for revoke and unlink.", type_name);
+
+       r = keyring_revoke_and_unlink_key(ktype, key_description);
+       if (r)
+               log_dbg(cd, "keyring_revoke_and_unlink_key failed (error %d)", r);
+       crypt_set_key_in_keyring(cd, 0);
 }
 
-int crypt_get_verity_info(struct crypt_device *cd,
-       struct crypt_params_verity *vp)
+/* internal only */
+void crypt_drop_keyring_key(struct crypt_device *cd, struct volume_key *vks)
 {
-       if (!isVERITY(cd->type) || !vp)
-               return -EINVAL;
+       struct volume_key *vk = vks;
 
-       vp->data_device = device_path(cd->device);
-       vp->hash_device = mdata_device_path(cd);
-       vp->hash_name = cd->u.verity.hdr.hash_name;
-       vp->salt = cd->u.verity.hdr.salt;
-       vp->salt_size = cd->u.verity.hdr.salt_size;
-       vp->data_block_size = cd->u.verity.hdr.data_block_size;
-       vp->hash_block_size = cd->u.verity.hdr.hash_block_size;
-       vp->data_size = cd->u.verity.hdr.data_size;
-       vp->hash_area_offset = cd->u.verity.hdr.hash_area_offset;
-       vp->hash_type = cd->u.verity.hdr.hash_type;
-       vp->flags = cd->u.verity.hdr.flags & CRYPT_VERITY_NO_HEADER;
-       return 0;
+       while (vk) {
+               crypt_drop_keyring_key_by_description(cd, vk->key_description, LOGON_KEY);
+               vk = crypt_volume_key_next(vk);
+       }
 }
 
-int crypt_get_active_device(struct crypt_device *cd, const char *name,
-                           struct crypt_active_device *cad)
+int crypt_activate_by_keyring(struct crypt_device *cd,
+                             const char *name,
+                             const char *key_description,
+                             int keyslot,
+                             uint32_t flags)
 {
-       struct crypt_dm_active_device dmd;
+       char *passphrase;
+       size_t passphrase_size;
        int r;
 
-       r = dm_query_device(cd, name, 0, &dmd);
+       if (!cd || !key_description)
+               return -EINVAL;
+
+       log_dbg(cd, "%s volume %s [keyslot %d] using passphrase in keyring.",
+               name ? "Activating" : "Checking", name ?: "passphrase", keyslot);
+
+       if (!kernel_keyring_support()) {
+               log_err(cd, _("Kernel keyring is not supported by the kernel."));
+               return -EINVAL;
+       }
+
+       r = _activate_check_status(cd, name, flags & CRYPT_ACTIVATE_REFRESH);
        if (r < 0)
                return r;
 
-       if (dmd.target != DM_CRYPT && dmd.target != DM_VERITY)
-               return -ENOTSUP;
+       r = keyring_get_passphrase(key_description, &passphrase, &passphrase_size);
+       if (r < 0) {
+               log_err(cd, _("Failed to read passphrase from keyring (error %d)."), r);
+               return -EINVAL;
+       }
 
-       if (cd && isTCRYPT(cd->type)) {
-               cad->offset     = TCRYPT_get_data_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
-               cad->iv_offset  = TCRYPT_get_iv_offset(cd, &cd->u.tcrypt.hdr, &cd->u.tcrypt.params);
-       } else {
-               cad->offset     = dmd.u.crypt.offset;
-               cad->iv_offset  = dmd.u.crypt.iv_offset;
+       r = _activate_by_passphrase(cd, name, keyslot, passphrase, passphrase_size, flags);
+
+       crypt_safe_memzero(passphrase, passphrase_size);
+       free(passphrase);
+
+       return r;
+}
+
+/*
+ * Workaround for serialization of parallel activation and memory-hard PBKDF
+ * In specific situation (systemd activation) this causes OOM killer activation.
+ * For now, let's provide this ugly way to serialize unlocking of devices.
+ */
+int crypt_serialize_lock(struct crypt_device *cd)
+{
+       if (!cd->memory_hard_pbkdf_lock_enabled)
+               return 0;
+
+       log_dbg(cd, "Taking global memory-hard access serialization lock.");
+       if (crypt_write_lock(cd, "memory-hard-access", true, &cd->pbkdf_memory_hard_lock)) {
+               log_err(cd, _("Failed to acquire global memory-hard access serialization lock."));
+               cd->pbkdf_memory_hard_lock = NULL;
+               return -EINVAL;
        }
-       cad->size       = dmd.size;
-       cad->flags      = dmd.flags;
 
        return 0;
 }
+
+void crypt_serialize_unlock(struct crypt_device *cd)
+{
+       if (!cd->memory_hard_pbkdf_lock_enabled)
+               return;
+
+       crypt_unlock_internal(cd, cd->pbkdf_memory_hard_lock);
+       cd->pbkdf_memory_hard_lock = NULL;
+}
+
+crypt_reencrypt_info crypt_reencrypt_status(struct crypt_device *cd,
+               struct crypt_params_reencrypt *params)
+{
+       if (!cd || !isLUKS2(cd->type))
+               return CRYPT_REENCRYPT_NONE;
+
+       if (_onlyLUKS2(cd, CRYPT_CD_QUIET, CRYPT_REQUIREMENT_ONLINE_REENCRYPT))
+               return CRYPT_REENCRYPT_INVALID;
+
+       return LUKS2_reencrypt_status(cd, params);
+}
+
+static void __attribute__((destructor)) libcryptsetup_exit(void)
+{
+       crypt_backend_destroy();
+       crypt_random_exit();
+}
diff --git a/lib/tcrypt/Makefile.am b/lib/tcrypt/Makefile.am
deleted file mode 100644 (file)
index 88bf520..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-moduledir = $(libdir)/cryptsetup
-
-noinst_LTLIBRARIES = libtcrypt.la
-
-libtcrypt_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-
-libtcrypt_la_SOURCES = \
-       tcrypt.c \
-       tcrypt.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
-
diff --git a/lib/tcrypt/Makefile.in b/lib/tcrypt/Makefile.in
deleted file mode 100644 (file)
index 842f637..0000000
+++ /dev/null
@@ -1,645 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = lib/tcrypt
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libtcrypt_la_LIBADD =
-am_libtcrypt_la_OBJECTS = libtcrypt_la-tcrypt.lo
-libtcrypt_la_OBJECTS = $(am_libtcrypt_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libtcrypt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libtcrypt_la_CFLAGS) \
-       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libtcrypt_la_SOURCES)
-DIST_SOURCES = $(libtcrypt_la_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-moduledir = $(libdir)/cryptsetup
-noinst_LTLIBRARIES = libtcrypt.la
-libtcrypt_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-libtcrypt_la_SOURCES = \
-       tcrypt.c \
-       tcrypt.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/tcrypt/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/tcrypt/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
-       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-       @list='$(noinst_LTLIBRARIES)'; \
-       locs=`for p in $$list; do echo $$p; done | \
-             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-             sort -u`; \
-       test -z "$$locs" || { \
-         echo rm -f $${locs}; \
-         rm -f $${locs}; \
-       }
-
-libtcrypt.la: $(libtcrypt_la_OBJECTS) $(libtcrypt_la_DEPENDENCIES) $(EXTRA_libtcrypt_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libtcrypt_la_LINK)  $(libtcrypt_la_OBJECTS) $(libtcrypt_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtcrypt_la-tcrypt.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libtcrypt_la-tcrypt.lo: tcrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtcrypt_la_CFLAGS) $(CFLAGS) -MT libtcrypt_la-tcrypt.lo -MD -MP -MF $(DEPDIR)/libtcrypt_la-tcrypt.Tpo -c -o libtcrypt_la-tcrypt.lo `test -f 'tcrypt.c' || echo '$(srcdir)/'`tcrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libtcrypt_la-tcrypt.Tpo $(DEPDIR)/libtcrypt_la-tcrypt.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='tcrypt.c' object='libtcrypt_la-tcrypt.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtcrypt_la_CFLAGS) $(CFLAGS) -c -o libtcrypt_la-tcrypt.lo `test -f 'tcrypt.c' || echo '$(srcdir)/'`tcrypt.c
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-       clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-       ctags-am distclean distclean-compile distclean-generic \
-       distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
index 03b11ed..859f0ed 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * TCRYPT (TrueCrypt-compatible) and VeraCrypt volume handling
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2015, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,7 +23,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <fcntl.h>
 #include <assert.h>
 
 #include "libcryptsetup.h"
 #include "internal.h"
 
 /* TCRYPT PBKDF variants */
-static struct {
+static const struct {
        unsigned int legacy:1;
        unsigned int veracrypt:1;
        const char *name;
        const char *hash;
        unsigned int iterations;
+       uint32_t veracrypt_pim_const;
+       uint32_t veracrypt_pim_mult;
 } tcrypt_kdf[] = {
-       { 0, 0, "pbkdf2", "ripemd160", 2000 },
-       { 0, 0, "pbkdf2", "ripemd160", 1000 },
-       { 0, 0, "pbkdf2", "sha512",    1000 },
-       { 0, 0, "pbkdf2", "whirlpool", 1000 },
-       { 1, 0, "pbkdf2", "sha1",      2000 },
-       { 0, 1, "pbkdf2", "sha512",    500000 },
-       { 0, 1, "pbkdf2", "ripemd160", 655331 },
-       { 0, 1, "pbkdf2", "ripemd160", 327661 }, // boot only
-       { 0, 1, "pbkdf2", "whirlpool", 500000 },
-       { 0, 1, "pbkdf2", "sha256",    500000 }, // VeraCrypt 1.0f
-       { 0, 1, "pbkdf2", "sha256",    200000 }, // boot only
-       { 0, 0, NULL,     NULL,        0 }
+       { 0, 0, "pbkdf2", "ripemd160",   2000, 0, 0 },
+       { 0, 0, "pbkdf2", "ripemd160",   1000, 0, 0 },
+       { 0, 0, "pbkdf2", "sha512",      1000, 0, 0 },
+       { 0, 0, "pbkdf2", "whirlpool",   1000, 0, 0 },
+       { 1, 0, "pbkdf2", "sha1",        2000, 0, 0 },
+       { 0, 1, "pbkdf2", "sha512",    500000, 15000, 1000 },
+       { 0, 1, "pbkdf2", "whirlpool", 500000, 15000, 1000 },
+       { 0, 1, "pbkdf2", "sha256",    500000, 15000, 1000 }, // VeraCrypt 1.0f
+       { 0, 1, "pbkdf2", "sha256",    200000,     0, 2048 }, // boot only
+       { 0, 1, "pbkdf2", "ripemd160", 655331, 15000, 1000 },
+       { 0, 1, "pbkdf2", "ripemd160", 327661,     0, 2048 }, // boot only
+       { 0, 1, "pbkdf2", "stribog512",500000, 15000, 1000 },
+//     { 0, 1, "pbkdf2", "stribog512",200000,     0, 2048 }, // boot only
+       { 0, 0,     NULL,        NULL,      0,     0,    0 }
 };
 
 struct tcrypt_alg {
@@ -96,6 +99,26 @@ static struct tcrypt_algs tcrypt_cipher[] = {
 {0,2,128,"serpent-twofish","xts-plain64",
        {{"serpent",64,16, 0,64,0},
         {"twofish",64,16,32,96,0}}},
+{0,1,64,"camellia","xts-plain64",
+       {{"camellia",    64,16,0,32,0}}},
+{0,1,64,"kuznyechik","xts-plain64",
+       {{"kuznyechik",  64,16,0,32,0}}},
+{0,2,128,"kuznyechik-camellia","xts-plain64",
+       {{"kuznyechik",64,16, 0,64,0},
+        {"camellia",  64,16,32,96,0}}},
+{0,2,128,"twofish-kuznyechik","xts-plain64",
+       {{"twofish",   64,16, 0,64,0},
+        {"kuznyechik",64,16,32,96,0}}},
+{0,2,128,"serpent-camellia","xts-plain64",
+       {{"serpent",   64,16, 0,64,0},
+        {"camellia",  64,16,32,96,0}}},
+{0,2,128,"aes-kuznyechik","xts-plain64",
+       {{"aes",       64,16, 0,64,0},
+        {"kuznyechik",64,16,32,96,0}}},
+{0,3,192,"camellia-serpent-kuznyechik","xts-plain64",
+       {{"camellia",  64,16, 0, 96,0},
+        {"serpent",   64,16,32,128,0},
+        {"kuznyechik",64,16,64,160,0}}},
 
 /* LRW mode */
 {0,1,48,"aes","lrw-benbi",
@@ -178,7 +201,8 @@ static struct tcrypt_algs tcrypt_cipher[] = {
 {}
 };
 
-static int TCRYPT_hdr_from_disk(struct tcrypt_phdr *hdr,
+static int TCRYPT_hdr_from_disk(struct crypt_device *cd,
+                               struct tcrypt_phdr *hdr,
                                struct crypt_params_tcrypt *params,
                                int kdf_index, int cipher_index)
 {
@@ -190,14 +214,14 @@ static int TCRYPT_hdr_from_disk(struct tcrypt_phdr *hdr,
        crc32 = crypt_crc32(~0, (unsigned char*)&hdr->d, size) ^ ~0;
        if (be16_to_cpu(hdr->d.version) > 3 &&
            crc32 != be32_to_cpu(hdr->d.header_crc32)) {
-               log_dbg("TCRYPT header CRC32 mismatch.");
+               log_dbg(cd, "TCRYPT header CRC32 mismatch.");
                return -EINVAL;
        }
 
        /* Check CRC32 of keys */
        crc32 = crypt_crc32(~0, (unsigned char*)hdr->d.keys, sizeof(hdr->d.keys)) ^ ~0;
        if (crc32 != be32_to_cpu(hdr->d.keys_crc32)) {
-               log_dbg("TCRYPT keys CRC32 mismatch.");
+               log_dbg(cd, "TCRYPT keys CRC32 mismatch.");
                return -EINVAL;
        }
 
@@ -276,8 +300,8 @@ static int decrypt_blowfish_le_cbc(struct tcrypt_alg *alg,
        }
 
        crypt_cipher_destroy(cipher);
-       crypt_memzero(iv, bs);
-       crypt_memzero(iv_old, bs);
+       crypt_safe_memzero(iv, bs);
+       crypt_safe_memzero(iv_old, bs);
        return r;
 }
 
@@ -314,12 +338,13 @@ static int TCRYPT_decrypt_hdr_one(struct tcrypt_alg *alg, const char *mode,
 {
        char backend_key[TCRYPT_HDR_KEY_LEN];
        char iv[TCRYPT_HDR_IV_LEN] = {};
-       char mode_name[MAX_CIPHER_LEN];
+       char mode_name[MAX_CIPHER_LEN + 1];
        struct crypt_cipher *cipher;
        char *c, *buf = (char*)&hdr->e;
        int r;
 
        /* Remove IV if present */
+       mode_name[MAX_CIPHER_LEN] = '\0';
        strncpy(mode_name, mode, MAX_CIPHER_LEN);
        c = strchr(mode_name, '-');
        if (c)
@@ -343,13 +368,13 @@ static int TCRYPT_decrypt_hdr_one(struct tcrypt_alg *alg, const char *mode,
                crypt_cipher_destroy(cipher);
        }
 
-       crypt_memzero(backend_key, sizeof(backend_key));
-       crypt_memzero(iv, TCRYPT_HDR_IV_LEN);
+       crypt_safe_memzero(backend_key, sizeof(backend_key));
+       crypt_safe_memzero(iv, TCRYPT_HDR_IV_LEN);
        return r;
 }
 
 /*
- * For chanined ciphers and CBC mode we need "outer" decryption.
+ * For chained ciphers and CBC mode we need "outer" decryption.
  * Backend doesn't provide this, so implement it here directly using ECB.
  */
 static int TCRYPT_decrypt_cbci(struct tcrypt_algs *ciphers,
@@ -394,8 +419,8 @@ out:
                if (cipher[j])
                        crypt_cipher_destroy(cipher[j]);
 
-       crypt_memzero(iv, bs);
-       crypt_memzero(iv_old, bs);
+       crypt_safe_memzero(iv, bs);
+       crypt_safe_memzero(iv_old, bs);
        return r;
 }
 
@@ -408,7 +433,7 @@ static int TCRYPT_decrypt_hdr(struct crypt_device *cd, struct tcrypt_phdr *hdr,
        for (i = 0; tcrypt_cipher[i].chain_count; i++) {
                if (!(flags & CRYPT_TCRYPT_LEGACY_MODES) && tcrypt_cipher[i].legacy)
                        continue;
-               log_dbg("TCRYPT:  trying cipher %s-%s",
+               log_dbg(cd, "TCRYPT:  trying cipher %s-%s",
                        tcrypt_cipher[i].long_name, tcrypt_cipher[i].mode);
 
                memcpy(&hdr2.e, &hdr->e, TCRYPT_HDR_LEN);
@@ -425,7 +450,7 @@ static int TCRYPT_decrypt_hdr(struct crypt_device *cd, struct tcrypt_phdr *hdr,
                }
 
                if (r < 0) {
-                       log_dbg("TCRYPT:   returned error %d, skipped.", r);
+                       log_dbg(cd, "TCRYPT:   returned error %d, skipped.", r);
                        if (r == -ENOTSUP)
                                break;
                        r = -ENOENT;
@@ -433,14 +458,14 @@ static int TCRYPT_decrypt_hdr(struct crypt_device *cd, struct tcrypt_phdr *hdr,
                }
 
                if (!strncmp(hdr2.d.magic, TCRYPT_HDR_MAGIC, TCRYPT_HDR_MAGIC_LEN)) {
-                       log_dbg("TCRYPT: Signature magic detected.");
+                       log_dbg(cd, "TCRYPT: Signature magic detected.");
                        memcpy(&hdr->e, &hdr2.e, TCRYPT_HDR_LEN);
                        r = i;
                        break;
                }
                if ((flags & CRYPT_TCRYPT_VERA_MODES) &&
                     !strncmp(hdr2.d.magic, VCRYPT_HDR_MAGIC, TCRYPT_HDR_MAGIC_LEN)) {
-                       log_dbg("TCRYPT: Signature magic detected (Veracrypt).");
+                       log_dbg(cd, "TCRYPT: Signature magic detected (Veracrypt).");
                        memcpy(&hdr->e, &hdr2.e, TCRYPT_HDR_LEN);
                        r = i;
                        break;
@@ -448,32 +473,36 @@ static int TCRYPT_decrypt_hdr(struct crypt_device *cd, struct tcrypt_phdr *hdr,
                r = -EPERM;
        }
 
-       crypt_memzero(&hdr2, sizeof(hdr2));
+       crypt_safe_memzero(&hdr2, sizeof(hdr2));
        return r;
 }
 
 static int TCRYPT_pool_keyfile(struct crypt_device *cd,
-                               unsigned char pool[TCRYPT_KEY_POOL_LEN],
-                               const char *keyfile)
+                               unsigned char pool[VCRYPT_KEY_POOL_LEN],
+                               const char *keyfile, int keyfiles_pool_length)
 {
-       unsigned char data[TCRYPT_KEYFILE_LEN];
-       int i, j, fd, data_size;
+       unsigned char *data;
+       int i, j, fd, data_size, r = -EIO;
        uint32_t crc;
 
-       log_dbg("TCRYPT: using keyfile %s.", keyfile);
+       log_dbg(cd, "TCRYPT: using keyfile %s.", keyfile);
+
+       data = malloc(TCRYPT_KEYFILE_LEN);
+       if (!data)
+               return -ENOMEM;
+       memset(data, 0, TCRYPT_KEYFILE_LEN);
 
        fd = open(keyfile, O_RDONLY);
        if (fd < 0) {
-               log_err(cd, _("Failed to open key file.\n"));
-               return -EIO;
+               log_err(cd, _("Failed to open key file."));
+               goto out;
        }
 
-       /* FIXME: add while */
-       data_size = read(fd, data, TCRYPT_KEYFILE_LEN);
+       data_size = read_buffer(fd, data, TCRYPT_KEYFILE_LEN);
        close(fd);
        if (data_size < 0) {
-               log_err(cd, _("Error reading keyfile %s.\n"), keyfile);
-               return -EIO;
+               log_err(cd, _("Error reading keyfile %s."), keyfile);
+               goto out;
        }
 
        for (i = 0, j = 0, crc = ~0U; i < data_size; i++) {
@@ -482,42 +511,54 @@ static int TCRYPT_pool_keyfile(struct crypt_device *cd,
                pool[j++] += (unsigned char)(crc >> 16);
                pool[j++] += (unsigned char)(crc >>  8);
                pool[j++] += (unsigned char)(crc);
-               j %= TCRYPT_KEY_POOL_LEN;
+               j %= keyfiles_pool_length;
        }
+       r = 0;
+out:
+       crypt_safe_memzero(&crc, sizeof(crc));
+       crypt_safe_memzero(data, TCRYPT_KEYFILE_LEN);
+       free(data);
 
-       crypt_memzero(&crc, sizeof(crc));
-       crypt_memzero(data, TCRYPT_KEYFILE_LEN);
-
-       return 0;
+       return r;
 }
 
 static int TCRYPT_init_hdr(struct crypt_device *cd,
                           struct tcrypt_phdr *hdr,
                           struct crypt_params_tcrypt *params)
 {
-       unsigned char pwd[TCRYPT_KEY_POOL_LEN] = {};
-       size_t passphrase_size;
+       unsigned char pwd[VCRYPT_KEY_POOL_LEN] = {};
+       size_t passphrase_size, max_passphrase_size;
        char *key;
-       unsigned int i, skipped = 0;
-       int r = -EPERM;
+       unsigned int i, skipped = 0, iterations;
+       int r = -EPERM, keyfiles_pool_length;
 
        if (posix_memalign((void*)&key, crypt_getpagesize(), TCRYPT_HDR_KEY_LEN))
                return -ENOMEM;
 
+       if (params->flags & CRYPT_TCRYPT_VERA_MODES &&
+           params->passphrase_size > TCRYPT_KEY_POOL_LEN) {
+               /* Really. Keyfile pool length depends on passphrase size in Veracrypt. */
+               max_passphrase_size = VCRYPT_KEY_POOL_LEN;
+               keyfiles_pool_length = VCRYPT_KEY_POOL_LEN;
+       } else {
+               max_passphrase_size = TCRYPT_KEY_POOL_LEN;
+               keyfiles_pool_length = TCRYPT_KEY_POOL_LEN;
+       }
+
        if (params->keyfiles_count)
-               passphrase_size = TCRYPT_KEY_POOL_LEN;
+               passphrase_size = max_passphrase_size;
        else
                passphrase_size = params->passphrase_size;
 
-       if (params->passphrase_size > TCRYPT_KEY_POOL_LEN) {
-               log_err(cd, _("Maximum TCRYPT passphrase length (%d) exceeded.\n"),
-                             TCRYPT_KEY_POOL_LEN);
+       if (params->passphrase_size > max_passphrase_size) {
+               log_err(cd, _("Maximum TCRYPT passphrase length (%zu) exceeded."),
+                             max_passphrase_size);
                goto out;
        }
 
        /* Calculate pool content from keyfiles */
        for (i = 0; i < params->keyfiles_count; i++) {
-               r = TCRYPT_pool_keyfile(cd, pwd, params->keyfiles[i]);
+               r = TCRYPT_pool_keyfile(cd, pwd, params->keyfiles[i], keyfiles_pool_length);
                if (r < 0)
                        goto out;
        }
@@ -531,21 +572,30 @@ static int TCRYPT_init_hdr(struct crypt_device *cd,
                        continue;
                if (!(params->flags & CRYPT_TCRYPT_VERA_MODES) && tcrypt_kdf[i].veracrypt)
                        continue;
+               if ((params->flags & CRYPT_TCRYPT_VERA_MODES) && params->veracrypt_pim) {
+                       /* Do not try TrueCrypt modes if we have PIM value */
+                       if (!tcrypt_kdf[i].veracrypt)
+                               continue;
+                       /* adjust iterations to given PIM cmdline parameter */
+                       iterations = tcrypt_kdf[i].veracrypt_pim_const +
+                                   (tcrypt_kdf[i].veracrypt_pim_mult * params->veracrypt_pim);
+               } else
+                       iterations = tcrypt_kdf[i].iterations;
+
                /* Derive header key */
-               log_dbg("TCRYPT: trying KDF: %s-%s-%d.",
-                       tcrypt_kdf[i].name, tcrypt_kdf[i].hash, tcrypt_kdf[i].iterations);
+               log_dbg(cd, "TCRYPT: trying KDF: %s-%s-%d%s.",
+                       tcrypt_kdf[i].name, tcrypt_kdf[i].hash, tcrypt_kdf[i].iterations,
+                       params->veracrypt_pim && tcrypt_kdf[i].veracrypt ? "-PIM" : "");
                r = crypt_pbkdf(tcrypt_kdf[i].name, tcrypt_kdf[i].hash,
                                (char*)pwd, passphrase_size,
                                hdr->salt, TCRYPT_HDR_SALT_LEN,
                                key, TCRYPT_HDR_KEY_LEN,
-                               tcrypt_kdf[i].iterations);
-               if (r < 0 && crypt_hash_size(tcrypt_kdf[i].hash) < 0) {
-                       log_verbose(cd, _("PBKDF2 hash algorithm %s not available, skipping.\n"),
+                               iterations, 0, 0);
+               if (r < 0) {
+                       log_verbose(cd, _("PBKDF2 hash algorithm %s not available, skipping."),
                                      tcrypt_kdf[i].hash);
                        continue;
                }
-               if (r < 0)
-                       break;
 
                /* Decrypt header */
                r = TCRYPT_decrypt_hdr(cd, hdr, key, params->flags);
@@ -558,29 +608,29 @@ static int TCRYPT_init_hdr(struct crypt_device *cd,
        }
 
        if ((r < 0 && r != -EPERM && skipped && skipped == i) || r == -ENOTSUP) {
-               log_err(cd, _("Required kernel crypto interface not available.\n"));
+               log_err(cd, _("Required kernel crypto interface not available."));
 #ifdef ENABLE_AF_ALG
-               log_err(cd, _("Ensure you have algif_skcipher kernel module loaded.\n"));
+               log_err(cd, _("Ensure you have algif_skcipher kernel module loaded."));
 #endif
        }
        if (r < 0)
                goto out;
 
-       r = TCRYPT_hdr_from_disk(hdr, params, i, r);
+       r = TCRYPT_hdr_from_disk(cd, hdr, params, i, r);
        if (!r) {
-               log_dbg("TCRYPT: Magic: %s, Header version: %d, req. %d, sector %d"
+               log_dbg(cd, "TCRYPT: Magic: %s, Header version: %d, req. %d, sector %d"
                        ", mk_offset %" PRIu64 ", hidden_size %" PRIu64
                        ", volume size %" PRIu64, tcrypt_kdf[i].veracrypt ?
                        VCRYPT_HDR_MAGIC : TCRYPT_HDR_MAGIC,
                        (int)hdr->d.version, (int)hdr->d.version_tc, (int)hdr->d.sector_size,
                        hdr->d.mk_offset, hdr->d.hidden_volume_size, hdr->d.volume_size);
-               log_dbg("TCRYPT: Header cipher %s-%s, key size %zu",
+               log_dbg(cd, "TCRYPT: Header cipher %s-%s, key size %zu",
                        params->cipher, params->mode, params->key_size);
        }
 out:
-       crypt_memzero(pwd, TCRYPT_KEY_POOL_LEN);
+       crypt_safe_memzero(pwd, TCRYPT_KEY_POOL_LEN);
        if (key)
-               crypt_memzero(key, TCRYPT_HDR_KEY_LEN);
+               crypt_safe_memzero(key, TCRYPT_HDR_KEY_LEN);
        free(key);
        return r;
 }
@@ -589,70 +639,71 @@ int TCRYPT_read_phdr(struct crypt_device *cd,
                     struct tcrypt_phdr *hdr,
                     struct crypt_params_tcrypt *params)
 {
-       struct device *base_device, *device = crypt_metadata_device(cd);
+       struct device *base_device = NULL, *device = crypt_metadata_device(cd);
        ssize_t hdr_size = sizeof(struct tcrypt_phdr);
        char *base_device_path;
-       int devfd = 0, r, bs;
+       int devfd, r;
 
        assert(sizeof(struct tcrypt_phdr) == 512);
 
-       log_dbg("Reading TCRYPT header of size %zu bytes from device %s.",
+       log_dbg(cd, "Reading TCRYPT header of size %zu bytes from device %s.",
                hdr_size, device_path(device));
 
-       bs = device_block_size(device);
-       if (bs < 0)
-               return bs;
-
        if (params->flags & CRYPT_TCRYPT_SYSTEM_HEADER &&
            crypt_dev_is_partition(device_path(device))) {
                base_device_path = crypt_get_base_device(device_path(device));
 
-               log_dbg("Reading TCRYPT system header from device %s.", base_device_path ?: "?");
+               log_dbg(cd, "Reading TCRYPT system header from device %s.", base_device_path ?: "?");
                if (!base_device_path)
                        return -EINVAL;
 
-               r = device_alloc(&base_device, base_device_path);
+               r = device_alloc(cd, &base_device, base_device_path);
+               free(base_device_path);
                if (r < 0)
                        return r;
-               devfd = device_open(base_device, O_RDONLY);
-               free(base_device_path);
-               device_free(base_device);
+               devfd = device_open(cd, base_device, O_RDONLY);
        } else
-               devfd = device_open(device, O_RDONLY);
+               devfd = device_open(cd, device, O_RDONLY);
 
-       if (devfd == -1) {
-               log_err(cd, _("Cannot open device %s.\n"), device_path(device));
+       if (devfd < 0) {
+               device_free(cd, base_device);
+               log_err(cd, _("Cannot open device %s."), device_path(device));
                return -EINVAL;
        }
 
        r = -EIO;
        if (params->flags & CRYPT_TCRYPT_SYSTEM_HEADER) {
-               if (lseek(devfd, TCRYPT_HDR_SYSTEM_OFFSET, SEEK_SET) >= 0 &&
-                   read_blockwise(devfd, bs, hdr, hdr_size) == hdr_size) {
+               if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                       device_alignment(device), hdr, hdr_size,
+                       TCRYPT_HDR_SYSTEM_OFFSET) == hdr_size) {
                        r = TCRYPT_init_hdr(cd, hdr, params);
                }
        } else if (params->flags & CRYPT_TCRYPT_HIDDEN_HEADER) {
                if (params->flags & CRYPT_TCRYPT_BACKUP_HEADER) {
-                       if (lseek(devfd, TCRYPT_HDR_HIDDEN_OFFSET_BCK, SEEK_END) >= 0 &&
-                           read_blockwise(devfd, bs, hdr, hdr_size) == hdr_size)
+                       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                               device_alignment(device), hdr, hdr_size,
+                               TCRYPT_HDR_HIDDEN_OFFSET_BCK) == hdr_size)
                                r = TCRYPT_init_hdr(cd, hdr, params);
                } else {
-                       if (lseek(devfd, TCRYPT_HDR_HIDDEN_OFFSET, SEEK_SET) >= 0 &&
-                           read_blockwise(devfd, bs, hdr, hdr_size) == hdr_size)
+                       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                               device_alignment(device), hdr, hdr_size,
+                               TCRYPT_HDR_HIDDEN_OFFSET) == hdr_size)
                                r = TCRYPT_init_hdr(cd, hdr, params);
-                       if (r &&
-                           lseek(devfd, TCRYPT_HDR_HIDDEN_OFFSET_OLD, SEEK_END) >= 0 &&
-                           read_blockwise(devfd, bs, hdr, hdr_size) == hdr_size)
+                       if (r && read_lseek_blockwise(devfd, device_block_size(cd, device),
+                               device_alignment(device), hdr, hdr_size,
+                               TCRYPT_HDR_HIDDEN_OFFSET_OLD) == hdr_size)
                                r = TCRYPT_init_hdr(cd, hdr, params);
                }
        } else if (params->flags & CRYPT_TCRYPT_BACKUP_HEADER) {
-               if (lseek(devfd, TCRYPT_HDR_OFFSET_BCK, SEEK_END) >= 0 &&
-                           read_blockwise(devfd, bs, hdr, hdr_size) == hdr_size)
+               if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                       device_alignment(device), hdr, hdr_size,
+                       TCRYPT_HDR_OFFSET_BCK) == hdr_size)
                        r = TCRYPT_init_hdr(cd, hdr, params);
-       } else if (read_blockwise(devfd, bs, hdr, hdr_size) == hdr_size)
+       } else if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                       device_alignment(device), hdr, hdr_size, 0) == hdr_size)
                r = TCRYPT_init_hdr(cd, hdr, params);
 
-       close(devfd);
+       device_free(cd, base_device);
        if (r < 0)
                memset(hdr, 0, sizeof (*hdr));
        return r;
@@ -679,38 +730,33 @@ int TCRYPT_activate(struct crypt_device *cd,
                     struct crypt_params_tcrypt *params,
                     uint32_t flags)
 {
-       char cipher[MAX_CIPHER_LEN], dm_name[PATH_MAX], dm_dev_name[PATH_MAX];
+       char dm_name[PATH_MAX], dm_dev_name[PATH_MAX], cipher_spec[MAX_CIPHER_LEN*2+1];
        char *part_path;
-       struct device *device = NULL, *part_device = NULL;
        unsigned int i;
        int r;
-       uint32_t req_flags;
+       uint32_t req_flags, dmc_flags;
        struct tcrypt_algs *algs;
        enum devcheck device_check;
+       uint64_t offset = crypt_get_data_offset(cd);
+       struct volume_key *vk = NULL;
+       struct device  *ptr_dev = crypt_data_device(cd), *device = NULL, *part_device = NULL;
        struct crypt_dm_active_device dmd = {
-               .target = DM_CRYPT,
-               .size   = 0,
-               .data_device = crypt_data_device(cd),
-               .u.crypt  = {
-                       .cipher = cipher,
-                       .offset = crypt_get_data_offset(cd),
-                       .iv_offset = crypt_get_iv_offset(cd),
-               }
+               .flags = flags
        };
 
        if (!hdr->d.version) {
-               log_dbg("TCRYPT: this function is not supported without encrypted header load.");
+               log_dbg(cd, "TCRYPT: this function is not supported without encrypted header load.");
                return -ENOTSUP;
        }
 
        if (hdr->d.sector_size && hdr->d.sector_size != SECTOR_SIZE) {
-               log_err(cd, _("Activation is not supported for %d sector size.\n"),
+               log_err(cd, _("Activation is not supported for %d sector size."),
                        hdr->d.sector_size);
                return -ENOTSUP;
        }
 
        if (strstr(params->mode, "-tcrypt")) {
-               log_err(cd, _("Kernel doesn't support activation for this TCRYPT legacy mode.\n"));
+               log_err(cd, _("Kernel does not support activation for this TCRYPT legacy mode."));
                return -ENOTSUP;
        }
 
@@ -723,6 +769,9 @@ int TCRYPT_activate(struct crypt_device *cd,
        if (!algs)
                return -EINVAL;
 
+       if (hdr->d.sector_size == 0)
+               return -EINVAL;
+
        if (params->flags & CRYPT_TCRYPT_SYSTEM_HEADER)
                dmd.size = 0;
        else if (params->flags & CRYPT_TCRYPT_HIDDEN_HEADER)
@@ -731,20 +780,20 @@ int TCRYPT_activate(struct crypt_device *cd,
                dmd.size = hdr->d.volume_size / hdr->d.sector_size;
 
        if (dmd.flags & CRYPT_ACTIVATE_SHARED)
-               device_check = DEV_SHARED;
+               device_check = DEV_OK;
        else
                device_check = DEV_EXCL;
 
        if ((params->flags & CRYPT_TCRYPT_SYSTEM_HEADER) &&
-            !crypt_dev_is_partition(device_path(dmd.data_device))) {
-               part_path = crypt_get_partition_device(device_path(dmd.data_device),
-                                                      dmd.u.crypt.offset, dmd.size);
+            !crypt_dev_is_partition(device_path(crypt_data_device(cd)))) {
+               part_path = crypt_get_partition_device(device_path(crypt_data_device(cd)),
+                                                      crypt_get_data_offset(cd), dmd.size);
                if (part_path) {
-                       if (!device_alloc(&part_device, part_path)) {
-                               log_verbose(cd, _("Activating TCRYPT system encryption for partition %s.\n"),
+                       if (!device_alloc(cd, &part_device, part_path)) {
+                               log_verbose(cd, _("Activating TCRYPT system encryption for partition %s."),
                                            part_path);
-                               dmd.data_device = part_device;
-                               dmd.u.crypt.offset = 0;
+                               ptr_dev = part_device;
+                               offset = 0;
                        }
                        free(part_path);
                } else
@@ -752,70 +801,88 @@ int TCRYPT_activate(struct crypt_device *cd,
                         * System encryption use the whole device mapping, there can
                         * be active partitions.
                         */
-                       device_check = DEV_SHARED;
+                       device_check = DEV_OK;
        }
 
-       r = device_block_adjust(cd, dmd.data_device, device_check,
-                               dmd.u.crypt.offset, &dmd.size, &dmd.flags);
+       r = device_block_adjust(cd, ptr_dev, device_check,
+                               offset, &dmd.size, &dmd.flags);
        if (r)
-               return r;
+               goto out;
 
-       /* Frome here, key size for every cipher must be the same */
-       dmd.u.crypt.vk = crypt_alloc_volume_key(algs->cipher[0].key_size +
-                                               algs->cipher[0].key_extra_size, NULL);
-       if (!dmd.u.crypt.vk)
-               return -ENOMEM;
+       /* From here, key size for every cipher must be the same */
+       vk = crypt_alloc_volume_key(algs->cipher[0].key_size +
+                                   algs->cipher[0].key_extra_size, NULL);
+       if (!vk) {
+               r = -ENOMEM;
+               goto out;
+       }
 
        for (i = algs->chain_count; i > 0; i--) {
                if (i == 1) {
-                       strncpy(dm_name, name, sizeof(dm_name));
+                       dm_name[sizeof(dm_name)-1] = '\0';
+                       strncpy(dm_name, name, sizeof(dm_name)-1);
                        dmd.flags = flags;
                } else {
                        snprintf(dm_name, sizeof(dm_name), "%s_%d", name, i-1);
                        dmd.flags = flags | CRYPT_ACTIVATE_PRIVATE;
                }
 
-               snprintf(cipher, sizeof(cipher), "%s-%s",
-                        algs->cipher[i-1].name, algs->mode);
-
                TCRYPT_copy_key(&algs->cipher[i-1], algs->mode,
-                               dmd.u.crypt.vk->key, hdr->d.keys);
+                               vk->key, hdr->d.keys);
 
                if (algs->chain_count != i) {
                        snprintf(dm_dev_name, sizeof(dm_dev_name), "%s/%s_%d",
                                 dm_get_dir(), name, i);
-                       r = device_alloc(&device, dm_dev_name);
+                       r = device_alloc(cd, &device, dm_dev_name);
                        if (r)
                                break;
-                       dmd.data_device = device;
-                       dmd.u.crypt.offset = 0;
+                       ptr_dev = device;
+                       offset = 0;
                }
 
-               log_dbg("Trying to activate TCRYPT device %s using cipher %s.",
-                       dm_name, dmd.u.crypt.cipher);
-               r = dm_create_device(cd, dm_name, CRYPT_TCRYPT, &dmd, 0);
+               r = snprintf(cipher_spec, sizeof(cipher_spec), "%s-%s", algs->cipher[i-1].name, algs->mode);
+               if (r < 0 || (size_t)r >= sizeof(cipher_spec)) {
+                       r = -ENOMEM;
+                       break;
+               }
 
-               device_free(device);
+               r = dm_crypt_target_set(&dmd.segment, 0, dmd.size, ptr_dev, vk,
+                               cipher_spec, crypt_get_iv_offset(cd), offset,
+                               crypt_get_integrity(cd),
+                               crypt_get_integrity_tag_size(cd),
+                               crypt_get_sector_size(cd));
+               if (r)
+                       break;
+
+               log_dbg(cd, "Trying to activate TCRYPT device %s using cipher %s.",
+                       dm_name, dmd.segment.u.crypt.cipher);
+               r = dm_create_device(cd, dm_name, CRYPT_TCRYPT, &dmd);
+
+               dm_targets_free(cd, &dmd);
+               device_free(cd, device);
                device = NULL;
 
                if (r)
                        break;
        }
 
-       if (r < 0 && !(dm_flags() & req_flags)) {
-               log_err(cd, _("Kernel doesn't support TCRYPT compatible mapping.\n"));
+       if (r < 0 &&
+           (dm_flags(cd, DM_CRYPT, &dmc_flags) || ((dmc_flags & req_flags) != req_flags))) {
+               log_err(cd, _("Kernel does not support TCRYPT compatible mapping."));
                r = -ENOTSUP;
        }
 
-       device_free(part_device);
-       crypt_free_volume_key(dmd.u.crypt.vk);
+out:
+       crypt_free_volume_key(vk);
+       device_free(cd, device);
+       device_free(cd, part_device);
        return r;
 }
 
 static int TCRYPT_remove_one(struct crypt_device *cd, const char *name,
-                     const char *base_uuid, int index)
+                     const char *base_uuid, int index, uint32_t flags)
 {
-       struct crypt_dm_active_device dmd = {};
+       struct crypt_dm_active_device dmd;
        char dm_name[PATH_MAX];
        int r;
 
@@ -828,15 +895,15 @@ static int TCRYPT_remove_one(struct crypt_device *cd, const char *name,
 
        r = dm_query_device(cd, dm_name, DM_ACTIVE_UUID, &dmd);
        if (!r && !strncmp(dmd.uuid, base_uuid, strlen(base_uuid)))
-               r = dm_remove_device(cd, dm_name, 0, 0);
+               r = dm_remove_device(cd, dm_name, flags);
 
        free(CONST_CAST(void*)dmd.uuid);
        return r;
 }
 
-int TCRYPT_deactivate(struct crypt_device *cd, const char *name)
+int TCRYPT_deactivate(struct crypt_device *cd, const char *name, uint32_t flags)
 {
-       struct crypt_dm_active_device dmd = {};
+       struct crypt_dm_active_device dmd;
        int r;
 
        r = dm_query_device(cd, name, DM_ACTIVE_UUID, &dmd);
@@ -845,28 +912,28 @@ int TCRYPT_deactivate(struct crypt_device *cd, const char *name)
        if (!dmd.uuid)
                return -EINVAL;
 
-       r = dm_remove_device(cd, name, 0, 0);
+       r = dm_remove_device(cd, name, flags);
        if (r < 0)
                goto out;
 
-       r = TCRYPT_remove_one(cd, name, dmd.uuid, 1);
+       r = TCRYPT_remove_one(cd, name, dmd.uuid, 1, flags);
        if (r < 0)
                goto out;
 
-       r = TCRYPT_remove_one(cd, name, dmd.uuid, 2);
-       if (r < 0)
-               goto out;
+       r = TCRYPT_remove_one(cd, name, dmd.uuid, 2, flags);
 out:
        free(CONST_CAST(void*)dmd.uuid);
        return (r == -ENODEV) ? 0 : r;
 }
 
 static int TCRYPT_status_one(struct crypt_device *cd, const char *name,
-                             const char *base_uuid, int index,
-                             size_t *key_size, char *cipher,
-                             uint64_t *data_offset, struct device **device)
+                            const char *base_uuid, int index,
+                            size_t *key_size, char *cipher,
+                            struct tcrypt_phdr *tcrypt_hdr,
+                            struct device **device)
 {
-       struct crypt_dm_active_device dmd = {};
+       struct crypt_dm_active_device dmd;
+       struct dm_target *tgt = &dmd.segment;
        char dm_name[PATH_MAX], *c;
        int r;
 
@@ -881,57 +948,63 @@ static int TCRYPT_status_one(struct crypt_device *cd, const char *name,
                                          DM_ACTIVE_UUID |
                                          DM_ACTIVE_CRYPT_CIPHER |
                                          DM_ACTIVE_CRYPT_KEYSIZE, &dmd);
-       if (r > 0)
-               r = 0;
-       if (!r && !strncmp(dmd.uuid, base_uuid, strlen(base_uuid))) {
-               if ((c = strchr(dmd.u.crypt.cipher, '-')))
+       if (r < 0)
+               return r;
+       if (!single_segment(&dmd) || tgt->type != DM_CRYPT) {
+               r = -ENOTSUP;
+               goto out;
+       }
+
+       r = 0;
+
+       if (!strncmp(dmd.uuid, base_uuid, strlen(base_uuid))) {
+               if ((c = strchr(tgt->u.crypt.cipher, '-')))
                        *c = '\0';
                strcat(cipher, "-");
-               strncat(cipher, dmd.u.crypt.cipher, MAX_CIPHER_LEN);
-               *key_size += dmd.u.crypt.vk->keylength;
-               *data_offset = dmd.u.crypt.offset * SECTOR_SIZE;
-               device_free(*device);
-               *device = dmd.data_device;
-       } else {
-               device_free(dmd.data_device);
+               strncat(cipher, tgt->u.crypt.cipher, MAX_CIPHER_LEN);
+               *key_size += tgt->u.crypt.vk->keylength;
+               tcrypt_hdr->d.mk_offset = tgt->u.crypt.offset * SECTOR_SIZE;
+               device_free(cd, *device);
+               MOVE_REF(*device, tgt->data_device);
+       } else
                r = -ENODEV;
-       }
-
+out:
+       dm_targets_free(cd, &dmd);
        free(CONST_CAST(void*)dmd.uuid);
-       free(CONST_CAST(void*)dmd.u.crypt.cipher);
-       crypt_free_volume_key(dmd.u.crypt.vk);
        return r;
 }
 
 int TCRYPT_init_by_name(struct crypt_device *cd, const char *name,
-                       const struct crypt_dm_active_device *dmd,
+                       const char *uuid,
+                       const struct dm_target *tgt,
                        struct device **device,
                        struct crypt_params_tcrypt *tcrypt_params,
                        struct tcrypt_phdr *tcrypt_hdr)
 {
        struct tcrypt_algs *algs;
-       char cipher[MAX_CIPHER_LEN * 4], mode[MAX_CIPHER_LEN], *tmp;
+       char cipher[MAX_CIPHER_LEN * 4], mode[MAX_CIPHER_LEN+1], *tmp;
        size_t key_size;
        int r;
 
        memset(tcrypt_params, 0, sizeof(*tcrypt_params));
        memset(tcrypt_hdr, 0, sizeof(*tcrypt_hdr));
        tcrypt_hdr->d.sector_size = SECTOR_SIZE;
-       tcrypt_hdr->d.mk_offset = dmd->u.crypt.offset * SECTOR_SIZE;
+       tcrypt_hdr->d.mk_offset = tgt->u.crypt.offset * SECTOR_SIZE;
 
-       strncpy(cipher, dmd->u.crypt.cipher, MAX_CIPHER_LEN);
+       strncpy(cipher, tgt->u.crypt.cipher, MAX_CIPHER_LEN);
        tmp = strchr(cipher, '-');
        if (!tmp)
                return -EINVAL;
        *tmp = '\0';
+       mode[MAX_CIPHER_LEN] = '\0';
        strncpy(mode, ++tmp, MAX_CIPHER_LEN);
 
-       key_size = dmd->u.crypt.vk->keylength;
-       r = TCRYPT_status_one(cd, name, dmd->uuid, 1, &key_size,
-                             cipher, &tcrypt_hdr->d.mk_offset, device);
+       key_size = tgt->u.crypt.vk->keylength;
+       r = TCRYPT_status_one(cd, name, uuid, 1, &key_size,
+                             cipher, tcrypt_hdr, device);
        if (!r)
-               r = TCRYPT_status_one(cd, name, dmd->uuid, 2, &key_size,
-                                     cipher, &tcrypt_hdr->d.mk_offset, device);
+               r = TCRYPT_status_one(cd, name, uuid, 2, &key_size,
+                                     cipher, tcrypt_hdr, device);
 
        if (r < 0 && r != -ENODEV)
                return r;
index 21ecba9..a3b6ad0 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * TCRYPT (TrueCrypt-compatible)  header defitinion
+ * TCRYPT (TrueCrypt-compatible)  header definition
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2014, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "libcryptsetup.h"
-
 #ifndef _CRYPTSETUP_TCRYPT_H
 #define _CRYPTSETUP_TCRYPT_H
 
+#include <stdint.h>
+
 #define TCRYPT_HDR_SALT_LEN 64
 #define TCRYPT_HDR_IV_LEN   16
 #define TCRYPT_HDR_LEN     448
@@ -42,6 +42,7 @@
 
 #define TCRYPT_LRW_IKEY_LEN 16
 #define TCRYPT_KEY_POOL_LEN 64
+#define VCRYPT_KEY_POOL_LEN 128
 #define TCRYPT_KEYFILE_LEN  1048576
 
 #define TCRYPT_HDR_FLAG_SYSTEM    (1 << 0)
@@ -72,7 +73,10 @@ struct tcrypt_phdr {
        };
 } __attribute__((__packed__));
 
+struct crypt_device;
+struct crypt_params_tcrypt;
 struct crypt_dm_active_device;
+struct dm_target;
 struct volume_key;
 struct device;
 
@@ -81,7 +85,8 @@ int TCRYPT_read_phdr(struct crypt_device *cd,
                     struct crypt_params_tcrypt *params);
 
 int TCRYPT_init_by_name(struct crypt_device *cd, const char *name,
-                       const struct crypt_dm_active_device *dmd,
+                       const char *uuid,
+                       const struct dm_target *tgt,
                        struct device **device,
                        struct crypt_params_tcrypt *tcrypt_params,
                        struct tcrypt_phdr *tcrypt_hdr);
@@ -93,7 +98,8 @@ int TCRYPT_activate(struct crypt_device *cd,
                     uint32_t flags);
 
 int TCRYPT_deactivate(struct crypt_device *cd,
-                     const char *name);
+                     const char *name,
+                     uint32_t flags);
 
 uint64_t TCRYPT_get_data_offset(struct crypt_device *cd,
                                struct tcrypt_phdr *hdr,
index a5aec70..0cf4378 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * utils - miscellaneous device utilities for cryptsetup
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2012, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <sys/mman.h>
 #include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/utsname.h>
 
 #include "internal.h"
 
-unsigned crypt_getpagesize(void)
+size_t crypt_getpagesize(void)
 {
        long r = sysconf(_SC_PAGESIZE);
-       return r < 0 ? DEFAULT_MEM_ALIGNMENT : r;
+       return r <= 0 ? DEFAULT_MEM_ALIGNMENT : (size_t)r;
 }
 
-static int get_alignment(int fd)
+unsigned crypt_cpusonline(void)
 {
-       int alignment = DEFAULT_MEM_ALIGNMENT;
-
-#ifdef _PC_REC_XFER_ALIGN
-       alignment = fpathconf(fd, _PC_REC_XFER_ALIGN);
-       if (alignment < 0)
-               alignment = DEFAULT_MEM_ALIGNMENT;
-#endif
-       return alignment;
+       long r = sysconf(_SC_NPROCESSORS_ONLN);
+       return r < 0 ? 1 : r;
 }
 
-static void *aligned_malloc(void **base, int size, int alignment)
+uint64_t crypt_getphysmemory_kb(void)
 {
-#ifdef HAVE_POSIX_MEMALIGN
-       return posix_memalign(base, alignment, size) ? NULL : *base;
-#else
-/* Credits go to Michal's padlock patches for this alignment code */
-       char *ptr;
-
-       ptr  = malloc(size + alignment);
-       if(ptr == NULL) return NULL;
-
-       *base = ptr;
-       if(alignment > 1 && ((long)ptr & (alignment - 1))) {
-               ptr += alignment - ((long)(ptr) & (alignment - 1));
-       }
-       return ptr;
-#endif
-}
-
-ssize_t write_blockwise(int fd, int bsize, void *orig_buf, size_t count)
-{
-       void *hangover_buf, *hangover_buf_base = NULL;
-       void *buf, *buf_base = NULL;
-       int r, hangover, solid, alignment;
-       ssize_t ret = -1;
-
-       if (fd == -1 || !orig_buf || bsize <= 0)
-               return -1;
+       long pagesize, phys_pages;
+       uint64_t phys_memory_kb;
 
-       hangover = count % bsize;
-       solid = count - hangover;
-       alignment = get_alignment(fd);
+       pagesize = sysconf(_SC_PAGESIZE);
+       phys_pages = sysconf(_SC_PHYS_PAGES);
 
-       if ((long)orig_buf & (alignment - 1)) {
-               buf = aligned_malloc(&buf_base, count, alignment);
-               if (!buf)
-                       goto out;
-               memcpy(buf, orig_buf, count);
-       } else
-               buf = orig_buf;
+       if (pagesize < 0 || phys_pages < 0)
+               return 0;
 
-       r = write(fd, buf, solid);
-       if (r < 0 || r != solid)
-               goto out;
+       phys_memory_kb = pagesize / 1024;
+       phys_memory_kb *= phys_pages;
 
-       if (hangover) {
-               hangover_buf = aligned_malloc(&hangover_buf_base, bsize, alignment);
-               if (!hangover_buf)
-                       goto out;
+       return phys_memory_kb;
+}
 
-               r = read(fd, hangover_buf, bsize);
-               if (r < 0 || r < hangover)
-                       goto out;
+/* MEMLOCK */
+#define DEFAULT_PROCESS_PRIORITY -18
 
-               if (r < bsize)
-                       bsize = r;
+static int _priority;
+static int _memlock_count = 0;
 
-               r = lseek(fd, -bsize, SEEK_CUR);
-               if (r < 0)
-                       goto out;
-               memcpy(hangover_buf, (char*)buf + solid, hangover);
+// return 1 if memory is locked
+int crypt_memlock_inc(struct crypt_device *ctx)
+{
+       if (!_memlock_count++) {
+               log_dbg(ctx, "Locking memory.");
+               if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
+                       log_dbg(ctx, "Cannot lock memory with mlockall.");
+                       _memlock_count--;
+                       return 0;
+               }
+               errno = 0;
+               if (((_priority = getpriority(PRIO_PROCESS, 0)) == -1) && errno)
+                       log_err(ctx, _("Cannot get process priority."));
+               else
+                       if (setpriority(PRIO_PROCESS, 0, DEFAULT_PROCESS_PRIORITY))
+                               log_dbg(ctx, "setpriority %d failed: %s",
+                                       DEFAULT_PROCESS_PRIORITY, strerror(errno));
+       }
+       return _memlock_count ? 1 : 0;
+}
 
-               r = write(fd, hangover_buf, bsize);
-               if (r < 0 || r < hangover)
-                       goto out;
+int crypt_memlock_dec(struct crypt_device *ctx)
+{
+       if (_memlock_count && (!--_memlock_count)) {
+               log_dbg(ctx, "Unlocking memory.");
+               if (munlockall() == -1)
+                       log_err(ctx, _("Cannot unlock memory."));
+               if (setpriority(PRIO_PROCESS, 0, _priority))
+                       log_dbg(ctx, "setpriority %d failed: %s", _priority, strerror(errno));
        }
-       ret = count;
-out:
-       free(hangover_buf_base);
-       if (buf != orig_buf)
-               free(buf_base);
-       return ret;
+       return _memlock_count ? 1 : 0;
 }
 
-ssize_t read_blockwise(int fd, int bsize, void *orig_buf, size_t count) {
-       void *hangover_buf, *hangover_buf_base = NULL;
-       void *buf, *buf_base = NULL;
-       int r, hangover, solid, alignment;
-       ssize_t ret = -1;
+/* Keyfile processing */
 
-       if (fd == -1 || !orig_buf || bsize <= 0)
+/*
+ * A simple call to lseek(3) might not be possible for some inputs (e.g.
+ * reading from a pipe), so this function instead reads of up to BUFSIZ bytes
+ * at a time until the specified number of bytes. It returns -1 on read error
+ * or when it reaches EOF before the requested number of bytes have been
+ * discarded.
+ */
+static int keyfile_seek(int fd, uint64_t bytes)
+{
+       char tmp[BUFSIZ];
+       size_t next_read;
+       ssize_t bytes_r;
+       off64_t r;
+
+       r = lseek64(fd, bytes, SEEK_CUR);
+       if (r > 0)
+               return 0;
+       if (r < 0 && errno != ESPIPE)
                return -1;
 
-       hangover = count % bsize;
-       solid = count - hangover;
-       alignment = get_alignment(fd);
+       while (bytes > 0) {
+               /* figure out how much to read */
+               next_read = bytes > sizeof(tmp) ? sizeof(tmp) : (size_t)bytes;
+
+               bytes_r = read(fd, tmp, next_read);
+               if (bytes_r < 0) {
+                       if (errno == EINTR)
+                               continue;
 
-       if ((long)orig_buf & (alignment - 1)) {
-               buf = aligned_malloc(&buf_base, count, alignment);
-               if (!buf)
+                       crypt_safe_memzero(tmp, sizeof(tmp));
+                       /* read error */
                        return -1;
-       } else
-               buf = orig_buf;
+               }
+
+               if (bytes_r == 0)
+                       /* EOF */
+                       break;
 
-       r = read(fd, buf, solid);
-       if(r < 0 || r != solid)
-               goto out;
+               bytes -= bytes_r;
+       }
 
-       if (hangover) {
-               hangover_buf = aligned_malloc(&hangover_buf_base, bsize, alignment);
-               if (!hangover_buf)
-                       goto out;
-               r = read(fd, hangover_buf, bsize);
-               if (r <  0 || r < hangover)
-                       goto out;
+       crypt_safe_memzero(tmp, sizeof(tmp));
+       return bytes == 0 ? 0 : -1;
+}
 
-               memcpy((char *)buf + solid, hangover_buf, hangover);
+int crypt_keyfile_device_read(struct crypt_device *cd,  const char *keyfile,
+                             char **key, size_t *key_size_read,
+                             uint64_t keyfile_offset, size_t key_size,
+                             uint32_t flags)
+{
+       int fd, regular_file, char_to_read = 0, char_read = 0, unlimited_read = 0;
+       int r = -EINVAL, newline;
+       char *pass = NULL;
+       size_t buflen, i;
+       uint64_t file_read_size;
+       struct stat st;
+
+       if (!key || !key_size_read)
+               return -EINVAL;
+
+       *key = NULL;
+       *key_size_read = 0;
+
+       fd = keyfile ? open(keyfile, O_RDONLY) : STDIN_FILENO;
+       if (fd < 0) {
+               log_err(cd, _("Failed to open key file."));
+               return -EINVAL;
        }
-       ret = count;
-out:
-       free(hangover_buf_base);
-       if (buf != orig_buf) {
-               memcpy(orig_buf, buf, count);
-               free(buf_base);
+
+       if (isatty(fd)) {
+               log_err(cd, _("Cannot read keyfile from a terminal."));
+               r = -EINVAL;
+               goto out_err;
        }
-       return ret;
-}
 
-/*
- * Combines llseek with blockwise write. write_blockwise can already deal with short writes
- * but we also need a function to deal with short writes at the start. But this information
- * is implicitly included in the read/write offset, which can not be set to non-aligned
- * boundaries. Hence, we combine llseek with write.
- */
-ssize_t write_lseek_blockwise(int fd, int bsize, char *buf, size_t count, off_t offset) {
-       char *frontPadBuf;
-       void *frontPadBuf_base = NULL;
-       int r, frontHang;
-       size_t innerCount = 0;
-       ssize_t ret = -1;
-
-       if (fd == -1 || !buf || bsize <= 0)
-               return -1;
+       /* If not requested otherwise, we limit input to prevent memory exhaustion */
+       if (key_size == 0) {
+               key_size = DEFAULT_KEYFILE_SIZE_MAXKB * 1024 + 1;
+               unlimited_read = 1;
+               /* use 4k for buffer (page divisor but avoid huge pages) */
+               buflen = 4096 - sizeof(size_t); // sizeof(struct safe_allocation);
+       } else
+               buflen = key_size;
 
-       frontHang = offset % bsize;
+       regular_file = 0;
+       if (keyfile) {
+               if (stat(keyfile, &st) < 0) {
+                       log_err(cd, _("Failed to stat key file."));
+                       goto out_err;
+               }
+               if (S_ISREG(st.st_mode)) {
+                       regular_file = 1;
+                       file_read_size = (uint64_t)st.st_size;
+
+                       if (keyfile_offset > file_read_size) {
+                               log_err(cd, _("Cannot seek to requested keyfile offset."));
+                               goto out_err;
+                       }
+                       file_read_size -= keyfile_offset;
+
+                       /* known keyfile size, alloc it in one step */
+                       if (file_read_size >= (uint64_t)key_size)
+                               buflen = key_size;
+                       else if (file_read_size)
+                               buflen = file_read_size;
+               }
+       }
 
-       if (lseek(fd, offset - frontHang, SEEK_SET) < 0)
-               goto out;
+       pass = crypt_safe_alloc(buflen);
+       if (!pass) {
+               log_err(cd, _("Out of memory while reading passphrase."));
+               goto out_err;
+       }
 
-       if (frontHang) {
-               frontPadBuf = aligned_malloc(&frontPadBuf_base,
-                                            bsize, get_alignment(fd));
-               if (!frontPadBuf)
-                       goto out;
+       /* Discard keyfile_offset bytes on input */
+       if (keyfile_offset && keyfile_seek(fd, keyfile_offset) < 0) {
+               log_err(cd, _("Cannot seek to requested keyfile offset."));
+               goto out_err;
+       }
 
-               r = read(fd, frontPadBuf, bsize);
-               if (r < 0 || r != bsize)
-                       goto out;
+       for (i = 0, newline = 0; i < key_size; i += char_read) {
+               if (i == buflen) {
+                       buflen += 4096;
+                       pass = crypt_safe_realloc(pass, buflen);
+                       if (!pass) {
+                               log_err(cd, _("Out of memory while reading passphrase."));
+                               r = -ENOMEM;
+                               goto out_err;
+                       }
+               }
 
-               innerCount = bsize - frontHang;
-               if (innerCount > count)
-                       innerCount = count;
+               if (flags & CRYPT_KEYFILE_STOP_EOL) {
+                       /* If we should stop on newline, we must read the input
+                        * one character at the time. Otherwise we might end up
+                        * having read some bytes after the newline, which we
+                        * promised not to do.
+                        */
+                       char_to_read = 1;
+               } else {
+                       /* char_to_read = min(key_size - i, buflen - i) */
+                       char_to_read = key_size < buflen ?
+                               key_size - i : buflen - i;
+               }
+               char_read = read_buffer(fd, &pass[i], char_to_read);
+               if (char_read < 0) {
+                       log_err(cd, _("Error reading passphrase."));
+                       r = -EPIPE;
+                       goto out_err;
+               }
 
-               memcpy(frontPadBuf + frontHang, buf, innerCount);
+               if (char_read == 0)
+                       break;
+               /* Stop on newline only if not requested read from keyfile */
+               if ((flags & CRYPT_KEYFILE_STOP_EOL) && pass[i] == '\n') {
+                       newline = 1;
+                       pass[i] = '\0';
+                       break;
+               }
+       }
 
-               if (lseek(fd, offset - frontHang, SEEK_SET) < 0)
-                       goto out;
+       /* Fail if piped input dies reading nothing */
+       if (!i && !regular_file && !newline) {
+               log_err(cd, _("Nothing to read on input."));
+               r = -EPIPE;
+               goto out_err;
+       }
 
-               r = write(fd, frontPadBuf, bsize);
-               if (r < 0 || r != bsize)
-                       goto out;
+       /* Fail if we exceeded internal default (no specified size) */
+       if (unlimited_read && i == key_size) {
+               log_err(cd, _("Maximum keyfile size exceeded."));
+               goto out_err;
+       }
 
-               buf += innerCount;
-               count -= innerCount;
+       if (!unlimited_read && i != key_size) {
+               log_err(cd, _("Cannot read requested amount of data."));
+               goto out_err;
        }
 
-       ret = count ? write_blockwise(fd, bsize, buf, count) : 0;
-       if (ret >= 0)
-               ret += innerCount;
-out:
-       free(frontPadBuf_base);
+       *key = pass;
+       *key_size_read = i;
+       r = 0;
+out_err:
+       if (fd != STDIN_FILENO)
+               close(fd);
 
-       return ret;
+       if (r)
+               crypt_safe_free(pass);
+       return r;
 }
 
-/* MEMLOCK */
-#define DEFAULT_PROCESS_PRIORITY -18
-
-static int _priority;
-static int _memlock_count = 0;
+int crypt_keyfile_read(struct crypt_device *cd,  const char *keyfile,
+                      char **key, size_t *key_size_read,
+                      size_t keyfile_offset, size_t keyfile_size_max,
+                      uint32_t flags)
+{
+       return crypt_keyfile_device_read(cd, keyfile, key, key_size_read,
+                                        keyfile_offset, keyfile_size_max, flags);
+}
 
-// return 1 if memory is locked
-int crypt_memlock_inc(struct crypt_device *ctx)
+int kernel_version(uint64_t *kversion)
 {
-       if (!_memlock_count++) {
-               log_dbg("Locking memory.");
-               if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
-                       log_dbg("Cannot lock memory with mlockall.");
-                       _memlock_count--;
-                       return 0;
-               }
-               errno = 0;
-               if (((_priority = getpriority(PRIO_PROCESS, 0)) == -1) && errno)
-                       log_err(ctx, _("Cannot get process priority.\n"));
-               else
-                       if (setpriority(PRIO_PROCESS, 0, DEFAULT_PROCESS_PRIORITY))
-                               log_dbg("setpriority %d failed: %s",
-                                       DEFAULT_PROCESS_PRIORITY, strerror(errno));
+       struct utsname uts;
+       uint16_t maj, min, patch, rel;
+       int r = -EINVAL;
+
+       if (uname(&uts) < 0)
+               return r;
+
+       if (sscanf(uts.release, "%" SCNu16  ".%" SCNu16 ".%" SCNu16 "-%" SCNu16,
+                  &maj, &min, &patch, &rel) == 4)
+               r = 0;
+       else if (sscanf(uts.release,  "%" SCNu16 ".%" SCNu16 ".%" SCNu16,
+                       &maj, &min, &patch) == 3) {
+               rel = 0;
+               r = 0;
        }
-       return _memlock_count ? 1 : 0;
+
+       if (!r)
+               *kversion = version(maj, min, patch, rel);
+
+       return r;
 }
 
-int crypt_memlock_dec(struct crypt_device *ctx)
+bool crypt_string_in(const char *str, char **list, size_t list_size)
 {
-       if (_memlock_count && (!--_memlock_count)) {
-               log_dbg("Unlocking memory.");
-               if (munlockall() == -1)
-                       log_err(ctx, _("Cannot unlock memory.\n"));
-               if (setpriority(PRIO_PROCESS, 0, _priority))
-                       log_dbg("setpriority %d failed: %s", _priority, strerror(errno));
-       }
-       return _memlock_count ? 1 : 0;
+       size_t i;
+
+       for (i = 0; *list && i < list_size; i++, list++)
+               if (!strcmp(str, *list))
+                       return true;
+
+       return false;
+}
+
+/* compare two strings (allows NULL values) */
+int crypt_strcmp(const char *a, const char *b)
+{
+       if (!a && !b)
+               return 0;
+       else if (!a || !b)
+               return 1;
+       return strcmp(a, b);
 }
index 1e4469b..f5c677a 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * libcryptsetup - cryptsetup library, cipher bechmark
+ * libcryptsetup - cryptsetup library, cipher benchmark
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2013, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 
 #include <stdlib.h>
 #include <errno.h>
-#include <time.h>
 
 #include "internal.h"
 
-/*
- * This is not simulating storage, so using disk block causes extreme overhead.
- * Let's use some fixed block size where results are more reliable...
- */
-#define CIPHER_BLOCK_BYTES 65536
-
-/*
- * If the measured value is lower, encrypted buffer is probably too small
- * and calculated values are not reliable.
- */
-#define CIPHER_TIME_MIN_MS 0.001
-
-/*
- * The whole test depends on Linux kernel usermode crypto API for now.
- * (The same implementations are used in dm-crypt though.)
- */
-
-struct cipher_perf {
-       char name[32];
-       char mode[32];
-       char *key;
-       size_t key_length;
-       char *iv;
-       size_t iv_length;
-       size_t buffer_size;
-};
-
-static int time_ms(struct timespec *start, struct timespec *end, double *ms)
-{
-       double start_ms, end_ms;
-
-       start_ms = start->tv_sec * 1000.0 + start->tv_nsec / (1000.0 * 1000);
-       end_ms   = end->tv_sec * 1000.0 + end->tv_nsec / (1000.0 * 1000);
-
-       *ms = end_ms - start_ms;
-       return 0;
-}
-
-static int cipher_perf_one(struct cipher_perf *cp, char *buf,
-                          size_t buf_size, int enc)
-{
-       struct crypt_cipher *cipher = NULL;
-       size_t done = 0, block = CIPHER_BLOCK_BYTES;
-       int r;
-
-       if (buf_size < block)
-               block = buf_size;
-
-       r = crypt_cipher_init(&cipher, cp->name, cp->mode, cp->key, cp->key_length);
-       if (r < 0) {
-               log_dbg("Cannot initialise cipher %s, mode %s.", cp->name, cp->mode);
-               return r;
-       }
-
-       while (done < buf_size) {
-               if ((done + block) > buf_size)
-                       block = buf_size - done;
-
-               if (enc)
-                       r = crypt_cipher_encrypt(cipher, &buf[done], &buf[done],
-                                                block, cp->iv, cp->iv_length);
-               else
-                       r = crypt_cipher_decrypt(cipher, &buf[done], &buf[done],
-                                                block, cp->iv, cp->iv_length);
-               if (r < 0)
-                       break;
-
-               done += block;
-       }
-
-       crypt_cipher_destroy(cipher);
-
-       return r;
-}
-static int cipher_measure(struct cipher_perf *cp, char *buf,
-                         size_t buf_size, int encrypt, double *ms)
-{
-       struct timespec start, end;
-       int r;
-
-       /*
-        * Using getrusage would be better here but the precision
-        * is not adequate, so better stick with CLOCK_MONOTONIC
-        */
-       if (clock_gettime(CLOCK_MONOTONIC, &start) < 0)
-               return -EINVAL;
-
-       r = cipher_perf_one(cp, buf, buf_size, encrypt);
-       if (r < 0)
-               return r;
-
-       if (clock_gettime(CLOCK_MONOTONIC, &end) < 0)
-               return -EINVAL;
-
-       r = time_ms(&start, &end, ms);
-       if (r < 0)
-               return r;
-
-       if (*ms < CIPHER_TIME_MIN_MS) {
-               log_dbg("Measured cipher runtime (%1.6f) is too low.", *ms);
-               return -ERANGE;
-       }
-
-       return 0;
-}
-
-static double speed_mbs(unsigned long bytes, double ms)
-{
-       double speed = bytes, s = ms / 1000.;
-
-       return speed / (1024 * 1024) / s;
-}
-
-static int cipher_perf(struct cipher_perf *cp,
-       double *encryption_mbs, double *decryption_mbs)
-{
-       double ms_enc, ms_dec, ms;
-       int r, repeat_enc, repeat_dec;
-       void *buf = NULL;
-
-       if (posix_memalign(&buf, crypt_getpagesize(), cp->buffer_size))
-               return -ENOMEM;
-
-       ms_enc = 0.0;
-       repeat_enc = 1;
-       while (ms_enc < 1000.0) {
-               r = cipher_measure(cp, buf, cp->buffer_size, 1, &ms);
-               if (r < 0) {
-                       free(buf);
-                       return r;
-               }
-               ms_enc += ms;
-               repeat_enc++;
-       }
-
-       ms_dec = 0.0;
-       repeat_dec = 1;
-       while (ms_dec < 1000.0) {
-               r = cipher_measure(cp, buf, cp->buffer_size, 0, &ms);
-               if (r < 0) {
-                       free(buf);
-                       return r;
-               }
-               ms_dec += ms;
-               repeat_dec++;
-       }
-
-       free(buf);
-
-       *encryption_mbs = speed_mbs(cp->buffer_size * repeat_enc, ms_enc);
-       *decryption_mbs = speed_mbs(cp->buffer_size * repeat_dec, ms_dec);
-
-       return  0;
-}
-
 int crypt_benchmark(struct crypt_device *cd,
        const char *cipher,
        const char *cipher_mode,
@@ -189,15 +33,11 @@ int crypt_benchmark(struct crypt_device *cd,
        double *encryption_mbs,
        double *decryption_mbs)
 {
-       struct cipher_perf cp = {
-               .key_length = volume_key_size,
-               .iv_length = iv_size,
-               .buffer_size = buffer_size,
-       };
-       char *c;
+       void *buffer = NULL;
+       char *iv = NULL, *key = NULL, mode[MAX_CIPHER_LEN], *c;
        int r;
 
-       if (!cipher || !cipher_mode || !volume_key_size)
+       if (!cipher || !cipher_mode || !volume_key_size || !encryption_mbs || !decryption_mbs)
                return -EINVAL;
 
        r = init_crypto(cd);
@@ -205,58 +45,171 @@ int crypt_benchmark(struct crypt_device *cd,
                return r;
 
        r = -ENOMEM;
+       if (posix_memalign(&buffer, crypt_getpagesize(), buffer_size))
+               goto out;
+
+       r = crypt_cipher_ivsize(cipher, cipher_mode);
+       if (r >= 0 && iv_size != (size_t)r) {
+               log_dbg(cd, "IV length for benchmark adjusted to %i bytes (requested %zu).", r, iv_size);
+               iv_size = r;
+       }
+
        if (iv_size) {
-               cp.iv = malloc(iv_size);
-               if (!cp.iv)
+               iv = malloc(iv_size);
+               if (!iv)
                        goto out;
-               crypt_random_get(cd, cp.iv, iv_size, CRYPT_RND_NORMAL);
+               crypt_random_get(cd, iv, iv_size, CRYPT_RND_NORMAL);
        }
 
-       cp.key = malloc(volume_key_size);
-       if (!cp.key)
+       key = malloc(volume_key_size);
+       if (!key)
                goto out;
 
-       crypt_random_get(cd, cp.key, volume_key_size, CRYPT_RND_NORMAL);
-       strncpy(cp.name, cipher, sizeof(cp.name)-1);
-       strncpy(cp.mode, cipher_mode, sizeof(cp.mode)-1);
+       crypt_random_get(cd, key, volume_key_size, CRYPT_RND_NORMAL);
 
+       strncpy(mode, cipher_mode, sizeof(mode)-1);
        /* Ignore IV generator */
-       if ((c  = strchr(cp.mode, '-')))
+       if ((c  = strchr(mode, '-')))
                *c = '\0';
 
-       r = cipher_perf(&cp, encryption_mbs, decryption_mbs);
+       r = crypt_cipher_perf_kernel(cipher, cipher_mode, buffer, buffer_size, key, volume_key_size,
+                                    iv, iv_size, encryption_mbs, decryption_mbs);
+
+       if (r == -ERANGE)
+               log_dbg(cd, "Measured cipher runtime is too low.");
+       else if (r)
+               log_dbg(cd, "Cannot initialize cipher %s, mode %s, key size %zu, IV size %zu.",
+                       cipher, cipher_mode, volume_key_size, iv_size);
 out:
-       free(cp.key);
-       free(cp.iv);
+       free(buffer);
+       free(key);
+       free(iv);
+
        return r;
 }
 
-int crypt_benchmark_kdf(struct crypt_device *cd,
-       const char *kdf,
-       const char *hash,
+int crypt_benchmark_pbkdf(struct crypt_device *cd,
+       struct crypt_pbkdf_type *pbkdf,
        const char *password,
        size_t password_size,
        const char *salt,
        size_t salt_size,
-       uint64_t *iterations_sec)
+       size_t volume_key_size,
+       int (*progress)(uint32_t time_ms, void *usrptr),
+       void *usrptr)
 {
        int r;
+       const char *kdf_opt;
 
-       if (!iterations_sec)
+       if (!pbkdf || (!password && password_size))
                return -EINVAL;
 
        r = init_crypto(cd);
        if (r < 0)
                return r;
 
-       if (!strncmp(kdf, "pbkdf2", 6))
-               r = crypt_pbkdf_check(kdf, hash, password, password_size,
-                                     salt, salt_size, iterations_sec);
-       else
-               r = -EINVAL;
+       kdf_opt = !strcmp(pbkdf->type, CRYPT_KDF_PBKDF2) ? pbkdf->hash : "";
+
+       log_dbg(cd, "Running %s(%s) benchmark.", pbkdf->type, kdf_opt);
+
+       r = crypt_pbkdf_perf(pbkdf->type, pbkdf->hash, password, password_size,
+                            salt, salt_size, volume_key_size, pbkdf->time_ms,
+                            pbkdf->max_memory_kb, pbkdf->parallel_threads,
+                            &pbkdf->iterations, &pbkdf->max_memory_kb, progress, usrptr);
 
        if (!r)
-               log_dbg("KDF %s, hash %s: %" PRIu64 " iterations per second.",
-                       kdf, hash, *iterations_sec);
+               log_dbg(cd, "Benchmark returns %s(%s) %u iterations, %u memory, %u threads (for %zu-bits key).",
+                       pbkdf->type, kdf_opt, pbkdf->iterations, pbkdf->max_memory_kb,
+                       pbkdf->parallel_threads, volume_key_size * 8);
+       return r;
+}
+
+struct benchmark_usrptr {
+       struct crypt_device *cd;
+       struct crypt_pbkdf_type *pbkdf;
+};
+
+static int benchmark_callback(uint32_t time_ms, void *usrptr)
+{
+       struct benchmark_usrptr *u = usrptr;
+
+       log_dbg(u->cd, "PBKDF benchmark: memory cost = %u, iterations = %u, "
+               "threads = %u (took %u ms)", u->pbkdf->max_memory_kb,
+               u->pbkdf->iterations, u->pbkdf->parallel_threads, time_ms);
+
+       return 0;
+}
+
+/*
+ * Used in internal places to benchmark crypt_device context PBKDF.
+ * Once requested parameters are benchmarked, iterations attribute is set,
+ * and the benchmarked values can be reused.
+ * Note that memory cost can be changed after benchmark (if used).
+ * NOTE: You need to check that you are benchmarking for the same key size.
+ */
+int crypt_benchmark_pbkdf_internal(struct crypt_device *cd,
+                                  struct crypt_pbkdf_type *pbkdf,
+                                  size_t volume_key_size)
+{
+       struct crypt_pbkdf_limits pbkdf_limits;
+       double PBKDF2_tmp;
+       uint32_t ms_tmp;
+       int r = -EINVAL;
+       struct benchmark_usrptr u = {
+               .cd = cd,
+               .pbkdf = pbkdf
+       };
+
+       r = crypt_pbkdf_get_limits(pbkdf->type, &pbkdf_limits);
+       if (r)
+               return r;
+
+       if (pbkdf->flags & CRYPT_PBKDF_NO_BENCHMARK) {
+               if (pbkdf->iterations) {
+                       log_dbg(cd, "Reusing PBKDF values (no benchmark flag is set).");
+                       return 0;
+               }
+               log_err(cd, _("PBKDF benchmark disabled but iterations not set."));
+               return -EINVAL;
+       }
+
+       /* For PBKDF2 run benchmark always. Also note it depends on volume_key_size! */
+       if (!strcmp(pbkdf->type, CRYPT_KDF_PBKDF2)) {
+               /*
+                * For PBKDF2 it is enough to run benchmark for only 1 second
+                * and interpolate final iterations value from it.
+                */
+               ms_tmp = pbkdf->time_ms;
+               pbkdf->time_ms = 1000;
+               pbkdf->parallel_threads = 0; /* N/A in PBKDF2 */
+               pbkdf->max_memory_kb = 0; /* N/A in PBKDF2 */
+
+               r = crypt_benchmark_pbkdf(cd, pbkdf, "foo", 3, "bar", 3,
+                                       volume_key_size, &benchmark_callback, &u);
+               pbkdf->time_ms = ms_tmp;
+               if (r < 0) {
+                       log_err(cd, _("Not compatible PBKDF2 options (using hash algorithm %s)."),
+                               pbkdf->hash);
+                       return r;
+               }
+
+               PBKDF2_tmp = ((double)pbkdf->iterations * pbkdf->time_ms / 1000.);
+               if (PBKDF2_tmp > (double)UINT32_MAX)
+                       return -EINVAL;
+               pbkdf->iterations = at_least((uint32_t)PBKDF2_tmp, pbkdf_limits.min_iterations);
+       } else {
+               /* Already benchmarked */
+               if (pbkdf->iterations) {
+                       log_dbg(cd, "Reusing PBKDF values.");
+                       return 0;
+               }
+
+               r = crypt_benchmark_pbkdf(cd, pbkdf, "foo", 3,
+                       "0123456789abcdef0123456789abcdef", 32,
+                       volume_key_size, &benchmark_callback, &u);
+               if (r < 0)
+                       log_err(cd, _("Not compatible PBKDF options."));
+       }
+
        return r;
 }
diff --git a/lib/utils_blkid.c b/lib/utils_blkid.c
new file mode 100644 (file)
index 0000000..0e3e7fd
--- /dev/null
@@ -0,0 +1,323 @@
+/*
+ * blkid probe utilities
+ *
+ * Copyright (C) 2018-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "utils_blkid.h"
+#include "utils_io.h"
+
+#ifdef HAVE_BLKID
+#include <blkid/blkid.h>
+/* make bad checksums flag optional */
+#ifndef BLKID_SUBLKS_BADCSUM
+#define BLKID_SUBLKS_BADCSUM 0
+#endif
+struct blkid_handle {
+       int fd;
+       blkid_probe pr;
+};
+#ifndef HAVE_BLKID_WIPE
+static size_t crypt_getpagesize(void)
+{
+       long r = sysconf(_SC_PAGESIZE);
+       return r <= 0 ? 4096 : (size_t)r;
+}
+#endif
+#endif
+
+void blk_set_chains_for_wipes(struct blkid_handle *h)
+{
+#ifdef HAVE_BLKID
+       blkid_probe_enable_partitions(h->pr, 1);
+       blkid_probe_set_partitions_flags(h->pr, 0
+#ifdef HAVE_BLKID_WIPE
+       | BLKID_PARTS_MAGIC
+#endif
+       );
+
+       blkid_probe_enable_superblocks(h->pr, 1);
+       blkid_probe_set_superblocks_flags(h->pr, BLKID_SUBLKS_LABEL   |
+                                                BLKID_SUBLKS_UUID    |
+                                                BLKID_SUBLKS_TYPE    |
+                                                BLKID_SUBLKS_USAGE   |
+                                                BLKID_SUBLKS_VERSION |
+                                                BLKID_SUBLKS_MAGIC   |
+                                                BLKID_SUBLKS_BADCSUM);
+#endif
+}
+
+void blk_set_chains_for_full_print(struct blkid_handle *h)
+{
+       blk_set_chains_for_wipes(h);
+}
+
+void blk_set_chains_for_fast_detection(struct blkid_handle *h)
+{
+#ifdef HAVE_BLKID
+       blkid_probe_enable_partitions(h->pr, 1);
+       blkid_probe_set_partitions_flags(h->pr, 0);
+
+       blkid_probe_enable_superblocks(h->pr, 1);
+       blkid_probe_set_superblocks_flags(h->pr, BLKID_SUBLKS_TYPE);
+#endif
+}
+
+int blk_init_by_path(struct blkid_handle **h, const char *path)
+{
+       int r = -ENOTSUP;
+#ifdef HAVE_BLKID
+       struct blkid_handle *tmp = malloc(sizeof(*tmp));
+       if (!tmp)
+               return -ENOMEM;
+
+       tmp->fd = -1;
+
+       tmp->pr = blkid_new_probe_from_filename(path);
+       if (!tmp->pr) {
+               free(tmp);
+               return -EINVAL;
+       }
+
+       *h = tmp;
+
+       r = 0;
+#endif
+       return r;
+}
+
+int blk_init_by_fd(struct blkid_handle **h, int fd)
+{
+       int r = -ENOTSUP;
+#ifdef HAVE_BLKID
+       struct blkid_handle *tmp = malloc(sizeof(*tmp));
+       if (!tmp)
+               return -ENOMEM;
+
+       tmp->pr = blkid_new_probe();
+       if (!tmp->pr) {
+               free(tmp);
+               return -EINVAL;
+       }
+
+       if (blkid_probe_set_device(tmp->pr, fd, 0, 0)) {
+               blkid_free_probe(tmp->pr);
+               free(tmp);
+               return -EINVAL;
+       }
+
+       tmp->fd = fd;
+
+       *h = tmp;
+
+       r = 0;
+#endif
+       return r;
+}
+
+int blk_superblocks_filter_luks(struct blkid_handle *h)
+{
+       int r = -ENOTSUP;
+#ifdef HAVE_BLKID
+       char luks[] = "crypto_LUKS";
+       char *luks_filter[] = {
+               luks,
+               NULL
+       };
+       r = blkid_probe_filter_superblocks_type(h->pr, BLKID_FLTR_NOTIN, luks_filter);
+#endif
+       return r;
+}
+
+blk_probe_status blk_probe(struct blkid_handle *h)
+{
+       blk_probe_status pr = PRB_FAIL;
+#ifdef HAVE_BLKID
+       int r = blkid_do_probe(h->pr);
+
+       if (r == 0)
+               pr = PRB_OK;
+       else if (r == 1)
+               pr = PRB_EMPTY;
+#endif
+       return pr;
+}
+
+blk_probe_status blk_safeprobe(struct blkid_handle *h)
+{
+       int r = -1;
+#ifdef HAVE_BLKID
+       r = blkid_do_safeprobe(h->pr);
+#endif
+       switch (r) {
+       case -2:
+               return PRB_AMBIGUOUS;
+       case 1:
+               return PRB_EMPTY;
+       case 0:
+               return PRB_OK;
+       default:
+               return PRB_FAIL;
+       }
+}
+
+int blk_is_partition(struct blkid_handle *h)
+{
+       int r = 0;
+#ifdef HAVE_BLKID
+       r = blkid_probe_has_value(h->pr, "PTTYPE");
+#endif
+       return r;
+}
+
+int blk_is_superblock(struct blkid_handle *h)
+{
+       int r = 0;
+#ifdef HAVE_BLKID
+       r = blkid_probe_has_value(h->pr, "TYPE");
+#endif
+       return r;
+}
+
+const char *blk_get_partition_type(struct blkid_handle *h)
+{
+       const char *value = NULL;
+#ifdef HAVE_BLKID
+       (void) blkid_probe_lookup_value(h->pr, "PTTYPE", &value, NULL);
+#endif
+       return value;
+}
+
+const char *blk_get_superblock_type(struct blkid_handle *h)
+{
+       const char *value = NULL;
+#ifdef HAVE_BLKID
+       (void) blkid_probe_lookup_value(h->pr, "TYPE", &value, NULL);
+#endif
+       return value;
+}
+
+void blk_free(struct blkid_handle *h)
+{
+#ifdef HAVE_BLKID
+       if (!h)
+               return;
+
+       if (h->pr)
+               blkid_free_probe(h->pr);
+
+       free(h);
+#endif
+}
+
+#ifdef HAVE_BLKID
+#ifndef HAVE_BLKID_WIPE
+static int blk_step_back(struct blkid_handle *h)
+{
+#ifdef HAVE_BLKID_STEP_BACK
+       return blkid_probe_step_back(h->pr);
+#else
+       blkid_reset_probe(h->pr);
+       blkid_probe_set_device(h->pr, h->fd, 0, 0);
+       return 0;
+#endif
+}
+#endif /* not HAVE_BLKID_WIPE */
+#endif /* HAVE_BLKID */
+
+int blk_do_wipe(struct blkid_handle *h)
+{
+#ifdef HAVE_BLKID
+#ifdef HAVE_BLKID_WIPE
+       return blkid_do_wipe(h->pr, 0);
+#else
+       const char *offset;
+       off_t offset_val;
+       void *buf;
+       ssize_t ret;
+       size_t alignment, len, bsize = blkid_probe_get_sectorsize(h->pr);
+
+       if (h->fd < 0 || !bsize)
+               return -EINVAL;
+
+       if (blk_is_partition(h)) {
+               if (blkid_probe_lookup_value(h->pr, "PTMAGIC_OFFSET", &offset, NULL))
+                       return -EINVAL;
+               if (blkid_probe_lookup_value(h->pr, "PTMAGIC", NULL, &len))
+                       return -EINVAL;
+       } else if (blk_is_superblock(h)) {
+               if (blkid_probe_lookup_value(h->pr, "SBMAGIC_OFFSET", &offset, NULL))
+                       return -EINVAL;
+               if (blkid_probe_lookup_value(h->pr, "SBMAGIC", NULL, &len))
+                       return -EINVAL;
+       } else
+               return 0;
+
+       alignment = crypt_getpagesize();
+
+       if (posix_memalign(&buf, alignment, len))
+               return -EINVAL;
+       memset(buf, 0, len);
+
+       offset_val = strtoll(offset, NULL, 10);
+
+       /* TODO: missing crypt_wipe_fd() */
+       ret = write_lseek_blockwise(h->fd, bsize, alignment, buf, len, offset_val);
+       free(buf);
+       if (ret < 0)
+               return -EIO;
+
+       if ((size_t)ret == len) {
+               blk_step_back(h);
+               return 0;
+       }
+
+       return -EIO;
+#endif
+#else /* HAVE_BLKID */
+       return -ENOTSUP;
+#endif
+}
+
+int blk_supported(void)
+{
+       int r = 0;
+#ifdef HAVE_BLKID
+       r = 1;
+#endif
+       return r;
+}
+
+off_t blk_get_offset(struct blkid_handle *h)
+{
+       off_t offset_value = -1;
+#ifdef HAVE_BLKID
+       const char *offset;
+       if (blk_is_superblock(h)) {
+               if (!blkid_probe_lookup_value(h->pr, "SBMAGIC_OFFSET", &offset, NULL))
+                       offset_value = strtoll(offset, NULL, 10);
+       } else if (blk_is_partition(h) && !blkid_probe_lookup_value(h->pr, "PTMAGIC_OFFSET", &offset, NULL))
+               offset_value = strtoll(offset, NULL, 10);
+#endif
+       return offset_value;
+}
diff --git a/lib/utils_blkid.h b/lib/utils_blkid.h
new file mode 100644 (file)
index 0000000..ca50da7
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * blkid probe utilities
+ *
+ * Copyright (C) 2018-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _UTILS_BLKID_H
+#define _UTILS_BLKID_H
+
+struct blkid_handle;
+
+typedef enum { PRB_OK = 0, PRB_EMPTY, PRB_AMBIGUOUS, PRB_FAIL } blk_probe_status;
+
+int blk_init_by_path(struct blkid_handle **h, const char *path);
+
+void blk_free(struct blkid_handle *h);
+
+/*
+ * WARNING: This will reset file description offset as if
+ *         lseek(devfd, 0, SEEK_SET) was called!
+ */
+int blk_init_by_fd(struct blkid_handle **h, int fd);
+
+void blk_set_chains_for_wipes(struct blkid_handle *h);
+
+void blk_set_chains_for_full_print(struct blkid_handle *h);
+
+void blk_set_chains_for_fast_detection(struct blkid_handle *h);
+
+int blk_superblocks_filter_luks(struct blkid_handle *h);
+
+blk_probe_status blk_safeprobe(struct blkid_handle *h);
+
+blk_probe_status blk_probe(struct blkid_handle *h);
+
+int blk_is_partition(struct blkid_handle *h);
+
+int blk_is_superblock(struct blkid_handle *h);
+
+const char *blk_get_partition_type(struct blkid_handle *h);
+
+const char *blk_get_superblock_type(struct blkid_handle *h);
+
+int blk_do_wipe(struct blkid_handle *h);
+
+int blk_supported(void);
+
+off_t blk_get_offset(struct blkid_handle *h);
+
+#endif
index 5cfe477..17dc6d8 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * utils_crypt - cipher utilities for cryptsetup
  *
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2012, Milan Broz
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include <stdlib.h>
-#include <stddef.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <ctype.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <termios.h>
 
 #include "libcryptsetup.h"
-#include "nls.h"
 #include "utils_crypt.h"
 
-#define log_dbg(x) crypt_log(NULL, CRYPT_LOG_DEBUG, x)
-#define log_err(cd, x) crypt_log(cd, CRYPT_LOG_ERROR, x)
-
-struct safe_allocation {
-       size_t  size;
-       char    data[0];
-};
-
 int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums,
                              char *cipher_mode)
 {
+       if (!s || !cipher || !cipher_mode)
+               return -EINVAL;
+
        if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]-%" MAX_CIPHER_LEN_STR "s",
                   cipher, cipher_mode) == 2) {
                if (!strcmp(cipher_mode, "plain"))
-                       strncpy(cipher_mode, "cbc-plain", 10);
+                       strcpy(cipher_mode, "cbc-plain");
                if (key_nums) {
                        char *tmp = strchr(cipher, ':');
                        *key_nums = tmp ? atoi(++tmp) : 1;
@@ -63,16 +49,16 @@ int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums,
        }
 
        /* Short version for "empty" cipher */
-       if (!strcmp(s, "null")) {
-               strncpy(cipher, "cipher_null", MAX_CIPHER_LEN);
-               strncpy(cipher_mode, "ecb", 9);
+       if (!strcmp(s, "null") || !strcmp(s, "cipher_null")) {
+               strcpy(cipher, "cipher_null");
+               strcpy(cipher_mode, "ecb");
                if (key_nums)
                        *key_nums = 0;
                return 0;
        }
 
        if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]", cipher) == 1) {
-               strncpy(cipher_mode, "cbc-plain", 10);
+               strcpy(cipher_mode, "cbc-plain");
                if (key_nums)
                        *key_nums = 1;
                return 0;
@@ -81,383 +67,86 @@ int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums,
        return -EINVAL;
 }
 
-/*
- * Replacement for memset(s, 0, n) on stack that can be optimized out
- * Also used in safe allocations for explicit memory wipe.
- */
-void crypt_memzero(void *s, size_t n)
-{
-       volatile uint8_t *p = (volatile uint8_t *)s;
-
-       while(n--)
-               *p++ = 0;
-}
-
-/* safe allocations */
-void *crypt_safe_alloc(size_t size)
-{
-       struct safe_allocation *alloc;
-
-       if (!size)
-               return NULL;
-
-       alloc = malloc(size + offsetof(struct safe_allocation, data));
-       if (!alloc)
-               return NULL;
-
-       alloc->size = size;
-       crypt_memzero(&alloc->data, size);
-
-       /* coverity[leaked_storage] */
-       return &alloc->data;
-}
-
-void crypt_safe_free(void *data)
-{
-       struct safe_allocation *alloc;
-
-       if (!data)
-               return;
-
-       alloc = (struct safe_allocation *)
-               ((char *)data - offsetof(struct safe_allocation, data));
-
-       crypt_memzero(data, alloc->size);
-
-       alloc->size = 0x55aa55aa;
-       free(alloc);
-}
-
-void *crypt_safe_realloc(void *data, size_t size)
-{
-       struct safe_allocation *alloc;
-       void *new_data;
-
-       new_data = crypt_safe_alloc(size);
-
-       if (new_data && data) {
-
-               alloc = (struct safe_allocation *)
-                       ((char *)data - offsetof(struct safe_allocation, data));
-
-               if (size > alloc->size)
-                       size = alloc->size;
-
-               memcpy(new_data, data, size);
-       }
-
-       crypt_safe_free(data);
-       return new_data;
-}
-
-/* Password reading helpers */
-static int untimed_read(int fd, char *pass, size_t maxlen)
-{
-       ssize_t i;
-
-       i = read(fd, pass, maxlen);
-       if (i > 0) {
-               pass[i-1] = '\0';
-               i = 0;
-       } else if (i == 0) { /* EOF */
-               *pass = 0;
-               i = -1;
-       }
-       return i;
-}
-
-static int timed_read(int fd, char *pass, size_t maxlen, long timeout)
-{
-       struct timeval t;
-       fd_set fds = {}; /* Just to avoid scan-build false report for FD_SET */
-       int failed = -1;
-
-       FD_ZERO(&fds);
-       FD_SET(fd, &fds);
-       t.tv_sec = timeout;
-       t.tv_usec = 0;
-
-       if (select(fd+1, &fds, NULL, NULL, &t) > 0)
-               failed = untimed_read(fd, pass, maxlen);
-
-       return failed;
-}
-
-static int interactive_pass(const char *prompt, char *pass, size_t maxlen,
-               long timeout)
+int crypt_parse_hash_integrity_mode(const char *s, char *integrity)
 {
-       struct termios orig, tmp;
-       int failed = -1;
-       int infd, outfd;
-
-       if (maxlen < 1)
-               return failed;
-
-       /* Read and write to /dev/tty if available */
-       infd = open("/dev/tty", O_RDWR);
-       if (infd == -1) {
-               infd = STDIN_FILENO;
-               outfd = STDERR_FILENO;
-       } else
-               outfd = infd;
+       char mode[MAX_CIPHER_LEN], hash[MAX_CIPHER_LEN];
+       int r;
 
-       if (tcgetattr(infd, &orig))
-               goto out_err;
-
-       memcpy(&tmp, &orig, sizeof(tmp));
-       tmp.c_lflag &= ~ECHO;
-
-       if (prompt && write(outfd, prompt, strlen(prompt)) < 0)
-               goto out_err;
+       if (!s || !integrity || strchr(s, '(') || strchr(s, ')'))
+               return -EINVAL;
 
-       tcsetattr(infd, TCSAFLUSH, &tmp);
-       if (timeout)
-               failed = timed_read(infd, pass, maxlen, timeout);
+       r = sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]-%" MAX_CIPHER_LEN_STR "s", mode, hash);
+       if (r == 2)
+               r = snprintf(integrity, MAX_CIPHER_LEN, "%s(%s)", mode, hash);
+       else if (r == 1)
+               r = snprintf(integrity, MAX_CIPHER_LEN, "%s", mode);
        else
-               failed = untimed_read(infd, pass, maxlen);
-       tcsetattr(infd, TCSAFLUSH, &orig);
+               return -EINVAL;
 
-out_err:
-       if (!failed && write(outfd, "\n", 1)) {};
+       if (r < 0 || r == MAX_CIPHER_LEN)
+               return -EINVAL;
 
-       if (infd != STDIN_FILENO)
-               close(infd);
-       return failed;
+       return 0;
 }
 
-static int crypt_get_key_tty(const char *prompt,
-                            char **key, size_t *key_size,
-                            int timeout, int verify,
-                            struct crypt_device *cd)
+int crypt_parse_integrity_mode(const char *s, char *integrity,
+                              int *integrity_key_size)
 {
-       int key_size_max = DEFAULT_PASSPHRASE_SIZE_MAX;
-       int r = -EINVAL;
-       char *pass = NULL, *pass_verify = NULL;
-
-       log_dbg("Interactive passphrase entry requested.");
+       int ks = 0, r = 0;
 
-       pass = crypt_safe_alloc(key_size_max + 1);
-       if (!pass) {
-               log_err(cd, _("Out of memory while reading passphrase.\n"));
-               return -ENOMEM;
-       }
-
-       if (interactive_pass(prompt, pass, key_size_max, timeout)) {
-               log_err(cd, _("Error reading passphrase from terminal.\n"));
-               goto out_err;
-       }
-       pass[key_size_max] = '\0';
-
-       if (verify) {
-               pass_verify = crypt_safe_alloc(key_size_max);
-               if (!pass_verify) {
-                       log_err(cd, _("Out of memory while reading passphrase.\n"));
-                       r = -ENOMEM;
-                       goto out_err;
-               }
+       if (!s || !integrity)
+               return -EINVAL;
 
-               if (interactive_pass(_("Verify passphrase: "),
-                   pass_verify, key_size_max, timeout)) {
-                       log_err(cd, _("Error reading passphrase from terminal.\n"));
-                       goto out_err;
-               }
+       // FIXME: do not hardcode it here
+
+       /* AEAD modes */
+       if (!strcmp(s, "aead") ||
+           !strcmp(s, "poly1305") ||
+           !strcmp(s, "none")) {
+               strncpy(integrity, s, MAX_CIPHER_LEN);
+               ks = 0;
+       } else if (!strcmp(s, "hmac-sha1")) {
+               strncpy(integrity, "hmac(sha1)", MAX_CIPHER_LEN);
+               ks = 20;
+       } else if (!strcmp(s, "hmac-sha256")) {
+               strncpy(integrity, "hmac(sha256)", MAX_CIPHER_LEN);
+               ks = 32;
+       } else if (!strcmp(s, "hmac-sha512")) {
+               ks = 64;
+               strncpy(integrity, "hmac(sha512)", MAX_CIPHER_LEN);
+       } else if (!strcmp(s, "cmac-aes")) {
+               ks = 16;
+               strncpy(integrity, "cmac(aes)", MAX_CIPHER_LEN);
+       } else
+               r = -EINVAL;
 
-               if (strncmp(pass, pass_verify, key_size_max)) {
-                       log_err(cd, _("Passphrases do not match.\n"));
-                       r = -EPERM;
-                       goto out_err;
-               }
-       }
+       if (integrity_key_size)
+               *integrity_key_size = ks;
 
-       *key = pass;
-       *key_size = strlen(pass);
-       r = 0;
-out_err:
-       crypt_safe_free(pass_verify);
-       if (r)
-               crypt_safe_free(pass);
        return r;
 }
 
-/*
- * A simple call to lseek(3) might not be possible for some inputs (e.g.
- * reading from a pipe), so this function instead reads of up to BUFSIZ bytes
- * at a time until the specified number of bytes. It returns -1 on read error
- * or when it reaches EOF before the requested number of bytes have been
- * discarded.
- */
-static int keyfile_seek(int fd, size_t bytes)
+int crypt_parse_pbkdf(const char *s, const char **pbkdf)
 {
-       char tmp[BUFSIZ];
-       size_t next_read;
-       ssize_t bytes_r;
-       off_t r;
+       const char *tmp = NULL;
 
-       r = lseek(fd, bytes, SEEK_CUR);
-       if (r > 0)
-               return 0;
-       if (r < 0 && errno != ESPIPE)
-               return -1;
-
-       while (bytes > 0) {
-               /* figure out how much to read */
-               next_read = bytes > sizeof(tmp) ? sizeof(tmp) : bytes;
-
-               bytes_r = read(fd, tmp, next_read);
-               if (bytes_r < 0) {
-                       if (errno == EINTR)
-                               continue;
-
-                       /* read error */
-                       return -1;
-               }
-
-               if (bytes_r == 0)
-                       /* EOF */
-                       break;
-
-               bytes -= bytes_r;
-       }
-
-       return bytes == 0 ? 0 : -1;
-}
-
-/*
- * Note: --key-file=- is interpreted as a read from a binary file (stdin)
- * key_size_max == 0 means detect maximum according to input type (tty/file)
- * timeout and verify options only applies to tty input
- */
-int crypt_get_key(const char *prompt,
-                 char **key, size_t *key_size,
-                 size_t keyfile_offset, size_t keyfile_size_max,
-                 const char *key_file, int timeout, int verify,
-                 struct crypt_device *cd)
-{
-       int fd, regular_file, read_stdin, char_read, unlimited_read = 0;
-       int r = -EINVAL;
-       char *pass = NULL;
-       size_t buflen, i, file_read_size;
-       struct stat st;
-
-       *key = NULL;
-       *key_size = 0;
-
-       /* Passphrase read from stdin? */
-       read_stdin = (!key_file || !strcmp(key_file, "-")) ? 1 : 0;
-
-       if (read_stdin && isatty(STDIN_FILENO)) {
-               if (keyfile_offset) {
-                       log_err(cd, _("Cannot use offset with terminal input.\n"));
-                       return -EINVAL;
-               }
-               return crypt_get_key_tty(prompt, key, key_size, timeout, verify, cd);
-       }
-
-       if (read_stdin)
-               log_dbg("STDIN descriptor passphrase entry requested.");
-       else
-               log_dbg("File descriptor passphrase entry requested.");
-
-       /* If not requsted otherwise, we limit input to prevent memory exhaustion */
-       if (keyfile_size_max == 0) {
-               keyfile_size_max = DEFAULT_KEYFILE_SIZE_MAXKB * 1024;
-               unlimited_read = 1;
-       }
-
-       fd = read_stdin ? STDIN_FILENO : open(key_file, O_RDONLY);
-       if (fd < 0) {
-               log_err(cd, _("Failed to open key file.\n"));
+       if (!s)
                return -EINVAL;
-       }
-
-       /* use 4k for buffer (page divisor but avoid huge pages) */
-       buflen = 4096 - sizeof(struct safe_allocation);
-       regular_file = 0;
-       if(!read_stdin) {
-               if(stat(key_file, &st) < 0) {
-                       log_err(cd, _("Failed to stat key file.\n"));
-                       goto out_err;
-               }
-               if(S_ISREG(st.st_mode)) {
-                       regular_file = 1;
-                       file_read_size = (size_t)st.st_size;
 
-                       if (keyfile_offset > file_read_size) {
-                               log_err(cd, _("Cannot seek to requested keyfile offset.\n"));
-                               goto out_err;
-                       }
-                       file_read_size -= keyfile_offset;
+       if (!strcasecmp(s, CRYPT_KDF_PBKDF2))
+               tmp = CRYPT_KDF_PBKDF2;
+       else if (!strcasecmp(s, CRYPT_KDF_ARGON2I))
+               tmp = CRYPT_KDF_ARGON2I;
+       else if (!strcasecmp(s, CRYPT_KDF_ARGON2ID))
+               tmp = CRYPT_KDF_ARGON2ID;
 
-                       /* known keyfile size, alloc it in one step */
-                       if (file_read_size >= keyfile_size_max)
-                               buflen = keyfile_size_max;
-                       else if (file_read_size)
-                               buflen = file_read_size;
-               }
-       }
-
-       pass = crypt_safe_alloc(buflen);
-       if (!pass) {
-               log_err(cd, _("Out of memory while reading passphrase.\n"));
-               goto out_err;
-       }
-
-       /* Discard keyfile_offset bytes on input */
-       if (keyfile_offset && keyfile_seek(fd, keyfile_offset) < 0) {
-               log_err(cd, _("Cannot seek to requested keyfile offset.\n"));
-               goto out_err;
-       }
-
-       for(i = 0; i < keyfile_size_max; i++) {
-               if(i == buflen) {
-                       buflen += 4096;
-                       pass = crypt_safe_realloc(pass, buflen);
-                       if (!pass) {
-                               log_err(cd, _("Out of memory while reading passphrase.\n"));
-                               r = -ENOMEM;
-                               goto out_err;
-                       }
-               }
-
-               char_read = read(fd, &pass[i], 1);
-               if (char_read < 0) {
-                       log_err(cd, _("Error reading passphrase.\n"));
-                       goto out_err;
-               }
-
-               /* Stop on newline only if not requested read from keyfile */
-               if(char_read == 0 || (!key_file && pass[i] == '\n'))
-                       break;
-       }
-
-       /* Fail if piped input dies reading nothing */
-       if(!i && !regular_file) {
-               log_dbg("Nothing read on input.");
-               r = -EPIPE;
-               goto out_err;
-       }
-
-       /* Fail if we exceeded internal default (no specified size) */
-       if (unlimited_read && i == keyfile_size_max) {
-               log_err(cd, _("Maximum keyfile size exceeded.\n"));
-               goto out_err;
-       }
-
-       if (!unlimited_read && i != keyfile_size_max) {
-               log_err(cd, _("Cannot read requested amount of data.\n"));
-               goto out_err;
-       }
+       if (!tmp)
+               return -EINVAL;
 
-       *key = pass;
-       *key_size = i;
-       r = 0;
-out_err:
-       if(fd != STDIN_FILENO)
-               close(fd);
+       if (pbkdf)
+               *pbkdf = tmp;
 
-       if (r)
-               crypt_safe_free(pass);
-       return r;
+       return 0;
 }
 
 ssize_t crypt_hex_to_bytes(const char *hex, char **result, int safe_alloc)
@@ -485,68 +174,3 @@ ssize_t crypt_hex_to_bytes(const char *hex, char **result, int safe_alloc)
        *result = bytes;
        return i;
 }
-
-/*
- * Device size string parsing, suffixes:
- * s|S - 512 bytes sectors
- * k  |K  |m  |M  |g  |G  |t  |T   - 1024 base
- * kiB|KiB|miB|MiB|giB|GiB|tiB|TiB - 1024 base
- * kb |KB |mM |MB |gB |GB |tB |TB  - 1000 base
- */
-int crypt_string_to_size(struct crypt_device *cd, const char *s, uint64_t *size)
-{
-       char *endp = NULL;
-       size_t len;
-       uint64_t mult_base, mult, tmp;
-
-       *size = strtoull(s, &endp, 10);
-       if (!isdigit(s[0]) ||
-           (errno == ERANGE && *size == ULLONG_MAX) ||
-           (errno != 0 && *size == 0))
-               return -EINVAL;
-
-       if (!endp || !*endp)
-               return 0;
-
-       len = strlen(endp);
-       /* Allow "B" and "iB" suffixes */
-       if (len > 3 ||
-          (len == 3 && (endp[1] != 'i' || endp[2] != 'B')) ||
-          (len == 2 && endp[1] != 'B'))
-               return -EINVAL;
-
-       if (len == 1 || len == 3)
-               mult_base = 1024;
-       else
-               mult_base = 1000;
-
-       mult = 1;
-       switch (endp[0]) {
-       case 's':
-       case 'S': mult = 512;
-               break;
-       case 't':
-       case 'T': mult *= mult_base;
-                /* Fall through */
-       case 'g':
-       case 'G': mult *= mult_base;
-                /* Fall through */
-       case 'm':
-       case 'M': mult *= mult_base;
-                /* Fall through */
-       case 'k':
-       case 'K': mult *= mult_base;
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       tmp = *size * mult;
-       if ((tmp / *size) != mult) {
-               log_dbg("Device size overflow.");
-               return -EINVAL;
-       }
-
-       *size = tmp;
-       return 0;
-}
index 3da4842..32b77cb 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * utils_crypt - cipher utilities for cryptsetup
  *
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2012, Milan Broz
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #define MAX_CIPHER_LEN_STR     "31"
 #define MAX_KEYFILES           32
 
-struct crypt_device;
-
 int crypt_parse_name_and_mode(const char *s, char *cipher,
                              int *key_nums, char *cipher_mode);
-
-int crypt_get_key(const char *prompt,
-                 char **key, size_t *key_size,
-                 size_t keyfile_offset, size_t keyfile_size_max,
-                 const char *key_file,
-                 int timeout, int verify,
-                 struct crypt_device *cd);
-
-void *crypt_safe_alloc(size_t size);
-void crypt_safe_free(void *data);
-void *crypt_safe_realloc(void *data, size_t size);
-
-void crypt_memzero(void *s, size_t n);
+int crypt_parse_hash_integrity_mode(const char *s, char *integrity);
+int crypt_parse_integrity_mode(const char *s, char *integrity,
+                              int *integrity_key_size);
+int crypt_parse_pbkdf(const char *s, const char **pbkdf);
 
 ssize_t crypt_hex_to_bytes(const char *hex, char **result, int safe_alloc);
-int crypt_string_to_size(struct crypt_device *cd, const char *s, uint64_t *size);
 
 #endif /* _UTILS_CRYPT_H */
index 46c2a0f..75449c0 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * device backend utilities
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2015, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2015, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <assert.h>
 #include <string.h>
 #include <stdlib.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <linux/fs.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+# include <sys/sysmacros.h>     /* for major, minor */
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+# include <sys/statvfs.h>
+#endif
 #include "internal.h"
+#include "utils_device_locking.h"
 
 struct device {
        char *path;
@@ -38,31 +45,61 @@ struct device {
        char *file_path;
        int loop_fd;
 
-       int o_direct:1;
-       int init_done:1;
+       int ro_dev_fd;
+       int dev_fd;
+       int dev_fd_excl;
+
+       struct crypt_lock_handle *lh;
+
+       unsigned int o_direct:1;
+       unsigned int init_done:1; /* path is bdev or loop already initialized */
+
+       /* cached values */
+       size_t alignment;
+       size_t block_size;
 };
 
-static int device_block_size_fd(int fd, size_t *min_size)
+static size_t device_fs_block_size_fd(int fd)
+{
+       size_t page_size = crypt_getpagesize();
+
+#ifdef HAVE_SYS_STATVFS_H
+       struct statvfs buf;
+
+       /*
+        * NOTE: some filesystems (NFS) returns bogus blocksize (1MB).
+        * Page-size io should always work and avoids increasing IO beyond aligned LUKS header.
+        */
+       if (!fstatvfs(fd, &buf) && buf.f_bsize && buf.f_bsize <= page_size)
+               return (size_t)buf.f_bsize;
+#endif
+       return page_size;
+}
+
+static size_t device_block_size_fd(int fd, size_t *min_size)
 {
        struct stat st;
-       int bsize = 0, r = -EINVAL;
+       size_t bsize;
+       int arg;
 
        if (fstat(fd, &st) < 0)
-               return -EINVAL;
+               return 0;
 
        if (S_ISREG(st.st_mode))
-               r = (int)crypt_getpagesize();
-       else if (ioctl(fd, BLKSSZGET, &bsize) >= 0)
-               r = bsize;
-       else
-               r = -EINVAL;
+               bsize = device_fs_block_size_fd(fd);
+       else {
+               if (ioctl(fd, BLKSSZGET, &arg) < 0)
+                       bsize = crypt_getpagesize();
+               else
+                       bsize = (size_t)arg;
+       }
 
-       if (r < 0 || !min_size)
-               return r;
+       if (!min_size)
+               return bsize;
 
        if (S_ISREG(st.st_mode)) {
                /* file can be empty as well */
-               if (st.st_size > bsize)
+               if (st.st_size > (ssize_t)bsize)
                        *min_size = bsize;
                else
                        *min_size = st.st_size;
@@ -74,15 +111,28 @@ static int device_block_size_fd(int fd, size_t *min_size)
        return bsize;
 }
 
+static size_t device_alignment_fd(int devfd)
+{
+       long alignment = DEFAULT_MEM_ALIGNMENT;
+
+#ifdef _PC_REC_XFER_ALIGN
+       alignment = fpathconf(devfd, _PC_REC_XFER_ALIGN);
+       if (alignment < 0)
+               alignment = DEFAULT_MEM_ALIGNMENT;
+#endif
+       return (size_t)alignment;
+}
+
 static int device_read_test(int devfd)
 {
        char buffer[512];
-       int blocksize, r = -EIO;
-       size_t minsize = 0;
+       int r = -EIO;
+       size_t minsize = 0, blocksize, alignment;
 
        blocksize = device_block_size_fd(devfd, &minsize);
+       alignment = device_alignment_fd(devfd);
 
-       if (blocksize < 0)
+       if (!blocksize || !alignment)
                return -EINVAL;
 
        if (minsize == 0)
@@ -91,30 +141,31 @@ static int device_read_test(int devfd)
        if (minsize > sizeof(buffer))
                minsize = sizeof(buffer);
 
-       if (read_blockwise(devfd, blocksize, buffer, minsize) == (ssize_t)minsize)
+       if (read_blockwise(devfd, blocksize, alignment, buffer, minsize) == (ssize_t)minsize)
                r = 0;
 
-       crypt_memzero(buffer, sizeof(buffer));
+       crypt_safe_memzero(buffer, sizeof(buffer));
        return r;
 }
 
 /*
  * The direct-io is always preferred. The header is usually mapped to the same
  * device and can be accessed when the rest of device is mapped to data device.
- * Using dirct-io encsures that we do not mess with data in cache.
+ * Using direct-io ensures that we do not mess with data in cache.
  * (But proper alignment should prevent this in the first place.)
  * The read test is needed to detect broken configurations (seen with remote
  * block devices) that allow open with direct-io but then fails on read.
  */
-static int device_ready(struct device *device, int check_directio)
+static int device_ready(struct crypt_device *cd, struct device *device)
 {
        int devfd = -1, r = 0;
        struct stat st;
+       size_t tmp_size;
 
-       device->o_direct = 0;
-       if (check_directio) {
-               log_dbg("Trying to open and read device %s with direct-io.",
+       if (device->o_direct) {
+               log_dbg(cd, "Trying to open and read device %s with direct-io.",
                        device_path(device));
+               device->o_direct = 0;
                devfd = open(device_path(device), O_RDONLY | O_DIRECT);
                if (devfd >= 0) {
                        if (device_read_test(devfd) == 0) {
@@ -127,13 +178,13 @@ static int device_ready(struct device *device, int check_directio)
        }
 
        if (devfd < 0) {
-               log_dbg("Trying to open device %s without direct-io.",
+               log_dbg(cd, "Trying to open device %s without direct-io.",
                        device_path(device));
                devfd = open(device_path(device), O_RDONLY);
        }
 
        if (devfd < 0) {
-               log_err(NULL, _("Device %s doesn't exist or access denied.\n"),
+               log_err(cd, _("Device %s does not exist or access denied."),
                        device_path(device));
                return -EINVAL;
        }
@@ -142,31 +193,175 @@ static int device_ready(struct device *device, int check_directio)
                r = -EINVAL;
        else if (!S_ISBLK(st.st_mode))
                r = S_ISREG(st.st_mode) ? -ENOTBLK : -EINVAL;
+       if (r == -EINVAL) {
+               log_err(cd, _("Device %s is not compatible."),
+                       device_path(device));
+               close(devfd);
+               return r;
+       }
+
+       /* Allow only increase (loop device) */
+       tmp_size = device_alignment_fd(devfd);
+       if (tmp_size > device->alignment)
+               device->alignment = tmp_size;
+
+       tmp_size = device_block_size_fd(devfd, NULL);
+       if (tmp_size > device->block_size)
+               device->block_size = tmp_size;
 
        close(devfd);
        return r;
 }
 
-int device_open(struct device *device, int flags)
+static int _open_locked(struct crypt_device *cd, struct device *device, int flags)
 {
-       int devfd;
+       int fd;
+
+       log_dbg(cd, "Opening locked device %s", device_path(device));
+
+       if ((flags & O_ACCMODE) != O_RDONLY && device_locked_readonly(device->lh)) {
+               log_dbg(cd, "Cannot open locked device %s in write mode. Read lock held.", device_path(device));
+               return -EAGAIN;
+       }
+
+       fd = open(device_path(device), flags);
+       if (fd < 0)
+               return -errno;
+
+       if (device_locked_verify(cd, fd, device->lh)) {
+               /* fd doesn't correspond to a locked resource */
+               close(fd);
+               log_dbg(cd, "Failed to verify lock resource for device %s.", device_path(device));
+               return -EINVAL;
+       }
+
+       return fd;
+}
+
+/*
+ * Common wrapper for device sync.
+ */
+void device_sync(struct crypt_device *cd, struct device *device)
+{
+       if (!device || device->dev_fd < 0)
+               return;
+
+       if (fsync(device->dev_fd) == -1)
+               log_dbg(cd, "Cannot sync device %s.", device_path(device));
+}
+
+/*
+ * in non-locked mode returns always fd or -1
+ *
+ * in locked mode:
+ *     opened fd or one of:
+ *     -EAGAIN : requested write mode while device being locked in via shared lock
+ *     -EINVAL : invalid lock fd state
+ *     -1      : all other errors
+ */
+static int device_open_internal(struct crypt_device *cd, struct device *device, int flags)
+{
+       int access, devfd;
 
-       flags |= O_SYNC;
        if (device->o_direct)
                flags |= O_DIRECT;
 
-       devfd = open(device_path(device), flags);
+       access = flags & O_ACCMODE;
+       if (access == O_WRONLY)
+               access = O_RDWR;
+
+       if (access == O_RDONLY && device->ro_dev_fd >= 0) {
+               log_dbg(cd, "Reusing open r%c fd on device %s", 'o', device_path(device));
+               return device->ro_dev_fd;
+       } else if (access == O_RDWR && device->dev_fd >= 0) {
+               log_dbg(cd, "Reusing open r%c fd on device %s", 'w', device_path(device));
+               return device->dev_fd;
+       }
+
+       if (device_locked(device->lh))
+               devfd = _open_locked(cd, device, flags);
+       else
+               devfd = open(device_path(device), flags);
+
+       if (devfd < 0) {
+               log_dbg(cd, "Cannot open device %s%s.",
+                       device_path(device),
+                       access != O_RDONLY ? " for write" : "");
+               return devfd;
+       }
 
-       if (devfd < 0)
-               log_dbg("Cannot open device %s.", device_path(device));
+       if (access == O_RDONLY)
+               device->ro_dev_fd = devfd;
+       else
+               device->dev_fd = devfd;
 
        return devfd;
 }
 
-int device_alloc(struct device **device, const char *path)
+int device_open(struct crypt_device *cd, struct device *device, int flags)
+{
+       assert(!device_locked(device->lh));
+       return device_open_internal(cd, device, flags);
+}
+
+int device_open_excl(struct crypt_device *cd, struct device *device, int flags)
+{
+       const char *path;
+       struct stat st;
+
+       if (!device)
+               return -EINVAL;
+
+       assert(!device_locked(device->lh));
+
+       if (device->dev_fd_excl < 0) {
+               path = device_path(device);
+               if (stat(path, &st))
+                       return -EINVAL;
+               if (!S_ISBLK(st.st_mode))
+                       log_dbg(cd, "%s is not a block device. Can't open in exclusive mode.",
+                               path);
+               else {
+                       /* open(2) with O_EXCL (w/o O_CREAT) on regular file is undefined behaviour according to man page */
+                       /* coverity[toctou] */
+                       device->dev_fd_excl = open(path, O_RDONLY | O_EXCL);
+                       if (device->dev_fd_excl < 0)
+                               return errno == EBUSY ? -EBUSY : device->dev_fd_excl;
+                       if (fstat(device->dev_fd_excl, &st) || !S_ISBLK(st.st_mode)) {
+                               log_dbg(cd, "%s is not a block device. Can't open in exclusive mode.",
+                                       path);
+                               close(device->dev_fd_excl);
+                               device->dev_fd_excl = -1;
+                       } else
+                               log_dbg(cd, "Device %s is blocked for exclusive open.", path);
+               }
+       }
+
+       return device_open_internal(cd, device, flags);
+}
+
+void device_release_excl(struct crypt_device *cd, struct device *device)
+{
+       if (device && device->dev_fd_excl >= 0) {
+               if (close(device->dev_fd_excl))
+                       log_dbg(cd, "Failed to release exclusive handle on device %s.",
+                               device_path(device));
+               else
+                       log_dbg(cd, "Closed exclusive fd for %s.", device_path(device));
+               device->dev_fd_excl = -1;
+       }
+}
+
+int device_open_locked(struct crypt_device *cd, struct device *device, int flags)
+{
+       assert(!crypt_metadata_locking_enabled() || device_locked(device->lh));
+       return device_open_internal(cd, device, flags);
+}
+
+/* Avoid any read from device, expects direct-io to work. */
+int device_alloc_no_check(struct device **device, const char *path)
 {
        struct device *dev;
-       int r;
 
        if (!path) {
                *device = NULL;
@@ -184,32 +379,60 @@ int device_alloc(struct device **device, const char *path)
                return -ENOMEM;
        }
        dev->loop_fd = -1;
+       dev->ro_dev_fd = -1;
+       dev->dev_fd = -1;
+       dev->dev_fd_excl = -1;
+       dev->o_direct = 1;
 
-       r = device_ready(dev, 1);
-       if (!r) {
-               dev->init_done = 1;
-       } else if (r == -ENOTBLK) {
-               /* alloc loop later */
-       } else if (r < 0) {
-               free(dev->path);
-               free(dev);
-               return -ENOTBLK;
+       *device = dev;
+       return 0;
+}
+
+int device_alloc(struct crypt_device *cd, struct device **device, const char *path)
+{
+       struct device *dev;
+       int r;
+
+       r = device_alloc_no_check(&dev, path);
+       if (r < 0)
+               return r;
+
+       if (dev) {
+               r = device_ready(cd, dev);
+               if (!r) {
+                       dev->init_done = 1;
+               } else if (r == -ENOTBLK) {
+                       /* alloc loop later */
+               } else if (r < 0) {
+                       free(dev->path);
+                       free(dev);
+                       return -ENOTBLK;
+               }
        }
 
        *device = dev;
        return 0;
 }
 
-void device_free(struct device *device)
+void device_free(struct crypt_device *cd, struct device *device)
 {
        if (!device)
                return;
 
+       device_close(cd, device);
+
+       if (device->dev_fd_excl != -1) {
+               log_dbg(cd, "Closed exclusive fd for %s.", device_path(device));
+               close(device->dev_fd_excl);
+       }
+
        if (device->loop_fd != -1) {
-               log_dbg("Closed loop %s (%s).", device->path, device->file_path);
+               log_dbg(cd, "Closed loop %s (%s).", device->path, device->file_path);
                close(device->loop_fd);
        }
 
+       assert(!device_locked(device->lh));
+
        free(device->file_path);
        free(device->path);
        free(device);
@@ -224,6 +447,21 @@ const char *device_block_path(const struct device *device)
        return device->path;
 }
 
+/* Get device-mapper name of device (if possible) */
+const char *device_dm_name(const struct device *device)
+{
+       const char *dmdir = dm_get_dir();
+       size_t dmdir_len = strlen(dmdir);
+
+       if (!device || !device->init_done)
+               return NULL;
+
+       if (strncmp(device->path, dmdir, dmdir_len))
+               return NULL;
+
+       return &device->path[dmdir_len+1];
+}
+
 /* Get path to device / file */
 const char *device_path(const struct device *device)
 {
@@ -243,10 +481,11 @@ const char *device_path(const struct device *device)
 #define BLKALIGNOFF _IO(0x12,122)
 #endif
 
-void device_topology_alignment(struct device *device,
-                           unsigned long *required_alignment, /* bytes */
-                           unsigned long *alignment_offset,   /* bytes */
-                           unsigned long default_alignment)
+void device_topology_alignment(struct crypt_device *cd,
+                              struct device *device,
+                              unsigned long *required_alignment, /* bytes */
+                              unsigned long *alignment_offset,   /* bytes */
+                              unsigned long default_alignment)
 {
        int dev_alignment_offset = 0;
        unsigned int min_io_size = 0, opt_io_size = 0;
@@ -265,7 +504,7 @@ void device_topology_alignment(struct device *device,
 
        /* minimum io size */
        if (ioctl(fd, BLKIOMIN, &min_io_size) == -1) {
-               log_dbg("Topology info for %s not supported, using default offset %lu bytes.",
+               log_dbg(cd, "Topology info for %s not supported, using default offset %lu bytes.",
                        device->path, default_alignment);
                goto out;
        }
@@ -281,40 +520,41 @@ void device_topology_alignment(struct device *device,
 
        temp_alignment = (unsigned long)min_io_size;
 
-       if (temp_alignment < (unsigned long)opt_io_size)
+       /* Ignore bogus opt-io that could break alignment */
+       if ((temp_alignment < (unsigned long)opt_io_size) &&
+           !((unsigned long)opt_io_size % temp_alignment))
                temp_alignment = (unsigned long)opt_io_size;
 
        /* If calculated alignment is multiple of default, keep default */
        if (temp_alignment && (default_alignment % temp_alignment))
                *required_alignment = temp_alignment;
 
-       log_dbg("Topology: IO (%u/%u), offset = %lu; Required alignment is %lu bytes.",
+       log_dbg(cd, "Topology: IO (%u/%u), offset = %lu; Required alignment is %lu bytes.",
                min_io_size, opt_io_size, *alignment_offset, *required_alignment);
 out:
        (void)close(fd);
 }
 
-int device_block_size(struct device *device)
+size_t device_block_size(struct crypt_device *cd, struct device *device)
 {
-       int fd, r = -EINVAL;
+       int fd;
 
        if (!device)
                return 0;
 
-       if (device->file_path)
-               return (int)crypt_getpagesize();
-
-       fd = open(device->path, O_RDONLY);
-       if(fd < 0)
-               return -EINVAL;
+       if (device->block_size)
+               return device->block_size;
 
-       r = device_block_size_fd(fd, NULL);
+       fd = open(device->file_path ?: device->path, O_RDONLY);
+       if (fd >= 0) {
+               device->block_size = device_block_size_fd(fd, NULL);
+               close(fd);
+       }
 
-       if (r <= 0)
-               log_dbg("Cannot get block size for device %s.", device_path(device));
+       if (!device->block_size)
+               log_dbg(cd, "Cannot get block size for device %s.", device_path(device));
 
-       close(fd);
-       return r;
+       return device->block_size;
 }
 
 int device_read_ahead(struct device *device, uint32_t *read_ahead)
@@ -360,18 +600,72 @@ out:
        return r;
 }
 
-static int device_info(struct device *device,
-                       enum devcheck device_check,
-                       int *readonly, uint64_t *size)
+/* For a file, allocate the required space */
+int device_fallocate(struct device *device, uint64_t size)
 {
        struct stat st;
-       int fd, r = -EINVAL, flags = 0;
+       int devfd, r = -EINVAL;
+
+       devfd = open(device_path(device), O_RDWR);
+       if (devfd == -1)
+               return -EINVAL;
 
-       *readonly = 0;
-       *size = 0;
+       if (!fstat(devfd, &st) && S_ISREG(st.st_mode) &&
+           ((uint64_t)st.st_size >= size || !posix_fallocate(devfd, 0, size))) {
+               r = 0;
+               if (device->file_path && crypt_loop_resize(device->path))
+                       r = -EINVAL;
+       }
+
+       close(devfd);
+       return r;
+}
+
+int device_check_size(struct crypt_device *cd,
+                     struct device *device,
+                     uint64_t req_offset, int falloc)
+{
+       uint64_t dev_size;
 
-       if (stat(device->path, &st) < 0)
+       if (device_size(device, &dev_size)) {
+               log_dbg(cd, "Cannot get device size for device %s.", device_path(device));
+               return -EIO;
+       }
+
+       log_dbg(cd, "Device size %" PRIu64 ", offset %" PRIu64 ".", dev_size, req_offset);
+
+       if (req_offset > dev_size) {
+               /* If it is header file, increase its size */
+               if (falloc && !device_fallocate(device, req_offset))
+                       return 0;
+
+               log_err(cd, _("Device %s is too small. Need at least %" PRIu64 " bytes."),
+                       device_path(device), req_offset);
                return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int device_info(struct crypt_device *cd,
+                      struct device *device,
+                      enum devcheck device_check,
+                      int *readonly, uint64_t *size)
+{
+       struct stat st;
+       int fd = -1, r, flags = 0, real_readonly;
+       uint64_t real_size;
+
+       if (!device)
+               return -ENOTBLK;
+
+       real_readonly = 0;
+       real_size = 0;
+
+       if (stat(device->path, &st) < 0) {
+               r = -EINVAL;
+               goto out;
+       }
 
        /* never wipe header on mounted device */
        if (device_check == DEV_EXCL && S_ISBLK(st.st_mode))
@@ -381,64 +675,93 @@ static int device_info(struct device *device,
        /* coverity[toctou] */
        fd = open(device->path, O_RDWR | flags);
        if (fd == -1 && errno == EROFS) {
-               *readonly = 1;
+               real_readonly = 1;
                fd = open(device->path, O_RDONLY | flags);
        }
 
-       if (fd == -1 && device_check == DEV_EXCL && errno == EBUSY)
-               return -EBUSY;
+       if (fd == -1 && device_check == DEV_EXCL && errno == EBUSY) {
+               r = -EBUSY;
+               goto out;
+       }
 
-       if (fd == -1)
-               return -EINVAL;
+       if (fd == -1) {
+               r = errno ? -errno : -EINVAL;
+               goto out;
+       }
 
+       r = 0;
        if (S_ISREG(st.st_mode)) {
                //FIXME: add readonly check
-               *size = (uint64_t)st.st_size;
-               *size >>= SECTOR_SHIFT;
+               real_size = (uint64_t)st.st_size;
+               real_size >>= SECTOR_SHIFT;
        } else {
                /* If the device can be opened read-write, i.e. readonly is still 0, then
                 * check whether BKROGET says that it is read-only. E.g. read-only loop
-                * devices may be openend read-write but are read-only according to BLKROGET
+                * devices may be opened read-write but are read-only according to BLKROGET
                 */
-               if (*readonly == 0 && (r = ioctl(fd, BLKROGET, readonly)) < 0)
+               if (real_readonly == 0 && (r = ioctl(fd, BLKROGET, &real_readonly)) < 0)
                        goto out;
 
-               if (ioctl(fd, BLKGETSIZE64, size) >= 0) {
-                       *size >>= SECTOR_SHIFT;
-                       r = 0;
+               r = ioctl(fd, BLKGETSIZE64, &real_size);
+               if (r >= 0) {
+                       real_size >>= SECTOR_SHIFT;
                        goto out;
                }
        }
-       r = -EINVAL;
 out:
-       close(fd);
+       if (fd != -1)
+               close(fd);
+
+       switch (r) {
+       case 0:
+               if (readonly)
+                       *readonly = real_readonly;
+               if (size)
+                       *size = real_size;
+               break;
+       case -EBUSY:
+               log_err(cd, _("Cannot use device %s which is in use "
+                             "(already mapped or mounted)."), device_path(device));
+               break;
+       case -EACCES:
+               log_err(cd, _("Cannot use device %s, permission denied."), device_path(device));
+               break;
+       default:
+               log_err(cd, _("Cannot get info about device %s."), device_path(device));
+               r = -EINVAL;
+       }
+
        return r;
 }
 
+int device_check_access(struct crypt_device *cd,
+                       struct device *device,
+                       enum devcheck device_check)
+{
+       return device_info(cd, device, device_check, NULL, NULL);
+}
+
 static int device_internal_prepare(struct crypt_device *cd, struct device *device)
 {
-       char *loop_device, *file_path = NULL;
+       char *loop_device = NULL, *file_path = NULL;
        int r, loop_fd, readonly = 0;
 
        if (device->init_done)
                return 0;
 
-       log_dbg("Allocating a free loop device.");
-       loop_device = crypt_loop_get_device();
-       if (!loop_device) {
-               if (getuid() || geteuid())
-                       log_err(cd, _("Cannot use a loopback device, "
-                                     "running as non-root user.\n"));
-               else
-                       log_err(cd, _("Cannot find a free loopback device.\n"));
+       if (getuid() || geteuid()) {
+               log_err(cd, _("Cannot use a loopback device, "
+                             "running as non-root user."));
                return -ENOTSUP;
        }
 
-       /* Keep the loop open, dettached on last close. */
-       loop_fd = crypt_loop_attach(loop_device, device->path, 0, 1, &readonly);
+       log_dbg(cd, "Allocating a free loop device.");
+
+       /* Keep the loop open, detached on last close. */
+       loop_fd = crypt_loop_attach(&loop_device, device->path, 0, 1, &readonly);
        if (loop_fd == -1) {
                log_err(cd, _("Attaching loopback device failed "
-                       "(loop device with autoclear flag is required).\n"));
+                       "(loop device with autoclear flag is required)."));
                free(loop_device);
                return -EINVAL;
        }
@@ -446,7 +769,7 @@ static int device_internal_prepare(struct crypt_device *cd, struct device *devic
        file_path = device->path;
        device->path = loop_device;
 
-       r = device_ready(device, device->o_direct);
+       r = device_ready(cd, device);
        if (r < 0) {
                device->path = file_path;
                crypt_loop_detach(loop_device);
@@ -478,28 +801,20 @@ int device_block_adjust(struct crypt_device *cd,
        if (r)
                return r;
 
-       r = device_info(device, device_check, &real_readonly, &real_size);
-       if (r < 0) {
-               if (r == -EBUSY)
-                       log_err(cd, _("Cannot use device %s which is in use "
-                                     "(already mapped or mounted).\n"),
-                                     device->path);
-               else
-                       log_err(cd, _("Cannot get info about device %s.\n"),
-                               device->path);
+       r = device_info(cd, device, device_check, &real_readonly, &real_size);
+       if (r)
                return r;
-       }
 
        if (device_offset >= real_size) {
-               log_err(cd, _("Requested offset is beyond real size of device %s.\n"),
-                       device->path);
+               log_err(cd, _("Requested offset is beyond real size of device %s."),
+                       device_path(device));
                return -EINVAL;
        }
 
        if (size && !*size) {
                *size = real_size;
                if (!*size) {
-                       log_err(cd, _("Device %s has zero size.\n"), device->path);
+                       log_err(cd, _("Device %s has zero size."), device_path(device));
                        return -ENOTBLK;
                }
                *size -= device_offset;
@@ -507,10 +822,10 @@ int device_block_adjust(struct crypt_device *cd,
 
        /* in case of size is set by parameter */
        if (size && ((real_size - device_offset) < *size)) {
-               log_dbg("Device %s: offset = %" PRIu64 " requested size = %" PRIu64
+               log_dbg(cd, "Device %s: offset = %" PRIu64 " requested size = %" PRIu64
                        ", backing device size = %" PRIu64,
                        device->path, device_offset, *size, real_size);
-               log_err(cd, _("Device %s is too small.\n"), device->path);
+               log_err(cd, _("Device %s is too small."), device_path(device));
                return -EINVAL;
        }
 
@@ -518,13 +833,156 @@ int device_block_adjust(struct crypt_device *cd,
                *flags |= CRYPT_ACTIVATE_READONLY;
 
        if (size)
-               log_dbg("Calculated device size is %" PRIu64" sectors (%s), offset %" PRIu64 ".",
+               log_dbg(cd, "Calculated device size is %" PRIu64" sectors (%s), offset %" PRIu64 ".",
                *size, real_readonly ? "RO" : "RW", device_offset);
        return 0;
 }
 
-size_t size_round_up(size_t size, unsigned int block)
+size_t size_round_up(size_t size, size_t block)
 {
        size_t s = (size + (block - 1)) / block;
        return s * block;
 }
+
+void device_disable_direct_io(struct device *device)
+{
+       device->o_direct = 0;
+}
+
+int device_direct_io(const struct device *device)
+{
+       return device->o_direct;
+}
+
+static dev_t device_devno(const struct device *device)
+{
+       struct stat st;
+
+       if (stat(device->path, &st) || !S_ISBLK(st.st_mode))
+               return 0;
+
+       return st.st_rdev;
+}
+
+int device_is_identical(struct device *device1, struct device *device2)
+{
+       if (!device1 || !device2)
+               return 0;
+
+       if (device1 == device2)
+               return 1;
+
+       if (device1->init_done && device2->init_done)
+               return (device_devno(device1) == device_devno(device2));
+       else if (device1->init_done || device2->init_done)
+               return 0;
+
+       if (!strcmp(device_path(device1), device_path(device2)))
+               return 1;
+
+       return 0;
+}
+
+int device_is_rotational(struct device *device)
+{
+       struct stat st;
+
+       if (stat(device_path(device), &st) < 0)
+               return -EINVAL;
+
+       if (!S_ISBLK(st.st_mode))
+               return 0;
+
+       return crypt_dev_is_rotational(major(st.st_rdev), minor(st.st_rdev));
+}
+
+size_t device_alignment(struct device *device)
+{
+       int devfd;
+
+       if (!device->alignment) {
+               devfd = open(device_path(device), O_RDONLY);
+               if (devfd != -1) {
+                       device->alignment = device_alignment_fd(devfd);
+                       close(devfd);
+               }
+       }
+
+       return device->alignment;
+}
+
+void device_set_lock_handle(struct device *device, struct crypt_lock_handle *h)
+{
+       device->lh = h;
+}
+
+struct crypt_lock_handle *device_get_lock_handle(struct device *device)
+{
+       return device->lh;
+}
+
+int device_read_lock(struct crypt_device *cd, struct device *device)
+{
+       if (!crypt_metadata_locking_enabled())
+               return 0;
+
+       if (device_read_lock_internal(cd, device))
+               return -EBUSY;
+
+       return 0;
+}
+
+int device_write_lock(struct crypt_device *cd, struct device *device)
+{
+       if (!crypt_metadata_locking_enabled())
+               return 0;
+
+       assert(!device_locked(device->lh) || !device_locked_readonly(device->lh));
+
+       return device_write_lock_internal(cd, device);
+}
+
+void device_read_unlock(struct crypt_device *cd, struct device *device)
+{
+       if (!crypt_metadata_locking_enabled())
+               return;
+
+       assert(device_locked(device->lh));
+
+       device_unlock_internal(cd, device);
+}
+
+void device_write_unlock(struct crypt_device *cd, struct device *device)
+{
+       if (!crypt_metadata_locking_enabled())
+               return;
+
+       assert(device_locked(device->lh) && !device_locked_readonly(device->lh));
+
+       device_unlock_internal(cd, device);
+}
+
+bool device_is_locked(struct device *device)
+{
+       return device ? device_locked(device->lh) : 0;
+}
+
+void device_close(struct crypt_device *cd, struct device *device)
+{
+       if (!device)
+               return;
+
+       if (device->ro_dev_fd != -1) {
+               log_dbg(cd, "Closing read only fd for %s.", device_path(device));
+               if (close(device->ro_dev_fd))
+                       log_dbg(cd, "Failed to close read only fd for %s.", device_path(device));
+               device->ro_dev_fd = -1;
+       }
+
+       if (device->dev_fd != -1) {
+               log_dbg(cd, "Closing read write fd for %s.", device_path(device));
+               if (close(device->dev_fd))
+                       log_dbg(cd, "Failed to close read write fd for %s.", device_path(device));
+               device->dev_fd = -1;
+       }
+}
diff --git a/lib/utils_device_locking.c b/lib/utils_device_locking.c
new file mode 100644 (file)
index 0000000..dac8315
--- /dev/null
@@ -0,0 +1,521 @@
+/*
+ * Metadata on-disk locking for processes serialization
+ *
+ * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <linux/limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+# include <sys/sysmacros.h>     /* for major, minor */
+#endif
+#include <libgen.h>
+#include <assert.h>
+
+#include "internal.h"
+#include "utils_device_locking.h"
+
+#define same_inode(buf1, buf2) \
+       ((buf1).st_ino == (buf2).st_ino && \
+        (buf1).st_dev == (buf2).st_dev)
+
+enum lock_type {
+       DEV_LOCK_READ = 0,
+       DEV_LOCK_WRITE
+};
+
+enum lock_mode {
+       DEV_LOCK_FILE = 0,
+       DEV_LOCK_BDEV,
+       DEV_LOCK_NAME
+};
+
+struct crypt_lock_handle {
+       unsigned refcnt;
+       int flock_fd;
+       enum lock_type type;
+       enum lock_mode mode;
+       union {
+       struct {
+               dev_t devno;
+       } bdev;
+       struct {
+               char *name;
+       } name;
+       } u;
+};
+
+static int resource_by_name(char *res, size_t res_size, const char *name, bool fullpath)
+{
+       int r;
+
+       if (fullpath)
+               r = snprintf(res, res_size, "%s/LN_%s", DEFAULT_LUKS2_LOCK_PATH, name);
+       else
+               r = snprintf(res, res_size, "LN_%s", name);
+
+       return (r < 0 || (size_t)r >= res_size) ? -EINVAL : 0;
+}
+
+static int resource_by_devno(char *res, size_t res_size, dev_t devno, unsigned fullpath)
+{
+       int r;
+
+       if (fullpath)
+               r = snprintf(res, res_size, "%s/L_%d:%d", DEFAULT_LUKS2_LOCK_PATH, major(devno), minor(devno));
+       else
+               r = snprintf(res, res_size, "L_%d:%d", major(devno), minor(devno));
+
+       return (r < 0 || (size_t)r >= res_size) ? -EINVAL : 0;
+}
+
+static int open_lock_dir(struct crypt_device *cd, const char *dir, const char *base)
+{
+       int dirfd, lockdfd;
+
+       dirfd = open(dir, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+       if (dirfd < 0) {
+               log_dbg(cd, "Failed to open directory %s: (%d: %s).", dir, errno, strerror(errno));
+               if (errno == ENOTDIR || errno == ENOENT)
+                       log_err(cd, _("Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."), dir, base);
+               return -EINVAL;
+       }
+
+       lockdfd = openat(dirfd, base, O_RDONLY | O_NOFOLLOW | O_DIRECTORY | O_CLOEXEC);
+       if (lockdfd < 0) {
+               if (errno == ENOENT) {
+                       log_std(cd, _("WARNING: Locking directory %s/%s is missing!\n"), dir, base);
+
+                       /* success or failure w/ errno == EEXIST either way just try to open the 'base' directory again */
+                       if (mkdirat(dirfd, base, DEFAULT_LUKS2_LOCK_DIR_PERMS) && errno != EEXIST)
+                               log_dbg(cd, "Failed to create directory %s in %s (%d: %s).", base, dir, errno, strerror(errno));
+                       else
+                               lockdfd = openat(dirfd, base, O_RDONLY | O_NOFOLLOW | O_DIRECTORY | O_CLOEXEC);
+               } else {
+                       log_dbg(cd, "Failed to open directory %s/%s: (%d: %s)", dir, base, errno, strerror(errno));
+                       if (errno == ENOTDIR || errno == ELOOP)
+                               log_err(cd, _("Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."), dir, base, base);
+               }
+       }
+
+       close(dirfd);
+       return lockdfd >= 0 ? lockdfd : -EINVAL;
+}
+
+static int open_resource(struct crypt_device *cd, const char *res)
+{
+       int err, lockdir_fd, r;
+       char dir[] = DEFAULT_LUKS2_LOCK_PATH,
+            base[] = DEFAULT_LUKS2_LOCK_PATH;
+
+       lockdir_fd = open_lock_dir(cd, dirname(dir), basename(base));
+       if (lockdir_fd < 0)
+               return -EINVAL;
+
+       log_dbg(cd, "Opening lock resource file %s/%s", DEFAULT_LUKS2_LOCK_PATH, res);
+       r = openat(lockdir_fd, res, O_CREAT | O_NOFOLLOW | O_RDWR | O_CLOEXEC, 0777);
+       err = errno;
+
+       close(lockdir_fd);
+
+       return r < 0 ? -err : r;
+}
+
+static int acquire_lock_handle(struct crypt_device *cd, struct device *device, struct crypt_lock_handle *h)
+{
+       char res[PATH_MAX];
+       int dev_fd, fd;
+       struct stat st;
+
+       dev_fd = open(device_path(device), O_RDONLY | O_NONBLOCK | O_CLOEXEC);
+       if (dev_fd < 0)
+               return -EINVAL;
+
+       if (fstat(dev_fd, &st)) {
+               close(dev_fd);
+               return -EINVAL;
+       }
+
+       if (S_ISBLK(st.st_mode)) {
+               if (resource_by_devno(res, sizeof(res), st.st_rdev, 0)) {
+                       close(dev_fd);
+                       return -EINVAL;
+               }
+
+               fd = open_resource(cd, res);
+               close(dev_fd);
+               if (fd < 0)
+                       return fd;
+
+               h->flock_fd = fd;
+               h->u.bdev.devno = st.st_rdev;
+               h->mode = DEV_LOCK_BDEV;
+       } else if (S_ISREG(st.st_mode)) {
+               // FIXME: workaround for nfsv4
+               fd = open(device_path(device), O_RDWR | O_NONBLOCK | O_CLOEXEC);
+               if (fd < 0)
+                       h->flock_fd = dev_fd;
+               else {
+                       h->flock_fd = fd;
+                       close(dev_fd);
+               }
+               h->mode = DEV_LOCK_FILE;
+       } else {
+               /* Wrong device type */
+               close(dev_fd);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int acquire_lock_handle_by_name(struct crypt_device *cd, const char *name, struct crypt_lock_handle *h)
+{
+       char res[PATH_MAX];
+       int fd;
+
+       h->u.name.name = strdup(name);
+       if (!h->u.name.name)
+               return -ENOMEM;
+
+       if (resource_by_name(res, sizeof(res), name, false)) {
+               free(h->u.name.name);
+               return -EINVAL;
+       }
+
+       fd = open_resource(cd, res);
+       if (fd < 0) {
+               free(h->u.name.name);
+               return fd;
+       }
+
+       h->flock_fd = fd;
+       h->mode = DEV_LOCK_NAME;
+
+       return 0;
+}
+
+static void release_lock_handle(struct crypt_device *cd, struct crypt_lock_handle *h)
+{
+       char res[PATH_MAX];
+       struct stat buf_a, buf_b;
+
+       if ((h->mode == DEV_LOCK_NAME) && /* was it name lock */
+           !flock(h->flock_fd, LOCK_EX | LOCK_NB) && /* lock to drop the file */
+           !resource_by_name(res, sizeof(res), h->u.name.name, true) && /* acquire lock resource name */
+           !fstat(h->flock_fd, &buf_a) && /* read inode id referred by fd */
+           !stat(res, &buf_b) && /* does path file still exist? */
+           same_inode(buf_a, buf_b)) { /* is it same id as the one referenced by fd? */
+               /* coverity[toctou] */
+               if (unlink(res)) /* yes? unlink the file */
+                       log_dbg(cd, "Failed to unlink resource file: %s", res);
+       }
+
+       if ((h->mode == DEV_LOCK_BDEV) && /* was it block device */
+           !flock(h->flock_fd, LOCK_EX | LOCK_NB) && /* lock to drop the file */
+           !resource_by_devno(res, sizeof(res), h->u.bdev.devno, 1) && /* acquire lock resource name */
+           !fstat(h->flock_fd, &buf_a) && /* read inode id referred by fd */
+           !stat(res, &buf_b) && /* does path file still exist? */
+           same_inode(buf_a, buf_b)) { /* is it same id as the one referenced by fd? */
+               /* coverity[toctou] */
+               if (unlink(res)) /* yes? unlink the file */
+                       log_dbg(cd, "Failed to unlink resource file: %s", res);
+       }
+
+       if (h->mode == DEV_LOCK_NAME)
+               free(h->u.name.name);
+
+       if (close(h->flock_fd))
+               log_dbg(cd, "Failed to close lock resource fd (%d).", h->flock_fd);
+}
+
+int device_locked(struct crypt_lock_handle *h)
+{
+       return (h && (h->type == DEV_LOCK_READ || h->type == DEV_LOCK_WRITE));
+}
+
+int device_locked_readonly(struct crypt_lock_handle *h)
+{
+       return (h && h->type == DEV_LOCK_READ);
+}
+
+static int verify_lock_handle(const char *device_path, struct crypt_lock_handle *h)
+{
+       char res[PATH_MAX];
+       struct stat lck_st, res_st;
+
+       /* we locked a regular file, check during device_open() instead. No reason to check now */
+       if (h->mode == DEV_LOCK_FILE)
+               return 0;
+
+       if (h->mode == DEV_LOCK_NAME) {
+               if (resource_by_name(res, sizeof(res), h->u.name.name, true))
+                       return -EINVAL;
+       } else if (h->mode == DEV_LOCK_BDEV) {
+               if (resource_by_devno(res, sizeof(res), h->u.bdev.devno, true))
+                       return -EINVAL;
+       } else
+               return -EINVAL;
+
+       if (fstat(h->flock_fd, &lck_st))
+               return -EINVAL;
+
+       return (stat(res, &res_st) || !same_inode(lck_st, res_st)) ? -EAGAIN : 0;
+}
+
+static unsigned device_lock_inc(struct crypt_lock_handle *h)
+{
+       return ++h->refcnt;
+}
+
+static unsigned device_lock_dec(struct crypt_lock_handle *h)
+{
+       assert(h->refcnt);
+
+       return --h->refcnt;
+}
+
+static int acquire_and_verify(struct crypt_device *cd, struct device *device, const char *resource, int flock_op, struct crypt_lock_handle **lock)
+{
+       int r;
+       struct crypt_lock_handle *h;
+
+       if (device && resource)
+               return -EINVAL;
+
+       if (!(h = malloc(sizeof(*h))))
+               return -ENOMEM;
+
+       do {
+               r = device ? acquire_lock_handle(cd, device, h) : acquire_lock_handle_by_name(cd, resource, h);
+               if (r < 0)
+                       break;
+
+               if (flock(h->flock_fd, flock_op)) {
+                       log_dbg(cd, "Flock on fd %d failed with errno %d.", h->flock_fd, errno);
+                       r = (errno == EWOULDBLOCK) ? -EBUSY : -EINVAL;
+                       release_lock_handle(cd, h);
+                       break;
+               }
+
+               log_dbg(cd, "Verifying lock handle for %s.", device ? device_path(device) : resource);
+
+               /*
+                * check whether another libcryptsetup process removed resource file before this
+                * one managed to flock() it. See release_lock_handle() for details
+                */
+               r = verify_lock_handle(device_path(device), h);
+               if (r < 0) {
+                       if (flock(h->flock_fd, LOCK_UN))
+                               log_dbg(cd, "flock on fd %d failed.", h->flock_fd);
+                       release_lock_handle(cd, h);
+                       log_dbg(cd, "Lock handle verification failed.");
+               }
+       } while (r == -EAGAIN);
+
+       if (r < 0) {
+               free(h);
+               return r;
+       }
+
+       *lock = h;
+
+       return 0;
+}
+
+int device_read_lock_internal(struct crypt_device *cd, struct device *device)
+{
+       int r;
+       struct crypt_lock_handle *h;
+
+       if (!device)
+               return -EINVAL;
+
+       h = device_get_lock_handle(device);
+
+       if (device_locked(h)) {
+               device_lock_inc(h);
+               log_dbg(cd, "Device %s READ lock (or higher) already held.", device_path(device));
+               return 0;
+       }
+
+       log_dbg(cd, "Acquiring read lock for device %s.", device_path(device));
+
+       r = acquire_and_verify(cd, device, NULL, LOCK_SH, &h);
+       if (r < 0)
+               return r;
+
+       h->type = DEV_LOCK_READ;
+       h->refcnt = 1;
+       device_set_lock_handle(device, h);
+
+       log_dbg(cd, "Device %s READ lock taken.", device_path(device));
+
+       return 0;
+}
+
+int device_write_lock_internal(struct crypt_device *cd, struct device *device)
+{
+       int r;
+       struct crypt_lock_handle *h;
+
+       if (!device)
+               return -EINVAL;
+
+       h = device_get_lock_handle(device);
+
+       if (device_locked(h)) {
+               log_dbg(cd, "Device %s WRITE lock already held.", device_path(device));
+               return device_lock_inc(h);
+       }
+
+       log_dbg(cd, "Acquiring write lock for device %s.", device_path(device));
+
+       r = acquire_and_verify(cd, device, NULL, LOCK_EX, &h);
+       if (r < 0)
+               return r;
+
+       h->type = DEV_LOCK_WRITE;
+       h->refcnt = 1;
+       device_set_lock_handle(device, h);
+
+       log_dbg(cd, "Device %s WRITE lock taken.", device_path(device));
+
+       return 1;
+}
+
+int crypt_read_lock(struct crypt_device *cd, const char *resource, bool blocking, struct crypt_lock_handle **lock)
+{
+       int r;
+       struct crypt_lock_handle *h;
+
+       if (!resource)
+               return -EINVAL;
+
+       log_dbg(cd, "Acquiring %sblocking read lock for resource %s.", blocking ? "" : "non", resource);
+
+       r = acquire_and_verify(cd, NULL, resource, LOCK_SH | (blocking ? 0 : LOCK_NB), &h);
+       if (r < 0)
+               return r;
+
+       h->type = DEV_LOCK_READ;
+       h->refcnt = 1;
+
+       log_dbg(cd, "READ lock for resource %s taken.", resource);
+
+       *lock = h;
+
+       return 0;
+}
+
+int crypt_write_lock(struct crypt_device *cd, const char *resource, bool blocking, struct crypt_lock_handle **lock)
+{
+       int r;
+       struct crypt_lock_handle *h;
+
+       if (!resource)
+               return -EINVAL;
+
+       log_dbg(cd, "Acquiring %sblocking write lock for resource %s.", blocking ? "" : "non", resource);
+
+       r = acquire_and_verify(cd, NULL, resource, LOCK_EX | (blocking ? 0 : LOCK_NB), &h);
+       if (r < 0)
+               return r;
+
+       h->type = DEV_LOCK_WRITE;
+       h->refcnt = 1;
+
+       log_dbg(cd, "WRITE lock for resource %s taken.", resource);
+
+       *lock = h;
+
+       return 0;
+}
+
+static void unlock_internal(struct crypt_device *cd, struct crypt_lock_handle *h)
+{
+       if (flock(h->flock_fd, LOCK_UN))
+               log_dbg(cd, "flock on fd %d failed.", h->flock_fd);
+       release_lock_handle(cd, h);
+       free(h);
+}
+
+void crypt_unlock_internal(struct crypt_device *cd, struct crypt_lock_handle *h)
+{
+       if (!h)
+               return;
+
+       /* nested locks are illegal */
+       assert(!device_lock_dec(h));
+
+       log_dbg(cd, "Unlocking %s lock for resource %s.",
+               device_locked_readonly(h) ? "READ" : "WRITE", h->u.name.name);
+
+       unlock_internal(cd, h);
+}
+
+void device_unlock_internal(struct crypt_device *cd, struct device *device)
+{
+       bool readonly;
+       struct crypt_lock_handle *h = device_get_lock_handle(device);
+       unsigned u = device_lock_dec(h);
+
+       if (u)
+               return;
+
+       readonly = device_locked_readonly(h);
+
+       unlock_internal(cd, h);
+
+       log_dbg(cd, "Device %s %s lock released.", device_path(device),
+               readonly ? "READ" : "WRITE");
+
+       device_set_lock_handle(device, NULL);
+}
+
+int device_locked_verify(struct crypt_device *cd, int dev_fd, struct crypt_lock_handle *h)
+{
+       char res[PATH_MAX];
+       struct stat dev_st, lck_st, st;
+
+       if (fstat(dev_fd, &dev_st) || fstat(h->flock_fd, &lck_st))
+               return 1;
+
+       /* if device handle is regular file the handle must match the lock handle */
+       if (S_ISREG(dev_st.st_mode)) {
+               log_dbg(cd, "Veryfing locked device handle (regular file)");
+               if (!same_inode(dev_st, lck_st))
+                       return 1;
+       } else if (S_ISBLK(dev_st.st_mode)) {
+               log_dbg(cd, "Veryfing locked device handle (bdev)");
+               if (resource_by_devno(res, sizeof(res), dev_st.st_rdev, 1) ||
+                   stat(res, &st) ||
+                   !same_inode(lck_st, st))
+                       return 1;
+       } else
+               return 1;
+
+       return 0;
+}
diff --git a/lib/utils_device_locking.h b/lib/utils_device_locking.h
new file mode 100644 (file)
index 0000000..41d0934
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Metadata on-disk locking for processes serialization
+ *
+ * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _CRYPTSETUP_UTILS_LOCKING_H
+#define _CRYPTSETUP_UTILS_LOCKING_H
+
+struct crypt_device;
+struct crypt_lock_handle;
+struct device;
+
+int device_locked_readonly(struct crypt_lock_handle *h);
+int device_locked(struct crypt_lock_handle *h);
+
+int device_read_lock_internal(struct crypt_device *cd, struct device *device);
+int device_write_lock_internal(struct crypt_device *cd, struct device *device);
+void device_unlock_internal(struct crypt_device *cd, struct device *device);
+
+int device_locked_verify(struct crypt_device *cd, int fd, struct crypt_lock_handle *h);
+
+int crypt_read_lock(struct crypt_device *cd, const char *name, bool blocking, struct crypt_lock_handle **lock);
+int crypt_write_lock(struct crypt_device *cd, const char *name, bool blocking, struct crypt_lock_handle **lock);
+void crypt_unlock_internal(struct crypt_device *cd, struct crypt_lock_handle *h);
+
+
+/* Used only in device internal allocation */
+void device_set_lock_handle(struct device *device, struct crypt_lock_handle *h);
+struct crypt_lock_handle *device_get_lock_handle(struct device *device);
+
+#endif
index 963785a..b6c8975 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * devname - search for device name
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2013, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #include <stdlib.h>
 #include <unistd.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <limits.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+# include <sys/sysmacros.h>     /* for major, minor */
+#endif
 #include "internal.h"
 
 static char *__lookup_dev(char *path, dev_t dev, int dir_level, const int max_level)
@@ -108,7 +110,7 @@ static char *lookup_dev_old(int major, int minor)
                return result;
 
        /* If it is dm, try DM dir  */
-       if (dm_is_dm_device(major, minor)) {
+       if (dm_is_dm_device(major)) {
                strncpy(buf, dm_get_dir(), PATH_MAX);
                if ((result = __lookup_dev(buf, dev, 0, 0)))
                        return result;
@@ -276,24 +278,30 @@ char *crypt_get_partition_device(const char *dev_path, uint64_t offset, uint64_t
                major(st.st_rdev), minor(st.st_rdev)) < 0)
                return NULL;
 
+       dir = opendir(path);
+       if (!dir)
+               return NULL;
+
        len = readlink(path, link, sizeof(link) - 1);
-       if (len < 0)
+       if (len < 0) {
+               closedir(dir);
                return NULL;
+       }
 
        /* Get top level disk name for sysfs search */
        link[len] = '\0';
        devname = strrchr(link, '/');
-       if (!devname)
+       if (!devname) {
+               closedir(dir);
                return NULL;
+       }
        devname++;
 
        /* DM devices do not use kernel partitions. */
-       if (dm_is_dm_kernel_name(devname))
-               return NULL;
-
-       dir = opendir(path);
-       if (!dir)
+       if (dm_is_dm_kernel_name(devname)) {
+               closedir(dir);
                return NULL;
+       }
 
        devname_len = strlen(devname);
        while((entry = readdir(dir))) {
@@ -362,3 +370,88 @@ char *crypt_get_base_device(const char *dev_path)
        snprintf(part_path, sizeof(part_path), "/dev/%s", devname);
        return strdup(part_path);
 }
+
+int lookup_by_disk_id(const char *dm_uuid)
+{
+       struct dirent *entry;
+       struct stat st;
+       int r = 0; /* not found */
+       DIR *dir = opendir("/dev/disk/by-id");
+
+       if (!dir)
+               /* map ENOTDIR to ENOENT we'll handle both errors same */
+               return errno == ENOTDIR ? -ENOENT : -errno;
+
+       while ((entry = readdir(dir))) {
+               if (entry->d_name[0] == '.' ||
+                   !strncmp(entry->d_name, "..", 2))
+                       continue;
+
+               if (fstatat(dirfd(dir), entry->d_name, &st, AT_SYMLINK_NOFOLLOW)) {
+                       r = -EINVAL;
+                       break;
+               }
+
+               if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode))
+                       continue;
+
+               if (!strncmp(entry->d_name, dm_uuid, strlen(dm_uuid))) {
+                       r = 1;
+                       break;
+               }
+       }
+
+       closedir(dir);
+
+       return r;
+}
+
+int lookup_by_sysfs_uuid_field(const char *dm_uuid, size_t max_len)
+{
+       struct dirent *entry;
+       char subpath[PATH_MAX], uuid[max_len];
+       ssize_t s;
+       struct stat st;
+       int fd, len, r = 0; /* not found */
+       DIR *dir = opendir("/sys/block/");
+
+       if (!dir)
+               /* map ENOTDIR to ENOENT we'll handle both errors same */
+               return errno == ENOTDIR ? -ENOENT : -errno;
+
+       while (r != 1 && (entry = readdir(dir))) {
+               if (entry->d_name[0] == '.' ||
+                   !strncmp(entry->d_name, "..", 2))
+                       continue;
+
+               len = snprintf(subpath, PATH_MAX, "%s/%s", entry->d_name, "dm/uuid");
+               if (len < 0 || len >= PATH_MAX) {
+                       r = -EINVAL;
+                       break;
+               }
+
+               /* looking for dm-X/dm/uuid file, symlinks are fine */
+               fd = openat(dirfd(dir), subpath, O_RDONLY | O_CLOEXEC);
+               if (fd < 0)
+                       continue;
+
+               if (fstat(fd, &st) || !S_ISREG(st.st_mode)) {
+                       close(fd);
+                       continue;
+               }
+
+               /* reads binary data */
+               s = read_buffer(fd, uuid, max_len - 1);
+               if (s > 0) {
+                       uuid[s] = '\0';
+                       if (!strncmp(uuid, dm_uuid, strlen(dm_uuid)))
+                               r = 1;
+               }
+
+               close(fd);
+       }
+
+       closedir(dir);
+
+       return r;
+}
index cd8b653..1501eb5 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * libdevmapper - device-mapper backend for cryptsetup
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2015, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2015, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -31,6 +31,18 @@ struct crypt_device;
 struct volume_key;
 struct crypt_params_verity;
 struct device;
+struct crypt_params_integrity;
+
+/* Device mapper internal flags */
+#define DM_RESUME_PRIVATE      (1 << 4) /* CRYPT_ACTIVATE_PRIVATE */
+#define DM_SUSPEND_SKIP_LOCKFS (1 << 5)
+#define DM_SUSPEND_WIPE_KEY    (1 << 6)
+#define DM_SUSPEND_NOFLUSH     (1 << 7)
+
+static inline uint32_t act2dmflags(uint32_t act_flags)
+{
+       return (act_flags & DM_RESUME_PRIVATE);
+}
 
 /* Device mapper backend - kernel support flags */
 #define DM_KEY_WIPE_SUPPORTED (1 << 0) /* key wipe message */
@@ -42,71 +54,178 @@ struct device;
 #define DM_TCW_SUPPORTED      (1 << 6) /* tcw (TCRYPT CBC with whitening) */
 #define DM_SAME_CPU_CRYPT_SUPPORTED (1 << 7) /* same_cpu_crypt */
 #define DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED (1 << 8) /* submit_from_crypt_cpus */
-
-uint32_t dm_flags(void);
+#define DM_VERITY_ON_CORRUPTION_SUPPORTED (1 << 9) /* ignore/restart_on_corruption, ignore_zero_block */
+#define DM_VERITY_FEC_SUPPORTED (1 << 10) /* Forward Error Correction (FEC) */
+#define DM_KERNEL_KEYRING_SUPPORTED (1 << 11) /* dm-crypt allows loading kernel keyring keys */
+#define DM_INTEGRITY_SUPPORTED (1 << 12) /* dm-integrity target supported */
+#define DM_SECTOR_SIZE_SUPPORTED (1 << 13) /* support for sector size setting in dm-crypt/dm-integrity */
+#define DM_CAPI_STRING_SUPPORTED (1 << 14) /* support for cryptoapi format cipher definition */
+#define DM_DEFERRED_SUPPORTED (1 << 15) /* deferred removal of device */
+#define DM_INTEGRITY_RECALC_SUPPORTED (1 << 16) /* dm-integrity automatic recalculation supported */
+#define DM_INTEGRITY_BITMAP_SUPPORTED (1 << 17) /* dm-integrity bitmap mode supported */
+#define DM_GET_TARGET_VERSION_SUPPORTED (1 << 18) /* dm DM_GET_TARGET version ioctl supported */
+#define DM_INTEGRITY_FIX_PADDING_SUPPORTED (1 << 19) /* supports the parameter fix_padding that fixes a bug that caused excessive padding */
+#define DM_BITLK_EBOIV_SUPPORTED (1 << 20) /* EBOIV for BITLK supported */
+#define DM_BITLK_ELEPHANT_SUPPORTED (1 << 21) /* Elephant diffuser for BITLK supported */
+#define DM_VERITY_SIGNATURE_SUPPORTED (1 << 22) /* Verity option root_hash_sig_key_desc supported */
+#define DM_INTEGRITY_DISCARDS_SUPPORTED (1 << 23) /* dm-integrity discards/TRIM option is supported */
+
+typedef enum { DM_CRYPT = 0, DM_VERITY, DM_INTEGRITY, DM_LINEAR, DM_ERROR, DM_ZERO, DM_UNKNOWN } dm_target_type;
+enum tdirection { TARGET_SET = 1, TARGET_QUERY };
+
+int dm_flags(struct crypt_device *cd, dm_target_type target, uint32_t *flags);
 
 #define DM_ACTIVE_DEVICE       (1 << 0)
 #define DM_ACTIVE_UUID         (1 << 1)
+#define DM_ACTIVE_HOLDERS      (1 << 2)
 
-#define DM_ACTIVE_CRYPT_CIPHER (1 << 2)
-#define DM_ACTIVE_CRYPT_KEYSIZE        (1 << 3)
-#define DM_ACTIVE_CRYPT_KEY    (1 << 4)
+#define DM_ACTIVE_CRYPT_CIPHER (1 << 3)
+#define DM_ACTIVE_CRYPT_KEYSIZE        (1 << 4)
+#define DM_ACTIVE_CRYPT_KEY    (1 << 5)
 
-#define DM_ACTIVE_VERITY_ROOT_HASH     (1 << 5)
-#define DM_ACTIVE_VERITY_HASH_DEVICE   (1 << 6)
-#define DM_ACTIVE_VERITY_PARAMS                (1 << 7)
+#define DM_ACTIVE_VERITY_ROOT_HASH     (1 << 6)
+#define DM_ACTIVE_VERITY_HASH_DEVICE   (1 << 7)
+#define DM_ACTIVE_VERITY_PARAMS                (1 << 8)
 
-struct crypt_dm_active_device {
-       enum { DM_CRYPT = 0, DM_VERITY } target;
-       uint64_t size;          /* active device size */
-       uint32_t flags;         /* activation flags */
-       const char *uuid;
+#define DM_ACTIVE_INTEGRITY_PARAMS     (1 << 9)
+
+struct dm_target {
+       dm_target_type type;
+       enum tdirection direction;
+       uint64_t offset;
+       uint64_t size;
        struct device *data_device;
        union {
        struct {
                const char *cipher;
+               const char *integrity;
 
                /* Active key for device */
                struct volume_key *vk;
 
                /* struct crypt_active_device */
                uint64_t offset;        /* offset in sectors */
-               uint64_t iv_offset;     /* IV initilisation sector */
+               uint64_t iv_offset;     /* IV initialisation sector */
+               uint32_t tag_size;      /* additional on-disk tag size */
+               uint32_t sector_size;   /* encryption sector size */
        } crypt;
        struct {
                struct device *hash_device;
+               struct device *fec_device;
 
                const char *root_hash;
                uint32_t root_hash_size;
+               const char *root_hash_sig_key_desc;
 
                uint64_t hash_offset;   /* hash offset in blocks (not header) */
+               uint64_t hash_blocks;   /* size of hash device (in hash blocks) */
+               uint64_t fec_offset;    /* FEC offset in blocks (not header) */
+               uint64_t fec_blocks;    /* size of FEC device (in hash blocks) */
                struct crypt_params_verity *vp;
        } verity;
+       struct {
+               uint64_t journal_size;
+               uint32_t journal_watermark;
+               uint32_t journal_commit_time;
+               uint32_t interleave_sectors;
+               uint32_t tag_size;
+               uint64_t offset;        /* offset in sectors */
+               uint32_t sector_size;   /* integrity sector size */
+               uint32_t buffer_sectors;
+
+               const char *integrity;
+               /* Active key for device */
+               struct volume_key *vk;
+
+               const char *journal_integrity;
+               struct volume_key *journal_integrity_key;
+
+               const char *journal_crypt;
+               struct volume_key *journal_crypt_key;
+
+               struct device *meta_device;
+
+               bool fix_padding;
+       } integrity;
+       struct {
+               uint64_t offset;
+       } linear;
+       struct {
+       } zero;
        } u;
+
+       char *params;
+       struct dm_target *next;
 };
 
-void dm_backend_init(void);
-void dm_backend_exit(void);
+struct crypt_dm_active_device {
+       uint64_t size;          /* active device size */
+       uint32_t flags;         /* activation flags */
+       const char *uuid;
+
+       unsigned holders:1;     /* device holders detected (on query only) */
 
-int dm_remove_device(struct crypt_device *cd, const char *name,
-                    int force, uint64_t size);
+       struct dm_target segment;
+};
+
+static inline bool single_segment(const struct crypt_dm_active_device *dmd)
+{
+       return dmd && !dmd->segment.next;
+}
+
+void dm_backend_init(struct crypt_device *cd);
+void dm_backend_exit(struct crypt_device *cd);
+
+int dm_targets_allocate(struct dm_target *first, unsigned count);
+void dm_targets_free(struct crypt_device *cd, struct crypt_dm_active_device *dmd);
+
+int dm_crypt_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+       struct device *data_device, struct volume_key *vk, const char *cipher,
+       uint64_t iv_offset, uint64_t data_offset, const char *integrity,
+       uint32_t tag_size, uint32_t sector_size);
+int dm_verity_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+       struct device *data_device, struct device *hash_device, struct device *fec_device,
+       const char *root_hash, uint32_t root_hash_size, const char *root_hash_sig_key_desc,
+       uint64_t hash_offset_block, uint64_t hash_blocks, struct crypt_params_verity *vp);
+int dm_integrity_target_set(struct crypt_device *cd,
+       struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+       struct device *meta_device,
+       struct device *data_device, uint64_t tag_size, uint64_t offset, uint32_t sector_size,
+       struct volume_key *vk,
+       struct volume_key *journal_crypt_key, struct volume_key *journal_mac_key,
+       const struct crypt_params_integrity *ip);
+int dm_linear_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size,
+       struct device *data_device, uint64_t data_offset);
+int dm_zero_target_set(struct dm_target *tgt, uint64_t seg_offset, uint64_t seg_size);
+
+int dm_remove_device(struct crypt_device *cd, const char *name, uint32_t flags);
 int dm_status_device(struct crypt_device *cd, const char *name);
 int dm_status_suspended(struct crypt_device *cd, const char *name);
 int dm_status_verity_ok(struct crypt_device *cd, const char *name);
+int dm_status_integrity_failures(struct crypt_device *cd, const char *name, uint64_t *count);
 int dm_query_device(struct crypt_device *cd, const char *name,
                    uint32_t get_flags, struct crypt_dm_active_device *dmd);
+int dm_device_deps(struct crypt_device *cd, const char *name, const char *prefix,
+                  char **names, size_t names_length);
 int dm_create_device(struct crypt_device *cd, const char *name,
-                    const char *type, struct crypt_dm_active_device *dmd,
-                    int reload);
-int dm_suspend_and_wipe_key(struct crypt_device *cd, const char *name);
+                    const char *type, struct crypt_dm_active_device *dmd);
+int dm_reload_device(struct crypt_device *cd, const char *name,
+                    struct crypt_dm_active_device *dmd, uint32_t dmflags, unsigned resume);
+int dm_suspend_device(struct crypt_device *cd, const char *name, uint32_t dmflags);
+int dm_resume_device(struct crypt_device *cd, const char *name, uint32_t dmflags);
 int dm_resume_and_reinstate_key(struct crypt_device *cd, const char *name,
-                               size_t key_size, const char *key);
+                               const struct volume_key *vk);
+int dm_error_device(struct crypt_device *cd, const char *name);
+int dm_clear_device(struct crypt_device *cd, const char *name);
 
 const char *dm_get_dir(void);
 
+int lookup_dm_dev_by_uuid(struct crypt_device *cd, const char *uuid, const char *type);
+
 /* These are DM helpers used only by utils_devpath file */
-int dm_is_dm_device(int major, int minor);
+int dm_is_dm_device(int major);
 int dm_is_dm_kernel_name(const char *name);
 char *dm_device_path(const char *prefix, int major, int minor);
+char *dm_device_name(const char *path);
 
 #endif /* _UTILS_DM_H */
index d5a18d7..34b2dae 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * FIPS mode utilities
  *
- * Copyright (C) 2011-2015, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
index 63765c4..2388ba6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * FIPS mode utilities
  *
- * Copyright (C) 2011-2015, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
diff --git a/lib/utils_io.c b/lib/utils_io.c
new file mode 100644 (file)
index 0000000..3fae22b
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * utils - miscellaneous I/O utilities for cryptsetup
+ *
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "utils_io.h"
+
+static ssize_t _read_buffer(int fd, void *buf, size_t length, volatile int *quit)
+{
+       size_t read_size = 0;
+       ssize_t r;
+
+       if (fd < 0 || !buf)
+               return -EINVAL;
+
+       do {
+               r = read(fd, buf, length - read_size);
+               if (r == -1 && errno != EINTR)
+                       return r;
+               if (r > 0) {
+                       read_size += (size_t)r;
+                       buf = (uint8_t*)buf + r;
+               }
+               if (r == 0 || (quit && *quit))
+                       return (ssize_t)read_size;
+       } while (read_size != length);
+
+       return (ssize_t)length;
+}
+
+ssize_t read_buffer(int fd, void *buf, size_t length)
+{
+       return _read_buffer(fd, buf, length, NULL);
+}
+
+ssize_t read_buffer_intr(int fd, void *buf, size_t length, volatile int *quit)
+{
+       return _read_buffer(fd, buf, length, quit);
+}
+
+static ssize_t _write_buffer(int fd, const void *buf, size_t length, volatile int *quit)
+{
+       size_t write_size = 0;
+       ssize_t w;
+
+       if (fd < 0 || !buf || !length)
+               return -EINVAL;
+
+       do {
+               w = write(fd, buf, length - write_size);
+               if (w < 0 && errno != EINTR)
+                       return w;
+               if (w > 0) {
+                       write_size += (size_t) w;
+                       buf = (const uint8_t*)buf + w;
+               }
+               if (w == 0 || (quit && *quit))
+                       return (ssize_t)write_size;
+       } while (write_size != length);
+
+       return (ssize_t)write_size;
+}
+
+ssize_t write_buffer(int fd, const void *buf, size_t length)
+{
+       return _write_buffer(fd, buf, length, NULL);
+}
+
+ssize_t write_buffer_intr(int fd, const void *buf, size_t length, volatile int *quit)
+{
+       return _write_buffer(fd, buf, length, quit);
+}
+
+ssize_t write_blockwise(int fd, size_t bsize, size_t alignment,
+                       void *orig_buf, size_t length)
+{
+       void *hangover_buf = NULL, *buf = NULL;
+       size_t hangover, solid;
+       ssize_t r, ret = -1;
+
+       if (fd == -1 || !orig_buf || !bsize || !alignment)
+               return -1;
+
+       hangover = length % bsize;
+       solid = length - hangover;
+
+       if ((size_t)orig_buf & (alignment - 1)) {
+               if (posix_memalign(&buf, alignment, length))
+                       return -1;
+               memcpy(buf, orig_buf, length);
+       } else
+               buf = orig_buf;
+
+       if (solid) {
+               r = write_buffer(fd, buf, solid);
+               if (r < 0 || r != (ssize_t)solid)
+                       goto out;
+       }
+
+       if (hangover) {
+               if (posix_memalign(&hangover_buf, alignment, bsize))
+                       goto out;
+               memset(hangover_buf, 0, bsize);
+
+               r = read_buffer(fd, hangover_buf, bsize);
+               if (r < 0)
+                       goto out;
+
+               if (lseek(fd, -(off_t)r, SEEK_CUR) < 0)
+                       goto out;
+
+               memcpy(hangover_buf, (char*)buf + solid, hangover);
+
+               r = write_buffer(fd, hangover_buf, bsize);
+               if (r < 0 || r < (ssize_t)hangover)
+                       goto out;
+       }
+       ret = length;
+out:
+       free(hangover_buf);
+       if (buf != orig_buf)
+               free(buf);
+       return ret;
+}
+
+ssize_t read_blockwise(int fd, size_t bsize, size_t alignment,
+                      void *orig_buf, size_t length)
+{
+       void *hangover_buf = NULL, *buf = NULL;
+       size_t hangover, solid;
+       ssize_t r, ret = -1;
+
+       if (fd == -1 || !orig_buf || !bsize || !alignment)
+               return -1;
+
+       hangover = length % bsize;
+       solid = length - hangover;
+
+       if ((size_t)orig_buf & (alignment - 1)) {
+               if (posix_memalign(&buf, alignment, length))
+                       return -1;
+       } else
+               buf = orig_buf;
+
+       r = read_buffer(fd, buf, solid);
+       if (r < 0 || r != (ssize_t)solid)
+               goto out;
+
+       if (hangover) {
+               if (posix_memalign(&hangover_buf, alignment, bsize))
+                       goto out;
+               r = read_buffer(fd, hangover_buf, bsize);
+               if (r <  0 || r < (ssize_t)hangover)
+                       goto out;
+
+               memcpy((char *)buf + solid, hangover_buf, hangover);
+       }
+       ret = length;
+out:
+       free(hangover_buf);
+       if (buf != orig_buf) {
+               if (ret != -1)
+                       memcpy(orig_buf, buf, length);
+               free(buf);
+       }
+       return ret;
+}
+
+/*
+ * Combines llseek with blockwise write. write_blockwise can already deal with short writes
+ * but we also need a function to deal with short writes at the start. But this information
+ * is implicitly included in the read/write offset, which can not be set to non-aligned
+ * boundaries. Hence, we combine llseek with write.
+ */
+ssize_t write_lseek_blockwise(int fd, size_t bsize, size_t alignment,
+                             void *buf, size_t length, off_t offset)
+{
+       void *frontPadBuf = NULL;
+       size_t frontHang, innerCount = 0;
+       ssize_t r, ret = -1;
+
+       if (fd == -1 || !buf || !bsize || !alignment)
+               return -1;
+
+       if (offset < 0)
+               offset = lseek(fd, offset, SEEK_END);
+
+       if (offset < 0)
+               return -1;
+
+       frontHang = offset % bsize;
+
+       if (lseek(fd, offset - frontHang, SEEK_SET) < 0)
+               return -1;
+
+       if (frontHang && length) {
+               if (posix_memalign(&frontPadBuf, alignment, bsize))
+                       return -1;
+
+               innerCount = bsize - frontHang;
+               if (innerCount > length)
+                       innerCount = length;
+
+               r = read_buffer(fd, frontPadBuf, bsize);
+               if (r < 0 || r < (ssize_t)(frontHang + innerCount))
+                       goto out;
+
+               memcpy((char*)frontPadBuf + frontHang, buf, innerCount);
+
+               if (lseek(fd, offset - frontHang, SEEK_SET) < 0)
+                       goto out;
+
+               r = write_buffer(fd, frontPadBuf, bsize);
+               if (r < 0 || r != (ssize_t)bsize)
+                       goto out;
+
+               buf = (char*)buf + innerCount;
+               length -= innerCount;
+       }
+
+       ret = length ? write_blockwise(fd, bsize, alignment, buf, length) : 0;
+       if (ret >= 0)
+               ret += innerCount;
+out:
+       free(frontPadBuf);
+       return ret;
+}
+
+ssize_t read_lseek_blockwise(int fd, size_t bsize, size_t alignment,
+                            void *buf, size_t length, off_t offset)
+{
+       void *frontPadBuf = NULL;
+       size_t frontHang, innerCount = 0;
+       ssize_t r, ret = -1;
+
+       if (fd == -1 || !buf || bsize <= 0)
+               return -1;
+
+       if (offset < 0)
+               offset = lseek(fd, offset, SEEK_END);
+
+       if (offset < 0)
+               return -1;
+
+       frontHang = offset % bsize;
+
+       if (lseek(fd, offset - frontHang, SEEK_SET) < 0)
+               return -1;
+
+       if (frontHang && length) {
+               if (posix_memalign(&frontPadBuf, alignment, bsize))
+                       return -1;
+
+               innerCount = bsize - frontHang;
+               if (innerCount > length)
+                       innerCount = length;
+
+               r = read_buffer(fd, frontPadBuf, bsize);
+               if (r < 0 || r < (ssize_t)(frontHang + innerCount))
+                       goto out;
+
+               memcpy(buf, (char*)frontPadBuf + frontHang, innerCount);
+
+               buf = (char*)buf + innerCount;
+               length -= innerCount;
+       }
+
+       ret = read_blockwise(fd, bsize, alignment, buf, length);
+       if (ret >= 0)
+               ret += innerCount;
+out:
+       free(frontPadBuf);
+       return ret;
+}
diff --git a/lib/utils_io.h b/lib/utils_io.h
new file mode 100644 (file)
index 0000000..4e64d86
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * utils - miscellaneous I/O utilities for cryptsetup
+ *
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _CRYPTSETUP_UTILS_IO_H
+#define _CRYPTSETUP_UTILS_IO_H
+
+#include <sys/types.h>
+
+ssize_t read_buffer(int fd, void *buf, size_t length);
+ssize_t read_buffer_intr(int fd, void *buf, size_t length, volatile int *quit);
+ssize_t write_buffer(int fd, const void *buf, size_t length);
+ssize_t write_buffer_intr(int fd, const void *buf, size_t length, volatile int *quit);
+ssize_t write_blockwise(int fd, size_t bsize, size_t alignment,
+                       void *orig_buf, size_t length);
+ssize_t read_blockwise(int fd, size_t bsize, size_t alignment,
+                      void *orig_buf, size_t length);
+ssize_t write_lseek_blockwise(int fd, size_t bsize, size_t alignment,
+                             void *buf, size_t length, off_t offset);
+ssize_t read_lseek_blockwise(int fd, size_t bsize, size_t alignment,
+                            void *buf, size_t length, off_t offset);
+
+#endif
diff --git a/lib/utils_keyring.c b/lib/utils_keyring.c
new file mode 100644 (file)
index 0000000..6e22c19
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ * kernel keyring utilities
+ *
+ * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#include "libcryptsetup.h"
+#include "utils_keyring.h"
+
+#ifndef HAVE_KEY_SERIAL_T
+#define HAVE_KEY_SERIAL_T
+typedef int32_t key_serial_t;
+#endif
+
+#ifndef ARRAY_SIZE
+# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
+#ifdef KERNEL_KEYRING
+
+static const struct {
+       key_type_t type;
+       const char *type_name;
+} key_types[] = {
+       { LOGON_KEY,    "logon" },
+       { USER_KEY,     "user"  },
+};
+
+#include <linux/keyctl.h>
+
+/* request_key */
+static key_serial_t request_key(const char *type,
+       const char *description,
+       const char *callout_info,
+       key_serial_t keyring)
+{
+       return syscall(__NR_request_key, type, description, callout_info, keyring);
+}
+
+/* add_key */
+static key_serial_t add_key(const char *type,
+       const char *description,
+       const void *payload,
+       size_t plen,
+       key_serial_t keyring)
+{
+       return syscall(__NR_add_key, type, description, payload, plen, keyring);
+}
+
+/* keyctl_read */
+static long keyctl_read(key_serial_t key, char *buffer, size_t buflen)
+{
+       return syscall(__NR_keyctl, KEYCTL_READ, key, buffer, buflen);
+}
+
+/* keyctl_revoke */
+static long keyctl_revoke(key_serial_t key)
+{
+       return syscall(__NR_keyctl, KEYCTL_REVOKE, key);
+}
+
+/* keyctl_unlink */
+static long keyctl_unlink(key_serial_t key, key_serial_t keyring)
+{
+       return syscall(__NR_keyctl, KEYCTL_UNLINK, key, keyring);
+}
+#endif
+
+int keyring_check(void)
+{
+#ifdef KERNEL_KEYRING
+       /* logon type key descriptions must be in format "prefix:description" */
+       return syscall(__NR_request_key, "logon", "dummy", NULL, 0) == -1l && errno != ENOSYS;
+#else
+       return 0;
+#endif
+}
+
+int keyring_add_key_in_thread_keyring(key_type_t ktype, const char *key_desc, const void *key, size_t key_size)
+{
+#ifdef KERNEL_KEYRING
+       key_serial_t kid;
+       const char *type_name = key_type_name(ktype);
+
+       if (!type_name || !key_desc)
+               return -EINVAL;
+
+       kid = add_key(type_name, key_desc, key, key_size, KEY_SPEC_THREAD_KEYRING);
+       if (kid < 0)
+               return -errno;
+
+       return 0;
+#else
+       return -ENOTSUP;
+#endif
+}
+
+/* currently used in client utilities only */
+int keyring_add_key_in_user_keyring(key_type_t ktype, const char *key_desc, const void *key, size_t key_size)
+{
+#ifdef KERNEL_KEYRING
+       const char *type_name = key_type_name(ktype);
+       key_serial_t kid;
+
+       if (!type_name || !key_desc)
+               return -EINVAL;
+
+       kid = add_key(type_name, key_desc, key, key_size, KEY_SPEC_USER_KEYRING);
+       if (kid < 0)
+               return -errno;
+
+       return 0;
+#else
+       return -ENOTSUP;
+#endif
+}
+
+/* alias for the same code */
+int keyring_get_key(const char *key_desc,
+                   char **key,
+                   size_t *key_size)
+{
+       return keyring_get_passphrase(key_desc, key, key_size);
+}
+
+int keyring_get_passphrase(const char *key_desc,
+                     char **passphrase,
+                     size_t *passphrase_len)
+{
+#ifdef KERNEL_KEYRING
+       int err;
+       key_serial_t kid;
+       long ret;
+       char *buf = NULL;
+       size_t len = 0;
+
+       do
+               kid = request_key(key_type_name(USER_KEY), key_desc, NULL, 0);
+       while (kid < 0 && errno == EINTR);
+
+       if (kid < 0)
+               return -errno;
+
+       /* just get payload size */
+       ret = keyctl_read(kid, NULL, 0);
+       if (ret > 0) {
+               len = ret;
+               buf = malloc(len);
+               if (!buf)
+                       return -ENOMEM;
+
+               /* retrieve actual payload data */
+               ret = keyctl_read(kid, buf, len);
+       }
+
+       if (ret < 0) {
+               err = errno;
+               if (buf)
+                       crypt_safe_memzero(buf, len);
+               free(buf);
+               return -err;
+       }
+
+       *passphrase = buf;
+       *passphrase_len = len;
+
+       return 0;
+#else
+       return -ENOTSUP;
+#endif
+}
+
+static int keyring_revoke_and_unlink_key_type(const char *type_name, const char *key_desc)
+{
+#ifdef KERNEL_KEYRING
+       key_serial_t kid;
+
+       if (!type_name || !key_desc)
+               return -EINVAL;
+
+       do
+               kid = request_key(type_name, key_desc, NULL, 0);
+       while (kid < 0 && errno == EINTR);
+
+       if (kid < 0)
+               return 0;
+
+       if (keyctl_revoke(kid))
+               return -errno;
+
+       /*
+        * best effort only. the key could have been linked
+        * in some other keyring and its payload is now
+        * revoked anyway.
+        */
+       keyctl_unlink(kid, KEY_SPEC_THREAD_KEYRING);
+       keyctl_unlink(kid, KEY_SPEC_PROCESS_KEYRING);
+       keyctl_unlink(kid, KEY_SPEC_USER_KEYRING);
+
+       return 0;
+#else
+       return -ENOTSUP;
+#endif
+}
+
+const char *key_type_name(key_type_t type)
+{
+#ifdef KERNEL_KEYRING
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(key_types); i++)
+               if (type == key_types[i].type)
+                       return key_types[i].type_name;
+#endif
+       return NULL;
+}
+
+int keyring_revoke_and_unlink_key(key_type_t ktype, const char *key_desc)
+{
+       return keyring_revoke_and_unlink_key_type(key_type_name(ktype), key_desc);
+}
diff --git a/lib/utils_keyring.h b/lib/utils_keyring.h
new file mode 100644 (file)
index 0000000..37a5ac6
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * kernel keyring syscall wrappers
+ *
+ * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _UTILS_KEYRING
+#define _UTILS_KEYRING
+
+#include <stddef.h>
+
+typedef enum { LOGON_KEY = 0, USER_KEY } key_type_t;
+
+const char *key_type_name(key_type_t ktype);
+
+int keyring_check(void);
+
+int keyring_get_key(const char *key_desc,
+                   char **key,
+                   size_t *key_size);
+
+int keyring_get_passphrase(const char *key_desc,
+                     char **passphrase,
+                     size_t *passphrase_len);
+
+int keyring_add_key_in_thread_keyring(
+       key_type_t ktype,
+       const char *key_desc,
+       const void *key,
+       size_t key_size);
+
+int keyring_add_key_in_user_keyring(
+       key_type_t ktype,
+       const char *key_desc,
+       const void *key,
+       size_t key_size);
+
+int keyring_revoke_and_unlink_key(key_type_t ktype, const char *key_desc);
+
+#endif
index d7b03a1..9696a40 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * loopback block device utilities
  *
- * Copyright (C) 2011-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2012, Milan Broz
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -28,6 +29,9 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+# include <sys/sysmacros.h>     /* for major, minor */
+#endif
 #include <linux/loop.h>
 
 #include "utils_loop.h"
 #define LOOP_CTL_GET_FREE 0x4C82
 #endif
 
+#ifndef LOOP_SET_CAPACITY
+#define LOOP_SET_CAPACITY 0x4C07
+#endif
+
 static char *crypt_loop_get_device_old(void)
 {
        char dev[20];
@@ -66,7 +74,7 @@ static char *crypt_loop_get_device_old(void)
        return NULL;
 }
 
-char *crypt_loop_get_device(void)
+static char *crypt_loop_get_device(void)
 {
        char dev[64];
        int i, loop_fd;
@@ -92,12 +100,15 @@ char *crypt_loop_get_device(void)
        return strdup(dev);
 }
 
-int crypt_loop_attach(const char *loop, const char *file, int offset,
+int crypt_loop_attach(char **loop, const char *file, int offset,
                      int autoclear, int *readonly)
 {
        struct loop_info64 lo64 = {0};
+       char *lo_file_name;
        int loop_fd = -1, file_fd = -1, r = 1;
 
+       *loop = NULL;
+
        file_fd = open(file, (*readonly ? O_RDONLY : O_RDWR) | O_EXCL);
        if (file_fd < 0 && (errno == EROFS || errno == EACCES) && !*readonly) {
                *readonly = 1;
@@ -106,18 +117,33 @@ int crypt_loop_attach(const char *loop, const char *file, int offset,
        if (file_fd < 0)
                goto out;
 
-       loop_fd = open(loop, *readonly ? O_RDONLY : O_RDWR);
-       if (loop_fd < 0)
-               goto out;
+       while (loop_fd < 0)  {
+               *loop = crypt_loop_get_device();
+               if (!*loop)
+                       goto out;
 
-       strncpy((char*)lo64.lo_file_name, file, LO_NAME_SIZE);
+               loop_fd = open(*loop, *readonly ? O_RDONLY : O_RDWR);
+               if (loop_fd < 0)
+                       goto out;
+
+               if (ioctl(loop_fd, LOOP_SET_FD, file_fd) < 0) {
+                       if (errno != EBUSY)
+                               goto out;
+                       free(*loop);
+                       *loop = NULL;
+
+                       close(loop_fd);
+                       loop_fd = -1;
+               }
+       }
+
+       lo_file_name = (char*)lo64.lo_file_name;
+       lo_file_name[LO_NAME_SIZE-1] = '\0';
+       strncpy(lo_file_name, file, LO_NAME_SIZE-1);
        lo64.lo_offset = offset;
        if (autoclear)
                lo64.lo_flags |= LO_FLAGS_AUTOCLEAR;
 
-       if (ioctl(loop_fd, LOOP_SET_FD, file_fd) < 0)
-               goto out;
-
        if (ioctl(loop_fd, LOOP_SET_STATUS64, &lo64) < 0) {
                (void)ioctl(loop_fd, LOOP_CLR_FD, 0);
                goto out;
@@ -139,6 +165,10 @@ out:
                close(loop_fd);
        if (file_fd >= 0)
                close(file_fd);
+       if (r && *loop) {
+               free(*loop);
+               *loop = NULL;
+       }
        return r ? -1 : loop_fd;
 }
 
@@ -157,6 +187,21 @@ int crypt_loop_detach(const char *loop)
        return r;
 }
 
+int crypt_loop_resize(const char *loop)
+{
+       int loop_fd = -1, r = 1;
+
+       loop_fd = open(loop, O_RDONLY);
+       if (loop_fd < 0)
+                return 1;
+
+       if (!ioctl(loop_fd, LOOP_SET_CAPACITY, 0))
+               r = 0;
+
+       close(loop_fd);
+       return r;
+}
+
 static char *_ioctl_backing_file(const char *loop)
 {
        struct loop_info64 lo64 = {0};
@@ -207,7 +252,12 @@ static char *_sysfs_backing_file(const char *loop)
 
 char *crypt_loop_backing_file(const char *loop)
 {
-       char *bf = _sysfs_backing_file(loop);
+       char *bf;
+
+       if (!crypt_loop_device(loop))
+               return NULL;
+
+       bf = _sysfs_backing_file(loop);
        return bf ?: _ioctl_backing_file(loop);
 }
 
index 052623d..a3572dc 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * loopback block device utilities
  *
- * Copyright (C) 2011-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 
 /* loopback device helpers */
 
-char *crypt_loop_get_device(void);
 char *crypt_loop_backing_file(const char *loop);
 int crypt_loop_device(const char *loop);
-int crypt_loop_attach(const char *loop, const char *file, int offset,
+int crypt_loop_attach(char **loop, const char *file, int offset,
                      int autoclear, int *readonly);
 int crypt_loop_detach(const char *loop);
+int crypt_loop_resize(const char *loop);
 
 #endif /* _UTILS_LOOP_H */
diff --git a/lib/utils_pbkdf.c b/lib/utils_pbkdf.c
new file mode 100644 (file)
index 0000000..967bb2c
--- /dev/null
@@ -0,0 +1,333 @@
+/*
+ * utils_pbkdf - PBKDF settings for libcryptsetup
+ *
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+
+#include "internal.h"
+
+const struct crypt_pbkdf_type default_pbkdf2 = {
+       .type = CRYPT_KDF_PBKDF2,
+       .hash = DEFAULT_LUKS1_HASH,
+       .time_ms = DEFAULT_LUKS1_ITER_TIME
+};
+
+const struct crypt_pbkdf_type default_argon2i = {
+       .type = CRYPT_KDF_ARGON2I,
+       .hash = DEFAULT_LUKS1_HASH,
+       .time_ms = DEFAULT_LUKS2_ITER_TIME,
+       .max_memory_kb = DEFAULT_LUKS2_MEMORY_KB,
+       .parallel_threads = DEFAULT_LUKS2_PARALLEL_THREADS
+};
+
+const struct crypt_pbkdf_type default_argon2id = {
+       .type = CRYPT_KDF_ARGON2ID,
+       .hash = DEFAULT_LUKS1_HASH,
+       .time_ms = DEFAULT_LUKS2_ITER_TIME,
+       .max_memory_kb = DEFAULT_LUKS2_MEMORY_KB,
+       .parallel_threads = DEFAULT_LUKS2_PARALLEL_THREADS
+};
+
+const struct crypt_pbkdf_type *crypt_get_pbkdf_type_params(const char *pbkdf_type)
+{
+       if (!pbkdf_type)
+               return NULL;
+
+       if (!strcmp(pbkdf_type, CRYPT_KDF_PBKDF2))
+               return &default_pbkdf2;
+       else if (!strcmp(pbkdf_type, CRYPT_KDF_ARGON2I))
+               return &default_argon2i;
+       else if (!strcmp(pbkdf_type, CRYPT_KDF_ARGON2ID))
+               return &default_argon2id;
+
+       return NULL;
+}
+
+static uint32_t adjusted_phys_memory(void)
+{
+       uint64_t memory_kb = crypt_getphysmemory_kb();
+
+       /* Ignore bogus value */
+       if (memory_kb < (128 * 1024) || memory_kb > UINT32_MAX)
+               return DEFAULT_LUKS2_MEMORY_KB;
+
+       /*
+        * Never use more than half of physical memory.
+        * OOM killer is too clever...
+        */
+       memory_kb /= 2;
+
+       return memory_kb;
+}
+
+/*
+ * PBKDF configuration interface
+ */
+int verify_pbkdf_params(struct crypt_device *cd,
+                       const struct crypt_pbkdf_type *pbkdf)
+{
+       struct crypt_pbkdf_limits pbkdf_limits;
+       const char *pbkdf_type;
+       int r;
+
+       r = init_crypto(cd);
+       if (r < 0)
+               return r;
+
+       if (!pbkdf->type ||
+           (!pbkdf->hash && !strcmp(pbkdf->type, "pbkdf2")))
+               return -EINVAL;
+
+       if (!pbkdf->time_ms && !(pbkdf->flags & CRYPT_PBKDF_NO_BENCHMARK)) {
+               log_err(cd, _("Requested PBKDF target time cannot be zero."));
+               return -EINVAL;
+       }
+
+       r = crypt_parse_pbkdf(pbkdf->type, &pbkdf_type);
+       if (r < 0) {
+               log_err(cd, _("Unknown PBKDF type %s."), pbkdf->type);
+               return r;
+       }
+
+       if (pbkdf->hash && crypt_hash_size(pbkdf->hash) < 0) {
+               log_err(cd, _("Requested hash %s is not supported."), pbkdf->hash);
+               return -EINVAL;
+       }
+
+       r = crypt_pbkdf_get_limits(pbkdf->type, &pbkdf_limits);
+       if (r < 0)
+               return r;
+
+       if (crypt_get_type(cd) &&
+           !strcmp(crypt_get_type(cd), CRYPT_LUKS1) &&
+           strcmp(pbkdf_type, CRYPT_KDF_PBKDF2)) {
+               log_err(cd, _("Requested PBKDF type is not supported for LUKS1."));
+               return -EINVAL;
+       }
+
+       if (!strcmp(pbkdf_type, CRYPT_KDF_PBKDF2)) {
+               if (pbkdf->max_memory_kb || pbkdf->parallel_threads) {
+                       log_err(cd, _("PBKDF max memory or parallel threads must not be set with pbkdf2."));
+                       return -EINVAL;
+               }
+               if (pbkdf->flags & CRYPT_PBKDF_NO_BENCHMARK &&
+                   pbkdf->iterations < pbkdf_limits.min_iterations) {
+                       log_err(cd, _("Forced iteration count is too low for %s (minimum is %u)."),
+                               pbkdf_type, pbkdf_limits.min_iterations);
+                       return -EINVAL;
+               }
+               return 0;
+       }
+
+       /* TODO: properly define minimal iterations and also minimal memory values */
+       if (pbkdf->flags & CRYPT_PBKDF_NO_BENCHMARK) {
+               if (pbkdf->iterations < pbkdf_limits.min_iterations) {
+                       log_err(cd, _("Forced iteration count is too low for %s (minimum is %u)."),
+                               pbkdf_type, pbkdf_limits.min_iterations);
+                       r = -EINVAL;
+               }
+               if (pbkdf->max_memory_kb < pbkdf_limits.min_memory) {
+                       log_err(cd, _("Forced memory cost is too low for %s (minimum is %u kilobytes)."),
+                               pbkdf_type, pbkdf_limits.min_memory);
+                       r = -EINVAL;
+               }
+       }
+
+       if (pbkdf->max_memory_kb > pbkdf_limits.max_memory) {
+               log_err(cd, _("Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."),
+                       pbkdf_limits.max_memory);
+               r = -EINVAL;
+       }
+       if (!pbkdf->max_memory_kb) {
+               log_err(cd, _("Requested maximum PBKDF memory cannot be zero."));
+               r = -EINVAL;
+       }
+       if (!pbkdf->parallel_threads) {
+               log_err(cd, _("Requested PBKDF parallel threads cannot be zero."));
+               r = -EINVAL;
+       }
+
+       return r;
+}
+
+int init_pbkdf_type(struct crypt_device *cd,
+                   const struct crypt_pbkdf_type *pbkdf,
+                   const char *dev_type)
+{
+       struct crypt_pbkdf_type *cd_pbkdf = crypt_get_pbkdf(cd);
+       struct crypt_pbkdf_limits pbkdf_limits;
+       const char *hash, *type;
+       unsigned cpus;
+       uint32_t old_flags, memory_kb;
+       int r;
+
+       if (crypt_fips_mode()) {
+               if (pbkdf && strcmp(pbkdf->type, CRYPT_KDF_PBKDF2)) {
+                       log_err(cd, _("Only PBKDF2 is supported in FIPS mode."));
+                       return -EINVAL;
+               }
+               if (!pbkdf)
+                       pbkdf = crypt_get_pbkdf_type_params(CRYPT_KDF_PBKDF2);
+       }
+
+       if (!pbkdf && dev_type && !strcmp(dev_type, CRYPT_LUKS2))
+               pbkdf = crypt_get_pbkdf_type_params(DEFAULT_LUKS2_PBKDF);
+       else if (!pbkdf)
+               pbkdf = crypt_get_pbkdf_type_params(CRYPT_KDF_PBKDF2);
+
+       r = verify_pbkdf_params(cd, pbkdf);
+       if (r)
+               return r;
+
+       r = crypt_pbkdf_get_limits(pbkdf->type, &pbkdf_limits);
+       if (r < 0)
+               return r;
+
+       type = strdup(pbkdf->type);
+       hash = pbkdf->hash ? strdup(pbkdf->hash) : NULL;
+
+       if (!type || (!hash && pbkdf->hash)) {
+               free(CONST_CAST(void*)type);
+               free(CONST_CAST(void*)hash);
+               return -ENOMEM;
+       }
+
+       free(CONST_CAST(void*)cd_pbkdf->type);
+       free(CONST_CAST(void*)cd_pbkdf->hash);
+       cd_pbkdf->type = type;
+       cd_pbkdf->hash = hash;
+
+       old_flags = cd_pbkdf->flags;
+       cd_pbkdf->flags = pbkdf->flags;
+
+       /* Reset iteration count so benchmark must run again. */
+       if (cd_pbkdf->flags & CRYPT_PBKDF_NO_BENCHMARK)
+               cd_pbkdf->iterations = pbkdf->iterations;
+       else
+               cd_pbkdf->iterations = 0;
+
+       if (old_flags & CRYPT_PBKDF_ITER_TIME_SET)
+               cd_pbkdf->flags |= CRYPT_PBKDF_ITER_TIME_SET;
+       else
+               cd_pbkdf->time_ms = pbkdf->time_ms;
+
+       cd_pbkdf->max_memory_kb = pbkdf->max_memory_kb;
+       cd_pbkdf->parallel_threads = pbkdf->parallel_threads;
+
+       if (cd_pbkdf->parallel_threads > pbkdf_limits.max_parallel) {
+               log_dbg(cd, "Maximum PBKDF threads is %d (requested %d).",
+                       pbkdf_limits.max_parallel, cd_pbkdf->parallel_threads);
+               cd_pbkdf->parallel_threads = pbkdf_limits.max_parallel;
+       }
+
+       if (cd_pbkdf->parallel_threads) {
+               cpus = crypt_cpusonline();
+               if (cd_pbkdf->parallel_threads > cpus) {
+                       log_dbg(cd, "Only %u active CPUs detected, "
+                               "PBKDF threads decreased from %d to %d.",
+                               cpus, cd_pbkdf->parallel_threads, cpus);
+                       cd_pbkdf->parallel_threads = cpus;
+               }
+       }
+
+       if (cd_pbkdf->max_memory_kb) {
+               memory_kb = adjusted_phys_memory();
+               if (cd_pbkdf->max_memory_kb > memory_kb) {
+                       log_dbg(cd, "Not enough physical memory detected, "
+                               "PBKDF max memory decreased from %dkB to %dkB.",
+                               cd_pbkdf->max_memory_kb, memory_kb);
+                       cd_pbkdf->max_memory_kb = memory_kb;
+               }
+       }
+
+       if (!strcmp(pbkdf->type, CRYPT_KDF_PBKDF2))
+               log_dbg(cd, "PBKDF %s-%s, time_ms %u (iterations %u).",
+                       cd_pbkdf->type, cd_pbkdf->hash, cd_pbkdf->time_ms, cd_pbkdf->iterations);
+       else
+               log_dbg(cd, "PBKDF %s, time_ms %u (iterations %u), max_memory_kb %u, parallel_threads %u.",
+                       cd_pbkdf->type, cd_pbkdf->time_ms, cd_pbkdf->iterations,
+                       cd_pbkdf->max_memory_kb, cd_pbkdf->parallel_threads);
+
+       return 0;
+}
+
+/* Libcryptsetup API */
+
+int crypt_set_pbkdf_type(struct crypt_device *cd, const struct crypt_pbkdf_type *pbkdf)
+{
+       if (!cd)
+               return -EINVAL;
+
+       if (!pbkdf)
+               log_dbg(cd, "Resetting pbkdf type to default");
+
+       crypt_get_pbkdf(cd)->flags = 0;
+
+       return init_pbkdf_type(cd, pbkdf, crypt_get_type(cd));
+}
+
+const struct crypt_pbkdf_type *crypt_get_pbkdf_type(struct crypt_device *cd)
+{
+       if (!cd)
+               return NULL;
+
+       return crypt_get_pbkdf(cd)->type ? crypt_get_pbkdf(cd) : NULL;
+}
+
+const struct crypt_pbkdf_type *crypt_get_pbkdf_default(const char *type)
+{
+       if (!type)
+               return NULL;
+
+       if (!strcmp(type, CRYPT_LUKS1) || crypt_fips_mode())
+               return crypt_get_pbkdf_type_params(CRYPT_KDF_PBKDF2);
+       else if (!strcmp(type, CRYPT_LUKS2))
+               return crypt_get_pbkdf_type_params(DEFAULT_LUKS2_PBKDF);
+
+       return NULL;
+}
+
+void crypt_set_iteration_time(struct crypt_device *cd, uint64_t iteration_time_ms)
+{
+       struct crypt_pbkdf_type *pbkdf;
+       uint32_t old_time_ms;
+
+       if (!cd || iteration_time_ms > UINT32_MAX)
+               return;
+
+       pbkdf = crypt_get_pbkdf(cd);
+       old_time_ms = pbkdf->time_ms;
+       pbkdf->time_ms = (uint32_t)iteration_time_ms;
+
+       if (pbkdf->type && verify_pbkdf_params(cd, pbkdf)) {
+               pbkdf->time_ms = old_time_ms;
+               log_dbg(cd, "Invalid iteration time.");
+               return;
+       }
+
+       pbkdf->flags |= CRYPT_PBKDF_ITER_TIME_SET;
+
+       /* iterations must be benchmarked now */
+       pbkdf->flags &= ~(CRYPT_PBKDF_NO_BENCHMARK);
+       pbkdf->iterations = 0;
+
+       log_dbg(cd, "Iteration time set to %" PRIu64 " milliseconds.", iteration_time_ms);
+}
diff --git a/lib/utils_safe_memory.c b/lib/utils_safe_memory.c
new file mode 100644 (file)
index 0000000..8c1fb5c
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * utils_safe_memory - safe memory helpers
+ *
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "libcryptsetup.h"
+
+struct safe_allocation {
+       size_t  size;
+       char    data[0];
+};
+
+/*
+ * Replacement for memset(s, 0, n) on stack that can be optimized out
+ * Also used in safe allocations for explicit memory wipe.
+ */
+void crypt_safe_memzero(void *data, size_t size)
+{
+#ifdef HAVE_EXPLICIT_BZERO
+       explicit_bzero(data, size);
+#else
+       volatile uint8_t *p = (volatile uint8_t *)data;
+
+       while(size--)
+               *p++ = 0;
+#endif
+}
+
+/* safe allocations */
+void *crypt_safe_alloc(size_t size)
+{
+       struct safe_allocation *alloc;
+
+       if (!size || size > (SIZE_MAX - offsetof(struct safe_allocation, data)))
+               return NULL;
+
+       alloc = malloc(size + offsetof(struct safe_allocation, data));
+       if (!alloc)
+               return NULL;
+
+       alloc->size = size;
+       crypt_safe_memzero(&alloc->data, size);
+
+       /* coverity[leaked_storage] */
+       return &alloc->data;
+}
+
+void crypt_safe_free(void *data)
+{
+       struct safe_allocation *alloc;
+
+       if (!data)
+               return;
+
+       alloc = (struct safe_allocation *)
+               ((char *)data - offsetof(struct safe_allocation, data));
+
+       crypt_safe_memzero(data, alloc->size);
+
+       alloc->size = 0x55aa55aa;
+       free(alloc);
+}
+
+void *crypt_safe_realloc(void *data, size_t size)
+{
+       struct safe_allocation *alloc;
+       void *new_data;
+
+       new_data = crypt_safe_alloc(size);
+
+       if (new_data && data) {
+
+               alloc = (struct safe_allocation *)
+                       ((char *)data - offsetof(struct safe_allocation, data));
+
+               if (size > alloc->size)
+                       size = alloc->size;
+
+               memcpy(new_data, data, size);
+       }
+
+       crypt_safe_free(data);
+       return new_data;
+}
diff --git a/lib/utils_storage_wrappers.c b/lib/utils_storage_wrappers.c
new file mode 100644 (file)
index 0000000..b7e816b
--- /dev/null
@@ -0,0 +1,394 @@
+/*
+ * Generic wrapper for storage functions
+ * (experimental only)
+ *
+ * Copyright (C) 2018-2020, Ondrej Kozina
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "utils_storage_wrappers.h"
+#include "internal.h"
+
+struct crypt_storage_wrapper {
+       crypt_storage_wrapper_type type;
+       int dev_fd;
+       int block_size;
+       size_t mem_alignment;
+       uint64_t data_offset;
+       union {
+       struct {
+               struct crypt_storage *s;
+               uint64_t iv_start;
+       } cb;
+       struct {
+               int dmcrypt_fd;
+               char name[PATH_MAX];
+       } dm;
+       } u;
+};
+
+static int crypt_storage_backend_init(struct crypt_device *cd,
+               struct crypt_storage_wrapper *w,
+               uint64_t iv_start,
+               int sector_size,
+               const char *cipher,
+               const char *cipher_mode,
+               const struct volume_key *vk,
+               uint32_t flags)
+{
+       int r;
+       struct crypt_storage *s;
+
+       /* iv_start, sector_size */
+       r = crypt_storage_init(&s, sector_size, cipher, cipher_mode, vk->key, vk->keylength);
+       if (r)
+               return r;
+
+       if ((flags & DISABLE_KCAPI) && crypt_storage_kernel_only(s)) {
+               log_dbg(cd, "Could not initialize userspace block cipher and kernel fallback is disabled.");
+               crypt_storage_destroy(s);
+               return -ENOTSUP;
+       }
+
+       w->type = USPACE;
+       w->u.cb.s = s;
+       w->u.cb.iv_start = iv_start;
+
+       return 0;
+}
+
+static int crypt_storage_dmcrypt_init(
+       struct crypt_device *cd,
+       struct crypt_storage_wrapper *cw,
+       struct device *device,
+       uint64_t device_offset,
+       uint64_t iv_start,
+       int sector_size,
+       const char *cipher_spec,
+       struct volume_key *vk,
+       int open_flags)
+{
+       static int counter = 0;
+       char path[PATH_MAX];
+       struct crypt_dm_active_device dmd = {
+               .flags = CRYPT_ACTIVATE_PRIVATE,
+       };
+       int mode, r, fd = -1;
+
+       log_dbg(cd, "Using temporary dmcrypt to access data.");
+
+       if (snprintf(cw->u.dm.name, sizeof(cw->u.dm.name), "temporary-cryptsetup-%d-%d", getpid(), counter++) < 0)
+               return -ENOMEM;
+       if (snprintf(path, sizeof(path), "%s/%s", dm_get_dir(), cw->u.dm.name) < 0)
+               return -ENOMEM;
+
+       r = device_block_adjust(cd, device, DEV_OK,
+                               device_offset, &dmd.size, &dmd.flags);
+       if (r < 0) {
+               log_err(cd, _("Device %s does not exist or access denied."),
+                       device_path(device));
+               return -EIO;
+       }
+
+       mode = open_flags | O_DIRECT;
+       if (dmd.flags & CRYPT_ACTIVATE_READONLY)
+               mode = (open_flags & ~O_ACCMODE) | O_RDONLY;
+
+       if (vk->key_description)
+               dmd.flags |= CRYPT_ACTIVATE_KEYRING_KEY;
+
+       r = dm_crypt_target_set(&dmd.segment, 0, dmd.size,
+                           device,
+                           vk,
+                           cipher_spec,
+                           iv_start,
+                           device_offset,
+                           NULL,
+                           0,
+                           sector_size);
+       if (r)
+               return r;
+
+       r = dm_create_device(cd, cw->u.dm.name, "TEMP", &dmd);
+       if (r < 0) {
+               if (r != -EACCES && r != -ENOTSUP)
+                       log_dbg(cd, "error hint would be nice");
+               r = -EIO;
+       }
+
+       dm_targets_free(cd, &dmd);
+
+       if (r)
+               return r;
+
+       fd = open(path, mode);
+       if (fd < 0) {
+               log_dbg(cd, "Failed to open %s", path);
+               dm_remove_device(cd, cw->u.dm.name, CRYPT_DEACTIVATE_FORCE);
+               return -EINVAL;
+       }
+
+       cw->type = DMCRYPT;
+       cw->u.dm.dmcrypt_fd = fd;
+
+       return 0;
+}
+
+int crypt_storage_wrapper_init(struct crypt_device *cd,
+       struct crypt_storage_wrapper **cw,
+       struct device *device,
+       uint64_t data_offset,
+       uint64_t iv_start,
+       int sector_size,
+       const char *cipher,
+       struct volume_key *vk,
+       uint32_t flags)
+{
+       int open_flags, r;
+       char _cipher[MAX_CIPHER_LEN], mode[MAX_CIPHER_LEN];
+       struct crypt_storage_wrapper *w;
+
+       /* device-mapper restrictions */
+       if (data_offset & ((1 << SECTOR_SHIFT) - 1))
+               return -EINVAL;
+
+       if (crypt_parse_name_and_mode(cipher, _cipher, NULL, mode))
+               return -EINVAL;
+
+       open_flags = O_CLOEXEC | ((flags & OPEN_READONLY) ? O_RDONLY : O_RDWR);
+
+       w = malloc(sizeof(*w));
+       if (!w)
+               return -ENOMEM;
+
+       memset(w, 0, sizeof(*w));
+       w->data_offset = data_offset;
+       w->mem_alignment = device_alignment(device);
+       w->block_size = device_block_size(cd, device);
+       if (!w->block_size || !w->mem_alignment) {
+               log_dbg(cd, "block size or alignment error.");
+               r = -EINVAL;
+               goto err;
+       }
+
+       w->dev_fd = device_open(cd, device, open_flags);
+       if (w->dev_fd < 0) {
+               r = -EINVAL;
+               goto err;
+       }
+
+       if (!strcmp(_cipher, "cipher_null")) {
+               log_dbg(cd, "Requested cipher_null, switching to noop wrapper.");
+               w->type = NONE;
+               *cw = w;
+               return 0;
+       }
+
+       if (!vk) {
+               log_dbg(cd, "no key passed.");
+               r = -EINVAL;
+               goto err;
+       }
+
+       r = crypt_storage_backend_init(cd, w, iv_start, sector_size, _cipher, mode, vk, flags);
+       if (!r) {
+               *cw = w;
+               return 0;
+       }
+
+       log_dbg(cd, "Failed to initialize userspace block cipher.");
+
+       if ((r != -ENOTSUP && r != -ENOENT) || (flags & DISABLE_DMCRYPT))
+               goto err;
+
+       r = crypt_storage_dmcrypt_init(cd, w, device, data_offset >> SECTOR_SHIFT, iv_start,
+                       sector_size, cipher, vk, open_flags);
+       if (r) {
+               log_dbg(cd, "Dm-crypt backend failed to initialize.");
+               goto err;
+       }
+       *cw = w;
+       return 0;
+err:
+       crypt_storage_wrapper_destroy(w);
+       /* wrapper destroy */
+       return r;
+}
+
+/* offset is relative to sector_start */
+ssize_t crypt_storage_wrapper_read(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length)
+{
+       return read_lseek_blockwise(cw->dev_fd,
+                       cw->block_size,
+                       cw->mem_alignment,
+                       buffer,
+                       buffer_length,
+                       cw->data_offset + offset);
+}
+
+ssize_t crypt_storage_wrapper_read_decrypt(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length)
+{
+       int r;
+       ssize_t read;
+
+       if (cw->type == DMCRYPT)
+               return read_lseek_blockwise(cw->u.dm.dmcrypt_fd,
+                               cw->block_size,
+                               cw->mem_alignment,
+                               buffer,
+                               buffer_length,
+                               offset);
+
+       read = read_lseek_blockwise(cw->dev_fd,
+                       cw->block_size,
+                       cw->mem_alignment,
+                       buffer,
+                       buffer_length,
+                       cw->data_offset + offset);
+       if (cw->type == NONE || read < 0)
+               return read;
+
+       r = crypt_storage_decrypt(cw->u.cb.s,
+                       cw->u.cb.iv_start + (offset >> SECTOR_SHIFT),
+                       read,
+                       buffer);
+       if (r)
+               return -EINVAL;
+
+       return read;
+}
+
+ssize_t crypt_storage_wrapper_decrypt(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length)
+{
+       int r;
+       ssize_t read;
+
+       if (cw->type == NONE)
+               return 0;
+
+       if (cw->type == DMCRYPT) {
+               /* there's nothing we can do, just read/decrypt via dm-crypt */
+               read = crypt_storage_wrapper_read_decrypt(cw, offset, buffer, buffer_length);
+               if (read < 0 || (size_t)read != buffer_length)
+                       return -EINVAL;
+               return 0;
+       }
+
+       r = crypt_storage_decrypt(cw->u.cb.s,
+                       cw->u.cb.iv_start + (offset >> SECTOR_SHIFT),
+                       buffer_length,
+                       buffer);
+       if (r)
+               return r;
+
+       return 0;
+}
+
+ssize_t crypt_storage_wrapper_write(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length)
+{
+       return write_lseek_blockwise(cw->dev_fd,
+                       cw->block_size,
+                       cw->mem_alignment,
+                       buffer,
+                       buffer_length,
+                       cw->data_offset + offset);
+}
+
+ssize_t crypt_storage_wrapper_encrypt_write(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length)
+{
+       if (cw->type == DMCRYPT)
+               return write_lseek_blockwise(cw->u.dm.dmcrypt_fd,
+                               cw->block_size,
+                               cw->mem_alignment,
+                               buffer,
+                               buffer_length,
+                               offset);
+
+       if (cw->type == USPACE &&
+           crypt_storage_encrypt(cw->u.cb.s,
+                   cw->u.cb.iv_start + (offset >> SECTOR_SHIFT),
+                   buffer_length, buffer))
+               return -EINVAL;
+
+       return write_lseek_blockwise(cw->dev_fd,
+                       cw->block_size,
+                       cw->mem_alignment,
+                       buffer,
+                       buffer_length,
+                       cw->data_offset + offset);
+}
+
+ssize_t crypt_storage_wrapper_encrypt(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length)
+{
+       if (cw->type == NONE)
+               return 0;
+
+       if (cw->type == DMCRYPT)
+               return -ENOTSUP;
+
+       if (crypt_storage_encrypt(cw->u.cb.s,
+                       cw->u.cb.iv_start + (offset >> SECTOR_SHIFT),
+                       buffer_length,
+                       buffer))
+               return -EINVAL;
+
+       return 0;
+}
+
+void crypt_storage_wrapper_destroy(struct crypt_storage_wrapper *cw)
+{
+       if (!cw)
+               return;
+
+       if (cw->type == USPACE)
+               crypt_storage_destroy(cw->u.cb.s);
+       if (cw->type == DMCRYPT) {
+               close(cw->u.dm.dmcrypt_fd);
+               dm_remove_device(NULL, cw->u.dm.name, CRYPT_DEACTIVATE_FORCE);
+       }
+
+       free(cw);
+}
+
+int crypt_storage_wrapper_datasync(const struct crypt_storage_wrapper *cw)
+{
+       if (!cw)
+               return -EINVAL;
+       if (cw->type == DMCRYPT)
+               return fdatasync(cw->u.dm.dmcrypt_fd);
+       else
+               return fdatasync(cw->dev_fd);
+}
+
+crypt_storage_wrapper_type crypt_storage_wrapper_get_type(const struct crypt_storage_wrapper *cw)
+{
+       return cw ? cw->type : NONE;
+}
diff --git a/lib/utils_storage_wrappers.h b/lib/utils_storage_wrappers.h
new file mode 100644 (file)
index 0000000..aaaa824
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Generic wrapper for storage functions
+ * (experimental only)
+ *
+ * Copyright (C) 2018-2020, Ondrej Kozina
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _UTILS_STORAGE_WRAPPERS_H
+#define _UTILS_STORAGE_WRAPPERS_H
+
+struct crypt_storage_wrapper;
+struct device;
+struct volume_key;
+struct crypt_device;
+
+#define DISABLE_USPACE (1 << 0)
+#define DISABLE_KCAPI  (1 << 1)
+#define DISABLE_DMCRYPT        (1 << 2)
+#define OPEN_READONLY  (1 << 3)
+
+typedef enum {
+       NONE = 0,
+       USPACE,
+       DMCRYPT
+} crypt_storage_wrapper_type;
+
+int crypt_storage_wrapper_init(struct crypt_device *cd,
+       struct crypt_storage_wrapper **cw,
+       struct device *device,
+       uint64_t data_offset,
+       uint64_t iv_start,
+       int sector_size,
+       const char *cipher,
+       struct volume_key *vk,
+       uint32_t flags);
+
+void crypt_storage_wrapper_destroy(struct crypt_storage_wrapper *cw);
+
+/* !!! when doing 'read' or 'write' all offset values are RELATIVE to data_offset !!! */
+ssize_t crypt_storage_wrapper_read(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length);
+ssize_t crypt_storage_wrapper_read_decrypt(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length);
+ssize_t crypt_storage_wrapper_decrypt(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length);
+
+ssize_t crypt_storage_wrapper_write(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length);
+ssize_t crypt_storage_wrapper_encrypt_write(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length);
+ssize_t crypt_storage_wrapper_encrypt(struct crypt_storage_wrapper *cw,
+               off_t offset, void *buffer, size_t buffer_length);
+
+int crypt_storage_wrapper_datasync(const struct crypt_storage_wrapper *cw);
+
+crypt_storage_wrapper_type crypt_storage_wrapper_get_type(const struct crypt_storage_wrapper *cw);
+#endif
index 210c566..96dff29 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * utils_wipe - wipe a device
  *
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2011-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2012, Milan Broz
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-#include "libcryptsetup.h"
 #include "internal.h"
 
-#define MAXIMUM_WIPE_BYTES     1024 * 1024 * 32 /* 32 MiB */
-
-static ssize_t _crypt_wipe_zero(int fd, int bsize, char *buffer,
-                               uint64_t offset, uint64_t size)
-{
-       memset(buffer, 0, size);
-       return write_lseek_blockwise(fd, bsize, buffer, size, offset);
-}
-
-static ssize_t _crypt_wipe_random(int fd, int bsize, char *buffer,
-                                 uint64_t offset, uint64_t size)
-{
-       if (crypt_random_get(NULL, buffer, size, CRYPT_RND_NORMAL) < 0)
-               return -EINVAL;
-
-       return write_lseek_blockwise(fd, bsize, buffer, size, offset);
-}
-
 /*
  * Wipe using Peter Gutmann method described in
  * http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html
+ * Note: used only for rotational device (and even there it is not needed today...)
  */
 static void wipeSpecial(char *buffer, size_t buffer_size, unsigned int turn)
 {
@@ -72,126 +45,222 @@ static void wipeSpecial(char *buffer, size_t buffer_size, unsigned int turn)
                {"\x6d\xb6\xdb"}, {"\xb6\xdb\x6d"}, {"\xdb\x6d\xb6"}
        };
 
-       for(i = 0; i < buffer_size / 3; ++i) {
+       for (i = 0; i < buffer_size / 3; ++i) {
                memcpy(buffer, write_modes[turn], 3);
                buffer += 3;
        }
 }
 
-static ssize_t _crypt_wipe_disk(int fd, int bsize, char *buffer,
-                               uint64_t offset, uint64_t size)
+static int crypt_wipe_special(struct crypt_device *cd, int fd, size_t bsize,
+                             size_t alignment, char *buffer,
+                             uint64_t offset, size_t size)
 {
-       int r;
+       int r = 0;
        unsigned int i;
        ssize_t written;
 
-       for(i = 0; i < 39; ++i) {
+       for (i = 0; i < 39; ++i) {
                if (i <  5) {
-                       r = crypt_random_get(NULL, buffer, size, CRYPT_RND_NORMAL);
-               } else if(i >=  5 && i < 32) {
+                       r = crypt_random_get(cd, buffer, size, CRYPT_RND_NORMAL);
+               } else if (i >=  5 && i < 32) {
                        wipeSpecial(buffer, size, i - 5);
                        r = 0;
-               } else if(i >= 32 && i < 38) {
-                       r = crypt_random_get(NULL, buffer, size, CRYPT_RND_NORMAL);
-               } else if(i >= 38 && i < 39) {
+               } else if (i >= 32 && i < 38) {
+                       r = crypt_random_get(cd, buffer, size, CRYPT_RND_NORMAL);
+               } else if (i >= 38 && i < 39) {
                        memset(buffer, 0xFF, size);
                        r = 0;
                }
                if (r < 0)
-                       return r;
+                       return -EIO;
 
-               written = write_lseek_blockwise(fd, bsize, buffer, size, offset);
+               written = write_lseek_blockwise(fd, bsize, alignment,
+                                               buffer, size, offset);
                if (written < 0 || written != (ssize_t)size)
-                       return written;
+                       return -EIO;
        }
 
        /* Rewrite it finally with random */
-       return _crypt_wipe_random(fd, bsize, buffer, offset, size);
+       if (crypt_random_get(cd, buffer, size, CRYPT_RND_NORMAL) < 0)
+               return -EIO;
+
+       written = write_lseek_blockwise(fd, bsize, alignment, buffer, size, offset);
+       if (written < 0 || written != (ssize_t)size)
+               return -EIO;
+
+       return 0;
 }
 
-static ssize_t _crypt_wipe_ssd(int fd, int bsize, char *buffer,
-                              uint64_t offset, uint64_t size)
+static int wipe_block(struct crypt_device *cd, int devfd, crypt_wipe_pattern pattern,
+                     char *sf, size_t device_block_size, size_t alignment,
+                     size_t wipe_block_size, uint64_t offset, bool *need_block_init)
 {
-       // FIXME: for now just rewrite it by random
-       return _crypt_wipe_random(fd, bsize, buffer, offset, size);
+       int r;
+
+       if (pattern == CRYPT_WIPE_SPECIAL)
+               return crypt_wipe_special(cd, devfd, device_block_size, alignment,
+                                         sf, offset, wipe_block_size);
+
+       if (*need_block_init) {
+               if (pattern == CRYPT_WIPE_ZERO) {
+                       memset(sf, 0, wipe_block_size);
+                       *need_block_init = false;
+                       r = 0;
+               } else if (pattern == CRYPT_WIPE_RANDOM) {
+                       r = crypt_random_get(cd, sf, wipe_block_size,
+                                            CRYPT_RND_NORMAL) ? -EIO : 0;
+                       *need_block_init = true;
+               } else if (pattern == CRYPT_WIPE_ENCRYPTED_ZERO) {
+                       // FIXME
+                       r = crypt_random_get(cd, sf, wipe_block_size,
+                                            CRYPT_RND_NORMAL) ? -EIO : 0;
+                       *need_block_init = true;
+               } else
+                       r = -EINVAL;
+
+               if (r)
+                       return r;
+       }
+
+       if (write_blockwise(devfd, device_block_size, alignment, sf,
+                           wipe_block_size) == (ssize_t)wipe_block_size)
+               return 0;
+
+       return -EIO;
 }
 
-int crypt_wipe(struct device *device,
-              uint64_t offset,
-              uint64_t size,
-              crypt_wipe_type type,
-              int exclusive)
+int crypt_wipe_device(struct crypt_device *cd,
+       struct device *device,
+       crypt_wipe_pattern pattern,
+       uint64_t offset,
+       uint64_t length,
+       size_t wipe_block_size,
+       int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
+       void *usrptr)
 {
-       struct stat st;
-       char *buffer;
-       int devfd, flags, bsize;
-       ssize_t written;
+       int r, devfd;
+       size_t bsize, alignment;
+       char *sf = NULL;
+       uint64_t dev_size;
+       bool need_block_init = true;
 
-       if (!size || size % SECTOR_SIZE || (size > MAXIMUM_WIPE_BYTES)) {
-               log_dbg("Unsuported wipe size for device %s: %ld.",
-                       device_path(device), (unsigned long)size);
+       /* Note: LUKS1 calls it with wipe_block not aligned to multiple of bsize */
+       bsize = device_block_size(cd, device);
+       alignment = device_alignment(device);
+       if (!bsize || !alignment || !wipe_block_size)
                return -EINVAL;
-       }
 
-       if (stat(device_path(device), &st) < 0) {
-               log_dbg("Device %s not found.", device_path(device));
+       /* FIXME: if wipe_block_size < bsize, then a wipe is highly ineffective */
+
+       /* Everything must be aligned to SECTOR_SIZE */
+       if (MISALIGNED_512(offset) || MISALIGNED_512(length) || MISALIGNED_512(wipe_block_size))
                return -EINVAL;
-       }
 
-       if (type == CRYPT_WIPE_DISK && S_ISBLK(st.st_mode)) {
-               if (!crypt_dev_is_rotational(major(st.st_rdev),
-                                               minor(st.st_rdev))) {
-                       type = CRYPT_WIPE_SSD;
-                       log_dbg("Non-rotational device, using SSD wipe mode.");
-               } else
-                       log_dbg("Rotational device, using normal wipe mode.");
-       }
+       if (device_is_locked(device))
+               devfd = device_open_locked(cd, device, O_RDWR);
+       else
+               devfd = device_open(cd, device, O_RDWR);
+       if (devfd < 0)
+               return errno ? -errno : -EINVAL;
 
-       bsize = device_block_size(device);
-       if (bsize <= 0)
-               return -EINVAL;
+       if (length)
+               dev_size = offset + length;
+       else {
+               r = device_size(device, &dev_size);
+               if (r)
+                       goto out;
 
-       buffer = malloc(size);
-       if (!buffer)
-               return -ENOMEM;
+               if (dev_size <= offset) {
+                       r = -EINVAL;
+                       goto out;
+               }
+       }
 
-       flags = O_RDWR;
+       r = posix_memalign((void **)&sf, alignment, wipe_block_size);
+       if (r)
+               goto out;
 
-       /* use O_EXCL only for block devices */
-       if (exclusive && S_ISBLK(st.st_mode))
-               flags |= O_EXCL;
+       if (lseek64(devfd, offset, SEEK_SET) < 0) {
+               log_err(cd, _("Cannot seek to device offset."));
+               r = -EINVAL;
+               goto out;
+       }
 
-       /* coverity[toctou] */
-       devfd = device_open(device, flags);
-       if (devfd == -1) {
-               free(buffer);
-               return errno ? -errno : -EINVAL;
+       if (progress && progress(dev_size, offset, usrptr)) {
+               r = -EINVAL; /* No change yet, treat this as a parameter error */
+               goto out;
        }
 
-       // FIXME: use fixed block size and loop here
-       switch (type) {
-               case CRYPT_WIPE_ZERO:
-                       written = _crypt_wipe_zero(devfd, bsize, buffer, offset, size);
-                       break;
-               case CRYPT_WIPE_DISK:
-                       written = _crypt_wipe_disk(devfd, bsize, buffer, offset, size);
-                       break;
-               case CRYPT_WIPE_SSD:
-                       written = _crypt_wipe_ssd(devfd, bsize, buffer, offset, size);
+       if (pattern == CRYPT_WIPE_SPECIAL && !device_is_rotational(device)) {
+               log_dbg(cd, "Non-rotational device, using random data wipe mode.");
+               pattern = CRYPT_WIPE_RANDOM;
+       }
+
+       while (offset < dev_size) {
+               if ((offset + wipe_block_size) > dev_size)
+                       wipe_block_size = dev_size - offset;
+
+               //log_dbg("Wipe %012" PRIu64 "-%012" PRIu64 " bytes", offset, offset + wipe_block_size);
+
+               r = wipe_block(cd, devfd, pattern, sf, bsize, alignment,
+                              wipe_block_size, offset, &need_block_init);
+               if (r) {
+                       log_err(cd,_("Device wipe error, offset %" PRIu64 "."), offset);
                        break;
-               case CRYPT_WIPE_RANDOM:
-                       written = _crypt_wipe_random(devfd, bsize, buffer, offset, size);
+               }
+
+               offset += wipe_block_size;
+
+               if (progress && progress(dev_size, offset, usrptr)) {
+                       r = -EINTR;
                        break;
-               default:
-                       log_dbg("Unsuported wipe type requested: (%d)", type);
-                       written = -1;
+               }
        }
 
-       close(devfd);
-       free(buffer);
+       device_sync(cd, device);
+out:
+       free(sf);
+       return r;
+}
 
-       if (written != (ssize_t)size || written < 0)
-               return -EIO;
+int crypt_wipe(struct crypt_device *cd,
+       const char *dev_path,
+       crypt_wipe_pattern pattern,
+       uint64_t offset,
+       uint64_t length,
+       size_t wipe_block_size,
+       uint32_t flags,
+       int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
+       void *usrptr)
+{
+       struct device *device;
+       int r;
 
-       return 0;
+       if (!cd)
+               return -EINVAL;
+
+       if (!dev_path)
+               device = crypt_data_device(cd);
+       else {
+               r = device_alloc_no_check(&device, dev_path);
+               if (r < 0)
+                       return r;
+
+               if (flags & CRYPT_WIPE_NO_DIRECT_IO)
+                       device_disable_direct_io(device);
+       }
+
+       if (!wipe_block_size)
+               wipe_block_size = 1024*1024;
+
+       log_dbg(cd, "Wipe [%u] device %s, offset %" PRIu64 ", length %" PRIu64 ", block %zu.",
+               (unsigned)pattern, device_path(device), offset, length, wipe_block_size);
+
+       r = crypt_wipe_device(cd, device, pattern, offset, length,
+                             wipe_block_size, progress, usrptr);
+
+       if (dev_path)
+               device_free(cd, device);
+
+       return r;
 }
diff --git a/lib/verity/Makefile.am b/lib/verity/Makefile.am
deleted file mode 100644 (file)
index b5ffc92..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-moduledir = $(libdir)/cryptsetup
-
-noinst_LTLIBRARIES = libverity.la
-
-libverity_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-
-libverity_la_SOURCES = \
-       verity_hash.c \
-       verity.c \
-       verity.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
diff --git a/lib/verity/Makefile.in b/lib/verity/Makefile.in
deleted file mode 100644 (file)
index bcb42e8..0000000
+++ /dev/null
@@ -1,655 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = lib/verity
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libverity_la_LIBADD =
-am_libverity_la_OBJECTS = libverity_la-verity_hash.lo \
-       libverity_la-verity.lo
-libverity_la_OBJECTS = $(am_libverity_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libverity_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libverity_la_CFLAGS) \
-       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libverity_la_SOURCES)
-DIST_SOURCES = $(libverity_la_SOURCES)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-moduledir = $(libdir)/cryptsetup
-noinst_LTLIBRARIES = libverity.la
-libverity_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@
-libverity_la_SOURCES = \
-       verity_hash.c \
-       verity.c \
-       verity.h
-
-AM_CPPFLAGS = -include config.h \
-        -I$(top_srcdir)/lib                    \
-        -I$(top_srcdir)/lib/crypto_backend
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/verity/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu lib/verity/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
-       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-       @list='$(noinst_LTLIBRARIES)'; \
-       locs=`for p in $$list; do echo $$p; done | \
-             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-             sort -u`; \
-       test -z "$$locs" || { \
-         echo rm -f $${locs}; \
-         rm -f $${locs}; \
-       }
-
-libverity.la: $(libverity_la_OBJECTS) $(libverity_la_DEPENDENCIES) $(EXTRA_libverity_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(libverity_la_LINK)  $(libverity_la_OBJECTS) $(libverity_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libverity_la-verity.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libverity_la-verity_hash.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libverity_la-verity_hash.lo: verity_hash.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libverity_la_CFLAGS) $(CFLAGS) -MT libverity_la-verity_hash.lo -MD -MP -MF $(DEPDIR)/libverity_la-verity_hash.Tpo -c -o libverity_la-verity_hash.lo `test -f 'verity_hash.c' || echo '$(srcdir)/'`verity_hash.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libverity_la-verity_hash.Tpo $(DEPDIR)/libverity_la-verity_hash.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='verity_hash.c' object='libverity_la-verity_hash.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libverity_la_CFLAGS) $(CFLAGS) -c -o libverity_la-verity_hash.lo `test -f 'verity_hash.c' || echo '$(srcdir)/'`verity_hash.c
-
-libverity_la-verity.lo: verity.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libverity_la_CFLAGS) $(CFLAGS) -MT libverity_la-verity.lo -MD -MP -MF $(DEPDIR)/libverity_la-verity.Tpo -c -o libverity_la-verity.lo `test -f 'verity.c' || echo '$(srcdir)/'`verity.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/libverity_la-verity.Tpo $(DEPDIR)/libverity_la-verity.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='verity.c' object='libverity_la-verity.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libverity_la_CFLAGS) $(CFLAGS) -c -o libverity_la-verity.lo `test -f 'verity.c' || echo '$(srcdir)/'`verity.c
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-       clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-       ctags-am distclean distclean-compile distclean-generic \
-       distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/lib/verity/rs.h b/lib/verity/rs.h
new file mode 100644 (file)
index 0000000..9171814
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Reed-Solomon codecs, based on libfec
+ *
+ * Copyright (C) 2004 Phil Karn, KA9Q
+ * libcryptsetup modifications
+ *   Copyright (C) 2017-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _LIBFEC_RS_H
+#define _LIBFEC_RS_H
+
+/* Special reserved value encoding zero in index form. */
+#define A0 (rs->nn)
+
+#define RS_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+typedef unsigned char data_t;
+
+/* Reed-Solomon codec control block */
+struct rs {
+       int mm;          /* Bits per symbol */
+       int nn;          /* Symbols per block (= (1<<mm)-1) */
+       data_t *alpha_to;/* log lookup table */
+       data_t *index_of;/* Antilog lookup table */
+       data_t *genpoly; /* Generator polynomial */
+       int nroots;      /* Number of generator roots = number of parity symbols */
+       int fcr;         /* First consecutive root, index form */
+       int prim;        /* Primitive element, index form */
+       int iprim;       /* prim-th root of 1, index form */
+       int pad;         /* Padding bytes in shortened block */
+};
+
+static inline int modnn(struct rs *rs, int x)
+{
+       while (x >= rs->nn) {
+               x -= rs->nn;
+               x = (x >> rs->mm) + (x & rs->nn);
+       }
+       return x;
+}
+
+struct rs *init_rs_char(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad);
+void free_rs_char(struct rs *rs);
+
+/* General purpose RS codec, 8-bit symbols */
+void encode_rs_char(struct rs *rs, data_t *data, data_t *parity);
+int decode_rs_char(struct rs *rs, data_t *data);
+
+#endif
diff --git a/lib/verity/rs_decode_char.c b/lib/verity/rs_decode_char.c
new file mode 100644 (file)
index 0000000..920475e
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Reed-Solomon decoder, based on libfec
+ *
+ * Copyright (C) 2002, Phil Karn, KA9Q
+ * libcryptsetup modifications
+ *   Copyright (C) 2017-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "rs.h"
+
+int decode_rs_char(struct rs* rs, data_t* data)
+{
+       int deg_lambda, el, deg_omega, syn_error, count;
+       int i, j, r, k;
+       data_t q, tmp, num1, num2, den, discr_r;
+       /* FIXME: remove VLAs here */
+       data_t lambda[rs->nroots + 1], s[rs->nroots]; /* Err+Eras Locator poly and syndrome poly */
+       data_t b[rs->nroots + 1], t[rs->nroots + 1], omega[rs->nroots + 1];
+       data_t root[rs->nroots], reg[rs->nroots + 1], loc[rs->nroots];
+
+       memset(s, 0, rs->nroots * sizeof(data_t));
+       memset(b, 0, (rs->nroots + 1) * sizeof(data_t));
+
+       /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */
+       for (i = 0; i < rs->nroots; i++)
+               s[i] = data[0];
+
+       for (j = 1; j < rs->nn - rs->pad; j++) {
+               for (i = 0; i < rs->nroots; i++) {
+                       if (s[i] == 0) {
+                               s[i] = data[j];
+                       } else {
+                               s[i] = data[j] ^ rs->alpha_to[modnn(rs, rs->index_of[s[i]] + (rs->fcr + i) * rs->prim)];
+                       }
+               }
+       }
+
+       /* Convert syndromes to index form, checking for nonzero condition */
+       syn_error = 0;
+       for (i = 0; i < rs->nroots; i++) {
+               syn_error |= s[i];
+               s[i] = rs->index_of[s[i]];
+       }
+
+       /*
+        * if syndrome is zero, data[] is a codeword and there are no
+        * errors to correct. So return data[] unmodified
+        */
+       if (!syn_error)
+               return 0;
+
+       memset(&lambda[1], 0, rs->nroots * sizeof(lambda[0]));
+       lambda[0] = 1;
+
+       for (i   = 0; i < rs->nroots + 1; i++)
+               b[i] = rs->index_of[lambda[i]];
+
+       /*
+        * Begin Berlekamp-Massey algorithm to determine error+erasure
+        * locator polynomial
+        */
+       r  = 0;
+       el = 0;
+       while (++r <= rs->nroots) { /* r is the step number */
+               /* Compute discrepancy at the r-th step in poly-form */
+               discr_r = 0;
+               for (i = 0; i < r; i++) {
+                       if ((lambda[i] != 0) && (s[r - i - 1] != A0)) {
+                               discr_r ^= rs->alpha_to[modnn(rs, rs->index_of[lambda[i]] + s[r - i - 1])];
+                       }
+               }
+               discr_r = rs->index_of[discr_r]; /* Index form */
+               if (discr_r == A0) {
+                       /* 2 lines below: B(x) <-- x*B(x) */
+                       memmove(&b[1], b, rs->nroots * sizeof(b[0]));
+                       b[0] = A0;
+               } else {
+                       /* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */
+                       t[0] = lambda[0];
+                       for (i = 0; i < rs->nroots; i++) {
+                               if (b[i] != A0)
+                                       t[i + 1] = lambda[i + 1] ^ rs->alpha_to[modnn(rs, discr_r + b[i])];
+                               else
+                                       t[i + 1] = lambda[i + 1];
+                       }
+                       if (2 * el <= r - 1) {
+                               el = r - el;
+                               /*
+                                * 2 lines below: B(x) <-- inv(discr_r) *
+                                * lambda(x)
+                                */
+                               for (i   = 0; i <= rs->nroots; i++)
+                                       b[i] = (lambda[i] == 0) ? A0 : modnn(rs, rs->index_of[lambda[i]] - discr_r + rs->nn);
+                       } else {
+                               /* 2 lines below: B(x) <-- x*B(x) */
+                               memmove(&b[1], b, rs->nroots * sizeof(b[0]));
+                               b[0] = A0;
+                       }
+                       memcpy(lambda, t, (rs->nroots + 1) * sizeof(t[0]));
+               }
+       }
+
+       /* Convert lambda to index form and compute deg(lambda(x)) */
+       deg_lambda = 0;
+       for (i = 0; i < rs->nroots + 1; i++) {
+               lambda[i] = rs->index_of[lambda[i]];
+               if (lambda[i] != A0)
+                       deg_lambda = i;
+       }
+       /* Find roots of the error+erasure locator polynomial by Chien search */
+       memcpy(&reg[1], &lambda[1], rs->nroots * sizeof(reg[0]));
+       count = 0; /* Number of roots of lambda(x) */
+       for (i = 1, k = rs->iprim - 1; i <= rs->nn; i++, k = modnn(rs, k + rs->iprim)) {
+               q = 1; /* lambda[0] is always 0 */
+               for (j = deg_lambda; j > 0; j--) {
+                       if (reg[j] != A0) {
+                               reg[j] = modnn(rs, reg[j] + j);
+                               q ^= rs->alpha_to[reg[j]];
+                       }
+               }
+               if (q != 0)
+                       continue; /* Not a root */
+
+               /* store root (index-form) and error location number */
+               root[count] = i;
+               loc[count]  = k;
+               /* If we've already found max possible roots, abort the search to save time */
+               if (++count == deg_lambda)
+                       break;
+       }
+
+       /*
+        * deg(lambda) unequal to number of roots => uncorrectable
+        * error detected
+        */
+       if (deg_lambda != count)
+               return -1;
+
+       /*
+        * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo
+        * x**rs->nroots). in index form. Also find deg(omega).
+        */
+       deg_omega = deg_lambda - 1;
+       for (i = 0; i <= deg_omega; i++) {
+               tmp = 0;
+               for (j = i; j >= 0; j--) {
+                       if ((s[i - j] != A0) && (lambda[j] != A0))
+                               tmp ^= rs->alpha_to[modnn(rs, s[i - j] + lambda[j])];
+               }
+               omega[i] = rs->index_of[tmp];
+       }
+
+       /*
+        * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
+        * inv(X(l))**(rs->fcr-1) and den = lambda_pr(inv(X(l))) all in poly-form
+        */
+       for (j = count - 1; j >= 0; j--) {
+               num1 = 0;
+               for (i = deg_omega; i >= 0; i--) {
+                       if (omega[i] != A0)
+                               num1 ^= rs->alpha_to[modnn(rs, omega[i] + i * root[j])];
+               }
+               num2 = rs->alpha_to[modnn(rs, root[j] * (rs->fcr - 1) + rs->nn)];
+               den  = 0;
+
+               /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
+               for (i = RS_MIN(deg_lambda, rs->nroots - 1) & ~1; i >= 0; i -= 2) {
+                       if (lambda[i + 1] != A0)
+                               den ^= rs->alpha_to[modnn(rs, lambda[i + 1] + i * root[j])];
+               }
+
+               /* Apply error to data */
+               if (num1 != 0 && loc[j] >= rs->pad) {
+                       data[loc[j] - rs->pad] ^= rs->alpha_to[modnn(rs, rs->index_of[num1] +
+                                                 rs->index_of[num2] + rs->nn - rs->index_of[den])];
+               }
+       }
+
+       return count;
+}
diff --git a/lib/verity/rs_encode_char.c b/lib/verity/rs_encode_char.c
new file mode 100644 (file)
index 0000000..00ebb8b
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * Reed-Solomon encoder, based on libfec
+ *
+ * Copyright (C) 2002, Phil Karn, KA9Q
+ * libcryptsetup modifications
+ *   Copyright (C) 2017-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "rs.h"
+
+/* Initialize a Reed-Solomon codec
+ * symsize = symbol size, bits
+ * gfpoly = Field generator polynomial coefficients
+ * fcr = first root of RS code generator polynomial, index form
+ * prim = primitive element to generate polynomial roots
+ * nroots = RS code generator polynomial degree (number of roots)
+ * pad = padding bytes at front of shortened block
+ */
+struct rs *init_rs_char(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad)
+{
+       struct rs *rs;
+       int i, j, sr, root, iprim;
+
+       /* Check parameter ranges */
+       if (symsize < 0 || symsize > 8 * (int)sizeof(data_t))
+               return NULL;
+       if (fcr < 0 || fcr >= (1<<symsize))
+               return NULL;
+       if (prim <= 0 || prim >= (1<<symsize))
+               return NULL;
+       if (nroots < 0 || nroots >= (1<<symsize))
+               return NULL; /* Can't have more roots than symbol values! */
+
+       if (pad < 0 || pad >= ((1<<symsize) - 1 - nroots))
+               return NULL; /* Too much padding */
+
+       rs = calloc(1, sizeof(struct rs));
+       if (rs == NULL)
+               return NULL;
+
+       rs->mm = symsize;
+       rs->nn = (1<<symsize) - 1;
+       rs->pad = pad;
+
+       rs->alpha_to = malloc(sizeof(data_t) * (rs->nn + 1));
+       if (rs->alpha_to == NULL) {
+               free(rs);
+               return NULL;
+       }
+       rs->index_of = malloc(sizeof(data_t) * (rs->nn + 1));
+       if (rs->index_of == NULL) {
+               free(rs->alpha_to);
+               free(rs);
+               return NULL;
+       }
+       memset(rs->index_of, 0, sizeof(data_t) * (rs->nn + 1));
+
+       /* Generate Galois field lookup tables */
+       rs->index_of[0] = A0; /* log(zero) = -inf */
+       rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */
+       sr = 1;
+       for (i = 0; i < rs->nn; i++) {
+               rs->index_of[sr] = i;
+               rs->alpha_to[i] = sr;
+               sr <<= 1;
+               if(sr & (1<<symsize))
+                       sr ^= gfpoly;
+               sr &= rs->nn;
+       }
+       if (sr != 1) {
+               /* field generator polynomial is not primitive! */
+               free(rs->alpha_to);
+               free(rs->index_of);
+               free(rs);
+               return NULL;
+       }
+
+       /* Form RS code generator polynomial from its roots */
+       rs->genpoly = malloc(sizeof(data_t) * (nroots + 1));
+       if (rs->genpoly == NULL) {
+               free(rs->alpha_to);
+               free(rs->index_of);
+               free(rs);
+               return NULL;
+       }
+
+       rs->fcr = fcr;
+       rs->prim = prim;
+       rs->nroots = nroots;
+
+       /* Find prim-th root of 1, used in decoding */
+       for (iprim = 1; (iprim % prim) != 0; iprim += rs->nn)
+               ;
+       rs->iprim = iprim / prim;
+
+       rs->genpoly[0] = 1;
+       for (i = 0, root = fcr * prim; i < nroots; i++, root += prim) {
+               rs->genpoly[i + 1] = 1;
+
+               /* Multiply rs->genpoly[] by  @**(root + x) */
+               for (j = i; j > 0; j--){
+                       if (rs->genpoly[j] != 0)
+                               rs->genpoly[j] = rs->genpoly[j - 1] ^ rs->alpha_to[modnn(rs, rs->index_of[rs->genpoly[j]] + root)];
+                       else
+                               rs->genpoly[j] = rs->genpoly[j - 1];
+               }
+               /* rs->genpoly[0] can never be zero */
+               rs->genpoly[0] = rs->alpha_to[modnn(rs, rs->index_of[rs->genpoly[0]] + root)];
+       }
+       /* convert rs->genpoly[] to index form for quicker encoding */
+       for (i = 0; i <= nroots; i++)
+               rs->genpoly[i] = rs->index_of[rs->genpoly[i]];
+
+       return rs;
+}
+
+void free_rs_char(struct rs *rs)
+{
+       if (!rs)
+               return;
+
+       free(rs->alpha_to);
+       free(rs->index_of);
+       free(rs->genpoly);
+       free(rs);
+}
+
+void encode_rs_char(struct rs *rs, data_t *data, data_t *parity)
+{
+       int i, j;
+       data_t feedback;
+
+       memset(parity, 0, rs->nroots * sizeof(data_t));
+
+       for (i = 0; i < rs->nn - rs->nroots - rs->pad; i++) {
+               feedback = rs->index_of[data[i] ^ parity[0]];
+               if (feedback != A0) {
+                       /* feedback term is non-zero */
+#ifdef UNNORMALIZED
+                       /* This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
+                        * always be for the polynomials constructed by init_rs() */
+                       feedback = modnn(rs, rs->nn - rs->genpoly[rs->nroots] + feedback);
+#endif
+                       for (j = 1; j < rs->nroots; j++)
+                               parity[j] ^= rs->alpha_to[modnn(rs, feedback + rs->genpoly[rs->nroots - j])];
+               }
+
+               /* Shift */
+               memmove(&parity[0], &parity[1], sizeof(data_t) * (rs->nroots - 1));
+
+               if (feedback != A0)
+                       parity[rs->nroots - 1] = rs->alpha_to[modnn(rs, feedback + rs->genpoly[0])];
+               else
+                       parity[rs->nroots - 1] = 0;
+       }
+}
index 5108e9e..af31784 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * dm-verity volume handling
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,7 +25,6 @@
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
 #include <netinet/in.h>
 #include <uuid/uuid.h>
 
@@ -58,52 +57,49 @@ int VERITY_read_sb(struct crypt_device *cd,
                   struct crypt_params_verity *params)
 {
        struct device *device = crypt_metadata_device(cd);
-       int bsize = device_block_size(device);
        struct verity_sb sb = {};
        ssize_t hdr_size = sizeof(struct verity_sb);
-       int devfd = 0, sb_version;
+       int devfd, sb_version;
 
-       log_dbg("Reading VERITY header of size %zu on device %s, offset %" PRIu64 ".",
+       log_dbg(cd, "Reading VERITY header of size %zu on device %s, offset %" PRIu64 ".",
                sizeof(struct verity_sb), device_path(device), sb_offset);
 
        if (params->flags & CRYPT_VERITY_NO_HEADER) {
-               log_err(cd, _("Verity device %s doesn't use on-disk header.\n"),
+               log_err(cd, _("Verity device %s does not use on-disk header."),
                        device_path(device));
                return -EINVAL;
        }
 
-       if (sb_offset % 512) {
-               log_err(cd, _("Unsupported VERITY hash offset.\n"));
+       if (MISALIGNED_512(sb_offset)) {
+               log_err(cd, _("Unsupported VERITY hash offset."));
                return -EINVAL;
        }
 
-       devfd = device_open(device, O_RDONLY);
-       if(devfd == -1) {
-               log_err(cd, _("Cannot open device %s.\n"), device_path(device));
+       devfd = device_open(cd, device, O_RDONLY);
+       if (devfd < 0) {
+               log_err(cd, _("Cannot open device %s."), device_path(device));
                return -EINVAL;
        }
 
-       if(lseek(devfd, sb_offset, SEEK_SET) < 0 ||
-          read_blockwise(devfd, bsize, &sb, hdr_size) < hdr_size) {
-               close(devfd);
+       if (read_lseek_blockwise(devfd, device_block_size(cd, device),
+                                device_alignment(device), &sb, hdr_size,
+                                sb_offset) < hdr_size)
                return -EIO;
-       }
-       close(devfd);
 
        if (memcmp(sb.signature, VERITY_SIGNATURE, sizeof(sb.signature))) {
-               log_err(cd, _("Device %s is not a valid VERITY device.\n"),
+               log_err(cd, _("Device %s is not a valid VERITY device."),
                        device_path(device));
                return -EINVAL;
        }
 
        sb_version = le32_to_cpu(sb.version);
        if (sb_version != 1) {
-               log_err(cd, _("Unsupported VERITY version %d.\n"), sb_version);
+               log_err(cd, _("Unsupported VERITY version %d."), sb_version);
                return -EINVAL;
        }
        params->hash_type = le32_to_cpu(sb.hash_type);
        if (params->hash_type > VERITY_MAX_HASH_TYPE) {
-               log_err(cd, _("Unsupported VERITY hash type %d.\n"), params->hash_type);
+               log_err(cd, _("Unsupported VERITY hash type %d."), params->hash_type);
                return -EINVAL;
        }
 
@@ -111,7 +107,7 @@ int VERITY_read_sb(struct crypt_device *cd,
        params->hash_block_size = le32_to_cpu(sb.hash_block_size);
        if (VERITY_BLOCK_SIZE_OK(params->data_block_size) ||
            VERITY_BLOCK_SIZE_OK(params->hash_block_size)) {
-               log_err(cd, _("Unsupported VERITY block size.\n"));
+               log_err(cd, _("Unsupported VERITY block size."));
                return -EINVAL;
        }
        params->data_size = le64_to_cpu(sb.data_blocks);
@@ -120,21 +116,24 @@ int VERITY_read_sb(struct crypt_device *cd,
        if (!params->hash_name)
                return -ENOMEM;
        if (crypt_hash_size(params->hash_name) <= 0) {
-               log_err(cd, _("Hash algorithm %s not supported.\n"),
+               log_err(cd, _("Hash algorithm %s not supported."),
                        params->hash_name);
                free(CONST_CAST(char*)params->hash_name);
+               params->hash_name = NULL;
                return -EINVAL;
        }
 
        params->salt_size = le16_to_cpu(sb.salt_size);
        if (params->salt_size > sizeof(sb.salt)) {
-               log_err(cd, _("VERITY header corrupted.\n"));
+               log_err(cd, _("VERITY header corrupted."));
                free(CONST_CAST(char*)params->hash_name);
+               params->hash_name = NULL;
                return -EINVAL;
        }
        params->salt = malloc(params->salt_size);
        if (!params->salt) {
                free(CONST_CAST(char*)params->hash_name);
+               params->hash_name = NULL;
                return -ENOMEM;
        }
        memcpy(CONST_CAST(char*)params->salt, sb.salt, params->salt_size);
@@ -153,30 +152,30 @@ int VERITY_write_sb(struct crypt_device *cd,
                   struct crypt_params_verity *params)
 {
        struct device *device = crypt_metadata_device(cd);
-       int bsize = device_block_size(device);
        struct verity_sb sb = {};
        ssize_t hdr_size = sizeof(struct verity_sb);
+       char *algorithm;
        uuid_t uuid;
-       int r, devfd = 0;
+       int r, devfd;
 
-       log_dbg("Updating VERITY header of size %zu on device %s, offset %" PRIu64 ".",
+       log_dbg(cd, "Updating VERITY header of size %zu on device %s, offset %" PRIu64 ".",
                sizeof(struct verity_sb), device_path(device), sb_offset);
 
        if (!uuid_string || uuid_parse(uuid_string, uuid) == -1) {
-               log_err(cd, _("Wrong VERITY UUID format provided on device %s.\n"),
+               log_err(cd, _("Wrong VERITY UUID format provided on device %s."),
                        device_path(device));
                return -EINVAL;
        }
 
        if (params->flags & CRYPT_VERITY_NO_HEADER) {
-               log_err(cd, _("Verity device %s doesn't use on-disk header.\n"),
+               log_err(cd, _("Verity device %s does not use on-disk header."),
                        device_path(device));
                return -EINVAL;
        }
 
-       devfd = device_open(device, O_RDWR);
-       if(devfd == -1) {
-               log_err(cd, _("Cannot open device %s.\n"), device_path(device));
+       devfd = device_open(cd, device, O_RDWR);
+       if (devfd < 0) {
+               log_err(cd, _("Cannot open device %s."), device_path(device));
                return -EINVAL;
        }
 
@@ -187,15 +186,19 @@ int VERITY_write_sb(struct crypt_device *cd,
        sb.hash_block_size = cpu_to_le32(params->hash_block_size);
        sb.salt_size       = cpu_to_le16(params->salt_size);
        sb.data_blocks     = cpu_to_le64(params->data_size);
-       strncpy((char *)sb.algorithm, params->hash_name, sizeof(sb.algorithm));
+       algorithm = (char *)sb.algorithm;
+       algorithm[sizeof(sb.algorithm)-1] = '\0';
+       strncpy(algorithm, params->hash_name, sizeof(sb.algorithm)-1);
        memcpy(sb.salt, params->salt, params->salt_size);
        memcpy(sb.uuid, uuid, sizeof(sb.uuid));
 
-       r = write_lseek_blockwise(devfd, bsize, (char*)&sb, hdr_size, sb_offset) < hdr_size ? -EIO : 0;
+       r = write_lseek_blockwise(devfd, device_block_size(cd, device), device_alignment(device),
+                                 (char*)&sb, hdr_size, sb_offset) < hdr_size ? -EIO : 0;
        if (r)
-               log_err(cd, _("Error during update of verity header on device %s.\n"),
+               log_err(cd, _("Error during update of verity header on device %s."),
                        device_path(device));
-       close(devfd);
+
+       device_sync(cd, device);
 
        return r;
 }
@@ -218,7 +221,8 @@ int VERITY_UUID_generate(struct crypt_device *cd, char **uuid_string)
 {
        uuid_t uuid;
 
-       if (!(*uuid_string = malloc(40)))
+       *uuid_string = malloc(40);
+       if (!*uuid_string)
                return -ENOMEM;
        uuid_generate(uuid);
        uuid_unparse(uuid, *uuid_string);
@@ -230,19 +234,42 @@ int VERITY_activate(struct crypt_device *cd,
                     const char *name,
                     const char *root_hash,
                     size_t root_hash_size,
+                    const char *signature_description,
+                    struct device *fec_device,
                     struct crypt_params_verity *verity_hdr,
                     uint32_t activation_flags)
 {
-       struct crypt_dm_active_device dmd;
+       uint32_t dmv_flags;
+       unsigned int fec_errors = 0;
        int r;
+       struct crypt_dm_active_device dmd = {
+               .size = verity_hdr->data_size * verity_hdr->data_block_size / 512,
+               .flags = activation_flags,
+               .uuid = crypt_get_uuid(cd),
+       };
 
-       log_dbg("Trying to activate VERITY device %s using hash %s.",
+       log_dbg(cd, "Trying to activate VERITY device %s using hash %s.",
                name ?: "[none]", verity_hdr->hash_name);
 
        if (verity_hdr->flags & CRYPT_VERITY_CHECK_HASH) {
-               log_dbg("Verification of data in userspace required.");
-               r = VERITY_verify(cd, verity_hdr,
-                                 root_hash, root_hash_size);
+               if (signature_description) {
+                       log_err(cd, _("Root hash signature verification is not supported."));
+                       return -EINVAL;
+               }
+
+               log_dbg(cd, "Verification of data in userspace required.");
+               r = VERITY_verify(cd, verity_hdr, root_hash, root_hash_size);
+
+               if (r == -EPERM && fec_device) {
+                       log_dbg(cd, "Verification failed, trying to repair with FEC device.");
+                       r = VERITY_FEC_process(cd, verity_hdr, fec_device, 1, &fec_errors);
+                       if (r < 0)
+                               log_err(cd, _("Errors cannot be repaired with FEC device."));
+                       else if (fec_errors)
+                               log_err(cd, _("Found %u repairable errors with FEC device."),
+                                       fec_errors);
+               }
+
                if (r < 0)
                        return r;
        }
@@ -250,40 +277,53 @@ int VERITY_activate(struct crypt_device *cd,
        if (!name)
                return 0;
 
-       dmd.target = DM_VERITY;
-       dmd.data_device = crypt_data_device(cd);
-       dmd.u.verity.hash_device = crypt_metadata_device(cd);
-       dmd.u.verity.root_hash = root_hash;
-       dmd.u.verity.root_hash_size = root_hash_size;
-       dmd.u.verity.hash_offset = VERITY_hash_offset_block(verity_hdr),
-       dmd.flags = activation_flags;
-       dmd.size = verity_hdr->data_size * verity_hdr->data_block_size / 512;
-       dmd.uuid = crypt_get_uuid(cd);
-       dmd.u.verity.vp = verity_hdr;
-
-       r = device_block_adjust(cd, dmd.u.verity.hash_device, DEV_OK,
+       r = device_block_adjust(cd, crypt_metadata_device(cd), DEV_OK,
                                0, NULL, NULL);
        if (r)
                return r;
 
-       r = device_block_adjust(cd, dmd.data_device, DEV_EXCL,
+       r = device_block_adjust(cd, crypt_data_device(cd), DEV_EXCL,
                                0, &dmd.size, &dmd.flags);
        if (r)
                return r;
 
-       r = dm_create_device(cd, name, CRYPT_VERITY, &dmd, 0);
-       if (r < 0 && !(dm_flags() & DM_VERITY_SUPPORTED)) {
-               log_err(cd, _("Kernel doesn't support dm-verity mapping.\n"));
-               return -ENOTSUP;
+       if (fec_device) {
+               r = device_block_adjust(cd, fec_device, DEV_OK,
+                                       0, NULL, NULL);
+               if (r)
+                       return r;
        }
-       if (r < 0)
+
+       r = dm_verity_target_set(&dmd.segment, 0, dmd.size, crypt_data_device(cd),
+                       crypt_metadata_device(cd), fec_device, root_hash,
+                       root_hash_size, signature_description,
+                       VERITY_hash_offset_block(verity_hdr),
+                       VERITY_hash_blocks(cd, verity_hdr), verity_hdr);
+
+       if (r)
                return r;
 
+       r = dm_create_device(cd, name, CRYPT_VERITY, &dmd);
+       if (r < 0 && (dm_flags(cd, DM_VERITY, &dmv_flags) || !(dmv_flags & DM_VERITY_SUPPORTED))) {
+               log_err(cd, _("Kernel does not support dm-verity mapping."));
+               r = -ENOTSUP;
+       }
+       if (r < 0 && signature_description && !(dmv_flags & DM_VERITY_SIGNATURE_SUPPORTED)) {
+               log_err(cd, _("Kernel does not support dm-verity signature option."));
+               r = -ENOTSUP;
+       }
+       if (r < 0)
+               goto out;
+
        r = dm_status_verity_ok(cd, name);
        if (r < 0)
-               return r;
+               goto out;
 
        if (!r)
-               log_err(cd, _("Verity device detected corruption after activation.\n"));
-       return 0;
+               log_err(cd, _("Verity device detected corruption after activation."));
+
+       r = 0;
+out:
+       dm_targets_free(cd, &dmd);
+       return r;
 }
index 4f457cb..0b7f0cc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * dm-verity volume handling
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,8 @@
 #ifndef _VERITY_H
 #define _VERITY_H
 
-#include <unistd.h>
+#include <stddef.h>
+#include <stdint.h>
 
 #define VERITY_MAX_HASH_TYPE 1
 #define VERITY_BLOCK_SIZE_OK(x)        ((x) % 512 || (x) < 512 || \
@@ -29,6 +30,7 @@
 
 struct crypt_device;
 struct crypt_params_verity;
+struct device;
 
 int VERITY_read_sb(struct crypt_device *cd,
                   uint64_t sb_offset,
@@ -44,6 +46,8 @@ int VERITY_activate(struct crypt_device *cd,
                     const char *name,
                     const char *root_hash,
                     size_t root_hash_size,
+                    const char *signature_description,
+                    struct device *fec_device,
                     struct crypt_params_verity *verity_hdr,
                     uint32_t activation_flags);
 
@@ -54,11 +58,19 @@ int VERITY_verify(struct crypt_device *cd,
 
 int VERITY_create(struct crypt_device *cd,
                  struct crypt_params_verity *verity_hdr,
-                 char *root_hash,
+                 const char *root_hash,
                  size_t root_hash_size);
 
+int VERITY_FEC_process(struct crypt_device *cd,
+                     struct crypt_params_verity *params,
+                     struct device *fec_device,
+                     int check_fec,
+                     unsigned int *errors);
+
 uint64_t VERITY_hash_offset_block(struct crypt_params_verity *params);
 
+uint64_t VERITY_hash_blocks(struct crypt_device *cd, struct crypt_params_verity *params);
+
 int VERITY_UUID_generate(struct crypt_device *cd, char **uuid_string);
 
 #endif
diff --git a/lib/verity/verity_fec.c b/lib/verity/verity_fec.c
new file mode 100644 (file)
index 0000000..a8a5e86
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+ * dm-verity Forward Error Correction (FEC) support
+ *
+ * Copyright (C) 2015 Google, Inc. All rights reserved.
+ * Copyright (C) 2017-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+
+#include "verity.h"
+#include "internal.h"
+#include "rs.h"
+
+/* ecc parameters */
+#define FEC_RSM 255
+#define FEC_MIN_RSN 231
+#define FEC_MAX_RSN 253
+
+#define FEC_INPUT_DEVICES 2
+
+/* parameters to init_rs_char */
+#define FEC_PARAMS(roots) \
+    8,          /* symbol size in bits */ \
+    0x11d,      /* field generator polynomial coefficients */ \
+    0,          /* first root of the generator */ \
+    1,          /* primitive element to generate polynomial roots */ \
+    (roots),    /* polynomial degree (number of roots) */ \
+    0           /* padding bytes at the front of shortened block */
+
+struct fec_input_device {
+       struct device *device;
+       int fd;
+       uint64_t start;
+       uint64_t count;
+};
+
+struct fec_context {
+       uint32_t rsn;
+       uint32_t roots;
+       uint64_t size;
+       uint64_t blocks;
+       uint64_t rounds;
+       uint32_t block_size;
+       struct fec_input_device *inputs;
+       size_t ninputs;
+};
+
+/* computes ceil(x / y) */
+static inline uint64_t FEC_div_round_up(uint64_t x, uint64_t y)
+{
+       return (x / y) + (x % y > 0 ? 1 : 0);
+}
+
+/* returns a physical offset for the given RS offset */
+static inline uint64_t FEC_interleave(struct fec_context *ctx, uint64_t offset)
+{
+       return (offset / ctx->rsn) +
+                       (offset % ctx->rsn) * ctx->rounds * ctx->block_size;
+}
+
+/* returns data for a byte at the specified RS offset */
+static int FEC_read_interleaved(struct fec_context *ctx, uint64_t i,
+                               void *output, size_t count)
+{
+       size_t n;
+       uint64_t offset = FEC_interleave(ctx, i);
+
+       /* offsets outside input area are assumed to contain zeros */
+       if (offset >= ctx->size) {
+               memset(output, 0, count);
+               return 0;
+       }
+
+       /* find the correct input device and read from it */
+       for (n = 0; n < ctx->ninputs; ++n) {
+               if (offset >= ctx->inputs[n].count) {
+                       offset -= ctx->inputs[n].count;
+                       continue;
+               }
+
+               /* FIXME: read_lseek_blockwise candidate */
+               if (lseek(ctx->inputs[n].fd, ctx->inputs[n].start + offset, SEEK_SET) < 0)
+                       return -1;
+               return (read_buffer(ctx->inputs[n].fd, output, count) == (ssize_t)count) ? 0 : -1;
+       }
+
+       /* should never be reached */
+       return -1;
+}
+
+/* encodes/decode inputs to/from fd */
+static int FEC_process_inputs(struct crypt_device *cd,
+                             struct crypt_params_verity *params,
+                             struct fec_input_device *inputs,
+                             size_t ninputs, int fd,
+                             int decode, unsigned int *errors)
+{
+       int r = 0;
+       unsigned int i;
+       struct fec_context ctx;
+       uint32_t b;
+       uint64_t n;
+       uint8_t rs_block[FEC_RSM];
+       uint8_t *buf = NULL;
+       void *rs;
+
+       /* initialize parameters */
+       ctx.roots = params->fec_roots;
+       ctx.rsn = FEC_RSM - ctx.roots;
+       ctx.block_size = params->data_block_size;
+       ctx.inputs = inputs;
+       ctx.ninputs = ninputs;
+
+       rs = init_rs_char(FEC_PARAMS(ctx.roots));
+       if (!rs) {
+               log_err(cd, _("Failed to allocate RS context."));
+               return -ENOMEM;
+       }
+
+       /* calculate the total area covered by error correction codes */
+       ctx.size = 0;
+       for (n = 0; n < ctx.ninputs; ++n)
+               ctx.size += ctx.inputs[n].count;
+
+       /* each byte in a data block is covered by a different code */
+       ctx.blocks = FEC_div_round_up(ctx.size, ctx.block_size);
+       ctx.rounds = FEC_div_round_up(ctx.blocks, ctx.rsn);
+
+       buf = malloc((size_t)ctx.block_size * ctx.rsn);
+       if (!buf) {
+               log_err(cd, _("Failed to allocate buffer."));
+               r = -ENOMEM;
+               goto out;
+       }
+
+       /* encode/decode input */
+       for (n = 0; n < ctx.rounds; ++n) {
+               for (i = 0; i < ctx.rsn; ++i) {
+                       if (FEC_read_interleaved(&ctx, n * ctx.rsn * ctx.block_size + i,
+                                                &buf[i * ctx.block_size], ctx.block_size)) {
+                               log_err(cd, _("Failed to read RS block %" PRIu64 " byte %d."), n, i);
+                               r = -EIO;
+                               goto out;
+                       }
+               }
+
+               for (b = 0; b < ctx.block_size; ++b) {
+                       for (i = 0; i < ctx.rsn; ++i)
+                               rs_block[i] = buf[i * ctx.block_size + b];
+
+                       /* decoding from parity device */
+                       if (decode) {
+                               if (read_buffer(fd, &rs_block[ctx.rsn], ctx.roots) < 0) {
+                                       log_err(cd, _("Failed to read parity for RS block %" PRIu64 "."), n);
+                                       r = -EIO;
+                                       goto out;
+                               }
+
+                               /* coverity[tainted_data] */
+                               r = decode_rs_char(rs, rs_block);
+                               if (r < 0) {
+                                       log_err(cd, _("Failed to repair parity for block %" PRIu64 "."), n);
+                                       goto out;
+                               }
+                               /* return number of detected errors */
+                               if (errors)
+                                       *errors += r;
+                               r = 0;
+                       } else {
+                               /* encoding and writing parity data to fec device */
+                               encode_rs_char(rs, rs_block, &rs_block[ctx.rsn]);
+                               if (write_buffer(fd, &rs_block[ctx.rsn], ctx.roots) < 0) {
+                                       log_err(cd, _("Failed to write parity for RS block %" PRIu64 "."), n);
+                                       r = -EIO;
+                                       goto out;
+                               }
+                       }
+               }
+       }
+out:
+       free_rs_char(rs);
+       free(buf);
+       return r;
+}
+
+int VERITY_FEC_process(struct crypt_device *cd,
+                     struct crypt_params_verity *params,
+                     struct device *fec_device, int check_fec,
+                     unsigned int *errors)
+{
+       int r;
+       int fd = -1;
+       struct fec_input_device inputs[FEC_INPUT_DEVICES] = {
+               {
+                       .device = crypt_data_device(cd),
+                       .fd = -1,
+                       .start = 0,
+                       .count =  params->data_size * params->data_block_size
+               },{
+                       .device = crypt_metadata_device(cd),
+                       .fd = -1,
+                       .start = VERITY_hash_offset_block(params) * params->data_block_size
+               }
+       };
+
+       /* validate parameters */
+       if (params->data_block_size != params->hash_block_size) {
+               log_err(cd, _("Block sizes must match for FEC."));
+               return -EINVAL;
+       }
+
+       if (params->fec_roots > FEC_RSM - FEC_MIN_RSN ||
+               params->fec_roots < FEC_RSM - FEC_MAX_RSN) {
+               log_err(cd, _("Invalid number of parity bytes."));
+               return -EINVAL;
+       }
+
+       r = -EIO;
+
+       if (check_fec)
+               fd = open(device_path(fec_device), O_RDONLY);
+       else
+               fd = open(device_path(fec_device), O_RDWR);
+
+       if (fd == -1) {
+               log_err(cd, _("Cannot open device %s."), device_path(fec_device));
+               goto out;
+       }
+
+       if (lseek(fd, params->fec_area_offset, SEEK_SET) < 0) {
+               log_dbg(cd, "Cannot seek to requested position in FEC device.");
+               goto out;
+       }
+
+       /* input devices */
+       inputs[0].fd = open(device_path(inputs[0].device), O_RDONLY);
+       if (inputs[0].fd == -1) {
+               log_err(cd, _("Cannot open device %s."), device_path(inputs[0].device));
+               goto out;
+       }
+       inputs[1].fd = open(device_path(inputs[1].device), O_RDONLY);
+       if (inputs[1].fd == -1) {
+               log_err(cd, _("Cannot open device %s."), device_path(inputs[1].device));
+               goto out;
+       }
+
+       /* cover the entire hash device starting from hash_offset */
+       r = device_size(inputs[1].device, &inputs[1].count);
+       if (r) {
+               log_err(cd, _("Failed to determine size for device %s."),
+                               device_path(inputs[1].device));
+               goto out;
+       }
+       inputs[1].count -= inputs[1].start;
+
+       r = FEC_process_inputs(cd, params, inputs, FEC_INPUT_DEVICES, fd, check_fec, errors);
+out:
+       if (inputs[0].fd != -1)
+               close(inputs[0].fd);
+       if (inputs[1].fd != -1)
+               close(inputs[1].fd);
+       if (fd != -1)
+               close(fd);
+
+       return r;
+}
index 3f25e91..6142430 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * dm-verity volume handling
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
  *
  * This file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -51,12 +51,12 @@ static int verify_zero(struct crypt_device *cd, FILE *wr, size_t bytes)
        size_t i;
 
        if (fread(block, bytes, 1, wr) != 1) {
-               log_dbg("EIO while reading spare area.");
+               log_dbg(cd, "EIO while reading spare area.");
                return -EIO;
        }
        for (i = 0; i < bytes; i++)
                if (block[i]) {
-                       log_err(cd, _("Spare area is not zeroed at position %" PRIu64 ".\n"),
+                       log_err(cd, _("Spare area is not zeroed at position %" PRIu64 "."),
                                ftello(wr) - bytes);
                        return -EPERM;
                }
@@ -97,6 +97,48 @@ static int mult_overflow(off_t *u, off_t b, size_t size)
        return 0;
 }
 
+static int hash_levels(size_t hash_block_size, size_t digest_size,
+                      off_t data_file_blocks, off_t *hash_position, int *levels,
+                      off_t *hash_level_block, off_t *hash_level_size)
+{
+       size_t hash_per_block_bits;
+       off_t s, s_shift;
+       int i;
+
+       if (!digest_size)
+               return -EINVAL;
+
+       hash_per_block_bits = get_bits_down(hash_block_size / digest_size);
+       if (!hash_per_block_bits)
+               return -EINVAL;
+
+       *levels = 0;
+       while (hash_per_block_bits * *levels < 64 &&
+              (data_file_blocks - 1) >> (hash_per_block_bits * *levels))
+               (*levels)++;
+
+       if (*levels > VERITY_MAX_LEVELS)
+               return -EINVAL;
+
+       for (i = *levels - 1; i >= 0; i--) {
+               if (hash_level_block)
+                       hash_level_block[i] = *hash_position;
+               // verity position of block data_file_blocks at level i
+               s_shift = (i + 1) * hash_per_block_bits;
+               if (s_shift > 63)
+                       return -EINVAL;
+               s = (data_file_blocks + ((off_t)1 << s_shift) - 1) >> ((i + 1) * hash_per_block_bits);
+               if (hash_level_size)
+                       hash_level_size[i] = s;
+               if ((*hash_position + s) < *hash_position ||
+                   (*hash_position + s) < 0)
+                       return -EINVAL;
+               *hash_position += s;
+       }
+
+       return 0;
+}
+
 static int create_or_verify(struct crypt_device *cd, FILE *rd, FILE *wr,
                                   off_t data_block, size_t data_block_size,
                                   off_t hash_block, size_t hash_block_size,
@@ -118,17 +160,17 @@ static int create_or_verify(struct crypt_device *cd, FILE *rd, FILE *wr,
 
        if (mult_overflow(&seek_rd, data_block, data_block_size) ||
            mult_overflow(&seek_wr, hash_block, hash_block_size)) {
-               log_err(cd, _("Device offset overflow.\n"));
+               log_err(cd, _("Device offset overflow."));
                return -EINVAL;
        }
 
        if (fseeko(rd, seek_rd, SEEK_SET)) {
-               log_dbg("Cannot seek to requested position in data device.");
+               log_dbg(cd, "Cannot seek to requested position in data device.");
                return -EIO;
        }
 
        if (wr && fseeko(wr, seek_wr, SEEK_SET)) {
-               log_dbg("Cannot seek to requested position in hash device.");
+               log_dbg(cd, "Cannot seek to requested position in hash device.");
                return -EIO;
        }
 
@@ -140,7 +182,7 @@ static int create_or_verify(struct crypt_device *cd, FILE *rd, FILE *wr,
                                break;
                        blocks--;
                        if (fread(data_buffer, data_block_size, 1, rd) != 1) {
-                               log_dbg("Cannot read data device block.");
+                               log_dbg(cd, "Cannot read data device block.");
                                return -EIO;
                        }
 
@@ -154,17 +196,17 @@ static int create_or_verify(struct crypt_device *cd, FILE *rd, FILE *wr,
                                break;
                        if (verify) {
                                if (fread(read_digest, digest_size, 1, wr) != 1) {
-                                       log_dbg("Cannot read digest form hash device.");
+                                       log_dbg(cd, "Cannot read digest form hash device.");
                                        return -EIO;
                                }
                                if (memcmp(read_digest, calculated_digest, digest_size)) {
-                                       log_err(cd, _("Verification failed at position %" PRIu64 ".\n"),
+                                       log_err(cd, _("Verification failed at position %" PRIu64 "."),
                                                ftello(rd) - data_block_size);
                                        return -EPERM;
                                }
                        } else {
                                if (fwrite(calculated_digest, digest_size, 1, wr) != 1) {
-                                       log_dbg("Cannot write digest to hash device.");
+                                       log_dbg(cd, "Cannot write digest to hash device.");
                                        return -EIO;
                                }
                        }
@@ -177,7 +219,7 @@ static int create_or_verify(struct crypt_device *cd, FILE *rd, FILE *wr,
                                                if (r)
                                                        return r;
                                        } else if (fwrite(left_block, digest_size_full - digest_size, 1, wr) != 1) {
-                                               log_dbg("Cannot write spare area to hash device.");
+                                               log_dbg(cd, "Cannot write spare area to hash device.");
                                                return -EIO;
                                        }
                                }
@@ -190,7 +232,7 @@ static int create_or_verify(struct crypt_device *cd, FILE *rd, FILE *wr,
                                if (r)
                                        return r;
                        } else if (fwrite(left_block, left_bytes, 1, wr) != 1) {
-                               log_dbg("Cannot write remaining spare area to hash device.");
+                               log_dbg(cd, "Cannot write remaining spare area to hash device.");
                                return -EIO;
                        }
                }
@@ -219,20 +261,19 @@ static int VERITY_create_or_verify_hash(struct crypt_device *cd,
        FILE *hash_file = NULL, *hash_file_2;
        off_t hash_level_block[VERITY_MAX_LEVELS];
        off_t hash_level_size[VERITY_MAX_LEVELS];
-       off_t data_file_blocks, s;
-       size_t hash_per_block_bits;
+       off_t data_file_blocks;
        off_t data_device_size = 0, hash_device_size = 0;
        uint64_t dev_size;
        int levels, i, r;
 
-       log_dbg("Hash %s %s, data device %s, data blocks %" PRIu64
+       log_dbg(cd, "Hash %s %s, data device %s, data blocks %" PRIu64
                ", hash_device %s, offset %" PRIu64 ".",
                verify ? "verification" : "creation", hash_name,
                device_path(data_device), data_blocks,
                device_path(hash_device), hash_position);
 
        if (data_blocks < 0 || hash_position < 0) {
-               log_err(cd, _("Invalid size parameters for verity device.\n"));
+               log_err(cd, _("Invalid size parameters for verity device."));
                return -EINVAL;
        }
 
@@ -246,61 +287,39 @@ static int VERITY_create_or_verify_hash(struct crypt_device *cd,
                data_file_blocks = data_blocks;
 
        if (mult_overflow(&data_device_size, data_blocks, data_block_size)) {
-               log_err(cd, _("Device offset overflow.\n"));
+               log_err(cd, _("Device offset overflow."));
                return -EINVAL;
        }
 
-       hash_per_block_bits = get_bits_down(hash_block_size / digest_size);
-       if (!hash_per_block_bits)
+       if (hash_levels(hash_block_size, digest_size, data_file_blocks, &hash_position,
+               &levels, &hash_level_block[0], &hash_level_size[0])) {
+               log_err(cd, _("Hash area overflow."));
                return -EINVAL;
-
-       levels = 0;
-       if (data_file_blocks) {
-               while (hash_per_block_bits * levels < 64 &&
-                      (data_file_blocks - 1) >> (hash_per_block_bits * levels))
-                       levels++;
        }
-       log_dbg("Using %d hash levels.", levels);
 
-       if (levels > VERITY_MAX_LEVELS) {
-               log_err(cd, _("Too many tree levels for verity volume.\n"));
-               return -EINVAL;
-       }
-
-       for (i = levels - 1; i >= 0; i--) {
-               hash_level_block[i] = hash_position;
-               // verity position of block data_file_blocks at level i
-               s = (data_file_blocks + ((off_t)1 << ((i + 1) * hash_per_block_bits)) - 1) >> ((i + 1) * hash_per_block_bits);
-               hash_level_size[i] = s;
-               if ((hash_position + s) < hash_position ||
-                   (hash_position + s) < 0) {
-                       log_err(cd, _("Device offset overflow.\n"));
-                       return -EINVAL;
-               }
-               hash_position += s;
-       }
+       log_dbg(cd, "Using %d hash levels.", levels);
 
        if (mult_overflow(&hash_device_size, hash_position, hash_block_size)) {
-               log_err(cd, _("Device offset overflow.\n"));
+               log_err(cd, _("Device offset overflow."));
                return -EINVAL;
        }
 
-       log_dbg("Data device size required: %" PRIu64 " bytes.",
+       log_dbg(cd, "Data device size required: %" PRIu64 " bytes.",
                data_device_size);
        data_file = fopen(device_path(data_device), "r");
        if (!data_file) {
-               log_err(cd, _("Cannot open device %s.\n"),
+               log_err(cd, _("Cannot open device %s."),
                        device_path(data_device)
                );
                r = -EIO;
                goto out;
        }
 
-       log_dbg("Hash device size required: %" PRIu64 " bytes.",
+       log_dbg(cd, "Hash device size required: %" PRIu64 " bytes.",
                hash_device_size);
        hash_file = fopen(device_path(hash_device), verify ? "r" : "r+");
        if (!hash_file) {
-               log_err(cd, _("Cannot open device %s.\n"),
+               log_err(cd, _("Cannot open device %s."),
                        device_path(hash_device));
                r = -EIO;
                goto out;
@@ -320,7 +339,7 @@ static int VERITY_create_or_verify_hash(struct crypt_device *cd,
                } else {
                        hash_file_2 = fopen(device_path(hash_device), "r");
                        if (!hash_file_2) {
-                               log_err(cd, _("Cannot open device %s.\n"),
+                               log_err(cd, _("Cannot open device %s."),
                                        device_path(hash_device));
                                r = -EIO;
                                goto out;
@@ -351,20 +370,20 @@ static int VERITY_create_or_verify_hash(struct crypt_device *cd,
 out:
        if (verify) {
                if (r)
-                       log_err(cd, _("Verification of data area failed.\n"));
+                       log_err(cd, _("Verification of data area failed."));
                else {
-                       log_dbg("Verification of data area succeeded.");
+                       log_dbg(cd, "Verification of data area succeeded.");
                        r = memcmp(root_hash, calculated_digest, digest_size) ? -EPERM : 0;
                        if (r)
-                               log_err(cd, _("Verification of root hash failed.\n"));
+                               log_err(cd, _("Verification of root hash failed."));
                        else
-                               log_dbg("Verification of root hash succeeded.");
+                               log_dbg(cd, "Verification of root hash succeeded.");
                }
        } else {
                if (r == -EIO)
-                       log_err(cd, _("Input/output error while creating hash area.\n"));
+                       log_err(cd, _("Input/output error while creating hash area."));
                else if (r)
-                       log_err(cd, _("Creation of hash area failed.\n"));
+                       log_err(cd, _("Creation of hash area failed."));
                else {
                        fsync(fileno(hash_file));
                        memcpy(root_hash, calculated_digest, digest_size);
@@ -402,17 +421,17 @@ int VERITY_verify(struct crypt_device *cd,
 /* Create verity hash */
 int VERITY_create(struct crypt_device *cd,
                  struct crypt_params_verity *verity_hdr,
-                 char *root_hash,
+                 const char *root_hash,
                  size_t root_hash_size)
 {
-       unsigned pgsize = crypt_getpagesize();
+       unsigned pgsize = (unsigned)crypt_getpagesize();
 
        if (verity_hdr->salt_size > 256)
                return -EINVAL;
 
        if (verity_hdr->data_block_size > pgsize)
                log_err(cd, _("WARNING: Kernel cannot activate device if data "
-                             "block size exceeds page size (%u).\n"), pgsize);
+                             "block size exceeds page size (%u)."), pgsize);
 
        return VERITY_create_or_verify_hash(cd, 0,
                verity_hdr->hash_type,
@@ -423,8 +442,20 @@ int VERITY_create(struct crypt_device *cd,
                verity_hdr->data_block_size,
                verity_hdr->data_size,
                VERITY_hash_offset_block(verity_hdr),
-               root_hash,
+               CONST_CAST(char*)root_hash,
                root_hash_size,
                verity_hdr->salt,
                verity_hdr->salt_size);
 }
+
+uint64_t VERITY_hash_blocks(struct crypt_device *cd, struct crypt_params_verity *params)
+{
+       off_t hash_position = 0;
+       int levels = 0;
+
+       if (hash_levels(params->hash_block_size, crypt_get_volume_key_size(cd),
+               params->data_size, &hash_position, &levels, NULL, NULL))
+               return 0;
+
+       return (uint64_t)hash_position;
+}
index e7150aa..4507451 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * cryptsetup volume key implementation
  *
- * Copyright (C) 2004-2006, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2010-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2006 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include <string.h>
+#include <stdint.h>
 #include <stdlib.h>
+#include <errno.h>
 
 #include "internal.h"
 
-struct volume_key *crypt_alloc_volume_key(unsigned keylength, const char *key)
+struct volume_key *crypt_alloc_volume_key(size_t keylength, const char *key)
 {
-       struct volume_key *vk = malloc(sizeof(*vk) + keylength);
+       struct volume_key *vk;
+
+       if (keylength > (SIZE_MAX - sizeof(*vk)))
+               return NULL;
 
+       vk = malloc(sizeof(*vk) + keylength);
        if (!vk)
                return NULL;
 
+       vk->key_description = NULL;
        vk->keylength = keylength;
-       if (key)
-               memcpy(&vk->key, key, keylength);
-       else
-               crypt_memzero(&vk->key, keylength);
+       vk->id = -1;
+       vk->next = NULL;
+
+       /* keylength 0 is valid => no key */
+       if (vk->keylength) {
+               if (key)
+                       memcpy(&vk->key, key, keylength);
+               else
+                       crypt_safe_memzero(&vk->key, keylength);
+       }
+
+       return vk;
+}
+
+int crypt_volume_key_set_description(struct volume_key *vk, const char *key_description)
+{
+       if (!vk)
+               return -EINVAL;
+
+       free(CONST_CAST(void*)vk->key_description);
+       vk->key_description = NULL;
+       if (key_description && !(vk->key_description = strdup(key_description)))
+               return -ENOMEM;
+
+       return 0;
+}
+
+void crypt_volume_key_set_id(struct volume_key *vk, int id)
+{
+       if (vk && id >= 0)
+               vk->id = id;
+}
+
+int crypt_volume_key_get_id(const struct volume_key *vk)
+{
+       return vk ? vk->id : -1;
+}
+
+struct volume_key *crypt_volume_key_by_id(struct volume_key *vks, int id)
+{
+       struct volume_key *vk = vks;
+
+       if (id < 0)
+               return NULL;
+
+       while (vk && vk->id != id)
+               vk = vk->next;
 
        return vk;
 }
 
+void crypt_volume_key_add_next(struct volume_key **vks, struct volume_key *vk)
+{
+       struct volume_key *tmp;
+
+       if (!vks)
+               return;
+
+       if (!*vks) {
+               *vks = vk;
+               return;
+       }
+
+       tmp = *vks;
+
+       while (tmp->next)
+               tmp = tmp->next;
+
+       tmp->next = vk;
+}
+
+struct volume_key *crypt_volume_key_next(struct volume_key *vk)
+{
+       return vk ? vk->next : NULL;
+}
+
 void crypt_free_volume_key(struct volume_key *vk)
 {
-       if (vk) {
-               crypt_memzero(vk->key, vk->keylength);
+       struct volume_key *vk_next;
+
+       while (vk) {
+               crypt_safe_memzero(vk->key, vk->keylength);
                vk->keylength = 0;
+               free(CONST_CAST(void*)vk->key_description);
+               vk_next = vk->next;
                free(vk);
+               vk = vk_next;
        }
 }
 
-struct volume_key *crypt_generate_volume_key(struct crypt_device *cd, unsigned keylength)
+struct volume_key *crypt_generate_volume_key(struct crypt_device *cd, size_t keylength)
 {
        int r;
        struct volume_key *vk;
index bffda54..0cb7f90 100644 (file)
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,9 +1,12 @@
+#! /bin/sh
+## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
+##               by inline-source v2014-01-03.01
 
-# libtool (GNU libtool) 2.4.2
+# libtool (GNU libtool) 2.4.6
+# Provide generalized library-building support services.
 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1996-2015 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Usage: $progname [OPTION]... [MODE-ARG]...
-#
-# Provide generalized library-building support services.
-#
-#       --config             show all configuration variables
-#       --debug              enable verbose shell tracing
-#   -n, --dry-run            display commands without modifying any files
-#       --features           display basic configuration information and exit
-#       --mode=MODE          use operation mode MODE
-#       --preserve-dup-deps  don't remove duplicate dependency libraries
-#       --quiet, --silent    don't print informational messages
-#       --no-quiet, --no-silent
-#                            print informational messages (default)
-#       --no-warn            don't display warning messages
-#       --tag=TAG            use configuration variables from tag TAG
-#   -v, --verbose            print more informational messages than default
-#       --no-verbose         don't print the extra informational messages
-#       --version            print version information
-#   -h, --help, --help-all   print short, long, or detailed help message
-#
-# MODE must be one of the following:
-#
-#         clean              remove files from the build directory
-#         compile            compile a source file into a libtool object
-#         execute            automatically set library path, then run a program
-#         finish             complete the installation of libtool libraries
-#         install            install libraries or executables
-#         link               create a library or an executable
-#         uninstall          remove libraries from an installed directory
-#
-# MODE-ARGS vary depending on the MODE.  When passed as first option,
-# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
-# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
-#
-# When reporting a bug, please describe a test case to reproduce it and
-# include the following information:
-#
-#         host-triplet:        $host
-#         shell:               $SHELL
-#         compiler:            $LTCC
-#         compiler flags:              $LTCFLAGS
-#         linker:              $LD (gnu? $with_gnu_ld)
-#         $progname:   (GNU libtool) 2.4.2 Debian-2.4.2-1.11
-#         automake:    $automake_version
-#         autoconf:    $autoconf_version
-#
-# Report bugs to <bug-libtool@gnu.org>.
-# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
-# General help using GNU software: <http://www.gnu.org/gethelp/>.
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.4.2 Debian-2.4.2-1.11"
-TIMESTAMP=""
-package_revision=1.3337
+VERSION="2.4.6 Debian-2.4.6-14"
+package_revision=2.4.6
 
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# Run './libtool --help' for help with using this script from the
+# command line.
+
+
+## ------------------------------- ##
+## User overridable command paths. ##
+## ------------------------------- ##
+
+# After configure completes, it has a better idea of some of the
+# shell tools we need than the defaults used by the functions shared
+# with bootstrap, so set those here where they can still be over-
+# ridden by the user, but otherwise take precedence.
+
+: ${AUTOCONF="autoconf"}
+: ${AUTOMAKE="automake"}
+
+
+## -------------------------- ##
+## Source external libraries. ##
+## -------------------------- ##
+
+# Much of our low-level functionality needs to be sourced from external
+# libraries, which are installed to $pkgauxdir.
+
+# Set a version string for this script.
+scriptversion=2015-01-20.17; # UTC
+
+# General shell script boiler plate, and helper functions.
+# Written by Gary V. Vaughan, 2004
+
+# Copyright (C) 2004-2015 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# As a special exception to the GNU General Public License, if you distribute
+# this file as part of a program or library that is built using GNU Libtool,
+# you may include this file under the same distribution terms that you use
+# for the rest of that program.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Please report bugs or propose patches to gary@gnu.org.
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# Evaluate this file near the top of your script to gain access to
+# the functions and variables defined here:
+#
+#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
+#
+# If you need to override any of the default environment variable
+# settings, do that before evaluating this file.
+
+
+## -------------------- ##
+## Shell normalisation. ##
+## -------------------- ##
+
+# Some shells need a little help to be as Bourne compatible as possible.
+# Before doing anything else, make sure all that help has been provided!
+
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
 fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
 
-# NLS nuisances: We save the old values to restore during execute mode.
-lt_user_locale=
-lt_safe_locale=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+# NLS nuisances: We save the old values in case they are required later.
+_G_user_locale=
+_G_safe_locale=
+for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 do
-  eval "if test \"\${$lt_var+set}\" = set; then
-          save_$lt_var=\$$lt_var
-          $lt_var=C
-         export $lt_var
-         lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
-         lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+  eval "if test set = \"\${$_G_var+set}\"; then
+          save_$_G_var=\$$_G_var
+          $_G_var=C
+         export $_G_var
+         _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
+         _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
        fi"
 done
-LC_ALL=C
-LANGUAGE=C
-export LANGUAGE LC_ALL
 
-$lt_unset CDPATH
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Make sure IFS has a sensible default
+sp=' '
+nl='
+'
+IFS="$sp       $nl"
+
+# There are apparently some retarded systems that use ';' as a PATH separator!
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
 
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
 
 
+## ------------------------- ##
+## Locate command utilities. ##
+## ------------------------- ##
+
+
+# func_executable_p FILE
+# ----------------------
+# Check that FILE is an executable regular file.
+func_executable_p ()
+{
+    test -f "$1" && test -x "$1"
+}
+
+
+# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
+# --------------------------------------------
+# Search for either a program that responds to --version with output
+# containing "GNU", or else returned by CHECK_FUNC otherwise, by
+# trying all the directories in PATH with each of the elements of
+# PROGS_LIST.
+#
+# CHECK_FUNC should accept the path to a candidate program, and
+# set $func_check_prog_result if it truncates its output less than
+# $_G_path_prog_max characters.
+func_path_progs ()
+{
+    _G_progs_list=$1
+    _G_check_func=$2
+    _G_PATH=${3-"$PATH"}
+
+    _G_path_prog_max=0
+    _G_path_prog_found=false
+    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
+    for _G_dir in $_G_PATH; do
+      IFS=$_G_save_IFS
+      test -z "$_G_dir" && _G_dir=.
+      for _G_prog_name in $_G_progs_list; do
+        for _exeext in '' .EXE; do
+          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
+          func_executable_p "$_G_path_prog" || continue
+          case `"$_G_path_prog" --version 2>&1` in
+            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
+            *)     $_G_check_func $_G_path_prog
+                  func_path_progs_result=$func_check_prog_result
+                  ;;
+          esac
+          $_G_path_prog_found && break 3
+        done
+      done
+    done
+    IFS=$_G_save_IFS
+    test -z "$func_path_progs_result" && {
+      echo "no acceptable sed could be found in \$PATH" >&2
+      exit 1
+    }
+}
+
+
+# We want to be able to use the functions in this file before configure
+# has figured out where the best binaries are kept, which means we have
+# to search for them ourselves - except when the results are already set
+# where we skip the searches.
+
+# Unless the user overrides by setting SED, search the path for either GNU
+# sed, or the sed that truncates its output the least.
+test -z "$SED" && {
+  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+  for _G_i in 1 2 3 4 5 6 7; do
+    _G_sed_script=$_G_sed_script$nl$_G_sed_script
+  done
+  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
+  _G_sed_script=
+
+  func_check_prog_sed ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo '' >> conftest.nl
+      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
+  rm -f conftest.sed
+  SED=$func_path_progs_result
+}
+
+
+# Unless the user overrides by setting GREP, search the path for either GNU
+# grep, or the grep that truncates its output the least.
+test -z "$GREP" && {
+  func_check_prog_grep ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    _G_path_prog_max=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo 'GREP' >> conftest.nl
+      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
+  GREP=$func_path_progs_result
+}
+
+
+## ------------------------------- ##
+## User overridable command paths. ##
+## ------------------------------- ##
+
+# All uppercase variable names are used for environment variables.  These
+# variables can be overridden by the user before calling a script that
+# uses them if a suitable command of that name is not already available
+# in the command search PATH.
 
 : ${CP="cp -f"}
-test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${ECHO="printf %s\n"}
+: ${EGREP="$GREP -E"}
+: ${FGREP="$GREP -F"}
+: ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
-: ${Xsed="$SED -e 1s/^X//"}
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
-EXIT_SKIP=77     # $? = 77 is used to indicate a skipped test to automake.
-
-exit_status=$EXIT_SUCCESS
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS="  $lt_nl"
 
-dirname="s,/[^/]*$,,"
-basename="s,^.*/,,"
 
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-} # func_dirname may be replaced by extended shell implementation
+## -------------------- ##
+## Useful sed snippets. ##
+## -------------------- ##
 
+sed_dirname='s|/[^/]*$||'
+sed_basename='s|^.*/||'
 
-# func_basename file
-func_basename ()
-{
-    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
-} # func_basename may be replaced by extended shell implementation
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
 
+# Same as above, but do not quote variable references.
+sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-    # Extract subdirectory from the argument.
-    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
-} # func_dirname_and_basename may be replaced by extended shell implementation
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
 
+# Sed substitution that converts a w32 file name or path
+# that contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-'\' parameter expansions in output of sed_double_quote_subst that
+# were '\'-ed in input to the same.  If an odd number of '\' preceded a
+# '$' in input to sed_double_quote_subst, that '$' was protected from
+# expansion.  Since each input '\' is now two '\'s, look for any number
+# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
+_G_bs='\\'
+_G_bs2='\\\\'
+_G_bs4='\\\\\\\\'
+_G_dollar='\$'
+sed_double_backslash="\
+  s/$_G_bs4/&\\
+/g
+  s/^$_G_bs2$_G_dollar/$_G_bs&/
+  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
+  s/\n//g"
 
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-    case ${2} in
-      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-    esac
-} # func_stripname may be replaced by extended shell implementation
 
+## ----------------- ##
+## Global variables. ##
+## ----------------- ##
 
-# These SED scripts presuppose an absolute path with a trailing slash.
-pathcar='s,^/\([^/]*\).*$,\1,'
-pathcdr='s,^/[^/]*,,'
-removedotparts=':dotsl
-               s@/\./@/@g
-               t dotsl
-               s,/\.$,/,'
-collapseslashes='s@/\{1,\}@/@g'
-finalslash='s,/*$,/,'
+# Except for the global variables explicitly listed below, the following
+# functions in the '^func_' namespace, and the '^require_' namespace
+# variables initialised in the 'Resource management' section, sourcing
+# this file will not pollute your global namespace with anything
+# else. There's no portable way to scope variables in Bourne shell
+# though, so actually running these functions will sometimes place
+# results into a variable named after the function, and often use
+# temporary variables in the '^_G_' namespace. If you are careful to
+# avoid using those namespaces casually in your sourcing script, things
+# should continue to work as you expect. And, of course, you can freely
+# overwrite any of the functions or variables defined here before
+# calling anything to customize them.
 
-# func_normal_abspath PATH
-# Remove doubled-up and trailing slashes, "." path components,
-# and cancel out any ".." path components in PATH after making
-# it an absolute path.
-#             value returned in "$func_normal_abspath_result"
-func_normal_abspath ()
-{
-  # Start from root dir and reassemble the path.
-  func_normal_abspath_result=
-  func_normal_abspath_tpath=$1
-  func_normal_abspath_altnamespace=
-  case $func_normal_abspath_tpath in
-    "")
-      # Empty path, that just means $cwd.
-      func_stripname '' '/' "`pwd`"
-      func_normal_abspath_result=$func_stripname_result
-      return
-    ;;
-    # The next three entries are used to spot a run of precisely
-    # two leading slashes without using negated character classes;
-    # we take advantage of case's first-match behaviour.
-    ///*)
-      # Unusual form of absolute path, do nothing.
-    ;;
-    //*)
-      # Not necessarily an ordinary path; POSIX reserves leading '//'
-      # and for example Cygwin uses it to access remote file shares
-      # over CIFS/SMB, so we conserve a leading double slash if found.
-      func_normal_abspath_altnamespace=/
-    ;;
-    /*)
-      # Absolute path, do nothing.
-    ;;
-    *)
-      # Relative path, prepend $cwd.
-      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
-    ;;
-  esac
-  # Cancel out all the simple stuff to save iterations.  We also want
-  # the path to end with a slash for ease of parsing, so make sure
-  # there is one (and only one) here.
-  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
-  while :; do
-    # Processed it all yet?
-    if test "$func_normal_abspath_tpath" = / ; then
-      # If we ascended to the root using ".." the result may be empty now.
-      if test -z "$func_normal_abspath_result" ; then
-        func_normal_abspath_result=/
-      fi
-      break
-    fi
-    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcar"`
-    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcdr"`
-    # Figure out what to do with it
-    case $func_normal_abspath_tcomponent in
-      "")
-        # Trailing empty path component, ignore it.
-      ;;
-      ..)
-        # Parent dir; strip last assembled component from result.
-        func_dirname "$func_normal_abspath_result"
-        func_normal_abspath_result=$func_dirname_result
-      ;;
-      *)
-        # Actual path component, append it.
-        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
-      ;;
-    esac
-  done
-  # Restore leading double-slash if one was found on entry.
-  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
-}
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77     # $? = 77 is used to indicate a skipped test to automake.
 
-# func_relative_path SRCDIR DSTDIR
-# generates a relative path from SRCDIR to DSTDIR, with a trailing
-# slash if non-empty, suitable for immediately appending a filename
-# without needing to append a separator.
-#             value returned in "$func_relative_path_result"
-func_relative_path ()
-{
-  func_relative_path_result=
-  func_normal_abspath "$1"
-  func_relative_path_tlibdir=$func_normal_abspath_result
-  func_normal_abspath "$2"
-  func_relative_path_tbindir=$func_normal_abspath_result
-
-  # Ascend the tree starting from libdir
-  while :; do
-    # check if we have found a prefix of bindir
-    case $func_relative_path_tbindir in
-      $func_relative_path_tlibdir)
-        # found an exact match
-        func_relative_path_tcancelled=
-        break
-        ;;
-      $func_relative_path_tlibdir*)
-        # found a matching prefix
-        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
-        func_relative_path_tcancelled=$func_stripname_result
-        if test -z "$func_relative_path_result"; then
-          func_relative_path_result=.
-        fi
-        break
-        ;;
-      *)
-        func_dirname $func_relative_path_tlibdir
-        func_relative_path_tlibdir=${func_dirname_result}
-        if test "x$func_relative_path_tlibdir" = x ; then
-          # Have to descend all the way to the root!
-          func_relative_path_result=../$func_relative_path_result
-          func_relative_path_tcancelled=$func_relative_path_tbindir
-          break
-        fi
-        func_relative_path_result=../$func_relative_path_result
-        ;;
-    esac
-  done
+# Allow overriding, eg assuming that you follow the convention of
+# putting '$debug_cmd' at the start of all your functions, you can get
+# bash to show function call trace with:
+#
+#    debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
+debug_cmd=${debug_cmd-":"}
+exit_cmd=:
 
-  # Now calculate path; take care to avoid doubling-up slashes.
-  func_stripname '' '/' "$func_relative_path_result"
-  func_relative_path_result=$func_stripname_result
-  func_stripname '/' '/' "$func_relative_path_tcancelled"
-  if test "x$func_stripname_result" != x ; then
-    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
-  fi
+# By convention, finish your script with:
+#
+#    exit $exit_status
+#
+# so that you can set exit_status to non-zero if you want to indicate
+# something went wrong during execution without actually bailing out at
+# the point of failure.
+exit_status=$EXIT_SUCCESS
 
-  # Normalisation. If bindir is libdir, return empty string,
-  # else relative path ending with a slash; either way, target
-  # file name can be directly appended.
-  if test ! -z "$func_relative_path_result"; then
-    func_stripname './' '' "$func_relative_path_result/"
-    func_relative_path_result=$func_stripname_result
-  fi
-}
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath=$0
 
-# The name of this program:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
+# The name of this program.
+progname=`$ECHO "$progpath" |$SED "$sed_basename"`
 
-# Make sure we have an absolute path for reexecution:
+# Make sure we have an absolute progpath for reexecution:
 case $progpath in
   [\\/]*|[A-Za-z]:\\*) ;;
   *[\\/]*)
-     progdir=$func_dirname_result
+     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
      progdir=`cd "$progdir" && pwd`
-     progpath="$progdir/$progname"
+     progpath=$progdir/$progname
      ;;
   *)
-     save_IFS="$IFS"
+     _G_IFS=$IFS
      IFS=${PATH_SEPARATOR-:}
      for progdir in $PATH; do
-       IFS="$save_IFS"
+       IFS=$_G_IFS
        test -x "$progdir/$progname" && break
      done
-     IFS="$save_IFS"
+     IFS=$_G_IFS
      test -n "$progdir" || progdir=`pwd`
-     progpath="$progdir/$progname"
+     progpath=$progdir/$progname
      ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
-# Sed substitution that turns a string into a regex matching for the
-# string literally.
-sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+## ----------------- ##
+## Standard options. ##
+## ----------------- ##
 
-# Sed substitution that converts a w32 file name or path
-# which contains forward slashes, into one that contains
-# (escaped) backslashes.  A very naive implementation.
-lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-
-# Re-`\' parameter expansions in output of double_quote_subst that were
-# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
-# in input to double_quote_subst, that '$' was protected from expansion.
-# Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
-bs='\\'
-bs2='\\\\'
-bs4='\\\\\\\\'
-dollar='\$'
-sed_double_backslash="\
-  s/$bs4/&\\
-/g
-  s/^$bs2$dollar/$bs&/
-  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
-  s/\n//g"
+# The following options affect the operation of the functions defined
+# below, and should be set appropriately depending on run-time para-
+# meters passed on the command line.
 
-# Standard options:
 opt_dry_run=false
-opt_help=false
 opt_quiet=false
 opt_verbose=false
-opt_warning=:
 
-# func_echo arg...
-# Echo program name prefixed message, along with the current mode
-# name if it has been set yet.
-func_echo ()
-{
-    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
-}
+# Categories 'all' and 'none' are always available.  Append any others
+# you will pass as the first argument to func_warning from your own
+# code.
+warning_categories=
 
-# func_verbose arg...
-# Echo program name prefixed message in verbose mode only.
-func_verbose ()
-{
-    $opt_verbose && func_echo ${1+"$@"}
+# By default, display warnings according to 'opt_warning_types'.  Set
+# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
+# treat the next displayed warning as a fatal error.
+warning_func=func_warn_and_continue
 
-    # A bug in bash halts the script if the last line of a function
-    # fails when set -e is in force, so we need another command to
-    # work around that:
-    :
-}
+# Set to 'all' to display all warnings, 'none' to suppress all
+# warnings, or a space delimited list of some subset of
+# 'warning_categories' to display only the listed warnings.
+opt_warning_types=all
 
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*"
-}
 
-# func_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
-    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
-}
+## -------------------- ##
+## Resource management. ##
+## -------------------- ##
 
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
-    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+# This section contains definitions for functions that each ensure a
+# particular resource (a file, or a non-empty configuration variable for
+# example) is available, and if appropriate to extract default values
+# from pertinent package files. Call them using their associated
+# 'require_*' variable to ensure that they are executed, at most, once.
+#
+# It's entirely deliberate that calling these functions can set
+# variables that don't obey the namespace limitations obeyed by the rest
+# of this file, in order that that they be as useful as possible to
+# callers.
 
-    # bash bug again:
-    :
-}
 
-# func_fatal_error arg...
-# Echo program name prefixed message to standard error, and exit.
-func_fatal_error ()
+# require_term_colors
+# -------------------
+# Allow display of bold text on terminals that support it.
+require_term_colors=func_require_term_colors
+func_require_term_colors ()
 {
-    func_error ${1+"$@"}
-    exit $EXIT_FAILURE
-}
+    $debug_cmd
+
+    test -t 1 && {
+      # COLORTERM and USE_ANSI_COLORS environment variables take
+      # precedence, because most terminfo databases neglect to describe
+      # whether color sequences are supported.
+      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
+
+      if test 1 = "$USE_ANSI_COLORS"; then
+        # Standard ANSI escape sequences
+        tc_reset='\e[0m'
+        tc_bold='\e[1m';   tc_standout='\e[7m'
+        tc_red='\e[31m';   tc_green='\e[32m'
+        tc_blue='\e[34m';  tc_cyan='\e[36m'
+      else
+        # Otherwise trust the terminfo database after all.
+        test -n "`tput sgr0 2>/dev/null`" && {
+          tc_reset=`tput sgr0`
+          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
+          tc_standout=$tc_bold
+          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
+          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
+          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
+          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
+          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
+        }
+      fi
+    }
 
-# func_fatal_help arg...
-# Echo program name prefixed message to standard error, followed by
-# a help hint, and exit.
-func_fatal_help ()
-{
-    func_error ${1+"$@"}
-    func_fatal_error "$help"
+    require_term_colors=:
 }
-help="Try \`$progname --help' for more information."  ## default
 
 
-# func_grep expression filename
+## ----------------- ##
+## Function library. ##
+## ----------------- ##
+
+# This section contains a variety of useful functions to call in your
+# scripts. Take note of the portable wrappers for features provided by
+# some modern shells, which will fall back to slower equivalents on
+# less featureful shells.
+
+
+# func_append VAR VALUE
+# ---------------------
+# Append VALUE onto the existing contents of VAR.
+
+  # We should try to minimise forks, especially on Windows where they are
+  # unreasonably slow, so skip the feature probes when bash or zsh are
+  # being used:
+  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
+    : ${_G_HAVE_ARITH_OP="yes"}
+    : ${_G_HAVE_XSI_OPS="yes"}
+    # The += operator was introduced in bash 3.1
+    case $BASH_VERSION in
+      [12].* | 3.0 | 3.0*) ;;
+      *)
+        : ${_G_HAVE_PLUSEQ_OP="yes"}
+        ;;
+    esac
+  fi
+
+  # _G_HAVE_PLUSEQ_OP
+  # Can be empty, in which case the shell is probed, "yes" if += is
+  # useable or anything else if it does not work.
+  test -z "$_G_HAVE_PLUSEQ_OP" \
+    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
+    && _G_HAVE_PLUSEQ_OP=yes
+
+if test yes = "$_G_HAVE_PLUSEQ_OP"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_append ()
+  {
+    $debug_cmd
+
+    eval "$1+=\$2"
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_append ()
+  {
+    $debug_cmd
+
+    eval "$1=\$$1\$2"
+  }
+fi
+
+
+# func_append_quoted VAR VALUE
+# ----------------------------
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+if test yes = "$_G_HAVE_PLUSEQ_OP"; then
+  eval 'func_append_quoted ()
+  {
+    $debug_cmd
+
+    func_quote_for_eval "$2"
+    eval "$1+=\\ \$func_quote_for_eval_result"
+  }'
+else
+  func_append_quoted ()
+  {
+    $debug_cmd
+
+    func_quote_for_eval "$2"
+    eval "$1=\$$1\\ \$func_quote_for_eval_result"
+  }
+fi
+
+
+# func_append_uniq VAR VALUE
+# --------------------------
+# Append unique VALUE onto the existing contents of VAR, assuming
+# entries are delimited by the first character of VALUE.  For example:
+#
+#   func_append_uniq options " --another-option option-argument"
+#
+# will only append to $options if " --another-option option-argument "
+# is not already present somewhere in $options already (note spaces at
+# each end implied by leading space in second argument).
+func_append_uniq ()
+{
+    $debug_cmd
+
+    eval _G_current_value='`$ECHO $'$1'`'
+    _G_delim=`expr "$2" : '\(.\)'`
+
+    case $_G_delim$_G_current_value$_G_delim in
+      *"$2$_G_delim"*) ;;
+      *) func_append "$@" ;;
+    esac
+}
+
+
+# func_arith TERM...
+# ------------------
+# Set func_arith_result to the result of evaluating TERMs.
+  test -z "$_G_HAVE_ARITH_OP" \
+    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
+    && _G_HAVE_ARITH_OP=yes
+
+if test yes = "$_G_HAVE_ARITH_OP"; then
+  eval 'func_arith ()
+  {
+    $debug_cmd
+
+    func_arith_result=$(( $* ))
+  }'
+else
+  func_arith ()
+  {
+    $debug_cmd
+
+    func_arith_result=`expr "$@"`
+  }
+fi
+
+
+# func_basename FILE
+# ------------------
+# Set func_basename_result to FILE with everything up to and including
+# the last / stripped.
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  # If this shell supports suffix pattern removal, then use it to avoid
+  # forking. Hide the definitions single quotes in case the shell chokes
+  # on unsupported syntax...
+  _b='func_basename_result=${1##*/}'
+  _d='case $1 in
+        */*) func_dirname_result=${1%/*}$2 ;;
+        *  ) func_dirname_result=$3        ;;
+      esac'
+
+else
+  # ...otherwise fall back to using sed.
+  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
+  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
+      if test "X$func_dirname_result" = "X$1"; then
+        func_dirname_result=$3
+      else
+        func_append func_dirname_result "$2"
+      fi'
+fi
+
+eval 'func_basename ()
+{
+    $debug_cmd
+
+    '"$_b"'
+}'
+
+
+# func_dirname FILE APPEND NONDIR_REPLACEMENT
+# -------------------------------------------
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+eval 'func_dirname ()
+{
+    $debug_cmd
+
+    '"$_d"'
+}'
+
+
+# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
+# --------------------------------------------------------
+# Perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# For efficiency, we do not delegate to the functions above but instead
+# duplicate the functionality here.
+eval 'func_dirname_and_basename ()
+{
+    $debug_cmd
+
+    '"$_b"'
+    '"$_d"'
+}'
+
+
+# func_echo ARG...
+# ----------------
+# Echo program name prefixed message.
+func_echo ()
+{
+    $debug_cmd
+
+    _G_message=$*
+
+    func_echo_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_IFS
+      $ECHO "$progname: $_G_line"
+    done
+    IFS=$func_echo_IFS
+}
+
+
+# func_echo_all ARG...
+# --------------------
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+
+# func_echo_infix_1 INFIX ARG...
+# ------------------------------
+# Echo program name, followed by INFIX on the first line, with any
+# additional lines not showing INFIX.
+func_echo_infix_1 ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    _G_infix=$1; shift
+    _G_indent=$_G_infix
+    _G_prefix="$progname: $_G_infix: "
+    _G_message=$*
+
+    # Strip color escape sequences before counting printable length
+    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
+    do
+      test -n "$_G_tc" && {
+        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
+        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
+      }
+    done
+    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
+
+    func_echo_infix_1_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_infix_1_IFS
+      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
+      _G_prefix=$_G_indent
+    done
+    IFS=$func_echo_infix_1_IFS
+}
+
+
+# func_error ARG...
+# -----------------
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
+}
+
+
+# func_fatal_error ARG...
+# -----------------------
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    $debug_cmd
+
+    func_error "$*"
+    exit $EXIT_FAILURE
+}
+
+
+# func_grep EXPRESSION FILENAME
+# -----------------------------
 # Check whether EXPRESSION matches any line of FILENAME, without output.
 func_grep ()
 {
+    $debug_cmd
+
     $GREP "$1" "$2" >/dev/null 2>&1
 }
 
 
-# func_mkdir_p directory-path
+# func_len STRING
+# ---------------
+# Set func_len_result to the length of STRING. STRING may not
+# start with a hyphen.
+  test -z "$_G_HAVE_XSI_OPS" \
+    && (eval 'x=a/b/c;
+      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
+    && _G_HAVE_XSI_OPS=yes
+
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_len ()
+  {
+    $debug_cmd
+
+    func_len_result=${#1}
+  }'
+else
+  func_len ()
+  {
+    $debug_cmd
+
+    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+  }
+fi
+
+
+# func_mkdir_p DIRECTORY-PATH
+# ---------------------------
 # Make sure the entire path to DIRECTORY-PATH is available.
 func_mkdir_p ()
 {
-    my_directory_path="$1"
-    my_dir_list=
+    $debug_cmd
+
+    _G_directory_path=$1
+    _G_dir_list=
 
-    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
 
-      # Protect directory names starting with `-'
-      case $my_directory_path in
-        -*) my_directory_path="./$my_directory_path" ;;
+      # Protect directory names starting with '-'
+      case $_G_directory_path in
+        -*) _G_directory_path=./$_G_directory_path ;;
       esac
 
       # While some portion of DIR does not yet exist...
-      while test ! -d "$my_directory_path"; do
+      while test ! -d "$_G_directory_path"; do
         # ...make a list in topmost first order.  Use a colon delimited
        # list incase some portion of path contains whitespace.
-        my_dir_list="$my_directory_path:$my_dir_list"
+        _G_dir_list=$_G_directory_path:$_G_dir_list
 
         # If the last portion added has no slash in it, the list is done
-        case $my_directory_path in */*) ;; *) break ;; esac
+        case $_G_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
       done
-      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
 
-      save_mkdir_p_IFS="$IFS"; IFS=':'
-      for my_dir in $my_dir_list; do
-       IFS="$save_mkdir_p_IFS"
-        # mkdir can fail with a `File exist' error if two processes
+      func_mkdir_p_IFS=$IFS; IFS=:
+      for _G_dir in $_G_dir_list; do
+       IFS=$func_mkdir_p_IFS
+        # mkdir can fail with a 'File exist' error if two processes
         # try to create one of the directories concurrently.  Don't
         # stop in that case!
-        $MKDIR "$my_dir" 2>/dev/null || :
+        $MKDIR "$_G_dir" 2>/dev/null || :
       done
-      IFS="$save_mkdir_p_IFS"
+      IFS=$func_mkdir_p_IFS
 
       # Bail out if we (or some other process) failed to create a directory.
-      test -d "$my_directory_path" || \
-        func_fatal_error "Failed to create \`$1'"
+      test -d "$_G_directory_path" || \
+        func_fatal_error "Failed to create '$1'"
     fi
 }
 
 
-# func_mktempdir [string]
+# func_mktempdir [BASENAME]
+# -------------------------
 # Make a temporary directory that won't clash with other running
 # libtool processes, and avoids race conditions if possible.  If
-# given, STRING is the basename for that directory.
+# given, BASENAME is the basename for that directory.
 func_mktempdir ()
 {
-    my_template="${TMPDIR-/tmp}/${1-$progname}"
+    $debug_cmd
 
-    if test "$opt_dry_run" = ":"; then
+    _G_template=${TMPDIR-/tmp}/${1-$progname}
+
+    if test : = "$opt_dry_run"; then
       # Return a directory name, but don't create it in dry-run mode
-      my_tmpdir="${my_template}-$$"
+      _G_tmpdir=$_G_template-$$
     else
 
       # If mktemp works, use that first and foremost
-      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
 
-      if test ! -d "$my_tmpdir"; then
+      if test ! -d "$_G_tmpdir"; then
         # Failing that, at least try and use $RANDOM to avoid a race
-        my_tmpdir="${my_template}-${RANDOM-0}$$"
+        _G_tmpdir=$_G_template-${RANDOM-0}$$
 
-        save_mktempdir_umask=`umask`
+        func_mktempdir_umask=`umask`
         umask 0077
-        $MKDIR "$my_tmpdir"
-        umask $save_mktempdir_umask
+        $MKDIR "$_G_tmpdir"
+        umask $func_mktempdir_umask
       fi
 
       # If we're not in dry-run mode, bomb out on failure
-      test -d "$my_tmpdir" || \
-        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+      test -d "$_G_tmpdir" || \
+        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
     fi
 
-    $ECHO "$my_tmpdir"
+    $ECHO "$_G_tmpdir"
 }
 
 
-# func_quote_for_eval arg
-# Aesthetically quote ARG to be evaled later.
-# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
-# is double-quoted, suitable for a subsequent eval, whereas
-# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
-# which are still active within double quotes backslashified.
-func_quote_for_eval ()
+# func_normal_abspath PATH
+# ------------------------
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+func_normal_abspath ()
 {
-    case $1 in
-      *[\\\`\"\$]*)
-       func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
-      *)
-        func_quote_for_eval_unquoted_result="$1" ;;
-    esac
+    $debug_cmd
 
-    case $func_quote_for_eval_unquoted_result in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting, command substitution and and variable
-      # expansion for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
-        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+    # These SED scripts presuppose an absolute path with a trailing slash.
+    _G_pathcar='s|^/\([^/]*\).*$|\1|'
+    _G_pathcdr='s|^/[^/]*||'
+    _G_removedotparts=':dotsl
+               s|/\./|/|g
+               t dotsl
+               s|/\.$|/|'
+    _G_collapseslashes='s|/\{1,\}|/|g'
+    _G_finalslash='s|/*$|/|'
+
+    # Start from root dir and reassemble the path.
+    func_normal_abspath_result=
+    func_normal_abspath_tpath=$1
+    func_normal_abspath_altnamespace=
+    case $func_normal_abspath_tpath in
+      "")
+        # Empty path, that just means $cwd.
+        func_stripname '' '/' "`pwd`"
+        func_normal_abspath_result=$func_stripname_result
+        return
+        ;;
+      # The next three entries are used to spot a run of precisely
+      # two leading slashes without using negated character classes;
+      # we take advantage of case's first-match behaviour.
+      ///*)
+        # Unusual form of absolute path, do nothing.
+        ;;
+      //*)
+        # Not necessarily an ordinary path; POSIX reserves leading '//'
+        # and for example Cygwin uses it to access remote file shares
+        # over CIFS/SMB, so we conserve a leading double slash if found.
+        func_normal_abspath_altnamespace=/
+        ;;
+      /*)
+        # Absolute path, do nothing.
         ;;
       *)
-        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+        # Relative path, prepend $cwd.
+        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+        ;;
     esac
+
+    # Cancel out all the simple stuff to save iterations.  We also want
+    # the path to end with a slash for ease of parsing, so make sure
+    # there is one (and only one) here.
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
+    while :; do
+      # Processed it all yet?
+      if test / = "$func_normal_abspath_tpath"; then
+        # If we ascended to the root using ".." the result may be empty now.
+        if test -z "$func_normal_abspath_result"; then
+          func_normal_abspath_result=/
+        fi
+        break
+      fi
+      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_pathcar"`
+      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_pathcdr"`
+      # Figure out what to do with it
+      case $func_normal_abspath_tcomponent in
+        "")
+          # Trailing empty path component, ignore it.
+          ;;
+        ..)
+          # Parent dir; strip last assembled component from result.
+          func_dirname "$func_normal_abspath_result"
+          func_normal_abspath_result=$func_dirname_result
+          ;;
+        *)
+          # Actual path component, append it.
+          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
+          ;;
+      esac
+    done
+    # Restore leading double-slash if one was found on entry.
+    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+
+# func_notquiet ARG...
+# --------------------
+# Echo program name prefixed message only when not in quiet mode.
+func_notquiet ()
+{
+    $debug_cmd
+
+    $opt_quiet || func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+
+# func_relative_path SRCDIR DSTDIR
+# --------------------------------
+# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
+func_relative_path ()
+{
+    $debug_cmd
+
+    func_relative_path_result=
+    func_normal_abspath "$1"
+    func_relative_path_tlibdir=$func_normal_abspath_result
+    func_normal_abspath "$2"
+    func_relative_path_tbindir=$func_normal_abspath_result
+
+    # Ascend the tree starting from libdir
+    while :; do
+      # check if we have found a prefix of bindir
+      case $func_relative_path_tbindir in
+        $func_relative_path_tlibdir)
+          # found an exact match
+          func_relative_path_tcancelled=
+          break
+          ;;
+        $func_relative_path_tlibdir*)
+          # found a matching prefix
+          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+          func_relative_path_tcancelled=$func_stripname_result
+          if test -z "$func_relative_path_result"; then
+            func_relative_path_result=.
+          fi
+          break
+          ;;
+        *)
+          func_dirname $func_relative_path_tlibdir
+          func_relative_path_tlibdir=$func_dirname_result
+          if test -z "$func_relative_path_tlibdir"; then
+            # Have to descend all the way to the root!
+            func_relative_path_result=../$func_relative_path_result
+            func_relative_path_tcancelled=$func_relative_path_tbindir
+            break
+          fi
+          func_relative_path_result=../$func_relative_path_result
+          ;;
+      esac
+    done
+
+    # Now calculate path; take care to avoid doubling-up slashes.
+    func_stripname '' '/' "$func_relative_path_result"
+    func_relative_path_result=$func_stripname_result
+    func_stripname '/' '/' "$func_relative_path_tcancelled"
+    if test -n "$func_stripname_result"; then
+      func_append func_relative_path_result "/$func_stripname_result"
+    fi
+
+    # Normalisation. If bindir is libdir, return '.' else relative path.
+    if test -n "$func_relative_path_result"; then
+      func_stripname './' '' "$func_relative_path_result"
+      func_relative_path_result=$func_stripname_result
+    fi
+
+    test -n "$func_relative_path_result" || func_relative_path_result=.
+
+    :
+}
+
+
+# func_quote_for_eval ARG...
+# --------------------------
+# Aesthetically quote ARGs to be evaled later.
+# This function returns two values:
+#   i) func_quote_for_eval_result
+#      double-quoted, suitable for a subsequent eval
+#  ii) func_quote_for_eval_unquoted_result
+#      has all characters that are still active within double
+#      quotes backslashified.
+func_quote_for_eval ()
+{
+    $debug_cmd
+
+    func_quote_for_eval_unquoted_result=
+    func_quote_for_eval_result=
+    while test 0 -lt $#; do
+      case $1 in
+        *[\\\`\"\$]*)
+         _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
+        *)
+          _G_unquoted_arg=$1 ;;
+      esac
+      if test -n "$func_quote_for_eval_unquoted_result"; then
+       func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
+      else
+        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
+      fi
+
+      case $_G_unquoted_arg in
+        # Double-quote args containing shell metacharacters to delay
+        # word splitting, command substitution and variable expansion
+        # for a subsequent eval.
+        # Many Bourne shells cannot handle close brackets correctly
+        # in scan sets, so we specify it separately.
+        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \  ]*|*]*|"")
+          _G_quoted_arg=\"$_G_unquoted_arg\"
+          ;;
+        *)
+          _G_quoted_arg=$_G_unquoted_arg
+         ;;
+      esac
+
+      if test -n "$func_quote_for_eval_result"; then
+       func_append func_quote_for_eval_result " $_G_quoted_arg"
+      else
+        func_append func_quote_for_eval_result "$_G_quoted_arg"
+      fi
+      shift
+    done
 }
 
 
-# func_quote_for_expand arg
+# func_quote_for_expand ARG
+# -------------------------
 # Aesthetically quote ARG to be evaled later; same as above,
 # but do not quote variable references.
 func_quote_for_expand ()
 {
+    $debug_cmd
+
     case $1 in
       *[\\\`\"]*)
-       my_arg=`$ECHO "$1" | $SED \
-           -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+       _G_arg=`$ECHO "$1" | $SED \
+           -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
       *)
-        my_arg="$1" ;;
+        _G_arg=$1 ;;
     esac
 
-    case $my_arg in
+    case $_G_arg in
       # Double-quote args containing shell metacharacters to delay
       # word splitting and command substitution for a subsequent eval.
       # Many Bourne shells cannot handle close brackets correctly
       # in scan sets, so we specify it separately.
       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
-        my_arg="\"$my_arg\""
+        _G_arg=\"$_G_arg\"
         ;;
     esac
 
-    func_quote_for_expand_result="$my_arg"
+    func_quote_for_expand_result=$_G_arg
+}
+
+
+# func_stripname PREFIX SUFFIX NAME
+# ---------------------------------
+# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_stripname ()
+  {
+    $debug_cmd
+
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary variable first.
+    func_stripname_result=$3
+    func_stripname_result=${func_stripname_result#"$1"}
+    func_stripname_result=${func_stripname_result%"$2"}
+  }'
+else
+  func_stripname ()
+  {
+    $debug_cmd
+
+    case $2 in
+      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
+      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
+    esac
+  }
+fi
+
+
+# func_show_eval CMD [FAIL_EXP]
+# -----------------------------
+# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    $debug_cmd
+
+    _G_cmd=$1
+    _G_fail_exp=${2-':'}
+
+    func_quote_for_expand "$_G_cmd"
+    eval "func_notquiet $func_quote_for_expand_result"
+
+    $opt_dry_run || {
+      eval "$_G_cmd"
+      _G_status=$?
+      if test 0 -ne "$_G_status"; then
+       eval "(exit $_G_status); $_G_fail_exp"
+      fi
+    }
+}
+
+
+# func_show_eval_locale CMD [FAIL_EXP]
+# ------------------------------------
+# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    $debug_cmd
+
+    _G_cmd=$1
+    _G_fail_exp=${2-':'}
+
+    $opt_quiet || {
+      func_quote_for_expand "$_G_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    $opt_dry_run || {
+      eval "$_G_user_locale
+           $_G_cmd"
+      _G_status=$?
+      eval "$_G_safe_locale"
+      if test 0 -ne "$_G_status"; then
+       eval "(exit $_G_status); $_G_fail_exp"
+      fi
+    }
+}
+
+
+# func_tr_sh
+# ----------
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+    $debug_cmd
+
+    case $1 in
+    [0-9]* | *[!a-zA-Z0-9_]*)
+      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
+      ;;
+    * )
+      func_tr_sh_result=$1
+      ;;
+    esac
+}
+
+
+# func_verbose ARG...
+# -------------------
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $debug_cmd
+
+    $opt_verbose && func_echo "$*"
+
+    :
+}
+
+
+# func_warn_and_continue ARG...
+# -----------------------------
+# Echo program name prefixed warning message to standard error.
+func_warn_and_continue ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
+}
+
+
+# func_warning CATEGORY ARG...
+# ----------------------------
+# Echo program name prefixed warning message to standard error. Warning
+# messages can be filtered according to CATEGORY, where this function
+# elides messages where CATEGORY is not listed in the global variable
+# 'opt_warning_types'.
+func_warning ()
+{
+    $debug_cmd
+
+    # CATEGORY must be in the warning_categories list!
+    case " $warning_categories " in
+      *" $1 "*) ;;
+      *) func_internal_error "invalid warning category '$1'" ;;
+    esac
+
+    _G_category=$1
+    shift
+
+    case " $opt_warning_types " in
+      *" $_G_category "*) $warning_func ${1+"$@"} ;;
+    esac
+}
+
+
+# func_sort_ver VER1 VER2
+# -----------------------
+# 'sort -V' is not generally available.
+# Note this deviates from the version comparison in automake
+# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
+# but this should suffice as we won't be specifying old
+# version formats or redundant trailing .0 in bootstrap.conf.
+# If we did want full compatibility then we should probably
+# use m4_version_compare from autoconf.
+func_sort_ver ()
+{
+    $debug_cmd
+
+    printf '%s\n%s\n' "$1" "$2" \
+      | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
+}
+
+# func_lt_ver PREV CURR
+# ---------------------
+# Return true if PREV and CURR are in the correct order according to
+# func_sort_ver, otherwise false.  Use it like this:
+#
+#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
+func_lt_ver ()
+{
+    $debug_cmd
+
+    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
+}
+
+
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End:
+#! /bin/sh
+
+# Set a version string for this script.
+scriptversion=2015-10-07.11; # UTC
+
+# A portable, pluggable option parser for Bourne shell.
+# Written by Gary V. Vaughan, 2010
+
+# Copyright (C) 2010-2015 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please report bugs or propose patches to gary@gnu.org.
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# This file is a library for parsing options in your shell scripts along
+# with assorted other useful supporting features that you can make use
+# of too.
+#
+# For the simplest scripts you might need only:
+#
+#   #!/bin/sh
+#   . relative/path/to/funclib.sh
+#   . relative/path/to/options-parser
+#   scriptversion=1.0
+#   func_options ${1+"$@"}
+#   eval set dummy "$func_options_result"; shift
+#   ...rest of your script...
+#
+# In order for the '--version' option to work, you will need to have a
+# suitably formatted comment like the one at the top of this file
+# starting with '# Written by ' and ending with '# warranty; '.
+#
+# For '-h' and '--help' to work, you will also need a one line
+# description of your script's purpose in a comment directly above the
+# '# Written by ' line, like the one at the top of this file.
+#
+# The default options also support '--debug', which will turn on shell
+# execution tracing (see the comment above debug_cmd below for another
+# use), and '--verbose' and the func_verbose function to allow your script
+# to display verbose messages only when your user has specified
+# '--verbose'.
+#
+# After sourcing this file, you can plug processing for additional
+# options by amending the variables from the 'Configuration' section
+# below, and following the instructions in the 'Option parsing'
+# section further down.
+
+## -------------- ##
+## Configuration. ##
+## -------------- ##
+
+# You should override these variables in your script after sourcing this
+# file so that they reflect the customisations you have added to the
+# option parser.
+
+# The usage line for option parsing errors and the start of '-h' and
+# '--help' output messages. You can embed shell variables for delayed
+# expansion at the time the message is displayed, but you will need to
+# quote other shell meta-characters carefully to prevent them being
+# expanded when the contents are evaled.
+usage='$progpath [OPTION]...'
+
+# Short help message in response to '-h' and '--help'.  Add to this or
+# override it after sourcing this library to reflect the full set of
+# options your script accepts.
+usage_message="\
+       --debug        enable verbose shell tracing
+   -W, --warnings=CATEGORY
+                      report the warnings falling in CATEGORY [all]
+   -v, --verbose      verbosely report processing
+       --version      print version information and exit
+   -h, --help         print short or long help message and exit
+"
+
+# Additional text appended to 'usage_message' in response to '--help'.
+long_help_message="
+Warning categories include:
+       'all'          show all warnings
+       'none'         turn off all the warnings
+       'error'        warnings are treated as fatal errors"
+
+# Help message printed before fatal option parsing errors.
+fatal_help="Try '\$progname --help' for more information."
+
+
+
+## ------------------------- ##
+## Hook function management. ##
+## ------------------------- ##
+
+# This section contains functions for adding, removing, and running hooks
+# to the main code.  A hook is just a named list of of function, that can
+# be run in order later on.
+
+# func_hookable FUNC_NAME
+# -----------------------
+# Declare that FUNC_NAME will run hooks added with
+# 'func_add_hook FUNC_NAME ...'.
+func_hookable ()
+{
+    $debug_cmd
+
+    func_append hookable_fns " $1"
+}
+
+
+# func_add_hook FUNC_NAME HOOK_FUNC
+# ---------------------------------
+# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
+# first have been declared "hookable" by a call to 'func_hookable'.
+func_add_hook ()
+{
+    $debug_cmd
+
+    case " $hookable_fns " in
+      *" $1 "*) ;;
+      *) func_fatal_error "'$1' does not accept hook functions." ;;
+    esac
+
+    eval func_append ${1}_hooks '" $2"'
+}
+
+
+# func_remove_hook FUNC_NAME HOOK_FUNC
+# ------------------------------------
+# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
+func_remove_hook ()
+{
+    $debug_cmd
+
+    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
+}
+
+
+# func_run_hooks FUNC_NAME [ARG]...
+# ---------------------------------
+# Run all hook functions registered to FUNC_NAME.
+# It is assumed that the list of hook functions contains nothing more
+# than a whitespace-delimited list of legal shell function names, and
+# no effort is wasted trying to catch shell meta-characters or preserve
+# whitespace.
+func_run_hooks ()
+{
+    $debug_cmd
+
+    _G_rc_run_hooks=false
+
+    case " $hookable_fns " in
+      *" $1 "*) ;;
+      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
+    esac
+
+    eval _G_hook_fns=\$$1_hooks; shift
+
+    for _G_hook in $_G_hook_fns; do
+      if eval $_G_hook '"$@"'; then
+        # store returned options list back into positional
+        # parameters for next 'cmd' execution.
+        eval _G_hook_result=\$${_G_hook}_result
+        eval set dummy "$_G_hook_result"; shift
+        _G_rc_run_hooks=:
+      fi
+    done
+
+    $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
+}
+
+
+
+## --------------- ##
+## Option parsing. ##
+## --------------- ##
+
+# In order to add your own option parsing hooks, you must accept the
+# full positional parameter list in your hook function, you may remove/edit
+# any options that you action, and then pass back the remaining unprocessed
+# options in '<hooked_function_name>_result', escaped suitably for
+# 'eval'.  In this case you also must return $EXIT_SUCCESS to let the
+# hook's caller know that it should pay attention to
+# '<hooked_function_name>_result'.  Returning $EXIT_FAILURE signalizes that
+# arguments are left untouched by the hook and therefore caller will ignore the
+# result variable.
+#
+# Like this:
+#
+#    my_options_prep ()
+#    {
+#        $debug_cmd
+#
+#        # Extend the existing usage message.
+#        usage_message=$usage_message'
+#      -s, --silent       don'\''t print informational messages
+#    '
+#        # No change in '$@' (ignored completely by this hook).  There is
+#        # no need to do the equivalent (but slower) action:
+#        # func_quote_for_eval ${1+"$@"}
+#        # my_options_prep_result=$func_quote_for_eval_result
+#        false
+#    }
+#    func_add_hook func_options_prep my_options_prep
+#
+#
+#    my_silent_option ()
+#    {
+#        $debug_cmd
+#
+#        args_changed=false
+#
+#        # Note that for efficiency, we parse as many options as we can
+#        # recognise in a loop before passing the remainder back to the
+#        # caller on the first unrecognised argument we encounter.
+#        while test $# -gt 0; do
+#          opt=$1; shift
+#          case $opt in
+#            --silent|-s) opt_silent=:
+#                         args_changed=:
+#                         ;;
+#            # Separate non-argument short options:
+#            -s*)         func_split_short_opt "$_G_opt"
+#                         set dummy "$func_split_short_opt_name" \
+#                             "-$func_split_short_opt_arg" ${1+"$@"}
+#                         shift
+#                         args_changed=:
+#                         ;;
+#            *)           # Make sure the first unrecognised option "$_G_opt"
+#                         # is added back to "$@", we could need that later
+#                         # if $args_changed is true.
+#                         set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
+#          esac
+#        done
+#
+#        if $args_changed; then
+#          func_quote_for_eval ${1+"$@"}
+#          my_silent_option_result=$func_quote_for_eval_result
+#        fi
+#
+#        $args_changed
+#    }
+#    func_add_hook func_parse_options my_silent_option
+#
+#
+#    my_option_validation ()
+#    {
+#        $debug_cmd
+#
+#        $opt_silent && $opt_verbose && func_fatal_help "\
+#    '--silent' and '--verbose' options are mutually exclusive."
+#
+#        false
+#    }
+#    func_add_hook func_validate_options my_option_validation
+#
+# You'll also need to manually amend $usage_message to reflect the extra
+# options you parse.  It's preferable to append if you can, so that
+# multiple option parsing hooks can be added safely.
+
+
+# func_options_finish [ARG]...
+# ----------------------------
+# Finishing the option parse loop (call 'func_options' hooks ATM).
+func_options_finish ()
+{
+    $debug_cmd
+
+    _G_func_options_finish_exit=false
+    if func_run_hooks func_options ${1+"$@"}; then
+      func_options_finish_result=$func_run_hooks_result
+      _G_func_options_finish_exit=:
+    fi
+
+    $_G_func_options_finish_exit
 }
 
 
-# func_show_eval cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.
-func_show_eval ()
+# func_options [ARG]...
+# ---------------------
+# All the functions called inside func_options are hookable. See the
+# individual implementations for details.
+func_hookable func_options
+func_options ()
 {
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
+    $debug_cmd
 
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
+    _G_rc_options=false
 
-    if ${opt_dry_run-false}; then :; else
-      eval "$my_cmd"
-      my_status=$?
-      if test "$my_status" -eq 0; then :; else
-       eval "(exit $my_status); $my_fail_exp"
+    for my_func in options_prep parse_options validate_options options_finish
+    do
+      if eval func_$my_func '${1+"$@"}'; then
+        eval _G_res_var='$'"func_${my_func}_result"
+        eval set dummy "$_G_res_var" ; shift
+        _G_rc_options=:
       fi
+    done
+
+    # Save modified positional parameters for caller.  As a top-level
+    # options-parser function we always need to set the 'func_options_result'
+    # variable (regardless the $_G_rc_options value).
+    if $_G_rc_options; then
+      func_options_result=$_G_res_var
+    else
+      func_quote_for_eval ${1+"$@"}
+      func_options_result=$func_quote_for_eval_result
     fi
+
+    $_G_rc_options
 }
 
 
-# func_show_eval_locale cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.  Use the saved locale for evaluation.
-func_show_eval_locale ()
+# func_options_prep [ARG]...
+# --------------------------
+# All initialisations required before starting the option parse loop.
+# Note that when calling hook functions, we pass through the list of
+# positional parameters.  If a hook function modifies that list, and
+# needs to propagate that back to rest of this script, then the complete
+# modified list must be put in 'func_run_hooks_result' before
+# returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
+func_hookable func_options_prep
+func_options_prep ()
 {
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
+    $debug_cmd
 
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
+    # Option defaults:
+    opt_verbose=false
+    opt_warning_types=
 
-    if ${opt_dry_run-false}; then :; else
-      eval "$lt_user_locale
-           $my_cmd"
-      my_status=$?
-      eval "$lt_safe_locale"
-      if test "$my_status" -eq 0; then :; else
-       eval "(exit $my_status); $my_fail_exp"
-      fi
+    _G_rc_options_prep=false
+    if func_run_hooks func_options_prep ${1+"$@"}; then
+      _G_rc_options_prep=:
+      # save modified positional parameters for caller
+      func_options_prep_result=$func_run_hooks_result
     fi
+
+    $_G_rc_options_prep
 }
 
-# func_tr_sh
-# Turn $1 into a string suitable for a shell variable name.
-# Result is stored in $func_tr_sh_result.  All characters
-# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
-# if $1 begins with a digit, a '_' is prepended as well.
-func_tr_sh ()
+
+# func_parse_options [ARG]...
+# ---------------------------
+# The main option parsing loop.
+func_hookable func_parse_options
+func_parse_options ()
 {
-  case $1 in
-  [0-9]* | *[!a-zA-Z0-9_]*)
-    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
-    ;;
-  * )
-    func_tr_sh_result=$1
-    ;;
-  esac
+    $debug_cmd
+
+    func_parse_options_result=
+
+    _G_rc_parse_options=false
+    # this just eases exit handling
+    while test $# -gt 0; do
+      # Defer to hook functions for initial option parsing, so they
+      # get priority in the event of reusing an option name.
+      if func_run_hooks func_parse_options ${1+"$@"}; then
+        eval set dummy "$func_run_hooks_result"; shift
+        _G_rc_parse_options=:
+      fi
+
+      # Break out of the loop if we already parsed every option.
+      test $# -gt 0 || break
+
+      _G_match_parse_options=:
+      _G_opt=$1
+      shift
+      case $_G_opt in
+        --debug|-x)   debug_cmd='set -x'
+                      func_echo "enabling shell trace mode"
+                      $debug_cmd
+                      ;;
+
+        --no-warnings|--no-warning|--no-warn)
+                      set dummy --warnings none ${1+"$@"}
+                      shift
+                     ;;
+
+        --warnings|--warning|-W)
+                      if test $# = 0 && func_missing_arg $_G_opt; then
+                        _G_rc_parse_options=:
+                        break
+                      fi
+                      case " $warning_categories $1" in
+                        *" $1 "*)
+                          # trailing space prevents matching last $1 above
+                          func_append_uniq opt_warning_types " $1"
+                          ;;
+                        *all)
+                          opt_warning_types=$warning_categories
+                          ;;
+                        *none)
+                          opt_warning_types=none
+                          warning_func=:
+                          ;;
+                        *error)
+                          opt_warning_types=$warning_categories
+                          warning_func=func_fatal_error
+                          ;;
+                        *)
+                          func_fatal_error \
+                             "unsupported warning category: '$1'"
+                          ;;
+                      esac
+                      shift
+                      ;;
+
+        --verbose|-v) opt_verbose=: ;;
+        --version)    func_version ;;
+        -\?|-h)       func_usage ;;
+        --help)       func_help ;;
+
+       # Separate optargs to long options (plugins may need this):
+       --*=*)        func_split_equals "$_G_opt"
+                     set dummy "$func_split_equals_lhs" \
+                          "$func_split_equals_rhs" ${1+"$@"}
+                      shift
+                      ;;
+
+       # Separate optargs to short options:
+        -W*)
+                      func_split_short_opt "$_G_opt"
+                      set dummy "$func_split_short_opt_name" \
+                          "$func_split_short_opt_arg" ${1+"$@"}
+                      shift
+                      ;;
+
+        # Separate non-argument short options:
+        -\?*|-h*|-v*|-x*)
+                      func_split_short_opt "$_G_opt"
+                      set dummy "$func_split_short_opt_name" \
+                          "-$func_split_short_opt_arg" ${1+"$@"}
+                      shift
+                      ;;
+
+        --)           _G_rc_parse_options=: ; break ;;
+        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
+        *)            set dummy "$_G_opt" ${1+"$@"}; shift
+                      _G_match_parse_options=false
+                      break
+                      ;;
+      esac
+
+      $_G_match_parse_options && _G_rc_parse_options=:
+    done
+
+
+    if $_G_rc_parse_options; then
+      # save modified positional parameters for caller
+      func_quote_for_eval ${1+"$@"}
+      func_parse_options_result=$func_quote_for_eval_result
+    fi
+
+    $_G_rc_parse_options
 }
 
 
-# func_version
-# Echo version message to standard output and exit.
-func_version ()
+# func_validate_options [ARG]...
+# ------------------------------
+# Perform any sanity checks on option settings and/or unconsumed
+# arguments.
+func_hookable func_validate_options
+func_validate_options ()
 {
-    $opt_debug
+    $debug_cmd
 
-    $SED -n '/(C)/!b go
-       :more
-       /\./!{
-         N
-         s/\n# / /
-         b more
-       }
-       :go
-       /^# '$PROGRAM' (GNU /,/# warranty; / {
-        s/^# //
-       s/^# *$//
-        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
-        p
-     }' < "$progpath"
-     exit $?
+    _G_rc_validate_options=false
+
+    # Display all warnings if -W was not given.
+    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
+
+    if func_run_hooks func_validate_options ${1+"$@"}; then
+      # save modified positional parameters for caller
+      func_validate_options_result=$func_run_hooks_result
+      _G_rc_validate_options=:
+    fi
+
+    # Bail if the options were screwed!
+    $exit_cmd $EXIT_FAILURE
+
+    $_G_rc_validate_options
 }
 
-# func_usage
-# Echo short help message to standard output and exit.
-func_usage ()
+
+
+## ----------------- ##
+## Helper functions. ##
+## ----------------- ##
+
+# This section contains the helper functions used by the rest of the
+# hookable option parser framework in ascii-betical order.
+
+
+# func_fatal_help ARG...
+# ----------------------
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
 {
-    $opt_debug
+    $debug_cmd
 
-    $SED -n '/^# Usage:/,/^#  *.*--help/ {
-        s/^# //
-       s/^# *$//
-       s/\$progname/'$progname'/
-       p
-    }' < "$progpath"
-    echo
-    $ECHO "run \`$progname --help | more' for full usage"
-    exit $?
+    eval \$ECHO \""Usage: $usage"\"
+    eval \$ECHO \""$fatal_help"\"
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
 }
 
-# func_help [NOEXIT]
-# Echo long help message to standard output and exit,
-# unless 'noexit' is passed as argument.
+
+# func_help
+# ---------
+# Echo long help message to standard output and exit.
 func_help ()
 {
-    $opt_debug
-
-    $SED -n '/^# Usage:/,/# Report bugs to/ {
-       :print
-        s/^# //
-       s/^# *$//
-       s*\$progname*'$progname'*
-       s*\$host*'"$host"'*
-       s*\$SHELL*'"$SHELL"'*
-       s*\$LTCC*'"$LTCC"'*
-       s*\$LTCFLAGS*'"$LTCFLAGS"'*
-       s*\$LD*'"$LD"'*
-       s/\$with_gnu_ld/'"$with_gnu_ld"'/
-       s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
-       s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
-       p
-       d
-     }
-     /^# .* home page:/b print
-     /^# General help using/b print
-     ' < "$progpath"
-    ret=$?
-    if test -z "$1"; then
-      exit $ret
-    fi
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message"
+    exit 0
 }
 
-# func_missing_arg argname
+
+# func_missing_arg ARGNAME
+# ------------------------
 # Echo program name prefixed message to standard error and set global
 # exit_cmd.
 func_missing_arg ()
 {
-    $opt_debug
+    $debug_cmd
 
-    func_error "missing argument for $1."
+    func_error "Missing argument for '$1'."
     exit_cmd=exit
 }
 
 
-# func_split_short_opt shortopt
+# func_split_equals STRING
+# ------------------------
+# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
+# splitting STRING at the '=' sign.
+test -z "$_G_HAVE_XSI_OPS" \
+    && (eval 'x=a/b/c;
+      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
+    && _G_HAVE_XSI_OPS=yes
+
+if test yes = "$_G_HAVE_XSI_OPS"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_split_equals ()
+  {
+      $debug_cmd
+
+      func_split_equals_lhs=${1%%=*}
+      func_split_equals_rhs=${1#*=}
+      test "x$func_split_equals_lhs" = "x$1" \
+        && func_split_equals_rhs=
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_split_equals ()
+  {
+      $debug_cmd
+
+      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
+      func_split_equals_rhs=
+      test "x$func_split_equals_lhs" = "x$1" \
+        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
+  }
+fi #func_split_equals
+
+
+# func_split_short_opt SHORTOPT
+# -----------------------------
 # Set func_split_short_opt_name and func_split_short_opt_arg shell
 # variables after splitting SHORTOPT after the 2nd character.
-func_split_short_opt ()
+if test yes = "$_G_HAVE_XSI_OPS"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_split_short_opt ()
+  {
+      $debug_cmd
+
+      func_split_short_opt_arg=${1#??}
+      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_split_short_opt ()
+  {
+      $debug_cmd
+
+      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
+      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
+  }
+fi #func_split_short_opt
+
+
+# func_usage
+# ----------
+# Echo short help message to standard output and exit.
+func_usage ()
 {
-    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
-    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+    $debug_cmd
 
-    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
-    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
-} # func_split_short_opt may be replaced by extended shell implementation
+    func_usage_message
+    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
+    exit 0
+}
 
 
-# func_split_long_opt longopt
-# Set func_split_long_opt_name and func_split_long_opt_arg shell
-# variables after splitting LONGOPT at the `=' sign.
-func_split_long_opt ()
+# func_usage_message
+# ------------------
+# Echo short help message to standard output.
+func_usage_message ()
 {
-    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
-    my_sed_long_arg='1s/^--[^=]*=//'
+    $debug_cmd
 
-    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
-    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
-} # func_split_long_opt may be replaced by extended shell implementation
+    eval \$ECHO \""Usage: $usage"\"
+    echo
+    $SED -n 's|^# ||
+        /^Written by/{
+          x;p;x
+        }
+       h
+       /^Written by/q' < "$progpath"
+    echo
+    eval \$ECHO \""$usage_message"\"
+}
 
-exit_cmd=:
 
+# func_version
+# ------------
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $debug_cmd
 
+    printf '%s\n' "$progname $scriptversion"
+    $SED -n '
+        /(C)/!b go
+        :more
+        /\./!{
+          N
+          s|\n# | |
+          b more
+        }
+        :go
+        /^# Written by /,/# warranty; / {
+          s|^# ||
+          s|^# *$||
+          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
+          p
+        }
+        /^# Written by / {
+          s|^# ||
+          p
+        }
+        /^warranty; /q' < "$progpath"
 
+    exit $?
+}
 
 
-magic="%%%MAGIC variable%%%"
-magic_exe="%%%MAGIC EXE variable%%%"
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End:
 
-# Global variables.
-nonopt=
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
+# Set a version string.
+scriptversion='(GNU libtool) 2.4.6'
 
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end.  This prevents here-documents from being
-# left over by shells.
-exec_cmd=
 
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
+# func_echo ARG...
+# ----------------
+# Libtool also displays the current mode in messages, so override
+# funclib.sh func_echo with this custom definition.
+func_echo ()
 {
-    eval "${1}=\$${1}\${2}"
-} # func_append may be replaced by extended shell implementation
+    $debug_cmd
 
-# func_append_quoted var value
-# Quote VALUE and append to the end of shell variable VAR, separated
-# by a space.
-func_append_quoted ()
-{
-    func_quote_for_eval "${2}"
-    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
-} # func_append_quoted may be replaced by extended shell implementation
+    _G_message=$*
+
+    func_echo_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_IFS
+      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
+    done
+    IFS=$func_echo_IFS
+}
 
 
-# func_arith arithmetic-term...
-func_arith ()
+# func_warning ARG...
+# -------------------
+# Libtool warnings are not categorized, so override funclib.sh
+# func_warning with this simpler definition.
+func_warning ()
 {
-    func_arith_result=`expr "${@}"`
-} # func_arith may be replaced by extended shell implementation
+    $debug_cmd
 
+    $warning_func ${1+"$@"}
+}
 
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
-} # func_len may be replaced by extended shell implementation
 
+## ---------------- ##
+## Options parsing. ##
+## ---------------- ##
+
+# Hook in the functions to make sure our own options are parsed during
+# the option parsing loop.
+
+usage='$progpath [OPTION]... [MODE-ARG]...'
+
+# Short help message in response to '-h'.
+usage_message="Options:
+       --config             show all configuration variables
+       --debug              enable verbose shell tracing
+   -n, --dry-run            display commands without modifying any files
+       --features           display basic configuration information and exit
+       --mode=MODE          use operation mode MODE
+       --no-warnings        equivalent to '-Wnone'
+       --preserve-dup-deps  don't remove duplicate dependency libraries
+       --quiet, --silent    don't print informational messages
+       --tag=TAG            use configuration variables from tag TAG
+   -v, --verbose            print more informational messages than default
+       --version            print version information
+   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
+   -h, --help, --help-all   print short, long, or detailed help message
+"
 
-# func_lo2o object
-func_lo2o ()
+# Additional text appended to 'usage_message' in response to '--help'.
+func_help ()
 {
-    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
-} # func_lo2o may be replaced by extended shell implementation
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message
+
+MODE must be one of the following:
+
+       clean           remove files from the build directory
+       compile         compile a source file into a libtool object
+       execute         automatically set library path, then run a program
+       finish          complete the installation of libtool libraries
+       install         install libraries or executables
+       link            create a library or an executable
+       uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  When passed as first option,
+'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
+Try '$progname --help --mode=MODE' for a more detailed description of MODE.
+
+When reporting a bug, please describe a test case to reproduce it and
+include the following information:
+
+       host-triplet:   $host
+       shell:          $SHELL
+       compiler:       $LTCC
+       compiler flags: $LTCFLAGS
+       linker:         $LD (gnu? $with_gnu_ld)
+       version:        $progname $scriptversion Debian-2.4.6-14
+       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
+       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
+
+Report bugs to <bug-libtool@gnu.org>.
+GNU libtool home page: <http://www.gnu.org/s/libtool/>.
+General help using GNU software: <http://www.gnu.org/gethelp/>."
+    exit 0
+}
 
 
-# func_xform libobj-or-source
-func_xform ()
-{
-    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
-} # func_xform may be replaced by extended shell implementation
+# func_lo2o OBJECT-NAME
+# ---------------------
+# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
+# object suffix.
+
+lo2o=s/\\.lo\$/.$objext/
+o2lo=s/\\.$objext\$/.lo/
+
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_lo2o ()
+  {
+    case $1 in
+      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
+      *   ) func_lo2o_result=$1               ;;
+    esac
+  }'
+
+  # func_xform LIBOBJ-OR-SOURCE
+  # ---------------------------
+  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
+  # suffix to a '.lo' libtool-object suffix.
+  eval 'func_xform ()
+  {
+    func_xform_result=${1%.*}.lo
+  }'
+else
+  # ...otherwise fall back to using sed.
+  func_lo2o ()
+  {
+    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
+  }
+
+  func_xform ()
+  {
+    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
+  }
+fi
 
 
-# func_fatal_configuration arg...
+# func_fatal_configuration ARG...
+# -------------------------------
 # Echo program name prefixed message to standard error, followed by
 # a configuration failure hint, and exit.
 func_fatal_configuration ()
 {
-    func_error ${1+"$@"}
-    func_error "See the $PACKAGE documentation for more information."
-    func_fatal_error "Fatal configuration error."
+    func__fatal_error ${1+"$@"} \
+      "See the $PACKAGE documentation for more information." \
+      "Fatal configuration error."
 }
 
 
 # func_config
+# -----------
 # Display the configuration for all the tags in this script.
 func_config ()
 {
@@ -915,17 +2222,19 @@ func_config ()
     exit $?
 }
 
+
 # func_features
+# -------------
 # Display the features supported by this script.
 func_features ()
 {
     echo "host: $host"
-    if test "$build_libtool_libs" = yes; then
+    if test yes = "$build_libtool_libs"; then
       echo "enable shared libraries"
     else
       echo "disable shared libraries"
     fi
-    if test "$build_old_libs" = yes; then
+    if test yes = "$build_old_libs"; then
       echo "enable static libraries"
     else
       echo "disable static libraries"
@@ -934,314 +2243,369 @@ func_features ()
     exit $?
 }
 
-# func_enable_tag tagname
+
+# func_enable_tag TAGNAME
+# -----------------------
 # Verify that TAGNAME is valid, and either flag an error and exit, or
 # enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
 # variable here.
 func_enable_tag ()
 {
-  # Global variable:
-  tagname="$1"
+    # Global variable:
+    tagname=$1
 
-  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
-  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
-  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+    sed_extractcf=/$re_begincf/,/$re_endcf/p
 
-  # Validate tagname.
-  case $tagname in
-    *[!-_A-Za-z0-9,/]*)
-      func_fatal_error "invalid tag name: $tagname"
-      ;;
-  esac
+    # Validate tagname.
+    case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+        func_fatal_error "invalid tag name: $tagname"
+        ;;
+    esac
 
-  # Don't test for the "default" C tag, as we know it's
-  # there but not specially marked.
-  case $tagname in
-    CC) ;;
+    # Don't test for the "default" C tag, as we know it's
+    # there but not specially marked.
+    case $tagname in
+        CC) ;;
     *)
-      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
-       taglist="$taglist $tagname"
-
-       # Evaluate the configuration.  Be careful to quote the path
-       # and the sed script, to avoid splitting on whitespace, but
-       # also don't use non-portable quotes within backquotes within
-       # quotes we have to do it in 2 steps:
-       extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
-       eval "$extractedcf"
-      else
-       func_error "ignoring unknown tag $tagname"
-      fi
-      ;;
-  esac
+        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+         taglist="$taglist $tagname"
+
+         # Evaluate the configuration.  Be careful to quote the path
+         # and the sed script, to avoid splitting on whitespace, but
+         # also don't use non-portable quotes within backquotes within
+         # quotes we have to do it in 2 steps:
+         extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+         eval "$extractedcf"
+        else
+         func_error "ignoring unknown tag $tagname"
+        fi
+        ;;
+    esac
 }
 
+
 # func_check_version_match
+# ------------------------
 # Ensure that we are using m4 macros, and libtool script from the same
 # release of libtool.
 func_check_version_match ()
 {
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
+    if test "$package_revision" != "$macro_revision"; then
+      if test "$VERSION" != "$macro_version"; then
+        if test -z "$macro_version"; then
+          cat >&2 <<_LT_EOF
 $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 $progname: definition of this LT_INIT comes from an older release.
 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 $progname: and run autoconf again.
 _LT_EOF
-      else
-        cat >&2 <<_LT_EOF
+        else
+          cat >&2 <<_LT_EOF
 $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 $progname: and run autoconf again.
 _LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
+        fi
+      else
+        cat >&2 <<_LT_EOF
 $progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
 $progname: of $PACKAGE $VERSION and run autoconf again.
 _LT_EOF
-    fi
+      fi
 
-    exit $EXIT_MISMATCH
-  fi
+      exit $EXIT_MISMATCH
+    fi
 }
 
 
-# Shorthand for --mode=foo, only valid as the first argument
-case $1 in
-clean|clea|cle|cl)
-  shift; set dummy --mode clean ${1+"$@"}; shift
-  ;;
-compile|compil|compi|comp|com|co|c)
-  shift; set dummy --mode compile ${1+"$@"}; shift
-  ;;
-execute|execut|execu|exec|exe|ex|e)
-  shift; set dummy --mode execute ${1+"$@"}; shift
-  ;;
-finish|finis|fini|fin|fi|f)
-  shift; set dummy --mode finish ${1+"$@"}; shift
-  ;;
-install|instal|insta|inst|ins|in|i)
-  shift; set dummy --mode install ${1+"$@"}; shift
-  ;;
-link|lin|li|l)
-  shift; set dummy --mode link ${1+"$@"}; shift
-  ;;
-uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-  shift; set dummy --mode uninstall ${1+"$@"}; shift
-  ;;
-esac
-
+# libtool_options_prep [ARG]...
+# -----------------------------
+# Preparation for options parsed by libtool.
+libtool_options_prep ()
+{
+    $debug_mode
 
+    # Option defaults:
+    opt_config=false
+    opt_dlopen=
+    opt_dry_run=false
+    opt_help=false
+    opt_mode=
+    opt_preserve_dup_deps=false
+    opt_quiet=false
 
-# Option defaults:
-opt_debug=:
-opt_dry_run=false
-opt_config=false
-opt_preserve_dup_deps=false
-opt_features=false
-opt_finish=false
-opt_help=false
-opt_help_all=false
-opt_silent=:
-opt_warning=:
-opt_verbose=:
-opt_silent=false
-opt_verbose=false
+    nonopt=
+    preserve_args=
 
+    _G_rc_lt_options_prep=:
 
-# Parse options once, thoroughly.  This comes as soon as possible in the
-# script to make things like `--version' happen as quickly as we can.
-{
-  # this just eases exit handling
-  while test $# -gt 0; do
-    opt="$1"
-    shift
-    case $opt in
-      --debug|-x)      opt_debug='set -x'
-                       func_echo "enabling shell trace mode"
-                       $opt_debug
-                       ;;
-      --dry-run|--dryrun|-n)
-                       opt_dry_run=:
-                       ;;
-      --config)
-                       opt_config=:
-func_config
-                       ;;
-      --dlopen|-dlopen)
-                       optarg="$1"
-                       opt_dlopen="${opt_dlopen+$opt_dlopen
-}$optarg"
-                       shift
-                       ;;
-      --preserve-dup-deps)
-                       opt_preserve_dup_deps=:
-                       ;;
-      --features)
-                       opt_features=:
-func_features
-                       ;;
-      --finish)
-                       opt_finish=:
-set dummy --mode finish ${1+"$@"}; shift
-                       ;;
-      --help)
-                       opt_help=:
-                       ;;
-      --help-all)
-                       opt_help_all=:
-opt_help=': help-all'
-                       ;;
-      --mode)
-                       test $# = 0 && func_missing_arg $opt && break
-                       optarg="$1"
-                       opt_mode="$optarg"
-case $optarg in
-  # Valid mode arguments:
-  clean|compile|execute|finish|install|link|relink|uninstall) ;;
-
-  # Catch anything else as an error
-  *) func_error "invalid argument for $opt"
-     exit_cmd=exit
-     break
-     ;;
-esac
-                       shift
-                       ;;
-      --no-silent|--no-quiet)
-                       opt_silent=false
-func_append preserve_args " $opt"
-                       ;;
-      --no-warning|--no-warn)
-                       opt_warning=false
-func_append preserve_args " $opt"
-                       ;;
-      --no-verbose)
-                       opt_verbose=false
-func_append preserve_args " $opt"
-                       ;;
-      --silent|--quiet)
-                       opt_silent=:
-func_append preserve_args " $opt"
-        opt_verbose=false
-                       ;;
-      --verbose|-v)
-                       opt_verbose=:
-func_append preserve_args " $opt"
-opt_silent=false
-                       ;;
-      --tag)
-                       test $# = 0 && func_missing_arg $opt && break
-                       optarg="$1"
-                       opt_tag="$optarg"
-func_append preserve_args " $opt $optarg"
-func_enable_tag "$optarg"
-                       shift
-                       ;;
-
-      -\?|-h)          func_usage                              ;;
-      --help)          func_help                               ;;
-      --version)       func_version                            ;;
-
-      # Separate optargs to long options:
-      --*=*)
-                       func_split_long_opt "$opt"
-                       set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
-                       shift
-                       ;;
-
-      # Separate non-argument short options:
-      -\?*|-h*|-n*|-v*)
-                       func_split_short_opt "$opt"
-                       set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
-                       shift
-                       ;;
-
-      --)              break                                   ;;
-      -*)              func_fatal_help "unrecognized option \`$opt'" ;;
-      *)               set dummy "$opt" ${1+"$@"};     shift; break  ;;
+    # Shorthand for --mode=foo, only valid as the first argument
+    case $1 in
+    clean|clea|cle|cl)
+      shift; set dummy --mode clean ${1+"$@"}; shift
+      ;;
+    compile|compil|compi|comp|com|co|c)
+      shift; set dummy --mode compile ${1+"$@"}; shift
+      ;;
+    execute|execut|execu|exec|exe|ex|e)
+      shift; set dummy --mode execute ${1+"$@"}; shift
+      ;;
+    finish|finis|fini|fin|fi|f)
+      shift; set dummy --mode finish ${1+"$@"}; shift
+      ;;
+    install|instal|insta|inst|ins|in|i)
+      shift; set dummy --mode install ${1+"$@"}; shift
+      ;;
+    link|lin|li|l)
+      shift; set dummy --mode link ${1+"$@"}; shift
+      ;;
+    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+      shift; set dummy --mode uninstall ${1+"$@"}; shift
+      ;;
+    *)
+      _G_rc_lt_options_prep=false
+      ;;
     esac
-  done
 
-  # Validate options:
+    if $_G_rc_lt_options_prep; then
+      # Pass back the list of options.
+      func_quote_for_eval ${1+"$@"}
+      libtool_options_prep_result=$func_quote_for_eval_result
+    fi
 
-  # save first non-option argument
-  if test "$#" -gt 0; then
-    nonopt="$opt"
-    shift
-  fi
+    $_G_rc_lt_options_prep
+}
+func_add_hook func_options_prep libtool_options_prep
 
-  # preserve --debug
-  test "$opt_debug" = : || func_append preserve_args " --debug"
 
-  case $host in
-    *cygwin* | *mingw* | *pw32* | *cegcc*)
-      # don't eliminate duplications in $postdeps and $predeps
-      opt_duplicate_compiler_generated_deps=:
-      ;;
-    *)
-      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
-      ;;
-  esac
+# libtool_parse_options [ARG]...
+# ---------------------------------
+# Provide handling for libtool specific options.
+libtool_parse_options ()
+{
+    $debug_cmd
 
-  $opt_help || {
-    # Sanity checks first:
-    func_check_version_match
+    _G_rc_lt_parse_options=false
 
-    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-      func_fatal_configuration "not configured to build any kind of library"
+    # Perform our own loop to consume as many options as possible in
+    # each iteration.
+    while test $# -gt 0; do
+      _G_match_lt_parse_options=:
+      _G_opt=$1
+      shift
+      case $_G_opt in
+        --dry-run|--dryrun|-n)
+                        opt_dry_run=:
+                        ;;
+
+        --config)       func_config ;;
+
+        --dlopen|-dlopen)
+                        opt_dlopen="${opt_dlopen+$opt_dlopen
+}$1"
+                        shift
+                        ;;
+
+        --preserve-dup-deps)
+                        opt_preserve_dup_deps=: ;;
+
+        --features)     func_features ;;
+
+        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
+
+        --help)         opt_help=: ;;
+
+        --help-all)     opt_help=': help-all' ;;
+
+        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
+                        opt_mode=$1
+                        case $1 in
+                          # Valid mode arguments:
+                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+                          # Catch anything else as an error
+                          *) func_error "invalid argument for $_G_opt"
+                             exit_cmd=exit
+                             break
+                             ;;
+                        esac
+                        shift
+                        ;;
+
+        --no-silent|--no-quiet)
+                        opt_quiet=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --no-warnings|--no-warning|--no-warn)
+                        opt_warning=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --no-verbose)
+                        opt_verbose=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --silent|--quiet)
+                        opt_quiet=:
+                        opt_verbose=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
+                        opt_tag=$1
+                        func_append preserve_args " $_G_opt $1"
+                        func_enable_tag "$1"
+                        shift
+                        ;;
+
+        --verbose|-v)   opt_quiet=false
+                        opt_verbose=:
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        # An option not handled by this hook function:
+        *)              set dummy "$_G_opt" ${1+"$@"} ; shift
+                        _G_match_lt_parse_options=false
+                        break
+                        ;;
+      esac
+      $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
+    done
+
+    if $_G_rc_lt_parse_options; then
+      # save modified positional parameters for caller
+      func_quote_for_eval ${1+"$@"}
+      libtool_parse_options_result=$func_quote_for_eval_result
     fi
 
-    # Darwin sucks
-    eval std_shrext=\"$shrext_cmds\"
+    $_G_rc_lt_parse_options
+}
+func_add_hook func_parse_options libtool_parse_options
+
 
-    # Only execute mode is allowed to have -dlopen flags.
-    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
-      func_error "unrecognized option \`-dlopen'"
-      $ECHO "$help" 1>&2
-      exit $EXIT_FAILURE
+
+# libtool_validate_options [ARG]...
+# ---------------------------------
+# Perform any sanity checks on option settings and/or unconsumed
+# arguments.
+libtool_validate_options ()
+{
+    # save first non-option argument
+    if test 0 -lt $#; then
+      nonopt=$1
+      shift
     fi
 
-    # Change the help message to a mode-specific one.
-    generic_help="$help"
-    help="Try \`$progname --help --mode=$opt_mode' for more information."
-  }
+    # preserve --debug
+    test : = "$debug_cmd" || func_append preserve_args " --debug"
+
+    case $host in
+      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
+      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
+      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
+        # don't eliminate duplications in $postdeps and $predeps
+        opt_duplicate_compiler_generated_deps=:
+        ;;
+      *)
+        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+        ;;
+    esac
 
+    $opt_help || {
+      # Sanity checks first:
+      func_check_version_match
 
-  # Bail if the options were screwed
-  $exit_cmd $EXIT_FAILURE
+      test yes != "$build_libtool_libs" \
+        && test yes != "$build_old_libs" \
+        && func_fatal_configuration "not configured to build any kind of library"
+
+      # Darwin sucks
+      eval std_shrext=\"$shrext_cmds\"
+
+      # Only execute mode is allowed to have -dlopen flags.
+      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
+        func_error "unrecognized option '-dlopen'"
+        $ECHO "$help" 1>&2
+        exit $EXIT_FAILURE
+      fi
+
+      # Change the help message to a mode-specific one.
+      generic_help=$help
+      help="Try '$progname --help --mode=$opt_mode' for more information."
+    }
+
+    # Pass back the unparsed argument list
+    func_quote_for_eval ${1+"$@"}
+    libtool_validate_options_result=$func_quote_for_eval_result
 }
+func_add_hook func_validate_options libtool_validate_options
 
 
+# Process options as early as possible so that --help and --version
+# can return quickly.
+func_options ${1+"$@"}
+eval set dummy "$func_options_result"; shift
+
 
 
 ## ----------- ##
 ##    Main.    ##
 ## ----------- ##
 
+magic='%%%MAGIC variable%%%'
+magic_exe='%%%MAGIC EXE variable%%%'
+
+# Global variables.
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# func_generated_by_libtool
+# True iff stdin has been generated by Libtool. This function is only
+# a basic sanity check; it will hardly flush out determined imposters.
+func_generated_by_libtool_p ()
+{
+  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
 # func_lalib_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
+# True iff FILE is a libtool '.la' library or '.lo' object file.
 # This function is only a basic sanity check; it will hardly flush out
 # determined imposters.
 func_lalib_p ()
 {
     test -f "$1" &&
-      $SED -e 4q "$1" 2>/dev/null \
-        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
 }
 
 # func_lalib_unsafe_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
+# True iff FILE is a libtool '.la' library or '.lo' object file.
 # This function implements the same check as func_lalib_p without
 # resorting to external programs.  To this end, it redirects stdin and
 # closes it afterwards, without saving the original file descriptor.
 # As a safety measure, use it only where a negative result would be
-# fatal anyway.  Works if `file' does not exist.
+# fatal anyway.  Works if 'file' does not exist.
 func_lalib_unsafe_p ()
 {
     lalib_p=no
@@ -1249,13 +2613,13 @@ func_lalib_unsafe_p ()
        for lalib_p_l in 1 2 3 4
        do
            read lalib_p_line
-           case "$lalib_p_line" in
+           case $lalib_p_line in
                \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
            esac
        done
        exec 0<&5 5<&-
     fi
-    test "$lalib_p" = yes
+    test yes = "$lalib_p"
 }
 
 # func_ltwrapper_script_p file
@@ -1264,7 +2628,8 @@ func_lalib_unsafe_p ()
 # determined imposters.
 func_ltwrapper_script_p ()
 {
-    func_lalib_p "$1"
+    test -f "$1" &&
+      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
 }
 
 # func_ltwrapper_executable_p file
@@ -1289,7 +2654,7 @@ func_ltwrapper_scriptname ()
 {
     func_dirname_and_basename "$1" "" "."
     func_stripname '' '.exe' "$func_basename_result"
-    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
 }
 
 # func_ltwrapper_p file
@@ -1308,11 +2673,13 @@ func_ltwrapper_p ()
 # FAIL_CMD may read-access the current command in variable CMD!
 func_execute_cmds ()
 {
-    $opt_debug
+    $debug_cmd
+
     save_ifs=$IFS; IFS='~'
     for cmd in $1; do
-      IFS=$save_ifs
+      IFS=$sp$nl
       eval cmd=\"$cmd\"
+      IFS=$save_ifs
       func_show_eval "$cmd" "${2-:}"
     done
     IFS=$save_ifs
@@ -1324,10 +2691,11 @@ func_execute_cmds ()
 # Note that it is not necessary on cygwin/mingw to append a dot to
 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
 # behavior happens only for exec(3), not for open(2)!  Also, sourcing
-# `FILE.' does not work on cygwin managed mounts.
+# 'FILE.' does not work on cygwin managed mounts.
 func_source ()
 {
-    $opt_debug
+    $debug_cmd
+
     case $1 in
     */* | *\\*)        . "$1" ;;
     *)         . "./$1" ;;
@@ -1354,10 +2722,10 @@ func_resolve_sysroot ()
 # store the result into func_replace_sysroot_result.
 func_replace_sysroot ()
 {
-  case "$lt_sysroot:$1" in
+  case $lt_sysroot:$1 in
   ?*:"$lt_sysroot"*)
     func_stripname "$lt_sysroot" '' "$1"
-    func_replace_sysroot_result="=$func_stripname_result"
+    func_replace_sysroot_result='='$func_stripname_result
     ;;
   *)
     # Including no sysroot.
@@ -1374,7 +2742,8 @@ func_replace_sysroot ()
 # arg is usually of the form 'gcc ...'
 func_infer_tag ()
 {
-    $opt_debug
+    $debug_cmd
+
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
@@ -1393,7 +2762,7 @@ func_infer_tag ()
        for z in $available_tags; do
          if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
            # Evaluate the configuration.
-           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+           eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
            CC_quoted=
            for arg in $CC; do
              # Double-quote args containing other shell metacharacters.
@@ -1418,7 +2787,7 @@ func_infer_tag ()
        # line option must be used.
        if test -z "$tagname"; then
          func_echo "unable to infer tagged configuration"
-         func_fatal_error "specify a tag with \`--tag'"
+         func_fatal_error "specify a tag with '--tag'"
 #      else
 #        func_verbose "using $tagname tagged configuration"
        fi
@@ -1434,15 +2803,15 @@ func_infer_tag ()
 # but don't create it if we're doing a dry run.
 func_write_libtool_object ()
 {
-    write_libobj=${1}
-    if test "$build_libtool_libs" = yes; then
-      write_lobj=\'${2}\'
+    write_libobj=$1
+    if test yes = "$build_libtool_libs"; then
+      write_lobj=\'$2\'
     else
       write_lobj=none
     fi
 
-    if test "$build_old_libs" = yes; then
-      write_oldobj=\'${3}\'
+    if test yes = "$build_old_libs"; then
+      write_oldobj=\'$3\'
     else
       write_oldobj=none
     fi
@@ -1450,7 +2819,7 @@ func_write_libtool_object ()
     $opt_dry_run || {
       cat >${write_libobj}T <<EOF
 # $write_libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 #
 # Please DO NOT delete this file!
 # It is necessary for linking the library.
@@ -1462,7 +2831,7 @@ pic_object=$write_lobj
 non_pic_object=$write_oldobj
 
 EOF
-      $MV "${write_libobj}T" "${write_libobj}"
+      $MV "${write_libobj}T" "$write_libobj"
     }
 }
 
@@ -1482,8 +2851,9 @@ EOF
 # be empty on error (or when ARG is empty)
 func_convert_core_file_wine_to_w32 ()
 {
-  $opt_debug
-  func_convert_core_file_wine_to_w32_result="$1"
+  $debug_cmd
+
+  func_convert_core_file_wine_to_w32_result=$1
   if test -n "$1"; then
     # Unfortunately, winepath does not exit with a non-zero error code, so we
     # are forced to check the contents of stdout. On the other hand, if the
@@ -1491,9 +2861,9 @@ func_convert_core_file_wine_to_w32 ()
     # *an error message* to stdout. So we must check for both error code of
     # zero AND non-empty stdout, which explains the odd construction:
     func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
-    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
       func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
-        $SED -e "$lt_sed_naive_backslashify"`
+        $SED -e "$sed_naive_backslashify"`
     else
       func_convert_core_file_wine_to_w32_result=
     fi
@@ -1514,18 +2884,19 @@ func_convert_core_file_wine_to_w32 ()
 # are convertible, then the result may be empty.
 func_convert_core_path_wine_to_w32 ()
 {
-  $opt_debug
+  $debug_cmd
+
   # unfortunately, winepath doesn't convert paths, only file names
-  func_convert_core_path_wine_to_w32_result=""
+  func_convert_core_path_wine_to_w32_result=
   if test -n "$1"; then
     oldIFS=$IFS
     IFS=:
     for func_convert_core_path_wine_to_w32_f in $1; do
       IFS=$oldIFS
       func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
-      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+      if test -n "$func_convert_core_file_wine_to_w32_result"; then
         if test -z "$func_convert_core_path_wine_to_w32_result"; then
-          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
         else
           func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
         fi
@@ -1554,7 +2925,8 @@ func_convert_core_path_wine_to_w32 ()
 # environment variable; do not put it in $PATH.
 func_cygpath ()
 {
-  $opt_debug
+  $debug_cmd
+
   if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
     func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
     if test "$?" -ne 0; then
@@ -1563,7 +2935,7 @@ func_cygpath ()
     fi
   else
     func_cygpath_result=
-    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
   fi
 }
 #end: func_cygpath
@@ -1574,10 +2946,11 @@ func_cygpath ()
 # result in func_convert_core_msys_to_w32_result.
 func_convert_core_msys_to_w32 ()
 {
-  $opt_debug
+  $debug_cmd
+
   # awkward: cmd appends spaces to result
   func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
-    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
 }
 #end: func_convert_core_msys_to_w32
 
@@ -1588,13 +2961,14 @@ func_convert_core_msys_to_w32 ()
 # func_to_host_file_result to ARG1).
 func_convert_file_check ()
 {
-  $opt_debug
-  if test -z "$2" && test -n "$1" ; then
+  $debug_cmd
+
+  if test -z "$2" && test -n "$1"; then
     func_error "Could not determine host file name corresponding to"
-    func_error "  \`$1'"
+    func_error "  '$1'"
     func_error "Continuing, but uninstalled executables may not work."
     # Fallback:
-    func_to_host_file_result="$1"
+    func_to_host_file_result=$1
   fi
 }
 # end func_convert_file_check
@@ -1606,10 +2980,11 @@ func_convert_file_check ()
 # func_to_host_file_result to a simplistic fallback value (see below).
 func_convert_path_check ()
 {
-  $opt_debug
+  $debug_cmd
+
   if test -z "$4" && test -n "$3"; then
     func_error "Could not determine the host path corresponding to"
-    func_error "  \`$3'"
+    func_error "  '$3'"
     func_error "Continuing, but uninstalled executables may not work."
     # Fallback.  This is a deliberately simplistic "conversion" and
     # should not be "improved".  See libtool.info.
@@ -1618,7 +2993,7 @@ func_convert_path_check ()
       func_to_host_path_result=`echo "$3" |
         $SED -e "$lt_replace_pathsep_chars"`
     else
-      func_to_host_path_result="$3"
+      func_to_host_path_result=$3
     fi
   fi
 }
@@ -1630,9 +3005,10 @@ func_convert_path_check ()
 # and appending REPL if ORIG matches BACKPAT.
 func_convert_path_front_back_pathsep ()
 {
-  $opt_debug
+  $debug_cmd
+
   case $4 in
-  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+  $1 ) func_to_host_path_result=$3$func_to_host_path_result
     ;;
   esac
   case $4 in
@@ -1646,7 +3022,7 @@ func_convert_path_front_back_pathsep ()
 ##################################################
 # $build to $host FILE NAME CONVERSION FUNCTIONS #
 ##################################################
-# invoked via `$to_host_file_cmd ARG'
+# invoked via '$to_host_file_cmd ARG'
 #
 # In each case, ARG is the path to be converted from $build to $host format.
 # Result will be available in $func_to_host_file_result.
@@ -1657,7 +3033,8 @@ func_convert_path_front_back_pathsep ()
 # in func_to_host_file_result.
 func_to_host_file ()
 {
-  $opt_debug
+  $debug_cmd
+
   $to_host_file_cmd "$1"
 }
 # end func_to_host_file
@@ -1669,7 +3046,8 @@ func_to_host_file ()
 # in (the comma separated) LAZY, no conversion takes place.
 func_to_tool_file ()
 {
-  $opt_debug
+  $debug_cmd
+
   case ,$2, in
     *,"$to_tool_file_cmd",*)
       func_to_tool_file_result=$1
@@ -1687,7 +3065,7 @@ func_to_tool_file ()
 # Copy ARG to func_to_host_file_result.
 func_convert_file_noop ()
 {
-  func_to_host_file_result="$1"
+  func_to_host_file_result=$1
 }
 # end func_convert_file_noop
 
@@ -1698,11 +3076,12 @@ func_convert_file_noop ()
 # func_to_host_file_result.
 func_convert_file_msys_to_w32 ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     func_convert_core_msys_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result=$func_convert_core_msys_to_w32_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1714,8 +3093,9 @@ func_convert_file_msys_to_w32 ()
 # func_to_host_file_result.
 func_convert_file_cygwin_to_w32 ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
     # LT_CYGPATH in this case.
@@ -1731,11 +3111,12 @@ func_convert_file_cygwin_to_w32 ()
 # and a working winepath. Returns result in func_to_host_file_result.
 func_convert_file_nix_to_w32 ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     func_convert_core_file_wine_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1747,12 +3128,13 @@ func_convert_file_nix_to_w32 ()
 # Returns result in func_to_host_file_result.
 func_convert_file_msys_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     func_convert_core_msys_to_w32 "$1"
     func_cygpath -u "$func_convert_core_msys_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
+    func_to_host_file_result=$func_cygpath_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1765,13 +3147,14 @@ func_convert_file_msys_to_cygwin ()
 # in func_to_host_file_result.
 func_convert_file_nix_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
     func_convert_core_file_wine_to_w32 "$1"
     func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
+    func_to_host_file_result=$func_cygpath_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1781,7 +3164,7 @@ func_convert_file_nix_to_cygwin ()
 #############################################
 # $build to $host PATH CONVERSION FUNCTIONS #
 #############################################
-# invoked via `$to_host_path_cmd ARG'
+# invoked via '$to_host_path_cmd ARG'
 #
 # In each case, ARG is the path to be converted from $build to $host format.
 # The result will be available in $func_to_host_path_result.
@@ -1805,10 +3188,11 @@ func_convert_file_nix_to_cygwin ()
 to_host_path_cmd=
 func_init_to_host_path_cmd ()
 {
-  $opt_debug
+  $debug_cmd
+
   if test -z "$to_host_path_cmd"; then
     func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
-    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+    to_host_path_cmd=func_convert_path_$func_stripname_result
   fi
 }
 
@@ -1818,7 +3202,8 @@ func_init_to_host_path_cmd ()
 # in func_to_host_path_result.
 func_to_host_path ()
 {
-  $opt_debug
+  $debug_cmd
+
   func_init_to_host_path_cmd
   $to_host_path_cmd "$1"
 }
@@ -1829,7 +3214,7 @@ func_to_host_path ()
 # Copy ARG to func_to_host_path_result.
 func_convert_path_noop ()
 {
-  func_to_host_path_result="$1"
+  func_to_host_path_result=$1
 }
 # end func_convert_path_noop
 
@@ -1840,8 +3225,9 @@ func_convert_path_noop ()
 # func_to_host_path_result.
 func_convert_path_msys_to_w32 ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # Remove leading and trailing path separator characters from ARG.  MSYS
     # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
@@ -1849,7 +3235,7 @@ func_convert_path_msys_to_w32 ()
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result=$func_convert_core_msys_to_w32_result
     func_convert_path_check : ";" \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
@@ -1863,8 +3249,9 @@ func_convert_path_msys_to_w32 ()
 # func_to_host_file_result.
 func_convert_path_cygwin_to_w32 ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
@@ -1883,14 +3270,15 @@ func_convert_path_cygwin_to_w32 ()
 # a working winepath.  Returns result in func_to_host_file_result.
 func_convert_path_nix_to_w32 ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
     func_convert_path_check : ";" \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
@@ -1904,15 +3292,16 @@ func_convert_path_nix_to_w32 ()
 # Returns result in func_to_host_file_result.
 func_convert_path_msys_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
     func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
+    func_to_host_path_result=$func_cygpath_result
     func_convert_path_check : : \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
@@ -1927,8 +3316,9 @@ func_convert_path_msys_to_cygwin ()
 # func_to_host_file_result.
 func_convert_path_nix_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # Remove leading and trailing path separator characters from
     # ARG. msys behavior is inconsistent here, cygpath turns them
@@ -1937,7 +3327,7 @@ func_convert_path_nix_to_cygwin ()
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
     func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
+    func_to_host_path_result=$func_cygpath_result
     func_convert_path_check : : \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
@@ -1946,13 +3336,31 @@ func_convert_path_nix_to_cygwin ()
 # end func_convert_path_nix_to_cygwin
 
 
+# func_dll_def_p FILE
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with _LT_DLL_DEF_P in libtool.m4
+func_dll_def_p ()
+{
+  $debug_cmd
+
+  func_dll_def_p_tmp=`$SED -n \
+    -e 's/^[    ]*//' \
+    -e '/^\(;.*\)*$/d' \
+    -e 's/^\(EXPORTS\|LIBRARY\)\([      ].*\)*$/DEF/p' \
+    -e q \
+    "$1"`
+  test DEF = "$func_dll_def_p_tmp"
+}
+
+
 # func_mode_compile arg...
 func_mode_compile ()
 {
-    $opt_debug
+    $debug_cmd
+
     # Get the compilation command and the source file.
     base_compile=
-    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
     suppress_opt=yes
     suppress_output=
     arg_mode=normal
@@ -1965,12 +3373,12 @@ func_mode_compile ()
       case $arg_mode in
       arg  )
        # do not "continue".  Instead, add this to base_compile
-       lastarg="$arg"
+       lastarg=$arg
        arg_mode=normal
        ;;
 
       target )
-       libobj="$arg"
+       libobj=$arg
        arg_mode=normal
        continue
        ;;
@@ -1980,7 +3388,7 @@ func_mode_compile ()
        case $arg in
        -o)
          test -n "$libobj" && \
-           func_fatal_error "you cannot specify \`-o' more than once"
+           func_fatal_error "you cannot specify '-o' more than once"
          arg_mode=target
          continue
          ;;
@@ -2009,12 +3417,12 @@ func_mode_compile ()
          func_stripname '-Wc,' '' "$arg"
          args=$func_stripname_result
          lastarg=
-         save_ifs="$IFS"; IFS=','
+         save_ifs=$IFS; IFS=,
          for arg in $args; do
-           IFS="$save_ifs"
+           IFS=$save_ifs
            func_append_quoted lastarg "$arg"
          done
-         IFS="$save_ifs"
+         IFS=$save_ifs
          func_stripname ' ' '' "$lastarg"
          lastarg=$func_stripname_result
 
@@ -2027,8 +3435,8 @@ func_mode_compile ()
          # Accept the current argument as the source file.
          # The previous "srcfile" becomes the current argument.
          #
-         lastarg="$srcfile"
-         srcfile="$arg"
+         lastarg=$srcfile
+         srcfile=$arg
          ;;
        esac  #  case $arg
        ;;
@@ -2043,13 +3451,13 @@ func_mode_compile ()
       func_fatal_error "you must specify an argument for -Xcompile"
       ;;
     target)
-      func_fatal_error "you must specify a target with \`-o'"
+      func_fatal_error "you must specify a target with '-o'"
       ;;
     *)
       # Get the name of the library object.
       test -z "$libobj" && {
        func_basename "$srcfile"
-       libobj="$func_basename_result"
+       libobj=$func_basename_result
       }
       ;;
     esac
@@ -2069,7 +3477,7 @@ func_mode_compile ()
     case $libobj in
     *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
     *)
-      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      func_fatal_error "cannot determine name of library object from '$libobj'"
       ;;
     esac
 
@@ -2078,8 +3486,8 @@ func_mode_compile ()
     for arg in $later; do
       case $arg in
       -shared)
-       test "$build_libtool_libs" != yes && \
-         func_fatal_configuration "can not build a shared library"
+       test yes = "$build_libtool_libs" \
+         || func_fatal_configuration "cannot build a shared library"
        build_old_libs=no
        continue
        ;;
@@ -2105,17 +3513,17 @@ func_mode_compile ()
     func_quote_for_eval "$libobj"
     test "X$libobj" != "X$func_quote_for_eval_result" \
       && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'   &()|`$[]' \
-      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+      && func_warning "libobj name '$libobj' may not contain shell special characters."
     func_dirname_and_basename "$obj" "/" ""
-    objname="$func_basename_result"
-    xdir="$func_dirname_result"
-    lobj=${xdir}$objdir/$objname
+    objname=$func_basename_result
+    xdir=$func_dirname_result
+    lobj=$xdir$objdir/$objname
 
     test -z "$base_compile" && \
       func_fatal_help "you must specify a compilation command"
 
     # Delete any leftover library objects.
-    if test "$build_old_libs" = yes; then
+    if test yes = "$build_old_libs"; then
       removelist="$obj $lobj $libobj ${libobj}T"
     else
       removelist="$lobj $libobj ${libobj}T"
@@ -2127,16 +3535,16 @@ func_mode_compile ()
       pic_mode=default
       ;;
     esac
-    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
       # non-PIC code in shared libraries is not supported
       pic_mode=default
     fi
 
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
-    if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
-      lockfile="$output_obj.lock"
+    if test no = "$compiler_c_o"; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
+      lockfile=$output_obj.lock
     else
       output_obj=
       need_locks=no
@@ -2145,12 +3553,12 @@ func_mode_compile ()
 
     # Lock this critical section if it is needed
     # We use this script file to make the link, it avoids creating a new file
-    if test "$need_locks" = yes; then
+    if test yes = "$need_locks"; then
       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
        func_echo "Waiting for $lockfile to be removed"
        sleep 2
       done
-    elif test "$need_locks" = warn; then
+    elif test warn = "$need_locks"; then
       if test -f "$lockfile"; then
        $ECHO "\
 *** ERROR, $lockfile exists and contains:
@@ -2158,7 +3566,7 @@ func_mode_compile ()
 
 This indicates that another process is trying to use the same
 temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
+your compiler does not support '-c' and '-o' together.  If you
 repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
@@ -2180,11 +3588,11 @@ compiler."
     qsrcfile=$func_quote_for_eval_result
 
     # Only build a PIC object if we are building libtool libraries.
-    if test "$build_libtool_libs" = yes; then
+    if test yes = "$build_libtool_libs"; then
       # Without this assignment, base_compile gets emptied.
       fbsd_hideous_sh_bug=$base_compile
 
-      if test "$pic_mode" != no; then
+      if test no != "$pic_mode"; then
        command="$base_compile $qsrcfile $pic_flag"
       else
        # Don't build PIC code
@@ -2201,7 +3609,7 @@ compiler."
       func_show_eval_locale "$command" \
           'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
 
-      if test "$need_locks" = warn &&
+      if test warn = "$need_locks" &&
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
        $ECHO "\
 *** ERROR, $lockfile contains:
@@ -2212,7 +3620,7 @@ $srcfile
 
 This indicates that another process is trying to use the same
 temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
+your compiler does not support '-c' and '-o' together.  If you
 repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
@@ -2228,20 +3636,20 @@ compiler."
       fi
 
       # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
+      if test yes = "$suppress_opt"; then
        suppress_output=' >/dev/null 2>&1'
       fi
     fi
 
     # Only build a position-dependent object if we build old libraries.
-    if test "$build_old_libs" = yes; then
-      if test "$pic_mode" != yes; then
+    if test yes = "$build_old_libs"; then
+      if test yes != "$pic_mode"; then
        # Don't build PIC code
        command="$base_compile $qsrcfile$pie_flag"
       else
        command="$base_compile $qsrcfile $pic_flag"
       fi
-      if test "$compiler_c_o" = yes; then
+      if test yes = "$compiler_c_o"; then
        func_append command " -o $obj"
       fi
 
@@ -2250,7 +3658,7 @@ compiler."
       func_show_eval_locale "$command" \
         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
-      if test "$need_locks" = warn &&
+      if test warn = "$need_locks" &&
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
        $ECHO "\
 *** ERROR, $lockfile contains:
@@ -2261,7 +3669,7 @@ $srcfile
 
 This indicates that another process is trying to use the same
 temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
+your compiler does not support '-c' and '-o' together.  If you
 repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
@@ -2281,7 +3689,7 @@ compiler."
       func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
 
       # Unlock the critical section if it was locked
-      if test "$need_locks" != no; then
+      if test no != "$need_locks"; then
        removelist=$lockfile
         $RM "$lockfile"
       fi
@@ -2291,7 +3699,7 @@ compiler."
 }
 
 $opt_help || {
-  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+  test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
@@ -2311,7 +3719,7 @@ func_mode_help ()
 Remove files from the build directory.
 
 RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 to RM.
 
 If FILE is a libtool library, object or program, all the files associated
@@ -2330,16 +3738,16 @@ This mode accepts the following additional options:
   -no-suppress      do not suppress compiler output for multiple passes
   -prefer-pic       try to build PIC objects only
   -prefer-non-pic   try to build non-PIC objects only
-  -shared           do not build a \`.o' file suitable for static linking
-  -static           only build a \`.o' file suitable for static linking
+  -shared           do not build a '.o' file suitable for static linking
+  -static           only build a '.o' file suitable for static linking
   -Wc,FLAG          pass FLAG directly to the compiler
 
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+COMPILE-COMMAND is a command to be used in creating a 'standard' object file
 from the given SOURCEFILE.
 
 The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
+SOURCEFILE, then substituting the C source code suffix '.c' with the
+library object suffix, '.lo'."
         ;;
 
       execute)
@@ -2352,7 +3760,7 @@ This mode accepts the following additional options:
 
   -dlopen FILE      add the directory containing FILE to the library path
 
-This mode sets the library path environment variable according to \`-dlopen'
+This mode sets the library path environment variable according to '-dlopen'
 flags.
 
 If any of the ARGS are libtool executable wrappers, then they are translated
@@ -2371,7 +3779,7 @@ Complete the installation of libtool libraries.
 Each LIBDIR is a directory that contains libtool libraries.
 
 The commands that this mode executes may require superuser privileges.  Use
-the \`--dry-run' option if you just want to see what would be executed."
+the '--dry-run' option if you just want to see what would be executed."
         ;;
 
       install)
@@ -2381,7 +3789,7 @@ the \`--dry-run' option if you just want to see what would be executed."
 Install executables or libraries.
 
 INSTALL-COMMAND is the installation command.  The first component should be
-either the \`install' or \`cp' program.
+either the 'install' or 'cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
@@ -2407,7 +3815,7 @@ The following components of LINK-COMMAND are treated specially:
   -avoid-version    do not add a version suffix if possible
   -bindir BINDIR    specify path to binaries directory (for systems where
                     libraries must be found in the PATH setting at runtime)
-  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
@@ -2421,7 +3829,8 @@ The following components of LINK-COMMAND are treated specially:
   -no-install       link a not-installable executable
   -no-undefined     declare that a library does not refer to external symbols
   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
-  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -objectlist FILE  use a list of object files found in FILE to specify objects
+  -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
   -precious-files-regex REGEX
                     don't remove output files matching REGEX
   -release RELEASE  specify package release information
@@ -2441,20 +3850,20 @@ The following components of LINK-COMMAND are treated specially:
   -Xlinker FLAG     pass linker-specific FLAG directly to the linker
   -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
-All other options (arguments beginning with \`-') are ignored.
+All other options (arguments beginning with '-') are ignored.
 
-Every other argument is treated as a filename.  Files ending in \`.la' are
+Every other argument is treated as a filename.  Files ending in '.la' are
 treated as uninstalled libtool libraries, other files are standard or library
 object files.
 
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
+If the OUTPUT-FILE ends in '.la', then a libtool library is created,
+only library objects ('.lo' files) may be specified, and '-rpath' is
 required, except when creating a convenience library.
 
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
+If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
+using 'ar' and 'ranlib', or on Windows using 'lib'.
 
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
 is created, otherwise an executable program is created."
         ;;
 
@@ -2465,7 +3874,7 @@ is created, otherwise an executable program is created."
 Remove libraries from an installation directory.
 
 RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 to RM.
 
 If FILE is a libtool library, all the files associated with it are deleted.
@@ -2473,17 +3882,17 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
 
       *)
-        func_fatal_help "invalid operation mode \`$opt_mode'"
+        func_fatal_help "invalid operation mode '$opt_mode'"
         ;;
     esac
 
     echo
-    $ECHO "Try \`$progname --help' for more information about other modes."
+    $ECHO "Try '$progname --help' for more information about other modes."
 }
 
 # Now that we've collected a possible --mode arg, show help if necessary
 if $opt_help; then
-  if test "$opt_help" = :; then
+  if test : = "$opt_help"; then
     func_mode_help
   else
     {
@@ -2491,7 +3900,7 @@ if $opt_help; then
       for opt_mode in compile link execute install finish uninstall clean; do
        func_mode_help
       done
-    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
     {
       func_help noexit
       for opt_mode in compile link execute install finish uninstall clean; do
@@ -2499,7 +3908,7 @@ if $opt_help; then
        func_mode_help
       done
     } |
-    sed '1d
+    $SED '1d
       /^When reporting/,/^Report/{
        H
        d
@@ -2516,16 +3925,17 @@ fi
 # func_mode_execute arg...
 func_mode_execute ()
 {
-    $opt_debug
+    $debug_cmd
+
     # The first argument is the command name.
-    cmd="$nonopt"
+    cmd=$nonopt
     test -z "$cmd" && \
       func_fatal_help "you must specify a COMMAND"
 
     # Handle -dlopen flags immediately.
     for file in $opt_dlopen; do
       test -f "$file" \
-       || func_fatal_help "\`$file' is not a file"
+       || func_fatal_help "'$file' is not a file"
 
       dir=
       case $file in
@@ -2535,7 +3945,7 @@ func_mode_execute ()
 
        # Check to see that this really is a libtool archive.
        func_lalib_unsafe_p "$file" \
-         || func_fatal_help "\`$lib' is not a valid libtool archive"
+         || func_fatal_help "'$lib' is not a valid libtool archive"
 
        # Read the libtool library.
        dlname=
@@ -2546,18 +3956,18 @@ func_mode_execute ()
        if test -z "$dlname"; then
          # Warn if it was a shared library.
          test -n "$library_names" && \
-           func_warning "\`$file' was not linked with \`-export-dynamic'"
+           func_warning "'$file' was not linked with '-export-dynamic'"
          continue
        fi
 
        func_dirname "$file" "" "."
-       dir="$func_dirname_result"
+       dir=$func_dirname_result
 
        if test -f "$dir/$objdir/$dlname"; then
          func_append dir "/$objdir"
        else
          if test ! -f "$dir/$dlname"; then
-           func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+           func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
          fi
        fi
        ;;
@@ -2565,18 +3975,18 @@ func_mode_execute ()
       *.lo)
        # Just add the directory containing the .lo file.
        func_dirname "$file" "" "."
-       dir="$func_dirname_result"
+       dir=$func_dirname_result
        ;;
 
       *)
-       func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+       func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
        continue
        ;;
       esac
 
       # Get the absolute pathname.
       absdir=`cd "$dir" && pwd`
-      test -n "$absdir" && dir="$absdir"
+      test -n "$absdir" && dir=$absdir
 
       # Now add the directory to shlibpath_var.
       if eval "test -z \"\$$shlibpath_var\""; then
@@ -2588,7 +3998,7 @@ func_mode_execute ()
 
     # This variable tells wrapper scripts just to set shlibpath_var
     # rather than running their programs.
-    libtool_execute_magic="$magic"
+    libtool_execute_magic=$magic
 
     # Check if any of the arguments is a wrapper script.
     args=
@@ -2601,12 +4011,12 @@ func_mode_execute ()
        if func_ltwrapper_script_p "$file"; then
          func_source "$file"
          # Transform arg to wrapped name.
-         file="$progdir/$program"
+         file=$progdir/$program
        elif func_ltwrapper_executable_p "$file"; then
          func_ltwrapper_scriptname "$file"
          func_source "$func_ltwrapper_scriptname_result"
          # Transform arg to wrapped name.
-         file="$progdir/$program"
+         file=$progdir/$program
        fi
        ;;
       esac
@@ -2614,7 +4024,15 @@ func_mode_execute ()
       func_append_quoted args "$file"
     done
 
-    if test "X$opt_dry_run" = Xfalse; then
+    if $opt_dry_run; then
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+       eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+       echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    else
       if test -n "$shlibpath_var"; then
        # Export the shlibpath_var.
        eval "export $shlibpath_var"
@@ -2631,25 +4049,18 @@ func_mode_execute ()
       done
 
       # Now prepare to actually exec the command.
-      exec_cmd="\$cmd$args"
-    else
-      # Display what would be done.
-      if test -n "$shlibpath_var"; then
-       eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-       echo "export $shlibpath_var"
-      fi
-      $ECHO "$cmd$args"
-      exit $EXIT_SUCCESS
+      exec_cmd=\$cmd$args
     fi
 }
 
-test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
 
 
 # func_mode_finish arg...
 func_mode_finish ()
 {
-    $opt_debug
+    $debug_cmd
+
     libs=
     libdirs=
     admincmds=
@@ -2663,11 +4074,11 @@ func_mode_finish ()
        if func_lalib_unsafe_p "$opt"; then
          func_append libs " $opt"
        else
-         func_warning "\`$opt' is not a valid libtool archive"
+         func_warning "'$opt' is not a valid libtool archive"
        fi
 
       else
-       func_fatal_error "invalid argument \`$opt'"
+       func_fatal_error "invalid argument '$opt'"
       fi
     done
 
@@ -2682,12 +4093,12 @@ func_mode_finish ()
       # Remove sysroot references
       if $opt_dry_run; then
         for lib in $libs; do
-          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+          echo "removing references to $lt_sysroot and '=' prefixes from $lib"
         done
       else
         tmpdir=`func_mktempdir`
         for lib in $libs; do
-         sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+         $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
            > $tmpdir/tmp-la
          mv -f $tmpdir/tmp-la $lib
        done
@@ -2712,7 +4123,7 @@ func_mode_finish ()
     fi
 
     # Exit here if they wanted silent mode.
-    $opt_silent && exit $EXIT_SUCCESS
+    $opt_quiet && exit $EXIT_SUCCESS
 
     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
       echo "----------------------------------------------------------------------"
@@ -2723,27 +4134,27 @@ func_mode_finish ()
       echo
       echo "If you ever happen to want to link against installed libraries"
       echo "in a given directory, LIBDIR, you must either use libtool, and"
-      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "specify the full pathname of the library, or use the '-LLIBDIR'"
       echo "flag during linking and do at least one of the following:"
       if test -n "$shlibpath_var"; then
-       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+       echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
        echo "     during execution"
       fi
       if test -n "$runpath_var"; then
-       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+       echo "   - add LIBDIR to the '$runpath_var' environment variable"
        echo "     during linking"
       fi
       if test -n "$hardcode_libdir_flag_spec"; then
        libdir=LIBDIR
        eval flag=\"$hardcode_libdir_flag_spec\"
 
-       $ECHO "   - use the \`$flag' linker flag"
+       $ECHO "   - use the '$flag' linker flag"
       fi
       if test -n "$admincmds"; then
        $ECHO "   - have your system administrator run these commands:$admincmds"
       fi
       if test -f /etc/ld.so.conf; then
-       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+       echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
       fi
       echo
 
@@ -2762,18 +4173,20 @@ func_mode_finish ()
     exit $EXIT_SUCCESS
 }
 
-test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
 
 
 # func_mode_install arg...
 func_mode_install ()
 {
-    $opt_debug
+    $debug_cmd
+
     # There may be an optional sh(1) argument at the beginning of
     # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+    if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
        # Allow the use of GNU shtool's install command.
-       case $nonopt in *shtool*) :;; *) false;; esac; then
+       case $nonopt in *shtool*) :;; *) false;; esac
+    then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -2800,7 +4213,7 @@ func_mode_install ()
     opts=
     prev=
     install_type=
-    isdir=no
+    isdir=false
     stripme=
     no_mode=:
     for arg
@@ -2813,7 +4226,7 @@ func_mode_install ()
       fi
 
       case $arg in
-      -d) isdir=yes ;;
+      -d) isdir=: ;;
       -f)
        if $install_cp; then :; else
          prev=$arg
@@ -2831,7 +4244,7 @@ func_mode_install ()
       *)
        # If the previous option needed an argument, then skip it.
        if test -n "$prev"; then
-         if test "x$prev" = x-m && test -n "$install_override_mode"; then
+         if test X-m = "X$prev" && test -n "$install_override_mode"; then
            arg2=$install_override_mode
            no_mode=false
          fi
@@ -2856,7 +4269,7 @@ func_mode_install ()
       func_fatal_help "you must specify an install program"
 
     test -n "$prev" && \
-      func_fatal_help "the \`$prev' option requires an argument"
+      func_fatal_help "the '$prev' option requires an argument"
 
     if test -n "$install_override_mode" && $no_mode; then
       if $install_cp; then :; else
@@ -2878,19 +4291,19 @@ func_mode_install ()
     dest=$func_stripname_result
 
     # Check to see that the destination is a directory.
-    test -d "$dest" && isdir=yes
-    if test "$isdir" = yes; then
-      destdir="$dest"
+    test -d "$dest" && isdir=:
+    if $isdir; then
+      destdir=$dest
       destname=
     else
       func_dirname_and_basename "$dest" "" "."
-      destdir="$func_dirname_result"
-      destname="$func_basename_result"
+      destdir=$func_dirname_result
+      destname=$func_basename_result
 
       # Not a directory, so check to see that there is only one file specified.
       set dummy $files; shift
       test "$#" -gt 1 && \
-       func_fatal_help "\`$dest' is not a directory"
+       func_fatal_help "'$dest' is not a directory"
     fi
     case $destdir in
     [\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -2899,7 +4312,7 @@ func_mode_install ()
        case $file in
        *.lo) ;;
        *)
-         func_fatal_help "\`$destdir' must be an absolute directory name"
+         func_fatal_help "'$destdir' must be an absolute directory name"
          ;;
        esac
       done
@@ -2908,7 +4321,7 @@ func_mode_install ()
 
     # This variable tells wrapper scripts just to set variables rather
     # than running their programs.
-    libtool_install_magic="$magic"
+    libtool_install_magic=$magic
 
     staticlibs=
     future_libdirs=
@@ -2928,7 +4341,7 @@ func_mode_install ()
 
        # Check to see that this really is a libtool archive.
        func_lalib_unsafe_p "$file" \
-         || func_fatal_help "\`$file' is not a valid libtool archive"
+         || func_fatal_help "'$file' is not a valid libtool archive"
 
        library_names=
        old_library=
@@ -2950,7 +4363,7 @@ func_mode_install ()
        fi
 
        func_dirname "$file" "/" ""
-       dir="$func_dirname_result"
+       dir=$func_dirname_result
        func_append dir "$objdir"
 
        if test -n "$relink_command"; then
@@ -2964,7 +4377,7 @@ func_mode_install ()
          # are installed into $libdir/../bin (currently, that works fine)
          # but it's something to keep an eye on.
          test "$inst_prefix_dir" = "$destdir" && \
-           func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+           func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
 
          if test -n "$inst_prefix_dir"; then
            # Stick the inst_prefix_dir data into the link command.
@@ -2973,29 +4386,36 @@ func_mode_install ()
            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
          fi
 
-         func_warning "relinking \`$file'"
+         func_warning "relinking '$file'"
          func_show_eval "$relink_command" \
-           'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+           'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
        fi
 
        # See the names of the shared library.
        set dummy $library_names; shift
        if test -n "$1"; then
-         realname="$1"
+         realname=$1
          shift
 
-         srcname="$realname"
-         test -n "$relink_command" && srcname="$realname"T
+         srcname=$realname
+         test -n "$relink_command" && srcname=${realname}T
 
          # Install the shared library and build the symlinks.
          func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
              'exit $?'
-         tstripme="$stripme"
+         tstripme=$stripme
          case $host_os in
          cygwin* | mingw* | pw32* | cegcc*)
            case $realname in
            *.dll.a)
-             tstripme=""
+             tstripme=
+             ;;
+           esac
+           ;;
+         os2*)
+           case $realname in
+           *_dll.a)
+             tstripme=
              ;;
            esac
            ;;
@@ -3006,7 +4426,7 @@ func_mode_install ()
 
          if test "$#" -gt 0; then
            # Delete the old symlinks, and create new ones.
-           # Try `ln -sf' first, because the `ln' binary might depend on
+           # Try 'ln -sf' first, because the 'ln' binary might depend on
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
            # so we also need to try rm && ln -s.
            for linkname
@@ -3017,14 +4437,14 @@ func_mode_install ()
          fi
 
          # Do each command in the postinstall commands.
-         lib="$destdir/$realname"
+         lib=$destdir/$realname
          func_execute_cmds "$postinstall_cmds" 'exit $?'
        fi
 
        # Install the pseudo-library for information purposes.
        func_basename "$file"
-       name="$func_basename_result"
-       instname="$dir/$name"i
+       name=$func_basename_result
+       instname=$dir/${name}i
        func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
        # Maybe install the static library, too.
@@ -3036,11 +4456,11 @@ func_mode_install ()
 
        # Figure out destination file name, if it wasn't already specified.
        if test -n "$destname"; then
-         destfile="$destdir/$destname"
+         destfile=$destdir/$destname
        else
          func_basename "$file"
-         destfile="$func_basename_result"
-         destfile="$destdir/$destfile"
+         destfile=$func_basename_result
+         destfile=$destdir/$destfile
        fi
 
        # Deduce the name of the destination old-style object file.
@@ -3050,11 +4470,11 @@ func_mode_install ()
          staticdest=$func_lo2o_result
          ;;
        *.$objext)
-         staticdest="$destfile"
+         staticdest=$destfile
          destfile=
          ;;
        *)
-         func_fatal_help "cannot copy a libtool object to \`$destfile'"
+         func_fatal_help "cannot copy a libtool object to '$destfile'"
          ;;
        esac
 
@@ -3063,7 +4483,7 @@ func_mode_install ()
          func_show_eval "$install_prog $file $destfile" 'exit $?'
 
        # Install the old object if enabled.
-       if test "$build_old_libs" = yes; then
+       if test yes = "$build_old_libs"; then
          # Deduce the name of the old-style object file.
          func_lo2o "$file"
          staticobj=$func_lo2o_result
@@ -3075,23 +4495,23 @@ func_mode_install ()
       *)
        # Figure out destination file name, if it wasn't already specified.
        if test -n "$destname"; then
-         destfile="$destdir/$destname"
+         destfile=$destdir/$destname
        else
          func_basename "$file"
-         destfile="$func_basename_result"
-         destfile="$destdir/$destfile"
+         destfile=$func_basename_result
+         destfile=$destdir/$destfile
        fi
 
        # If the file is missing, and there is a .exe on the end, strip it
        # because it is most likely a libtool script we actually want to
        # install
-       stripped_ext=""
+       stripped_ext=
        case $file in
          *.exe)
            if test ! -f "$file"; then
              func_stripname '' '.exe' "$file"
              file=$func_stripname_result
-             stripped_ext=".exe"
+             stripped_ext=.exe
            fi
            ;;
        esac
@@ -3119,19 +4539,19 @@ func_mode_install ()
 
          # Check the variables that should have been set.
          test -z "$generated_by_libtool_version" && \
-           func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+           func_fatal_error "invalid libtool wrapper script '$wrapper'"
 
-         finalize=yes
+         finalize=:
          for lib in $notinst_deplibs; do
            # Check to see that each library is installed.
            libdir=
            if test -f "$lib"; then
              func_source "$lib"
            fi
-           libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+           libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
            if test -n "$libdir" && test ! -f "$libfile"; then
-             func_warning "\`$lib' has not been installed in \`$libdir'"
-             finalize=no
+             func_warning "'$lib' has not been installed in '$libdir'"
+             finalize=false
            fi
          done
 
@@ -3139,29 +4559,29 @@ func_mode_install ()
          func_source "$wrapper"
 
          outputname=
-         if test "$fast_install" = no && test -n "$relink_command"; then
+         if test no = "$fast_install" && test -n "$relink_command"; then
            $opt_dry_run || {
-             if test "$finalize" = yes; then
+             if $finalize; then
                tmpdir=`func_mktempdir`
                func_basename "$file$stripped_ext"
-               file="$func_basename_result"
-               outputname="$tmpdir/$file"
+               file=$func_basename_result
+               outputname=$tmpdir/$file
                # Replace the output file specification.
                relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 
-               $opt_silent || {
+               $opt_quiet || {
                  func_quote_for_expand "$relink_command"
                  eval "func_echo $func_quote_for_expand_result"
                }
                if eval "$relink_command"; then :
                  else
-                 func_error "error: relink \`$file' with the above command before installing it"
+                 func_error "error: relink '$file' with the above command before installing it"
                  $opt_dry_run || ${RM}r "$tmpdir"
                  continue
                fi
-               file="$outputname"
+               file=$outputname
              else
-               func_warning "cannot relink \`$file'"
+               func_warning "cannot relink '$file'"
              fi
            }
          else
@@ -3198,10 +4618,10 @@ func_mode_install ()
 
     for file in $staticlibs; do
       func_basename "$file"
-      name="$func_basename_result"
+      name=$func_basename_result
 
       # Set up the ranlib parameters.
-      oldlib="$destdir/$name"
+      oldlib=$destdir/$name
       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
       tool_oldlib=$func_to_tool_file_result
 
@@ -3216,18 +4636,18 @@ func_mode_install ()
     done
 
     test -n "$future_libdirs" && \
-      func_warning "remember to run \`$progname --finish$future_libdirs'"
+      func_warning "remember to run '$progname --finish$future_libdirs'"
 
     if test -n "$current_libdirs"; then
       # Maybe just do a dry run.
       $opt_dry_run && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
     else
       exit $EXIT_SUCCESS
     fi
 }
 
-test "$opt_mode" = install && func_mode_install ${1+"$@"}
+test install = "$opt_mode" && func_mode_install ${1+"$@"}
 
 
 # func_generate_dlsyms outputname originator pic_p
@@ -3235,16 +4655,17 @@ test "$opt_mode" = install && func_mode_install ${1+"$@"}
 # a dlpreopen symbol table.
 func_generate_dlsyms ()
 {
-    $opt_debug
-    my_outputname="$1"
-    my_originator="$2"
-    my_pic_p="${3-no}"
-    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    $debug_cmd
+
+    my_outputname=$1
+    my_originator=$2
+    my_pic_p=${3-false}
+    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
     my_dlsyms=
 
-    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+    if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
       if test -n "$NM" && test -n "$global_symbol_pipe"; then
-       my_dlsyms="${my_outputname}S.c"
+       my_dlsyms=${my_outputname}S.c
       else
        func_error "not configured to extract global symbols from dlpreopened files"
       fi
@@ -3255,7 +4676,7 @@ func_generate_dlsyms ()
       "") ;;
       *.c)
        # Discover the nlist of each of the dlfiles.
-       nlist="$output_objdir/${my_outputname}.nm"
+       nlist=$output_objdir/$my_outputname.nm
 
        func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
 
@@ -3263,34 +4684,36 @@ func_generate_dlsyms ()
        func_verbose "creating $output_objdir/$my_dlsyms"
 
        $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
-/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
-/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
 
 #ifdef __cplusplus
 extern \"C\" {
 #endif
 
-#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
 #endif
 
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
    relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
-#elif defined(__osf__)
+#elif defined __osf__
 /* This system does not cope well with relocations in const data.  */
 # define LT_DLSYM_CONST
 #else
 # define LT_DLSYM_CONST const
 #endif
 
+#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
+
 /* External symbol declarations for the compiler. */\
 "
 
-       if test "$dlself" = yes; then
-         func_verbose "generating symbol list for \`$output'"
+       if test yes = "$dlself"; then
+         func_verbose "generating symbol list for '$output'"
 
          $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
@@ -3298,7 +4721,7 @@ extern \"C\" {
          progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
          for progfile in $progfiles; do
            func_to_tool_file "$progfile" func_convert_file_msys_to_w32
-           func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+           func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
            $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
          done
 
@@ -3318,10 +4741,10 @@ extern \"C\" {
 
          # Prepare the list of exported symbols
          if test -z "$export_symbols"; then
-           export_symbols="$output_objdir/$outputname.exp"
+           export_symbols=$output_objdir/$outputname.exp
            $opt_dry_run || {
              $RM $export_symbols
-             eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+             eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
              case $host in
              *cygwin* | *mingw* | *cegcc* )
                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
@@ -3331,7 +4754,7 @@ extern \"C\" {
            }
          else
            $opt_dry_run || {
-             eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+             eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
              eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
              eval '$MV "$nlist"T "$nlist"'
              case $host in
@@ -3345,22 +4768,22 @@ extern \"C\" {
        fi
 
        for dlprefile in $dlprefiles; do
-         func_verbose "extracting global C symbols from \`$dlprefile'"
+         func_verbose "extracting global C symbols from '$dlprefile'"
          func_basename "$dlprefile"
-         name="$func_basename_result"
+         name=$func_basename_result
           case $host in
            *cygwin* | *mingw* | *cegcc* )
              # if an import library, we need to obtain dlname
              if func_win32_import_lib_p "$dlprefile"; then
                func_tr_sh "$dlprefile"
                eval "curr_lafile=\$libfile_$func_tr_sh_result"
-               dlprefile_dlbasename=""
+               dlprefile_dlbasename=
                if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
                  # Use subshell, to avoid clobbering current variable values
                  dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
-                 if test -n "$dlprefile_dlname" ; then
+                 if test -n "$dlprefile_dlname"; then
                    func_basename "$dlprefile_dlname"
-                   dlprefile_dlbasename="$func_basename_result"
+                   dlprefile_dlbasename=$func_basename_result
                  else
                    # no lafile. user explicitly requested -dlpreopen <import library>.
                    $sharedlib_from_linklib_cmd "$dlprefile"
@@ -3368,7 +4791,7 @@ extern \"C\" {
                  fi
                fi
                $opt_dry_run || {
-                 if test -n "$dlprefile_dlbasename" ; then
+                 if test -n "$dlprefile_dlbasename"; then
                    eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
                  else
                    func_warning "Could not compute DLL name from $name"
@@ -3424,6 +4847,11 @@ extern \"C\" {
            echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
          fi
 
+         func_show_eval '$RM "${nlist}I"'
+         if test -n "$global_symbol_to_import"; then
+           eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
+         fi
+
          echo >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
@@ -3432,11 +4860,30 @@ typedef struct {
   void *address;
 } lt_dlsymlist;
 extern LT_DLSYM_CONST lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[];
+lt_${my_prefix}_LTX_preloaded_symbols[];\
+"
+
+         if test -s "$nlist"I; then
+           echo >> "$output_objdir/$my_dlsyms" "\
+static void lt_syminit(void)
+{
+  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
+  for (; symbol->name; ++symbol)
+    {"
+           $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
+           echo >> "$output_objdir/$my_dlsyms" "\
+    }
+}"
+         fi
+         echo >> "$output_objdir/$my_dlsyms" "\
 LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[] =
-{\
-  { \"$my_originator\", (void *) 0 },"
+{ {\"$my_originator\", (void *) 0},"
+
+         if test -s "$nlist"I; then
+           echo >> "$output_objdir/$my_dlsyms" "\
+  {\"@INIT@\", (void *) &lt_syminit},"
+         fi
 
          case $need_lib_prefix in
          no)
@@ -3478,9 +4925,7 @@ static const void *lt_preloaded_setup() {
          *-*-hpux*)
            pic_flag_for_symtable=" $pic_flag"  ;;
          *)
-           if test "X$my_pic_p" != Xno; then
-             pic_flag_for_symtable=" $pic_flag"
-           fi
+           $my_pic_p && pic_flag_for_symtable=" $pic_flag"
            ;;
          esac
          ;;
@@ -3497,10 +4942,10 @@ static const void *lt_preloaded_setup() {
        func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
 
        # Clean up the generated files.
-       func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+       func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
 
        # Transform the symbol file into the correct name.
-       symfileobj="$output_objdir/${my_outputname}S.$objext"
+       symfileobj=$output_objdir/${my_outputname}S.$objext
        case $host in
        *cygwin* | *mingw* | *cegcc* )
          if test -f "$output_objdir/$my_outputname.def"; then
@@ -3518,7 +4963,7 @@ static const void *lt_preloaded_setup() {
        esac
        ;;
       *)
-       func_fatal_error "unknown suffix for \`$my_dlsyms'"
+       func_fatal_error "unknown suffix for '$my_dlsyms'"
        ;;
       esac
     else
@@ -3532,6 +4977,32 @@ static const void *lt_preloaded_setup() {
     fi
 }
 
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $debug_cmd
+
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $debug_cmd
+
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
 # func_win32_libid arg
 # return the library type of file 'arg'
 #
@@ -3541,8 +5012,9 @@ static const void *lt_preloaded_setup() {
 # Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
-  $opt_debug
-  win32_libid_type="unknown"
+  $debug_cmd
+
+  win32_libid_type=unknown
   win32_fileres=`file -L $1 2>/dev/null`
   case $win32_fileres in
   *ar\ archive\ import\ library*) # definitely import
@@ -3552,16 +5024,29 @@ func_win32_libid ()
     # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
        $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
-      func_to_tool_file "$1" func_convert_file_msys_to_w32
-      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
-       $SED -n -e '
+      case $nm_interface in
+      "MS dumpbin")
+       if func_cygming_ms_implib_p "$1" ||
+          func_cygming_gnu_implib_p "$1"
+       then
+         win32_nmres=import
+       else
+         win32_nmres=
+       fi
+       ;;
+      *)
+       func_to_tool_file "$1" func_convert_file_msys_to_w32
+       win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+         $SED -n -e '
            1,100{
                / I /{
-                   s,.*,import,
+                   s|.*|import|
                    p
                    q
                }
            }'`
+       ;;
+      esac
       case $win32_nmres in
       import*)  win32_libid_type="x86 archive import";;
       *)        win32_libid_type="x86 archive static";;
@@ -3593,7 +5078,8 @@ func_win32_libid ()
 #    $sharedlib_from_linklib_result
 func_cygming_dll_for_implib ()
 {
-  $opt_debug
+  $debug_cmd
+
   sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
 }
 
@@ -3610,7 +5096,8 @@ func_cygming_dll_for_implib ()
 # specified import library.
 func_cygming_dll_for_implib_fallback_core ()
 {
-  $opt_debug
+  $debug_cmd
+
   match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
   $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
     $SED '/^Contents of section '"$match_literal"':/{
@@ -3646,8 +5133,8 @@ func_cygming_dll_for_implib_fallback_core ()
       /./p' |
     # we now have a list, one entry per line, of the stringified
     # contents of the appropriate section of all members of the
-    # archive which possess that section. Heuristic: eliminate
-    # all those which have a first or second character that is
+    # archive that possess that section. Heuristic: eliminate
+    # all those that have a first or second character that is
     # a '.' (that is, objdump's representation of an unprintable
     # character.) This should work for all archives with less than
     # 0x302f exports -- but will fail for DLLs whose name actually
@@ -3658,30 +5145,6 @@ func_cygming_dll_for_implib_fallback_core ()
     $SED -e '/^\./d;/^.\./d;q'
 }
 
-# func_cygming_gnu_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is a GNU/binutils-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_gnu_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
-  test -n "$func_cygming_gnu_implib_tmp"
-}
-
-# func_cygming_ms_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is an MS-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_ms_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
-  test -n "$func_cygming_ms_implib_tmp"
-}
-
 # func_cygming_dll_for_implib_fallback ARG
 # Platform-specific function to extract the
 # name of the DLL associated with the specified
@@ -3695,16 +5158,17 @@ func_cygming_ms_implib_p ()
 #    $sharedlib_from_linklib_result
 func_cygming_dll_for_implib_fallback ()
 {
-  $opt_debug
-  if func_cygming_gnu_implib_p "$1" ; then
+  $debug_cmd
+
+  if func_cygming_gnu_implib_p "$1"; then
     # binutils import library
     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
-  elif func_cygming_ms_implib_p "$1" ; then
+  elif func_cygming_ms_implib_p "$1"; then
     # ms-generated import library
     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
   else
     # unknown
-    sharedlib_from_linklib_result=""
+    sharedlib_from_linklib_result=
   fi
 }
 
@@ -3712,10 +5176,11 @@ func_cygming_dll_for_implib_fallback ()
 # func_extract_an_archive dir oldlib
 func_extract_an_archive ()
 {
-    $opt_debug
-    f_ex_an_ar_dir="$1"; shift
-    f_ex_an_ar_oldlib="$1"
-    if test "$lock_old_archive_extraction" = yes; then
+    $debug_cmd
+
+    f_ex_an_ar_dir=$1; shift
+    f_ex_an_ar_oldlib=$1
+    if test yes = "$lock_old_archive_extraction"; then
       lockfile=$f_ex_an_ar_oldlib.lock
       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
        func_echo "Waiting for $lockfile to be removed"
@@ -3724,7 +5189,7 @@ func_extract_an_archive ()
     fi
     func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
                   'stat=$?; rm -f "$lockfile"; exit $stat'
-    if test "$lock_old_archive_extraction" = yes; then
+    if test yes = "$lock_old_archive_extraction"; then
       $opt_dry_run || rm -f "$lockfile"
     fi
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
@@ -3738,22 +5203,23 @@ func_extract_an_archive ()
 # func_extract_archives gentop oldlib ...
 func_extract_archives ()
 {
-    $opt_debug
-    my_gentop="$1"; shift
+    $debug_cmd
+
+    my_gentop=$1; shift
     my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
+    my_oldobjs=
+    my_xlib=
+    my_xabs=
+    my_xdir=
 
     for my_xlib in $my_oldlibs; do
       # Extract the objects.
       case $my_xlib in
-       [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+       [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
        *) my_xabs=`pwd`"/$my_xlib" ;;
       esac
       func_basename "$my_xlib"
-      my_xlib="$func_basename_result"
+      my_xlib=$func_basename_result
       my_xlib_u=$my_xlib
       while :; do
         case " $extracted_archives " in
@@ -3765,7 +5231,7 @@ func_extract_archives ()
        esac
       done
       extracted_archives="$extracted_archives $my_xlib_u"
-      my_xdir="$my_gentop/$my_xlib_u"
+      my_xdir=$my_gentop/$my_xlib_u
 
       func_mkdir_p "$my_xdir"
 
@@ -3778,22 +5244,23 @@ func_extract_archives ()
          cd $my_xdir || exit $?
          darwin_archive=$my_xabs
          darwin_curdir=`pwd`
-         darwin_base_archive=`basename "$darwin_archive"`
+         func_basename "$darwin_archive"
+         darwin_base_archive=$func_basename_result
          darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
          if test -n "$darwin_arches"; then
            darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
            darwin_arch=
            func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
-           for darwin_arch in  $darwin_arches ; do
-             func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-             $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-             cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-             func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+           for darwin_arch in  $darwin_arches; do
+             func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
+             $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
+             cd "unfat-$$/$darwin_base_archive-$darwin_arch"
+             func_extract_an_archive "`pwd`" "$darwin_base_archive"
              cd "$darwin_curdir"
-             $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+             $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
            done # $darwin_arches
             ## Okay now we've a bunch of thin objects, gotta fatten them up :)
-           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
            darwin_file=
            darwin_files=
            for darwin_file in $darwin_filelist; do
@@ -3815,7 +5282,7 @@ func_extract_archives ()
       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
     done
 
-    func_extract_archives_result="$my_oldobjs"
+    func_extract_archives_result=$my_oldobjs
 }
 
 
@@ -3830,7 +5297,7 @@ func_extract_archives ()
 #
 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
 # variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
+# will assume that the directory where it is stored is
 # the $objdir directory.  This is a cygwin/mingw-specific
 # behavior.
 func_emit_wrapper ()
@@ -3841,7 +5308,7 @@ func_emit_wrapper ()
 #! $SHELL
 
 # $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 #
 # The $output program cannot be directly executed until all the libtool
 # libraries that it depends on are installed.
@@ -3898,9 +5365,9 @@ _LTECHO_EOF'
 
 # Very basic option parsing. These options are (a) specific to
 # the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
+# /script/ and the wrapper /executable/ that is used only on
 # windows platforms, and (c) all begin with the string "--lt-"
-# (application programs are unlikely to have options which match
+# (application programs are unlikely to have options that match
 # this pattern).
 #
 # There are only two supported options: --lt-debug and
@@ -3933,7 +5400,7 @@ func_parse_lt_options ()
 
   # Print the debug banner immediately:
   if test -n \"\$lt_option_debug\"; then
-    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
   fi
 }
 
@@ -3944,7 +5411,7 @@ func_lt_dump_args ()
   lt_dump_args_N=1;
   for lt_arg
   do
-    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
     lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
   done
 }
@@ -3958,7 +5425,7 @@ func_exec_program_core ()
   *-*-mingw | *-*-os2* | *-cegcc*)
     $ECHO "\
       if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
         func_lt_dump_args \${1+\"\$@\"} 1>&2
       fi
       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
@@ -3968,7 +5435,7 @@ func_exec_program_core ()
   *)
     $ECHO "\
       if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
         func_lt_dump_args \${1+\"\$@\"} 1>&2
       fi
       exec \"\$progdir/\$program\" \${1+\"\$@\"}
@@ -4043,13 +5510,13 @@ func_exec_program ()
   test -n \"\$absdir\" && thisdir=\"\$absdir\"
 "
 
-       if test "$fast_install" = yes; then
+       if test yes = "$fast_install"; then
          $ECHO "\
   program=lt-'$outputname'$exeext
   progdir=\"\$thisdir/$objdir\"
 
   if test ! -f \"\$progdir/\$program\" ||
-     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
 
     file=\"\$\$-\$program\"
@@ -4066,7 +5533,7 @@ func_exec_program ()
     if test -n \"\$relink_command\"; then
       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
       else
-       $ECHO \"\$relink_command_output\" >&2
+       \$ECHO \"\$relink_command_output\" >&2
        $RM \"\$progdir/\$file\"
        exit 1
       fi
@@ -4101,7 +5568,7 @@ func_exec_program ()
        fi
 
        # Export our shlibpath_var if we have one.
-       if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+       if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
          $ECHO "\
     # Add our own library path to $shlibpath_var
     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
@@ -4121,7 +5588,7 @@ func_exec_program ()
     fi
   else
     # The program doesn't exist.
-    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
     \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
@@ -4140,7 +5607,7 @@ func_emit_cwrapperexe_src ()
        cat <<EOF
 
 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
-   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+   Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 
    The $output program cannot be directly executed until all the libtool
    libraries that it depends on are installed.
@@ -4175,47 +5642,45 @@ EOF
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
+
 /* declarations of non-ANSI functions */
-#if defined(__MINGW32__)
+#if defined __MINGW32__
 # ifdef __STRICT_ANSI__
 int _putenv (const char *);
 # endif
-#elif defined(__CYGWIN__)
+#elif defined __CYGWIN__
 # ifdef __STRICT_ANSI__
 char *realpath (const char *, char *);
 int putenv (char *);
 int setenv (const char *, const char *, int);
 # endif
-/* #elif defined (other platforms) ... */
+/* #elif defined other_platform || defined ... */
 #endif
 
 /* portability defines, excluding path handling macros */
-#if defined(_MSC_VER)
+#if defined _MSC_VER
 # define setmode _setmode
 # define stat    _stat
 # define chmod   _chmod
 # define getcwd  _getcwd
 # define putenv  _putenv
 # define S_IXUSR _S_IEXEC
-# ifndef _INTPTR_T_DEFINED
-#  define _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#elif defined(__MINGW32__)
+#elif defined __MINGW32__
 # define setmode _setmode
 # define stat    _stat
 # define chmod   _chmod
 # define getcwd  _getcwd
 # define putenv  _putenv
-#elif defined(__CYGWIN__)
+#elif defined __CYGWIN__
 # define HAVE_SETENV
 # define FOPEN_WB "wb"
-/* #elif defined (other platforms) ... */
+/* #elif defined other platforms ... */
 #endif
 
-#if defined(PATH_MAX)
+#if defined PATH_MAX
 # define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
+#elif defined MAXPATHLEN
 # define LT_PATHMAX MAXPATHLEN
 #else
 # define LT_PATHMAX 1024
@@ -4234,8 +5699,8 @@ int setenv (const char *, const char *, int);
 # define PATH_SEPARATOR ':'
 #endif
 
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
+#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
+  defined __OS2__
 # define HAVE_DOS_BASED_FILE_SYSTEM
 # define FOPEN_WB "wb"
 # ifndef DIR_SEPARATOR_2
@@ -4268,10 +5733,10 @@ int setenv (const char *, const char *, int);
 
 #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 #define XFREE(stale) do { \
-  if (stale) { free ((void *) stale); stale = 0; } \
+  if (stale) { free (stale); stale = 0; } \
 } while (0)
 
-#if defined(LT_DEBUGWRAPPER)
+#if defined LT_DEBUGWRAPPER
 static int lt_debug = 1;
 #else
 static int lt_debug = 0;
@@ -4300,11 +5765,16 @@ void lt_dump_script (FILE *f);
 EOF
 
            cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+# define externally_visible volatile
+#else
+# define externally_visible __attribute__((externally_visible)) volatile
+#endif
+externally_visible const char * MAGIC_EXE = "$magic_exe";
 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF
 
-           if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+           if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
               func_to_host_path "$temp_rpath"
              cat <<EOF
 const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
@@ -4328,7 +5798,7 @@ const char * EXE_PATH_VALUE   = "";
 EOF
            fi
 
-           if test "$fast_install" = yes; then
+           if test yes = "$fast_install"; then
              cat <<EOF
 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
 EOF
@@ -4357,12 +5827,12 @@ main (int argc, char *argv[])
   char *actual_cwrapper_name;
   char *target_name;
   char *lt_argv_zero;
-  intptr_t rval = 127;
+  int rval = 127;
 
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  newargz = XMALLOC (char *, argc + 1);
+  newargz = XMALLOC (char *, (size_t) argc + 1);
 
   /* very simple arg parsing; don't want to rely on getopt
    * also, copy all non cwrapper options to newargz, except
@@ -4371,10 +5841,10 @@ main (int argc, char *argv[])
   newargc=0;
   for (i = 1; i < argc; i++)
     {
-      if (strcmp (argv[i], dumpscript_opt) == 0)
+      if (STREQ (argv[i], dumpscript_opt))
        {
 EOF
-           case "$host" in
+           case $host in
              *mingw* | *cygwin* )
                # make stdout use "unix" line endings
                echo "          setmode(1,_O_BINARY);"
@@ -4385,12 +5855,12 @@ EOF
          lt_dump_script (stdout);
          return 0;
        }
-      if (strcmp (argv[i], debug_opt) == 0)
+      if (STREQ (argv[i], debug_opt))
        {
           lt_debug = 1;
           continue;
        }
-      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+      if (STREQ (argv[i], ltwrapper_option_prefix))
         {
           /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
              namespace, but it is not one of the ones we know about and
@@ -4413,7 +5883,7 @@ EOF
 EOF
            cat <<EOF
   /* The GNU banner must be the first non-error debug message */
-  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
 EOF
            cat <<"EOF"
   lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
@@ -4524,7 +5994,7 @@ EOF
                cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
   newargz = prepare_spawn (newargz);
-  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
@@ -4569,7 +6039,7 @@ base_name (const char *name)
 {
   const char *base;
 
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
   /* Skip over the disk name in MSDOS pathnames. */
   if (isalpha ((unsigned char) name[0]) && name[1] == ':')
     name += 2;
@@ -4628,7 +6098,7 @@ find_executable (const char *wrapper)
   const char *p_next;
   /* static buffer for getcwd */
   char tmp[LT_PATHMAX + 1];
-  int tmp_len;
+  size_t tmp_len;
   char *concat_name;
 
   lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
@@ -4638,7 +6108,7 @@ find_executable (const char *wrapper)
     return NULL;
 
   /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
   if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
     {
       concat_name = xstrdup (wrapper);
@@ -4656,7 +6126,7 @@ find_executable (const char *wrapper)
            return concat_name;
          XFREE (concat_name);
        }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
     }
 #endif
 
@@ -4679,7 +6149,7 @@ find_executable (const char *wrapper)
              for (q = p; *q; q++)
                if (IS_PATH_SEPARATOR (*q))
                  break;
-             p_len = q - p;
+             p_len = (size_t) (q - p);
              p_next = (*q == '\0' ? q : q + 1);
              if (p_len == 0)
                {
@@ -4798,7 +6268,7 @@ strendzap (char *str, const char *pat)
   if (patlen <= len)
     {
       str += len - patlen;
-      if (strcmp (str, pat) == 0)
+      if (STREQ (str, pat))
        *str = '\0';
     }
   return str;
@@ -4863,7 +6333,7 @@ lt_setenv (const char *name, const char *value)
     char *str = xstrdup (value);
     setenv (name, str, 1);
 #else
-    int len = strlen (name) + 1 + strlen (value) + 1;
+    size_t len = strlen (name) + 1 + strlen (value) + 1;
     char *str = XMALLOC (char, len);
     sprintf (str, "%s=%s", name, value);
     if (putenv (str) != EXIT_SUCCESS)
@@ -4880,8 +6350,8 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
   char *new_value;
   if (orig_value && *orig_value)
     {
-      int orig_value_len = strlen (orig_value);
-      int add_len = strlen (add);
+      size_t orig_value_len = strlen (orig_value);
+      size_t add_len = strlen (add);
       new_value = XMALLOC (char, add_len + orig_value_len + 1);
       if (to_end)
         {
@@ -4912,10 +6382,10 @@ lt_update_exe_path (const char *name, const char *value)
     {
       char *new_value = lt_extend_str (getenv (name), value, 0);
       /* some systems can't cope with a ':'-terminated path #' */
-      int len = strlen (new_value);
-      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+      size_t len = strlen (new_value);
+      while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
         {
-          new_value[len-1] = '\0';
+          new_value[--len] = '\0';
         }
       lt_setenv (name, new_value);
       XFREE (new_value);
@@ -5082,27 +6552,47 @@ EOF
 # True if ARG is an import lib, as indicated by $file_magic_cmd
 func_win32_import_lib_p ()
 {
-    $opt_debug
+    $debug_cmd
+
     case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
     *import*) : ;;
     *) false ;;
     esac
 }
 
+# func_suncc_cstd_abi
+# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
+# Several compiler flags select an ABI that is incompatible with the
+# Cstd library. Avoid specifying it if any are in CXXFLAGS.
+func_suncc_cstd_abi ()
+{
+    $debug_cmd
+
+    case " $compile_command " in
+    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
+      suncc_use_cstd_abi=no
+      ;;
+    *)
+      suncc_use_cstd_abi=yes
+      ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
-    $opt_debug
+    $debug_cmd
+
     case $host in
     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
       # It is impossible to link a dll without this setting, and
       # we shouldn't force the makefile maintainer to figure out
-      # which system we are compiling for in order to pass an extra
+      # what system we are compiling for in order to pass an extra
       # flag for every libtool invocation.
       # allow_undefined=no
 
       # FIXME: Unfortunately, there are problems with the above when trying
-      # to make a dll which has undefined symbols, in which case not
+      # to make a dll that has undefined symbols, in which case not
       # even a static library is built.  For now, we need to specify
       # -no-undefined on the libtool link line when we can be certain
       # that all symbols are satisfied, otherwise we get a static library.
@@ -5146,10 +6636,11 @@ func_mode_link ()
     module=no
     no_install=no
     objs=
+    os2dllname=
     non_pic_objects=
     precious_files_regex=
     prefer_static_libs=no
-    preload=no
+    preload=false
     prev=
     prevarg=
     release=
@@ -5161,7 +6652,7 @@ func_mode_link ()
     vinfo=
     vinfo_number=no
     weak_libs=
-    single_module="${wl}-single_module"
+    single_module=$wl-single_module
     func_infer_tag $base_compile
 
     # We need to know -static, to get the right output filenames.
@@ -5169,15 +6660,15 @@ func_mode_link ()
     do
       case $arg in
       -shared)
-       test "$build_libtool_libs" != yes && \
-         func_fatal_configuration "can not build a shared library"
+       test yes != "$build_libtool_libs" \
+         && func_fatal_configuration "cannot build a shared library"
        build_old_libs=no
        break
        ;;
       -all-static | -static | -static-libtool-libs)
        case $arg in
        -all-static)
-         if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+         if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
            func_warning "complete static linking is impossible in this configuration"
          fi
          if test -n "$link_static_flag"; then
@@ -5210,7 +6701,7 @@ func_mode_link ()
 
     # Go through the arguments, transforming them on the way.
     while test "$#" -gt 0; do
-      arg="$1"
+      arg=$1
       shift
       func_quote_for_eval "$arg"
       qarg=$func_quote_for_eval_unquoted_result
@@ -5227,21 +6718,21 @@ func_mode_link ()
 
        case $prev in
        bindir)
-         bindir="$arg"
+         bindir=$arg
          prev=
          continue
          ;;
        dlfiles|dlprefiles)
-         if test "$preload" = no; then
+         $preload || {
            # Add the symbol object into the linking commands.
            func_append compile_command " @SYMFILE@"
            func_append finalize_command " @SYMFILE@"
-           preload=yes
-         fi
+           preload=:
+         }
          case $arg in
          *.la | *.lo) ;;  # We handle these cases below.
          force)
-           if test "$dlself" = no; then
+           if test no = "$dlself"; then
              dlself=needless
              export_dynamic=yes
            fi
@@ -5249,9 +6740,9 @@ func_mode_link ()
            continue
            ;;
          self)
-           if test "$prev" = dlprefiles; then
+           if test dlprefiles = "$prev"; then
              dlself=yes
-           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+           elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
              dlself=yes
            else
              dlself=needless
@@ -5261,7 +6752,7 @@ func_mode_link ()
            continue
            ;;
          *)
-           if test "$prev" = dlfiles; then
+           if test dlfiles = "$prev"; then
              func_append dlfiles " $arg"
            else
              func_append dlprefiles " $arg"
@@ -5272,14 +6763,14 @@ func_mode_link ()
          esac
          ;;
        expsyms)
-         export_symbols="$arg"
+         export_symbols=$arg
          test -f "$arg" \
-           || func_fatal_error "symbol file \`$arg' does not exist"
+           || func_fatal_error "symbol file '$arg' does not exist"
          prev=
          continue
          ;;
        expsyms_regex)
-         export_symbols_regex="$arg"
+         export_symbols_regex=$arg
          prev=
          continue
          ;;
@@ -5297,7 +6788,13 @@ func_mode_link ()
          continue
          ;;
        inst_prefix)
-         inst_prefix_dir="$arg"
+         inst_prefix_dir=$arg
+         prev=
+         continue
+         ;;
+       mllvm)
+         # Clang does not use LLVM to link, so we can simply discard any
+         # '-mllvm $arg' options when doing the link step.
          prev=
          continue
          ;;
@@ -5321,21 +6818,21 @@ func_mode_link ()
 
                if test -z "$pic_object" ||
                   test -z "$non_pic_object" ||
-                  test "$pic_object" = none &&
-                  test "$non_pic_object" = none; then
-                 func_fatal_error "cannot find name of object for \`$arg'"
+                  test none = "$pic_object" &&
+                  test none = "$non_pic_object"; then
+                 func_fatal_error "cannot find name of object for '$arg'"
                fi
 
                # Extract subdirectory from the argument.
                func_dirname "$arg" "/" ""
-               xdir="$func_dirname_result"
+               xdir=$func_dirname_result
 
-               if test "$pic_object" != none; then
+               if test none != "$pic_object"; then
                  # Prepend the subdirectory the object is found in.
-                 pic_object="$xdir$pic_object"
+                 pic_object=$xdir$pic_object
 
-                 if test "$prev" = dlfiles; then
-                   if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+                 if test dlfiles = "$prev"; then
+                   if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
                      func_append dlfiles " $pic_object"
                      prev=
                      continue
@@ -5346,7 +6843,7 @@ func_mode_link ()
                  fi
 
                  # CHECK ME:  I think I busted this.  -Ossama
-                 if test "$prev" = dlprefiles; then
+                 if test dlprefiles = "$prev"; then
                    # Preload the old-style object.
                    func_append dlprefiles " $pic_object"
                    prev=
@@ -5354,23 +6851,23 @@ func_mode_link ()
 
                  # A PIC object.
                  func_append libobjs " $pic_object"
-                 arg="$pic_object"
+                 arg=$pic_object
                fi
 
                # Non-PIC object.
-               if test "$non_pic_object" != none; then
+               if test none != "$non_pic_object"; then
                  # Prepend the subdirectory the object is found in.
-                 non_pic_object="$xdir$non_pic_object"
+                 non_pic_object=$xdir$non_pic_object
 
                  # A standard non-PIC object
                  func_append non_pic_objects " $non_pic_object"
-                 if test -z "$pic_object" || test "$pic_object" = none ; then
-                   arg="$non_pic_object"
+                 if test -z "$pic_object" || test none = "$pic_object"; then
+                   arg=$non_pic_object
                  fi
                else
                  # If the PIC object exists, use it instead.
                  # $xdir was prepended to $pic_object above.
-                 non_pic_object="$pic_object"
+                 non_pic_object=$pic_object
                  func_append non_pic_objects " $non_pic_object"
                fi
              else
@@ -5378,7 +6875,7 @@ func_mode_link ()
                if $opt_dry_run; then
                  # Extract subdirectory from the argument.
                  func_dirname "$arg" "/" ""
-                 xdir="$func_dirname_result"
+                 xdir=$func_dirname_result
 
                  func_lo2o "$arg"
                  pic_object=$xdir$objdir/$func_lo2o_result
@@ -5386,24 +6883,29 @@ func_mode_link ()
                  func_append libobjs " $pic_object"
                  func_append non_pic_objects " $non_pic_object"
                else
-                 func_fatal_error "\`$arg' is not a valid libtool object"
+                 func_fatal_error "'$arg' is not a valid libtool object"
                fi
              fi
            done
          else
-           func_fatal_error "link input file \`$arg' does not exist"
+           func_fatal_error "link input file '$arg' does not exist"
          fi
          arg=$save_arg
          prev=
          continue
          ;;
+       os2dllname)
+         os2dllname=$arg
+         prev=
+         continue
+         ;;
        precious_regex)
-         precious_files_regex="$arg"
+         precious_files_regex=$arg
          prev=
          continue
          ;;
        release)
-         release="-$arg"
+         release=-$arg
          prev=
          continue
          ;;
@@ -5415,7 +6917,7 @@ func_mode_link ()
            func_fatal_error "only absolute run-paths are allowed"
            ;;
          esac
-         if test "$prev" = rpath; then
+         if test rpath = "$prev"; then
            case "$rpath " in
            *" $arg "*) ;;
            *) func_append rpath " $arg" ;;
@@ -5430,7 +6932,7 @@ func_mode_link ()
          continue
          ;;
        shrext)
-         shrext_cmds="$arg"
+         shrext_cmds=$arg
          prev=
          continue
          ;;
@@ -5470,7 +6972,7 @@ func_mode_link ()
        esac
       fi # test -n "$prev"
 
-      prevarg="$arg"
+      prevarg=$arg
 
       case $arg in
       -all-static)
@@ -5484,7 +6986,7 @@ func_mode_link ()
 
       -allow-undefined)
        # FIXME: remove this flag sometime in the future.
-       func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+       func_fatal_error "'-allow-undefined' must not be used because it is the default"
        ;;
 
       -avoid-version)
@@ -5516,7 +7018,7 @@ func_mode_link ()
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
          func_fatal_error "more than one -exported-symbols argument is not allowed"
        fi
-       if test "X$arg" = "X-export-symbols"; then
+       if test X-export-symbols = "X$arg"; then
          prev=expsyms
        else
          prev=expsyms_regex
@@ -5550,9 +7052,9 @@ func_mode_link ()
        func_stripname "-L" '' "$arg"
        if test -z "$func_stripname_result"; then
          if test "$#" -gt 0; then
-           func_fatal_error "require no space between \`-L' and \`$1'"
+           func_fatal_error "require no space between '-L' and '$1'"
          else
-           func_fatal_error "need path for \`-L' option"
+           func_fatal_error "need path for '-L' option"
          fi
        fi
        func_resolve_sysroot "$func_stripname_result"
@@ -5563,8 +7065,8 @@ func_mode_link ()
        *)
          absdir=`cd "$dir" && pwd`
          test -z "$absdir" && \
-           func_fatal_error "cannot determine absolute directory name of \`$dir'"
-         dir="$absdir"
+           func_fatal_error "cannot determine absolute directory name of '$dir'"
+         dir=$absdir
          ;;
        esac
        case "$deplibs " in
@@ -5599,7 +7101,7 @@ func_mode_link ()
        ;;
 
       -l*)
-       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+       if test X-lc = "X$arg" || test X-lm = "X$arg"; then
          case $host in
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
            # These systems don't actually have a C or math library (as such)
@@ -5607,11 +7109,11 @@ func_mode_link ()
            ;;
          *-*-os2*)
            # These systems don't actually have a C library (as such)
-           test "X$arg" = "X-lc" && continue
+           test X-lc = "X$arg" && continue
            ;;
-         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
            # Do not include libc due to us having libc/libc_r.
-           test "X$arg" = "X-lc" && continue
+           test X-lc = "X$arg" && continue
            ;;
          *-*-rhapsody* | *-*-darwin1.[012])
            # Rhapsody C and math libraries are in the System framework
@@ -5620,16 +7122,16 @@ func_mode_link ()
            ;;
          *-*-sco3.2v5* | *-*-sco5v6*)
            # Causes problems with __ctype
-           test "X$arg" = "X-lc" && continue
+           test X-lc = "X$arg" && continue
            ;;
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
            # Compiler inserts libc in the correct place for threads to work
-           test "X$arg" = "X-lc" && continue
+           test X-lc = "X$arg" && continue
            ;;
          esac
-       elif test "X$arg" = "X-lc_r"; then
+       elif test X-lc_r = "X$arg"; then
         case $host in
-        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
           # Do not include libc_r directly, use -pthread flag.
           continue
           ;;
@@ -5639,6 +7141,11 @@ func_mode_link ()
        continue
        ;;
 
+      -mllvm)
+       prev=mllvm
+       continue
+       ;;
+
       -module)
        module=yes
        continue
@@ -5668,7 +7175,7 @@ func_mode_link ()
        ;;
 
       -multi_module)
-       single_module="${wl}-multi_module"
+       single_module=$wl-multi_module
        continue
        ;;
 
@@ -5682,8 +7189,8 @@ func_mode_link ()
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
          # The PATH hackery in wrapper scripts is required on Windows
          # and Darwin in order for the loader to find any dlls it needs.
-         func_warning "\`-no-install' is ignored for $host"
-         func_warning "assuming \`-no-fast-install' instead"
+         func_warning "'-no-install' is ignored for $host"
+         func_warning "assuming '-no-fast-install' instead"
          fast_install=no
          ;;
        *) no_install=yes ;;
@@ -5701,6 +7208,11 @@ func_mode_link ()
        continue
        ;;
 
+      -os2dllname)
+       prev=os2dllname
+       continue
+       ;;
+
       -o) prev=output ;;
 
       -precious-files-regex)
@@ -5788,14 +7300,14 @@ func_mode_link ()
        func_stripname '-Wc,' '' "$arg"
        args=$func_stripname_result
        arg=
-       save_ifs="$IFS"; IFS=','
+       save_ifs=$IFS; IFS=,
        for flag in $args; do
-         IFS="$save_ifs"
+         IFS=$save_ifs
           func_quote_for_eval "$flag"
          func_append arg " $func_quote_for_eval_result"
          func_append compiler_flags " $func_quote_for_eval_result"
        done
-       IFS="$save_ifs"
+       IFS=$save_ifs
        func_stripname ' ' '' "$arg"
        arg=$func_stripname_result
        ;;
@@ -5804,15 +7316,15 @@ func_mode_link ()
        func_stripname '-Wl,' '' "$arg"
        args=$func_stripname_result
        arg=
-       save_ifs="$IFS"; IFS=','
+       save_ifs=$IFS; IFS=,
        for flag in $args; do
-         IFS="$save_ifs"
+         IFS=$save_ifs
           func_quote_for_eval "$flag"
          func_append arg " $wl$func_quote_for_eval_result"
          func_append compiler_flags " $wl$func_quote_for_eval_result"
          func_append linker_flags " $func_quote_for_eval_result"
        done
-       IFS="$save_ifs"
+       IFS=$save_ifs
        func_stripname ' ' '' "$arg"
        arg=$func_stripname_result
        ;;
@@ -5835,7 +7347,7 @@ func_mode_link ()
       # -msg_* for osf cc
       -msg_*)
        func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
+       arg=$func_quote_for_eval_result
        ;;
 
       # Flags to be passed through unchanged, with rationale:
@@ -5847,25 +7359,52 @@ func_mode_link ()
       # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
       # -F/path              path to uninstalled frameworks, gcc on darwin
       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # -fstack-protector*   stack protector flags for GCC
       # @file                GCC response files
       # -tp=*                Portland pgcc target processor selection
       # --sysroot=*          for sysroot support
-      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -specs=*             GCC specs files
+      # -stdlib=*            select c++ std lib with clang
+      # -fsanitize=*         Clang/GCC memory and address sanitizer
+      # -fuse-ld=*           Linker select flags for GCC
+      # -static-*            direct GCC to link specific libraries statically
+      # -fcilkplus           Cilk Plus language extension features for C/C++
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+      -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
         func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
+       arg=$func_quote_for_eval_result
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
         func_append compiler_flags " $arg"
         continue
         ;;
 
+      -Z*)
+        if test os2 = "`expr $host : '.*\(os2\)'`"; then
+          # OS/2 uses -Zxxx to specify OS/2-specific options
+         compiler_flags="$compiler_flags $arg"
+         func_append compile_command " $arg"
+         func_append finalize_command " $arg"
+         case $arg in
+         -Zlinker | -Zstack)
+           prev=xcompiler
+           ;;
+         esac
+         continue
+        else
+         # Otherwise treat like 'Some other compiler flag' below
+         func_quote_for_eval "$arg"
+         arg=$func_quote_for_eval_result
+        fi
+       ;;
+
       # Some other compiler flag.
       -* | +*)
         func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
+       arg=$func_quote_for_eval_result
        ;;
 
       *.$objext)
@@ -5886,21 +7425,21 @@ func_mode_link ()
 
          if test -z "$pic_object" ||
             test -z "$non_pic_object" ||
-            test "$pic_object" = none &&
-            test "$non_pic_object" = none; then
-           func_fatal_error "cannot find name of object for \`$arg'"
+            test none = "$pic_object" &&
+            test none = "$non_pic_object"; then
+           func_fatal_error "cannot find name of object for '$arg'"
          fi
 
          # Extract subdirectory from the argument.
          func_dirname "$arg" "/" ""
-         xdir="$func_dirname_result"
+         xdir=$func_dirname_result
 
-         if test "$pic_object" != none; then
+         test none = "$pic_object" || {
            # Prepend the subdirectory the object is found in.
-           pic_object="$xdir$pic_object"
+           pic_object=$xdir$pic_object
 
-           if test "$prev" = dlfiles; then
-             if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+           if test dlfiles = "$prev"; then
+             if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
                func_append dlfiles " $pic_object"
                prev=
                continue
@@ -5911,7 +7450,7 @@ func_mode_link ()
            fi
 
            # CHECK ME:  I think I busted this.  -Ossama
-           if test "$prev" = dlprefiles; then
+           if test dlprefiles = "$prev"; then
              # Preload the old-style object.
              func_append dlprefiles " $pic_object"
              prev=
@@ -5919,23 +7458,23 @@ func_mode_link ()
 
            # A PIC object.
            func_append libobjs " $pic_object"
-           arg="$pic_object"
-         fi
+           arg=$pic_object
+         }
 
          # Non-PIC object.
-         if test "$non_pic_object" != none; then
+         if test none != "$non_pic_object"; then
            # Prepend the subdirectory the object is found in.
-           non_pic_object="$xdir$non_pic_object"
+           non_pic_object=$xdir$non_pic_object
 
            # A standard non-PIC object
            func_append non_pic_objects " $non_pic_object"
-           if test -z "$pic_object" || test "$pic_object" = none ; then
-             arg="$non_pic_object"
+           if test -z "$pic_object" || test none = "$pic_object"; then
+             arg=$non_pic_object
            fi
          else
            # If the PIC object exists, use it instead.
            # $xdir was prepended to $pic_object above.
-           non_pic_object="$pic_object"
+           non_pic_object=$pic_object
            func_append non_pic_objects " $non_pic_object"
          fi
        else
@@ -5943,7 +7482,7 @@ func_mode_link ()
          if $opt_dry_run; then
            # Extract subdirectory from the argument.
            func_dirname "$arg" "/" ""
-           xdir="$func_dirname_result"
+           xdir=$func_dirname_result
 
            func_lo2o "$arg"
            pic_object=$xdir$objdir/$func_lo2o_result
@@ -5951,7 +7490,7 @@ func_mode_link ()
            func_append libobjs " $pic_object"
            func_append non_pic_objects " $non_pic_object"
          else
-           func_fatal_error "\`$arg' is not a valid libtool object"
+           func_fatal_error "'$arg' is not a valid libtool object"
          fi
        fi
        ;;
@@ -5967,11 +7506,11 @@ func_mode_link ()
        # A libtool-controlled library.
 
        func_resolve_sysroot "$arg"
-       if test "$prev" = dlfiles; then
+       if test dlfiles = "$prev"; then
          # This library was specified with -dlopen.
          func_append dlfiles " $func_resolve_sysroot_result"
          prev=
-       elif test "$prev" = dlprefiles; then
+       elif test dlprefiles = "$prev"; then
          # The library was specified with -dlpreopen.
          func_append dlprefiles " $func_resolve_sysroot_result"
          prev=
@@ -5986,7 +7525,7 @@ func_mode_link ()
        # Unknown arguments in both finalize_command and compile_command need
        # to be aesthetically quoted because they are evaled later.
        func_quote_for_eval "$arg"
-       arg="$func_quote_for_eval_result"
+       arg=$func_quote_for_eval_result
        ;;
       esac # arg
 
@@ -5998,9 +7537,9 @@ func_mode_link ()
     done # argument parsing loop
 
     test -n "$prev" && \
-      func_fatal_help "the \`$prevarg' option requires an argument"
+      func_fatal_help "the '$prevarg' option requires an argument"
 
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+    if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
       eval arg=\"$export_dynamic_flag_spec\"
       func_append compile_command " $arg"
       func_append finalize_command " $arg"
@@ -6009,20 +7548,23 @@ func_mode_link ()
     oldlibs=
     # calculate the name of the file, without its directory
     func_basename "$output"
-    outputname="$func_basename_result"
-    libobjs_save="$libobjs"
+    outputname=$func_basename_result
+    libobjs_save=$libobjs
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 
+    # Definition is injected by LT_CONFIG during libtool generation.
+    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
+
     func_dirname "$output" "/" ""
-    output_objdir="$func_dirname_result$objdir"
+    output_objdir=$func_dirname_result$objdir
     func_to_tool_file "$output_objdir/"
     tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
@@ -6045,7 +7587,7 @@ func_mode_link ()
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
     for deplib in $deplibs; do
-      if $opt_preserve_dup_deps ; then
+      if $opt_preserve_dup_deps; then
        case "$libs " in
        *" $deplib "*) func_append specialdeplibs " $deplib" ;;
        esac
@@ -6053,7 +7595,7 @@ func_mode_link ()
       func_append libs " $deplib"
     done
 
-    if test "$linkmode" = lib; then
+    if test lib = "$linkmode"; then
       libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
       # Compute libraries that are listed more than once in $predeps
@@ -6085,7 +7627,7 @@ func_mode_link ()
          case $file in
          *.la) ;;
          *)
-           func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+           func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
            ;;
          esac
        done
@@ -6093,7 +7635,7 @@ func_mode_link ()
     prog)
        compile_deplibs=
        finalize_deplibs=
-       alldeplibs=no
+       alldeplibs=false
        newdlfiles=
        newdlprefiles=
        passes="conv scan dlopen dlpreopen link"
@@ -6105,32 +7647,32 @@ func_mode_link ()
     for pass in $passes; do
       # The preopen pass in lib mode reverses $deplibs; put it back here
       # so that -L comes before libs that need it for instance...
-      if test "$linkmode,$pass" = "lib,link"; then
+      if test lib,link = "$linkmode,$pass"; then
        ## FIXME: Find the place where the list is rebuilt in the wrong
        ##        order, and fix it there properly
         tmp_deplibs=
        for deplib in $deplibs; do
          tmp_deplibs="$deplib $tmp_deplibs"
        done
-       deplibs="$tmp_deplibs"
+       deplibs=$tmp_deplibs
       fi
 
-      if test "$linkmode,$pass" = "lib,link" ||
-        test "$linkmode,$pass" = "prog,scan"; then
-       libs="$deplibs"
+      if test lib,link = "$linkmode,$pass" ||
+        test prog,scan = "$linkmode,$pass"; then
+       libs=$deplibs
        deplibs=
       fi
-      if test "$linkmode" = prog; then
+      if test prog = "$linkmode"; then
        case $pass in
-       dlopen) libs="$dlfiles" ;;
-       dlpreopen) libs="$dlprefiles" ;;
+       dlopen) libs=$dlfiles ;;
+       dlpreopen) libs=$dlprefiles ;;
        link)
          libs="$deplibs %DEPLIBS%"
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
          ;;
        esac
       fi
-      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+      if test lib,dlpreopen = "$linkmode,$pass"; then
        # Collect and forward deplibs of preopened libtool libs
        for lib in $dlprefiles; do
          # Ignore non-libtool-libs
@@ -6151,26 +7693,26 @@ func_mode_link ()
            esac
          done
        done
-       libs="$dlprefiles"
+       libs=$dlprefiles
       fi
-      if test "$pass" = dlopen; then
+      if test dlopen = "$pass"; then
        # Collect dlpreopened libraries
-       save_deplibs="$deplibs"
+       save_deplibs=$deplibs
        deplibs=
       fi
 
       for deplib in $libs; do
        lib=
-       found=no
+       found=false
        case $deplib in
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-         if test "$linkmode,$pass" = "prog,link"; then
+         if test prog,link = "$linkmode,$pass"; then
            compile_deplibs="$deplib $compile_deplibs"
            finalize_deplibs="$deplib $finalize_deplibs"
          else
            func_append compiler_flags " $deplib"
-           if test "$linkmode" = lib ; then
+           if test lib = "$linkmode"; then
                case "$new_inherited_linker_flags " in
                    *" $deplib "*) ;;
                    * ) func_append new_inherited_linker_flags " $deplib" ;;
@@ -6180,13 +7722,13 @@ func_mode_link ()
          continue
          ;;
        -l*)
-         if test "$linkmode" != lib && test "$linkmode" != prog; then
-           func_warning "\`-l' is ignored for archives/objects"
+         if test lib != "$linkmode" && test prog != "$linkmode"; then
+           func_warning "'-l' is ignored for archives/objects"
            continue
          fi
          func_stripname '-l' '' "$deplib"
          name=$func_stripname_result
-         if test "$linkmode" = lib; then
+         if test lib = "$linkmode"; then
            searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
          else
            searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
@@ -6194,31 +7736,22 @@ func_mode_link ()
          for searchdir in $searchdirs; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
-             lib="$searchdir/lib${name}${search_ext}"
+             lib=$searchdir/lib$name$search_ext
              if test -f "$lib"; then
-               if test "$search_ext" = ".la"; then
-                 found=yes
+               if test .la = "$search_ext"; then
+                 found=:
                else
-                 found=no
+                 found=false
                fi
                break 2
              fi
            done
          done
-         if test "$found" != yes; then
-           # deplib doesn't seem to be a libtool library
-           if test "$linkmode,$pass" = "prog,link"; then
-             compile_deplibs="$deplib $compile_deplibs"
-             finalize_deplibs="$deplib $finalize_deplibs"
-           else
-             deplibs="$deplib $deplibs"
-             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-           fi
-           continue
-         else # deplib is a libtool library
+         if $found; then
+           # deplib is a libtool library
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
            # We need to do some special things here, and not later.
-           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+           if test yes = "$allow_libtool_libs_with_static_runtimes"; then
              case " $predeps $postdeps " in
              *" $deplib "*)
                if func_lalib_p "$lib"; then
@@ -6226,19 +7759,19 @@ func_mode_link ()
                  old_library=
                  func_source "$lib"
                  for l in $old_library $library_names; do
-                   ll="$l"
+                   ll=$l
                  done
-                 if test "X$ll" = "X$old_library" ; then # only static version available
-                   found=no
+                 if test "X$ll" = "X$old_library"; then # only static version available
+                   found=false
                    func_dirname "$lib" "" "."
-                   ladir="$func_dirname_result"
+                   ladir=$func_dirname_result
                    lib=$ladir/$old_library
-                   if test "$linkmode,$pass" = "prog,link"; then
+                   if test prog,link = "$linkmode,$pass"; then
                      compile_deplibs="$deplib $compile_deplibs"
                      finalize_deplibs="$deplib $finalize_deplibs"
                    else
                      deplibs="$deplib $deplibs"
-                     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+                     test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
                    fi
                    continue
                  fi
@@ -6247,15 +7780,25 @@ func_mode_link ()
              *) ;;
              esac
            fi
+         else
+           # deplib doesn't seem to be a libtool library
+           if test prog,link = "$linkmode,$pass"; then
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             deplibs="$deplib $deplibs"
+             test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
+           fi
+           continue
          fi
          ;; # -l
        *.ltframework)
-         if test "$linkmode,$pass" = "prog,link"; then
+         if test prog,link = "$linkmode,$pass"; then
            compile_deplibs="$deplib $compile_deplibs"
            finalize_deplibs="$deplib $finalize_deplibs"
          else
            deplibs="$deplib $deplibs"
-           if test "$linkmode" = lib ; then
+           if test lib = "$linkmode"; then
                case "$new_inherited_linker_flags " in
                    *" $deplib "*) ;;
                    * ) func_append new_inherited_linker_flags " $deplib" ;;
@@ -6268,18 +7811,18 @@ func_mode_link ()
          case $linkmode in
          lib)
            deplibs="$deplib $deplibs"
-           test "$pass" = conv && continue
+           test conv = "$pass" && continue
            newdependency_libs="$deplib $newdependency_libs"
            func_stripname '-L' '' "$deplib"
            func_resolve_sysroot "$func_stripname_result"
            func_append newlib_search_path " $func_resolve_sysroot_result"
            ;;
          prog)
-           if test "$pass" = conv; then
+           if test conv = "$pass"; then
              deplibs="$deplib $deplibs"
              continue
            fi
-           if test "$pass" = scan; then
+           if test scan = "$pass"; then
              deplibs="$deplib $deplibs"
            else
              compile_deplibs="$deplib $compile_deplibs"
@@ -6290,13 +7833,13 @@ func_mode_link ()
            func_append newlib_search_path " $func_resolve_sysroot_result"
            ;;
          *)
-           func_warning "\`-L' is ignored for archives/objects"
+           func_warning "'-L' is ignored for archives/objects"
            ;;
          esac # linkmode
          continue
          ;; # -L
        -R*)
-         if test "$pass" = link; then
+         if test link = "$pass"; then
            func_stripname '-R' '' "$deplib"
            func_resolve_sysroot "$func_stripname_result"
            dir=$func_resolve_sysroot_result
@@ -6314,7 +7857,7 @@ func_mode_link ()
          lib=$func_resolve_sysroot_result
          ;;
        *.$libext)
-         if test "$pass" = conv; then
+         if test conv = "$pass"; then
            deplibs="$deplib $deplibs"
            continue
          fi
@@ -6325,21 +7868,26 @@ func_mode_link ()
            case " $dlpreconveniencelibs " in
            *" $deplib "*) ;;
            *)
-             valid_a_lib=no
+             valid_a_lib=false
              case $deplibs_check_method in
                match_pattern*)
                  set dummy $deplibs_check_method; shift
                  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
                  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
                    | $EGREP "$match_pattern_regex" > /dev/null; then
-                   valid_a_lib=yes
+                   valid_a_lib=:
                  fi
                ;;
                pass_all)
-                 valid_a_lib=yes
+                 valid_a_lib=:
                ;;
              esac
-             if test "$valid_a_lib" != yes; then
+             if $valid_a_lib; then
+               echo
+               $ECHO "*** Warning: Linking the shared library $output against the"
+               $ECHO "*** static library $deplib is not portable!"
+               deplibs="$deplib $deplibs"
+             else
                echo
                $ECHO "*** Warning: Trying to link with static lib archive $deplib."
                echo "*** I have the capability to make that library automatically link in when"
@@ -6347,18 +7895,13 @@ func_mode_link ()
                echo "*** shared version of the library, which you do not appear to have"
                echo "*** because the file extensions .$libext of this argument makes me believe"
                echo "*** that it is just a static archive that I should not use here."
-             else
-               echo
-               $ECHO "*** Warning: Linking the shared library $output against the"
-               $ECHO "*** static library $deplib is not portable!"
-               deplibs="$deplib $deplibs"
              fi
              ;;
            esac
            continue
            ;;
          prog)
-           if test "$pass" != link; then
+           if test link != "$pass"; then
              deplibs="$deplib $deplibs"
            else
              compile_deplibs="$deplib $compile_deplibs"
@@ -6369,10 +7912,10 @@ func_mode_link ()
          esac # linkmode
          ;; # *.$libext
        *.lo | *.$objext)
-         if test "$pass" = conv; then
+         if test conv = "$pass"; then
            deplibs="$deplib $deplibs"
-         elif test "$linkmode" = prog; then
-           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+         elif test prog = "$linkmode"; then
+           if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
              # If there is no dlopen support or we're linking statically,
              # we need to preload.
              func_append newdlprefiles " $deplib"
@@ -6385,22 +7928,20 @@ func_mode_link ()
          continue
          ;;
        %DEPLIBS%)
-         alldeplibs=yes
+         alldeplibs=:
          continue
          ;;
        esac # case $deplib
 
-       if test "$found" = yes || test -f "$lib"; then :
-       else
-         func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
-       fi
+       $found || test -f "$lib" \
+         || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
 
        # Check to see that this really is a libtool archive.
        func_lalib_unsafe_p "$lib" \
-         || func_fatal_error "\`$lib' is not a valid libtool archive"
+         || func_fatal_error "'$lib' is not a valid libtool archive"
 
        func_dirname "$lib" "" "."
-       ladir="$func_dirname_result"
+       ladir=$func_dirname_result
 
        dlname=
        dlopen=
@@ -6430,19 +7971,19 @@ func_mode_link ()
          done
        fi
        dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-       if test "$linkmode,$pass" = "lib,link" ||
-          test "$linkmode,$pass" = "prog,scan" ||
-          { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+       if test lib,link = "$linkmode,$pass" ||
+          test prog,scan = "$linkmode,$pass" ||
+          { test prog != "$linkmode" && test lib != "$linkmode"; }; then
          test -n "$dlopen" && func_append dlfiles " $dlopen"
          test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
        fi
 
-       if test "$pass" = conv; then
+       if test conv = "$pass"; then
          # Only check for convenience libraries
          deplibs="$lib $deplibs"
          if test -z "$libdir"; then
            if test -z "$old_library"; then
-             func_fatal_error "cannot find name of link library for \`$lib'"
+             func_fatal_error "cannot find name of link library for '$lib'"
            fi
            # It is a libtool convenience library, so add in its objects.
            func_append convenience " $ladir/$objdir/$old_library"
@@ -6450,15 +7991,15 @@ func_mode_link ()
            tmp_libs=
            for deplib in $dependency_libs; do
              deplibs="$deplib $deplibs"
-             if $opt_preserve_dup_deps ; then
+             if $opt_preserve_dup_deps; then
                case "$tmp_libs " in
                *" $deplib "*) func_append specialdeplibs " $deplib" ;;
                esac
              fi
              func_append tmp_libs " $deplib"
            done
-         elif test "$linkmode" != prog && test "$linkmode" != lib; then
-           func_fatal_error "\`$lib' is not a convenience library"
+         elif test prog != "$linkmode" && test lib != "$linkmode"; then
+           func_fatal_error "'$lib' is not a convenience library"
          fi
          continue
        fi # $pass = conv
@@ -6467,26 +8008,26 @@ func_mode_link ()
        # Get the name of the library we link against.
        linklib=
        if test -n "$old_library" &&
-          { test "$prefer_static_libs" = yes ||
-            test "$prefer_static_libs,$installed" = "built,no"; }; then
+          { test yes = "$prefer_static_libs" ||
+            test built,no = "$prefer_static_libs,$installed"; }; then
          linklib=$old_library
        else
          for l in $old_library $library_names; do
-           linklib="$l"
+           linklib=$l
          done
        fi
        if test -z "$linklib"; then
-         func_fatal_error "cannot find name of link library for \`$lib'"
+         func_fatal_error "cannot find name of link library for '$lib'"
        fi
 
        # This library was specified with -dlopen.
-       if test "$pass" = dlopen; then
-         if test -z "$libdir"; then
-           func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
-         fi
+       if test dlopen = "$pass"; then
+         test -z "$libdir" \
+           && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
          if test -z "$dlname" ||
-            test "$dlopen_support" != yes ||
-            test "$build_libtool_libs" = no; then
+            test yes != "$dlopen_support" ||
+            test no = "$build_libtool_libs"
+         then
            # If there is no dlname, no dlopen support or we're linking
            # statically, we need to preload.  We also need to preload any
            # dependent libraries so libltdl's deplib preloader doesn't
@@ -6500,40 +8041,40 @@ func_mode_link ()
 
        # We need an absolute path.
        case $ladir in
-       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
        *)
          abs_ladir=`cd "$ladir" && pwd`
          if test -z "$abs_ladir"; then
-           func_warning "cannot determine absolute directory name of \`$ladir'"
+           func_warning "cannot determine absolute directory name of '$ladir'"
            func_warning "passing it literally to the linker, although it might fail"
-           abs_ladir="$ladir"
+           abs_ladir=$ladir
          fi
          ;;
        esac
        func_basename "$lib"
-       laname="$func_basename_result"
+       laname=$func_basename_result
 
        # Find the relevant object directory and library name.
-       if test "X$installed" = Xyes; then
+       if test yes = "$installed"; then
          if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-           func_warning "library \`$lib' was moved."
-           dir="$ladir"
-           absdir="$abs_ladir"
-           libdir="$abs_ladir"
+           func_warning "library '$lib' was moved."
+           dir=$ladir
+           absdir=$abs_ladir
+           libdir=$abs_ladir
          else
-           dir="$lt_sysroot$libdir"
-           absdir="$lt_sysroot$libdir"
+           dir=$lt_sysroot$libdir
+           absdir=$lt_sysroot$libdir
          fi
-         test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+         test yes = "$hardcode_automatic" && avoidtemprpath=yes
        else
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-           dir="$ladir"
-           absdir="$abs_ladir"
+           dir=$ladir
+           absdir=$abs_ladir
            # Remove this search path later
            func_append notinst_path " $abs_ladir"
          else
-           dir="$ladir/$objdir"
-           absdir="$abs_ladir/$objdir"
+           dir=$ladir/$objdir
+           absdir=$abs_ladir/$objdir
            # Remove this search path later
            func_append notinst_path " $abs_ladir"
          fi
@@ -6542,11 +8083,11 @@ func_mode_link ()
        name=$func_stripname_result
 
        # This library was specified with -dlpreopen.
-       if test "$pass" = dlpreopen; then
-         if test -z "$libdir" && test "$linkmode" = prog; then
-           func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+       if test dlpreopen = "$pass"; then
+         if test -z "$libdir" && test prog = "$linkmode"; then
+           func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
          fi
-         case "$host" in
+         case $host in
            # special handling for platforms with PE-DLLs.
            *cygwin* | *mingw* | *cegcc* )
              # Linker will automatically link against shared library if both
@@ -6590,9 +8131,9 @@ func_mode_link ()
 
        if test -z "$libdir"; then
          # Link the convenience library
-         if test "$linkmode" = lib; then
+         if test lib = "$linkmode"; then
            deplibs="$dir/$old_library $deplibs"
-         elif test "$linkmode,$pass" = "prog,link"; then
+         elif test prog,link = "$linkmode,$pass"; then
            compile_deplibs="$dir/$old_library $compile_deplibs"
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
          else
@@ -6602,14 +8143,14 @@ func_mode_link ()
        fi
 
 
-       if test "$linkmode" = prog && test "$pass" != link; then
+       if test prog = "$linkmode" && test link != "$pass"; then
          func_append newlib_search_path " $ladir"
          deplibs="$lib $deplibs"
 
-         linkalldeplibs=no
-         if test "$link_all_deplibs" != no || test -z "$library_names" ||
-            test "$build_libtool_libs" = no; then
-           linkalldeplibs=yes
+         linkalldeplibs=false
+         if test no != "$link_all_deplibs" || test -z "$library_names" ||
+            test no = "$build_libtool_libs"; then
+           linkalldeplibs=:
          fi
 
          tmp_libs=
@@ -6621,14 +8162,14 @@ func_mode_link ()
                 ;;
            esac
            # Need to link against all dependency_libs?
-           if test "$linkalldeplibs" = yes; then
+           if $linkalldeplibs; then
              deplibs="$deplib $deplibs"
            else
              # Need to hardcode shared library paths
              # or/and link against static libraries
              newdependency_libs="$deplib $newdependency_libs"
            fi
-           if $opt_preserve_dup_deps ; then
+           if $opt_preserve_dup_deps; then
              case "$tmp_libs " in
              *" $deplib "*) func_append specialdeplibs " $deplib" ;;
              esac
@@ -6638,15 +8179,15 @@ func_mode_link ()
          continue
        fi # $linkmode = prog...
 
-       if test "$linkmode,$pass" = "prog,link"; then
+       if test prog,link = "$linkmode,$pass"; then
          if test -n "$library_names" &&
-            { { test "$prefer_static_libs" = no ||
-                test "$prefer_static_libs,$installed" = "built,yes"; } ||
+            { { test no = "$prefer_static_libs" ||
+                test built,yes = "$prefer_static_libs,$installed"; } ||
               test -z "$old_library"; }; then
            # We need to hardcode the library path
-           if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+           if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
              # Make sure the rpath contains only unique directories.
-             case "$temp_rpath:" in
+             case $temp_rpath: in
              *"$absdir:"*) ;;
              *) func_append temp_rpath "$absdir:" ;;
              esac
@@ -6675,9 +8216,9 @@ func_mode_link ()
            esac
          fi # $linkmode,$pass = prog,link...
 
-         if test "$alldeplibs" = yes &&
-            { test "$deplibs_check_method" = pass_all ||
-              { test "$build_libtool_libs" = yes &&
+         if $alldeplibs &&
+            { test pass_all = "$deplibs_check_method" ||
+              { test yes = "$build_libtool_libs" &&
                 test -n "$library_names"; }; }; then
            # We only need to search for static libraries
            continue
@@ -6686,19 +8227,19 @@ func_mode_link ()
 
        link_static=no # Whether the deplib will be linked statically
        use_static_libs=$prefer_static_libs
-       if test "$use_static_libs" = built && test "$installed" = yes; then
+       if test built = "$use_static_libs" && test yes = "$installed"; then
          use_static_libs=no
        fi
        if test -n "$library_names" &&
-          { test "$use_static_libs" = no || test -z "$old_library"; }; then
+          { test no = "$use_static_libs" || test -z "$old_library"; }; then
          case $host in
-         *cygwin* | *mingw* | *cegcc*)
+         *cygwin* | *mingw* | *cegcc* | *os2*)
              # No point in relinking DLLs because paths are not encoded
              func_append notinst_deplibs " $lib"
              need_relink=no
            ;;
          *)
-           if test "$installed" = no; then
+           if test no = "$installed"; then
              func_append notinst_deplibs " $lib"
              need_relink=yes
            fi
@@ -6708,24 +8249,24 @@ func_mode_link ()
 
          # Warn about portability, can't link against -module's on some
          # systems (darwin).  Don't bleat about dlopened modules though!
-         dlopenmodule=""
+         dlopenmodule=
          for dlpremoduletest in $dlprefiles; do
            if test "X$dlpremoduletest" = "X$lib"; then
-             dlopenmodule="$dlpremoduletest"
+             dlopenmodule=$dlpremoduletest
              break
            fi
          done
-         if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+         if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
            echo
-           if test "$linkmode" = prog; then
+           if test prog = "$linkmode"; then
              $ECHO "*** Warning: Linking the executable $output against the loadable module"
            else
              $ECHO "*** Warning: Linking the shared library $output against the loadable module"
            fi
            $ECHO "*** $linklib is not portable!"
          fi
-         if test "$linkmode" = lib &&
-            test "$hardcode_into_libs" = yes; then
+         if test lib = "$linkmode" &&
+            test yes = "$hardcode_into_libs"; then
            # Hardcode the library path.
            # Skip directories that are in the system default run-time
            # search path.
@@ -6753,43 +8294,43 @@ func_mode_link ()
            # figure out the soname
            set dummy $library_names
            shift
-           realname="$1"
+           realname=$1
            shift
            libname=`eval "\\$ECHO \"$libname_spec\""`
            # use dlname if we got it. it's perfectly good, no?
            if test -n "$dlname"; then
-             soname="$dlname"
+             soname=$dlname
            elif test -n "$soname_spec"; then
              # bleh windows
              case $host in
-             *cygwin* | mingw* | *cegcc*)
+             *cygwin* | mingw* | *cegcc* | *os2*)
                func_arith $current - $age
                major=$func_arith_result
-               versuffix="-$major"
+               versuffix=-$major
                ;;
              esac
              eval soname=\"$soname_spec\"
            else
-             soname="$realname"
+             soname=$realname
            fi
 
            # Make a new name for the extract_expsyms_cmds to use
-           soroot="$soname"
+           soroot=$soname
            func_basename "$soroot"
-           soname="$func_basename_result"
+           soname=$func_basename_result
            func_stripname 'lib' '.dll' "$soname"
            newlib=libimp-$func_stripname_result.a
 
            # If the library has no export list, then create one now
            if test -f "$output_objdir/$soname-def"; then :
            else
-             func_verbose "extracting exported symbol list from \`$soname'"
+             func_verbose "extracting exported symbol list from '$soname'"
              func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
            fi
 
            # Create $newlib
            if test -f "$output_objdir/$newlib"; then :; else
-             func_verbose "generating import library for \`$soname'"
+             func_verbose "generating import library for '$soname'"
              func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
            fi
            # make sure the library variables are pointing to the new library
@@ -6797,58 +8338,58 @@ func_mode_link ()
            linklib=$newlib
          fi # test -n "$old_archive_from_expsyms_cmds"
 
-         if test "$linkmode" = prog || test "$opt_mode" != relink; then
+         if test prog = "$linkmode" || test relink != "$opt_mode"; then
            add_shlibpath=
            add_dir=
            add=
            lib_linked=yes
            case $hardcode_action in
            immediate | unsupported)
-             if test "$hardcode_direct" = no; then
-               add="$dir/$linklib"
+             if test no = "$hardcode_direct"; then
+               add=$dir/$linklib
                case $host in
-                 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
-                 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+                 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
+                 *-*-sysv4*uw2*) add_dir=-L$dir ;;
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
-                   *-*-unixware7*) add_dir="-L$dir" ;;
+                   *-*-unixware7*) add_dir=-L$dir ;;
                  *-*-darwin* )
-                   # if the lib is a (non-dlopened) module then we can not
+                   # if the lib is a (non-dlopened) module then we cannot
                    # link against it, someone is ignoring the earlier warnings
                    if /usr/bin/file -L $add 2> /dev/null |
-                        $GREP ": [^:]* bundle" >/dev/null ; then
+                        $GREP ": [^:]* bundle" >/dev/null; then
                      if test "X$dlopenmodule" != "X$lib"; then
                        $ECHO "*** Warning: lib $linklib is a module, not a shared library"
-                       if test -z "$old_library" ; then
+                       if test -z "$old_library"; then
                          echo
                          echo "*** And there doesn't seem to be a static archive available"
                          echo "*** The link will probably fail, sorry"
                        else
-                         add="$dir/$old_library"
+                         add=$dir/$old_library
                        fi
                      elif test -n "$old_library"; then
-                       add="$dir/$old_library"
+                       add=$dir/$old_library
                      fi
                    fi
                esac
-             elif test "$hardcode_minus_L" = no; then
+             elif test no = "$hardcode_minus_L"; then
                case $host in
-               *-*-sunos*) add_shlibpath="$dir" ;;
+               *-*-sunos*) add_shlibpath=$dir ;;
                esac
-               add_dir="-L$dir"
-               add="-l$name"
-             elif test "$hardcode_shlibpath_var" = no; then
-               add_shlibpath="$dir"
-               add="-l$name"
+               add_dir=-L$dir
+               add=-l$name
+             elif test no = "$hardcode_shlibpath_var"; then
+               add_shlibpath=$dir
+               add=-l$name
              else
                lib_linked=no
              fi
              ;;
            relink)
-             if test "$hardcode_direct" = yes &&
-                test "$hardcode_direct_absolute" = no; then
-               add="$dir/$linklib"
-             elif test "$hardcode_minus_L" = yes; then
-               add_dir="-L$absdir"
+             if test yes = "$hardcode_direct" &&
+                test no = "$hardcode_direct_absolute"; then
+               add=$dir/$linklib
+             elif test yes = "$hardcode_minus_L"; then
+               add_dir=-L$absdir
                # Try looking first in the location we're being installed to.
                if test -n "$inst_prefix_dir"; then
                  case $libdir in
@@ -6857,10 +8398,10 @@ func_mode_link ()
                      ;;
                  esac
                fi
-               add="-l$name"
-             elif test "$hardcode_shlibpath_var" = yes; then
-               add_shlibpath="$dir"
-               add="-l$name"
+               add=-l$name
+             elif test yes = "$hardcode_shlibpath_var"; then
+               add_shlibpath=$dir
+               add=-l$name
              else
                lib_linked=no
              fi
@@ -6868,7 +8409,7 @@ func_mode_link ()
            *) lib_linked=no ;;
            esac
 
-           if test "$lib_linked" != yes; then
+           if test yes != "$lib_linked"; then
              func_fatal_configuration "unsupported hardcode properties"
            fi
 
@@ -6878,15 +8419,15 @@ func_mode_link ()
              *) func_append compile_shlibpath "$add_shlibpath:" ;;
              esac
            fi
-           if test "$linkmode" = prog; then
+           if test prog = "$linkmode"; then
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
            else
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
              test -n "$add" && deplibs="$add $deplibs"
-             if test "$hardcode_direct" != yes &&
-                test "$hardcode_minus_L" != yes &&
-                test "$hardcode_shlibpath_var" = yes; then
+             if test yes != "$hardcode_direct" &&
+                test yes != "$hardcode_minus_L" &&
+                test yes = "$hardcode_shlibpath_var"; then
                case :$finalize_shlibpath: in
                *":$libdir:"*) ;;
                *) func_append finalize_shlibpath "$libdir:" ;;
@@ -6895,33 +8436,33 @@ func_mode_link ()
            fi
          fi
 
-         if test "$linkmode" = prog || test "$opt_mode" = relink; then
+         if test prog = "$linkmode" || test relink = "$opt_mode"; then
            add_shlibpath=
            add_dir=
            add=
            # Finalize command for both is simple: just hardcode it.
-           if test "$hardcode_direct" = yes &&
-              test "$hardcode_direct_absolute" = no; then
-             add="$libdir/$linklib"
-           elif test "$hardcode_minus_L" = yes; then
-             add_dir="-L$libdir"
-             add="-l$name"
-           elif test "$hardcode_shlibpath_var" = yes; then
+           if test yes = "$hardcode_direct" &&
+              test no = "$hardcode_direct_absolute"; then
+             add=$libdir/$linklib
+           elif test yes = "$hardcode_minus_L"; then
+             add_dir=-L$libdir
+             add=-l$name
+           elif test yes = "$hardcode_shlibpath_var"; then
              case :$finalize_shlibpath: in
              *":$libdir:"*) ;;
              *) func_append finalize_shlibpath "$libdir:" ;;
              esac
-             add="-l$name"
-           elif test "$hardcode_automatic" = yes; then
+             add=-l$name
+           elif test yes = "$hardcode_automatic"; then
              if test -n "$inst_prefix_dir" &&
-                test -f "$inst_prefix_dir$libdir/$linklib" ; then
-               add="$inst_prefix_dir$libdir/$linklib"
+                test -f "$inst_prefix_dir$libdir/$linklib"; then
+               add=$inst_prefix_dir$libdir/$linklib
              else
-               add="$libdir/$linklib"
+               add=$libdir/$linklib
              fi
            else
              # We cannot seem to hardcode it, guess we'll fake it.
-             add_dir="-L$libdir"
+             add_dir=-L$libdir
              # Try looking first in the location we're being installed to.
              if test -n "$inst_prefix_dir"; then
                case $libdir in
@@ -6930,10 +8471,10 @@ func_mode_link ()
                    ;;
                esac
              fi
-             add="-l$name"
+             add=-l$name
            fi
 
-           if test "$linkmode" = prog; then
+           if test prog = "$linkmode"; then
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
            else
@@ -6941,43 +8482,43 @@ func_mode_link ()
              test -n "$add" && deplibs="$add $deplibs"
            fi
          fi
-       elif test "$linkmode" = prog; then
+       elif test prog = "$linkmode"; then
          # Here we assume that one of hardcode_direct or hardcode_minus_L
          # is not unsupported.  This is valid on all known static and
          # shared platforms.
-         if test "$hardcode_direct" != unsupported; then
-           test -n "$old_library" && linklib="$old_library"
+         if test unsupported != "$hardcode_direct"; then
+           test -n "$old_library" && linklib=$old_library
            compile_deplibs="$dir/$linklib $compile_deplibs"
            finalize_deplibs="$dir/$linklib $finalize_deplibs"
          else
            compile_deplibs="-l$name -L$dir $compile_deplibs"
            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
          fi
-       elif test "$build_libtool_libs" = yes; then
+       elif test yes = "$build_libtool_libs"; then
          # Not a shared library
-         if test "$deplibs_check_method" != pass_all; then
+         if test pass_all != "$deplibs_check_method"; then
            # We're trying link a shared library against a static one
            # but the system doesn't support it.
 
            # Just print a warning and add the library to dependency_libs so
            # that the program can be linked against the static library.
            echo
-           $ECHO "*** Warning: This system can not link to static lib archive $lib."
+           $ECHO "*** Warning: This system cannot link to static lib archive $lib."
            echo "*** I have the capability to make that library automatically link in when"
            echo "*** you link to this library.  But I can only do this if you have a"
            echo "*** shared version of the library, which you do not appear to have."
-           if test "$module" = yes; then
+           if test yes = "$module"; then
              echo "*** But as you try to build a module library, libtool will still create "
              echo "*** a static module, that should work as long as the dlopening application"
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
              if test -z "$global_symbol_pipe"; then
                echo
                echo "*** However, this would only work if libtool was able to extract symbol"
-               echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+               echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
                echo "*** not find such a program.  So, this module is probably useless."
-               echo "*** \`nm' from GNU binutils and a full rebuild may help."
+               echo "*** 'nm' from GNU binutils and a full rebuild may help."
              fi
-             if test "$build_old_libs" = no; then
+             if test no = "$build_old_libs"; then
                build_libtool_libs=module
                build_old_libs=yes
              else
@@ -6990,11 +8531,11 @@ func_mode_link ()
          fi
        fi # link shared/static library?
 
-       if test "$linkmode" = lib; then
+       if test lib = "$linkmode"; then
          if test -n "$dependency_libs" &&
-            { test "$hardcode_into_libs" != yes ||
-              test "$build_old_libs" = yes ||
-              test "$link_static" = yes; }; then
+            { test yes != "$hardcode_into_libs" ||
+              test yes = "$build_old_libs" ||
+              test yes = "$link_static"; }; then
            # Extract -R from dependency_libs
            temp_deplibs=
            for libdir in $dependency_libs; do
@@ -7008,12 +8549,12 @@ func_mode_link ()
              *) func_append temp_deplibs " $libdir";;
              esac
            done
-           dependency_libs="$temp_deplibs"
+           dependency_libs=$temp_deplibs
          fi
 
          func_append newlib_search_path " $absdir"
          # Link against this library
-         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+         test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
          # ... and its dependency_libs
          tmp_libs=
          for deplib in $dependency_libs; do
@@ -7023,7 +8564,7 @@ func_mode_link ()
                    func_resolve_sysroot "$func_stripname_result";;
               *) func_resolve_sysroot "$deplib" ;;
             esac
-           if $opt_preserve_dup_deps ; then
+           if $opt_preserve_dup_deps; then
              case "$tmp_libs " in
              *" $func_resolve_sysroot_result "*)
                 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
@@ -7032,12 +8573,12 @@ func_mode_link ()
            func_append tmp_libs " $func_resolve_sysroot_result"
          done
 
-         if test "$link_all_deplibs" != no; then
+         if test no != "$link_all_deplibs"; then
            # Add the search paths of all dependency libraries
            for deplib in $dependency_libs; do
              path=
              case $deplib in
-             -L*) path="$deplib" ;;
+             -L*) path=$deplib ;;
              *.la)
                func_resolve_sysroot "$deplib"
                deplib=$func_resolve_sysroot_result
@@ -7045,12 +8586,12 @@ func_mode_link ()
                dir=$func_dirname_result
                # We need an absolute path.
                case $dir in
-               [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+               [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
                *)
                  absdir=`cd "$dir" && pwd`
                  if test -z "$absdir"; then
-                   func_warning "cannot determine absolute directory name of \`$dir'"
-                   absdir="$dir"
+                   func_warning "cannot determine absolute directory name of '$dir'"
+                   absdir=$dir
                  fi
                  ;;
                esac
@@ -7058,35 +8599,35 @@ func_mode_link ()
                case $host in
                *-*-darwin*)
                  depdepl=
-                 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
-                 if test -n "$deplibrary_names" ; then
-                   for tmp in $deplibrary_names ; do
+                 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names"; then
+                   for tmp in $deplibrary_names; do
                      depdepl=$tmp
                    done
-                   if test -f "$absdir/$objdir/$depdepl" ; then
-                     depdepl="$absdir/$objdir/$depdepl"
-                     darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                   if test -f "$absdir/$objdir/$depdepl"; then
+                     depdepl=$absdir/$objdir/$depdepl
+                     darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
                       if test -z "$darwin_install_name"; then
-                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                          darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
                       fi
-                     func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-                     func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+                     func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
+                     func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
                      path=
                    fi
                  fi
                  ;;
                *)
-                 path="-L$absdir/$objdir"
+                 path=-L$absdir/$objdir
                  ;;
                esac
                else
-                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+                 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
                  test -z "$libdir" && \
-                   func_fatal_error "\`$deplib' is not a valid libtool archive"
+                   func_fatal_error "'$deplib' is not a valid libtool archive"
                  test "$absdir" != "$libdir" && \
-                   func_warning "\`$deplib' seems to be moved"
+                   func_warning "'$deplib' seems to be moved"
 
-                 path="-L$absdir"
+                 path=-L$absdir
                fi
                ;;
              esac
@@ -7098,23 +8639,23 @@ func_mode_link ()
          fi # link_all_deplibs != no
        fi # linkmode = lib
       done # for deplib in $libs
-      if test "$pass" = link; then
-       if test "$linkmode" = "prog"; then
+      if test link = "$pass"; then
+       if test prog = "$linkmode"; then
          compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
          finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
        else
          compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
        fi
       fi
-      dependency_libs="$newdependency_libs"
-      if test "$pass" = dlpreopen; then
+      dependency_libs=$newdependency_libs
+      if test dlpreopen = "$pass"; then
        # Link the dlpreopened libraries before other libraries
        for deplib in $save_deplibs; do
          deplibs="$deplib $deplibs"
        done
       fi
-      if test "$pass" != dlopen; then
-       if test "$pass" != conv; then
+      if test dlopen != "$pass"; then
+       test conv = "$pass" || {
          # Make sure lib_search_path contains only unique directories.
          lib_search_path=
          for dir in $newlib_search_path; do
@@ -7124,12 +8665,12 @@ func_mode_link ()
            esac
          done
          newlib_search_path=
-       fi
+       }
 
-       if test "$linkmode,$pass" != "prog,link"; then
-         vars="deplibs"
-       else
+       if test prog,link = "$linkmode,$pass"; then
          vars="compile_deplibs finalize_deplibs"
+       else
+         vars=deplibs
        fi
        for var in $vars dependency_libs; do
          # Add libraries to $var in reverse order
@@ -7187,62 +8728,93 @@ func_mode_link ()
          eval $var=\"$tmp_libs\"
        done # for var
       fi
+
+      # Add Sun CC postdeps if required:
+      test CXX = "$tagname" && {
+        case $host_os in
+        linux*)
+          case `$CC -V 2>&1 | sed 5q` in
+          *Sun\ C*) # Sun C++ 5.9
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+
+        solaris*)
+          func_cc_basename "$CC"
+          case $func_cc_basename_result in
+          CC* | sunCC*)
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+        esac
+      }
+
       # Last step: remove runtime libs from dependency_libs
       # (they stay in deplibs)
       tmp_libs=
-      for i in $dependency_libs ; do
+      for i in $dependency_libs; do
        case " $predeps $postdeps $compiler_lib_search_path " in
        *" $i "*)
-         i=""
+         i=
          ;;
        esac
-       if test -n "$i" ; then
+       if test -n "$i"; then
          func_append tmp_libs " $i"
        fi
       done
       dependency_libs=$tmp_libs
     done # for pass
-    if test "$linkmode" = prog; then
-      dlfiles="$newdlfiles"
+    if test prog = "$linkmode"; then
+      dlfiles=$newdlfiles
     fi
-    if test "$linkmode" = prog || test "$linkmode" = lib; then
-      dlprefiles="$newdlprefiles"
+    if test prog = "$linkmode" || test lib = "$linkmode"; then
+      dlprefiles=$newdlprefiles
     fi
 
     case $linkmode in
     oldlib)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-       func_warning "\`-dlopen' is ignored for archives"
+      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
+       func_warning "'-dlopen' is ignored for archives"
       fi
 
       case " $deplibs" in
       *\ -l* | *\ -L*)
-       func_warning "\`-l' and \`-L' are ignored for archives" ;;
+       func_warning "'-l' and '-L' are ignored for archives" ;;
       esac
 
       test -n "$rpath" && \
-       func_warning "\`-rpath' is ignored for archives"
+       func_warning "'-rpath' is ignored for archives"
 
       test -n "$xrpath" && \
-       func_warning "\`-R' is ignored for archives"
+       func_warning "'-R' is ignored for archives"
 
       test -n "$vinfo" && \
-       func_warning "\`-version-info/-version-number' is ignored for archives"
+       func_warning "'-version-info/-version-number' is ignored for archives"
 
       test -n "$release" && \
-       func_warning "\`-release' is ignored for archives"
+       func_warning "'-release' is ignored for archives"
 
       test -n "$export_symbols$export_symbols_regex" && \
-       func_warning "\`-export-symbols' is ignored for archives"
+       func_warning "'-export-symbols' is ignored for archives"
 
       # Now set the variables for building old libraries.
       build_libtool_libs=no
-      oldlibs="$output"
+      oldlibs=$output
       func_append objs "$old_deplibs"
       ;;
 
     lib)
-      # Make sure we only generate libraries of the form `libNAME.la'.
+      # Make sure we only generate libraries of the form 'libNAME.la'.
       case $outputname in
       lib*)
        func_stripname 'lib' '.la' "$outputname"
@@ -7251,10 +8823,10 @@ func_mode_link ()
        eval libname=\"$libname_spec\"
        ;;
       *)
-       test "$module" = no && \
-         func_fatal_help "libtool library \`$output' must begin with \`lib'"
+       test no = "$module" \
+         && func_fatal_help "libtool library '$output' must begin with 'lib'"
 
-       if test "$need_lib_prefix" != no; then
+       if test no != "$need_lib_prefix"; then
          # Add the "lib" prefix for modules if required
          func_stripname '' '.la' "$outputname"
          name=$func_stripname_result
@@ -7268,8 +8840,8 @@ func_mode_link ()
       esac
 
       if test -n "$objs"; then
-       if test "$deplibs_check_method" != pass_all; then
-         func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+       if test pass_all != "$deplibs_check_method"; then
+         func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
        else
          echo
          $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
@@ -7278,21 +8850,21 @@ func_mode_link ()
        fi
       fi
 
-      test "$dlself" != no && \
-       func_warning "\`-dlopen self' is ignored for libtool libraries"
+      test no = "$dlself" \
+       || func_warning "'-dlopen self' is ignored for libtool libraries"
 
       set dummy $rpath
       shift
-      test "$#" -gt 1 && \
-       func_warning "ignoring multiple \`-rpath's for a libtool library"
+      test 1 -lt "$#" \
+       && func_warning "ignoring multiple '-rpath's for a libtool library"
 
-      install_libdir="$1"
+      install_libdir=$1
 
       oldlibs=
       if test -z "$rpath"; then
-       if test "$build_libtool_libs" = yes; then
+       if test yes = "$build_libtool_libs"; then
          # Building a libtool convenience library.
-         # Some compilers have problems with a `.al' extension so
+         # Some compilers have problems with a '.al' extension so
          # convenience libraries should have the same extension an
          # archive normally would.
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
@@ -7301,20 +8873,20 @@ func_mode_link ()
        fi
 
        test -n "$vinfo" && \
-         func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+         func_warning "'-version-info/-version-number' is ignored for convenience libraries"
 
        test -n "$release" && \
-         func_warning "\`-release' is ignored for convenience libraries"
+         func_warning "'-release' is ignored for convenience libraries"
       else
 
        # Parse the version information argument.
-       save_ifs="$IFS"; IFS=':'
+       save_ifs=$IFS; IFS=:
        set dummy $vinfo 0 0 0
        shift
-       IFS="$save_ifs"
+       IFS=$save_ifs
 
        test -n "$7" && \
-         func_fatal_help "too many parameters to \`-version-info'"
+         func_fatal_help "too many parameters to '-version-info'"
 
        # convert absolute version numbers to libtool ages
        # this retains compatibility with .la files and attempts
@@ -7322,45 +8894,45 @@ func_mode_link ()
 
        case $vinfo_number in
        yes)
-         number_major="$1"
-         number_minor="$2"
-         number_revision="$3"
+         number_major=$1
+         number_minor=$2
+         number_revision=$3
          #
          # There are really only two kinds -- those that
          # use the current revision as the major version
          # and those that subtract age and use age as
          # a minor version.  But, then there is irix
-         # which has an extra 1 added just for fun
+         # that has an extra 1 added just for fun
          #
          case $version_type in
          # correct linux to gnu/linux during the next big refactor
-         darwin|linux|osf|windows|none)
+         darwin|freebsd-elf|linux|osf|windows|none)
            func_arith $number_major + $number_minor
            current=$func_arith_result
-           age="$number_minor"
-           revision="$number_revision"
+           age=$number_minor
+           revision=$number_revision
            ;;
-         freebsd-aout|freebsd-elf|qnx|sunos)
-           current="$number_major"
-           revision="$number_minor"
-           age="0"
+         freebsd-aout|qnx|sunos)
+           current=$number_major
+           revision=$number_minor
+           age=0
            ;;
          irix|nonstopux)
            func_arith $number_major + $number_minor
            current=$func_arith_result
-           age="$number_minor"
-           revision="$number_minor"
+           age=$number_minor
+           revision=$number_minor
            lt_irix_increment=no
            ;;
          *)
-           func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+           func_fatal_configuration "$modename: unknown library version type '$version_type'"
            ;;
          esac
          ;;
        no)
-         current="$1"
-         revision="$2"
-         age="$3"
+         current=$1
+         revision=$2
+         age=$3
          ;;
        esac
 
@@ -7368,30 +8940,30 @@ func_mode_link ()
        case $current in
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
        *)
-         func_error "CURRENT \`$current' must be a nonnegative integer"
-         func_fatal_error "\`$vinfo' is not valid version information"
+         func_error "CURRENT '$current' must be a nonnegative integer"
+         func_fatal_error "'$vinfo' is not valid version information"
          ;;
        esac
 
        case $revision in
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
        *)
-         func_error "REVISION \`$revision' must be a nonnegative integer"
-         func_fatal_error "\`$vinfo' is not valid version information"
+         func_error "REVISION '$revision' must be a nonnegative integer"
+         func_fatal_error "'$vinfo' is not valid version information"
          ;;
        esac
 
        case $age in
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
        *)
-         func_error "AGE \`$age' must be a nonnegative integer"
-         func_fatal_error "\`$vinfo' is not valid version information"
+         func_error "AGE '$age' must be a nonnegative integer"
+         func_fatal_error "'$vinfo' is not valid version information"
          ;;
        esac
 
        if test "$age" -gt "$current"; then
-         func_error "AGE \`$age' is greater than the current interface number \`$current'"
-         func_fatal_error "\`$vinfo' is not valid version information"
+         func_error "AGE '$age' is greater than the current interface number '$current'"
+         func_fatal_error "'$vinfo' is not valid version information"
        fi
 
        # Calculate the version variables.
@@ -7406,26 +8978,36 @@ func_mode_link ()
          # verstring for coding it into the library header
          func_arith $current - $age
          major=.$func_arith_result
-         versuffix="$major.$age.$revision"
+         versuffix=$major.$age.$revision
          # Darwin ld doesn't like 0 for these options...
          func_arith $current + 1
          minor_current=$func_arith_result
-         xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+         xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+          # On Darwin other compilers
+          case $CC in
+              nagfor*)
+                  verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
+                  ;;
+              *)
+                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+                  ;;
+          esac
          ;;
 
        freebsd-aout)
-         major=".$current"
-         versuffix=".$current.$revision";
+         major=.$current
+         versuffix=.$current.$revision
          ;;
 
        freebsd-elf)
-         major=".$current"
-         versuffix=".$current"
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix=$major.$age.$revision
          ;;
 
        irix | nonstopux)
-         if test "X$lt_irix_increment" = "Xno"; then
+         if test no = "$lt_irix_increment"; then
            func_arith $current - $age
          else
            func_arith $current - $age + 1
@@ -7436,69 +9018,74 @@ func_mode_link ()
            nonstopux) verstring_prefix=nonstopux ;;
            *)         verstring_prefix=sgi ;;
          esac
-         verstring="$verstring_prefix$major.$revision"
+         verstring=$verstring_prefix$major.$revision
 
          # Add in all the interfaces that we are compatible with.
          loop=$revision
-         while test "$loop" -ne 0; do
+         while test 0 -ne "$loop"; do
            func_arith $revision - $loop
            iface=$func_arith_result
            func_arith $loop - 1
            loop=$func_arith_result
-           verstring="$verstring_prefix$major.$iface:$verstring"
+           verstring=$verstring_prefix$major.$iface:$verstring
          done
 
-         # Before this point, $major must not contain `.'.
+         # Before this point, $major must not contain '.'.
          major=.$major
-         versuffix="$major.$revision"
+         versuffix=$major.$revision
          ;;
 
        linux) # correct to gnu/linux during the next big refactor
          func_arith $current - $age
          major=.$func_arith_result
-         versuffix="$major.$age.$revision"
+         versuffix=$major.$age.$revision
          ;;
 
        osf)
          func_arith $current - $age
          major=.$func_arith_result
-         versuffix=".$current.$age.$revision"
-         verstring="$current.$age.$revision"
+         versuffix=.$current.$age.$revision
+         verstring=$current.$age.$revision
 
          # Add in all the interfaces that we are compatible with.
          loop=$age
-         while test "$loop" -ne 0; do
+         while test 0 -ne "$loop"; do
            func_arith $current - $loop
            iface=$func_arith_result
            func_arith $loop - 1
            loop=$func_arith_result
-           verstring="$verstring:${iface}.0"
+           verstring=$verstring:$iface.0
          done
 
          # Make executables depend on our current version.
-         func_append verstring ":${current}.0"
+         func_append verstring ":$current.0"
          ;;
 
        qnx)
-         major=".$current"
-         versuffix=".$current"
+         major=.$current
+         versuffix=.$current
+         ;;
+
+       sco)
+         major=.$current
+         versuffix=.$current
          ;;
 
        sunos)
-         major=".$current"
-         versuffix=".$current.$revision"
+         major=.$current
+         versuffix=.$current.$revision
          ;;
 
        windows)
          # Use '-' rather than '.', since we only want one
-         # extension on DOS 8.3 filesystems.
+         # extension on DOS 8.3 file systems.
          func_arith $current - $age
          major=$func_arith_result
-         versuffix="-$major"
+         versuffix=-$major
          ;;
 
        *)
-         func_fatal_configuration "unknown library version type \`$version_type'"
+         func_fatal_configuration "unknown library version type '$version_type'"
          ;;
        esac
 
@@ -7512,42 +9099,45 @@ func_mode_link ()
            verstring=
            ;;
          *)
-           verstring="0.0"
+           verstring=0.0
            ;;
          esac
-         if test "$need_version" = no; then
+         if test no = "$need_version"; then
            versuffix=
          else
-           versuffix=".0.0"
+           versuffix=.0.0
          fi
        fi
 
        # Remove version info from name if versioning should be avoided
-       if test "$avoid_version" = yes && test "$need_version" = no; then
+       if test yes,no = "$avoid_version,$need_version"; then
          major=
          versuffix=
-         verstring=""
+         verstring=
        fi
 
        # Check to see if the archive will have undefined symbols.
-       if test "$allow_undefined" = yes; then
-         if test "$allow_undefined_flag" = unsupported; then
-           func_warning "undefined symbols not allowed in $host shared libraries"
-           build_libtool_libs=no
-           build_old_libs=yes
+       if test yes = "$allow_undefined"; then
+         if test unsupported = "$allow_undefined_flag"; then
+           if test yes = "$build_old_libs"; then
+             func_warning "undefined symbols not allowed in $host shared libraries; building static only"
+             build_libtool_libs=no
+           else
+             func_fatal_error "can't build $host shared library unless -no-undefined is specified"
+           fi
          fi
        else
          # Don't allow undefined symbols.
-         allow_undefined_flag="$no_undefined_flag"
+         allow_undefined_flag=$no_undefined_flag
        fi
 
       fi
 
-      func_generate_dlsyms "$libname" "$libname" "yes"
+      func_generate_dlsyms "$libname" "$libname" :
       func_append libobjs " $symfileobj"
-      test "X$libobjs" = "X " && libobjs=
+      test " " = "$libobjs" && libobjs=
 
-      if test "$opt_mode" != relink; then
+      if test relink != "$opt_mode"; then
        # Remove our outputs, but don't remove object files since they
        # may have been created when compiling PIC objects.
        removelist=
@@ -7556,8 +9146,8 @@ func_mode_link ()
          case $p in
            *.$objext | *.gcno)
               ;;
-           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-              if test "X$precious_files_regex" != "X"; then
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
+              if test -n "$precious_files_regex"; then
                 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
                 then
                   continue
@@ -7573,11 +9163,11 @@ func_mode_link ()
       fi
 
       # Now set the variables for building old libraries.
-      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+      if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
        func_append oldlibs " $output_objdir/$libname.$libext"
 
        # Transform .lo files to .o files.
-       oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+       oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
       fi
 
       # Eliminate all temporary directories.
@@ -7598,13 +9188,13 @@ func_mode_link ()
          *) func_append finalize_rpath " $libdir" ;;
          esac
        done
-       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+       if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
          dependency_libs="$temp_xrpath $dependency_libs"
        fi
       fi
 
       # Make sure dlfiles contains only unique files that won't be dlpreopened
-      old_dlfiles="$dlfiles"
+      old_dlfiles=$dlfiles
       dlfiles=
       for lib in $old_dlfiles; do
        case " $dlprefiles $dlfiles " in
@@ -7614,7 +9204,7 @@ func_mode_link ()
       done
 
       # Make sure dlprefiles contains only unique files
-      old_dlprefiles="$dlprefiles"
+      old_dlprefiles=$dlprefiles
       dlprefiles=
       for lib in $old_dlprefiles; do
        case "$dlprefiles " in
@@ -7623,7 +9213,7 @@ func_mode_link ()
        esac
       done
 
-      if test "$build_libtool_libs" = yes; then
+      if test yes = "$build_libtool_libs"; then
        if test -n "$rpath"; then
          case $host in
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
@@ -7647,7 +9237,7 @@ func_mode_link ()
            ;;
          *)
            # Add libc to deplibs on all other systems if necessary.
-           if test "$build_libtool_need_lc" = "yes"; then
+           if test yes = "$build_libtool_need_lc"; then
              func_append deplibs " -lc"
            fi
            ;;
@@ -7663,9 +9253,9 @@ func_mode_link ()
        # I'm not sure if I'm treating the release correctly.  I think
        # release should show up in the -l (ie -lgmp5) so we don't want to
        # add it in twice.  Is that correct?
-       release=""
-       versuffix=""
-       major=""
+       release=
+       versuffix=
+       major=
        newdeplibs=
        droppeddeps=no
        case $deplibs_check_method in
@@ -7694,20 +9284,20 @@ EOF
              -l*)
                func_stripname -l '' "$i"
                name=$func_stripname_result
-               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               if test yes = "$allow_libtool_libs_with_static_runtimes"; then
                  case " $predeps $postdeps " in
                  *" $i "*)
                    func_append newdeplibs " $i"
-                   i=""
+                   i=
                    ;;
                  esac
                fi
-               if test -n "$i" ; then
+               if test -n "$i"; then
                  libname=`eval "\\$ECHO \"$libname_spec\""`
                  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
                  set dummy $deplib_matches; shift
                  deplib_match=$1
-                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
                    func_append newdeplibs " $i"
                  else
                    droppeddeps=yes
@@ -7737,20 +9327,20 @@ EOF
                $opt_dry_run || $RM conftest
                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
                  ldd_output=`ldd conftest`
-                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
                    case " $predeps $postdeps " in
                    *" $i "*)
                      func_append newdeplibs " $i"
-                     i=""
+                     i=
                      ;;
                    esac
                  fi
-                 if test -n "$i" ; then
+                 if test -n "$i"; then
                    libname=`eval "\\$ECHO \"$libname_spec\""`
                    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
                    set dummy $deplib_matches; shift
                    deplib_match=$1
-                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
                      func_append newdeplibs " $i"
                    else
                      droppeddeps=yes
@@ -7787,24 +9377,24 @@ EOF
            -l*)
              func_stripname -l '' "$a_deplib"
              name=$func_stripname_result
-             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+             if test yes = "$allow_libtool_libs_with_static_runtimes"; then
                case " $predeps $postdeps " in
                *" $a_deplib "*)
                  func_append newdeplibs " $a_deplib"
-                 a_deplib=""
+                 a_deplib=
                  ;;
                esac
              fi
-             if test -n "$a_deplib" ; then
+             if test -n "$a_deplib"; then
                libname=`eval "\\$ECHO \"$libname_spec\""`
                if test -n "$file_magic_glob"; then
                  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
                else
                  libnameglob=$libname
                fi
-               test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+               test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-                 if test "$want_nocaseglob" = yes; then
+                 if test yes = "$want_nocaseglob"; then
                    shopt -s nocaseglob
                    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
                    $nocaseglob
@@ -7822,25 +9412,25 @@ EOF
                      # We might still enter an endless loop, since a link
                      # loop can be closed while we follow links,
                      # but so what?
-                     potlib="$potent_lib"
+                     potlib=$potent_lib
                      while test -h "$potlib" 2>/dev/null; do
-                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+                       potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
                        case $potliblink in
-                       [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-                       *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+                       [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
+                       *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
                        esac
                      done
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
                         $SED -e 10q |
                         $EGREP "$file_magic_regex" > /dev/null; then
                        func_append newdeplibs " $a_deplib"
-                       a_deplib=""
+                       a_deplib=
                        break 2
                      fi
                  done
                done
              fi
-             if test -n "$a_deplib" ; then
+             if test -n "$a_deplib"; then
                droppeddeps=yes
                echo
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
@@ -7848,7 +9438,7 @@ EOF
                echo "*** you link to this library.  But I can only do this if you have a"
                echo "*** shared version of the library, which you do not appear to have"
                echo "*** because I did check the linker path looking for a file starting"
-               if test -z "$potlib" ; then
+               if test -z "$potlib"; then
                  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
                else
                  $ECHO "*** with $libname and none of the candidates passed a file format test"
@@ -7871,30 +9461,30 @@ EOF
            -l*)
              func_stripname -l '' "$a_deplib"
              name=$func_stripname_result
-             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+             if test yes = "$allow_libtool_libs_with_static_runtimes"; then
                case " $predeps $postdeps " in
                *" $a_deplib "*)
                  func_append newdeplibs " $a_deplib"
-                 a_deplib=""
+                 a_deplib=
                  ;;
                esac
              fi
-             if test -n "$a_deplib" ; then
+             if test -n "$a_deplib"; then
                libname=`eval "\\$ECHO \"$libname_spec\""`
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
                  for potent_lib in $potential_libs; do
-                   potlib="$potent_lib" # see symlink-check above in file_magic test
+                   potlib=$potent_lib # see symlink-check above in file_magic test
                    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
                       $EGREP "$match_pattern_regex" > /dev/null; then
                      func_append newdeplibs " $a_deplib"
-                     a_deplib=""
+                     a_deplib=
                      break 2
                    fi
                  done
                done
              fi
-             if test -n "$a_deplib" ; then
+             if test -n "$a_deplib"; then
                droppeddeps=yes
                echo
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
@@ -7902,7 +9492,7 @@ EOF
                echo "*** you link to this library.  But I can only do this if you have a"
                echo "*** shared version of the library, which you do not appear to have"
                echo "*** because I did check the linker path looking for a file starting"
-               if test -z "$potlib" ; then
+               if test -z "$potlib"; then
                  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
                else
                  $ECHO "*** with $libname and none of the candidates passed a file format test"
@@ -7918,18 +9508,18 @@ EOF
          done # Gone through all deplibs.
          ;;
        none | unknown | *)
-         newdeplibs=""
+         newdeplibs=
          tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
-         if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-           for i in $predeps $postdeps ; do
+         if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+           for i in $predeps $postdeps; do
              # can't use Xsed below, because $i might contain '/'
-             tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+             tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
            done
          fi
          case $tmp_deplibs in
          *[!\  \ ]*)
            echo
-           if test "X$deplibs_check_method" = "Xnone"; then
+           if test none = "$deplibs_check_method"; then
              echo "*** Warning: inter-library dependencies are not supported in this platform."
            else
              echo "*** Warning: inter-library dependencies are not known to be supported."
@@ -7953,8 +9543,8 @@ EOF
          ;;
        esac
 
-       if test "$droppeddeps" = yes; then
-         if test "$module" = yes; then
+       if test yes = "$droppeddeps"; then
+         if test yes = "$module"; then
            echo
            echo "*** Warning: libtool could not satisfy all declared inter-library"
            $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
@@ -7963,12 +9553,12 @@ EOF
            if test -z "$global_symbol_pipe"; then
              echo
              echo "*** However, this would only work if libtool was able to extract symbol"
-             echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+             echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
              echo "*** not find such a program.  So, this module is probably useless."
-             echo "*** \`nm' from GNU binutils and a full rebuild may help."
+             echo "*** 'nm' from GNU binutils and a full rebuild may help."
            fi
-           if test "$build_old_libs" = no; then
-             oldlibs="$output_objdir/$libname.$libext"
+           if test no = "$build_old_libs"; then
+             oldlibs=$output_objdir/$libname.$libext
              build_libtool_libs=module
              build_old_libs=yes
            else
@@ -7979,14 +9569,14 @@ EOF
            echo "*** automatically added whenever a program is linked with this library"
            echo "*** or is declared to -dlopen it."
 
-           if test "$allow_undefined" = no; then
+           if test no = "$allow_undefined"; then
              echo
              echo "*** Since this library must not contain undefined symbols,"
              echo "*** because either the platform does not support them or"
              echo "*** it was explicitly requested with -no-undefined,"
              echo "*** libtool will only create a static version of it."
-             if test "$build_old_libs" = no; then
-               oldlibs="$output_objdir/$libname.$libext"
+             if test no = "$build_old_libs"; then
+               oldlibs=$output_objdir/$libname.$libext
                build_libtool_libs=module
                build_old_libs=yes
              else
@@ -8032,7 +9622,7 @@ EOF
        *) func_append new_libs " $deplib" ;;
        esac
       done
-      deplibs="$new_libs"
+      deplibs=$new_libs
 
       # All the library-specific variables (install_libdir is set above).
       library_names=
@@ -8040,25 +9630,25 @@ EOF
       dlname=
 
       # Test again, we may have decided not to build it any more
-      if test "$build_libtool_libs" = yes; then
-       # Remove ${wl} instances when linking with ld.
+      if test yes = "$build_libtool_libs"; then
+       # Remove $wl instances when linking with ld.
        # FIXME: should test the right _cmds variable.
        case $archive_cmds in
          *\$LD\ *) wl= ;;
         esac
-       if test "$hardcode_into_libs" = yes; then
+       if test yes = "$hardcode_into_libs"; then
          # Hardcode the library paths
          hardcode_libdirs=
          dep_rpath=
-         rpath="$finalize_rpath"
-         test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+         rpath=$finalize_rpath
+         test relink = "$opt_mode" || rpath=$compile_rpath$rpath
          for libdir in $rpath; do
            if test -n "$hardcode_libdir_flag_spec"; then
              if test -n "$hardcode_libdir_separator"; then
                func_replace_sysroot "$libdir"
                libdir=$func_replace_sysroot_result
                if test -z "$hardcode_libdirs"; then
-                 hardcode_libdirs="$libdir"
+                 hardcode_libdirs=$libdir
                else
                  # Just accumulate the unique libdirs.
                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
@@ -8083,7 +9673,7 @@ EOF
          # Substitute the hardcoded libdirs into the rpath.
          if test -n "$hardcode_libdir_separator" &&
             test -n "$hardcode_libdirs"; then
-           libdir="$hardcode_libdirs"
+           libdir=$hardcode_libdirs
            eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
          fi
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
@@ -8097,8 +9687,8 @@ EOF
          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
        fi
 
-       shlibpath="$finalize_shlibpath"
-       test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+       shlibpath=$finalize_shlibpath
+       test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
        if test -n "$shlibpath"; then
          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
        fi
@@ -8108,19 +9698,19 @@ EOF
        eval library_names=\"$library_names_spec\"
        set dummy $library_names
        shift
-       realname="$1"
+       realname=$1
        shift
 
        if test -n "$soname_spec"; then
          eval soname=\"$soname_spec\"
        else
-         soname="$realname"
+         soname=$realname
        fi
        if test -z "$dlname"; then
          dlname=$soname
        fi
 
-       lib="$output_objdir/$realname"
+       lib=$output_objdir/$realname
        linknames=
        for link
        do
@@ -8134,7 +9724,7 @@ EOF
        delfiles=
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
          $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
-         export_symbols="$output_objdir/$libname.uexp"
+         export_symbols=$output_objdir/$libname.uexp
          func_append delfiles " $export_symbols"
        fi
 
@@ -8143,31 +9733,31 @@ EOF
        cygwin* | mingw* | cegcc*)
          if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
            # exporting using user supplied symfile
-           if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+           func_dll_def_p "$export_symbols" || {
              # and it's NOT already a .def file. Must figure out
              # which of the given symbols are data symbols and tag
              # them as such. So, trigger use of export_symbols_cmds.
              # export_symbols gets reassigned inside the "prepare
              # the list of exported symbols" if statement, so the
              # include_expsyms logic still works.
-             orig_export_symbols="$export_symbols"
+             orig_export_symbols=$export_symbols
              export_symbols=
              always_export_symbols=yes
-           fi
+           }
          fi
          ;;
        esac
 
        # Prepare the list of exported symbols
        if test -z "$export_symbols"; then
-         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
-           func_verbose "generating symbol list for \`$libname.la'"
-           export_symbols="$output_objdir/$libname.exp"
+         if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
+           func_verbose "generating symbol list for '$libname.la'"
+           export_symbols=$output_objdir/$libname.exp
            $opt_dry_run || $RM $export_symbols
            cmds=$export_symbols_cmds
-           save_ifs="$IFS"; IFS='~'
+           save_ifs=$IFS; IFS='~'
            for cmd1 in $cmds; do
-             IFS="$save_ifs"
+             IFS=$save_ifs
              # Take the normal branch if the nm_file_list_spec branch
              # doesn't work or if tool conversion is not needed.
              case $nm_file_list_spec~$to_tool_file_cmd in
@@ -8181,7 +9771,7 @@ EOF
                  try_normal_branch=no
                  ;;
              esac
-             if test "$try_normal_branch" = yes \
+             if test yes = "$try_normal_branch" \
                 && { test "$len" -lt "$max_cmd_len" \
                      || test "$max_cmd_len" -le -1; }
              then
@@ -8192,7 +9782,7 @@ EOF
                output_la=$func_basename_result
                save_libobjs=$libobjs
                save_output=$output
-               output=${output_objdir}/${output_la}.nm
+               output=$output_objdir/$output_la.nm
                func_to_tool_file "$output"
                libobjs=$nm_file_list_spec$func_to_tool_file_result
                func_append delfiles " $output"
@@ -8215,8 +9805,8 @@ EOF
                break
              fi
            done
-           IFS="$save_ifs"
-           if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+           IFS=$save_ifs
+           if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
            fi
@@ -8224,16 +9814,16 @@ EOF
        fi
 
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
-         tmp_export_symbols="$export_symbols"
-         test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+         tmp_export_symbols=$export_symbols
+         test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
          $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
        fi
 
-       if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+       if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
          # The given exports_symbols file has to be filtered, so filter it.
-         func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+         func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
          # FIXME: $output_objdir/$libname.filter potentially contains lots of
-         # 's' commands which not all seds can handle. GNU sed should be fine
+         # 's' commands, which not all seds can handle. GNU sed should be fine
          # though. Also, the filter scales superlinearly with the number of
          # global variables. join(1) would be nice here, but unfortunately
          # isn't a blessed tool.
@@ -8252,11 +9842,11 @@ EOF
            ;;
          esac
        done
-       deplibs="$tmp_deplibs"
+       deplibs=$tmp_deplibs
 
        if test -n "$convenience"; then
          if test -n "$whole_archive_flag_spec" &&
-           test "$compiler_needs_object" = yes &&
+           test yes = "$compiler_needs_object" &&
            test -z "$libobjs"; then
            # extract the archives, so we have objects to list.
            # TODO: could optimize this to just extract one archive.
@@ -8267,7 +9857,7 @@ EOF
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
            test "X$libobjs" = "X " && libobjs=
          else
-           gentop="$output_objdir/${outputname}x"
+           gentop=$output_objdir/${outputname}x
            func_append generated " $gentop"
 
            func_extract_archives $gentop $convenience
@@ -8276,18 +9866,18 @@ EOF
          fi
        fi
 
-       if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+       if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
          eval flag=\"$thread_safe_flag_spec\"
          func_append linker_flags " $flag"
        fi
 
        # Make a backup of the uninstalled library when relinking
-       if test "$opt_mode" = relink; then
+       if test relink = "$opt_mode"; then
          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
        fi
 
        # Do each of the archive commands.
-       if test "$module" = yes && test -n "$module_cmds" ; then
+       if test yes = "$module" && test -n "$module_cmds"; then
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
            eval test_cmds=\"$module_expsym_cmds\"
            cmds=$module_expsym_cmds
@@ -8305,7 +9895,7 @@ EOF
          fi
        fi
 
-       if test "X$skipped_export" != "X:" &&
+       if test : != "$skipped_export" &&
           func_len " $test_cmds" &&
           len=$func_len_result &&
           test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
@@ -8338,8 +9928,8 @@ EOF
          last_robj=
          k=1
 
-         if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
-           output=${output_objdir}/${output_la}.lnkscript
+         if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
+           output=$output_objdir/$output_la.lnkscript
            func_verbose "creating GNU ld script: $output"
            echo 'INPUT (' > $output
            for obj in $save_libobjs
@@ -8351,14 +9941,14 @@ EOF
            func_append delfiles " $output"
            func_to_tool_file "$output"
            output=$func_to_tool_file_result
-         elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
-           output=${output_objdir}/${output_la}.lnk
+         elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
+           output=$output_objdir/$output_la.lnk
            func_verbose "creating linker input file list: $output"
            : > $output
            set x $save_libobjs
            shift
            firstobj=
-           if test "$compiler_needs_object" = yes; then
+           if test yes = "$compiler_needs_object"; then
              firstobj="$1 "
              shift
            fi
@@ -8373,7 +9963,7 @@ EOF
          else
            if test -n "$save_libobjs"; then
              func_verbose "creating reloadable object files..."
-             output=$output_objdir/$output_la-${k}.$objext
+             output=$output_objdir/$output_la-$k.$objext
              eval test_cmds=\"$reload_cmds\"
              func_len " $test_cmds"
              len0=$func_len_result
@@ -8385,13 +9975,13 @@ EOF
                func_len " $obj"
                func_arith $len + $func_len_result
                len=$func_arith_result
-               if test "X$objlist" = X ||
+               if test -z "$objlist" ||
                   test "$len" -lt "$max_cmd_len"; then
                  func_append objlist " $obj"
                else
                  # The command $test_cmds is almost too long, add a
                  # command to the queue.
-                 if test "$k" -eq 1 ; then
+                 if test 1 -eq "$k"; then
                    # The first file doesn't have a previous command to add.
                    reload_objs=$objlist
                    eval concat_cmds=\"$reload_cmds\"
@@ -8401,10 +9991,10 @@ EOF
                    reload_objs="$objlist $last_robj"
                    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
                  fi
-                 last_robj=$output_objdir/$output_la-${k}.$objext
+                 last_robj=$output_objdir/$output_la-$k.$objext
                  func_arith $k + 1
                  k=$func_arith_result
-                 output=$output_objdir/$output_la-${k}.$objext
+                 output=$output_objdir/$output_la-$k.$objext
                  objlist=" $obj"
                  func_len " $last_robj"
                  func_arith $len0 + $func_len_result
@@ -8416,9 +10006,9 @@ EOF
              # files will link in the last one created.
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
              reload_objs="$objlist $last_robj"
-             eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+             eval concat_cmds=\"\$concat_cmds$reload_cmds\"
              if test -n "$last_robj"; then
-               eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+               eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
              fi
              func_append delfiles " $output"
 
@@ -8426,9 +10016,9 @@ EOF
              output=
            fi
 
-           if ${skipped_export-false}; then
-             func_verbose "generating symbol list for \`$libname.la'"
-             export_symbols="$output_objdir/$libname.exp"
+           ${skipped_export-false} && {
+             func_verbose "generating symbol list for '$libname.la'"
+             export_symbols=$output_objdir/$libname.exp
              $opt_dry_run || $RM $export_symbols
              libobjs=$output
              # Append the command to create the export file.
@@ -8437,16 +10027,16 @@ EOF
              if test -n "$last_robj"; then
                eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
              fi
-           fi
+           }
 
            test -n "$save_libobjs" &&
              func_verbose "creating a temporary reloadable object file: $output"
 
            # Loop through the commands generated above and execute them.
-           save_ifs="$IFS"; IFS='~'
+           save_ifs=$IFS; IFS='~'
            for cmd in $concat_cmds; do
-             IFS="$save_ifs"
-             $opt_silent || {
+             IFS=$save_ifs
+             $opt_quiet || {
                  func_quote_for_expand "$cmd"
                  eval "func_echo $func_quote_for_expand_result"
              }
@@ -8454,7 +10044,7 @@ EOF
                lt_exit=$?
 
                # Restore the uninstalled library and exit
-               if test "$opt_mode" = relink; then
+               if test relink = "$opt_mode"; then
                  ( cd "$output_objdir" && \
                    $RM "${realname}T" && \
                    $MV "${realname}U" "$realname" )
@@ -8463,7 +10053,7 @@ EOF
                exit $lt_exit
              }
            done
-           IFS="$save_ifs"
+           IFS=$save_ifs
 
            if test -n "$export_symbols_regex" && ${skipped_export-false}; then
              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
@@ -8471,18 +10061,18 @@ EOF
            fi
          fi
 
-          if ${skipped_export-false}; then
+          ${skipped_export-false} && {
            if test -n "$export_symbols" && test -n "$include_expsyms"; then
-             tmp_export_symbols="$export_symbols"
-             test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+             tmp_export_symbols=$export_symbols
+             test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
              $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
            fi
 
            if test -n "$orig_export_symbols"; then
              # The given exports_symbols file has to be filtered, so filter it.
-             func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+             func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
              # FIXME: $output_objdir/$libname.filter potentially contains lots of
-             # 's' commands which not all seds can handle. GNU sed should be fine
+             # 's' commands, which not all seds can handle. GNU sed should be fine
              # though. Also, the filter scales superlinearly with the number of
              # global variables. join(1) would be nice here, but unfortunately
              # isn't a blessed tool.
@@ -8491,7 +10081,7 @@ EOF
              export_symbols=$output_objdir/$libname.def
              $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
            fi
-         fi
+         }
 
          libobjs=$output
          # Restore the value of output.
@@ -8505,7 +10095,7 @@ EOF
          # value of $libobjs for piecewise linking.
 
          # Do each of the archive commands.
-         if test "$module" = yes && test -n "$module_cmds" ; then
+         if test yes = "$module" && test -n "$module_cmds"; then
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
              cmds=$module_expsym_cmds
            else
@@ -8527,7 +10117,7 @@ EOF
 
        # Add any objects from preloaded convenience libraries
        if test -n "$dlprefiles"; then
-         gentop="$output_objdir/${outputname}x"
+         gentop=$output_objdir/${outputname}x
          func_append generated " $gentop"
 
          func_extract_archives $gentop $dlprefiles
@@ -8535,11 +10125,12 @@ EOF
          test "X$libobjs" = "X " && libobjs=
        fi
 
-       save_ifs="$IFS"; IFS='~'
+       save_ifs=$IFS; IFS='~'
        for cmd in $cmds; do
-         IFS="$save_ifs"
+         IFS=$sp$nl
          eval cmd=\"$cmd\"
-         $opt_silent || {
+         IFS=$save_ifs
+         $opt_quiet || {
            func_quote_for_expand "$cmd"
            eval "func_echo $func_quote_for_expand_result"
          }
@@ -8547,7 +10138,7 @@ EOF
            lt_exit=$?
 
            # Restore the uninstalled library and exit
-           if test "$opt_mode" = relink; then
+           if test relink = "$opt_mode"; then
              ( cd "$output_objdir" && \
                $RM "${realname}T" && \
                $MV "${realname}U" "$realname" )
@@ -8556,10 +10147,10 @@ EOF
            exit $lt_exit
          }
        done
-       IFS="$save_ifs"
+       IFS=$save_ifs
 
        # Restore the uninstalled library and exit
-       if test "$opt_mode" = relink; then
+       if test relink = "$opt_mode"; then
          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
          if test -n "$convenience"; then
@@ -8579,39 +10170,39 @@ EOF
        done
 
        # If -module or -export-dynamic was specified, set the dlname.
-       if test "$module" = yes || test "$export_dynamic" = yes; then
+       if test yes = "$module" || test yes = "$export_dynamic"; then
          # On all known operating systems, these are identical.
-         dlname="$soname"
+         dlname=$soname
        fi
       fi
       ;;
 
     obj)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-       func_warning "\`-dlopen' is ignored for objects"
+      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
+       func_warning "'-dlopen' is ignored for objects"
       fi
 
       case " $deplibs" in
       *\ -l* | *\ -L*)
-       func_warning "\`-l' and \`-L' are ignored for objects" ;;
+       func_warning "'-l' and '-L' are ignored for objects" ;;
       esac
 
       test -n "$rpath" && \
-       func_warning "\`-rpath' is ignored for objects"
+       func_warning "'-rpath' is ignored for objects"
 
       test -n "$xrpath" && \
-       func_warning "\`-R' is ignored for objects"
+       func_warning "'-R' is ignored for objects"
 
       test -n "$vinfo" && \
-       func_warning "\`-version-info' is ignored for objects"
+       func_warning "'-version-info' is ignored for objects"
 
       test -n "$release" && \
-       func_warning "\`-release' is ignored for objects"
+       func_warning "'-release' is ignored for objects"
 
       case $output in
       *.lo)
        test -n "$objs$old_deplibs" && \
-         func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+         func_fatal_error "cannot build library object '$output' from non-libtool objects"
 
        libobj=$output
        func_lo2o "$libobj"
@@ -8619,7 +10210,7 @@ EOF
        ;;
       *)
        libobj=
-       obj="$output"
+       obj=$output
        ;;
       esac
 
@@ -8632,17 +10223,19 @@ EOF
       # the extraction.
       reload_conv_objs=
       gentop=
-      # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec and hope we can get by with
-      # turning comma into space..
-      wl=
-
+      # if reload_cmds runs $LD directly, get rid of -Wl from
+      # whole_archive_flag_spec and hope we can get by with turning comma
+      # into space.
+      case $reload_cmds in
+        *\$LD[\ \$]*) wl= ;;
+      esac
       if test -n "$convenience"; then
        if test -n "$whole_archive_flag_spec"; then
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-         reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+         test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+         reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
        else
-         gentop="$output_objdir/${obj}x"
+         gentop=$output_objdir/${obj}x
          func_append generated " $gentop"
 
          func_extract_archives $gentop $convenience
@@ -8651,12 +10244,12 @@ EOF
       fi
 
       # If we're not building shared, we need to use non_pic_objs
-      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+      test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
 
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
 
-      output="$obj"
+      output=$obj
       func_execute_cmds "$reload_cmds" 'exit $?'
 
       # Exit if we aren't doing a library object file.
@@ -8668,7 +10261,7 @@ EOF
        exit $EXIT_SUCCESS
       fi
 
-      if test "$build_libtool_libs" != yes; then
+      test yes = "$build_libtool_libs" || {
        if test -n "$gentop"; then
          func_show_eval '${RM}r "$gentop"'
        fi
@@ -8678,12 +10271,12 @@ EOF
        # $show "echo timestamp > $libobj"
        # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
        exit $EXIT_SUCCESS
-      fi
+      }
 
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
+      if test -n "$pic_flag" || test default != "$pic_mode"; then
        # Only do commands if we really have different PIC objects.
        reload_objs="$libobjs $reload_conv_objs"
-       output="$libobj"
+       output=$libobj
        func_execute_cmds "$reload_cmds" 'exit $?'
       fi
 
@@ -8700,16 +10293,14 @@ EOF
                  output=$func_stripname_result.exe;;
       esac
       test -n "$vinfo" && \
-       func_warning "\`-version-info' is ignored for programs"
+       func_warning "'-version-info' is ignored for programs"
 
       test -n "$release" && \
-       func_warning "\`-release' is ignored for programs"
+       func_warning "'-release' is ignored for programs"
 
-      test "$preload" = yes \
-        && test "$dlopen_support" = unknown \
-       && test "$dlopen_self" = unknown \
-       && test "$dlopen_self_static" = unknown && \
-         func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+      $preload \
+       && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
+       && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
 
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
@@ -8723,11 +10314,11 @@ EOF
       *-*-darwin*)
        # Don't allow lazy linking, it breaks C++ global constructors
        # But is supposedly fixed on 10.4 or later (yay!).
-       if test "$tagname" = CXX ; then
+       if test CXX = "$tagname"; then
          case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
            10.[0123])
-             func_append compile_command " ${wl}-bind_at_load"
-             func_append finalize_command " ${wl}-bind_at_load"
+             func_append compile_command " $wl-bind_at_load"
+             func_append finalize_command " $wl-bind_at_load"
            ;;
          esac
        fi
@@ -8763,7 +10354,7 @@ EOF
        *) func_append new_libs " $deplib" ;;
        esac
       done
-      compile_deplibs="$new_libs"
+      compile_deplibs=$new_libs
 
 
       func_append compile_command " $compile_deplibs"
@@ -8787,7 +10378,7 @@ EOF
        if test -n "$hardcode_libdir_flag_spec"; then
          if test -n "$hardcode_libdir_separator"; then
            if test -z "$hardcode_libdirs"; then
-             hardcode_libdirs="$libdir"
+             hardcode_libdirs=$libdir
            else
              # Just accumulate the unique libdirs.
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
@@ -8810,7 +10401,7 @@ EOF
        fi
        case $host in
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-         testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+         testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
          case :$dllsearchpath: in
          *":$libdir:"*) ;;
          ::) dllsearchpath=$libdir;;
@@ -8827,10 +10418,10 @@ EOF
       # Substitute the hardcoded libdirs into the rpath.
       if test -n "$hardcode_libdir_separator" &&
         test -n "$hardcode_libdirs"; then
-       libdir="$hardcode_libdirs"
+       libdir=$hardcode_libdirs
        eval rpath=\" $hardcode_libdir_flag_spec\"
       fi
-      compile_rpath="$rpath"
+      compile_rpath=$rpath
 
       rpath=
       hardcode_libdirs=
@@ -8838,7 +10429,7 @@ EOF
        if test -n "$hardcode_libdir_flag_spec"; then
          if test -n "$hardcode_libdir_separator"; then
            if test -z "$hardcode_libdirs"; then
-             hardcode_libdirs="$libdir"
+             hardcode_libdirs=$libdir
            else
              # Just accumulate the unique libdirs.
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
@@ -8863,45 +10454,43 @@ EOF
       # Substitute the hardcoded libdirs into the rpath.
       if test -n "$hardcode_libdir_separator" &&
         test -n "$hardcode_libdirs"; then
-       libdir="$hardcode_libdirs"
+       libdir=$hardcode_libdirs
        eval rpath=\" $hardcode_libdir_flag_spec\"
       fi
-      finalize_rpath="$rpath"
+      finalize_rpath=$rpath
 
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+      if test -n "$libobjs" && test yes = "$build_old_libs"; then
        # Transform all the library objects into standard objects.
        compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
        finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
       fi
 
-      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+      func_generate_dlsyms "$outputname" "@PROGRAM@" false
 
       # template prelinking step
       if test -n "$prelink_cmds"; then
        func_execute_cmds "$prelink_cmds" 'exit $?'
       fi
 
-      wrappers_required=yes
+      wrappers_required=:
       case $host in
       *cegcc* | *mingw32ce*)
         # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
-        wrappers_required=no
+        wrappers_required=false
         ;;
       *cygwin* | *mingw* )
-        if test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
+        test yes = "$build_libtool_libs" || wrappers_required=false
         ;;
       *)
-        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
-          wrappers_required=no
+        if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
+          wrappers_required=false
         fi
         ;;
       esac
-      if test "$wrappers_required" = no; then
+      $wrappers_required || {
        # Replace the output file specification.
        compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
-       link_command="$compile_command$compile_rpath"
+       link_command=$compile_command$compile_rpath
 
        # We have no uninstalled library dependencies, so finalize right now.
        exit_status=0
@@ -8914,12 +10503,12 @@ EOF
        fi
 
        # Delete the generated files.
-       if test -f "$output_objdir/${outputname}S.${objext}"; then
-         func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+       if test -f "$output_objdir/${outputname}S.$objext"; then
+         func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
        fi
 
        exit $exit_status
-      fi
+      }
 
       if test -n "$compile_shlibpath$finalize_shlibpath"; then
        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
@@ -8949,9 +10538,9 @@ EOF
        fi
       fi
 
-      if test "$no_install" = yes; then
+      if test yes = "$no_install"; then
        # We don't need to create a wrapper script.
-       link_command="$compile_var$compile_command$compile_rpath"
+       link_command=$compile_var$compile_command$compile_rpath
        # Replace the output file specification.
        link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
        # Delete the old output file.
@@ -8968,27 +10557,28 @@ EOF
        exit $EXIT_SUCCESS
       fi
 
-      if test "$hardcode_action" = relink; then
-       # Fast installation is not supported
-       link_command="$compile_var$compile_command$compile_rpath"
-       relink_command="$finalize_var$finalize_command$finalize_rpath"
+      case $hardcode_action,$fast_install in
+        relink,*)
+         # Fast installation is not supported
+         link_command=$compile_var$compile_command$compile_rpath
+         relink_command=$finalize_var$finalize_command$finalize_rpath
 
-       func_warning "this platform does not like uninstalled shared libraries"
-       func_warning "\`$output' will be relinked during installation"
-      else
-       if test "$fast_install" != no; then
-         link_command="$finalize_var$compile_command$finalize_rpath"
-         if test "$fast_install" = yes; then
-           relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
-         else
-           # fast_install is set to needless
-           relink_command=
-         fi
-       else
-         link_command="$compile_var$compile_command$compile_rpath"
-         relink_command="$finalize_var$finalize_command$finalize_rpath"
-       fi
-      fi
+         func_warning "this platform does not like uninstalled shared libraries"
+         func_warning "'$output' will be relinked during installation"
+         ;;
+        *,yes)
+         link_command=$finalize_var$compile_command$finalize_rpath
+         relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+          ;;
+       *,no)
+         link_command=$compile_var$compile_command$compile_rpath
+         relink_command=$finalize_var$finalize_command$finalize_rpath
+          ;;
+       *,needless)
+         link_command=$finalize_var$compile_command$finalize_rpath
+         relink_command=
+          ;;
+      esac
 
       # Replace the output file specification.
       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
@@ -9045,8 +10635,8 @@ EOF
            func_dirname_and_basename "$output" "" "."
            output_name=$func_basename_result
            output_path=$func_dirname_result
-           cwrappersource="$output_path/$objdir/lt-$output_name.c"
-           cwrapper="$output_path/$output_name.exe"
+           cwrappersource=$output_path/$objdir/lt-$output_name.c
+           cwrapper=$output_path/$output_name.exe
            $RM $cwrappersource $cwrapper
            trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
@@ -9067,7 +10657,7 @@ EOF
            trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
            $opt_dry_run || {
              # note: this script will not be executed, so do not chmod.
-             if test "x$build" = "x$host" ; then
+             if test "x$build" = "x$host"; then
                $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
              else
                func_emit_wrapper no > $func_ltwrapper_scriptname_result
@@ -9090,25 +10680,27 @@ EOF
     # See if we need to build an old-fashioned archive.
     for oldlib in $oldlibs; do
 
-      if test "$build_libtool_libs" = convenience; then
-       oldobjs="$libobjs_save $symfileobj"
-       addlibs="$convenience"
-       build_libtool_libs=no
-      else
-       if test "$build_libtool_libs" = module; then
-         oldobjs="$libobjs_save"
+      case $build_libtool_libs in
+        convenience)
+         oldobjs="$libobjs_save $symfileobj"
+         addlibs=$convenience
          build_libtool_libs=no
-       else
+         ;;
+       module)
+         oldobjs=$libobjs_save
+         addlibs=$old_convenience
+         build_libtool_libs=no
+          ;;
+       *)
          oldobjs="$old_deplibs $non_pic_objects"
-         if test "$preload" = yes && test -f "$symfileobj"; then
-           func_append oldobjs " $symfileobj"
-         fi
-       fi
-       addlibs="$old_convenience"
-      fi
+         $preload && test -f "$symfileobj" \
+           && func_append oldobjs " $symfileobj"
+         addlibs=$old_convenience
+         ;;
+      esac
 
       if test -n "$addlibs"; then
-       gentop="$output_objdir/${outputname}x"
+       gentop=$output_objdir/${outputname}x
        func_append generated " $gentop"
 
        func_extract_archives $gentop $addlibs
@@ -9116,13 +10708,13 @@ EOF
       fi
 
       # Do each command in the archive commands.
-      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+      if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
        cmds=$old_archive_from_new_cmds
       else
 
        # Add any objects from preloaded convenience libraries
        if test -n "$dlprefiles"; then
-         gentop="$output_objdir/${outputname}x"
+         gentop=$output_objdir/${outputname}x
          func_append generated " $gentop"
 
          func_extract_archives $gentop $dlprefiles
@@ -9143,7 +10735,7 @@ EOF
          :
        else
          echo "copying selected object files to avoid basename conflicts..."
-         gentop="$output_objdir/${outputname}x"
+         gentop=$output_objdir/${outputname}x
          func_append generated " $gentop"
          func_mkdir_p "$gentop"
          save_oldobjs=$oldobjs
@@ -9152,7 +10744,7 @@ EOF
          for obj in $save_oldobjs
          do
            func_basename "$obj"
-           objbase="$func_basename_result"
+           objbase=$func_basename_result
            case " $oldobjs " in
            " ") oldobjs=$obj ;;
            *[\ /]"$objbase "*)
@@ -9221,18 +10813,18 @@ EOF
            else
              # the above command should be used before it gets too long
              oldobjs=$objlist
-             if test "$obj" = "$last_oldobj" ; then
+             if test "$obj" = "$last_oldobj"; then
                RANLIB=$save_RANLIB
              fi
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-             eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+             eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
              objlist=
              len=$len0
            fi
          done
          RANLIB=$save_RANLIB
          oldobjs=$objlist
-         if test "X$oldobjs" = "X" ; then
+         if test -z "$oldobjs"; then
            eval cmds=\"\$concat_cmds\"
          else
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
@@ -9249,7 +10841,7 @@ EOF
     case $output in
     *.la)
       old_library=
-      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      test yes = "$build_old_libs" && old_library=$libname.$libext
       func_verbose "creating $output"
 
       # Preserve any variables that may affect compiler behavior
@@ -9264,31 +10856,31 @@ EOF
        fi
       done
       # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
-      if test "$hardcode_automatic" = yes ; then
+      if test yes = "$hardcode_automatic"; then
        relink_command=
       fi
 
       # Only create the output if not a dry run.
       $opt_dry_run || {
        for installed in no yes; do
-         if test "$installed" = yes; then
+         if test yes = "$installed"; then
            if test -z "$install_libdir"; then
              break
            fi
-           output="$output_objdir/$outputname"i
+           output=$output_objdir/${outputname}i
            # Replace all uninstalled libtool libraries with the installed ones
            newdependency_libs=
            for deplib in $dependency_libs; do
              case $deplib in
              *.la)
                func_basename "$deplib"
-               name="$func_basename_result"
+               name=$func_basename_result
                func_resolve_sysroot "$deplib"
-               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+               eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
                test -z "$libdir" && \
-                 func_fatal_error "\`$deplib' is not a valid libtool archive"
+                 func_fatal_error "'$deplib' is not a valid libtool archive"
                func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
                ;;
              -L*)
@@ -9304,23 +10896,23 @@ EOF
              *) func_append newdependency_libs " $deplib" ;;
              esac
            done
-           dependency_libs="$newdependency_libs"
+           dependency_libs=$newdependency_libs
            newdlfiles=
 
            for lib in $dlfiles; do
              case $lib in
              *.la)
                func_basename "$lib"
-               name="$func_basename_result"
-               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               name=$func_basename_result
+               eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
                test -z "$libdir" && \
-                 func_fatal_error "\`$lib' is not a valid libtool archive"
+                 func_fatal_error "'$lib' is not a valid libtool archive"
                func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
                ;;
              *) func_append newdlfiles " $lib" ;;
              esac
            done
-           dlfiles="$newdlfiles"
+           dlfiles=$newdlfiles
            newdlprefiles=
            for lib in $dlprefiles; do
              case $lib in
@@ -9330,34 +10922,34 @@ EOF
                # didn't already link the preopened objects directly into
                # the library:
                func_basename "$lib"
-               name="$func_basename_result"
-               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               name=$func_basename_result
+               eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
                test -z "$libdir" && \
-                 func_fatal_error "\`$lib' is not a valid libtool archive"
+                 func_fatal_error "'$lib' is not a valid libtool archive"
                func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
                ;;
              esac
            done
-           dlprefiles="$newdlprefiles"
+           dlprefiles=$newdlprefiles
          else
            newdlfiles=
            for lib in $dlfiles; do
              case $lib in
-               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
                *) abs=`pwd`"/$lib" ;;
              esac
              func_append newdlfiles " $abs"
            done
-           dlfiles="$newdlfiles"
+           dlfiles=$newdlfiles
            newdlprefiles=
            for lib in $dlprefiles; do
              case $lib in
-               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
                *) abs=`pwd`"/$lib" ;;
              esac
              func_append newdlprefiles " $abs"
            done
-           dlprefiles="$newdlprefiles"
+           dlprefiles=$newdlprefiles
          fi
          $RM $output
          # place dlname in correct position for cygwin
@@ -9373,10 +10965,9 @@ EOF
          case $host,$output,$installed,$module,$dlname in
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
              # If a -bindir argument was supplied, place the dll there.
-             if test "x$bindir" != x ;
-             then
+             if test -n "$bindir"; then
                func_relative_path "$install_libdir" "$bindir"
-               tdlname=$func_relative_path_result$dlname
+               tdlname=$func_relative_path_result/$dlname
              else
                # Otherwise fall back on heuristic.
                tdlname=../bin/$dlname
@@ -9385,7 +10976,7 @@ EOF
          esac
          $ECHO > $output "\
 # $outputname - a libtool library file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 #
 # Please DO NOT delete this file!
 # It is necessary for linking the library.
@@ -9399,7 +10990,7 @@ library_names='$library_names'
 # The name of the static archive.
 old_library='$old_library'
 
-# Linker flags that can not go in dependency_libs.
+# Linker flags that cannot go in dependency_libs.
 inherited_linker_flags='$new_inherited_linker_flags'
 
 # Libraries that this one depends upon.
@@ -9425,7 +11016,7 @@ dlpreopen='$dlprefiles'
 
 # Directory that this library needs to be installed in:
 libdir='$install_libdir'"
-         if test "$installed" = no && test "$need_relink" = yes; then
+         if test no,yes = "$installed,$need_relink"; then
            $ECHO >> $output "\
 relink_command=\"$relink_command\""
          fi
@@ -9440,27 +11031,29 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
-{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
-    func_mode_link ${1+"$@"}
+if test link = "$opt_mode" || test relink = "$opt_mode"; then
+  func_mode_link ${1+"$@"}
+fi
 
 
 # func_mode_uninstall arg...
 func_mode_uninstall ()
 {
-    $opt_debug
-    RM="$nonopt"
+    $debug_cmd
+
+    RM=$nonopt
     files=
-    rmforce=
+    rmforce=false
     exit_status=0
 
     # This variable tells wrapper scripts just to set variables rather
     # than running their programs.
-    libtool_install_magic="$magic"
+    libtool_install_magic=$magic
 
     for arg
     do
       case $arg in
-      -f) func_append RM " $arg"; rmforce=yes ;;
+      -f) func_append RM " $arg"; rmforce=: ;;
       -*) func_append RM " $arg" ;;
       *) func_append files " $arg" ;;
       esac
@@ -9473,18 +11066,18 @@ func_mode_uninstall ()
 
     for file in $files; do
       func_dirname "$file" "" "."
-      dir="$func_dirname_result"
-      if test "X$dir" = X.; then
-       odir="$objdir"
+      dir=$func_dirname_result
+      if test . = "$dir"; then
+       odir=$objdir
       else
-       odir="$dir/$objdir"
+       odir=$dir/$objdir
       fi
       func_basename "$file"
-      name="$func_basename_result"
-      test "$opt_mode" = uninstall && odir="$dir"
+      name=$func_basename_result
+      test uninstall = "$opt_mode" && odir=$dir
 
       # Remember odir for removal later, being careful to avoid duplicates
-      if test "$opt_mode" = clean; then
+      if test clean = "$opt_mode"; then
        case " $rmdirs " in
          *" $odir "*) ;;
          *) func_append rmdirs " $odir" ;;
@@ -9499,11 +11092,11 @@ func_mode_uninstall ()
       elif test -d "$file"; then
        exit_status=1
        continue
-      elif test "$rmforce" = yes; then
+      elif $rmforce; then
        continue
       fi
 
-      rmfiles="$file"
+      rmfiles=$file
 
       case $name in
       *.la)
@@ -9517,7 +11110,7 @@ func_mode_uninstall ()
          done
          test -n "$old_library" && func_append rmfiles " $odir/$old_library"
 
-         case "$opt_mode" in
+         case $opt_mode in
          clean)
            case " $library_names " in
            *" $dlname "*) ;;
@@ -9528,12 +11121,12 @@ func_mode_uninstall ()
          uninstall)
            if test -n "$library_names"; then
              # Do each command in the postuninstall commands.
-             func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+             func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
            fi
 
            if test -n "$old_library"; then
              # Do each command in the old_postuninstall commands.
-             func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+             func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
            fi
            # FIXME: should reinstall the best remaining shared library.
            ;;
@@ -9549,21 +11142,19 @@ func_mode_uninstall ()
          func_source $dir/$name
 
          # Add PIC object to the list of files to remove.
-         if test -n "$pic_object" &&
-            test "$pic_object" != none; then
+         if test -n "$pic_object" && test none != "$pic_object"; then
            func_append rmfiles " $dir/$pic_object"
          fi
 
          # Add non-PIC object to the list of files to remove.
-         if test -n "$non_pic_object" &&
-            test "$non_pic_object" != none; then
+         if test -n "$non_pic_object" && test none != "$non_pic_object"; then
            func_append rmfiles " $dir/$non_pic_object"
          fi
        fi
        ;;
 
       *)
-       if test "$opt_mode" = clean ; then
+       if test clean = "$opt_mode"; then
          noexename=$name
          case $file in
          *.exe)
@@ -9590,12 +11181,12 @@ func_mode_uninstall ()
 
            # note $name still contains .exe if it was in $file originally
            # as does the version of $file that was added into $rmfiles
-           func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
-           if test "$fast_install" = yes && test -n "$relink_command"; then
+           func_append rmfiles " $odir/$name $odir/${name}S.$objext"
+           if test yes = "$fast_install" && test -n "$relink_command"; then
              func_append rmfiles " $odir/lt-$name"
            fi
-           if test "X$noexename" != "X$name" ; then
-             func_append rmfiles " $odir/lt-${noexename}.c"
+           if test "X$noexename" != "X$name"; then
+             func_append rmfiles " $odir/lt-$noexename.c"
            fi
          fi
        fi
@@ -9604,7 +11195,7 @@ func_mode_uninstall ()
       func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
 
-    # Try to remove the ${objdir}s in the directories where we deleted files
+    # Try to remove the $objdir's in the directories where we deleted files
     for dir in $rmdirs; do
       if test -d "$dir"; then
        func_show_eval "rmdir $dir >/dev/null 2>&1"
@@ -9614,16 +11205,17 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
-{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
-    func_mode_uninstall ${1+"$@"}
+if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
+  func_mode_uninstall ${1+"$@"}
+fi
 
 test -z "$opt_mode" && {
-  help="$generic_help"
+  help=$generic_help
   func_fatal_help "you must specify a MODE"
 }
 
 test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$opt_mode'"
+  func_fatal_help "invalid operation mode '$opt_mode'"
 
 if test -n "$exec_cmd"; then
   eval exec "$exec_cmd"
@@ -9634,7 +11226,7 @@ exit $exit_status
 
 
 # The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries.  Given conflicting
+# where we disable both kinds of libraries.  Given conflicting
 # choices, we go for a static library, that is the most portable,
 # since we can't tell whether shared libraries were disabled because
 # the user asked for that or because the platform doesn't support
@@ -9657,5 +11249,3 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 # mode:shell-script
 # sh-indentation:2
 # End:
-# vi:sw=2
-
index dae3d81..8d1f066 100644 (file)
@@ -1,5 +1,5 @@
-# gettext.m4 serial 53 (gettext-0.15)
-dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
+# gettext.m4 serial 66 (gettext-0.18.2)
+dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,7 @@ dnl They are *not* in the public domain.
 
 dnl Authors:
 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2005.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
 
 dnl Macro to add for using GNU gettext.
 
@@ -35,7 +35,7 @@ dnl    will be ignored.  If NEEDSYMBOL is specified and is
 dnl    'need-formatstring-macros', then GNU gettext implementations that don't
 dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
 dnl INTLDIR is used to find the intl libraries.  If empty,
-dnl    the value `$(top_builddir)/intl/' is used.
+dnl    the value '$(top_builddir)/intl/' is used.
 dnl
 dnl The result of the configuration is one of three cases:
 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
@@ -60,11 +60,18 @@ AC_DEFUN([AM_GNU_GETTEXT],
   ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
     [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
 ])])])])])
+  ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
+    [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
   ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
     [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
 ])])])])
-  define([gt_included_intl], ifelse([$1], [external], [no], [yes]))
+  define([gt_included_intl],
+    ifelse([$1], [external],
+      ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
+      [yes]))
   define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
+  gt_NEEDS_INIT
+  AM_GNU_GETTEXT_NEED([$2])
 
   AC_REQUIRE([AM_PO_SUBDIRS])dnl
   ifelse(gt_included_intl, yes, [
@@ -78,7 +85,7 @@ AC_DEFUN([AM_GNU_GETTEXT],
   dnl Sometimes libintl requires libiconv, so first search for libiconv.
   dnl Ideally we would do this search only after the
   dnl      if test "$USE_NLS" = "yes"; then
-  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
   dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
   dnl the configure script would need to contain the same shell code
   dnl again, outside any 'if'. There are two solutions:
@@ -90,7 +97,7 @@ AC_DEFUN([AM_GNU_GETTEXT],
     AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
   ])
 
-  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
+  dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
   gt_INTL_MACOSX
 
   dnl Set USE_NLS.
@@ -104,16 +111,25 @@ AC_DEFUN([AM_GNU_GETTEXT],
   LTLIBINTL=
   POSUB=
 
+  dnl Add a version number to the cache macros.
+  case " $gt_needs " in
+    *" need-formatstring-macros "*) gt_api_version=3 ;;
+    *" need-ngettext "*) gt_api_version=2 ;;
+    *) gt_api_version=1 ;;
+  esac
+  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
+  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
+
   dnl If we use NLS figure out what method
   if test "$USE_NLS" = "yes"; then
     gt_use_preinstalled_gnugettext=no
     ifelse(gt_included_intl, yes, [
       AC_MSG_CHECKING([whether included gettext is requested])
-      AC_ARG_WITH(included-gettext,
+      AC_ARG_WITH([included-gettext],
         [  --with-included-gettext use the GNU gettext library included here],
         nls_cv_force_use_gnu_gettext=$withval,
         nls_cv_force_use_gnu_gettext=no)
-      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+      AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
 
       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
@@ -122,26 +138,41 @@ AC_DEFUN([AM_GNU_GETTEXT],
         dnl to use.  If GNU gettext is available we use this.  Else we have
         dnl to fall back to GNU NLS library.
 
-        dnl Add a version number to the cache macros.
-        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
-        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
-        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
-
-        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
-         [AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+        if test $gt_api_version -ge 3; then
+          gt_revision_test_code='
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
 #endif
+changequote(,)dnl
 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-]], [])[extern int _nl_msg_cat_cntr;
-extern int *_nl_domain_bindings;],
-            [bindtextdomain ("", "");
-return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
-            gt_cv_func_gnugettext_libc=yes,
-            gt_cv_func_gnugettext_libc=no)])
-
-        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+changequote([,])dnl
+'
+        else
+          gt_revision_test_code=
+        fi
+        if test $gt_api_version -ge 2; then
+          gt_expression_test_code=' + * ngettext ("", "", 0)'
+        else
+          gt_expression_test_code=
+        fi
+
+        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
+         [AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM(
+               [[
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+               ]],
+               [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings
+               ]])],
+            [eval "$gt_func_gnugettext_libc=yes"],
+            [eval "$gt_func_gnugettext_libc=no"])])
+
+        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
           dnl Sometimes libintl requires libiconv, so first search for libiconv.
           ifelse(gt_included_intl, yes, , [
             AM_ICONV_LINK
@@ -152,49 +183,53 @@ return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)],
           dnl even if libiconv doesn't exist.
           AC_LIB_LINKFLAGS_BODY([intl])
           AC_CACHE_CHECK([for GNU gettext in libintl],
-            gt_cv_func_gnugettext_libintl,
+            [$gt_func_gnugettext_libintl],
            [gt_save_CPPFLAGS="$CPPFLAGS"
             CPPFLAGS="$CPPFLAGS $INCINTL"
             gt_save_LIBS="$LIBS"
             LIBS="$LIBS $LIBINTL"
             dnl Now see whether libintl exists and does not depend on libiconv.
-            AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-]], [])[extern int _nl_msg_cat_cntr;
+            AC_LINK_IFELSE(
+              [AC_LANG_PROGRAM(
+                 [[
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
 extern
 #ifdef __cplusplus
 "C"
 #endif
-const char *_nl_expand_alias (const char *);],
-              [bindtextdomain ("", "");
-return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
-              gt_cv_func_gnugettext_libintl=yes,
-              gt_cv_func_gnugettext_libintl=no)
+const char *_nl_expand_alias (const char *);
+                 ]],
+                 [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+                 ]])],
+              [eval "$gt_func_gnugettext_libintl=yes"],
+              [eval "$gt_func_gnugettext_libintl=no"])
             dnl Now see whether libintl exists and depends on libiconv.
-            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
+            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
               LIBS="$LIBS $LIBICONV"
-              AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-]], [])[extern int _nl_msg_cat_cntr;
+              AC_LINK_IFELSE(
+                [AC_LANG_PROGRAM(
+                   [[
+#include <libintl.h>
+$gt_revision_test_code
+extern int _nl_msg_cat_cntr;
 extern
 #ifdef __cplusplus
 "C"
 #endif
-const char *_nl_expand_alias (const char *);],
-                [bindtextdomain ("", "");
-return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
-               [LIBINTL="$LIBINTL $LIBICONV"
-                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
-                gt_cv_func_gnugettext_libintl=yes
-               ])
+const char *_nl_expand_alias (const char *);
+                   ]],
+                   [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+                   ]])],
+                [LIBINTL="$LIBINTL $LIBICONV"
+                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                 eval "$gt_func_gnugettext_libintl=yes"
+                ])
             fi
             CPPFLAGS="$gt_save_CPPFLAGS"
             LIBS="$gt_save_LIBS"])
@@ -204,8 +239,8 @@ return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)],
         dnl use it.  But if this macro is used in GNU gettext, and GNU
         dnl gettext is already preinstalled in libintl, we update this
         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
-        if test "$gt_cv_func_gnugettext_libc" = "yes" \
-           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
+        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
+           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
                 && test "$PACKAGE" != gettext-runtime \
                 && test "$PACKAGE" != gettext-tools; }; then
           gt_use_preinstalled_gnugettext=yes
@@ -252,7 +287,7 @@ return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)],
 
     if test "$gt_use_preinstalled_gnugettext" = "yes" \
        || test "$nls_cv_use_gnu_gettext" = "yes"; then
-      AC_DEFINE(ENABLE_NLS, 1,
+      AC_DEFINE([ENABLE_NLS], [1],
         [Define to 1 if translation of program messages to the user's native language
    is requested.])
     else
@@ -265,7 +300,7 @@ return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)],
   if test "$USE_NLS" = "yes"; then
     AC_MSG_CHECKING([where the gettext function comes from])
     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
-      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
         gt_source="external libintl"
       else
         gt_source="libc"
@@ -279,16 +314,16 @@ return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)],
   if test "$USE_NLS" = "yes"; then
 
     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
-      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
         AC_MSG_CHECKING([how to link with libintl])
         AC_MSG_RESULT([$LIBINTL])
         AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
       fi
 
       dnl For backward compatibility. Some packages may be using this.
-      AC_DEFINE(HAVE_GETTEXT, 1,
+      AC_DEFINE([HAVE_GETTEXT], [1],
        [Define if the GNU gettext() function is already present or preinstalled.])
-      AC_DEFINE(HAVE_DCGETTEXT, 1,
+      AC_DEFINE([HAVE_DCGETTEXT], [1],
        [Define if the GNU dcgettext() function is already present or preinstalled.])
     fi
 
@@ -304,9 +339,9 @@ return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)],
     fi
 
     dnl Make all variables we use known to autoconf.
-    AC_SUBST(BUILD_INCLUDED_LIBINTL)
-    AC_SUBST(USE_INCLUDED_LIBINTL)
-    AC_SUBST(CATOBJEXT)
+    AC_SUBST([BUILD_INCLUDED_LIBINTL])
+    AC_SUBST([USE_INCLUDED_LIBINTL])
+    AC_SUBST([CATOBJEXT])
 
     dnl For backward compatibility. Some configure.ins may be using this.
     nls_cv_header_intl=
@@ -314,316 +349,51 @@ return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)],
 
     dnl For backward compatibility. Some Makefiles may be using this.
     DATADIRNAME=share
-    AC_SUBST(DATADIRNAME)
+    AC_SUBST([DATADIRNAME])
 
     dnl For backward compatibility. Some Makefiles may be using this.
     INSTOBJEXT=.mo
-    AC_SUBST(INSTOBJEXT)
+    AC_SUBST([INSTOBJEXT])
 
     dnl For backward compatibility. Some Makefiles may be using this.
     GENCAT=gencat
-    AC_SUBST(GENCAT)
+    AC_SUBST([GENCAT])
 
     dnl For backward compatibility. Some Makefiles may be using this.
     INTLOBJS=
     if test "$USE_INCLUDED_LIBINTL" = yes; then
       INTLOBJS="\$(GETTOBJS)"
     fi
-    AC_SUBST(INTLOBJS)
+    AC_SUBST([INTLOBJS])
 
     dnl Enable libtool support if the surrounding package wishes it.
     INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
-    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
+    AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
   ])
 
   dnl For backward compatibility. Some Makefiles may be using this.
   INTLLIBS="$LIBINTL"
-  AC_SUBST(INTLLIBS)
+  AC_SUBST([INTLLIBS])
 
   dnl Make all documented variables known to autoconf.
-  AC_SUBST(LIBINTL)
-  AC_SUBST(LTLIBINTL)
-  AC_SUBST(POSUB)
+  AC_SUBST([LIBINTL])
+  AC_SUBST([LTLIBINTL])
+  AC_SUBST([POSUB])
 ])
 
 
-dnl Checks for all prerequisites of the intl subdirectory,
-dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
-dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
-AC_DEFUN([AM_INTL_SUBDIR],
+dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
+m4_define([gt_NEEDS_INIT],
 [
-  AC_REQUIRE([AC_PROG_INSTALL])dnl
-  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
-  AC_REQUIRE([AC_PROG_CC])dnl
-  AC_REQUIRE([AC_CANONICAL_HOST])dnl
-  AC_REQUIRE([gt_GLIBC2])dnl
-  AC_REQUIRE([AC_PROG_RANLIB])dnl
-  AC_REQUIRE([gl_VISIBILITY])dnl
-  AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
-  AC_REQUIRE([bh_C_SIGNED])dnl
-  AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl
-  AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
-  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
-  AC_REQUIRE([gt_TYPE_WINT_T])dnl
-  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
-  AC_REQUIRE([gt_TYPE_INTMAX_T])
-  AC_REQUIRE([gt_PRINTF_POSIX])
-  AC_REQUIRE([gl_GLIBC21])dnl
-  AC_REQUIRE([gl_XSIZE])dnl
-  AC_REQUIRE([gt_INTL_MACOSX])dnl
-
-  AC_CHECK_TYPE([ptrdiff_t], ,
-    [AC_DEFINE([ptrdiff_t], [long],
-       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
-    ])
-  AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
-  AC_CHECK_FUNCS([asprintf fwprintf putenv setenv setlocale snprintf wcslen])
-
-  dnl Use the _snprintf function only if it is declared (because on NetBSD it
-  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
-  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
-  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
-
-  dnl Use the *_unlocked functions only if they are declared.
-  dnl (because some of them were defined without being declared in Solaris
-  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
-  dnl on Solaris 2.5.1 to run on Solaris 2.6).
-  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
-  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
-
-  case $gt_cv_func_printf_posix in
-    *yes) HAVE_POSIX_PRINTF=1 ;;
-    *) HAVE_POSIX_PRINTF=0 ;;
-  esac
-  AC_SUBST([HAVE_POSIX_PRINTF])
-  if test "$ac_cv_func_asprintf" = yes; then
-    HAVE_ASPRINTF=1
-  else
-    HAVE_ASPRINTF=0
-  fi
-  AC_SUBST([HAVE_ASPRINTF])
-  if test "$ac_cv_func_snprintf" = yes; then
-    HAVE_SNPRINTF=1
-  else
-    HAVE_SNPRINTF=0
-  fi
-  AC_SUBST([HAVE_SNPRINTF])
-  if test "$ac_cv_func_wprintf" = yes; then
-    HAVE_WPRINTF=1
-  else
-    HAVE_WPRINTF=0
-  fi
-  AC_SUBST([HAVE_WPRINTF])
-
-  AM_LANGINFO_CODESET
-  gt_LC_MESSAGES
-
-  dnl Compilation on mingw and Cygwin needs special Makefile rules, because
-  dnl 1. when we install a shared library, we must arrange to export
-  dnl    auxiliary pointer variables for every exported variable,
-  dnl 2. when we install a shared library and a static library simultaneously,
-  dnl    the include file specifies __declspec(dllimport) and therefore we
-  dnl    must arrange to define the auxiliary pointer variables for the
-  dnl    exported variables _also_ in the static library.
-  if test "$enable_shared" = yes; then
-    case "$host_os" in
-      cygwin*) is_woe32dll=yes ;;
-      *) is_woe32dll=no ;;
-    esac
-  else
-    is_woe32dll=no
-  fi
-  WOE32DLL=$is_woe32dll
-  AC_SUBST([WOE32DLL])
-
-  dnl Rename some macros and functions used for locking.
-  AH_BOTTOM([
-#define __libc_lock_t                   gl_lock_t
-#define __libc_lock_define              gl_lock_define
-#define __libc_lock_define_initialized  gl_lock_define_initialized
-#define __libc_lock_init                gl_lock_init
-#define __libc_lock_lock                gl_lock_lock
-#define __libc_lock_unlock              gl_lock_unlock
-#define __libc_lock_recursive_t                   gl_recursive_lock_t
-#define __libc_lock_define_recursive              gl_recursive_lock_define
-#define __libc_lock_define_initialized_recursive  gl_recursive_lock_define_initialized
-#define __libc_lock_init_recursive                gl_recursive_lock_init
-#define __libc_lock_lock_recursive                gl_recursive_lock_lock
-#define __libc_lock_unlock_recursive              gl_recursive_lock_unlock
-#define glthread_in_use  libintl_thread_in_use
-#define glthread_lock_init     libintl_lock_init
-#define glthread_lock_lock     libintl_lock_lock
-#define glthread_lock_unlock   libintl_lock_unlock
-#define glthread_lock_destroy  libintl_lock_destroy
-#define glthread_rwlock_init     libintl_rwlock_init
-#define glthread_rwlock_rdlock   libintl_rwlock_rdlock
-#define glthread_rwlock_wrlock   libintl_rwlock_wrlock
-#define glthread_rwlock_unlock   libintl_rwlock_unlock
-#define glthread_rwlock_destroy  libintl_rwlock_destroy
-#define glthread_recursive_lock_init     libintl_recursive_lock_init
-#define glthread_recursive_lock_lock     libintl_recursive_lock_lock
-#define glthread_recursive_lock_unlock   libintl_recursive_lock_unlock
-#define glthread_recursive_lock_destroy  libintl_recursive_lock_destroy
-#define glthread_once                 libintl_once
-#define glthread_once_call            libintl_once_call
-#define glthread_once_singlethreaded  libintl_once_singlethreaded
-])
-])
-
-
-dnl Checks for the core files of the intl subdirectory:
-dnl   dcigettext.c
-dnl   eval-plural.h
-dnl   explodename.c
-dnl   finddomain.c
-dnl   gettextP.h
-dnl   gmo.h
-dnl   hash-string.h hash-string.c
-dnl   l10nflist.c
-dnl   libgnuintl.h.in (except the *printf stuff)
-dnl   loadinfo.h
-dnl   loadmsgcat.c
-dnl   localealias.c
-dnl   log.c
-dnl   plural-exp.h plural-exp.c
-dnl   plural.y
-dnl Used by libglocale.
-AC_DEFUN([gt_INTL_SUBDIR_CORE],
-[
-  AC_REQUIRE([AC_C_INLINE])dnl
-  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
-  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
-  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
-  AC_REQUIRE([AC_FUNC_MMAP])dnl
-  AC_REQUIRE([gt_INTDIV0])dnl
-  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
-  AC_REQUIRE([gl_HEADER_INTTYPES_H])dnl
-  AC_REQUIRE([gt_INTTYPES_PRI])dnl
-  AC_REQUIRE([gl_LOCK])dnl
-
-  AC_TRY_LINK(
-    [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
-    [],
-    [AC_DEFINE([HAVE_BUILTIN_EXPECT], 1,
-       [Define to 1 if the compiler understands __builtin_expect.])])
-
-  AC_CHECK_HEADERS([argz.h limits.h unistd.h sys/param.h])
-  AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
-    stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \
-    argz_next __fsetlocking])
-
-  dnl Use the *_unlocked functions only if they are declared.
-  dnl (because some of them were defined without being declared in Solaris
-  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
-  dnl on Solaris 2.5.1 to run on Solaris 2.6).
-  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
-  gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
-  gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
-
-  AM_ICONV
-
-  dnl glibc >= 2.4 has a NL_LOCALE_NAME macro when _GNU_SOURCE is defined,
-  dnl and a _NL_LOCALE_NAME macro always.
-  AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name,
-    [AC_TRY_LINK([#include <langinfo.h>
-#include <locale.h>],
-      [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));],
-      gt_cv_nl_locale_name=yes,
-      gt_cv_nl_locale_name=no)
-    ])
-  if test $gt_cv_nl_locale_name = yes; then
-    AC_DEFINE(HAVE_NL_LOCALE_NAME, 1,
-      [Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if _GNU_SOURCE is defined.])
-  fi
-
-  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
-  dnl because plural.y uses bison specific features. It requires at least
-  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
-  dnl compile.
-  dnl bison is only needed for the maintainer (who touches plural.y). But in
-  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
-  dnl the rule in general Makefile. Now, some people carelessly touch the
-  dnl files or have a broken "make" program, hence the plural.c rule will
-  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
-  dnl present or too old.
-  AC_CHECK_PROGS([INTLBISON], [bison])
-  if test -z "$INTLBISON"; then
-    ac_verc_fail=yes
-  else
-    dnl Found it, now check the version.
-    AC_MSG_CHECKING([version of bison])
-changequote(<<,>>)dnl
-    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
-    case $ac_prog_version in
-      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
-      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
-changequote([,])dnl
-         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
-      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
-    esac
-    AC_MSG_RESULT([$ac_prog_version])
-  fi
-  if test $ac_verc_fail = yes; then
-    INTLBISON=:
-  fi
-])
-
-
-dnl Checks for special options needed on MacOS X.
-dnl Defines INTL_MACOSX_LIBS.
-AC_DEFUN([gt_INTL_MACOSX],
-[
-  dnl Check for API introduced in MacOS X 10.2.
-  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
-    gt_cv_func_CFPreferencesCopyAppValue,
-    [gt_save_LIBS="$LIBS"
-     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
-     AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
-       [CFPreferencesCopyAppValue(NULL, NULL)],
-       [gt_cv_func_CFPreferencesCopyAppValue=yes],
-       [gt_cv_func_CFPreferencesCopyAppValue=no])
-     LIBS="$gt_save_LIBS"])
-  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
-    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
-      [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
-  fi
-  dnl Check for API introduced in MacOS X 10.3.
-  AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
-    [gt_save_LIBS="$LIBS"
-     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
-     AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
-       [gt_cv_func_CFLocaleCopyCurrent=yes],
-       [gt_cv_func_CFLocaleCopyCurrent=no])
-     LIBS="$gt_save_LIBS"])
-  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
-    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
-      [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
-  fi
-  INTL_MACOSX_LIBS=
-  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
-    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
-  fi
-  AC_SUBST([INTL_MACOSX_LIBS])
+  m4_divert_text([DEFAULTS], [gt_needs=])
+  m4_define([gt_NEEDS_INIT], [])
 ])
 
 
-dnl gt_CHECK_DECL(FUNC, INCLUDES)
-dnl Check whether a function is declared.
-AC_DEFUN([gt_CHECK_DECL],
+dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
+AC_DEFUN([AM_GNU_GETTEXT_NEED],
 [
-  AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
-    [AC_TRY_COMPILE([$2], [
-#ifndef $1
-  char *p = (char *) $1;
-#endif
-], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
-  if test $ac_cv_have_decl_$1 = yes; then
-    gt_value=1
-  else
-    gt_value=0
-  fi
-  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
-    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
+  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
 ])
 
 
index 654c415..a503646 100644 (file)
@@ -1,5 +1,5 @@
-# iconv.m4 serial AM4 (gettext-0.11.3)
-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+# iconv.m4 serial 18 (gettext-0.18.2)
+dnl Copyright (C) 2000-2002, 2007-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -21,6 +21,7 @@ AC_DEFUN([AM_ICONV_LINK],
 [
   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
   dnl those with the standalone portable GNU libiconv installed).
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
 
   dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
   dnl accordingly.
@@ -29,34 +30,170 @@ AC_DEFUN([AM_ICONV_LINK],
   dnl Add $INCICONV to CPPFLAGS before performing the following checks,
   dnl because if the user has installed libiconv and not disabled its use
   dnl via --without-libiconv-prefix, he wants to use it. The first
-  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+  dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
   am_save_CPPFLAGS="$CPPFLAGS"
   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
 
-  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
     am_cv_func_iconv="no, consider installing GNU libiconv"
     am_cv_lib_iconv=no
-    AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
-      [iconv_t cd = iconv_open("","");
-       iconv(cd,NULL,NULL,NULL,NULL);
-       iconv_close(cd);],
-      am_cv_func_iconv=yes)
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <iconv.h>
+         ]],
+         [[iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);]])],
+      [am_cv_func_iconv=yes])
     if test "$am_cv_func_iconv" != yes; then
       am_save_LIBS="$LIBS"
       LIBS="$LIBS $LIBICONV"
-      AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
-        [iconv_t cd = iconv_open("","");
-         iconv(cd,NULL,NULL,NULL,NULL);
-         iconv_close(cd);],
-        am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes)
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
+#include <stdlib.h>
+#include <iconv.h>
+           ]],
+           [[iconv_t cd = iconv_open("","");
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);]])],
+        [am_cv_lib_iconv=yes]
+        [am_cv_func_iconv=yes])
       LIBS="$am_save_LIBS"
     fi
   ])
   if test "$am_cv_func_iconv" = yes; then
-    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
+      dnl Solaris 10.
+      am_save_LIBS="$LIBS"
+      if test $am_cv_lib_iconv = yes; then
+        LIBS="$LIBS $LIBICONV"
+      fi
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <iconv.h>
+#include <string.h>
+int main ()
+{
+  int result = 0;
+  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+     returns.  */
+  {
+    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+    if (cd_utf8_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\342\202\254"; /* EURO SIGN */
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_utf8_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
+      }
+  }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
+      }
+  }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        const char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#if 0 /* This bug could be worked around by the caller.  */
+  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        char buf[50];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_88591_to_utf8,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if ((int)res > 0)
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#endif
+  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+     provided.  */
+  if (/* Try standardized names.  */
+      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+      /* Try IRIX, OSF/1 names.  */
+      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+      /* Try AIX names.  */
+      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+      /* Try HP-UX names.  */
+      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+    result |= 16;
+  return result;
+}]])],
+        [am_cv_func_iconv_works=yes],
+        [am_cv_func_iconv_works=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+           *)            am_cv_func_iconv_works="guessing yes" ;;
+         esac
+changequote([,])dnl
+        ])
+      LIBS="$am_save_LIBS"
+    ])
+    case "$am_cv_func_iconv_works" in
+      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+      *)   am_func_iconv=yes ;;
+    esac
+  else
+    am_func_iconv=no am_cv_lib_iconv=no
+  fi
+  if test "$am_func_iconv" = yes; then
+    AC_DEFINE([HAVE_ICONV], [1],
+      [Define if you have the iconv() function and it works.])
   fi
   if test "$am_cv_lib_iconv" = yes; then
     AC_MSG_CHECKING([how to link with libiconv])
@@ -68,34 +205,64 @@ AC_DEFUN([AM_ICONV_LINK],
     LIBICONV=
     LTLIBICONV=
   fi
-  AC_SUBST(LIBICONV)
-  AC_SUBST(LTLIBICONV)
+  AC_SUBST([LIBICONV])
+  AC_SUBST([LTLIBICONV])
 ])
 
-AC_DEFUN([AM_ICONV],
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+dnl This is tricky because of the way 'aclocal' is implemented:
+dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
+dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
+dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
+dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
+dnl   warnings.
+m4_define([gl_iconv_AC_DEFUN],
+  m4_version_prereq([2.64],
+    [[AC_DEFUN_ONCE(
+        [$1], [$2])]],
+    [m4_ifdef([gl_00GNULIB],
+       [[AC_DEFUN_ONCE(
+           [$1], [$2])]],
+       [[AC_DEFUN(
+           [$1], [$2])]])]))
+gl_iconv_AC_DEFUN([AM_ICONV],
 [
   AM_ICONV_LINK
   if test "$am_cv_func_iconv" = yes; then
     AC_MSG_CHECKING([for iconv declaration])
-    AC_CACHE_VAL(am_cv_proto_iconv, [
-      AC_TRY_COMPILE([
+    AC_CACHE_VAL([am_cv_proto_iconv], [
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
 #include <stdlib.h>
 #include <iconv.h>
 extern
 #ifdef __cplusplus
 "C"
 #endif
-#if defined(__STDC__) || defined(__cplusplus)
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
 #else
 size_t iconv();
 #endif
-], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+           ]],
+           [[]])],
+        [am_cv_proto_iconv_arg1=""],
+        [am_cv_proto_iconv_arg1="const"])
       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
-    AC_MSG_RESULT([$]{ac_t:-
-         }[$]am_cv_proto_iconv)
-    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+    AC_MSG_RESULT([
+         $am_cv_proto_iconv])
+    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
       [Define as const if the declaration of iconv() needs const.])
+    dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
+    m4_ifdef([gl_ICONV_H_DEFAULTS],
+      [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+       if test -n "$am_cv_proto_iconv_arg1"; then
+         ICONV_CONST="const"
+       fi
+      ])
   fi
 ])
diff --git a/m4/intlmacosx.m4 b/m4/intlmacosx.m4
new file mode 100644 (file)
index 0000000..ab97d39
--- /dev/null
@@ -0,0 +1,56 @@
+# intlmacosx.m4 serial 5 (gettext-0.18.2)
+dnl Copyright (C) 2004-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Checks for special options needed on Mac OS X.
+dnl Defines INTL_MACOSX_LIBS.
+AC_DEFUN([gt_INTL_MACOSX],
+[
+  dnl Check for API introduced in Mac OS X 10.2.
+  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+    [gt_cv_func_CFPreferencesCopyAppValue],
+    [gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <CoreFoundation/CFPreferences.h>]],
+          [[CFPreferencesCopyAppValue(NULL, NULL)]])],
+       [gt_cv_func_CFPreferencesCopyAppValue=yes],
+       [gt_cv_func_CFPreferencesCopyAppValue=no])
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
+      [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+  fi
+  dnl Check for API introduced in Mac OS X 10.3.
+  AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
+    [gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+     AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <CoreFoundation/CFLocale.h>]],
+          [[CFLocaleCopyCurrent();]])],
+       [gt_cv_func_CFLocaleCopyCurrent=yes],
+       [gt_cv_func_CFLocaleCopyCurrent=no])
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
+      [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
+  fi
+  INTL_MACOSX_LIBS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+  fi
+  AC_SUBST([INTL_MACOSX_LIBS])
+])
index 96c4e2c..c145e47 100644 (file)
@@ -1,50 +1,56 @@
-# lib-ld.m4 serial 3 (gettext-0.13)
-dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
+# lib-ld.m4 serial 6
+dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl Subroutines of libtool.m4,
-dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
-dnl with libtool.m4.
+dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
+dnl collision with libtool.m4.
 
-dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
 AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
 *GNU* | *'with BFD'*)
-  acl_cv_prog_gnu_ld=yes ;;
+  acl_cv_prog_gnu_ld=yes
+  ;;
 *)
-  acl_cv_prog_gnu_ld=no ;;
+  acl_cv_prog_gnu_ld=no
+  ;;
 esac])
 with_gnu_ld=$acl_cv_prog_gnu_ld
 ])
 
-dnl From libtool-1.4. Sets the variable LD.
+dnl From libtool-2.4. Sets the variable LD.
 AC_DEFUN([AC_LIB_PROG_LD],
-[AC_ARG_WITH(gnu-ld,
-[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
+[AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+        [assume the C compiler uses GNU ld [default=no]])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
 # Prepare PATH_SEPARATOR.
 # The user is always right.
 if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
 fi
+
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by GCC])
+  AC_MSG_CHECKING([for ld used by $CC])
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -54,12 +60,12 @@ if test "$GCC" = yes; then
   esac
   case $ac_prog in
     # Accept absolute paths.
-    [[\\/]* | [A-Za-z]:[\\/]*)]
-      [re_direlt='/[^/][^/]*/\.\./']
-      # Canonicalize the path of ld
-      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
+      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
       ;;
@@ -77,33 +83,36 @@ elif test "$with_gnu_ld" = yes; then
 else
   AC_MSG_CHECKING([for non-GNU ld])
 fi
-AC_CACHE_VAL(acl_cv_path_LD,
+AC_CACHE_VAL([acl_cv_path_LD],
 [if test -z "$LD"; then
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
   for ac_dir in $PATH; do
+    IFS="$acl_save_ifs"
     test -z "$ac_dir" && ac_dir=.
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
       acl_cv_path_LD="$ac_dir/$ac_prog"
       # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some GNU ld's only accept -v.
+      # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break
+        ;;
       *)
-       test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break
+        ;;
       esac
     fi
   done
-  IFS="$ac_save_ifs"
+  IFS="$acl_save_ifs"
 else
   acl_cv_path_LD="$LD" # Let the user override the test with a path.
 fi])
 LD="$acl_cv_path_LD"
 if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
+  AC_MSG_RESULT([$LD])
 else
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([no])
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
 AC_LIB_PROG_LD_GNU
index 9292919..073f040 100644 (file)
@@ -1,58 +1,66 @@
-# lib-link.m4 serial 8 (gettext-0.15)
-dnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
+# lib-link.m4 serial 26 (gettext-0.18.2)
+dnl Copyright (C) 2001-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Bruno Haible.
 
-AC_PREREQ(2.50)
+AC_PREREQ([2.54])
 
 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
 dnl the libraries corresponding to explicit and implicit dependencies.
 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
 dnl augments the CPPFLAGS variable.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 AC_DEFUN([AC_LIB_LINKFLAGS],
 [
   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
   AC_REQUIRE([AC_LIB_RPATH])
-  define([Name],[translit([$1],[./-], [___])])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
     AC_LIB_LINKFLAGS_BODY([$1], [$2])
     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
     ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
     ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
   ])
   LIB[]NAME="$ac_cv_lib[]Name[]_libs"
   LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
   INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
   AC_SUBST([LIB]NAME)
   AC_SUBST([LTLIB]NAME)
+  AC_SUBST([LIB]NAME[_PREFIX])
   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
   dnl results of this search when this library appears as a dependency.
   HAVE_LIB[]NAME=yes
-  undefine([Name])
-  undefine([NAME])
+  popdef([NAME])
+  popdef([Name])
 ])
 
-dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
 dnl searches for libname and the libraries corresponding to explicit and
 dnl implicit dependencies, together with the specified include files and
-dnl the ability to compile and link the specified testcode. If found, it
-dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
-dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
 [
   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
   AC_REQUIRE([AC_LIB_RPATH])
-  define([Name],[translit([$1],[./-], [___])])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 
   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
   dnl accordingly.
@@ -66,13 +74,26 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
 
   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
     ac_save_LIBS="$LIBS"
-    LIBS="$LIBS $LIB[]NAME"
-    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+    dnl because these -l options might require -L options that are present in
+    dnl LIBS. -l options benefit only from the -L options listed before it.
+    dnl Otherwise, add it to the front of LIBS, because it may be a static
+    dnl library that depends on another static library that is present in LIBS.
+    dnl Static libraries benefit only from the static libraries listed after
+    dnl it.
+    case " $LIB[]NAME" in
+      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+      *)       LIBS="$LIB[]NAME $LIBS" ;;
+    esac
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[$3]], [[$4]])],
+      [ac_cv_lib[]Name=yes],
+      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
     LIBS="$ac_save_LIBS"
   ])
   if test "$ac_cv_lib[]Name" = yes; then
     HAVE_LIB[]NAME=yes
-    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
     AC_MSG_CHECKING([how to link with lib[]$1])
     AC_MSG_RESULT([$LIB[]NAME])
   else
@@ -82,17 +103,25 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
     CPPFLAGS="$ac_save_CPPFLAGS"
     LIB[]NAME=
     LTLIB[]NAME=
+    LIB[]NAME[]_PREFIX=
   fi
   AC_SUBST([HAVE_LIB]NAME)
   AC_SUBST([LIB]NAME)
   AC_SUBST([LTLIB]NAME)
-  undefine([Name])
-  undefine([NAME])
+  AC_SUBST([LIB]NAME[_PREFIX])
+  popdef([NAME])
+  popdef([Name])
 ])
 
 dnl Determine the platform dependent parameters needed to use rpath:
-dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
-dnl hardcode_direct, hardcode_minus_L.
+dnl   acl_libext,
+dnl   acl_shlibext,
+dnl   acl_libname_spec,
+dnl   acl_library_names_spec,
+dnl   acl_hardcode_libdir_flag_spec,
+dnl   acl_hardcode_libdir_separator,
+dnl   acl_hardcode_direct,
+dnl   acl_hardcode_minus_L.
 AC_DEFUN([AC_LIB_RPATH],
 [
   dnl Tell automake >= 1.10 to complain if config.rpath is missing.
@@ -101,7 +130,7 @@ AC_DEFUN([AC_LIB_RPATH],
   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
-  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
     . ./conftest.sh
@@ -109,35 +138,66 @@ AC_DEFUN([AC_LIB_RPATH],
     acl_cv_rpath=done
   ])
   wl="$acl_cv_wl"
-  libext="$acl_cv_libext"
-  shlibext="$acl_cv_shlibext"
-  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-  hardcode_direct="$acl_cv_hardcode_direct"
-  hardcode_minus_L="$acl_cv_hardcode_minus_L"
+  acl_libext="$acl_cv_libext"
+  acl_shlibext="$acl_cv_shlibext"
+  acl_libname_spec="$acl_cv_libname_spec"
+  acl_library_names_spec="$acl_cv_library_names_spec"
+  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  acl_hardcode_direct="$acl_cv_hardcode_direct"
+  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
   dnl Determine whether the user wants rpath handling at all.
-  AC_ARG_ENABLE(rpath,
+  AC_ARG_ENABLE([rpath],
     [  --disable-rpath         do not hardcode runtime library paths],
     :, enable_rpath=yes)
 ])
 
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_frompackage_]NAME, [$2])
+  popdef([NAME])
+  pushdef([PACK],[$2])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_libsinpackage_]PACKUP,
+    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
+  popdef([PACKUP])
+  popdef([PACK])
+])
+
 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
 dnl the libraries corresponding to explicit and implicit dependencies.
 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 [
   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
+  dnl Autoconf >= 2.61 supports dots in --with options.
+  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
   dnl By default, look in $includedir and $libdir.
   use_additional=yes
   AC_LIB_WITH_FINAL_PREFIX([
     eval additional_includedir=\"$includedir\"
     eval additional_libdir=\"$libdir\"
   ])
-  AC_LIB_ARG_WITH([lib$1-prefix],
-[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
-  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
+  AC_ARG_WITH(P_A_C_K[-prefix],
+[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
+  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
 [
     if test "X$withval" = "Xno"; then
       use_additional=no
@@ -150,6 +210,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
       else
         additional_includedir="$withval/include"
         additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
       fi
     fi
 ])
@@ -158,6 +222,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
   LIB[]NAME=
   LTLIB[]NAME=
   INC[]NAME=
+  LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
@@ -177,7 +245,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
         names_already_handled="$names_already_handled $name"
         dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
         dnl or AC_LIB_HAVE_LINKFLAGS call.
-        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
         eval value=\"\$HAVE_LIB$uppername\"
         if test -n "$value"; then
           if test "$value" = yes; then
@@ -197,22 +265,55 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
           found_la=
           found_so=
           found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
           if test $use_additional = yes; then
-            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
-              found_dir="$additional_libdir"
-              found_so="$additional_libdir/lib$name.$shlibext"
-              if test -f "$additional_libdir/lib$name.la"; then
-                found_la="$additional_libdir/lib$name.la"
-              fi
-            else
-              if test -f "$additional_libdir/lib$name.$libext"; then
-                found_dir="$additional_libdir"
-                found_a="$additional_libdir/lib$name.$libext"
-                if test -f "$additional_libdir/lib$name.la"; then
-                  found_la="$additional_libdir/lib$name.la"
+            dir="$additional_libdir"
+            dnl The same code as in the loop below:
+            dnl First look for a shared library.
+            if test -n "$acl_shlibext"; then
+              if test -f "$dir/$libname$shrext"; then
+                found_dir="$dir"
+                found_so="$dir/$libname$shrext"
+              else
+                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                  ver=`(cd "$dir" && \
+                        for f in "$libname$shrext".*; do echo "$f"; done \
+                        | sed -e "s,^$libname$shrext\\\\.,," \
+                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                        | sed 1q ) 2>/dev/null`
+                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                    found_dir="$dir"
+                    found_so="$dir/$libname$shrext.$ver"
+                  fi
+                else
+                  eval library_names=\"$acl_library_names_spec\"
+                  for f in $library_names; do
+                    if test -f "$dir/$f"; then
+                      found_dir="$dir"
+                      found_so="$dir/$f"
+                      break
+                    fi
+                  done
                 fi
               fi
             fi
+            dnl Then look for a static library.
+            if test "X$found_dir" = "X"; then
+              if test -f "$dir/$libname.$acl_libext"; then
+                found_dir="$dir"
+                found_a="$dir/$libname.$acl_libext"
+              fi
+            fi
+            if test "X$found_dir" != "X"; then
+              if test -f "$dir/$libname.la"; then
+                found_la="$dir/$libname.la"
+              fi
+            fi
           fi
           if test "X$found_dir" = "X"; then
             for x in $LDFLAGS $LTLIB[]NAME; do
@@ -220,21 +321,46 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
               case "$x" in
                 -L*)
                   dir=`echo "X$x" | sed -e 's/^X-L//'`
-                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
-                    found_dir="$dir"
-                    found_so="$dir/lib$name.$shlibext"
-                    if test -f "$dir/lib$name.la"; then
-                      found_la="$dir/lib$name.la"
-                    fi
-                  else
-                    if test -f "$dir/lib$name.$libext"; then
+                  dnl First look for a shared library.
+                  if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext"; then
                       found_dir="$dir"
-                      found_a="$dir/lib$name.$libext"
-                      if test -f "$dir/lib$name.la"; then
-                        found_la="$dir/lib$name.la"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
                       fi
                     fi
                   fi
+                  dnl Then look for a static library.
+                  if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
                   ;;
               esac
               if test "X$found_dir" != "X"; then
@@ -249,7 +375,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
               dnl Linking with a shared library. We attempt to hardcode its
               dnl directory into the executable's runpath, unless it's the
               dnl standard /usr/lib.
-              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+              if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
                 dnl No hardcoding is needed.
                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
               else
@@ -268,12 +396,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
                   ltrpathdirs="$ltrpathdirs $found_dir"
                 fi
                 dnl The hardcoding into $LIBNAME is system dependent.
-                if test "$hardcode_direct" = yes; then
+                if test "$acl_hardcode_direct" = yes; then
                   dnl Using DIR/libNAME.so during linking hardcodes DIR into the
                   dnl resulting binary.
                   LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                 else
-                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
                     dnl Use an explicit option to hardcode DIR into the resulting
                     dnl binary.
                     LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
@@ -304,13 +432,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
                     if test -z "$haveit"; then
                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
                     fi
-                    if test "$hardcode_minus_L" != no; then
+                    if test "$acl_hardcode_minus_L" != no; then
                       dnl FIXME: Not sure whether we should use
                       dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
                       dnl here.
                       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                     else
-                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
+                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
                       dnl here, because this doesn't fit in flags passed to the
                       dnl compiler. So give up. No hardcoding. This affects only
                       dnl very old systems.
@@ -337,6 +465,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
             case "$found_dir" in
               */$acl_libdirstem | */$acl_libdirstem/)
                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
                 additional_includedir="$basedir/include"
                 ;;
             esac
@@ -397,9 +535,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
                     dnl   3. if it's already present in $LDFLAGS or the already
                     dnl      constructed $LIBNAME,
                     dnl   4. if it doesn't exist as a directory.
-                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
                       haveit=
-                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
                         if test -n "$GCC"; then
                           case $host_os in
                             linux* | gnu* | k*bsd*-gnu) haveit=yes;;
@@ -498,18 +638,18 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
     done
   done
   if test "X$rpathdirs" != "X"; then
-    if test -n "$hardcode_libdir_separator"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
       dnl Weird platform: only the last -rpath option counts, the user must
       dnl pass all path elements in one option. We can arrange that for a
       dnl single library, but not when more than one $LIBNAMEs are used.
       alldirs=
       for found_dir in $rpathdirs; do
-        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
       done
-      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
+      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
       acl_save_libdir="$libdir"
       libdir="$alldirs"
-      eval flag=\"$hardcode_libdir_flag_spec\"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
       libdir="$acl_save_libdir"
       LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
     else
@@ -517,7 +657,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
       for found_dir in $rpathdirs; do
         acl_save_libdir="$libdir"
         libdir="$found_dir"
-        eval flag=\"$hardcode_libdir_flag_spec\"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
         libdir="$acl_save_libdir"
         LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
       done
@@ -530,6 +670,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
     done
   fi
+  popdef([P_A_C_K])
+  popdef([PACKLIBS])
+  popdef([PACKUP])
+  popdef([PACK])
+  popdef([NAME])
 ])
 
 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
@@ -566,7 +711,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
   $1=
   if test "$enable_rpath" != no; then
-    if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
       dnl Use an explicit option to hardcode directories into the resulting
       dnl binary.
       rpathdirs=
@@ -575,7 +720,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
         if test -n "$next"; then
           dir="$next"
           dnl No need to hardcode the standard /usr/lib.
-          if test "X$dir" != "X/usr/$acl_libdirstem"; then
+          if test "X$dir" != "X/usr/$acl_libdirstem" \
+             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
             rpathdirs="$rpathdirs $dir"
           fi
           next=
@@ -584,7 +730,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
             -L) next=yes ;;
             -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
                  dnl No need to hardcode the standard /usr/lib.
-                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
+                 if test "X$dir" != "X/usr/$acl_libdirstem" \
+                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
                    rpathdirs="$rpathdirs $dir"
                  fi
                  next= ;;
@@ -600,16 +747,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
           done
         else
           dnl The linker is used for linking directly.
-          if test -n "$hardcode_libdir_separator"; then
+          if test -n "$acl_hardcode_libdir_separator"; then
             dnl Weird platform: only the last -rpath option counts, the user
             dnl must pass all path elements in one option.
             alldirs=
             for dir in $rpathdirs; do
-              alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
+              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
             done
             acl_save_libdir="$libdir"
             libdir="$alldirs"
-            eval flag=\"$hardcode_libdir_flag_spec\"
+            eval flag=\"$acl_hardcode_libdir_flag_spec\"
             libdir="$acl_save_libdir"
             $1="$flag"
           else
@@ -617,7 +764,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
             for dir in $rpathdirs; do
               acl_save_libdir="$libdir"
               libdir="$dir"
-              eval flag=\"$hardcode_libdir_flag_spec\"
+              eval flag=\"$acl_hardcode_libdir_flag_spec\"
               libdir="$acl_save_libdir"
               $1="${$1}${$1:+ }$flag"
             done
index a8684e1..60908e8 100644 (file)
@@ -1,5 +1,5 @@
-# lib-prefix.m4 serial 5 (gettext-0.15)
-dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+# lib-prefix.m4 serial 7 (gettext-0.18)
+dnl Copyright (C) 2001-2005, 2008-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -153,33 +153,72 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
   prefix="$acl_save_prefix"
 ])
 
-dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
-dnl the basename of the libdir, either "lib" or "lib64".
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a variable acl_libdirstem, containing the basename of the libdir, either
+dnl   "lib" or "lib64" or "lib/64",
+dnl - a variable acl_libdirstem2, as a secondary possible value for
+dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
+dnl   "lib/amd64".
 AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
 [
-  dnl There is no formal standard regarding lib and lib64. The current
-  dnl practice is that on a system supporting 32-bit and 64-bit instruction
-  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
-  dnl libraries go under $prefix/lib. We determine the compiler's default
-  dnl mode by looking at the compiler's library search path. If at least
-  dnl of its elements ends in /lib64 or points to a directory whose absolute
-  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
-  dnl default, namely "lib".
+  dnl There is no formal standard regarding lib and lib64.
+  dnl On glibc systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
+  dnl the compiler's default mode by looking at the compiler's library search
+  dnl path. If at least one of its elements ends in /lib64 or points to a
+  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
+  dnl Otherwise we use the default, namely "lib".
+  dnl On Solaris systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+  AC_REQUIRE([AC_CANONICAL_HOST])
   acl_libdirstem=lib
-  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
-  if test -n "$searchpath"; then
-    acl_save_IFS="${IFS=       }"; IFS=":"
-    for searchdir in $searchpath; do
-      if test -d "$searchdir"; then
-        case "$searchdir" in
-          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
-          *) searchdir=`cd "$searchdir" && pwd`
-             case "$searchdir" in
-               */lib64 ) acl_libdirstem=lib64 ;;
-             esac ;;
+  acl_libdirstem2=
+  case "$host_os" in
+    solaris*)
+      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
+      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
+      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+      dnl symlink is missing, so we set acl_libdirstem2 too.
+      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
+        [AC_EGREP_CPP([sixtyfour bits], [
+#ifdef _LP64
+sixtyfour bits
+#endif
+           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+        ])
+      if test $gl_cv_solaris_64bit = yes; then
+        acl_libdirstem=lib/64
+        case "$host_cpu" in
+          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
+          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
         esac
       fi
-    done
-    IFS="$acl_save_IFS"
-  fi
+      ;;
+    *)
+      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+      if test -n "$searchpath"; then
+        acl_save_IFS="${IFS=   }"; IFS=":"
+        for searchdir in $searchpath; do
+          if test -d "$searchdir"; then
+            case "$searchdir" in
+              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+              */../ | */.. )
+                # Better ignore directories of this form. They are misleading.
+                ;;
+              *) searchdir=`cd "$searchdir" && pwd`
+                 case "$searchdir" in
+                   */lib64 ) acl_libdirstem=lib64 ;;
+                 esac ;;
+            esac
+          fi
+        done
+        IFS="$acl_save_IFS"
+      fi
+      ;;
+  esac
+  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
 ])
index d7c043f..a6d21ae 100644 (file)
@@ -1,8 +1,6 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#   Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
 # modifications, as long as this notice is preserved.
 
 m4_define([_LT_COPYING], [dnl
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of of the License, or
+# (at your option) any later version.
 #
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program or library that is built
+# using GNU Libtool, you may include this file under the  same
+# distribution terms that you use for the rest of that program.
 #
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ])
 
-# serial 57 LT_INIT
+# serial 58 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -67,7 +59,7 @@ esac
 # LT_INIT([OPTIONS])
 # ------------------
 AC_DEFUN([LT_INIT],
-[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK
 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
@@ -91,7 +83,7 @@ dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
 # This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
+LIBTOOL_DEPS=$ltmain
 
 # Always use our own libtool.
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -111,26 +103,43 @@ dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
 dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
 
 
+# _LT_PREPARE_CC_BASENAME
+# -----------------------
+m4_defun([_LT_PREPARE_CC_BASENAME], [
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in @S|@*""; do
+      case $cc_temp in
+        compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+        distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+])# _LT_PREPARE_CC_BASENAME
+
+
 # _LT_CC_BASENAME(CC)
 # -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME,
+# but that macro is also expanded into generated libtool script, which
+# arranges for $SED and $ECHO to be set by different means.
 m4_defun([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
-  case $cc_temp in
-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+[m4_require([_LT_PREPARE_CC_BASENAME])dnl
+AC_REQUIRE([_LT_DECL_SED])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+func_cc_basename $1
+cc_basename=$func_cc_basename_result
 ])
 
 
 # _LT_FILEUTILS_DEFAULTS
 # ----------------------
 # It is okay to use these file commands and assume they have been set
-# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'.
 m4_defun([_LT_FILEUTILS_DEFAULTS],
 [: ${CP="cp -f"}
 : ${MV="mv -f"}
@@ -177,15 +186,16 @@ m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
 m4_require([_LT_WITH_SYSROOT])dnl
+m4_require([_LT_CMD_TRUNCATE])dnl
 
 _LT_CONFIG_LIBTOOL_INIT([
-# See if we are running on zsh, and set the options which allow our
+# See if we are running on zsh, and set the options that allow our
 # commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
+if test -n "\${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 ])
-if test -n "${ZSH_VERSION+set}" ; then
+if test -n "${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 
@@ -198,7 +208,7 @@ aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
   # reason, if we set the COLLECT_NAMES environment variable, the problems
   # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
+  if test set != "${COLLECT_NAMES+set}"; then
     COLLECT_NAMES=
     export COLLECT_NAMES
   fi
@@ -209,14 +219,14 @@ esac
 ofile=libtool
 can_build_shared=yes
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a '.a' archive for static linking (except MSVC,
 # which needs '.lib').
 libext=a
 
-with_gnu_ld="$lt_cv_prog_gnu_ld"
+with_gnu_ld=$lt_cv_prog_gnu_ld
 
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
+old_CC=$CC
+old_CFLAGS=$CFLAGS
 
 # Set sane defaults for various variables
 test -z "$CC" && CC=cc
@@ -269,14 +279,14 @@ no_glob_subst='s/\*/\\\*/g'
 
 # _LT_PROG_LTMAIN
 # ---------------
-# Note that this code is called both from `configure', and `config.status'
+# Note that this code is called both from 'configure', and 'config.status'
 # now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
-# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# 'config.status' has no value for ac_aux_dir unless we are using Automake,
 # so we pass a copy along to make sure it has a sensible value anyway.
 m4_defun([_LT_PROG_LTMAIN],
 [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
 _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
-ltmain="$ac_aux_dir/ltmain.sh"
+ltmain=$ac_aux_dir/ltmain.sh
 ])# _LT_PROG_LTMAIN
 
 
@@ -286,7 +296,7 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 # So that we can recreate a full libtool script including additional
 # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
-# in macros and then make a single call at the end using the `libtool'
+# in macros and then make a single call at the end using the 'libtool'
 # label.
 
 
@@ -421,8 +431,8 @@ m4_define([_lt_decl_all_varnames],
 
 # _LT_CONFIG_STATUS_DECLARE([VARNAME])
 # ------------------------------------
-# Quote a variable value, and forward it to `config.status' so that its
-# declaration there will have the same value as in `configure'.  VARNAME
+# Quote a variable value, and forward it to 'config.status' so that its
+# declaration there will have the same value as in 'configure'.  VARNAME
 # must have a single quote delimited value for this to work.
 m4_define([_LT_CONFIG_STATUS_DECLARE],
 [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
@@ -446,7 +456,7 @@ m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 # Output comment and list of tags supported by the script
 m4_defun([_LT_LIBTOOL_TAGS],
 [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
-available_tags="_LT_TAGS"dnl
+available_tags='_LT_TAGS'dnl
 ])
 
 
@@ -474,7 +484,7 @@ m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
 # _LT_LIBTOOL_CONFIG_VARS
 # -----------------------
 # Produce commented declarations of non-tagged libtool config variables
-# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool'
 # script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
 # section) are produced by _LT_LIBTOOL_TAG_VARS.
 m4_defun([_LT_LIBTOOL_CONFIG_VARS],
@@ -500,8 +510,8 @@ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
 # Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
 # variables for single and double quote escaping we saved from calls
 # to _LT_DECL, we can put quote escaped variables declarations
-# into `config.status', and then the shell code to quote escape them in
-# for loops in `config.status'.  Finally, any additional code accumulated
+# into 'config.status', and then the shell code to quote escape them in
+# for loops in 'config.status'.  Finally, any additional code accumulated
 # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
 m4_defun([_LT_CONFIG_COMMANDS],
 [AC_PROVIDE_IFELSE([LT_OUTPUT],
@@ -547,7 +557,7 @@ for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -560,7 +570,7 @@ for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -576,7 +586,7 @@ _LT_OUTPUT_LIBTOOL_INIT
 # Generate a child script FILE with all initialization necessary to
 # reuse the environment learned by the parent script, and make the
 # file executable.  If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins.  After this
+# '#!' sequence but before initialization text begins.  After this
 # macro, additional text can be appended to FILE to form the body of
 # the child script.  The macro ends with non-zero status if the
 # file could not be fully written (such as if the disk is full).
@@ -598,7 +608,7 @@ AS_SHELL_SANITIZE
 _AS_PREPARE
 exec AS_MESSAGE_FD>&1
 _ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
+test 0 = "$lt_write_fail" && chmod +x $1[]dnl
 m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
@@ -621,7 +631,7 @@ exec AS_MESSAGE_LOG_FD>>config.log
 } >&AS_MESSAGE_LOG_FD
 
 lt_cl_help="\
-\`$as_me' creates a local libtool stub from the current configuration,
+'$as_me' creates a local libtool stub from the current configuration,
 for use in further configure time tests before the real libtool is
 generated.
 
@@ -643,7 +653,7 @@ Copyright (C) 2011 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
-while test $[#] != 0
+while test 0 != $[#]
 do
   case $[1] in
     --version | --v* | -V )
@@ -656,10 +666,10 @@ do
       lt_cl_silent=: ;;
 
     -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try \`$[0] --help' for more information.]) ;;
+Try '$[0] --help' for more information.]) ;;
 
     *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try \`$[0] --help' for more information.]) ;;
+Try '$[0] --help' for more information.]) ;;
   esac
   shift
 done
@@ -685,7 +695,7 @@ chmod +x "$CONFIG_LT"
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
 lt_cl_success=:
-test "$silent" = yes &&
+test yes = "$silent" &&
   lt_config_lt_args="$lt_config_lt_args --quiet"
 exec AS_MESSAGE_LOG_FD>/dev/null
 $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
@@ -705,27 +715,30 @@ m4_defun([_LT_CONFIG],
 _LT_CONFIG_SAVE_COMMANDS([
   m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
   m4_if(_LT_TAG, [C], [
-    # See if we are running on zsh, and set the options which allow our
+    # See if we are running on zsh, and set the options that allow our
     # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
+    if test -n "${ZSH_VERSION+set}"; then
       setopt NO_GLOB_SUBST
     fi
 
-    cfgfile="${ofile}T"
+    cfgfile=${ofile}T
     trap "$RM \"$cfgfile\"; exit 1" 1 2 15
     $RM "$cfgfile"
 
     cat <<_LT_EOF >> "$cfgfile"
 #! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# Generated automatically by $as_me ($PACKAGE) $VERSION
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
+
+# Provide generalized library-building support services.
+# Written by Gordon Matzigkeit, 1996
+
 _LT_COPYING
 _LT_LIBTOOL_TAGS
 
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
+
 # ### BEGIN LIBTOOL CONFIG
 _LT_LIBTOOL_CONFIG_VARS
 _LT_LIBTOOL_TAG_VARS
@@ -733,13 +746,24 @@ _LT_LIBTOOL_TAG_VARS
 
 _LT_EOF
 
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_PREPARE_MUNGE_PATH_LIST
+_LT_PREPARE_CC_BASENAME
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
   case $host_os in
   aix3*)
     cat <<\_LT_EOF >> "$cfgfile"
 # AIX sometimes has problems with the GCC collect2 program.  For some
 # reason, if we set the COLLECT_NAMES environment variable, the problems
 # vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
+if test set != "${COLLECT_NAMES+set}"; then
   COLLECT_NAMES=
   export COLLECT_NAMES
 fi
@@ -756,8 +780,6 @@ _LT_EOF
   sed '$q' "$ltmain" >> "$cfgfile" \
      || (rm -f "$cfgfile"; exit 1)
 
-  _LT_PROG_REPLACE_SHELLFNS
-
    mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
@@ -775,7 +797,6 @@ _LT_EOF
 [m4_if([$1], [], [
     PACKAGE='$PACKAGE'
     VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
     RM='$RM'
     ofile='$ofile'], [])
 ])dnl /_LT_CONFIG_SAVE_COMMANDS
@@ -974,7 +995,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 
     AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
       [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
+      if test -z "$LT_MULTI_MODULE"; then
        # By default we will add the -single_module flag. You can override
        # by either setting the environment variable LT_MULTI_MODULE
        # non-empty at configure time, or by adding -multi_module to the
@@ -992,7 +1013,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
          cat conftest.err >&AS_MESSAGE_LOG_FD
        # Otherwise, if the output was created with a 0 exit code from
        # the compiler, it worked.
-       elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+       elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
          lt_cv_apple_cc_single_mod=yes
        else
          cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1010,7 +1031,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
       AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
        [lt_cv_ld_exported_symbols_list=yes],
        [lt_cv_ld_exported_symbols_list=no])
-       LDFLAGS="$save_LDFLAGS"
+       LDFLAGS=$save_LDFLAGS
     ])
 
     AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
@@ -1020,8 +1041,8 @@ int forced_loaded() { return 2;}
 _LT_EOF
       echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
       $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
-      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
-      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
       echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
       $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
       cat > conftest.c << _LT_EOF
@@ -1032,7 +1053,7 @@ _LT_EOF
       _lt_result=$?
       if test -s conftest.err && $GREP force_load conftest.err; then
        cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
        lt_cv_ld_force_load=yes
       else
        cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1042,32 +1063,32 @@ _LT_EOF
     ])
     case $host_os in
     rhapsody* | darwin1.[[012]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
     darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
     darwin*) # darwin 5.x on
       # if running on 10.5 or later, the deployment target defaults
       # to the OS version, if on x86, and 10.4, the deployment
       # target defaults to 10.4. Don't you love it?
       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
        10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-       10.[[012]]*)
-         _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+       10.[[012]][[,.]]*)
+         _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
        10.*)
-         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
       esac
     ;;
   esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+    if test yes = "$lt_cv_apple_cc_single_mod"; then
       _lt_dar_single_mod='$single_module'
     fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    if test yes = "$lt_cv_ld_exported_symbols_list"; then
+      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
     else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -1087,29 +1108,29 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  if test yes = "$lt_cv_ld_force_load"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
     m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
                   [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
   else
     _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   fi
   _LT_TAGVAR(link_all_deplibs, $1)=yes
-  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
-  if test "$_lt_dar_can_shared" = "yes"; then
+  if test yes = "$_lt_dar_can_shared"; then
     output_verbose_link_cmd=func_echo_all
-    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
     m4_if([$1], [CXX],
-[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+[   if test yes != "$lt_cv_apple_cc_single_mod"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil"
     fi
 ],[])
   else
@@ -1129,7 +1150,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
 # Allow to override them for all tags through lt_cv_aix_libpath.
 m4_defun([_LT_SYS_MODULE_PATH_AIX],
 [m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
+if test set = "${lt_cv_aix_libpath+set}"; then
   aix_libpath=$lt_cv_aix_libpath
 else
   AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
@@ -1147,7 +1168,7 @@ else
     _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
   fi],[])
   if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib
   fi
   ])
   aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
@@ -1167,8 +1188,8 @@ m4_define([_LT_SHELL_INIT],
 # -----------------------
 # Find how we can fake an echo command that does not interpret backslash.
 # In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
+# of the generated configure script that will find a shell with a builtin
+# printf (that we can use as an echo command).
 m4_defun([_LT_PROG_ECHO_BACKSLASH],
 [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
@@ -1196,10 +1217,10 @@ fi
 # Invoke $ECHO with all args, space-separated.
 func_echo_all ()
 {
-    $ECHO "$*" 
+    $ECHO "$*"
 }
 
-case "$ECHO" in
+case $ECHO in
   printf*) AC_MSG_RESULT([printf]) ;;
   print*) AC_MSG_RESULT([print -r]) ;;
   *) AC_MSG_RESULT([cat]) ;;
@@ -1225,16 +1246,17 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
 AC_DEFUN([_LT_WITH_SYSROOT],
 [AC_MSG_CHECKING([for sysroot])
 AC_ARG_WITH([sysroot],
-[  --with-sysroot[=DIR] Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).],
+[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
+  [Search for dependent libraries within DIR (or the compiler's sysroot
+   if not specified).])],
 [], [with_sysroot=no])
 
 dnl lt_sysroot will always be passed unquoted.  We quote it here
 dnl in case the user passed a directory name.
 lt_sysroot=
-case ${with_sysroot} in #(
+case $with_sysroot in #(
  yes)
-   if test "$GCC" = yes; then
+   if test yes = "$GCC"; then
      lt_sysroot=`$CC --print-sysroot 2>/dev/null`
    fi
    ;; #(
@@ -1244,14 +1266,14 @@ case ${with_sysroot} in #(
  no|'')
    ;; #(
  *)
-   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_RESULT([$with_sysroot])
    AC_MSG_ERROR([The sysroot must be an absolute path.])
    ;;
 esac
 
  AC_MSG_RESULT([${lt_sysroot:-no}])
 _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
+[dependent libraries, and where our libraries should be installed.])])
 
 # _LT_ENABLE_LOCK
 # ---------------
@@ -1259,31 +1281,33 @@ m4_defun([_LT_ENABLE_LOCK],
 [AC_ARG_ENABLE([libtool-lock],
   [AS_HELP_STRING([--disable-libtool-lock],
     [avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+test no = "$enable_libtool_lock" || enable_libtool_lock=yes
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
 case $host in
 ia64-*-hpux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set mode
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.$ac_objext` in
       *ELF-32*)
-       HPUX_IA64_MODE="32"
+       HPUX_IA64_MODE=32
        ;;
       *ELF-64*)
-       HPUX_IA64_MODE="64"
+       HPUX_IA64_MODE=64
        ;;
     esac
   fi
   rm -rf conftest*
   ;;
 *-*-irix6*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
+    if test yes = "$lt_cv_prog_gnu_ld"; then
       case `/usr/bin/file conftest.$ac_objext` in
        *32-bit*)
          LD="${LD-ld} -melf32bsmip"
@@ -1312,9 +1336,46 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
+mips64*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    emul=elf
+    case `/usr/bin/file conftest.$ac_objext` in
+      *32-bit*)
+       emul="${emul}32"
+       ;;
+      *64-bit*)
+       emul="${emul}64"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *MSB*)
+       emul="${emul}btsmip"
+       ;;
+      *LSB*)
+       emul="${emul}ltsmip"
+       ;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *N32*)
+       emul="${emul}n32"
+       ;;
+    esac
+    LD="${LD-ld} -m $emul"
+  fi
+  rm -rf conftest*
+  ;;
+
 x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.  Note that the listed cases only cover the
+  # situations where additional linker options are needed (such as when
+  # doing 32-bit compilation for a host where ld defaults to 64-bit, or
+  # vice versa); the common cases where no linker options are needed do
+  # not appear in the list.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
@@ -1333,10 +1394,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
                ;;
            esac
            ;;
-         powerpc64le-*)
+         powerpc64le-*linux*)
            LD="${LD-ld} -m elf32lppclinux"
            ;;
-         powerpc64-*)
+         powerpc64-*linux*)
            LD="${LD-ld} -m elf32ppclinux"
            ;;
          s390x-*linux*)
@@ -1355,10 +1416,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
          x86_64-*linux*)
            LD="${LD-ld} -m elf_x86_64"
            ;;
-         powerpcle-*)
+         powerpcle-*linux*)
            LD="${LD-ld} -m elf64lppc"
            ;;
-         powerpc-*)
+         powerpc-*linux*)
            LD="${LD-ld} -m elf64ppc"
            ;;
          s390*-*linux*|s390*-*tpf*)
@@ -1376,19 +1437,20 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
+  SAVE_CFLAGS=$CFLAGS
   CFLAGS="$CFLAGS -belf"
   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
     [AC_LANG_PUSH(C)
      AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
      AC_LANG_POP])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+  if test yes != "$lt_cv_cc_needs_belf"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
+    CFLAGS=$SAVE_CFLAGS
   fi
   ;;
 *-*solaris*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
@@ -1396,7 +1458,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
       case $lt_cv_prog_gnu_ld in
       yes*)
         case $host in
-        i?86-*-solaris*)
+        i?86-*-solaris*|x86_64-*-solaris*)
           LD="${LD-ld} -m elf_x86_64"
           ;;
         sparc*-*-solaris*)
@@ -1405,7 +1467,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
         esac
         # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
         if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
+          LD=${LD-ld}_sol2
         fi
         ;;
       *)
@@ -1421,7 +1483,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   ;;
 esac
 
-need_locks="$enable_libtool_lock"
+need_locks=$enable_libtool_lock
 ])# _LT_ENABLE_LOCK
 
 
@@ -1430,7 +1492,7 @@ need_locks="$enable_libtool_lock"
 m4_defun([_LT_PROG_AR],
 [AC_CHECK_TOOLS(AR, [ar], false)
 : ${AR=ar}
-: ${AR_FLAGS=cru}
+: ${AR_FLAGS=cr}
 _LT_DECL([], [AR], [1], [The archiver])
 _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
 
@@ -1440,11 +1502,11 @@ AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
      [echo conftest.$ac_objext > conftest.lst
       lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
       AC_TRY_EVAL([lt_ar_try])
-      if test "$ac_status" -eq 0; then
+      if test 0 -eq "$ac_status"; then
        # Ensure the archiver fails upon bogus file names.
        rm -f conftest.$ac_objext libconftest.a
        AC_TRY_EVAL([lt_ar_try])
-       if test "$ac_status" -ne 0; then
+       if test 0 -ne "$ac_status"; then
           lt_cv_ar_at_file=@
         fi
       fi
@@ -1452,7 +1514,7 @@ AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
      ])
   ])
 
-if test "x$lt_cv_ar_at_file" = xno; then
+if test no = "$lt_cv_ar_at_file"; then
   archiver_list_spec=
 else
   archiver_list_spec=$lt_cv_ar_at_file
@@ -1483,7 +1545,7 @@ old_postuninstall_cmds=
 
 if test -n "$RANLIB"; then
   case $host_os in
-  openbsd*)
+  bitrig* | openbsd*)
     old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
@@ -1519,7 +1581,7 @@ AC_CACHE_CHECK([$1], [$2],
   [$2=no
    m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
    echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$3"
+   lt_compiler_flag="$3"  ## exclude from sc_useless_quotes_in_assignment
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
@@ -1546,7 +1608,7 @@ AC_CACHE_CHECK([$1], [$2],
    $RM conftest*
 ])
 
-if test x"[$]$2" = xyes; then
+if test yes = "[$]$2"; then
     m4_if([$5], , :, [$5])
 else
     m4_if([$6], , :, [$6])
@@ -1568,7 +1630,7 @@ AC_DEFUN([_LT_LINKER_OPTION],
 m4_require([_LT_DECL_SED])dnl
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
-   save_LDFLAGS="$LDFLAGS"
+   save_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS $3"
    echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
@@ -1587,10 +1649,10 @@ AC_CACHE_CHECK([$1], [$2],
      fi
    fi
    $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+   LDFLAGS=$save_LDFLAGS
 ])
 
-if test x"[$]$2" = xyes; then
+if test yes = "[$]$2"; then
     m4_if([$4], , :, [$4])
 else
     m4_if([$5], , :, [$5])
@@ -1611,7 +1673,7 @@ AC_DEFUN([LT_CMD_MAX_LEN],
 AC_MSG_CHECKING([the maximum length of command line arguments])
 AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
   i=0
-  teststring="ABCD"
+  teststring=ABCD
 
   case $build_os in
   msdosdjgpp*)
@@ -1651,7 +1713,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+  bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
     # This has been around since 386BSD, at least.  Likely further.
     if test -x /sbin/sysctl; then
       lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
@@ -1702,22 +1764,22 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
     if test -n "$lt_cv_sys_max_cmd_len" && \
-       test undefined != "$lt_cv_sys_max_cmd_len"; then
+       test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
       # Make teststring a little bigger before we do anything with it.
       # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
+      for i in 1 2 3 4 5 6 7 8; do
         teststring=$teststring$teststring
       done
       SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+      while { test X`env echo "$teststring$teststring" 2>/dev/null` \
                 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-             test $i != 17 # 1/2 MB should be enough
+             test 17 != "$i" # 1/2 MB should be enough
       do
         i=`expr $i + 1`
         teststring=$teststring$teststring
@@ -1733,7 +1795,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     ;;
   esac
 ])
-if test -n $lt_cv_sys_max_cmd_len ; then
+if test -n "$lt_cv_sys_max_cmd_len"; then
   AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
 else
   AC_MSG_RESULT(none)
@@ -1761,7 +1823,7 @@ m4_defun([_LT_HEADER_DLFCN],
 # ----------------------------------------------------------------
 m4_defun([_LT_TRY_DLOPEN_SELF],
 [m4_require([_LT_HEADER_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
+if test yes = "$cross_compiling"; then :
   [$4]
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -1808,9 +1870,9 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
+/* When -fvisibility=hidden is used, assume the code has been annotated
    correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
 int fnord () __attribute__((visibility("default")));
 #endif
 
@@ -1836,7 +1898,7 @@ int main ()
   return status;
 }]
 _LT_EOF
-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+  if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then
     (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -1857,7 +1919,7 @@ rm -fr conftest*
 # ------------------
 AC_DEFUN([LT_SYS_DLOPEN_SELF],
 [m4_require([_LT_HEADER_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
+if test yes != "$enable_dlopen"; then
   enable_dlopen=unknown
   enable_dlopen_self=unknown
   enable_dlopen_self_static=unknown
@@ -1867,44 +1929,52 @@ else
 
   case $host_os in
   beos*)
-    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen=load_add_on
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
     ;;
 
   mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen=LoadLibrary
     lt_cv_dlopen_libs=
     ;;
 
   cygwin*)
-    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen=dlopen
     lt_cv_dlopen_libs=
     ;;
 
   darwin*)
-  # if libdl is installed we need to link against it
+    # if libdl is installed we need to link against it
     AC_CHECK_LIB([dl], [dlopen],
-               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
-    lt_cv_dlopen="dyld"
+               [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[
+    lt_cv_dlopen=dyld
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
     ])
     ;;
 
+  tpf*)
+    # Don't try to run any link tests for TPF.  We know it's impossible
+    # because TPF is a cross-compiler, and we know how we open DSOs.
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=no
+    ;;
+
   *)
     AC_CHECK_FUNC([shl_load],
-         [lt_cv_dlopen="shl_load"],
+         [lt_cv_dlopen=shl_load],
       [AC_CHECK_LIB([dld], [shl_load],
-           [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+           [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld],
        [AC_CHECK_FUNC([dlopen],
-             [lt_cv_dlopen="dlopen"],
+             [lt_cv_dlopen=dlopen],
          [AC_CHECK_LIB([dl], [dlopen],
-               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+               [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],
            [AC_CHECK_LIB([svld], [dlopen],
-                 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+                 [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld],
              [AC_CHECK_LIB([dld], [dld_link],
-                   [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+                   [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld])
              ])
            ])
          ])
@@ -1913,21 +1983,21 @@ else
     ;;
   esac
 
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
+  if test no = "$lt_cv_dlopen"; then
     enable_dlopen=no
+  else
+    enable_dlopen=yes
   fi
 
   case $lt_cv_dlopen in
   dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+    save_CPPFLAGS=$CPPFLAGS
+    test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-    save_LDFLAGS="$LDFLAGS"
+    save_LDFLAGS=$LDFLAGS
     wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    save_LIBS="$LIBS"
+    save_LIBS=$LIBS
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
     AC_CACHE_CHECK([whether a program can dlopen itself],
@@ -1937,7 +2007,7 @@ else
            lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
     ])
 
-    if test "x$lt_cv_dlopen_self" = xyes; then
+    if test yes = "$lt_cv_dlopen_self"; then
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
          lt_cv_dlopen_self_static, [dnl
@@ -1947,9 +2017,9 @@ else
       ])
     fi
 
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
+    CPPFLAGS=$save_CPPFLAGS
+    LDFLAGS=$save_LDFLAGS
+    LIBS=$save_LIBS
     ;;
   esac
 
@@ -2041,8 +2111,8 @@ m4_defun([_LT_COMPILER_FILE_LOCKS],
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 _LT_COMPILER_C_O([$1])
 
-hard_links="nottested"
-if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+hard_links=nottested
+if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then
   # do not overwrite the value of need_locks provided by the user
   AC_MSG_CHECKING([if we can lock with hard links])
   hard_links=yes
@@ -2052,8 +2122,8 @@ if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" !=
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   AC_MSG_RESULT([$hard_links])
-  if test "$hard_links" = no; then
-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+  if test no = "$hard_links"; then
+    AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe])
     need_locks=warn
   fi
 else
@@ -2080,8 +2150,8 @@ objdir=$lt_cv_objdir
 _LT_DECL([], [objdir], [0],
          [The name of the directory that contains temporary libtool files])dnl
 m4_pattern_allow([LT_OBJDIR])dnl
-AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
-  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/",
+  [Define to the sub-directory where libtool stores uninstalled libraries.])
 ])# _LT_CHECK_OBJDIR
 
 
@@ -2093,15 +2163,15 @@ m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
 _LT_TAGVAR(hardcode_action, $1)=
 if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
    test -n "$_LT_TAGVAR(runpath_var, $1)" ||
-   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+   test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then
 
   # We can hardcode non-existent directories.
-  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+  if test no != "$_LT_TAGVAR(hardcode_direct, $1)" &&
      # If the only mechanism to avoid hardcoding is shlibpath_var, we
      # have to relink, otherwise we might link with an installed library
      # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+     ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" &&
+     test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then
     # Linking always hardcodes the temporary library directory.
     _LT_TAGVAR(hardcode_action, $1)=relink
   else
@@ -2115,12 +2185,12 @@ else
 fi
 AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
 
-if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
-   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+if test relink = "$_LT_TAGVAR(hardcode_action, $1)" ||
+   test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then
   # Fast installation is not supported
   enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
+elif test yes = "$shlibpath_overrides_runpath" ||
+     test no = "$enable_shared"; then
   # Fast installation is not necessary
   enable_fast_install=needless
 fi
@@ -2144,7 +2214,7 @@ else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
   darwin*)
-    if test -n "$STRIP" ; then
+    if test -n "$STRIP"; then
       striplib="$STRIP -x"
       old_striplib="$STRIP -S"
       AC_MSG_RESULT([yes])
@@ -2162,6 +2232,47 @@ _LT_DECL([], [striplib], [1])
 ])# _LT_CMD_STRIPLIB
 
 
+# _LT_PREPARE_MUNGE_PATH_LIST
+# ---------------------------
+# Make sure func_munge_path_list() is defined correctly.
+m4_defun([_LT_PREPARE_MUNGE_PATH_LIST],
+[[# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x@S|@2 in
+    x)
+        ;;
+    *:)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
+        ;;
+    x:*)
+        eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
+        ;;
+    *)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+]])# _LT_PREPARE_PATH_LIST
+
+
 # _LT_SYS_DYNAMIC_LINKER([TAG])
 # -----------------------------
 # PORTME Fill in your ld.so characteristics
@@ -2172,17 +2283,18 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
        [], [
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
+    darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
+    *) lt_awk_arg='/^libraries:/' ;;
   esac
   case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
+    mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
+    *) lt_sed_strip_eq='s|=/|/|g' ;;
   esac
   lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
   case $lt_search_path_spec in
@@ -2198,28 +2310,35 @@ if test "$GCC" = yes; then
     ;;
   esac
   # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
+  # and add multilib dir if necessary...
   lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  # ...but if some path component already ends with the multilib dir we assume
+  # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
+  case "$lt_multi_os_dir; $lt_search_path_spec " in
+  "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
+    lt_multi_os_dir=
+    ;;
+  esac
   for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
+    if test -d "$lt_sys_path$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
+    elif test -n "$lt_multi_os_dir"; then
       test -d "$lt_sys_path" && \
        lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
   lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
+BEGIN {RS = " "; FS = "/|\n";} {
+  lt_foo = "";
+  lt_count = 0;
   for (lt_i = NF; lt_i > 0; lt_i--) {
     if ($lt_i != "" && $lt_i != ".") {
       if ($lt_i == "..") {
         lt_count++;
       } else {
         if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
+          lt_foo = "/" $lt_i lt_foo;
         } else {
           lt_count--;
         }
@@ -2233,7 +2352,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   # for these hosts.
   case $host_os in
     mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+      $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;;
   esac
   sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
@@ -2242,7 +2361,7 @@ fi])
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
-shrext_cmds=".so"
+shrext_cmds=.so
 postinstall_cmds=
 postuninstall_cmds=
 finish_cmds=
@@ -2259,14 +2378,17 @@ hardcode_into_libs=no
 # flags to be left without arguments
 need_version=unknown
 
+AC_ARG_VAR([LT_SYS_LIBRARY_PATH],
+[User-defined run-time library search path.])
+
 case $host_os in
 aix3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
   # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
+  soname_spec='$libname$release$shared_ext$major'
   ;;
 
 aix[[4-9]]*)
@@ -2274,41 +2396,91 @@ aix[[4-9]]*)
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
     shlibpath_var=LD_LIBRARY_PATH
   else
     # With GCC up to 2.95.x, collect2 would create an import file
     # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
+    # the line '#! .'.  This would cause the generated library to
+    # depend on '.', always an invalid library.  This was fixed in
     # development snapshots of GCC prior to 3.0.
     case $host_os in
       aix4 | aix4.[[01]] | aix4.[[01]].*)
       if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
           echo ' yes '
-          echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+          echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
        :
       else
        can_build_shared=no
       fi
       ;;
     esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # Using Import Files as archive members, it is possible to support
+    # filename-based versioning of shared library archives on AIX. While
+    # this would work for both with and without runtime linking, it will
+    # prevent static linking of such archives. So we do filename-based
+    # shared library versioning with .so extension only, which is used
+    # when both runtime linking and shared linking is enabled.
+    # Unfortunately, runtime linking may impact performance, so we do
+    # not want this to be the default eventually. Also, we use the
+    # versioned .so libs for executables only if there is the -brtl
+    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # To allow for filename-based versioning support, we need to create
+    # libNAME.so.V as an archive file, containing:
+    # *) an Import File, referring to the versioned filename of the
+    #    archive as well as the shared archive member, telling the
+    #    bitwidth (32 or 64) of that shared object, and providing the
+    #    list of exported symbols of that shared object, eventually
+    #    decorated with the 'weak' keyword
+    # *) the shared object with the F_LOADONLY flag set, to really avoid
+    #    it being seen by the linker.
+    # At run time we better use the real file rather than another symlink,
+    # but for link time we create the symlink libNAME.so -> libNAME.so.V
+
+    case $with_aix_soname,$aix_use_runtimelinking in
+    # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
     # soname into executable. Probably we can add versioning support to
     # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
+    aix,yes) # traditional libtool
+      dynamic_linker='AIX unversionable lib.so'
       # If using run time linking (on AIX 4.2 or later) use lib<name>.so
       # instead of lib<name>.a to let people know that these are not
       # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      ;;
+    aix,no) # traditional AIX only
+      dynamic_linker='AIX lib.a[(]lib.so.V[)]'
       # We preserve .a as extension for shared libraries through AIX4.2
       # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      ;;
+    svr4,*) # full svr4 only
+      dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,yes) # both, prefer svr4
+      dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # unpreferred sharedlib libNAME.a needs extra handling
+      postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
+      postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,no) # both, prefer aix
+      dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]"
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
+      postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
+      postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
+      ;;
+    esac
     shlibpath_var=LIBPATH
   fi
   ;;
@@ -2318,18 +2490,18 @@ amigaos*)
   powerpc)
     # Since July 2007 AmigaOS4 officially supports .so libraries.
     # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
     ;;
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
 
 beos*)
-  library_names_spec='${libname}${shared_ext}'
+  library_names_spec='$libname$shared_ext'
   dynamic_linker="$host_os ld.so"
   shlibpath_var=LIBRARY_PATH
   ;;
@@ -2337,8 +2509,8 @@ beos*)
 bsdi[[45]]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
@@ -2350,7 +2522,7 @@ bsdi[[45]]*)
 
 cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
-  shrext_cmds=".dll"
+  shrext_cmds=.dll
   need_version=no
   need_lib_prefix=no
 
@@ -2359,8 +2531,8 @@ cygwin* | mingw* | pw32* | cegcc*)
     # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname~
@@ -2376,17 +2548,17 @@ cygwin* | mingw* | pw32* | cegcc*)
     case $host_os in
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
 m4_if([$1], [],[
       sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
       ;;
     esac
     dynamic_linker='Win32 ld.exe'
@@ -2395,8 +2567,8 @@ m4_if([$1], [],[
   *,cl*)
     # Native MSVC
     libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
+    soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
+    library_names_spec='$libname.dll.lib'
 
     case $build_os in
     mingw*)
@@ -2423,7 +2595,7 @@ m4_if([$1], [],[
       sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
       ;;
     *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=$LIB
       if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
         # It is most probably a Windows format PATH.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
@@ -2436,8 +2608,8 @@ m4_if([$1], [],[
     esac
 
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname'
@@ -2450,7 +2622,7 @@ m4_if([$1], [],[
 
   *)
     # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib'
     dynamic_linker='Win32 ld.exe'
     ;;
   esac
@@ -2463,8 +2635,8 @@ darwin* | rhapsody*)
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
+  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$major$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
@@ -2477,8 +2649,8 @@ dgux*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -2496,12 +2668,13 @@ freebsd* | dragonfly*)
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
     freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
       need_version=yes
       ;;
   esac
@@ -2531,10 +2704,10 @@ haiku*)
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=no
   sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
@@ -2552,14 +2725,15 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.so"
     shlibpath_var=LD_LIBRARY_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    if test 32 = "$HPUX_IA64_MODE"; then
       sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
     else
       sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
     fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   hppa*64*)
     shrext_cmds='.sl'
@@ -2567,8 +2741,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
@@ -2577,8 +2751,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=SHLIB_PATH
     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     ;;
   esac
   # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
@@ -2591,8 +2765,8 @@ interix[[3-9]]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
@@ -2603,7 +2777,7 @@ irix5* | irix6* | nonstopux*)
   case $host_os in
     nonstopux*) version_type=nonstopux ;;
     *)
-       if test "$lt_cv_prog_gnu_ld" = yes; then
+       if test yes = "$lt_cv_prog_gnu_ld"; then
                version_type=linux # correct to gnu/linux during the next big refactor
        else
                version_type=irix
@@ -2611,8 +2785,8 @@ irix5* | irix6* | nonstopux*)
   esac
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
   case $host_os in
   irix5* | nonstopux*)
     libsuff= shlibsuff=
@@ -2631,8 +2805,8 @@ irix5* | irix6* | nonstopux*)
   esac
   shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
   shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
+  sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
   hardcode_into_libs=yes
   ;;
 
@@ -2641,13 +2815,33 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
+linux*android*)
+  version_type=none # Android doesn't support versioned libraries.
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext'
+  soname_spec='$libname$release$shared_ext'
+  finish_cmds=
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  dynamic_linker='Android linker'
+  # Don't embed -rpath directories since the linker doesn't support them.
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  ;;
+
 # This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
@@ -2672,7 +2866,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) to the search path.
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[  ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
@@ -2704,12 +2903,12 @@ netbsd*)
   need_lib_prefix=no
   need_version=no
   if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
   else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     dynamic_linker='NetBSD ld.elf_so'
   fi
   shlibpath_var=LD_LIBRARY_PATH
@@ -2719,7 +2918,7 @@ netbsd*)
 
 newsos6)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   ;;
@@ -2728,58 +2927,68 @@ newsos6)
   version_type=qnx
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   dynamic_linker='ldqnx.so'
   ;;
 
-openbsd*)
+openbsd* | bitrig*)
   version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
+  sys_lib_dlsearch_path_spec=/usr/lib
   need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[[89]] | openbsd2.[[89]].*)
-       shlibpath_overrides_runpath=no
-       ;;
-      *)
-       shlibpath_overrides_runpath=yes
-       ;;
-      esac
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    need_version=no
   else
-    shlibpath_overrides_runpath=yes
+    need_version=yes
   fi
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
   ;;
 
 os2*)
   libname_spec='$name'
-  shrext_cmds=".dll"
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
   need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
+  # OS/2 can only load a DLL with a base name of 8 characters or less.
+  soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
+    v=$($ECHO $release$versuffix | tr -d .-);
+    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
+    $ECHO $n$v`$shared_ext'
+  library_names_spec='${libname}_dll.$libext'
   dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
+  shlibpath_var=BEGINLIBPATH
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  postinstall_cmds='base_file=`basename \$file`~
+    dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
+    dldir=$destdir/`dirname \$dlpath`~
+    test -d \$dldir || mkdir -p \$dldir~
+    $install_prog $dir/$dlname \$dldir/$dlname~
+    chmod a+x \$dldir/$dlname~
+    if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+      eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+    fi'
+  postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+    dlpath=$dir/\$dldll~
+    $RM \$dlpath'
   ;;
 
 osf3* | osf4* | osf5*)
   version_type=osf
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
   ;;
 
 rdos*)
@@ -2790,8 +2999,8 @@ solaris*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
@@ -2801,11 +3010,11 @@ solaris*)
 
 sunos4*)
   version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
   finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     need_lib_prefix=no
   fi
   need_version=yes
@@ -2813,8 +3022,8 @@ sunos4*)
 
 sysv4 | sysv4.3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   case $host_vendor in
     sni)
@@ -2835,24 +3044,24 @@ sysv4 | sysv4.3*)
   ;;
 
 sysv4*MP*)
-  if test -d /usr/nec ;then
+  if test -d /usr/necthen
     version_type=linux # correct to gnu/linux during the next big refactor
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
+    library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
+    soname_spec='$libname$shared_ext.$major'
     shlibpath_var=LD_LIBRARY_PATH
   fi
   ;;
 
 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
+  version_type=sco
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
   else
     sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
@@ -2870,7 +3079,7 @@ tpf*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -2878,8 +3087,8 @@ tpf*)
 
 uts4*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -2888,20 +3097,30 @@ uts4*)
   ;;
 esac
 AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
+test no = "$dynamic_linker" && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
+  sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
 fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
+  sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
 
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
 _LT_DECL([], [variables_saved_for_relink], [1],
     [Variables whose values should be saved in libtool wrapper scripts and
     restored at link time])
@@ -2934,39 +3153,41 @@ _LT_DECL([], [hardcode_into_libs], [0],
     [Whether we should hardcode library paths into libraries])
 _LT_DECL([], [sys_lib_search_path_spec], [2],
     [Compile-time system search path for libraries])
-_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
-    [Run-time system search path for libraries])
+_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2],
+    [Detected run-time system search path for libraries])
+_LT_DECL([], [configure_time_lt_sys_library_path], [2],
+    [Explicit LT_SYS_LIBRARY_PATH set during ./configure time])
 ])# _LT_SYS_DYNAMIC_LINKER
 
 
 # _LT_PATH_TOOL_PREFIX(TOOL)
 # --------------------------
-# find a file program which can recognize shared library
+# find a file program that can recognize shared library
 AC_DEFUN([_LT_PATH_TOOL_PREFIX],
 [m4_require([_LT_DECL_EGREP])dnl
 AC_MSG_CHECKING([for $1])
 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
 [case $MAGIC_CMD in
 [[\\/*] |  ?:[\\/]*])
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
   ;;
 *)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
 dnl $ac_dummy forces splitting on constant user-supplied paths.
 dnl POSIX.2 word splitting is done only on the output of word expansions,
 dnl not every word.  This closes a longstanding sh security hole.
   ac_dummy="m4_if([$2], , $PATH, [$2])"
   for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+    if test -f "$ac_dir/$1"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"$1"
       if test -n "$file_magic_test_file"; then
        case $deplibs_check_method in
        "file_magic "*)
          file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         MAGIC_CMD=$lt_cv_path_MAGIC_CMD
          if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
            $EGREP "$file_magic_regex" > /dev/null; then
            :
@@ -2989,11 +3210,11 @@ _LT_EOF
       break
     fi
   done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
   ;;
 esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 if test -n "$MAGIC_CMD"; then
   AC_MSG_RESULT($MAGIC_CMD)
 else
@@ -3011,7 +3232,7 @@ dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
 
 # _LT_PATH_MAGIC
 # --------------
-# find a file program which can recognize a shared library
+# find a file program that can recognize a shared library
 m4_defun([_LT_PATH_MAGIC],
 [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
 if test -z "$lt_cv_path_MAGIC_CMD"; then
@@ -3038,16 +3259,16 @@ m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
        [assume the C compiler uses GNU ld @<:@default=no@:>@])],
-    [test "$withval" = no || with_gnu_ld=yes],
+    [test no = "$withval" || with_gnu_ld=yes],
     [with_gnu_ld=no])dnl
 
 ac_prog=ld
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   # Check if gcc -print-prog-name=ld gives a path.
   AC_MSG_CHECKING([for ld used by $CC])
   case $host in
   *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
+    # gcc leaves a trailing carriage return, which upsets mingw
     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
   *)
     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
@@ -3061,7 +3282,7 @@ if test "$GCC" = yes; then
       while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
        ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
       done
-      test -z "$LD" && LD="$ac_prog"
+      test -z "$LD" && LD=$ac_prog
       ;;
   "")
     # If it fails, then pretend we aren't using GCC.
@@ -3072,37 +3293,37 @@ if test "$GCC" = yes; then
     with_gnu_ld=unknown
     ;;
   esac
-elif test "$with_gnu_ld" = yes; then
+elif test yes = "$with_gnu_ld"; then
   AC_MSG_CHECKING([for GNU ld])
 else
   AC_MSG_CHECKING([for non-GNU ld])
 fi
 AC_CACHE_VAL(lt_cv_path_LD,
 [if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
+      lt_cv_path_LD=$ac_dir/$ac_prog
       # Check to see if the program is GNU ld.  I'd rather use --version,
       # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break
+       test no != "$with_gnu_ld" && break
        ;;
       *)
-       test "$with_gnu_ld" != yes && break
+       test yes != "$with_gnu_ld" && break
        ;;
       esac
     fi
   done
-  IFS="$lt_save_ifs"
+  IFS=$lt_save_ifs
 else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+  lt_cv_path_LD=$LD # Let the user override the test with a path.
 fi])
-LD="$lt_cv_path_LD"
+LD=$lt_cv_path_LD
 if test -n "$LD"; then
   AC_MSG_RESULT($LD)
 else
@@ -3156,13 +3377,13 @@ esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
   cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       reload_cmds=false
     fi
     ;;
   darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    if test yes = "$GCC"; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
     else
       reload_cmds='$LD$reload_flag -o $output$reload_objs'
     fi
@@ -3173,6 +3394,43 @@ _LT_TAGDECL([], [reload_cmds], [2])dnl
 ])# _LT_CMD_RELOAD
 
 
+# _LT_PATH_DD
+# -----------
+# find a working dd
+m4_defun([_LT_PATH_DD],
+[AC_CACHE_CHECK([for a working dd], [ac_cv_path_lt_DD],
+[printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+: ${lt_DD:=$DD}
+AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd],
+[if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
+fi])
+rm -f conftest.i conftest2.i conftest.out])
+])# _LT_PATH_DD
+
+
+# _LT_CMD_TRUNCATE
+# ----------------
+# find command to truncate a binary pipe
+m4_defun([_LT_CMD_TRUNCATE],
+[m4_require([_LT_PATH_DD])
+AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin],
+[printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+lt_cv_truncate_bin=
+if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
+fi
+rm -f conftest.i conftest2.i conftest.out
+test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"])
+_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1],
+  [Command to truncate a binary pipe])
+])# _LT_CMD_TRUNCATE
+
+
 # _LT_CHECK_MAGIC_METHOD
 # ----------------------
 # how to check for library dependencies
@@ -3188,13 +3446,13 @@ lt_cv_deplibs_check_method='unknown'
 # Need to set the preceding variable on all platforms that support
 # interlibrary dependencies.
 # 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
+# 'unknown' -- same as none, but documents that we really don't know.
 # 'pass_all' -- all dependencies passed with no checks.
 # 'test_compile' -- check by making test program.
 # 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
+# that responds to the $file_magic_cmd with a given extended regex.
+# If you have 'file' or equivalent on your system and you're not sure
+# whether 'pass_all' will *always* work, you probably want this one.
 
 case $host_os in
 aix[[4-9]]*)
@@ -3221,8 +3479,7 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
@@ -3318,8 +3575,8 @@ newos6*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+openbsd* | bitrig*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
   else
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
@@ -3372,6 +3629,9 @@ sysv4 | sysv4.3*)
 tpf*)
   lt_cv_deplibs_check_method=pass_all
   ;;
+os2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 esac
 ])
 
@@ -3412,33 +3672,38 @@ AC_DEFUN([LT_PATH_NM],
 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
 [if test -n "$NM"; then
   # Let the user override the test.
-  lt_cv_path_NM="$NM"
+  lt_cv_path_NM=$NM
 else
-  lt_nm_to_check="${ac_tool_prefix}nm"
+  lt_nm_to_check=${ac_tool_prefix}nm
   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
     lt_nm_to_check="$lt_nm_to_check nm"
   fi
   for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
     for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      tmp_nm=$ac_dir/$lt_tmp_nm
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
        # Check to see if the nm accepts a BSD-compat flag.
-       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       # Adding the 'sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
        # Tru64's nm complains that /dev/null is an invalid object file
-       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-       */dev/null* | *'Invalid file or object type'*)
+       # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
+       case $build_os in
+       mingw*) lt_bad_file=conftest.nm/nofile ;;
+       *) lt_bad_file=/dev/null ;;
+       esac
+       case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
+       *$lt_bad_file* | *'Invalid file or object type'*)
          lt_cv_path_NM="$tmp_nm -B"
-         break
+         break 2
          ;;
        *)
          case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
          */dev/null*)
            lt_cv_path_NM="$tmp_nm -p"
-           break
+           break 2
            ;;
          *)
            lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
@@ -3449,21 +3714,21 @@ else
        esac
       fi
     done
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
   done
   : ${lt_cv_path_NM=no}
 fi])
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
+if test no != "$lt_cv_path_NM"; then
+  NM=$lt_cv_path_NM
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
   if test -n "$DUMPBIN"; then :
     # Let the user override the test.
   else
     AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
     *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
+      DUMPBIN="$DUMPBIN -symbols -headers"
       ;;
     *)
       DUMPBIN=:
@@ -3471,8 +3736,8 @@ else
     esac
   fi
   AC_SUBST([DUMPBIN])
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
+  if test : != "$DUMPBIN"; then
+    NM=$DUMPBIN
   fi
 fi
 test -z "$NM" && NM=nm
@@ -3518,8 +3783,8 @@ lt_cv_sharedlib_from_linklib_cmd,
 
 case $host_os in
 cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
+  # two different shell functions defined in ltmain.sh;
+  # decide which one to use based on capabilities of $DLLTOOL
   case `$DLLTOOL --help 2>&1` in
   *--identify-strict*)
     lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
@@ -3531,7 +3796,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   ;;
 *)
   # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  lt_cv_sharedlib_from_linklib_cmd=$ECHO
   ;;
 esac
 ])
@@ -3558,13 +3823,28 @@ AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool
     lt_cv_path_mainfest_tool=yes
   fi
   rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
+if test yes != "$lt_cv_path_mainfest_tool"; then
   MANIFEST_TOOL=:
 fi
 _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
 ])# _LT_PATH_MANIFEST_TOOL
 
 
+# _LT_DLL_DEF_P([FILE])
+# ---------------------
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with func_dll_def_p in the libtool script
+AC_DEFUN([_LT_DLL_DEF_P],
+[dnl
+  test DEF = "`$SED -n dnl
+    -e '\''s/^[[        ]]*//'\'' dnl Strip leading whitespace
+    -e '\''/^\(;.*\)*$/d'\'' dnl      Delete empty lines and comments
+    -e '\''s/^\(EXPORTS\|LIBRARY\)\([[  ]].*\)*$/DEF/p'\'' dnl
+    -e q dnl                          Only consider the first "real" line
+    $1`" dnl
+])# _LT_DLL_DEF_P
+
+
 # LT_LIB_M
 # --------
 # check for math library
@@ -3576,11 +3856,11 @@ case $host in
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw)
   AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
   ;;
 *)
-  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  AC_CHECK_LIB(m, cos, LIBM=-lm)
   ;;
 esac
 AC_SUBST([LIBM])
@@ -3599,7 +3879,7 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $cc_basename in
   nvcc*)
     _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
@@ -3651,7 +3931,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   symcode='[[ABCDGISTW]]'
   ;;
 hpux*)
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     symcode='[[ABCDEGRST]]'
   fi
   ;;
@@ -3684,14 +3964,44 @@ case `$NM -V 2>&1` in
   symcode='[[ABCDGIRSTW]]' ;;
 esac
 
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  # Gets list of data symbols to import.
+  lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
+  # Adjust the below global symbol transforms to fixup imported variables.
+  lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
+  lt_c_name_hook=" -e 's/^I .* \(.*\)$/  {\"\1\", (void *) 0},/p'"
+  lt_c_name_lib_hook="\
+  -e 's/^I .* \(lib.*\)$/  {\"\1\", (void *) 0},/p'\
+  -e 's/^I .* \(.*\)$/  {\"lib\1\", (void *) 0},/p'"
+else
+  # Disable hooks by default.
+  lt_cv_sys_global_symbol_to_import=
+  lt_cdecl_hook=
+  lt_c_name_hook=
+  lt_c_name_lib_hook=
+fi
+
 # Transform an extracted symbol line into a proper C declaration.
 # Some systems (esp. on ia64) link data and code symbols differently,
 # so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+lt_cv_sys_global_symbol_to_cdecl="sed -n"\
+$lt_cdecl_hook\
+" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
+$lt_c_name_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/p'"
+
+# Transform an extracted symbol line into symbol name with lib prefix and
+# symbol address.
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
+$lt_c_name_lib_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(lib.*\)$/  {\"\1\", (void *) \&\1},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"lib\1\", (void *) \&\1},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -3709,21 +4019,24 @@ for ac_symprfx in "" "_"; do
 
   # Write the raw and C identifiers.
   if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
+    # Fake it for dumpbin and say T for any non-static function,
+    # D for any global variable and I for any imported variable.
     # Also find C++ and __fastcall symbols from MSVC++,
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
 "     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
+"     /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
+"     /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
 "     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
+"     {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
+"     s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
 "     ' prfx=^$ac_symprfx]"
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[    ]]\($symcode$symcode*\)[[       ]][[    ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
@@ -3750,7 +4063,8 @@ _LT_EOF
   if AC_TRY_EVAL(ac_compile); then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+    $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD
+    if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
        mv -f "$nlist"T "$nlist"
@@ -3763,11 +4077,11 @@ _LT_EOF
        if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
          cat <<_LT_EOF > conftest.$ac_ext
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
    relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT@&t@_DLSYM_CONST
-#elif defined(__osf__)
+#elif defined __osf__
 /* This system does not cope well with relocations in const data.  */
 # define LT@&t@_DLSYM_CONST
 #else
@@ -3793,7 +4107,7 @@ lt__PROGRAM__LTX_preloaded_symbols[[]] =
 {
   { "@PROGRAM@", (void *) 0 },
 _LT_EOF
-         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+         $SED "s/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
          cat <<\_LT_EOF >> conftest.$ac_ext
   {0, (void *) 0}
 };
@@ -3813,9 +4127,9 @@ _LT_EOF
          mv conftest.$ac_objext conftstm.$ac_objext
          lt_globsym_save_LIBS=$LIBS
          lt_globsym_save_CFLAGS=$CFLAGS
-         LIBS="conftstm.$ac_objext"
+         LIBS=conftstm.$ac_objext
          CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
-         if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+         if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
            pipe_works=yes
          fi
          LIBS=$lt_globsym_save_LIBS
@@ -3836,7 +4150,7 @@ _LT_EOF
   rm -rf conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
+  if test yes = "$pipe_works"; then
     break
   else
     lt_cv_sys_global_symbol_pipe=
@@ -3863,12 +4177,16 @@ _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
     [Take the output of nm and produce a listing of raw symbols and C names])
 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
     [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1],
+    [Transform the output of nm into a list of symbols to manually relocate])
 _LT_DECL([global_symbol_to_c_name_address],
     [lt_cv_sys_global_symbol_to_c_name_address], [1],
     [Transform the output of nm in a C name address pair])
 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
     [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
     [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([nm_interface], [lt_cv_nm_interface], [1],
+    [The name lister interface])
 _LT_DECL([], [nm_file_list_spec], [1],
     [Specify filename containing input files for $NM])
 ]) # _LT_CMD_GLOBAL_SYMBOLS
@@ -3884,17 +4202,18 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)=
 
 m4_if([$1], [CXX], [
   # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
+  if test yes = "$GXX"; then
     _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
     _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
 
     case $host_os in
     aix*)
       # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
        # AIX 5 now supports IA64 processor
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       fi
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
 
     amigaos*)
@@ -3905,8 +4224,8 @@ m4_if([$1], [CXX], [
         ;;
       m68k)
             # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
             _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
         ;;
       esac
@@ -3922,6 +4241,11 @@ m4_if([$1], [CXX], [
       # (--disable-auto-import) libraries
       m4_if([$1], [GCJ], [],
        [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+       ;;
+      esac
       ;;
     darwin* | rhapsody*)
       # PIC is the default on this platform
@@ -3971,7 +4295,7 @@ m4_if([$1], [CXX], [
     case $host_os in
       aix[[4-9]]*)
        # All AIX code is PIC.
-       if test "$host_cpu" = ia64; then
+       if test ia64 = "$host_cpu"; then
          # AIX 5 now supports IA64 processor
          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
        else
@@ -4012,14 +4336,14 @@ m4_if([$1], [CXX], [
        case $cc_basename in
          CC*)
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-           _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-           if test "$host_cpu" != ia64; then
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
+           if test ia64 != "$host_cpu"; then
              _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
            fi
            ;;
          aCC*)
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-           _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
            case $host_cpu in
            hppa*64*|ia64*)
              # +Z the default
@@ -4056,7 +4380,7 @@ m4_if([$1], [CXX], [
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
            ;;
          ecpc* )
-           # old Intel C++ for x86_64 which still supported -KPIC.
+           # old Intel C++ for x86_64, which still supported -KPIC.
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
            _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
@@ -4201,17 +4525,18 @@ m4_if([$1], [CXX], [
   fi
 ],
 [
-  if test "$GCC" = yes; then
+  if test yes = "$GCC"; then
     _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
     _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
 
     case $host_os in
       aix*)
       # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
        # AIX 5 now supports IA64 processor
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       fi
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
 
     amigaos*)
@@ -4222,8 +4547,8 @@ m4_if([$1], [CXX], [
         ;;
       m68k)
             # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
             _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
         ;;
       esac
@@ -4240,6 +4565,11 @@ m4_if([$1], [CXX], [
       # (--disable-auto-import) libraries
       m4_if([$1], [GCJ], [],
        [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+       ;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -4310,7 +4640,7 @@ m4_if([$1], [CXX], [
     case $host_os in
     aix*)
       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
        # AIX 5 now supports IA64 processor
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       else
@@ -4318,11 +4648,30 @@ m4_if([$1], [CXX], [
       fi
       ;;
 
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      case $cc_basename in
+      nagfor*)
+        # NAG Fortran compiler
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      esac
+      ;;
+
     mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       m4_if([$1], [GCJ], [],
        [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+       ;;
+      esac
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -4338,7 +4687,7 @@ m4_if([$1], [CXX], [
        ;;
       esac
       # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
       ;;
 
     irix5* | irix6* | nonstopux*)
@@ -4349,12 +4698,18 @@ m4_if([$1], [CXX], [
 
     linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
+      # old Intel for x86_64, which still supported -KPIC.
       ecc*)
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
         ;;
+      # flang / f18. f95 an alias for gfortran or flang on Debian
+      flang* | f18* | f95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
       # icc used to be incompatible with GCC.
       # ICC 10 doesn't accept -KPIC any more.
       icc* | ifort*)
@@ -4374,6 +4729,12 @@ m4_if([$1], [CXX], [
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
        ;;
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+       ;;
       pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
        # which looks to be a dead project)
@@ -4471,7 +4832,7 @@ m4_if([$1], [CXX], [
       ;;
 
     sysv4*MP*)
-      if test -d /usr/nec ;then
+      if test -d /usr/necthen
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       fi
@@ -4500,7 +4861,7 @@ m4_if([$1], [CXX], [
   fi
 ])
 case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
+  # For platforms that do not support PIC, -DPIC is meaningless:
   *djgpp*)
     _LT_TAGVAR(lt_prog_compiler_pic, $1)=
     ;;
@@ -4566,17 +4927,21 @@ m4_if([$1], [CXX], [
   case $host_os in
   aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
+    # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+    # Without the "-l" option, or with the "-B" option, AIX nm treats
+    # weak defined symbols like other global defined symbols, whereas
+    # GNU nm marks them as "W".
+    # While the 'weak' keyword is ignored in the Export File, we need
+    # it in the Import File for the 'aix-soname' feature, so we have
+    # to replace the "-B" option with "-P" for AIX nm.
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
     else
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
     fi
     ;;
   pw32*)
-    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
@@ -4625,9 +4990,9 @@ m4_if([$1], [CXX], [
   # included in the symbol list
   _LT_TAGVAR(include_expsyms, $1)=
   # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
+  # it will be wrapped by ' (' and ')$', so one must not match beginning or
+  # end of line.  Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
+  # as well as any symbol that contains 'd'.
   _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
@@ -4643,7 +5008,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       with_gnu_ld=no
     fi
     ;;
@@ -4651,7 +5016,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
     # we just hope/assume this is gcc and not c89 (= MSVC++)
     with_gnu_ld=yes
     ;;
-  openbsd*)
+  openbsd* | bitrig*)
     with_gnu_ld=no
     ;;
   linux* | k*bsd*-gnu | gnu*)
@@ -4664,7 +5029,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
   # On some targets, GNU ld is compatible enough with the native linker
   # that we're better off using the native interface for both.
   lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     case $host_os in
       aix*)
        # The AIX port of GNU ld has always aspired to compatibility
@@ -4686,24 +5051,24 @@ dnl Note also adjust exclude_expsyms for C++ above.
     esac
   fi
 
-  if test "$lt_use_gnu_ld_interface" = yes; then
+  if test yes = "$lt_use_gnu_ld_interface"; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
+    wlarc='$wl'
 
     # Set some defaults for GNU ld with shared library support. These
     # are reset later if shared libraries are not supported. Putting them
     # here allows them to be overridden if necessary.
     runpath_var=LD_RUN_PATH
-    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
     # ancient GNU ld didn't support --whole-archive et. al.
     if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
     else
       _LT_TAGVAR(whole_archive_flag_spec, $1)=
     fi
     supports_anon_versioning=no
-    case `$LD -v 2>&1` in
+    case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in
       *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
@@ -4716,7 +5081,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
     case $host_os in
     aix[[3-9]]*)
       # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
+      if test ia64 != "$host_cpu"; then
        _LT_TAGVAR(ld_shlibs, $1)=no
        cat <<_LT_EOF 1>&2
 
@@ -4735,7 +5100,7 @@ _LT_EOF
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             _LT_TAGVAR(archive_expsym_cmds, $1)=''
         ;;
       m68k)
@@ -4751,7 +5116,7 @@ _LT_EOF
        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
        # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
        # support --undefined.  This deserves some investigation.  FIXME
-       _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       else
        _LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4761,7 +5126,7 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -4769,61 +5134,89 @@ _LT_EOF
       _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-       # If the export-symbols file already is a .def file (1st line
-       # is EXPORTS), use it as is; otherwise, prepend...
-       _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-         cp $export_symbols $output_objdir/$soname.def;
-       else
-         echo EXPORTS > $output_objdir/$soname.def;
-         cat $export_symbols >> $output_objdir/$soname.def;
-       fi~
-       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file, use it as
+       # is; otherwise, prepend EXPORTS...
+       _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+          cp $export_symbols $output_objdir/$soname.def;
+        else
+          echo EXPORTS > $output_objdir/$soname.def;
+          cat $export_symbols >> $output_objdir/$soname.def;
+        fi~
+        $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
       else
        _LT_TAGVAR(ld_shlibs, $1)=no
       fi
       ;;
 
     haiku*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      shrext_cmds=.dll
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
     interix[[3-9]]*)
       _LT_TAGVAR(hardcode_direct, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
       # Instead, shared libraries are loaded at an image base (0x10000000 by
       # default) and relocated if they conflict, which is a slow very memory
       # consuming and fragmenting process.  To avoid this, we pick a random,
       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
     gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
+      if test linux-dietlibc = "$host_os"; then
        case $cc_basename in
          diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
        esac
       fi
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-        && test "$tmp_diet" = no
+        && test no = "$tmp_diet"
       then
        tmp_addflag=' $pic_flag'
        tmp_sharedflag='-shared'
        case $cc_basename,$host_cpu in
         pgcc*)                         # Portland Group C compiler
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          tmp_addflag=' $pic_flag'
          ;;
        pgf77* | pgf90* | pgf95* | pgfortran*)
                                        # Portland Group f77 and f90 compilers
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          tmp_addflag=' $pic_flag -Mnomain' ;;
        ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
          tmp_addflag=' -i_dynamic' ;;
@@ -4834,42 +5227,47 @@ _LT_EOF
        lf95*)                          # Lahey Fortran 8.1
          _LT_TAGVAR(whole_archive_flag_spec, $1)=
          tmp_sharedflag='--shared' ;;
+        nagfor*)                        # NAGFOR 5.3
+          tmp_sharedflag='-Wl,-shared' ;;
        xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
          tmp_sharedflag='-qmkshrobj'
          tmp_addflag= ;;
        nvcc*)  # Cuda Compiler Driver 2.2
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          _LT_TAGVAR(compiler_needs_object, $1)=yes
          ;;
        esac
        case `$CC -V 2>&1 | sed 5q` in
        *Sun\ C*)                       # Sun C 5.9
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
          _LT_TAGVAR(compiler_needs_object, $1)=yes
          tmp_sharedflag='-G' ;;
        *Sun\ F*)                       # Sun Fortran 8.3
          tmp_sharedflag='-G' ;;
        esac
-       _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
 
-        if test "x$supports_anon_versioning" = xyes; then
+        if test yes = "$supports_anon_versioning"; then
           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-           echo "local: *; };" >> $output_objdir/$libname.ver~
-           $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+            cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+            echo "local: *; };" >> $output_objdir/$libname.ver~
+            $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
         fi
 
        case $cc_basename in
+       tcc*)
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic'
+         ;;
        xlf* | bgf* | bgxlf* | mpixlf*)
          # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
          _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
          _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-         if test "x$supports_anon_versioning" = xyes; then
+         if test yes = "$supports_anon_versioning"; then
            _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-             cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-             echo "local: *; };" >> $output_objdir/$libname.ver~
-             $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+              echo "local: *; };" >> $output_objdir/$libname.ver~
+              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
          fi
          ;;
        esac
@@ -4883,8 +5281,8 @@ _LT_EOF
        _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
        wlarc=
       else
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -4902,8 +5300,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
        _LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4915,7 +5313,7 @@ _LT_EOF
        _LT_TAGVAR(ld_shlibs, $1)=no
        cat <<_LT_EOF 1>&2
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
 *** reliably create shared libraries on SCO systems.  Therefore, libtool
 *** is disabling shared libraries support.  We urge you to upgrade GNU
 *** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
@@ -4930,9 +5328,9 @@ _LT_EOF
          # DT_RUNPATH tag from executables and libraries.  But doing so
          # requires that you compile everything twice, which is a pain.
          if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
          else
            _LT_TAGVAR(ld_shlibs, $1)=no
          fi
@@ -4949,15 +5347,15 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
        _LT_TAGVAR(ld_shlibs, $1)=no
       fi
       ;;
     esac
 
-    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+    if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then
       runpath_var=
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
       _LT_TAGVAR(export_dynamic_flag_spec, $1)=
@@ -4973,7 +5371,7 @@ _LT_EOF
       # Note: this linker hardcodes the directories in LIBPATH if there
       # are no directories specified by -L.
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+      if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
        # Neither direct hardcoding nor static linking is supported with a
        # broken collect2.
        _LT_TAGVAR(hardcode_direct, $1)=unsupported
@@ -4981,34 +5379,57 @@ _LT_EOF
       ;;
 
     aix[[4-9]]*)
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
        # On IA64, the linker does run time linking by default, so we don't
        # have to do anything special.
        aix_use_runtimelinking=no
        exp_sym_flag='-Bexport'
-       no_entry_flag=""
+       no_entry_flag=
       else
        # If we're using GNU nm, then we don't want the "-C" option.
-       # -C means demangle to AIX nm, but means don't demangle with GNU nm
-       # Also, AIX nm treats weak defined symbols like other global
-       # defined symbols, whereas GNU nm marks them as "W".
+       # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+       # Without the "-l" option, or with the "-B" option, AIX nm treats
+       # weak defined symbols like other global defined symbols, whereas
+       # GNU nm marks them as "W".
+       # While the 'weak' keyword is ignored in the Export File, we need
+       # it in the Import File for the 'aix-soname' feature, so we have
+       # to replace the "-B" option with "-P" for AIX nm.
        if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
        else
-         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+         _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
        fi
        aix_use_runtimelinking=no
 
        # Test if we are trying to use run time linking or normal
        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-       # need to do runtime linking.
+       # have runtime linking enabled, and use it for executables.
+       # For shared libraries, we enable/disable runtime linking
+       # depending on the kind of the shared library created -
+       # when "with_aix_soname,aix_use_runtimelinking" is:
+       # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "aix,yes"  lib.so          shared, rtl:yes, for executables
+       #            lib.a           static archive
+       # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+       #            lib.a(lib.so.V) shared, rtl:no,  for executables
+       # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a(lib.so.V) shared, rtl:no
+       # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+       #            lib.a           static archive
        case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
          for ld_flag in $LDFLAGS; do
-         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+         if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
            aix_use_runtimelinking=yes
            break
          fi
          done
+         if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+           # With aix-soname=svr4, we create the lib.so.V shared archives only,
+           # so we don't have lib.a shared libs to link our executables.
+           # We have to force runtime linking in this case.
+           aix_use_runtimelinking=yes
+           LDFLAGS="$LDFLAGS -Wl,-brtl"
+         fi
          ;;
        esac
 
@@ -5027,13 +5448,21 @@ _LT_EOF
       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
       _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
       _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+      _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
+      case $with_aix_soname,$aix_use_runtimelinking in
+      aix,*) ;; # traditional, no import file
+      svr4,* | *,yes) # use import file
+       # The Import File defines what to hardcode.
+       _LT_TAGVAR(hardcode_direct, $1)=no
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+       ;;
+      esac
 
-      if test "$GCC" = yes; then
+      if test yes = "$GCC"; then
        case $host_os in aix4.[[012]]|aix4.[[012]].*)
        # We only want to do this on AIX 4.2 and lower, the check
        # below for broken collect2 doesn't work under 4.3+
-         collect2name=`${CC} -print-prog-name=collect2`
+         collect2name=`$CC -print-prog-name=collect2`
          if test -f "$collect2name" &&
           strings "$collect2name" | $GREP resolve_lib_name >/dev/null
          then
@@ -5052,62 +5481,80 @@ _LT_EOF
          ;;
        esac
        shared_flag='-shared'
-       if test "$aix_use_runtimelinking" = yes; then
-         shared_flag="$shared_flag "'${wl}-G'
+       if test yes = "$aix_use_runtimelinking"; then
+         shared_flag="$shared_flag "'$wl-G'
        fi
-       _LT_TAGVAR(link_all_deplibs, $1)=no
+       # Need to ensure runtime linking is disabled for the traditional
+       # shared library, or the linker may eventually find shared libraries
+       # /with/ Import File - we do not want to mix them.
+       shared_flag_aix='-shared'
+       shared_flag_svr4='-shared $wl-G'
       else
        # not using gcc
-       if test "$host_cpu" = ia64; then
+       if test ia64 = "$host_cpu"; then
        # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
        # chokes on -Wl,-G. The following line is correct:
          shared_flag='-G'
        else
-         if test "$aix_use_runtimelinking" = yes; then
-           shared_flag='${wl}-G'
+         if test yes = "$aix_use_runtimelinking"; then
+           shared_flag='$wl-G'
          else
-           shared_flag='${wl}-bM:SRE'
+           shared_flag='$wl-bM:SRE'
          fi
+         shared_flag_aix='$wl-bM:SRE'
+         shared_flag_svr4='$wl-G'
        fi
       fi
 
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       _LT_TAGVAR(always_export_symbols, $1)=yes
-      if test "$aix_use_runtimelinking" = yes; then
+      if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
        # Warning - without using the other runtime loading flags (-brtl),
        # -berok will link without error, but may produce a broken library.
        _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
         _LT_SYS_MODULE_PATH_AIX([$1])
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
       else
-       if test "$host_cpu" = ia64; then
-         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+       if test ia64 = "$host_cpu"; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
          _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-         _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+         _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
        else
         # Determine the default libpath from the value encoded in an
         # empty executable.
         _LT_SYS_MODULE_PATH_AIX([$1])
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
          # Warning - without using the other run time loading flags,
          # -berok will link without error, but may produce a broken library.
-         _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-         _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-         if test "$with_gnu_ld" = yes; then
+         _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
+         _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
+         if test yes = "$with_gnu_ld"; then
            # We only use this code for GNU lds that support --whole-archive.
-           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
          else
            # Exported symbols can be pulled into shared objects from archives
            _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
          fi
          _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-         # This is similar to how AIX traditionally builds its shared libraries.
-         _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+         # -brtl affects multiple linker settings, -berok does not and is overridden later
+         compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
+         if test svr4 != "$with_aix_soname"; then
+           # This is similar to how AIX traditionally builds its shared libraries.
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+         fi
+         if test aix != "$with_aix_soname"; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+         else
+           # used by -dlpreopen to get the symbols
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+         fi
+         _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
        fi
       fi
       ;;
@@ -5116,7 +5563,7 @@ _LT_EOF
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             _LT_TAGVAR(archive_expsym_cmds, $1)=''
         ;;
       m68k)
@@ -5146,16 +5593,17 @@ _LT_EOF
        # Tell ltmain to make .lib files, not .a files.
        libext=lib
        # Tell ltmain to make .dll files, not .so files.
-       shrext_cmds=".dll"
+       shrext_cmds=.dll
        # FIXME: Setting linknames here is a bad hack.
-       _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-       _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-           sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-         else
-           sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-         fi~
-         $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-         linknames='
+       _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+       _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+            cp "$export_symbols" "$output_objdir/$soname.def";
+            echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+          else
+            $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+          fi~
+          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+          linknames='
        # The linker will not automatically build a static lib if we build a DLL.
        # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -5164,18 +5612,18 @@ _LT_EOF
        # Don't use ranlib
        _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
        _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-         lt_tool_outputfile="@TOOL_OUTPUT@"~
-         case $lt_outputfile in
-           *.exe|*.EXE) ;;
-           *)
-             lt_outputfile="$lt_outputfile.exe"
-             lt_tool_outputfile="$lt_tool_outputfile.exe"
-             ;;
-         esac~
-         if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-           $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-           $RM "$lt_outputfile.manifest";
-         fi'
+          lt_tool_outputfile="@TOOL_OUTPUT@"~
+          case $lt_outputfile in
+            *.exe|*.EXE) ;;
+            *)
+              lt_outputfile=$lt_outputfile.exe
+              lt_tool_outputfile=$lt_tool_outputfile.exe
+              ;;
+          esac~
+          if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+            $RM "$lt_outputfile.manifest";
+          fi'
        ;;
       *)
        # Assume MSVC wrapper
@@ -5184,7 +5632,7 @@ _LT_EOF
        # Tell ltmain to make .lib files, not .a files.
        libext=lib
        # Tell ltmain to make .dll files, not .so files.
-       shrext_cmds=".dll"
+       shrext_cmds=.dll
        # FIXME: Setting linknames here is a bad hack.
        _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
        # The linker will automatically build a .lib file if we build a DLL.
@@ -5234,33 +5682,33 @@ _LT_EOF
       ;;
 
     hpux9*)
-      if test "$GCC" = yes; then
-       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       else
-       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_TAGVAR(hardcode_direct, $1)=yes
 
       # hardcode_minus_L: Not really in the search PATH,
       # but as the default location of the library.
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
        _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
-      if test "$with_gnu_ld" = no; then
-       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
        _LT_TAGVAR(hardcode_direct, $1)=yes
        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
        # hardcode_minus_L: Not really in the search PATH,
        # but as the default location of the library.
        _LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5268,25 +5716,25 @@ _LT_EOF
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test yes,no = "$GCC,$with_gnu_ld"; then
        case $host_cpu in
        hppa*64*)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        ia64*)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        esac
       else
        case $host_cpu in
        hppa*64*)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        ia64*)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
        m4_if($1, [], [
@@ -5294,14 +5742,14 @@ _LT_EOF
          # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
          _LT_LINKER_OPTION([if $CC understands -b],
            _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
-           [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+           [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
            [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
-         [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+         [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
          ;;
        esac
       fi
-      if test "$with_gnu_ld" = no; then
-       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
        case $host_cpu in
@@ -5312,7 +5760,7 @@ _LT_EOF
        *)
          _LT_TAGVAR(hardcode_direct, $1)=yes
          _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
 
          # hardcode_minus_L: Not really in the search PATH,
          # but as the default location of the library.
@@ -5323,16 +5771,16 @@ _LT_EOF
       ;;
 
     irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
        # Try to use the -exported_symbol ld option, if it does not
        # work, assume that -exports_file does not work either and
        # implicitly export all symbols.
        # This should be the same for all languages, so no per-tag cache variable.
        AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
          [lt_cv_irix_exported_symbol],
-         [save_LDFLAGS="$LDFLAGS"
-          LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+         [save_LDFLAGS=$LDFLAGS
+          LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
           AC_LINK_IFELSE(
             [AC_LANG_SOURCE(
                [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
@@ -5345,21 +5793,32 @@ _LT_EOF
       end]])])],
              [lt_cv_irix_exported_symbol=yes],
              [lt_cv_irix_exported_symbol=no])
-           LDFLAGS="$save_LDFLAGS"])
-       if test "$lt_cv_irix_exported_symbol" = yes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+           LDFLAGS=$save_LDFLAGS])
+       if test yes = "$lt_cv_irix_exported_symbol"; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
        fi
+       _LT_TAGVAR(link_all_deplibs, $1)=no
       else
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_TAGVAR(inherit_rpath, $1)=yes
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
+    linux*)
+      case $cc_basename in
+      tcc*)
+       # Fabrice Bellard et al's Tiny C Compiler
+       _LT_TAGVAR(ld_shlibs, $1)=yes
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      esac
+      ;;
+
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
@@ -5374,7 +5833,7 @@ _LT_EOF
     newsos6)
       _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
       _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
@@ -5382,27 +5841,19 @@ _LT_EOF
     *nto* | *qnx*)
       ;;
 
-    openbsd*)
+    openbsd* | bitrig*)
       if test -f /usr/libexec/ld.so; then
        _LT_TAGVAR(hardcode_direct, $1)=yes
        _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
        else
-         case $host_os in
-          openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-            _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-            ;;
-          *)
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-            ;;
-         esac
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
        fi
       else
        _LT_TAGVAR(ld_shlibs, $1)=no
@@ -5413,33 +5864,53 @@ _LT_EOF
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      shrext_cmds=.dll
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+       $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+       $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+       $ECHO EXPORTS >> $output_objdir/$libname.def~
+       prefix_cmds="$SED"~
+       if test EXPORTS = "`$SED 1q $export_symbols`"; then
+         prefix_cmds="$prefix_cmds -e 1d";
+       fi~
+       prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+       cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+       $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+       emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
 
     osf3*)
-      if test "$GCC" = yes; then
-       _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
       else
        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       ;;
 
     osf4* | osf5*)     # as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-       _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       else
        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+          $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
 
        # Both c and cxx compiler support -rpath directly
        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -5450,24 +5921,24 @@ _LT_EOF
 
     solaris*)
       _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
-      if test "$GCC" = yes; then
-       wlarc='${wl}'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+       wlarc='$wl'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+          $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
        case `$CC -V 2>&1` in
        *"Compilers 5.0"*)
          wlarc=''
-         _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+            $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
          ;;
        *)
-         wlarc='${wl}'
-         _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         wlarc='$wl'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-         $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+            $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
          ;;
        esac
       fi
@@ -5477,11 +5948,11 @@ _LT_EOF
       solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
       *)
        # The compiler driver will combine and reorder linker options,
-       # but understands `-z linker_flag'.  GCC discards it without `$wl',
+       # but understands '-z linker_flag'.  GCC discards it without '$wl',
        # but is careful enough not to reorder.
        # Supported since Solaris 2.6 (maybe 2.5.1?)
-       if test "$GCC" = yes; then
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+       if test yes = "$GCC"; then
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
        else
          _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
        fi
@@ -5491,10 +5962,10 @@ _LT_EOF
       ;;
 
     sunos4*)
-      if test "x$host_vendor" = xsequent; then
+      if test sequent = "$host_vendor"; then
        # Use $CC to link under sequent, because it throws in some extra .o
        # files that make .init and .fini sections work.
-       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
       else
        _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -5543,43 +6014,43 @@ _LT_EOF
       ;;
 
     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
     sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
+      # Note: We CANNOT use -z defs as we might desire, because we do not
       # link with -lc, and that would cause any symbols used from libc to
       # always be unresolved, which means just about no library would
       # ever link correctly.  If we're not using GNU ld we use -z text
       # though, which does catch some bad symbols but isn't as heavy-handed
       # as -z defs.
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
       _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
@@ -5594,17 +6065,17 @@ _LT_EOF
       ;;
     esac
 
-    if test x$host_vendor = xsni; then
+    if test sni = "$host_vendor"; then
       case $host in
       sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym'
        ;;
       esac
     fi
   fi
 ])
 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
 
 _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
 
@@ -5621,7 +6092,7 @@ x|xyes)
   # Assume -lc should be added
   _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
+  if test yes,yes = "$GCC,$enable_shared"; then
     case $_LT_TAGVAR(archive_cmds, $1) in
     *'~'*)
       # FIXME: we may have to deal with multi-command sequences.
@@ -5701,12 +6172,12 @@ _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
     [Whether we need a single "-rpath" flag with a separated argument])
 _LT_TAGDECL([], [hardcode_direct], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
     DIR into the resulting binary])
 _LT_TAGDECL([], [hardcode_direct_absolute], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
     DIR into the resulting binary and the resulting library dependency is
-    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    "absolute", i.e impossible to change by setting $shlibpath_var if the
     library is relocated])
 _LT_TAGDECL([], [hardcode_minus_L], [0],
     [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
@@ -5747,10 +6218,10 @@ dnl    [Compiler flag to generate thread safe objects])
 # ------------------------
 # Ensure that the configuration variables for a C compiler are suitably
 # defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
+# the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_C_CONFIG],
 [m4_require([_LT_DECL_EGREP])dnl
-lt_save_CC="$CC"
+lt_save_CC=$CC
 AC_LANG_PUSH(C)
 
 # Source file extension for C test sources.
@@ -5790,18 +6261,18 @@ if test -n "$compiler"; then
   LT_SYS_DLOPEN_SELF
   _LT_CMD_STRIPLIB
 
-  # Report which library types will actually be built
+  # Report what library types will actually be built
   AC_MSG_CHECKING([if libtool supports shared libraries])
   AC_MSG_RESULT([$can_build_shared])
 
   AC_MSG_CHECKING([whether to build shared libraries])
-  test "$can_build_shared" = "no" && enable_shared=no
+  test no = "$can_build_shared" && enable_shared=no
 
   # On AIX, shared libraries and static libraries use the same namespace, and
   # are all built from PIC.
   case $host_os in
   aix3*)
-    test "$enable_shared" = yes && enable_static=no
+    test yes = "$enable_shared" && enable_static=no
     if test -n "$RANLIB"; then
       archive_cmds="$archive_cmds~\$RANLIB \$lib"
       postinstall_cmds='$RANLIB $lib'
@@ -5809,8 +6280,12 @@ if test -n "$compiler"; then
     ;;
 
   aix[[4-9]]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
+    if test ia64 != "$host_cpu"; then
+      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+      yes,aix,yes) ;;                  # shared object as lib.so file only
+      yes,svr4,*) ;;                   # shared object as lib.so archive member only
+      yes,*) enable_static=no ;;       # shared object in lib.a archive as well
+      esac
     fi
     ;;
   esac
@@ -5818,13 +6293,13 @@ if test -n "$compiler"; then
 
   AC_MSG_CHECKING([whether to build static libraries])
   # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
+  test yes = "$enable_shared" || enable_static=yes
   AC_MSG_RESULT([$enable_static])
 
   _LT_CONFIG($1)
 fi
 AC_LANG_POP
-CC="$lt_save_CC"
+CC=$lt_save_CC
 ])# _LT_LANG_C_CONFIG
 
 
@@ -5832,14 +6307,14 @@ CC="$lt_save_CC"
 # --------------------------
 # Ensure that the configuration variables for a C++ compiler are suitably
 # defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
+# the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_CXX_CONFIG],
 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
+if test -n "$CXX" && ( test no != "$CXX" &&
+    ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) ||
+    (test g++ != "$CXX"))); then
   AC_PROG_CXXCPP
 else
   _lt_caught_CXX_error=yes
@@ -5881,7 +6356,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the CXX compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_caught_CXX_error" != yes; then
+if test yes != "$_lt_caught_CXX_error"; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="int some_variable = 0;"
 
@@ -5923,35 +6398,35 @@ if test "$_lt_caught_CXX_error" != yes; then
   if test -n "$compiler"; then
     # We don't want -fno-exception when compiling C++ code, so set the
     # no_builtin_flag separately
-    if test "$GXX" = yes; then
+    if test yes = "$GXX"; then
       _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
     else
       _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
     fi
 
-    if test "$GXX" = yes; then
+    if test yes = "$GXX"; then
       # Set up default GNU C++ configuration
 
       LT_PATH_LD
 
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
-      if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      if test yes = "$with_gnu_ld"; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
 
         # If archive_cmds runs LD, not CC, wlarc should be empty
         # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
         #     investigate it a little bit more. (MM)
-        wlarc='${wl}'
+        wlarc='$wl'
 
         # ancient GNU ld didn't support --whole-archive et. al.
         if eval "`$CC -print-prog-name=ld` --help 2>&1" |
          $GREP 'no-whole-archive' > /dev/null; then
-          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
         else
           _LT_TAGVAR(whole_archive_flag_spec, $1)=
         fi
@@ -5970,7 +6445,7 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
       # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
 
     else
       GXX=no
@@ -5987,18 +6462,30 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(ld_shlibs, $1)=no
         ;;
       aix[[4-9]]*)
-        if test "$host_cpu" = ia64; then
+        if test ia64 = "$host_cpu"; then
           # On IA64, the linker does run time linking by default, so we don't
           # have to do anything special.
           aix_use_runtimelinking=no
           exp_sym_flag='-Bexport'
-          no_entry_flag=""
+          no_entry_flag=
         else
           aix_use_runtimelinking=no
 
           # Test if we are trying to use run time linking or normal
           # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-          # need to do runtime linking.
+          # have runtime linking enabled, and use it for executables.
+          # For shared libraries, we enable/disable runtime linking
+          # depending on the kind of the shared library created -
+          # when "with_aix_soname,aix_use_runtimelinking" is:
+          # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "aix,yes"  lib.so          shared, rtl:yes, for executables
+          #            lib.a           static archive
+          # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+          #            lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a(lib.so.V) shared, rtl:no
+          # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a           static archive
           case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
            for ld_flag in $LDFLAGS; do
              case $ld_flag in
@@ -6008,6 +6495,13 @@ if test "$_lt_caught_CXX_error" != yes; then
                ;;
              esac
            done
+           if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+             # With aix-soname=svr4, we create the lib.so.V shared archives only,
+             # so we don't have lib.a shared libs to link our executables.
+             # We have to force runtime linking in this case.
+             aix_use_runtimelinking=yes
+             LDFLAGS="$LDFLAGS -Wl,-brtl"
+           fi
            ;;
           esac
 
@@ -6026,13 +6520,21 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
         _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
         _LT_TAGVAR(link_all_deplibs, $1)=yes
-        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+        _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
+        case $with_aix_soname,$aix_use_runtimelinking in
+        aix,*) ;;      # no import file
+        svr4,* | *,yes) # use import file
+          # The Import File defines what to hardcode.
+          _LT_TAGVAR(hardcode_direct, $1)=no
+          _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+          ;;
+        esac
 
-        if test "$GXX" = yes; then
+        if test yes = "$GXX"; then
           case $host_os in aix4.[[012]]|aix4.[[012]].*)
           # We only want to do this on AIX 4.2 and lower, the check
           # below for broken collect2 doesn't work under 4.3+
-         collect2name=`${CC} -print-prog-name=collect2`
+         collect2name=`$CC -print-prog-name=collect2`
          if test -f "$collect2name" &&
             strings "$collect2name" | $GREP resolve_lib_name >/dev/null
          then
@@ -6050,64 +6552,84 @@ if test "$_lt_caught_CXX_error" != yes; then
          fi
           esac
           shared_flag='-shared'
-         if test "$aix_use_runtimelinking" = yes; then
-           shared_flag="$shared_flag "'${wl}-G'
+         if test yes = "$aix_use_runtimelinking"; then
+           shared_flag=$shared_flag' $wl-G'
          fi
+         # Need to ensure runtime linking is disabled for the traditional
+         # shared library, or the linker may eventually find shared libraries
+         # /with/ Import File - we do not want to mix them.
+         shared_flag_aix='-shared'
+         shared_flag_svr4='-shared $wl-G'
         else
           # not using gcc
-          if test "$host_cpu" = ia64; then
+          if test ia64 = "$host_cpu"; then
          # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
          # chokes on -Wl,-G. The following line is correct:
          shared_flag='-G'
           else
-           if test "$aix_use_runtimelinking" = yes; then
-             shared_flag='${wl}-G'
+           if test yes = "$aix_use_runtimelinking"; then
+             shared_flag='$wl-G'
            else
-             shared_flag='${wl}-bM:SRE'
+             shared_flag='$wl-bM:SRE'
            fi
+           shared_flag_aix='$wl-bM:SRE'
+           shared_flag_svr4='$wl-G'
           fi
         fi
 
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
         # It seems that -bexpall does not export symbols beginning with
         # underscore (_), so it is better to generate a list of symbols to
        # export.
         _LT_TAGVAR(always_export_symbols, $1)=yes
-        if test "$aix_use_runtimelinking" = yes; then
+       if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
           # Warning - without using the other runtime loading flags (-brtl),
           # -berok will link without error, but may produce a broken library.
-          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # The "-G" linker flag allows undefined symbols.
+          _LT_TAGVAR(no_undefined_flag, $1)='-bernotok'
           # Determine the default libpath from the value encoded in an empty
           # executable.
           _LT_SYS_MODULE_PATH_AIX([$1])
-          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
         else
-          if test "$host_cpu" = ia64; then
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+          if test ia64 = "$host_cpu"; then
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
            _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
           else
            # Determine the default libpath from the value encoded in an
            # empty executable.
            _LT_SYS_MODULE_PATH_AIX([$1])
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
            # Warning - without using the other run time loading flags,
            # -berok will link without error, but may produce a broken library.
-           _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-           _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-           if test "$with_gnu_ld" = yes; then
+           _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
+           _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
+           if test yes = "$with_gnu_ld"; then
              # We only use this code for GNU lds that support --whole-archive.
-             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
            else
              # Exported symbols can be pulled into shared objects from archives
              _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
            fi
            _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-           # This is similar to how AIX traditionally builds its shared
-           # libraries.
-           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+           # -brtl affects multiple linker settings, -berok does not and is overridden later
+           compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
+           if test svr4 != "$with_aix_soname"; then
+             # This is similar to how AIX traditionally builds its shared
+             # libraries. Need -bnortl late, we may have -brtl in LDFLAGS.
+             _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+           fi
+           if test aix != "$with_aix_soname"; then
+             _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+           else
+             # used by -dlpreopen to get the symbols
+             _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+           fi
+           _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
           fi
         fi
         ;;
@@ -6117,7 +6639,7 @@ if test "$_lt_caught_CXX_error" != yes; then
          _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
          # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
          # support --undefined.  This deserves some investigation.  FIXME
-         _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
        else
          _LT_TAGVAR(ld_shlibs, $1)=no
        fi
@@ -6145,57 +6667,58 @@ if test "$_lt_caught_CXX_error" != yes; then
          # Tell ltmain to make .lib files, not .a files.
          libext=lib
          # Tell ltmain to make .dll files, not .so files.
-         shrext_cmds=".dll"
+         shrext_cmds=.dll
          # FIXME: Setting linknames here is a bad hack.
-         _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-         _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-             $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-           else
-             $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-           fi~
-           $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-           linknames='
+         _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+         _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+              cp "$export_symbols" "$output_objdir/$soname.def";
+              echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+            else
+              $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+            fi~
+            $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+            linknames='
          # The linker will not automatically build a static lib if we build a DLL.
          # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
          _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
          # Don't use ranlib
          _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
          _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-           lt_tool_outputfile="@TOOL_OUTPUT@"~
-           case $lt_outputfile in
-             *.exe|*.EXE) ;;
-             *)
-               lt_outputfile="$lt_outputfile.exe"
-               lt_tool_outputfile="$lt_tool_outputfile.exe"
-               ;;
-           esac~
-           func_to_tool_file "$lt_outputfile"~
-           if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-             $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-             $RM "$lt_outputfile.manifest";
-           fi'
+            lt_tool_outputfile="@TOOL_OUTPUT@"~
+            case $lt_outputfile in
+              *.exe|*.EXE) ;;
+              *)
+                lt_outputfile=$lt_outputfile.exe
+                lt_tool_outputfile=$lt_tool_outputfile.exe
+                ;;
+            esac~
+            func_to_tool_file "$lt_outputfile"~
+            if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+              $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+              $RM "$lt_outputfile.manifest";
+            fi'
          ;;
        *)
          # g++
          # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
          # as there is no search path for DLLs.
          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
          _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
          _LT_TAGVAR(always_export_symbols, $1)=no
          _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
 
          if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-           # If the export-symbols file already is a .def file (1st line
-           # is EXPORTS), use it as is; otherwise, prepend...
-           _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-             cp $export_symbols $output_objdir/$soname.def;
-           else
-             echo EXPORTS > $output_objdir/$soname.def;
-             cat $export_symbols >> $output_objdir/$soname.def;
-           fi~
-           $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+           # If the export-symbols file already is a .def file, use it as
+           # is; otherwise, prepend EXPORTS...
+           _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+              cp $export_symbols $output_objdir/$soname.def;
+            else
+              echo EXPORTS > $output_objdir/$soname.def;
+              cat $export_symbols >> $output_objdir/$soname.def;
+            fi~
+            $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
          else
            _LT_TAGVAR(ld_shlibs, $1)=no
          fi
@@ -6206,6 +6729,34 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_DARWIN_LINKER_FEATURES($1)
        ;;
 
+      os2*)
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+       _LT_TAGVAR(hardcode_minus_L, $1)=yes
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       shrext_cmds=.dll
+       _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+         $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+         $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+         $ECHO EXPORTS >> $output_objdir/$libname.def~
+         emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+         $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+         emximp -o $lib $output_objdir/$libname.def'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+         $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+         $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+         $ECHO EXPORTS >> $output_objdir/$libname.def~
+         prefix_cmds="$SED"~
+         if test EXPORTS = "`$SED 1q $export_symbols`"; then
+           prefix_cmds="$prefix_cmds -e 1d";
+         fi~
+         prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+         cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+         $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+         emximp -o $lib $output_objdir/$libname.def'
+       _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+       ;;
+
       dgux*)
         case $cc_basename in
           ec++*)
@@ -6241,14 +6792,14 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       haiku*)
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
         _LT_TAGVAR(link_all_deplibs, $1)=yes
         ;;
 
       hpux9*)
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
         _LT_TAGVAR(hardcode_direct, $1)=yes
         _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
                                             # but as the default
@@ -6260,7 +6811,7 @@ if test "$_lt_caught_CXX_error" != yes; then
             _LT_TAGVAR(ld_shlibs, $1)=no
             ;;
           aCC*)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
             # Commands to make compiler produce verbose output that lists
             # what "hidden" libraries, object files and flags are used when
             # linking a shared library.
@@ -6269,11 +6820,11 @@ if test "$_lt_caught_CXX_error" != yes; then
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
             ;;
           *)
-            if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            if test yes = "$GXX"; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6283,15 +6834,15 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       hpux10*|hpux11*)
-        if test $with_gnu_ld = no; then
-         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        if test no = "$with_gnu_ld"; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
          _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
           case $host_cpu in
             hppa*64*|ia64*)
               ;;
             *)
-             _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+             _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
               ;;
           esac
         fi
@@ -6317,13 +6868,13 @@ if test "$_lt_caught_CXX_error" != yes; then
           aCC*)
            case $host_cpu in
              hppa*64*)
-               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
                ;;
              ia64*)
-               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
                ;;
              *)
-               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
                ;;
            esac
            # Commands to make compiler produce verbose output that lists
@@ -6334,20 +6885,20 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
            ;;
           *)
-           if test "$GXX" = yes; then
-             if test $with_gnu_ld = no; then
+           if test yes = "$GXX"; then
+             if test no = "$with_gnu_ld"; then
                case $host_cpu in
                  hppa*64*)
-                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
                    ;;
                  ia64*)
-                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
                    ;;
                  *)
-                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
                    ;;
                esac
              fi
@@ -6362,22 +6913,22 @@ if test "$_lt_caught_CXX_error" != yes; then
       interix[[3-9]]*)
        _LT_TAGVAR(hardcode_direct, $1)=no
        _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
        # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
        # Instead, shared libraries are loaded at an image base (0x10000000 by
        # default) and relocated if they conflict, which is a slow very memory
        # consuming and fragmenting process.  To avoid this, we pick a random,
        # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
        # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
        ;;
       irix5* | irix6*)
         case $cc_basename in
           CC*)
            # SGI C++
-           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 
            # Archives containing C++ object files must be created using
            # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -6386,17 +6937,17 @@ if test "$_lt_caught_CXX_error" != yes; then
            _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
            ;;
           *)
-           if test "$GXX" = yes; then
-             if test "$with_gnu_ld" = no; then
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+           if test yes = "$GXX"; then
+             if test no = "$with_gnu_ld"; then
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
              else
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib'
              fi
            fi
            _LT_TAGVAR(link_all_deplibs, $1)=yes
            ;;
         esac
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
@@ -6409,8 +6960,8 @@ if test "$_lt_caught_CXX_error" != yes; then
            # KCC will only create a shared library if the output file
            # ends with ".so" (or ".sl" for HP-UX), so rename the library
            # to its proper name (with version) after linking.
-           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-           _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib'
            # Commands to make compiler produce verbose output that lists
            # what "hidden" libraries, object files and flags are used when
            # linking a shared library.
@@ -6419,10 +6970,10 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
 
            # Archives containing C++ object files must be created using
            # "CC -Bstatic", where "CC" is the KAI C++ compiler.
@@ -6436,59 +6987,59 @@ if test "$_lt_caught_CXX_error" != yes; then
            # earlier do not add the objects themselves.
            case `$CC -V 2>&1` in
              *"Version 7."*)
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
                ;;
              *)  # Version 8.0 or newer
                tmp_idyn=
                case $host_cpu in
                  ia64*) tmp_idyn=' -i_dynamic';;
                esac
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
                ;;
            esac
            _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
            ;;
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
            case `$CC -V` in
            *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
              _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
-               rm -rf $tpldir~
-               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
              _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
-               rm -rf $tpldir~
-               $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-               $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
-               $RANLIB $oldlib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+                $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+                $RANLIB $oldlib'
              _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
-               rm -rf $tpldir~
-               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
              _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
-               rm -rf $tpldir~
-               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
              ;;
            *) # Version 6 and above use weak symbols
-             _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
              ;;
            esac
 
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
             ;;
          cxx*)
            # Compaq C++
-           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname  -o $lib $wl-retain-symbols-file $wl$export_symbols'
 
            runpath_var=LD_RUN_PATH
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -6502,18 +7053,18 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
            ;;
          xl* | mpixl* | bgxl*)
            # IBM XL 8.0 on PPC, with GNU ld
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-           _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-           if test "x$supports_anon_versioning" = xyes; then
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+           if test yes = "$supports_anon_versioning"; then
              _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-               cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-               echo "local: *; };" >> $output_objdir/$libname.ver~
-               $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+                cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+                echo "local: *; };" >> $output_objdir/$libname.ver~
+                $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
            fi
            ;;
          *)
@@ -6521,10 +7072,10 @@ if test "$_lt_caught_CXX_error" != yes; then
            *Sun\ C*)
              # Sun C++ 5.9
              _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-             _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+             _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols'
              _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
              _LT_TAGVAR(compiler_needs_object, $1)=yes
 
              # Not sure whether something based on
@@ -6582,22 +7133,17 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(ld_shlibs, $1)=yes
        ;;
 
-      openbsd2*)
-        # C++ shared libraries are fairly broken
-       _LT_TAGVAR(ld_shlibs, $1)=no
-       ;;
-
-      openbsd*)
+      openbsd* | bitrig*)
        if test -f /usr/libexec/ld.so; then
          _LT_TAGVAR(hardcode_direct, $1)=yes
          _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
          _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-           _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
          fi
          output_verbose_link_cmd=func_echo_all
        else
@@ -6613,9 +7159,9 @@ if test "$_lt_caught_CXX_error" != yes; then
            # KCC will only create a shared library if the output file
            # ends with ".so" (or ".sl" for HP-UX), so rename the library
            # to its proper name (with version) after linking.
-           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
 
-           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
            _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
            # Archives containing C++ object files must be created using
@@ -6633,17 +7179,17 @@ if test "$_lt_caught_CXX_error" != yes; then
           cxx*)
            case $host in
              osf3*)
-               _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+               _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
                ;;
              *)
                _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
                _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-                 echo "-hidden">> $lib.exp~
-                 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
-                 $RM $lib.exp'
+                  echo "-hidden">> $lib.exp~
+                  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~
+                  $RM $lib.exp'
                _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
                ;;
            esac
@@ -6658,27 +7204,27 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
            ;;
          *)
-           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-             _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+           if test yes,no = "$GXX,$with_gnu_ld"; then
+             _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
              case $host in
                osf3*)
-                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
                  ;;
                *)
-                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
                  ;;
              esac
 
-             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
              _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
              # Commands to make compiler produce verbose output that lists
              # what "hidden" libraries, object files and flags are used when
              # linking a shared library.
-             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
 
            else
              # FIXME: insert proper C++ library support
@@ -6718,9 +7264,9 @@ if test "$_lt_caught_CXX_error" != yes; then
            # Sun C++ 4.2, 5.x and Centerline C++
             _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
            _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-           _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
            _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-             $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+              $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -6728,7 +7274,7 @@ if test "$_lt_caught_CXX_error" != yes; then
              solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
              *)
                # The compiler driver will combine and reorder linker options,
-               # but understands `-z linker_flag'.
+               # but understands '-z linker_flag'.
                # Supported since Solaris 2.6 (maybe 2.5.1?)
                _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
                ;;
@@ -6745,42 +7291,42 @@ if test "$_lt_caught_CXX_error" != yes; then
            ;;
           gcx*)
            # Green Hills C++ Compiler
-           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
 
            # The C++ compiler must be used to create the archive.
            _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
            ;;
           *)
            # GNU C++ compiler with Solaris linker
-           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-             _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+           if test yes,no = "$GXX,$with_gnu_ld"; then
+             _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs'
              if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
                _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-                 $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+                  $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
                # Commands to make compiler produce verbose output that lists
                # what "hidden" libraries, object files and flags are used when
                # linking a shared library.
-               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
              else
-               # g++ 2.7 appears to require `-G' NOT `-shared' on this
+               # g++ 2.7 appears to require '-G' NOT '-shared' on this
                # platform.
-               _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
                _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-                 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+                  $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
                # Commands to make compiler produce verbose output that lists
                # what "hidden" libraries, object files and flags are used when
                # linking a shared library.
-               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
              fi
 
-             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
              case $host_os in
                solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
                *)
-                 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+                 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
                  ;;
              esac
            fi
@@ -6789,52 +7335,52 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       runpath_var='LD_RUN_PATH'
 
       case $cc_basename in
         CC*)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
       esac
       ;;
 
       sysv5* | sco3.2v5* | sco5v6*)
-       # Note: We can NOT use -z defs as we might desire, because we do not
+       # Note: We CANNOT use -z defs as we might desire, because we do not
        # link with -lc, and that would cause any symbols used from libc to
        # always be unresolved, which means just about no library would
        # ever link correctly.  If we're not using GNU ld we use -z text
        # though, which does catch some bad symbols but isn't as heavy-handed
        # as -z defs.
-       _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-       _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+       _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+       _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
        _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
        _LT_TAGVAR(link_all_deplibs, $1)=yes
-       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
        runpath_var='LD_RUN_PATH'
 
        case $cc_basename in
           CC*)
-           _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
            _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-             '"$_LT_TAGVAR(old_archive_cmds, $1)"
+              '"$_LT_TAGVAR(old_archive_cmds, $1)"
            _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-             '"$_LT_TAGVAR(reload_cmds, $1)"
+              '"$_LT_TAGVAR(reload_cmds, $1)"
            ;;
          *)
-           _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
            ;;
        esac
       ;;
@@ -6865,10 +7411,10 @@ if test "$_lt_caught_CXX_error" != yes; then
     esac
 
     AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+    test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
 
-    _LT_TAGVAR(GCC, $1)="$GXX"
-    _LT_TAGVAR(LD, $1)="$LD"
+    _LT_TAGVAR(GCC, $1)=$GXX
+    _LT_TAGVAR(LD, $1)=$LD
 
     ## CAVEAT EMPTOR:
     ## There is no encapsulation within the following macros, do not change
@@ -6895,7 +7441,7 @@ if test "$_lt_caught_CXX_error" != yes; then
   lt_cv_path_LD=$lt_save_path_LD
   lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
   lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-fi # test "$_lt_caught_CXX_error" != yes
+fi # test yes != "$_lt_caught_CXX_error"
 
 AC_LANG_POP
 ])# _LT_LANG_CXX_CONFIG
@@ -6917,13 +7463,14 @@ AC_REQUIRE([_LT_DECL_SED])
 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
 func_stripname_cnf ()
 {
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  case @S|@2 in
+  .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;;
+  *)  func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;;
   esac
 } # func_stripname_cnf
 ])# _LT_FUNC_STRIPNAME_CNF
 
+
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -7007,13 +7554,13 @@ if AC_TRY_EVAL(ac_compile); then
   pre_test_object_deps_done=no
 
   for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${p} in
+    case $prev$p in
 
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
        # Remove the space.
-       if test $p = "-L" ||
-          test $p = "-R"; then
+       if test x-L = "$p" ||
+          test x-R = "$p"; then
         prev=$p
         continue
        fi
@@ -7029,16 +7576,16 @@ if AC_TRY_EVAL(ac_compile); then
        case $p in
        =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
        esac
-       if test "$pre_test_object_deps_done" = no; then
-        case ${prev} in
+       if test no = "$pre_test_object_deps_done"; then
+        case $prev in
         -L | -R)
           # Internal compiler library paths should come after those
           # provided the user.  The postdeps already come after the
           # user supplied libs so there is no need to process them.
           if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
-            _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+            _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p
           else
-            _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+            _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p"
           fi
           ;;
         # The "-l" case would never come before the object being
@@ -7046,9 +7593,9 @@ if AC_TRY_EVAL(ac_compile); then
         esac
        else
         if test -z "$_LT_TAGVAR(postdeps, $1)"; then
-          _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+          _LT_TAGVAR(postdeps, $1)=$prev$p
         else
-          _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+          _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p"
         fi
        fi
        prev=
@@ -7063,15 +7610,15 @@ if AC_TRY_EVAL(ac_compile); then
         continue
        fi
 
-       if test "$pre_test_object_deps_done" = no; then
+       if test no = "$pre_test_object_deps_done"; then
         if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
-          _LT_TAGVAR(predep_objects, $1)="$p"
+          _LT_TAGVAR(predep_objects, $1)=$p
         else
           _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
         fi
        else
         if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
-          _LT_TAGVAR(postdep_objects, $1)="$p"
+          _LT_TAGVAR(postdep_objects, $1)=$p
         else
           _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
         fi
@@ -7102,51 +7649,6 @@ interix[[3-9]]*)
   _LT_TAGVAR(postdep_objects,$1)=
   _LT_TAGVAR(postdeps,$1)=
   ;;
-
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC* | sunCC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
 esac
 ])
 
@@ -7155,7 +7657,7 @@ case " $_LT_TAGVAR(postdeps, $1) " in
 esac
  _LT_TAGVAR(compiler_lib_search_dirs, $1)=
 if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'`
 fi
 _LT_TAGDECL([], [compiler_lib_search_dirs], [1],
     [The directories searched by this compiler when creating a shared library])
@@ -7175,10 +7677,10 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
 [AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
+if test -z "$F77" || test no = "$F77"; then
   _lt_disable_F77=yes
 fi
 
@@ -7215,7 +7717,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the F77 compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
+if test yes != "$_lt_disable_F77"; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="\
       subroutine t
@@ -7237,7 +7739,7 @@ if test "$_lt_disable_F77" != yes; then
   _LT_LINKER_BOILERPLATE
 
   # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
+  lt_save_CC=$CC
   lt_save_GCC=$GCC
   lt_save_CFLAGS=$CFLAGS
   CC=${F77-"f77"}
@@ -7251,21 +7753,25 @@ if test "$_lt_disable_F77" != yes; then
     AC_MSG_RESULT([$can_build_shared])
 
     AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
+    test no = "$can_build_shared" && enable_shared=no
 
     # On AIX, shared libraries and static libraries use the same namespace, and
     # are all built from PIC.
     case $host_os in
       aix3*)
-        test "$enable_shared" = yes && enable_static=no
+        test yes = "$enable_shared" && enable_static=no
         if test -n "$RANLIB"; then
           archive_cmds="$archive_cmds~\$RANLIB \$lib"
           postinstall_cmds='$RANLIB $lib'
         fi
         ;;
       aix[[4-9]]*)
-       if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-         test "$enable_shared" = yes && enable_static=no
+       if test ia64 != "$host_cpu"; then
+         case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+         yes,aix,yes) ;;               # shared object as lib.so file only
+         yes,svr4,*) ;;                # shared object as lib.so archive member only
+         yes,*) enable_static=no ;;    # shared object in lib.a archive as well
+         esac
        fi
         ;;
     esac
@@ -7273,11 +7779,11 @@ if test "$_lt_disable_F77" != yes; then
 
     AC_MSG_CHECKING([whether to build static libraries])
     # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
+    test yes = "$enable_shared" || enable_static=yes
     AC_MSG_RESULT([$enable_static])
 
-    _LT_TAGVAR(GCC, $1)="$G77"
-    _LT_TAGVAR(LD, $1)="$LD"
+    _LT_TAGVAR(GCC, $1)=$G77
+    _LT_TAGVAR(LD, $1)=$LD
 
     ## CAVEAT EMPTOR:
     ## There is no encapsulation within the following macros, do not change
@@ -7294,9 +7800,9 @@ if test "$_lt_disable_F77" != yes; then
   fi # test -n "$compiler"
 
   GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
-fi # test "$_lt_disable_F77" != yes
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test yes != "$_lt_disable_F77"
 
 AC_LANG_POP
 ])# _LT_LANG_F77_CONFIG
@@ -7306,11 +7812,11 @@ AC_LANG_POP
 # -------------------------
 # Ensure that the configuration variables for a Fortran compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_FC_CONFIG],
 [AC_LANG_PUSH(Fortran)
 
-if test -z "$FC" || test "X$FC" = "Xno"; then
+if test -z "$FC" || test no = "$FC"; then
   _lt_disable_FC=yes
 fi
 
@@ -7347,7 +7853,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the FC compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_FC" != yes; then
+if test yes != "$_lt_disable_FC"; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="\
       subroutine t
@@ -7369,7 +7875,7 @@ if test "$_lt_disable_FC" != yes; then
   _LT_LINKER_BOILERPLATE
 
   # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
+  lt_save_CC=$CC
   lt_save_GCC=$GCC
   lt_save_CFLAGS=$CFLAGS
   CC=${FC-"f95"}
@@ -7385,21 +7891,25 @@ if test "$_lt_disable_FC" != yes; then
     AC_MSG_RESULT([$can_build_shared])
 
     AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
+    test no = "$can_build_shared" && enable_shared=no
 
     # On AIX, shared libraries and static libraries use the same namespace, and
     # are all built from PIC.
     case $host_os in
       aix3*)
-        test "$enable_shared" = yes && enable_static=no
+        test yes = "$enable_shared" && enable_static=no
         if test -n "$RANLIB"; then
           archive_cmds="$archive_cmds~\$RANLIB \$lib"
           postinstall_cmds='$RANLIB $lib'
         fi
         ;;
       aix[[4-9]]*)
-       if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-         test "$enable_shared" = yes && enable_static=no
+       if test ia64 != "$host_cpu"; then
+         case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+         yes,aix,yes) ;;               # shared object as lib.so file only
+         yes,svr4,*) ;;                # shared object as lib.so archive member only
+         yes,*) enable_static=no ;;    # shared object in lib.a archive as well
+         esac
        fi
         ;;
     esac
@@ -7407,11 +7917,11 @@ if test "$_lt_disable_FC" != yes; then
 
     AC_MSG_CHECKING([whether to build static libraries])
     # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
+    test yes = "$enable_shared" || enable_static=yes
     AC_MSG_RESULT([$enable_static])
 
-    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
-    _LT_TAGVAR(LD, $1)="$LD"
+    _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu
+    _LT_TAGVAR(LD, $1)=$LD
 
     ## CAVEAT EMPTOR:
     ## There is no encapsulation within the following macros, do not change
@@ -7431,7 +7941,7 @@ if test "$_lt_disable_FC" != yes; then
   GCC=$lt_save_GCC
   CC=$lt_save_CC
   CFLAGS=$lt_save_CFLAGS
-fi # test "$_lt_disable_FC" != yes
+fi # test yes != "$_lt_disable_FC"
 
 AC_LANG_POP
 ])# _LT_LANG_FC_CONFIG
@@ -7441,7 +7951,7 @@ AC_LANG_POP
 # --------------------------
 # Ensure that the configuration variables for the GNU Java Compiler compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_GCJ_CONFIG],
 [AC_REQUIRE([LT_PROG_GCJ])dnl
 AC_LANG_SAVE
@@ -7475,7 +7985,7 @@ CC=${GCJ-"gcj"}
 CFLAGS=$GCJFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
+_LT_TAGVAR(LD, $1)=$LD
 _LT_CC_BASENAME([$compiler])
 
 # GCJ did not exist at the time GCC didn't implicitly link libc in.
@@ -7512,7 +8022,7 @@ CFLAGS=$lt_save_CFLAGS
 # --------------------------
 # Ensure that the configuration variables for the GNU Go compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_GO_CONFIG],
 [AC_REQUIRE([LT_PROG_GO])dnl
 AC_LANG_SAVE
@@ -7546,7 +8056,7 @@ CC=${GOC-"gccgo"}
 CFLAGS=$GOFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
+_LT_TAGVAR(LD, $1)=$LD
 _LT_CC_BASENAME([$compiler])
 
 # Go did not exist at the time GCC didn't implicitly link libc in.
@@ -7583,7 +8093,7 @@ CFLAGS=$lt_save_CFLAGS
 # -------------------------
 # Ensure that the configuration variables for the Windows resource compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_RC_CONFIG],
 [AC_REQUIRE([LT_PROG_RC])dnl
 AC_LANG_SAVE
@@ -7599,7 +8109,7 @@ _LT_TAGVAR(objext, $1)=$objext
 lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
+lt_simple_link_test_code=$lt_simple_compile_test_code
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_TAG_COMPILER
@@ -7609,7 +8119,7 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
+lt_save_CC=$CC
 lt_save_CFLAGS=$CFLAGS
 lt_save_GCC=$GCC
 GCC=
@@ -7638,7 +8148,7 @@ AC_DEFUN([LT_PROG_GCJ],
 [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
   [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
     [AC_CHECK_TOOL(GCJ, gcj,)
-      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2"
       AC_SUBST(GCJFLAGS)])])[]dnl
 ])
 
@@ -7749,7 +8259,7 @@ lt_ac_count=0
 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
 # along with /bin/sed that truncates output.
 for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
+  test ! -f "$lt_ac_sed" && continue
   cat /dev/null > conftest.in
   lt_ac_count=0
   echo $ECHO_N "0123456789$ECHO_C" >conftest.in
@@ -7766,9 +8276,9 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
     $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
     cmp -s conftest.out conftest.nl || break
     # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
+    test 10 -lt "$lt_ac_count" && break
     lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
+    if test "$lt_ac_count" -gt "$lt_ac_max"; then
       lt_ac_max=$lt_ac_count
       lt_cv_path_SED=$lt_ac_sed
     fi
@@ -7792,27 +8302,7 @@ dnl AC_DEFUN([LT_AC_PROG_SED], [])
 # Find out whether the shell is Bourne or XSI compatible,
 # or has some other useful features.
 m4_defun([_LT_CHECK_SHELL_FEATURES],
-[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-AC_MSG_RESULT([$xsi_shell])
-_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
-
-AC_MSG_CHECKING([whether the shell understands "+="])
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-AC_MSG_RESULT([$lt_shell_append])
-_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   lt_unset=unset
 else
   lt_unset=false
@@ -7836,102 +8326,9 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
 ])# _LT_CHECK_SHELL_FEATURES
 
 
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([    ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
-    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-    # positional parameters, so assign one to ordinary parameter first.
-    func_stripname_result=${3}
-    func_stripname_result=${func_stripname_result#"${1}"}
-    func_stripname_result=${func_stripname_result%"${2}"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
-    func_split_long_opt_name=${1%%=*}
-    func_split_long_opt_arg=${1#*=}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
-    func_split_short_opt_arg=${1#??}
-    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
-    case ${1} in
-      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-      *)    func_lo2o_result=${1} ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
-
-  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
-
-  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
-    func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
-    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
 # _LT_PATH_CONVERSION_FUNCTIONS
 # -----------------------------
-# Determine which file name conversion functions should be used by
+# Determine what file name conversion functions should be used by
 # func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
 # for certain cross-compile configurations and native mingw.
 m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
index 5d9acd8..94b0829 100644 (file)
@@ -1,14 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
+#   Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 7 ltoptions.m4
+# serial 8 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -29,7 +29,7 @@ m4_define([_LT_SET_OPTION],
 [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
 m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
         _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
+    [m4_warning([Unknown $1 option '$2'])])[]dnl
 ])
 
 
@@ -75,13 +75,15 @@ m4_if([$1],[LT_INIT],[
   dnl
   dnl If no reference was made to various pairs of opposing options, then
   dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
   dnl archives by default:
   _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
   _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-                  [_LT_ENABLE_FAST_INSTALL])
+                  [_LT_ENABLE_FAST_INSTALL])
+  _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
+                  [_LT_WITH_AIX_SONAME([aix])])
   ])
 ])# _LT_SET_OPTIONS
 
@@ -112,7 +114,7 @@ AU_DEFUN([AC_LIBTOOL_DLOPEN],
 [_LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
+put the 'dlopen' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -148,7 +150,7 @@ AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
 _LT_SET_OPTION([LT_INIT], [win32-dll])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
+put the 'win32-dll' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -157,9 +159,9 @@ dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
 
 # _LT_ENABLE_SHARED([DEFAULT])
 # ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-shared flag, and supports the 'shared' and
+# 'disable-shared' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_SHARED],
 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([shared],
@@ -172,14 +174,14 @@ AC_ARG_ENABLE([shared],
     *)
       enable_shared=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$pkg" = "X$p"; then
          enable_shared=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
@@ -211,9 +213,9 @@ dnl AC_DEFUN([AM_DISABLE_SHARED], [])
 
 # _LT_ENABLE_STATIC([DEFAULT])
 # ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-static flag, and support the 'static' and
+# 'disable-static' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_STATIC],
 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([static],
@@ -226,14 +228,14 @@ AC_ARG_ENABLE([static],
     *)
      enable_static=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$pkg" = "X$p"; then
          enable_static=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
@@ -265,9 +267,9 @@ dnl AC_DEFUN([AM_DISABLE_STATIC], [])
 
 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
 # ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-fast-install flag, and support the 'fast-install'
+# and 'disable-fast-install' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_FAST_INSTALL],
 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([fast-install],
@@ -280,14 +282,14 @@ AC_ARG_ENABLE([fast-install],
     *)
       enable_fast_install=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$pkg" = "X$p"; then
          enable_fast_install=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
@@ -304,14 +306,14 @@ AU_DEFUN([AC_ENABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
+the 'fast-install' option into LT_INIT's first parameter.])
 ])
 
 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
+the 'disable-fast-install' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -319,11 +321,64 @@ dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 
 
+# _LT_WITH_AIX_SONAME([DEFAULT])
+# ----------------------------------
+# implement the --with-aix-soname flag, and support the `aix-soname=aix'
+# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
+# is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
+m4_define([_LT_WITH_AIX_SONAME],
+[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
+shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[[5-9]]*,yes)
+  AC_MSG_CHECKING([which variant of shared library versioning to provide])
+  AC_ARG_WITH([aix-soname],
+    [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
+      [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
+    [case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      AC_MSG_ERROR([Unknown argument to --with-aix-soname])
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname],
+    [AC_CACHE_VAL([lt_cv_with_aix_soname],
+      [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
+    with_aix_soname=$lt_cv_with_aix_soname])
+  AC_MSG_RESULT([$with_aix_soname])
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+_LT_DECL([], [shared_archive_member_spec], [0],
+    [Shared archive member basename, for filename based shared library versioning on AIX])dnl
+])# _LT_WITH_AIX_SONAME
+
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
+
+
 # _LT_WITH_PIC([MODE])
 # --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
 # LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+# MODE is either 'yes' or 'no'.  If omitted, it defaults to 'both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
     [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
@@ -334,19 +389,17 @@ m4_define([_LT_WITH_PIC],
     *)
       pic_mode=default
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for lt_pkg in $withval; do
-       IFS="$lt_save_ifs"
+       IFS=$lt_save_ifs
        if test "X$lt_pkg" = "X$lt_p"; then
          pic_mode=yes
        fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+    [pic_mode=m4_default([$1], [default])])
 
 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
 ])# _LT_WITH_PIC
@@ -359,7 +412,7 @@ AU_DEFUN([AC_LIBTOOL_PICMODE],
 [_LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
+put the 'pic-only' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
index 9000a05..48bc934 100644 (file)
@@ -1,6 +1,7 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
+# Foundation, Inc.
 # Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -33,7 +34,7 @@ m4_define([_lt_join],
 # ------------
 # Manipulate m4 lists.
 # These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
+# Autoconf-2.59, which quotes differently.
 m4_define([lt_car], [[$1]])
 m4_define([lt_cdr],
 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
@@ -44,7 +45,7 @@ m4_define([lt_unquote], $1)
 
 # lt_append(MACRO-NAME, STRING, [SEPARATOR])
 # ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
 # Note that neither SEPARATOR nor STRING are expanded; they are appended
 # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
 # No SEPARATOR is output if MACRO-NAME was previously undefined (different
index 07a8602..fa04b52 100644 (file)
@@ -1,6 +1,6 @@
 # ltversion.m4 -- version numbers                      -*- Autoconf -*-
 #
-#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -9,15 +9,15 @@
 
 # @configure_input@
 
-# serial 3337 ltversion.m4
+# serial 4179 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
+m4_define([LT_PACKAGE_VERSION], [2.4.6])
+m4_define([LT_PACKAGE_REVISION], [2.4.6])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
+[macro_version='2.4.6'
+macro_revision='2.4.6'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
index c573da9..c6b26f8 100644 (file)
@@ -1,6 +1,7 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
 # This file is free software; the Free Software Foundation gives
@@ -11,7 +12,7 @@
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
 # which have later been changed to m4_define as they aren't part of the
 # exported API, or moved to Autoconf or Automake where they belong.
 #
@@ -25,7 +26,7 @@
 # included after everything else.  This provides aclocal with the
 # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
 # because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
 #
 # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
 # Yes, that means every name once taken will need to remain here until
index 7967cc2..8f8a147 100644 (file)
--- a/m4/nls.m4
+++ b/m4/nls.m4
@@ -1,5 +1,6 @@
-# nls.m4 serial 3 (gettext-0.15)
-dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc.
+# nls.m4 serial 5 (gettext-0.18)
+dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation,
+dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -17,15 +18,15 @@ dnl Authors:
 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
 
-AC_PREREQ(2.50)
+AC_PREREQ([2.50])
 
 AC_DEFUN([AM_NLS],
 [
   AC_MSG_CHECKING([whether NLS is requested])
   dnl Default is enabled NLS
-  AC_ARG_ENABLE(nls,
+  AC_ARG_ENABLE([nls],
     [  --disable-nls           do not use Native Language Support],
     USE_NLS=$enableval, USE_NLS=yes)
-  AC_MSG_RESULT($USE_NLS)
-  AC_SUBST(USE_NLS)
+  AC_MSG_RESULT([$USE_NLS])
+  AC_SUBST([USE_NLS])
 ])
index 00133ef..1c70b6c 100644 (file)
--- a/m4/po.m4
+++ b/m4/po.m4
@@ -1,5 +1,5 @@
-# po.m4 serial 13 (gettext-0.15)
-dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
+# po.m4 serial 21 (gettext-0.18.3)
+dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -17,16 +17,21 @@ dnl Authors:
 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
 
-AC_PREREQ(2.50)
+AC_PREREQ([2.60])
 
 dnl Checks for all prerequisites of the po subdirectory.
 AC_DEFUN([AM_PO_SUBDIRS],
 [
   AC_REQUIRE([AC_PROG_MAKE_SET])dnl
   AC_REQUIRE([AC_PROG_INSTALL])dnl
-  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
+  AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+  AC_REQUIRE([AC_PROG_SED])dnl
   AC_REQUIRE([AM_NLS])dnl
 
+  dnl Release version of the gettext macros. This is used to ensure that
+  dnl the gettext macros and po/Makefile.in.in are in sync.
+  AC_SUBST([GETTEXT_MACRO_VERSION], [0.18])
+
   dnl Perform the following tests also if --disable-nls has been given,
   dnl because they are needed for "make dist" to work.
 
@@ -37,7 +42,7 @@ AC_DEFUN([AM_PO_SUBDIRS],
     [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
      (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
     :)
-  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+  AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
 
   dnl Test whether it is GNU msgfmt >= 0.15.
 changequote(,)dnl
@@ -84,6 +89,10 @@ changequote([,])dnl
   test -n "$localedir" || localedir='${datadir}/locale'
   AC_SUBST([localedir])
 
+  dnl Support for AM_XGETTEXT_OPTION.
+  test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
+  AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
+
   AC_CONFIG_COMMANDS([po-directories], [[
     for ac_file in $CONFIG_FILES; do
       # Support "outfile[:infile[:infile...]]"
@@ -94,7 +103,7 @@ changequote([,])dnl
       case "$ac_file" in */Makefile.in)
         # Adjust a relative srcdir.
         ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
-        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+        ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
         ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
         # In autoconf-2.13 it is called $ac_given_srcdir.
         # In autoconf-2.50 it is called $srcdir.
@@ -110,7 +119,8 @@ changequote([,])dnl
         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
           rm -f "$ac_dir/POTFILES"
           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
-          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          gt_tab=`printf '\t'`
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
           POMAKEFILEDEPS="POTFILES.in"
           # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
           # on $ac_dir but don't depend on user-specified configuration
@@ -121,12 +131,12 @@ changequote([,])dnl
               test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
             fi
             ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
-            # Hide the ALL_LINGUAS assigment from automake < 1.5.
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
             eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
             POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
           else
             # The set of available languages was given in configure.in.
-            # Hide the ALL_LINGUAS assigment from automake < 1.5.
+            # Hide the ALL_LINGUAS assignment from automake < 1.5.
             eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
           fi
           # Compute POFILES
@@ -218,7 +228,7 @@ AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
 changequote(,)dnl
   # Adjust a relative srcdir.
   ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
-  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+  ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
   ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
   # In autoconf-2.13 it is called $ac_given_srcdir.
   # In autoconf-2.50 it is called $srcdir.
@@ -246,6 +256,7 @@ EOT
   fi
 
   # A sed script that extracts the value of VARIABLE from a Makefile.
+  tab=`printf '\t'`
   sed_x_variable='
 # Test if the hold space is empty.
 x
@@ -253,9 +264,9 @@ s/P/P/
 x
 ta
 # Yes it was empty. Look if we have the expected variable definition.
-/^[     ]*VARIABLE[     ]*=/{
+/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
   # Seen the first line of the variable definition.
-  s/^[  ]*VARIABLE[     ]*=//
+  s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
   ba
 }
 bd
@@ -307,7 +318,7 @@ changequote([,])dnl
     sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
     ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
   fi
-  # Hide the ALL_LINGUAS assigment from automake < 1.5.
+  # Hide the ALL_LINGUAS assignment from automake < 1.5.
   eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
   # Compute POFILES
   # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
@@ -397,14 +408,15 @@ changequote([,])dnl
   fi
 
   sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
+  tab=`printf '\t'`
   if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
     # Add dependencies that cannot be formulated as a simple suffix rule.
     for lang in $ALL_LINGUAS; do
       frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
       cat >> "$ac_file.tmp" <<EOF
 $frobbedlang.msg: $lang.po
-       @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
-       \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
+${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
 EOF
     done
   fi
@@ -414,8 +426,8 @@ EOF
       frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
       cat >> "$ac_file.tmp" <<EOF
 $frobbedlang/\$(DOMAIN).resources.dll: $lang.po
-       @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
-       \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
+${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
 EOF
     done
   fi
@@ -426,3 +438,16 @@ EOF
   fi
   mv "$ac_file.tmp" "$ac_file"
 ])
+
+dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
+AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
+[
+  XGETTEXT_EXTRA_OPTIONS=
+])
+
+dnl Registers an option to be passed to xgettext in the po subdirectory.
+AC_DEFUN([AM_XGETTEXT_OPTION],
+[
+  AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
+  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
+])
index a56365c..7b39123 100644 (file)
@@ -1,5 +1,5 @@
-# progtest.m4 serial 4 (gettext-0.14.2)
-dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc.
+# progtest.m4 serial 7 (gettext-0.18.2)
+dnl Copyright (C) 1996-2003, 2005, 2008-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -16,7 +16,7 @@ dnl They are *not* in the public domain.
 dnl Authors:
 dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
 
-AC_PREREQ(2.50)
+AC_PREREQ([2.50])
 
 # Search path for a program which passes the given test.
 
@@ -27,15 +27,14 @@ AC_DEFUN([AM_PATH_PROG_WITH_TEST],
 # Prepare PATH_SEPARATOR.
 # The user is always right.
 if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
 fi
 
 # Find out how to test for executable files. Don't use a zero-byte file,
@@ -55,7 +54,7 @@ rm -f conf$$.file
 # Extract the first word of "$2", so it can be a program name with args.
 set dummy $2; ac_word=[$]2
 AC_MSG_CHECKING([for $ac_word])
-AC_CACHE_VAL(ac_cv_path_$1,
+AC_CACHE_VAL([ac_cv_path_$1],
 [case "[$]$1" in
   [[\\/]]* | ?:[[\\/]]*)
     ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
@@ -84,9 +83,9 @@ ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
 esac])dnl
 $1="$ac_cv_path_$1"
 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
-  AC_MSG_RESULT([$]$1)
+  AC_MSG_RESULT([$][$1])
 else
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([no])
 fi
-AC_SUBST($1)dnl
+AC_SUBST([$1])dnl
 ])
diff --git a/man/Makefile.am b/man/Makefile.am
deleted file mode 100644 (file)
index a364ff3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-man8_MANS = cryptsetup.8
-
-if VERITYSETUP
-man8_MANS += veritysetup.8
-endif
-
-if REENCRYPT
-man8_MANS += cryptsetup-reencrypt.8
-endif
-
-EXTRA_DIST = cryptsetup.8 veritysetup.8 cryptsetup-reencrypt.8
diff --git a/man/Makefile.in b/man/Makefile.in
deleted file mode 100644 (file)
index b2e9bf3..0000000
+++ /dev/null
@@ -1,559 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-@VERITYSETUP_TRUE@am__append_1 = veritysetup.8
-@REENCRYPT_TRUE@am__append_2 = cryptsetup-reencrypt.8
-subdir = man
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-SOURCES =
-DIST_SOURCES =
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-man8dir = $(mandir)/man8
-am__installdirs = "$(DESTDIR)$(man8dir)"
-NROFF = nroff
-MANS = $(man8_MANS)
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-man8_MANS = cryptsetup.8 $(am__append_1) $(am__append_2)
-EXTRA_DIST = cryptsetup.8 veritysetup.8 cryptsetup-reencrypt.8
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu man/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-install-man8: $(man8_MANS)
-       @$(NORMAL_INSTALL)
-       @list1='$(man8_MANS)'; \
-       list2=''; \
-       test -n "$(man8dir)" \
-         && test -n "`echo $$list1$$list2`" \
-         || exit 0; \
-       echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \
-       $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \
-       { for i in $$list1; do echo "$$i"; done;  \
-       if test -n "$$list2"; then \
-         for i in $$list2; do echo "$$i"; done \
-           | sed -n '/\.8[a-z]*$$/p'; \
-       fi; \
-       } | while read p; do \
-         if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
-         echo "$$d$$p"; echo "$$p"; \
-       done | \
-       sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
-       sed 'N;N;s,\n, ,g' | { \
-       list=; while read file base inst; do \
-         if test "$$base" = "$$inst"; then list="$$list $$file"; else \
-           echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
-           $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
-         fi; \
-       done; \
-       for i in $$list; do echo "$$i"; done | $(am__base_list) | \
-       while read files; do \
-         test -z "$$files" || { \
-           echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
-           $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
-       done; }
-
-uninstall-man8:
-       @$(NORMAL_UNINSTALL)
-       @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
-       files=`{ for i in $$list; do echo "$$i"; done; \
-       } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-             -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-       dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
-tags TAGS:
-
-ctags CTAGS:
-
-cscope cscopelist:
-
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(MANS)
-installdirs:
-       for dir in "$(DESTDIR)$(man8dir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-       -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-man
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man: install-man8
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-man
-
-uninstall-man: uninstall-man8
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
-       cscopelist-am ctags-am distclean distclean-generic \
-       distclean-libtool distdir dvi dvi-am html html-am info info-am \
-       install install-am install-data install-data-am install-dvi \
-       install-dvi-am install-exec install-exec-am install-html \
-       install-html-am install-info install-info-am install-man \
-       install-man8 install-pdf install-pdf-am install-ps \
-       install-ps-am install-strip installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-       ps ps-am tags-am uninstall uninstall-am uninstall-man \
-       uninstall-man8
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/man/Makemodule.am b/man/Makemodule.am
new file mode 100644 (file)
index 0000000..3f68441
--- /dev/null
@@ -0,0 +1,15 @@
+EXTRA_DIST += man/cryptsetup.8 man/integritysetup.8 man/veritysetup.8 man/cryptsetup-reencrypt.8
+
+man8_MANS += man/cryptsetup.8
+
+if VERITYSETUP
+man8_MANS += man/veritysetup.8
+endif
+
+if REENCRYPT
+man8_MANS += man/cryptsetup-reencrypt.8
+endif
+
+if INTEGRITYSETUP
+man8_MANS += man/integritysetup.8
+endif
index bfb7e23..3dbb6e1 100644 (file)
@@ -1,4 +1,4 @@
-.TH CRYPTSETUP-REENCRYPT "8" "January 2015" "cryptsetup-reencrypt" "Maintenance Commands"
+.TH CRYPTSETUP-REENCRYPT "8" "January 2019" "cryptsetup-reencrypt" "Maintenance Commands"
 .SH NAME
 cryptsetup-reencrypt - tool for offline LUKS device re-encryption
 .SH SYNOPSIS
@@ -14,18 +14,20 @@ unclocked by passphrase), \fBcipher\fR, \fBcipher mode\fR.
 Cryptsetup-reencrypt reencrypts data on LUKS device in-place. During
 reencryption process the LUKS device is marked unavailable.
 
+\fINOTE\fR: If you're looking for LUKS2 online reencryption manual please read cryptsetup(8)
+man page instead (see reencrypt action). This page is for legacy offline reencryption
+utility only.
+
 \fIWARNING\fR: The cryptsetup-reencrypt program is not resistant to hardware
-or kernel failures during reencryption (you can lose you data in this case).
+or kernel failures during reencryption (you can lose your data in this case).
 
 \fIALWAYS BE SURE YOU HAVE RELIABLE BACKUP BEFORE USING THIS TOOL.\fR
 .br
-\fITHIS TOOL IS EXPERIMENTAL.\fR
-
 The reencryption can be temporarily suspended (by TERM signal or by
 using ctrl+c) but you need to retain temporary files named LUKS-<uuid>.[log|org|new].
 LUKS device is unavailable until reencryption is finished though.
 
-Current working directory must by writable and temporary
+Current working directory must be writable and temporary
 files created during reencryption must be present.
 
 For more info about LUKS see cryptsetup(8).
@@ -36,68 +38,109 @@ To start (or continue) re-encryption for <device> use:
 .PP
 \fIcryptsetup-reencrypt\fR <device>
 
-\fB<options>\fR can be [\-\-batch-mode, \-\-block-size, \-\-cipher, \-\-debug,
-\-\-device-size, \-\-hash, \-\-iter-time, \-\-use-random | \-\-use-urandom,
-\-\-keep-key, \-\-key-size, \-\-key-file, \-\-key-slot, \-\-keyfile-offset,
-\-\-keyfile-size, \-\-tries, \-\-use-directio, \-\-use-fsync, \-\-verbose, \-\-write-log]
+\fB<options>\fR can be [\-\-batch-mode, \-\-block-size, \-\-cipher | \-\-keep-key,
+\-\-debug, \-\-device-size, \-\-hash, \-\-header, \-\-iter-time | \-\-pbkdf\-force\-iterations,
+\-\-key-file, \-\-key-size, \-\-key-slot, \-\-keyfile-offset, \-\-keyfile-size,
+\-\-master\-key\-file, \-\-tries, \-\-pbkdf, \-\-pbkdf\-memory, \-\-pbkdf\-parallel,
+\-\-progress-frequency, \-\-use-directio, \-\-use-random | \-\-use-urandom, \-\-use-fsync,
+\-\-uuid, \-\-verbose, \-\-write-log]
 
-To encrypt data on (not yet encrypted) device, use \fI\-\-new\fR with combination
-with \fI\-\-reduce-device-size\fR.
+To encrypt data on (not yet encrypted) device, use \fI\-\-new\fR in combination
+with \fI\-\-reduce-device-size\fR or with \fI\-\-header\fR option for detached header.
 
 To remove encryption from device, use \fI\-\-decrypt\fR.
 
 For detailed description of encryption and key file options see \fIcryptsetup(8)\fR
 man page.
 .TP
-.B "\-\-verbose, \-v"
-Print more information on command execution.
+.B "\-\-batch-mode, \-q"
+Suppresses all warnings and reencryption progress output.
+.TP
+.B "\-\-block-size, \-B \fIvalue\fR"
+Use re-encryption block size of <value> in MiB.
+
+Values can be between 1 and 64 MiB.
+.TP
+.B "\-\-cipher, \-c" \fI<cipher-spec>\fR
+Set the cipher specification string.
 .TP
 .B "\-\-debug"
 Run in debug mode with full diagnostic logs. Debug output
 lines are always prefixed by '#'.
 .TP
-.B "\-\-cipher, \-c" \fI<cipher-spec>\fR
-Set the cipher specification string.
+.B "\-\-decrypt"
+Remove encryption (decrypt already encrypted device and remove LUKS header).
+
+\fBWARNING:\fR This is destructive operation and cannot be reverted.
 .TP
-.B "\-\-key-size, \-s \fI<bits>\fR"
-Set key size in bits. The argument has to be a multiple of  8.
+.B "\-\-device-size \fIsize[units]\fR"
+Instead of real device size, use specified value.
 
-The possible key-sizes are limited by the cipher and mode used.
+It means that only specified area (from the start of the device
+to the specified size) will be reencrypted.
 
-If you are increasing key size, there must be enough space in the LUKS header
-for enlarged keyslots (data offset must be large enough) or reencryption
-cannot be performed.
+If no unit suffix is specified, the size is in bytes.
 
-If there is not enough space for keyslots with new key size,
-you can destructively shrink device with \-\-reduce-device-size option.
+Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB,MiB,GiB,TiB)
+for units with 1024 base or KB/MB/GB/TB for 1000 base (SI scale).
+
+\fBWARNING:\fR This is destructive operation.
 .TP
 .B "\-\-hash, \-h \fI<hash-spec>\fR"
-Specifies the hash used in the LUKS key setup scheme and volume key digest.
+Specifies the hash used in the LUKS1 key setup scheme and volume key digest.
 
 \fBNOTE:\fR if this parameter is not specified, default hash algorithm is always used
-for new device header.
+for new LUKS1 device header.
+
+\fBNOTE:\fR with LUKS2 format this option is only relevant when new keyslot pbkdf algorithm
+is set to PBKDF2 (see \fI\-\-pbkdf\fR).
+.TP
+.B "\-\-header\fR \fI<LUKS header file>\fR"
+Use a detached (separated) metadata device or file where the
+LUKS header is stored. This option allows one to store ciphertext
+and LUKS header on different devices.
+
+\fBWARNING:\fR There is no check whether the ciphertext device specified
+actually belongs to the header given.
+If used with \fI\-\-new\fR option, the header file will created (or overwritten).
+Use with care.
 .TP
 .B "\-\-iter-time, \-i \fI<milliseconds>\fR"
 The number of milliseconds to spend with PBKDF2 passphrase processing for the
 new LUKS header.
 .TP
-.B "\-\-use-random"
-.TP
-.B "\-\-use-urandom"
-Define which kernel random number generator will be used to create the volume key.
+.B "\-\-keep-key"
+Do not change encryption key, just reencrypt the LUKS header and keyslots.
+
+This option can be combined only with \fI\-\-hash\fR, \fI\-\-iter-time\fR,
+\fI\-\-pbkdf\-force\-iterations\fR, \fI\-\-pbkdf\fR (LUKS2 only),
+\fI\-\-pbkdf\-memory\fR (Argon2i/id and LUKS2 only) and \fI\-\-pbkdf\-parallel\fR
+(Argon2i/id and LUKS2 only) options.
 .TP
 .B "\-\-key-file, \-d \fIname\fR"
 Read the passphrase from file.
 
-\fBWARNING:\fR \-\-key-file option can be used only if there only one active keyslot,
+\fBWARNING:\fR \-\-key-file option can be used only if there is only one active keyslot,
 or alternatively, also if \-\-key-slot option is specified (then all other keyslots
 will be disabled in new LUKS device).
 
 If this option is not used, cryptsetup-reencrypt will ask for all active keyslot
 passphrases.
 .TP
-.B "\-\-key-slot, \-S <0-7>"
-Specify which key slot is used.
+.B "\-\-key-size, \-s \fI<bits>\fR"
+Set key size in bits. The argument has to be a multiple of  8.
+
+The possible key-sizes are limited by the cipher and mode used.
+
+If you are increasing key size, there must be enough space in the LUKS header
+for enlarged keyslots (data offset must be large enough) or reencryption
+cannot be performed.
+
+If there is not enough space for keyslots with new key size,
+you can destructively shrink device with \-\-reduce-device-size option.
+.TP
+.B "\-\-key-slot, \-S <0-MAX>"
+Specify which key slot is used. For LUKS1, max keyslot number is 7. For LUKS2, it's 31.
 
 \fBWARNING:\fR All other keyslots will be disabled if this option is used.
 .TP
@@ -109,34 +152,39 @@ Read a maximum of \fIvalue\fR bytes from the key file.
 Default is to read the whole file up to the compiled-in
 maximum.
 .TP
-.B "\-\-keep-key"
-Do not change encryption key, just reencrypt the LUKS header and keyslots.
-
-This option can be combined only with \fI\-\-hash\fR or \fI\-\-iter-time\fR
-options.
-.TP
-.B "\-\-tries, \-T"
-Number of retries for invalid passphrase entry.
+.B "\-\-master\-key\-file"
+Use new volume (master) key stored in a file.
 .TP
-.B "\-\-block-size, \-B \fIvalue\fR"
-Use re-encryption block size of <value> in MiB.
-
-Values can be between 1 and 64 MiB.
-.TP
-.B "\-\-device-size \fIsize[units]\fR"
-Instead of real device size, use specified value.
-
-It means that only specified area (from the start of the device
-to the specified size) will be reencrypted.
-
-\fBWARNING:\fR This is destructive operation.
+.B "\-\-new, \-N"
+Create new header (encrypt not yet encrypted device).
 
-If no unit suffix is specified, the size is in bytes.
+This option must be used together with \-\-reduce-device-size.
 
-Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB,MiB,GiB,TiB)
-for units with 1024 base or KB/MB/GB/TB for 1000 base (SI scale).
+\fBWARNING:\fR This is destructive operation and cannot be reverted.
+.TP
+.B "\-\-pbkdf"
+Set Password-Based Key Derivation Function (PBKDF) algorithm for LUKS keyslot.
+The PBKDF can be: \fIpbkdf2\fR, \fIargon2i\fR for Argon2i or \fIargon2id\fR for Argon2id.
 
-\fBWARNING:\fR This is destructive operation.
+For LUKS1, only \fIpbkdf2\fR is accepted (no need to use this option).
+.TP
+.B "\-\-pbkdf\-force\-iterations <num>"
+Avoid PBKDF benchmark and set time cost (iterations) directly.
+.TP
+.B "\-\-pbkdf\-memory <number>"
+Set the memory cost for PBKDF (for Argon2i/id the number represents kilobytes).
+Note that it is maximal value, PBKDF benchmark or available physical memory
+can decrease it.
+This option is not available for PBKDF2.
+.TP
+.B "\-\-pbkdf\-parallel <number>"
+Set the parallel cost for PBKDF (number of threads, up to 4).
+Note that it is maximal value, it is decreased automatically if
+CPU online count is lower.
+This option is not available for PBKDF2.
+.TP
+.B "\-\-progress-frequency <seconds>"
+Print separate line every <seconds> with reencryption progress.
 .TP
 .B "\-\-reduce-device-size \fIsize[units]\fR"
 Enlarge data offset to specified value by shrinking device size.
@@ -150,22 +198,20 @@ partition (so last sectors contains no data).
 
 For units suffix see \-\-device-size parameter description.
 
-\fBWARNING:\fR This is destructive operation and cannot be reverted.
-Use with extreme care - shrinked filesystems are usually unrecoverable.
-
 You cannot shrink device more than by 64 MiB (131072 sectors).
-.TP
-.B "\-\-new, N"
-Create new header (encrypt not yet encrypted device).
-
-This option must be used together with \-\-reduce-device-size.
 
 \fBWARNING:\fR This is destructive operation and cannot be reverted.
+Use with extreme care - shrunk filesystems are usually unrecoverable.
 .TP
-.B "\-\-decrypt"
-Remove encryption (decrypt already encrypted device and remove LUKS header).
+.B "\-\-tries, \-T"
+Number of retries for invalid passphrase entry.
+.TP
+.B "\-\-type <type>"
+Use only while encrypting not yet encrypted device (see \-\-new).
 
-\fBWARNING:\fR This is destructive operation and cannot be reverted.
+Specify LUKS version when performing in-place encryption. If the parameter
+is omitted default value (LUKS1) is used. Type may be one of: \fBluks\fR (default),
+\fBluks1\fR or \fBluks2\fR.
 .TP
 .B "\-\-use-directio"
 Use direct-io (O_DIRECT) for all read/write data operations related
@@ -178,15 +224,27 @@ operations (e.g. in virtual environments).
 Use fsync call after every written block. This applies for reencryption
 log files as well.
 .TP
-.B "\-\-write-log"
-Update log file after every block write. This can slow down reencryption
-but will minimize data loss in the case of system crash.
+.B "\-\-use-random"
 .TP
-.B "\-\-batch-mode, \-q"
-Suppresses all warnings and reencryption progress output.
+.B "\-\-use-urandom"
+Define which kernel random number generator will be used to create the volume key.
+.TP
+.B "\-\-uuid" \fI<uuid>\fR
+Use only while resuming an interrupted decryption process (see \-\-decrypt).
+
+To find out what \fI<uuid>\fR to pass look for temporary files LUKS-<uuid>.[|log|org|new]
+of the interrupted decryption process.
+.TP
+.B "\-\-verbose, \-v"
+Print more information on command execution.
 .TP
 .B "\-\-version"
 Show the program version.
+.TP
+.B "\-\-write-log"
+Update log file after every block write. This can slow down reencryption
+but will minimize data loss in the case of system crash.
+
 .SH RETURN CODES
 Cryptsetup-reencrypt returns 0 on success and a non-zero value on error.
 
@@ -227,9 +285,9 @@ Please attach the output of the failed command with the
 .SH AUTHORS
 Cryptsetup-reencrypt was written by Milan Broz <gmazyland@gmail.com>.
 .SH COPYRIGHT
-Copyright \(co 2012-2015 Milan Broz
+Copyright \(co 2012-2020 Milan Broz
 .br
-Copyright \(co 2012-2013 Red Hat, Inc.
+Copyright \(co 2012-2020 Red Hat, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index 16ecec0..bc3fff6 100644 (file)
@@ -1,4 +1,4 @@
-.TH CRYPTSETUP "8" "December 2013" "cryptsetup" "Maintenance Commands"
+.TH CRYPTSETUP "8" "January 2019" "cryptsetup" "Maintenance Commands"
 .SH NAME
 cryptsetup - manage plain dm-crypt and LUKS encrypted volumes
 .SH SYNOPSIS
@@ -12,7 +12,7 @@ and can hence offer more features than plain dm-crypt. On the other
 hand, the header is visible and vulnerable to damage.
 
 In addition, cryptsetup provides limited support for the use of
-historic loopaes volumes and for TrueCrypt compatible volumes.
+loop-AES volumes, TrueCrypt, VeraCrypt and BitLocker compatible volumes.
 
 .SH PLAIN DM-CRYPT OR LUKS?
 .PP
@@ -29,12 +29,12 @@ to be mentioned here.
 
 \fBBackup:\fR Storage media die. Encryption has no influence on that.
 Backup is mandatory for encrypted data as well, if the data has any
-worth. See the Cryptsetup FAQ for advice on how to do backup of an
+worth. See the Cryptsetup FAQ for advice on how to do backup of an
 encrypted volume.
 
 \fBCharacter encoding:\fR If you enter a
 passphrase with special symbols, the passphrase can change
-depending character encoding. Keyboard settings can also change,
+depending on character encoding. Keyboard settings can also change,
 which can make blind input hard or impossible. For
 example, switching from some ASCII 8-bit variant to UTF-8
 can lead to a different binary encoding and hence different
@@ -57,10 +57,10 @@ secure wiping by just overwriting header and key-slot area.
 it is a very good idea to wipe filesystem signatures, data, etc. before
 creating a LUKS or plain dm-crypt container on it.
 For a quick removal of filesystem signatures, use "wipefs". Take care
-though that this may not remove everything. In particular md (RAID)
+though that this may not remove everything. In particular, MD RAID
 signatures at the end of a device may survive. It also does not
 remove data. For a full wipe, overwrite the whole partition before
-container creation. If you do not know how to to that, the
+container creation. If you do not know how to do that, the
 cryptsetup FAQ describes several options.
 
 .SH BASIC COMMANDS
@@ -70,8 +70,8 @@ The following are valid actions for all supported device types.
 .IP
 Opens (creates a mapping with) <name> backed by device <device>.
 
-Device type can be \fIplain\fR, \fIluks\fR (default), \fIloopaes\fR
-or \fItcrypt\fR.
+Device type can be \fIplain\fR, \fIluks\fR (default), \fIluks1\fR, \fIluks2\fR,
+\fIloopaes\fR or \fItcrypt\fR.
 
 For backward compatibility there are \fBopen\fR command aliases:
 
@@ -84,6 +84,8 @@ For backward compatibility there are \fBopen\fR command aliases:
 \fBloopaesOpen\fR: open \-\-type loopaes
 .br
 \fBtcryptOpen\fR: open \-\-type tcrypt
+.br
+\fBbitlkOpen\fR: open \-\-type bitlk
 
 \fB<options>\fR are type specific and are described below
 for individual device types. For \fBcreate\fR, the order of the <name>
@@ -98,6 +100,9 @@ For backward compatibility there are \fBclose\fR command aliases:
 \fBremove\fR, \fBplainClose\fR, \fBluksClose\fR, \fBloopaesClose\fR,
 \fBtcryptClose\fR (all behaves exactly the same, device type is
 determined automatically from active device).
+
+\fB<options>\fR can be [\-\-deferred]
+
 .PP
 \fIstatus\fR <name>
 .IP
@@ -107,10 +112,95 @@ Reports the status for the mapping <name>.
 .IP
 Resizes an active mapping <name>.
 
-If \-\-size (in sectors) is not specified, the size of the
-underlying block device is used. Note that this does not
-change the raw device geometry, it just changes how many
-sectors of the raw device are represented in the mapped device.
+If \-\-size (in 512-bytes sectors) or \-\-device\-size are not specified,
+the size is computed from the underlying device. For LUKS it is the size
+of the underlying device without the area reserved for LUKS header
+(see data payload offset in \fBluksDump\fR command).
+For plain crypt device, the whole device size is used.
+
+Note that this does not change the raw device geometry, it just
+changes how many sectors of the raw device are represented
+in the mapped device.
+
+If cryptsetup detected volume key for active device loaded in kernel keyring
+service, resize action would first try to retrieve
+the key using a token and only if it failed it'd ask for a passphrase
+to unlock a keyslot (LUKS) or to derive a volume key again (plain mode).
+The kernel keyring is used by default for LUKS2 devices.
+
+With LUKS2 device additional \fB<options>\fR can be [\-\-token\-id, \-\-token\-only,
+\-\-key\-slot, \-\-key\-file, \-\-keyfile\-size, \-\-keyfile\-offset, \-\-timeout,
+\-\-disable\-locks, \-\-disable\-keyring].
+
+.PP
+\fIrefresh\fR <name>
+.IP
+Refreshes parameters of active mapping <name>.
+
+Updates parameters of active device <name> without need to deactivate the device
+(and umount filesystem). Currently it supports parameters refresh on following
+devices: LUKS1, LUKS2 (including authenticated encryption), plain crypt
+and loopaes.
+
+Mandatory parametrs are identical to those of an open action for respective
+device type.
+
+You may change following parameters on all devices \-\-perf\-same_cpu_crypt,
+\-\-perf\-submit_from_crypt_cpus and \-\-allow\-discards.
+
+Refreshing device without any optional parameter will refresh the device
+with default setting (respective to device type).
+
+\fBLUKS2 only:\fR
+
+\-\-integrity\-no\-journal parameter affects only LUKS2 devices with
+underlying dm-integrity device.
+
+Adding option \-\-persistent stores any combination of device parameters
+above in LUKS2 metadata (only after successful refresh operation).
+
+\-\-disable\-keyring parameter refreshes a device with volume key passed
+in dm-crypt driver.
+
+.PP
+\fIreencrypt\fR <device> or --active-name <name> [<new_name>]
+.IP
+Run resilient reencryption (LUKS2 device only).
+
+There are 3 basic modes of operation:
+
+\(bu device reencryption (\fIreencrypt\fR)
+
+\(bu device encryption (\fIreencrypt\fR \-\-encrypt)
+
+\(bu device decryption (\fIreencrypt\fR \-\-decrypt)
+
+<device> or --active-name <name> is mandatory parameter.
+
+With <device> parameter cryptsetup looks up active <device> dm mapping.
+If no active mapping is detected, it starts offline reencryption otherwise online
+reencryption takes place.
+
+Reencryption process may be safely interrupted by a user via SIGTERM signal (ctrl+c).
+
+To resume already initialized or interrupted reencryption, just run the cryptsetup
+\fIreencrypt\fR command again to continue the reencryption operation.
+Reencryption may be resumed with different \-\-resilience or \-\-hotzone\-size unless
+implicit datashift resilience mode is used (reencrypt \-\-encrypt with \-\-reduce-device-size
+option).
+
+If the reencryption process was interrupted abruptly (reencryption process crash, system crash, poweroff)
+it may require recovery. The recovery is currently run automatically on next activation (action \fIopen\fR)
+when needed.
+
+Optional parameter <new_name> takes effect only with \-\-encrypt option and it activates device <new_name>
+immediately after encryption initialization gets finished. That's useful when device needs to be ready
+as soon as possible and mounted (used) before full data area encryption is completed.
+
+Action supports following additional \fB<options>\fR [\-\-encrypt, \-\-decrypt, \-\-device\-size,
+\-\-resilience, \-\-resilience-hash, \-\-hotzone-size, \-\-init\-only, \-\-resume\-only,
+\-\-reduce\-device\-size].
+
 .SH PLAIN MODE
 Plain dm-crypt encrypts the device sector-by-sector with a
 single, non-salted hash of the passphrase. No checks
@@ -128,8 +218,9 @@ The following are valid plain device type actions:
 Opens (creates a mapping with) <name> backed by device <device>.
 
 \fB<options>\fR can be [\-\-hash, \-\-cipher, \-\-verify-passphrase,
-\-\-key-file, \-\-keyfile-offset, \-\-key-size, \-\-offset, \-\-skip, \-\-size,
-\-\-readonly, \-\-shared, \-\-allow-discards]
+\-\-sector\-size, \-\-key-file, \-\-keyfile-offset, \-\-key-size,
+\-\-offset, \-\-skip, \-\-size, \-\-readonly, \-\-shared, \-\-allow\-discards,
+\-\-refresh]
 
 Example: 'cryptsetup open \-\-type plain /dev/sda10 e1' maps the raw
 encrypted device /dev/sda10 to the mapped (decrypted) device
@@ -141,7 +232,7 @@ It adds a standardized header at the start of the device,
 a key-slot area directly behind the header and the bulk
 data area behind that. The whole set is called a 'LUKS container'.
 The device that a LUKS container resides on is called a 'LUKS device'.
-For most purposes both terms can be used interchangeably. But
+For most purposes, both terms can be used interchangeably. But
 note that when the LUKS header is at a nonzero offset
 in a device, then the device is not a LUKS device anymore, but
 has a LUKS container stored in it at an offset.
@@ -153,6 +244,12 @@ are protected against brute-force and dictionary
 attacks by PBKDF2, which implements hash iteration and salting
 in one function.
 
+LUKS2 is a new version of header format that allows additional
+extensions like different PBKDF algorithm or authenticated encryption.
+You can format device with LUKS2 header if you specify
+\fI\-\-type luks2\fR in \fIluksFormat\fR command.
+For activation, the format is already recognized automatically.
+
 Each passphrase, also called a
 .B key
 in this document, is associated with one of 8 key-slots.
@@ -160,13 +257,13 @@ Key operations that do not specify a slot affect the first slot
 that matches the supplied passphrase or the first empty slot if
 a new passphrase is added.
 
-The \fB<device>\fR parameter can be also specified by a LUKS UUID in the
+The \fB<device>\fR parameter can also be specified by a LUKS UUID in the
 format UUID=<uuid>. Translation to real device name uses symlinks
 in /dev/disk/by-uuid directory.
 
 To specify a detached header, the \fB\-\-header\fR parameter can be used
-in all LUKS commands and always takes precedence over positional \fB<device>\fR
-parameter.
+in all LUKS commands and always takes precedence over the positional
+\fB<device>\fR parameter.
 
 The following are valid LUKS actions:
 
@@ -178,21 +275,32 @@ either via prompting or via <key file>. Note that
 if the second argument is present, then the passphrase
 is taken from the file given there, without the need
 to use the \-\-key-file option. Also note that for both forms
-of reading the passphrase from file you can
+of reading the passphrase from file you can
 give '-' as file name, which results in the passphrase being read
 from stdin and the safety-question being skipped.
 
 You can only call luksFormat on a LUKS device that is not mapped.
 
+To use LUKS2, specify \fI\-\-type luks2\fR.
+
 \fB<options>\fR can be [\-\-hash, \-\-cipher, \-\-verify\-passphrase,
 \-\-key\-size, \-\-key\-slot,
 \-\-key\-file (takes precedence over optional second argument),
 \-\-keyfile\-offset, \-\-keyfile\-size, \-\-use\-random | \-\-use\-urandom,
 \-\-uuid, \-\-master\-key\-file, \-\-iter\-time, \-\-header,
-\-\-force\-password].
+\-\-pbkdf\-force\-iterations,
+\-\-force\-password, \-\-disable-locks].
+
+For LUKS2, additional \fB<options>\fR can be
+[\-\-integrity, \-\-integrity\-no\-wipe, \-\-sector\-size,
+\-\-label, \-\-subsystem,
+\-\-pbkdf, \-\-pbkdf\-memory, \-\-pbkdf\-parallel,
+\-\-disable\-locks, \-\-disable\-keyring,
+\-\-luks2\-metadata\-size, \-\-luks2\-keyslots\-size,
+\-\-keyslot\-cipher, \-\-keyslot\-key\-size].
 
 \fBWARNING:\fR Doing a luksFormat on an existing LUKS container will
-make all data the old container permanently irretrievable, unless
+make all data the old container permanently irretrievable unless
 you have a header backup.
 .PP
 \fIopen\fR \-\-type luks <device> <name>
@@ -201,16 +309,20 @@ you have a header backup.
 .IP
 Opens the LUKS device <device> and sets up a mapping <name> after
 successful verification of the supplied passphrase.
-If the passphrase is not supplied via \-\-key-file, the command
-prompts for it interactively.
+
+First, the passphrase is searched in LUKS tokens. If it's not
+found in any token and also the passphrase is not supplied via \-\-key-file,
+the command prompts for it interactively.
 
 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
 \-\-keyfile\-size, \-\-readonly, \-\-test\-passphrase,
-\-\-allow\-discards, \-\-header, \-\-key-slot, \-\-master\-key\-file].
+\-\-allow\-discards, \-\-header, \-\-key-slot, \-\-master\-key\-file, \-\-token\-id,
+\-\-token\-only, \-\-disable\-keyring, \-\-disable\-locks, \-\-type, \-\-refresh,
+\-\-serialize\-memory\-hard\-pbkdf].
 .PP
 \fIluksSuspend\fR <name>
 .IP
-Suspends an active device (all IO operations will blocked
+Suspends an active device (all IO operations will block
 and accesses to the device will wait indefinitely)
 and wipes the encryption
 key from kernel memory. Needs kernel 2.6.19 or later.
@@ -221,39 +333,48 @@ the mapped device.
 
 \fBWARNING:\fR never suspend the device on which the cryptsetup binary resides.
 
-\fB<options>\fR can be [\-\-header].
+\fB<options>\fR can be [\-\-header, \-\-disable\-locks].
 .PP
 \fIluksResume\fR <name>
 .IP
 Resumes a suspended device and reinstates the encryption key.
 Prompts interactively for a passphrase if \-\-key-file is not given.
 
-\fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-size, \-\-header]
+\fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-size, \-\-header,
+\-\-disable\-keyring, \-\-disable\-locks, \-\-type]
 .PP
 \fIluksAddKey\fR <device> [<key file with new key>]
 .IP
-adds a new passphrase. An existing passphrase must be supplied
+Adds a new passphrase. An existing passphrase must be supplied
 interactively or via \-\-key-file.
 The new passphrase to be added can be specified interactively
 or read from the file given as positional argument.
 
+\fBNOTE:\fR with \-\-unbound option the action creates new unbound
+LUKS2 keyslot. The keyslot cannot be used for device activation.
+If you don't pass new key via \-\-master\-key\-file option,
+new random key is generated. Existing passphrase for any active keyslot
+is not required.
+
 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
 \-\-keyfile\-size, \-\-new\-keyfile\-offset,
 \-\-new\-keyfile\-size, \-\-key\-slot, \-\-master\-key\-file,
-\-\-iter\-time, \-\-force\-password, \-\-header].
+\-\-force\-password, \-\-header, \-\-disable\-locks,
+\-\-iter-time, \-\-pbkdf, \-\-pbkdf\-force\-iterations,
+\-\-unbound, \-\-type, \-\-keyslot\-cipher, \-\-keyslot\-key\-size].
 .PP
 \fIluksRemoveKey\fR <device> [<key file with passphrase to be removed>]
 .IP
 Removes the supplied passphrase from the LUKS device. The
 passphrase to be removed can be specified interactively,
-as positional argument or via \-\-key-file.
+as the positional argument or via \-\-key-file.
 
 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
-\-\-keyfile\-size, \-\-header]
+\-\-keyfile\-size, \-\-header, \-\-disable\-locks, \-\-type]
 
 \fBWARNING:\fR If you read the passphrase from stdin
-(without further argument or with '-' as argument
-to \-\-key\-file), batch-mode (\-q) will be implicitely
+(without further argument or with '-' as an argument
+to \-\-key\-file), batch-mode (\-q) will be implicitly
 switched on and no warning will be given when you remove the
 last remaining passphrase from a LUKS container. Removing
 the last passphrase makes the LUKS container permanently
@@ -282,26 +403,59 @@ inaccessible.
 
 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
 \-\-keyfile\-size, \-\-new\-keyfile\-offset,
-\-\-new\-keyfile\-size, \-\-key\-slot, \-\-force\-password, \-\-header].
+\-\-iter-time, \-\-pbkdf, \-\-pbkdf\-force\-iterations,
+\-\-new\-keyfile\-size, \-\-key\-slot, \-\-force\-password, \-\-header,
+\-\-disable\-locks, \-\-type, \-\-keyslot\-cipher, \-\-keyslot\-key\-size].
+.PP
+.PP
+\fIluksConvertKey\fR <device>
+.IP
+Converts an existing LUKS2 keyslot to new pbkdf parameters. The
+passphrase for keyslot to be converted must be supplied interactively
+or via \-\-key\-file. If no \-\-pbkdf parameters are specified LUKS2
+default pbkdf values will apply.
+
+If a keyslot is specified (via \-\-key\-slot), the passphrase for that
+keyslot must be given. If no keyslot is specified and there is still
+a free keyslot, then the new parameters will be put into a free
+keyslot before the keyslot containing the old parameters is
+purged. If there is no free keyslot, then the keyslot with the old
+parameters is overwritten directly.
+
+\fBWARNING:\fR If a keyslot is overwritten, a media failure during
+this operation can cause the overwrite to fail after the old
+parameters have been wiped and make the LUKS container inaccessible.
+
+\fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
+\-\-keyfile\-size, \-\-key\-slot, \-\-header, \-\-disable\-locks,
+\-\-iter-time, \-\-pbkdf, \-\-pbkdf\-force\-iterations,
+\-\-pbkdf\-memory, \-\-pbkdf\-parallel,
+\-\-keyslot\-cipher, \-\-keyslot\-key\-size].
 .PP
 \fIluksKillSlot\fR <device> <key slot number>
 .IP
-Wipe the key-slot number <key slot> from the LUKS device. A remaining
-passphrase must be supplied, either interactively or via \-\-key-file.
+Wipe the key-slot number <key slot> from the LUKS device. Except running
+in batch-mode (\-q) a remaining passphrase must be supplied,
+either interactively or via \-\-key-file.
 This command can remove the last remaining key-slot, but requires
 an interactive confirmation when doing so. Removing the last
 passphrase makes a LUKS container permanently inaccessible.
 
 \fB<options>\fR can be [\-\-key\-file, \-\-keyfile\-offset,
-\-\-keyfile\-size, \-\-header].
+\-\-keyfile\-size, \-\-header, \-\-disable\-locks, \-\-type].
 
 \fBWARNING:\fR If you read the passphrase from stdin
-(without further argument or with '-' as argument
-to \-\-key-file), batch-mode (\-q) will be implicitely
+(without further argument or with '-' as an argument
+to \-\-key-file), batch-mode (\-q) will be implicitly
 switched on and no warning will be given when you remove the
 last remaining passphrase from a LUKS container. Removing
 the last passphrase makes the LUKS container permanently
 inaccessible.
+
+\fBNOTE:\fR If there is no passphrase provided (on stdin or through
+\-\-key-file argument) and batch-mode (\-q) is active, the
+key-slot is removed without any other warning.
+
 .PP
 \fIerase\fR <device>
 .br
@@ -323,23 +477,31 @@ Set new UUID if \fI\-\-uuid\fR option is specified.
 Returns true, if <device> is a LUKS device, false otherwise.
 Use option \-v to get human-readable feedback. 'Command successful.'
 means the device is a LUKS device.
+
+By specifying \-\-type you may query for specific LUKS version.
 .PP
 \fIluksDump\fR <device>
 .IP
 Dump the header information of a LUKS device.
 
 If the \-\-dump\-master\-key option is used, the LUKS device master key is
-dumped instead of the keyslot info. Beware that the master key cannot be
-changed and can be used to decrypt the data stored in the LUKS container
-without a passphrase and even without the LUKS header. This means
-that if the master key is compromised, the whole device has to be
-erased to prevent further access. Use this option carefully.
-
-In order to dump the master key, a passphrase has to be supplied,
+dumped instead of the keyslot info. Together with \-\-master\-key\-file option,
+master key is dumped to a file instead of standard output. Beware that the
+master key cannot be changed without reencryption and can be used to decrypt
+the data stored in the LUKS container without a passphrase and even without the
+LUKS header. This means that if the master key is compromised, the whole device
+has to be erased or reencrypted to prevent further access. Use this option carefully.
+
+To dump the master key, a passphrase has to be supplied,
 either interactively or via \-\-key\-file.
 
+To dump unbound key (LUKS2 format only), \-\-unbound parameter, specific \-\-key-slot
+id and proper passphrase has to be supplied, either interactively or via \-\-key\-file.
+Optional \-\-master\-key\-file parameter enables unbound keyslot dump to a file.
+
 \fB<options>\fR can be [\-\-dump\-master\-key, \-\-key\-file,
-\-\-keyfile\-offset, \-\-keyfile\-size, \-\-header].
+\-\-keyfile\-offset, \-\-keyfile\-size, \-\-header, \-\-disable\-locks,
+\-\-master\-key\-file, \-\-type, \-\-unbound, \-\-key-slot].
 
 \fBWARNING:\fR If \-\-dump\-master\-key is used with \-\-key\-file
 and the argument to \-\-key\-file is '-', no validation question
@@ -370,12 +532,68 @@ from the specified file.
 Note: Using '-' as filename reads the header backup from a file named '-'.
 
 \fBWARNING:\fR Header and keyslots will be replaced, only
-the passphrases from the backup will work afterwards.
+the passphrases from the backup will work afterward.
 
 This command requires that the master key size and data offset
 of the LUKS header already on the device and of the header backup
 match. Alternatively, if there is no LUKS header on the device,
 the backup will also be written to it.
+.PP
+\fItoken\fR <add|remove|import|export> <device>
+.IP
+Action \fIadd\fR creates new keyring token to enable auto-activation of the device.
+For the auto-activation, the passphrase must be stored in keyring with the specified
+description. Usually, the passphrase should be stored in \fIuser\fR or
+\fIuser-session\fR keyring.
+The \fItoken\fR command is supported only for LUKS2.
+
+For adding new keyring token, option \-\-key\-description is mandatory.
+Also, new token is assigned to key slot specified with \-\-key\-slot option or to all
+active key slots in the case \-\-key\-slot option is omitted.
+
+To remove existing token, specify the token ID which should be removed with
+\-\-token\-id option.
+
+\fBWARNING:\fR The action \fItoken remove\fR removes any token type, not just \fIkeyring\fR
+type from token slot specified by \-\-token\-id option.
+
+Action \fIimport\fR can store arbitrary valid token json in LUKS2 header. It may be passed via
+standard input or via file passed in \-\-json\-file option. If you specify \-\-key\-slot then
+successfully imported token is also assigned to the key slot.
+
+Action \fIexport\fR writes requested token json to a file passed with \-\-json\-file or
+to standard output.
+
+\fB<options>\fR can be [\-\-header, \-\-token\-id, \-\-key\-slot, \-\-key\-description,
+\-\-disable\-locks, \-\-disable\-keyring, \-\-json\-file].
+.PP
+\fIconvert\fR <device> \-\-type <format>
+.IP
+Converts the device between LUKS1 and LUKS2 format (if possible).
+The conversion will not be performed if there is an additional LUKS2 feature or LUKS1 has
+unsupported header size.
+
+Conversion (both directions) must be performed on inactive device. There must not be active
+dm-crypt mapping established for LUKS header requested for conversion.
+
+\fB\-\-type\fR option is mandatory with following accepted values: \fIluks1\fR or \fIluks2\fR.
+
+\fBWARNING:\fR The \fIconvert\fR action can destroy the LUKS header in the case of a crash
+during conversion or if a media error occurs.
+Always create a header backup before performing this operation!
+
+\fB<options>\fR can be [\-\-header, \-\-type].
+.PP
+\fIconfig\fR <device>
+.IP
+Set permanent configuration options (store to LUKS header).
+The \fIconfig\fR command is supported only for LUKS2.
+
+The permanent options can be \fI\-\-priority\fR to set priority (normal, prefer, ignore)
+for keyslot (specified by \fI\-\-key\-slot\fR) or \fI\-\-label\fR and \fI\-\-subsystem\fR.
+
+\fB<options>\fR can be [\-\-priority, \-\-label, \-\-subsystem, \-\-key\-slot, \-\-header].
+
 .SH loop-AES EXTENSION
 cryptsetup supports mapping loop-AES encrypted partition using
 a compatibility mode.
@@ -392,7 +610,7 @@ If the key file is encrypted with GnuPG, then you have to use
 gpg \-\-decrypt <keyfile> | cryptsetup loopaesOpen \-\-key\-file=\-
 <device> <name>
 
-\fBWARNING:\fR The loop-AES extension cannot use direct input of key file
+\fBWARNING:\fR The loop-AES extension cannot use the direct input of key file
 on real terminal because the keys are separated by end-of-line and only part
 of the multi-key file would be read.
 .br
@@ -415,7 +633,7 @@ passphrase hashing (otherwise it is detected according to key
 size).
 
 \fB<options>\fR can be [\-\-key\-file, \-\-key\-size, \-\-offset, \-\-skip,
-\-\-hash, \-\-readonly, \-\-allow\-discards].
+\-\-hash, \-\-readonly, \-\-allow\-discards, \-\-refresh].
 .PP
 See also section 7 of the FAQ and \fBhttp://loop-aes.sourceforge.net\fR
 for more information regarding loop-AES.
@@ -439,11 +657,20 @@ Cryptsetup should recognize all header variants, except legacy cipher chains
 using LRW encryption mode with 64 bits encryption block (namely Blowfish
 in LRW mode is not recognized, this is limitation of kernel crypto API).
 
-To recognize VeraCrypt device  use \fB\-\-veracrypt\fR option.
+To recognize a VeraCrypt device use the \fB\-\-veracrypt\fR option.
 VeraCrypt is just extension of TrueCrypt header with increased
 iteration count so unlocking can take quite a lot of time (in comparison
 with TCRYPT device).
 
+To open a VeraCrypt device with a custom Personal Iteration Multiplier (PIM)
+value, \fBadditionally to \-\-veracrypt \fR use either the
+\fB\-\-veracrypt\-pim=<PIM>\fR option to directly specify the PIM on the command-
+line or use \fB\-\-veracrypt\-query\-pim\fR to be prompted for the PIM.
+
+The PIM value affects the number of iterations applied during key derivation. Please refer to
+\fBhttps://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20%28PIM%29.html\fR
+for more detailed information.
+
 \fBNOTE:\fR Activation with \fBtcryptOpen\fR is supported only for cipher chains
 using LRW or XTS encryption modes.
 
@@ -453,17 +680,17 @@ and doesn't require superuser privilege.
 To map system device (device with boot loader where the whole encrypted
 system resides) use \fB\-\-tcrypt\-system\fR option.
 You can use partition device as the parameter (parameter must be real partition
-device, not image in file), then only this partition is mapped.
+device, not an image in a file), then only this partition is mapped.
 
-If you have whole TCRYPT device as a file image and you want to map multiple
+If you have the whole TCRYPT device as a file image and you want to map multiple
 partition encrypted with system encryption, please create loopback mapping
 with partitions first (\fBlosetup \-P\fR, see \fPlosetup(8)\fR man page for more info),
 and use loop partition as the device parameter.
 
-If you use whole base device as parameter, one device for the whole system
+If you use the whole base device as a parameter, one device for the whole system
 encryption is mapped. This mode is available only for backward compatibility
 with older cryptsetup versions which mapped TCRYPT system encryption
-using whole device.
+using the whole device.
 
 To use hidden header (and map hidden device, if available),
 use \fB\-\-tcrypt\-hidden\fR option.
@@ -487,15 +714,15 @@ a mapping <name>.
 
 \fB<options>\fR can be [\-\-key\-file, \-\-tcrypt\-hidden,
 \-\-tcrypt\-system, \-\-tcrypt\-backup, \-\-readonly, \-\-test\-passphrase,
-\-\-allow-discards].
+\-\-allow-discards, \-\-veracrypt, \-\-veracrypt\-pim, \-\-veracrypt\-query\-pim].
 
-The keyfile parameter allows combination of file content with the
+The keyfile parameter allows combination of file content with the
 passphrase and can be repeated. Note that using keyfiles is compatible
 with TCRYPT and is different from LUKS keyfile logic.
 
 \fBWARNING:\fR Option \fB\-\-allow\-discards\fR cannot be combined with
-option \fB\-\-tcrypt\-hidden\fR. For normal mapping it can cause
-\fBdestruction of hidden volume\fR (hidden volume appears as unused space
+option \fB\-\-tcrypt\-hidden\fR. For normal mapping, it can cause
+the \fBdestruction of hidden volume\fR (hidden volume appears as unused space
 for outer volume so this space can be discarded).
 
 .PP
@@ -514,14 +741,55 @@ to be erased to prevent further access. Use this option carefully.
 \fB<options>\fR can be [\-\-dump\-master\-key, \-\-key\-file,
 \-\-tcrypt\-hidden, \-\-tcrypt\-system, \-\-tcrypt\-backup].
 
-The keyfile parameter allows combination of file content with the
+The keyfile parameter allows combination of file content with the
 passphrase and can be repeated.
 .PP
-See also \fBhttp://www.truecrypt.org\fR for more information regarding
+See also \fBhttps://en.wikipedia.org/wiki/TrueCrypt\fR for more information regarding
 TrueCrypt.
 
 Please note that cryptsetup does not use TrueCrypt code, please report
-all problems related to this compatibility extension to cryptsetup project.
+all problems related to this compatibility extension to the cryptsetup project.
+
+.SH BITLK (Windows BitLocker-compatible) EXTENSION (EXPERIMENTAL)
+cryptsetup supports mapping of BitLocker and BitLocker to Go encrypted partition
+using a native Linux kernel API.
+Header formatting and BITLK header changes are not supported, cryptsetup
+never changes BITLK header on-device.
+
+\fBWARNING:\fR This extension is EXPERIMENTAL.
+
+BITLK extension requires kernel userspace crypto API to be available
+(for details see TCRYPT section).
+
+Cryptsetup should recognize all BITLK header variants, except legacy
+header used in Windows Vista systems and partially decrypted BitLocker devices.
+Activation of legacy devices encrypted in CBC mode requires at least
+Linux kernel version 5.3 and for devices using Elephant diffuser kernel 5.6.
+
+The \fBbitlkDump\fR command should work for all recognized BITLK devices
+and doesn't require superuser privilege.
+
+For unlocking with the \fBopen\fR a password or a recovery passphrase must
+be provided. Other unlocking methods (TPM, SmartCard) are not supported.
+
+.PP
+\fIopen\fR \-\-type bitlk <device> <name>
+.br
+\fIbitlkOpen\fR <device> <name>  (\fBold syntax\fR)
+.IP
+Opens the BITLK (a BitLocker-compatible) <device> and sets up
+a mapping <name>.
+
+\fB<options>\fR can be [\-\-key\-file, \-\-readonly, \-\-test\-passphrase,
+\-\-allow-discards].
+
+.PP
+\fIbitlkDump\fR <device>
+.IP
+Dump the header information of a BITLK device.
+
+Please note that cryptsetup does not use any Windows BitLocker code, please report
+all problems related to this compatibility extension to the cryptsetup project.
 .SH MISCELLANEOUS
 .PP
 \fIrepair\fR <device>
@@ -532,7 +800,8 @@ for LUKS device type.
 This command is useful to fix some known benign LUKS metadata
 header corruptions. Only basic corruptions of unused keyslot
 are fixable. This command will only change the LUKS header, not
-any key-slot data.
+any key-slot data. You may enforce LUKS version by adding \-\-type
+option.
 
 \fBWARNING:\fR Always create a binary backup of the original
 header before calling this command.
@@ -540,7 +809,7 @@ header before calling this command.
 \fIbenchmark\fR <options>
 .IP
 Benchmarks ciphers and KDF (key derivation function).
-Without parameters it tries to measure few common configurations.
+Without parameters, it tries to measure few common configurations.
 
 To benchmark other ciphers or modes, you need to specify \fB\-\-cipher\fR
 and \fB\-\-key\-size\fR options or \fB\-\-hash\fR for KDF test.
@@ -560,9 +829,14 @@ If you are configuring kernel yourself, enable
 .B "\-\-verbose, \-v"
 Print more information on command execution.
 .TP
-.B "\-\-debug"
+.B "\-\-debug or \-\-debug\-json"
 Run in debug mode with full diagnostic logs. Debug output
 lines are always prefixed by '#'.
+If \-\-debug\-json is used, additional LUKS2 JSON data structures are printed.
+.TP
+.B "\-\-type <device-type>
+Specifies required device type, for more info
+read \fIBASIC COMMANDS\fR section.
 .TP
 .B "\-\-hash, \-h \fI<hash\-spec>\fR"
 Specifies the passphrase hash for \fIopen\fR (for plain and
@@ -593,7 +867,7 @@ The current default in the distributed sources is
 "aes-cbc-essiv:sha256" for plain dm-crypt and
 "aes-xts-plain64" for LUKS.
 
-If a hash is part of the cipher spefification, then it is
+If a hash is part of the cipher specification, then it is
 used as part of the IV generation. For example, ESSIV
 needs a hash function, while "plain64" does not and
 hence none is specified.
@@ -630,18 +904,18 @@ See section \fBNOTES ON PASSPHRASE PROCESSING\fR for more information.
 .TP
 .B "\-\-keyfile\-offset \fIvalue\fR"
 Skip \fIvalue\fR bytes at the beginning of the key file.
-Works with all commands that accepts key files.
+Works with all commands that accept key files.
 .TP
 .B "\-\-keyfile\-size, \-l \fIvalue\fR"
 Read a maximum of \fIvalue\fR bytes from the key file.
-Default is to read the whole file up to the compiled-in
+The default is to read the whole file up to the compiled-in
 maximum that can be queried with \-\-help. Supplying more
 data than the compiled-in maximum aborts the operation.
 
 This option is useful
 to cut trailing newlines, for example. If \-\-keyfile\-offset
 is also given, the size count starts after the offset.
-Works with all commands that accepts key files.
+Works with all commands that accept key files.
 .TP
 .B "\-\-new\-keyfile\-offset \fIvalue\fR"
 Skip \fIvalue\fR bytes at the start when
@@ -651,7 +925,7 @@ adding a new passphrase from key file with
 .B "\-\-new\-keyfile\-size  \fIvalue\fR"
 Read a maximum of \fIvalue\fR bytes when adding
 a new passphrase from key file with \fIluksAddKey\fR.
-Default is to read the whole file up to the compiled-in
+The default is to read the whole file up to the compiled-in
 maximum length that can be queried with \-\-help.
 Supplying more than the compiled in maximum aborts the
 operation.
@@ -668,13 +942,17 @@ LUKS header and all other parameters are the same,
 then the new header decrypts the data encrypted with the
 header the master key was taken from.
 
+Action \fIluksDump\fR together with \-\-dump\-master\-key
+option: The volume (master) key is stored in a file instead of
+being printed out to standard output.
+
 \fBWARNING:\fR If you create your own master key, you
-need to make sure to do it right. Otherwise you can end
+need to make sure to do it right. Otherwise, you can end
 up with a low-entropy or otherwise partially predictable
 master key which will compromise security.
 
 For \fIluksAddKey\fR this allows adding a new passphrase
-without having to know an exiting one.
+without having to know an existing one.
 
 For \fIopen\fR this allows one to open the LUKS device
 without giving a passphrase.
@@ -684,6 +962,11 @@ For \fIluksDump\fR this option includes the master key in the displayed
 information. Use with care, as the master key can be used to
 bypass the passphrases, see also option \-\-master\-key\-file.
 .TP
+.B "\-\-json\-file"
+Read token json from a file or write token to it. See \fItoken\fR action for more
+information. \-\-json\-file=- reads json from standard input or writes it to
+standard output respectively.
+.TP
 .B "\-\-use\-random"
 .TP
 .B "\-\-use\-urandom"
@@ -726,14 +1009,18 @@ All other LUKS actions will use the key-size specified in the LUKS header.
 Use \fIcryptsetup \-\-help\fR to show the compiled-in defaults.
 .TP
 .B "\-\-size, \-b <number of 512 byte sectors>"
-Force the size of the underlying device in sectors of 512 bytes.
+Set the size of the device in sectors of 512 bytes.
 This option is only relevant for the \fIopen\fR and \fIresize\fR
 actions.
 .TP
 .B "\-\-offset, \-o <number of 512 byte sectors>"
 Start offset in the backend device in 512-byte sectors.
 This option is only relevant for the \fIopen\fR action with plain
-or loopaes device types.
+or loopaes device types or for LUKS devices in \fIluksFormat\fR.
+
+For LUKS, the \-\-offset option sets the data offset (payload) of data
+device and must be be aligned to 4096-byte sectors (must be multiple of 8).
+This option cannot be combined with \-\-align\-payload option.
 .TP
 .B "\-\-skip, \-p <number of 512 byte sectors>"
 Start offset used in IV calculation in 512-byte sectors
@@ -742,9 +1029,25 @@ This option is only relevant for the \fIopen\fR action with plain
 or loopaes device types.
 
 Hence, if \-\-offset \fIn\fR, and \-\-skip \fIs\fR, sector \fIn\fR
-(the first sector of encrypted device) will get a sector number
+(the first sector of the encrypted device) will get a sector number
 of \fIs\fR for the IV calculation.
 .TP
+.B "\-\-device\-size \fIsize[units]\fR"
+Instead of real device size, use specified value.
+
+With \fIreencrypt\fR action it means that only specified area
+(from the start of the device to the specified size) will be
+reencrypted.
+
+With \fIresize\fR action it sets new size of the device.
+
+If no unit suffix is specified, the size is in bytes.
+
+Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB,MiB,GiB,TiB)
+for units with 1024 base or KB/MB/GB/TB for 1000 base (SI scale).
+
+\fBWARNING:\fR This is destructive operation when used with reencrypt command.
+.TP
 .B "\-\-readonly, \-r"
 set up a read-only mapping.
 .TP
@@ -755,18 +1058,77 @@ This option is only relevant for the
 \fIopen \-\-type plain\fR action. Use \-\-offset, \-\-size and \-\-skip to
 specify the mapped area.
 .TP
+.B "\-\-pbkdf <PBKDF spec>"
+Set Password-Based Key Derivation Function (PBKDF) algorithm for LUKS keyslot.
+The PBKDF can be: \fIpbkdf2\fR (for PBKDF2 according to RFC2898),
+\fIargon2i\fR for Argon2i or \fIargon2id\fR for Argon2id
+(see https://www.cryptolux.org/index.php/Argon2 for more info).
+
+For LUKS1, only PBKDF2 is accepted (no need to use this option).
+The default PBKDF2 for LUKS2 is set during compilation time
+and is available in \fIcryptsetup \-\-help\fR output.
+
+A PBKDF is used for increasing dictionary and brute-force attack cost
+for keyslot passwords. The parameters can be time, memory and parallel cost.
+
+For PBKDF2, only time cost (number of iterations) applies.
+For Argon2i/id, there is also memory cost (memory required during
+the process of key derivation) and parallel cost (number of threads
+that run in parallel during the key derivation.
+
+Note that increasing memory cost also increases time, so the final
+parameter values are measured by a benchmark. The benchmark
+tries to find iteration time (\fI\-\-iter\-time\fR) with required
+memory cost \fI\-\-pbkdf\-memory\fR. If it is not possible,
+the memory cost is decreased as well.
+The parallel cost \fI\-\-pbkdf\-parallel\fR is constant, is is checked
+against available CPU cores (if not available, it is decreased) and the maximum
+parallel cost is 4.
+
+You can see all PBKDF parameters for particular LUKS2 keyslot with
+\fIluksDump\fR command.
+
+\fBNOTE:\fR If you do not want to use benchmark and want to specify
+all parameters directly, use \fI\-\-pbkdf\-force\-iterations\fR with
+\fI\-\-pbkdf\-memory\fR and \fI\-\-pbkdf\-parallel\fR.
+This will override the values without benchmarking.
+Note it can cause extremely long unlocking time. Use only is specified
+cases, for example, if you know that the formatted device will
+be used on some small embedded system.
+In this case, the LUKS PBKDF2 digest will be set to the minimum iteration count.
+.TP
 .B "\-\-iter\-time, \-i <number of milliseconds>"
-The number of milliseconds to spend with PBKDF2 passphrase processing.
+The number of milliseconds to spend with PBKDF passphrase processing.
 This option is only relevant for LUKS operations that set or change
 passphrases, such as \fIluksFormat\fR or \fIluksAddKey\fR.
 Specifying 0 as parameter selects the compiled-in default.
 .TP
+.B "\-\-pbkdf\-memory <number>"
+Set the memory cost for PBKDF (for Argon2i/id the number represents kilobytes).
+Note that it is maximal value, PBKDF benchmark or available physical memory
+can decrease it.
+This option is not available for PBKDF2.
+.TP
+.B "\-\-pbkdf\-parallel <number>"
+Set the parallel cost for PBKDF (number of threads, up to 4).
+Note that it is maximal value, it is decreased automatically if
+CPU online count is lower.
+This option is not available for PBKDF2.
+.TP
+.B "\-\-pbkdf\-force\-iterations <num>"
+Avoid PBKDF benchmark and set time cost (iterations) directly.
+It can be used for LUKS/LUKS2 device only.
+See \fI\-\-pbkdf\fR option for more info.
+.TP
 .B "\-\-batch\-mode, \-q"
 Suppresses all confirmation questions. Use with care!
 
 If the \-y option is not specified, this option also switches off
 the passphrase verification for \fIluksFormat\fR.
 .TP
+.B "\-\-progress-frequency <seconds>"
+Print separate line every <seconds> with wipe progress.
+.TP
 .B "\-\-timeout, \-t <number of seconds>"
 The number of seconds to wait before timeout on passphrase input
 via terminal. It is relevant every time a passphrase is asked,
@@ -790,24 +1152,30 @@ Align payload at a boundary of \fIvalue\fR 512-byte sectors.
 This option is relevant for \fIluksFormat\fR.
 
 If not specified, cryptsetup tries to use the topology info
-provided by kernel for the underlying device to get optimal alignment.
+provided by the kernel for the underlying device to get the optimal alignment.
 If not available (or the calculated value is a multiple of the default)
 data is by default aligned to a 1MiB boundary (i.e. 2048 512-byte sectors).
 
-For a detached LUKS header this option specifies the offset on the
+For a detached LUKS header, this option specifies the offset on the
 data device. See also the \-\-header option.
+
+\fBWARNING:\fR This option is DEPRECATED and has often unexpected impact
+to the data offset and keyslot area size (for LUKS2) due to the complex rounding.
+For fixed data device offset use \fI\-\-offset\fR option instead.
+
 .TP
 .B "\-\-uuid=\fIUUID\fR"
 Use the provided \fIUUID\fR for the \fIluksFormat\fR command
-instead of generating new one. Changes the existing UUID when
+instead of generating new one. Changes the existing UUID when
 used with the \fIluksUUID\fR command.
 
 The UUID must be provided in the standard UUID format,
 e.g. 12345678-1234-1234-1234-123456789abc.
 .TP
 .B "\-\-allow\-discards\fR"
-Allow the use of discard (TRIM) requests for device.
+Allow the use of discard (TRIM) requests for the device.
 This option is only relevant for \fIopen\fR action.
+This is also not supported for LUKS2 devices with data integrity protection.
 
 \fBWARNING:\fR This command can have a negative security impact
 because it can make filesystem-level operations visible on
@@ -816,7 +1184,7 @@ filesystem type, used space, etc. may be extractable from
 the physical device if the discarded blocks can be located
 later. If in doubt, do not use it.
 
-A kernel version of 3.1 or later is needed. For earlier kernels
+A kernel version of 3.1 or later is needed. For earlier kernels,
 this option is ignored.
 .TP
 .B "\-\-perf\-same_cpu_crypt\fR"
@@ -842,21 +1210,21 @@ performance tuning, use only if you need a change to default dm-crypt
 behaviour. Needs kernel 4.0 or later.
 .TP
 .B "\-\-test\-passphrase\fR"
-Do not activate device, just verify passphrase.
+Do not activate the device, just verify passphrase.
 This option is only relevant for \fIopen\fR action (the device
 mapping name is not mandatory if this option is used).
 .TP
 .B "\-\-header\fR <device or file storing the LUKS header>"
 Use a detached (separated) metadata device or file where the
-LUKS header is stored. This options allows one to store ciphertext
+LUKS header is stored. This option allows one to store ciphertext
 and LUKS header on different devices.
 
 This option is only relevant for LUKS devices and can be
 used with the \fIluksFormat\fR, \fIopen\fR, \fIluksSuspend\fR,
 \fIluksResume\fR, \fIstatus\fR and \fIresize\fR commands.
 
-For \fIluksFormat\fR with a file name as argument to \-\-header,
-it has to exist and be large enough to contain the LUKS header.
+For \fIluksFormat\fR with a file name as the argument to \-\-header,
+the file will be automatically created if it does not exist.
 See the cryptsetup FAQ for header size calculation.
 
 For other commands that change the LUKS header (e.g. \fIluksAddKey\fR),
@@ -867,19 +1235,237 @@ If used with \fIluksFormat\fR, the \-\-align\-payload option is taken
 as absolute sector alignment on ciphertext device and can be zero.
 
 \fBWARNING:\fR There is no check whether the ciphertext device specified
-actually belongs to the header given. In fact you can specify an
+actually belongs to the header given. In fact, you can specify an
 arbitrary device as the ciphertext device for \fIopen\fR
 with the \-\-header option. Use with care.
 .TP
-.B "\-\-force\-password\fR"
+.B "\-\-header\-backup\-file <file>"
+Specify file with header backup for \fIluksHeaderBackup\fR or
+\fIluksHeaderRestore\fR actions.
+.TP
+.B "\-\-force\-password"
 Do not use password quality checking for new LUKS passwords.
 
 This option applies only to \fIluksFormat\fR, \fIluksAddKey\fR and
 \fIluksChangeKey\fR and is ignored if cryptsetup is built without
 password quality checking support.
 
-For more info about password quality check, see manual page
-for \fBpwquality.conf(5)\fR.
+For more info about password quality check, see the manual page
+for \fBpwquality.conf(5)\fR and \fBpasswdqc.conf(5)\fR.
+.TP
+.B "\-\-deferred"
+Defers device removal in \fIclose\fR command until the last user closes it.
+.TP
+.B "\-\-disable\-locks"
+Disable lock protection for metadata on disk.
+This option is valid only for LUKS2 and ignored for other formats.
+
+\fBWARNING:\fR Do not use this option unless you run cryptsetup in
+a restricted environment where locking is impossible to perform
+(where /run directory cannot be used).
+.TP
+.B "\-\-disable\-keyring"
+Do not load volume key in kernel keyring and store it directly
+in the dm-crypt target instead.
+This option is supported only for the LUKS2 format.
+.TP
+.B "\-\-key\-description <text>"
+Set key description in keyring for use with \fItoken\fR command.
+.TP
+.B "\-\-priority <normal|prefer|ignore>"
+Set a priority for LUKS2 keyslot.
+The \fIprefer\fR priority marked slots are tried before \fInormal\fR priority.
+The \fIignored\fR priority means, that slot is never used, if not explicitly
+requested by \fI\-\-key\-slot\fR option.
+.TP
+.B "\-\-token\-id"
+Specify what token to use in actions \fItoken\fR, \fIopen\fR or \fIresize\fR.
+If omitted, all available tokens will be checked before proceeding further with
+passphrase prompt.
+.TP
+.B "\-\-token\-only"
+Do not proceed further with action (any of \fItoken\fR, \fIopen\fR or
+\fIresize\fR) if token activation failed. Without the option,
+action asks for passphrase to proceed further.
+.TP
+.B "\-\-sector\-size <bytes>"
+Set sector size for use with disk encryption. It must be power of two
+and in range 512 - 4096 bytes. The default is 512 bytes sectors.
+This option is available only in the LUKS2 mode.
+
+Note that if sector size is higher than underlying device hardware sector
+and there is not integrity protection that uses data journal, using
+this option can increase risk on incomplete sector writes during a power fail.
+
+If used together with \fI\-\-integrity\fR option and dm-integrity journal,
+the atomicity of writes is guaranteed in all cases (but it cost write
+performance - data has to be written twice).
+
+Increasing sector size from 512 bytes to 4096 bytes can provide better
+performance on most of the modern storage devices and also with some
+hw encryption accelerators.
+.TP
+.B "\-\-iv-large-sectors"
+Count Initialization Vector (IV) in larger sector size (if set) instead
+of 512 bytes sectors. This option can be used only for \fIopen\fR command
+and \fIplain\fR encryption type.
+
+\fBNOTE:\fR This option does not have any performance or security impact,
+use it only for accessing incompatible existing disk images from other systems
+that require this option.
+.TP
+.B "\-\-persistent"
+If used with LUKS2 devices and activation commands like \fIopen\fR or \fIrefresh\fR,
+the specified activation flags are persistently written into metadata
+and used next time automatically even for normal activation.
+(No need to use cryptab or other system configuration files.)
+
+If you need to remove a persistent flag, use \fI\-\-persistent\fR without
+the flag you want to remove (e.g. to disable persistently stored discard flag,
+use \fI\-\-persistent\fR without \fI\-\-allow-discards\fR).
+
+Only \fI\-\-allow-discards\fR, \fI\-\-perf\-same_cpu_crypt\fR,
+\fI\-\-perf\-submit_from_crypt_cpus\fR and \fI\-\-integrity\-no\-journal\fR
+can be stored persistently.
+.TP
+.B "\-\-refresh"
+Refreshes an active device with new set of parameters. See action \fIrefresh\fR description
+for more details.
+.TP
+.B "\-\-label <LABEL>"
+.B "\-\-subsystem <SUBSYSTEM>"
+Set label and subsystem description for LUKS2 device, can be used
+in \fIconfig\fR and \fIformat\fR actions.
+The label and subsystem are optional fields and can be later used in udev scripts
+for triggering user actions once device marked by these labels is detected.
+.TP
+.B "\-\-integrity <integrity algorithm>"
+Specify integrity algorithm to be used for authenticated disk encryption in LUKS2.
+
+\fBWARNING: This extension is EXPERIMENTAL\fR and requires dm-integrity
+kernel target (available since kernel version 4.12).
+For native AEAD modes, also enable "User-space interface for AEAD cipher algorithms"
+in "Cryptographic API" section (CONFIG_CRYPTO_USER_API_AEAD .config option).
+
+For more info, see \fIAUTHENTICATED DISK ENCRYPTION\fR section.
+.TP
+.B "\-\-luks2\-metadata\-size <size>"
+This option can be used to enlarge the LUKS2 metadata (JSON) area.
+The size includes 4096 bytes for binary metadata (usable JSON area is smaller
+of the binary area).
+According to LUKS2 specification, only these values are valid:
+16, 32, 64, 128, 256, 512, 1024, 2048 and 4096 kB
+The <size> can be specified with unit suffix (for example 128k).
+.TP
+.B "\-\-luks2\-keyslots\-size <size>"
+This option can be used to set specific size of the LUKS2 binary keyslot area
+(key material is encrypted there). The value must be aligned to multiple
+of 4096 bytes with maximum size 128MB.
+The <size> can be specified with unit suffix (for example 128k).
+.TP
+.B "\-\-keyslot\-cipher <cipher\-spec>"
+This option can be used to set specific cipher encryption for the LUKS2 keyslot area.
+.TP
+.B "\-\-keyslot\-key\-size <bits>"
+This option can be used to set specific key size for the LUKS2 keyslot area.
+.TP
+.B "\-\-integrity\-no\-journal"
+Activate device with integrity protection without using data journal (direct
+write of data and integrity tags).
+Note that without journal power fail can cause non-atomic write and data corruption.
+Use only if journalling is performed on a different storage layer.
+.TP
+.B "\-\-integrity\-no\-wipe"
+Skip wiping of device authentication (integrity) tags. If you skip this
+step, sectors will report invalid integrity tag until an application write
+to the sector.
+
+\fBNOTE:\fR Even some writes to the device can fail if the write is not
+aligned to page size and page-cache initiates read of a sector with invalid
+integrity tag.
+.TP
+.B "\-\-unbound"
+
+Creates new or dumps existing LUKS2 unbound keyslot. See \fIluksAddKey\fR or
+\fIluksDump\fR actions for more details.
+
+.TP
+.B "\-\-tcrypt\-hidden"
+.B "\-\-tcrypt\-system"
+.B "\-\-tcrypt\-backup"
+Specify which TrueCrypt on-disk header will be used to open the device.
+See \fITCRYPT\fR section for more info.
+.TP
+.B "\-\-veracrypt"
+Allow VeraCrypt compatible mode. Only for TCRYPT extension.
+See \fITCRYPT\fR section for more info.
+.TP
+.B "\-\-veracrypt\-pim"
+.B "\-\-veracrypt\-query\-pim"
+Use a custom Personal Iteration Multiplier (PIM) for VeraCrypt device.
+See \fITCRYPT\fR section for more info.
+.TP
+.B "\-\-serialize\-memory\-hard\-pbkdf"
+Use a global lock to serialize unlocking of keyslots using memory-hard PBKDF.
+
+\fBNOTE:\fR This is (ugly) workaround for a specific situation when multiple
+devices are activated in parallel and system instead of reporting out of memory
+starts unconditionally stop processes using out-of-memory killer.
+
+\fBDO NOT USE\fR this switch until you are implementing boot environment
+with parallel devices activation!
+.TP
+.B "\-\-encrypt"
+Initialize (and run) device encryption (\fIreencrypt\fR action parameter)
+.TP
+.B "\-\-decrypt"
+Initialize (and run) device decryption (\fIreencrypt\fR action parameter)
+.TP
+.B "\-\-init\-only"
+Initialize reencryption (any variant) operation in LUKS2 metadata only and exit. If any
+reencrypt operation is already initialized in metadata, the command with \-\-init\-only
+parameter fails.
+.TP
+.B "\-\-resume\-only"
+Resume reencryption (any variant) operation already described in LUKS2 metadata. If no
+reencrypt operation is initialized, the command with \-\-resume\-only
+parameter fails. Useful for resuming reencrypt operation without accidentally triggering
+new reencryption operation.
+.TP
+.B "\-\-resilience <mode>"
+Reencryption resilience mode can be one of \fIchecksum\fR, \fIjournal\fR or \fInone\fR.
+
+\fIchecksum\fR: default mode, where individual checksums of ciphertext hotzone sectors are stored,
+so the recovery process can detect which sectors where already reencrypted. It requires that the device sector write is atomic.
+
+\fIjournal\fR: the hotzone is journaled in the binary area (so the data are written twice).
+
+\fInone\fR: performance mode. There is no protection and the only way it's safe to interrupt
+the reencryption is similar to old offline reencryption utility. (ctrl+c).
+
+The option is ignored if reencryption with datashift mode is in progress.
+.TP
+.B "\-\-resilience-hash <hash>"
+The hash algorithm used with "\-\-resilience checksum" only. The default hash is sha256. With other resilience modes, the hash parameter is ignored.
+.TP
+.B "\-\-hotzone-size <size>"
+This option can be used to set an upper limit on the size of reencryption area (hotzone).
+The <size> can be specified with unit suffix (for example 50M). Note that actual hotzone
+size may be less than specified <size> due to other limitations (free space in keyslots area or
+available memory).
+.TP
+.B "\-\-reduce\-device\-size <size>"
+Initialize LUKS2 reencryption with data device size reduction (currently only \-\-encrypt variant is supported).
+
+Last <size> sectors of <device> will be used to properly initialize device reencryption. That means any
+data at last <size> sectors will be lost.
+
+It could be useful if you added some space to underlying partition or logical volume (so last <size> sectors contains no data).
+
+Recommended minimal size is twice the default LUKS2 header size (\-\-reduce\-device\-size 32M) for \-\-encrypt use case. Be sure to
+have enough (at least \-\-reduce\-device\-size value of free space at the end of <device>).
+
+WARNING: This is a destructive operation and cannot be reverted.  Use with extreme care - accidentally overwritten filesystems are usually unrecoverable.
 .TP
 .B "\-\-version"
 Show the program version.
@@ -931,7 +1517,7 @@ less than the key size.
 
 \fBFrom a key file\fR: It will be truncated to the
 key size of the used cipher or the size given by \-s
-and directly used as binary key.
+and directly used as binary key.
 
 \fBWARNING\fR: The \-\-hash argument is being ignored.
 The \-\-hash option is usable only for stdin input in plain mode.
@@ -973,10 +1559,10 @@ low-entropy passphrases, but open will take longer to
 complete. For passphrases that have entropy higher than the
 used key length, higher iteration times will not increase security.
 
-The default setting of one second is sufficient for most
+The default setting of one or two seconds is sufficient for most
 practical cases. The only exception is a low-entropy
 passphrase used on a device with a slow CPU, as this will
-result in a low iteration count. On a slow device it may
+result in a low iteration count. On a slow device, it may
 be advisable to increase the iteration time using the
 \-\-iter\-time option in order to obtain a higher
 iteration count. This does slow down all later luksOpen
@@ -996,7 +1582,7 @@ in order to get more options.
 
 For the \-\-hash option, if the crypto backend is libgcrypt,
 then all algorithms supported by the gcrypt library are available.
-For other crypto backends some algorithms may be missing.
+For other crypto backends, some algorithms may be missing.
 .SH NOTES ON PASSPHRASES
 Mathematics can't be bribed. Make sure you keep your passphrases safe.
 There are a few nice tricks for constructing a fallback, when suddenly
@@ -1025,18 +1611,67 @@ time, using /dev/urandom in a low-entropy situation will
 produce low-quality keys. This is a serious problem, but solving
 it is out of scope for a mere man-page.
 See \fPurandom(4)\fR for more information.
+.SH AUTHENTICATED DISK ENCRYPTION (EXPERIMENTAL)
+Since Linux kernel version 4.12 dm-crypt supports authenticated
+disk encryption.
+
+Normal disk encryption modes are length-preserving (plaintext sector
+is of the same size as a ciphertext sector) and can provide only
+confidentiality protection, but not cryptographically sound
+data integrity protection.
+
+Authenticated modes require additional space per-sector for
+authentication tag and use Authenticated Encryption with Additional
+Data (AEAD) algorithms.
+
+If you configure LUKS2 device with data integrity protection,
+there will be an underlying dm-integrity device, which provides
+additional per-sector metadata space and also provide data
+journal protection to ensure atomicity of data and metadata update.
+Because there must be additional space for metadata and journal,
+the available space for the device will be smaller than for
+length-preserving modes.
+
+The dm-crypt device then resides on top of such a dm-integrity device.
+All activation and deactivation of this device stack is performed
+by cryptsetup, there is no difference in using \fIluksOpen\fR
+for integrity protected devices.
+If you want to format LUKS2 device with data integrity protection,
+use \fI\-\-integrity\fR option.
+
+Since dm-integrity doesn't support discards (TRIM), dm-crypt device on top of it
+inherits this, so integrity protection mode doesn't support discards either.
+
+Some integrity modes requires two independent keys (key for encryption
+and for authentication). Both these keys are stored in one LUKS keyslot.
+
+\fBWARNING:\fR All support for authenticated modes is experimental
+and there are only some modes available for now. Note that there
+are a very few authenticated encryption algorithms that are suitable
+for disk encryption.
+
 .SH NOTES ON LOOPBACK DEVICE USE
 Cryptsetup is usually used directly on a block device (disk
 partition or LVM volume). However, if the device argument is a
 file, cryptsetup tries to allocate a loopback device
 and map it into this file. This mode requires Linux kernel 2.6.25
 or more recent which supports the loop autoclear flag (loop device is
-cleared on last close automatically). Of course, you can
+cleared on the last close automatically). Of course, you can
 always map a file to a loop-device manually. See the
 cryptsetup FAQ for an example.
 
 When device mapping is active, you can see the loop backing file in
 the status command output. Also see losetup(8).
+.SH LUKS2 header locking
+.PP
+The LUKS2 on-disk metadata is updated in several steps and
+to achieve proper atomic update, there is a locking mechanism.
+For an image in file, code uses \fIflock(2)\fR system call.
+For a block device, lock is performed over a special file stored
+in a locking directory (by default \fI/run/lock/cryptsetup\fR).
+The locking directory should be created with the proper security
+context by the distribution during the boot-up phase.
+Only LUKS2 uses locks, other formats do not use this mechanism.
 .SH DEPRECATED ACTIONS
 .PP
 The \fIreload\fR action is no longer supported.
@@ -1065,11 +1700,11 @@ Copyright \(co 2004 Jana Saout
 .br
 Copyright \(co 2004-2006 Clemens Fruhwirth
 .br
-Copyright \(co 2009-2015 Red Hat, Inc.
+Copyright \(co 2012-2014 Arno Wagner
 .br
-Copyright \(co 2009-2015 Milan Broz
+Copyright \(co 2009-2020 Red Hat, Inc.
 .br
-Copyright \(co 2012-2014 Arno Wagner
+Copyright \(co 2009-2020 Milan Broz
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/man/integritysetup.8 b/man/integritysetup.8
new file mode 100644 (file)
index 0000000..44e7e07
--- /dev/null
@@ -0,0 +1,240 @@
+.TH INTEGRITYSETUP "8" "January 2019" "integritysetup" "Maintenance Commands"
+.SH NAME
+integritysetup - manage dm-integrity (block level integrity) volumes
+.SH SYNOPSIS
+.B integritysetup <options> <action> <action args>
+.SH DESCRIPTION
+.PP
+Integritysetup is used to configure dm-integrity managed device-mapper mappings.
+
+Device-mapper integrity target provides read-write transparent integrity
+checking of block devices. The dm-integrity target emulates additional data
+integrity field per-sector. You can use this additional field directly
+with integritysetup utility, or indirectly (for authenticated encryption)
+through cryptsetup.
+
+Integritysetup supports these operations:
+.PP
+\fIformat\fR <device>
+.IP
+Formats <device> (calculates space and dm-integrity superblock and wipes the device).
+
+\fB<options>\fR can be [\-\-data\-device, \-\-batch\-mode, \-\-no\-wipe, \-\-journal\-size,
+\-\-interleave\-sectors, \-\-tag\-size, \-\-integrity, \-\-integrity\-key\-size,
+\-\-integrity\-key\-file, \-\-sector\-size, \-\-progress-frequency]
+
+.PP
+\fIopen\fR <device> <name>
+.br
+\fIcreate\fR <name> <device> (\fBOBSOLETE syntax\fR)
+.IP
+Open a mapping with <name> backed by device <device>.
+
+\fB<options>\fR can be [\-\-data\-device, \-\-batch\-mode, \-\-journal\-watermark,
+\-\-journal\-commit\-time, \-\-buffer\-sectors, \-\-integrity, \-\-integrity\-key\-size,
+\-\-integrity\-key\-file, \-\-integrity\-no\-journal, \-\-integrity\-recalculate,
+\-\-integrity\-recovery\-mode, \-\-allow\-discards]
+
+.PP
+\fIclose\fR <name>
+.IP
+Removes existing mapping <name>.
+
+For backward compatibility, there is \fBremove\fR command alias
+for the \fBclose\fR command.
+.PP
+\fIstatus\fR <name>
+.IP
+Reports status for the active integrity mapping <name>.
+.PP
+\fIdump\fR <device>
+.IP
+Reports parameters from on-disk stored superblock.
+
+.SH OPTIONS
+.TP
+.B "\-\-verbose, \-v"
+Print more information on command execution.
+.TP
+.B "\-\-debug"
+Run in debug mode with full diagnostic logs. Debug output
+lines are always prefixed by '#'.
+.TP
+.B "\-\-version"
+Show the program version.
+.TP
+.B "\-\-batch\-mode"
+Do not ask for confirmation.
+.TP
+.B "\-\-progress-frequency <seconds>"
+Print separate line every <seconds> with wipe progress.
+.TP
+.B "\-\-no\-wipe"
+Do not wipe the device after format. A device that is not initially wiped will contain invalid checksums.
+.TP
+.B "\-\-journal\-size, \-j BYTES"
+Size of the journal.
+.TP
+.B "\-\-interleave\-sectors SECTORS"
+The number of interleaved sectors.
+.TP
+.B "\-\-integrity\-recalculate"
+Automatically recalculate integrity tags in kernel on activation.
+The device can be used during automatic integrity recalculation but becomes fully
+integrity protected only after the background operation is finished.
+This option is available since the Linux kernel version 4.19.
+.TP
+.B "\-\-journal\-watermark PERCENT"
+Journal watermark in percents. When the size of the journal exceeds this watermark,
+the journal flush will be started.
+.TP
+.B "\-\-journal\-commit\-time MS"
+Commit time in milliseconds. When this time passes (and no explicit flush operation was issued),
+the journal is written.
+.TP
+.B "\-\-tag\-size, \-t BYTES"
+Size of the integrity tag per-sector (here the integrity function will store authentication tag).
+
+\fBNOTE:\fR The size can be smaller that output size of the hash function, in that case only
+part of the hash will be stored.
+.TP
+.B "\-\-data\-device"
+Specify a separate data device that contains existing data. The <device> then will contain
+calculated integrity tags and journal for this data device.
+.TP
+.B "\-\-sector\-size, \-s BYTES"
+Sector size (power of two: 512, 1024, 2048, 4096).
+.TP
+.B "\-\-buffer\-sectors SECTORS"
+The number of sectors in one buffer.
+
+The tag area is accessed using buffers, the large buffer size means that the I/O size will
+be larger, but there could be less I/Os issued.
+.TP
+.B "\-\-integrity, \-I ALGORITHM"
+Use internal integrity calculation (standalone mode).
+The integrity algorithm can be CRC (crc32c/crc32) or hash function (sha1, sha256).
+
+For HMAC (hmac-sha256) you have also to specify an integrity key and its size.
+.TP
+.B "\-\-integrity\-key\-size BYTES"
+The size of the data integrity key.
+.TP
+.B "\-\-integrity\-key\-file FILE"
+The file with the integrity key.
+.TP
+.B "\-\-integrity\-no\-journal, \-D"
+Disable journal for integrity device.
+.TP
+.B "\-\-integrity\-bitmap\-mode. \-B"
+Use alternate bitmap mode (available since Linux kernel 5.2)  where dm-integrity uses bitmap
+instead of a journal. If a bit in the bitmap is 1, the corresponding region's data and integrity tags
+are not synchronized - if the machine crashes, the unsynchronized regions will be recalculated.
+The bitmap mode is faster than the journal mode, because we don't have to write the data
+twice, but it is also less reliable, because if data corruption happens
+when the machine crashes, it may not be detected.
+.TP
+.B "\-\-bitmap\-sectors\-per\-bit SECTORS"
+Number of 512-byte sectors per bitmap bit, the value must be power of two.
+.TP
+.B "\-\-bitmap\-flush\-time MS"
+Bitmap flush time in milliseconds.
+.TP
+
+\fBWARNING:\fR
+In case of a crash, it is possible that the data and integrity tag doesn't match
+if the journal is disabled.
+.TP
+.B "\-\-integrity\-recovery\-mode. \-R"
+Recovery mode (no journal, no tag checking).
+.TP
+
+\fBNOTE:\fR The following options are intended for testing purposes only.
+Using journal encryption does not make sense without encryption the data,
+these options are internally used in authenticated disk encryption with \fBcryptsetup(8)\fR.
+.TP
+.B "\-\-journal\-integrity ALGORITHM"
+Integrity algorithm for journal area.
+See \-\-integrity option for detailed specification.
+.TP
+.B "\-\-journal\-integrity\-key\-size BYTES"
+The size of the journal integrity key.
+.TP
+.B "\-\-journal\-integrity\-key\-file FILE"
+The file with the integrity key.
+.TP
+.B "\-\-journal\-crypt ALGORITHM"
+Encryption algorithm for journal data area.
+You can use a block cipher here such as cbc-aes or
+a stream cipher, for example, chacha20 or ctr-aes.
+.TP
+.B "\-\-journal\-crypt\-key\-size BYTES"
+The size of the journal encryption key.
+.TP
+.B "\-\-journal\-crypt\-key\-file FILE"
+The file with the journal encryption key.
+.TP
+.B "\-\-allow\-discards\fR"
+Allow the use of discard (TRIM) requests for the device.
+This option is available since the Linux kernel version 5.7.
+.TP
+The dm-integrity target is available since Linux kernel version 4.12.
+.TP
+\fBNOTE:\fR
+Format and activation of an integrity device always require superuser
+privilege because the superblock is calculated and handled in dm-integrity kernel target.
+
+.SH RETURN CODES
+Integritysetup returns 0 on success and a non-zero value on error.
+
+Error codes are:
+    1 wrong parameters
+    2 no permission
+    3 out of memory
+    4 wrong device specified
+    5 device already exists, or device is busy.
+
+.SH EXAMPLES
+Format the device with default standalone mode (CRC32C):
+
+.B "integritysetup format <device>"
+
+Open the device with default parameters:
+
+.B "integritysetup open <device> test"
+
+Format the device in standalone mode for use with HMAC(SHA256):
+
+.B "integritysetup format <device> \-\-tag\-size 32 \-\-integrity hmac\-sha256 \
+\-\-integrity\-key\-file <keyfile> \-\-integrity\-key\-size <key_bytes>"
+
+Open (activate) the device with HMAC(SHA256) and HMAC key in file:
+
+.B "integritysetup open <device> test \-\-integrity hmac\-sha256 \
+\-\-integrity\-key\-file <keyfile> \-\-integrity\-key\-size <key_bytes>"
+
+Dump dm-integrity superblock information:
+
+.B "integritysetup dump <device>"
+
+.SH REPORTING BUGS
+Report bugs, including ones in the documentation, on
+the cryptsetup mailing list at <dm-crypt@saout.de>
+or in the 'Issues' section on LUKS website.
+Please attach the output of the failed command with the
+\-\-debug option added.
+.SH AUTHORS
+The integritysetup tool is written by Milan Broz <gmazyland@gmail.com>
+and is part of the cryptsetup project.
+.SH COPYRIGHT
+Copyright \(co 2016-2020 Red Hat, Inc.
+.br
+Copyright \(co 2016-2020 Milan Broz
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+.SH SEE ALSO
+The project website at \fBhttps://gitlab.com/cryptsetup/cryptsetup\fR
+
+The integrity on-disk format specification available at
+\fBhttps://gitlab.com/cryptsetup/cryptsetup/wikis/DMIntegrity\fR
index 15dd963..d907e1b 100644 (file)
@@ -1,4 +1,4 @@
-.TH VERITYSETUP "8" "December 2013" "veritysetup" "Maintenance Commands"
+.TH VERITYSETUP "8" "January 2019" "veritysetup" "Maintenance Commands"
 .SH NAME
 veritysetup - manage dm-verity (block level verification) volumes
 .SH SYNOPSIS
@@ -30,14 +30,18 @@ If hash device path doesn't exist, it will be created as file.
 \-\-data-block-size, \-\-hash-block-size, \-\-data-blocks, \-\-hash-offset,
 \-\-salt, \-\-uuid]
 .PP
-\fIcreate\fR <name> <data_device> <hash_device> <root_hash>
+\fIopen\fR <data_device> <name> <hash_device> <root_hash>
+.br
+\fIcreate\fR <name> <data_device> <hash_device> <root_hash>  (\fBOBSOLETE syntax\fR)
 .IP
 Creates a mapping with <name> backed by device <data_device> and using
 <hash_device> for in-kernel verification.
 
 The <root_hash> is a hexadecimal string.
 
-\fB<options>\fR can be [\-\-hash-offset, \-\-no-superblock]
+\fB<options>\fR can be [\-\-hash-offset, \-\-no-superblock,
+\-\-ignore-corruption or \-\-restart-on-corruption, \-\-ignore-zero-blocks,
+\-\-check-at-most-once, \-\-root-hash-signature]
 
 If option \-\-no-superblock is used, you have to use as the same options
 as in initial format operation.
@@ -55,9 +59,12 @@ The <root_hash> is a hexadecimal string.
 If option \-\-no-superblock is used, you have to use as the same options
 as in initial format operation.
 .PP
-\fIremove\fR <name>
+\fIclose\fR <name>
 .IP
 Removes existing mapping <name>.
+
+For backward compatibility there is \fBremove\fR command alias
+for \fBclose\fR command.
 .PP
 \fIstatus\fR <name>
 .IP
@@ -82,7 +89,7 @@ Create or use dm-verity without permanent on-disk superblock.
 .TP
 .B "\-\-format=number"
 Specifies the hash version type.
-Format type 0 is original Chrome OS verion. Format type 1 is current version.
+Format type 0 is original Chrome OS version. Format type 1 is current version.
 .TP
 .B "\-\-data-block-size=bytes"
 Used block size for the data device.
@@ -110,14 +117,97 @@ Use the provided UUID for format command instead of generating new one.
 The UUID must be provided in standard UUID format,
 e.g. 12345678-1234-1234-1234-123456789abc.
 .TP
+.B "\-\-ignore-corruption", "\-\-restart-on-corruption"
+Defines what to do if data integrity problem is detected (data corruption).
+
+Without these options kernel fails the IO operation with I/O error.
+With \-\-ignore-corruption option the corruption is only logged.
+With \-\-restart-on-corruption the kernel is restarted immediately.
+(You have to provide way how to avoid restart loops.)
+
+\fBWARNING:\fR Use these options only for very specific cases.
+These options are available since Linux kernel version 4.1.
+.TP
+.B "\-\-ignore-zero-blocks"
+Instruct kernel to not verify blocks that are expected to contain zeroes
+and always directly return zeroes instead.
+
+\fBWARNING:\fR Use this option only in very specific cases.
+This option is available since Linux kernel version 4.5.
+.TP
+.B "\-\-check-at-most-once"
+Instruct kernel to verify blocks only the first time they are read
+from the data device, rather than every time.
+
+\fBWARNING:\fR It provides a reduced level of security because only
+offline tampering of the data device's content will be detected,
+not online tampering.
+This option is available since Linux kernel version 4.17.
+.TP
+.B "\-\-hash=hash"
+Hash algorithm for dm-verity. For default see \-\-help option.
+.TP
 .B "\-\-version"
 Show the program version.
+.TP
+.B "\-\-fec-device=fec_device"
+Use forward error correction (FEC) to recover from corruption if hash verification fails.
+Use encoding data from the specified device.
+
+The fec device argument can be block device or file image.
+For format, if fec device path doesn't exist, it will be created as file.
+
+Note: block sizes for data and hash devices must match. Also, if the verity data_device is encrypted the fec_device should be too.
+.TP
+.B "\-\-fec-offset=bytes"
+This is the offset, in bytes, from the start of the FEC device to the beginning of the encoding data.
+.TP
+.B "\-\-fec-roots=num"
+Number of generator roots. This equals to the number of parity bytes in the encoding data.
+In RS(M, N) encoding, the number of roots is M-N. M is 255 and M-N is between 2 and 24 (including).
+.TP
+.B "\-\-root-hash-signature=FILE"
+Path to roothash signature file used to verify the root hash (in kernel).
+This feature requires Linux kernel version 5.4 or more recent.
+.TP
 .SH RETURN CODES
 Veritysetup returns 0 on success and a non-zero value on error.
 
-Error codes are: 1 wrong parameters, 2 no permission,
-3 out of memory, 4 wrong device specified, 5 device already exists
-or device is busy.
+Error codes are:
+    1 wrong parameters
+    2 no permission
+    3 out of memory
+    4 wrong device specified
+    5 device already exists or device is busy.
+
+.SH EXAMPLES
+.B "veritysetup \-\-data-blocks=256 format <data_device> <hash_device>"
+
+Calculates and stores verification data on hash_device for the first 256 blocks (of block-size).
+If hash_device does not exist, it is created (as file image).
+
+.B "veritysetup format <data_device> <hash_device>"
+
+Calculates and stores verification data on hash_device for the whole data_device.
+
+.B "veritysetup \-\-data-blocks=256 \-\-hash-offset=1052672 format <device> <device>"
+
+Verification data (hashes) is stored on the same device as data (starting at hash-offset).
+Hash-offset must be greater than number of blocks in data-area.
+
+.B "veritysetup \-\-data-blocks=256 \-\-hash-offset=1052672 create test-device <device> <device> <root_hash>"
+
+Activates the verity device named test-device. Options \-\-data-blocks and \-\-hash-offset are the same
+as in the format command. The <root_hash> was calculated in format command.
+
+.B "veritysetup \-\-data-blocks=256 \-\-hash-offset=1052672 verify <data_device> <hash_device> <root_hash>"
+
+Verifies device without activation (in userspace).
+
+.B "veritysetup \-\-fec-device=<fec_device> \-\-fec-roots=10 format <data_device> <hash_device>"
+
+Calculates and stores verification and encoding data for data_device.
+
 .SH REPORTING BUGS
 Report bugs, including ones in the documentation, on
 the cryptsetup mailing list at <dm-crypt@saout.de>
@@ -130,9 +220,9 @@ The first implementation of veritysetup was written by Chrome OS authors.
 This version is based on verification code written by Mikulas Patocka <mpatocka@redhat.com>
 and rewritten for libcryptsetup by Milan Broz <gmazyland@gmail.com>.
 .SH COPYRIGHT
-Copyright \(co 2012-2013 Red Hat, Inc.
+Copyright \(co 2012-2020 Red Hat, Inc.
 .br
-Copyright \(co 2012-2014 Milan Broz
+Copyright \(co 2012-2020 Milan Broz
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
index 8f4b1c9..fc6aa44 100644 (file)
@@ -13,7 +13,7 @@ luks|tcrypt specified device type (LUKS or TrueCrypt)
 cpus - number of processes to start in parallel
 
 Format of dictionary file is simple one password per line,
-if first char on line s # it is skiped as comment.
+if first char on line is # it is skipped as comment.
 
 For LUKS, you have it run as root (device-mapper cannot
 create dmcrypt devices as nrmal user. Code need
index 6811662..c80d502 100644 (file)
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
 
        /*
         * Need to create temporary keyslot device-mapper devices and allocate loop if needed,
-        * so root is requried here.
+        * so root is required here.
         */
        if (getuid() != 0) {
                printf("You must be root to run this program.\n");
index 43b1146..0672949 100644 (file)
@@ -2,18 +2,20 @@ Example of simple dracut module for reencryption of system
 LUKS drive on-the-fly.
 
 Install in /usr/[share|lib]/dracut/modules.d/90reencrypt, then
-build special intramfs "with dracut -a reencrypt -o crypt".
+build special initramfs "with dracut -a reencrypt -o crypt".
 Reencrypt module doesn't work (has a conflict) with crypt module as
-of now. After successfull reencryption reboot using original initramfs.
+of now. After successful reencryption reboot using original initramfs.
 
 Dracut then recognize argument rd.luks.reencrypt=name:size,
 e.g. rd.luks.reencrypt=sda2:52G means only 52G of device
 will be reencrypted (default is whole device).
 (Name is kernel name of device.)
 
-Also, you may specify keyslot which you want to use for reencryption,
-rd.luks.reencrypt_keyslot=<keyslot_number>. Bear in mind that if you
-use this option, all other keyslots will be deactivated.
+If there's more than single active keyslot in the target luks device
+you're required to select one keyslot explicitly for reencryption via
+rd.luks.reencrypt_keyslot=<keyslot_number> option. Bear in mind that
+if you use this option, all other keyslots will get deactivated in the
+process.
 
 Another argument, rd.luks.reencrypt_key=/dev/sda:/path/to/keyfile
 can be used to read password for specific keyslot from device containing
index 5d03d21..fcd7c92 100755 (executable)
@@ -24,6 +24,9 @@ install() {
 
     dracut_install cryptsetup-reencrypt
 
+    # moddir variable is assigned in dracut general shell lib
+    # shellcheck disable=SC2154
     inst_hook cmdline 30 "$moddir/parse-reencrypt.sh"
     inst_simple "$moddir"/reencrypt.sh /sbin/reencrypt
+    inst_simple "$moddir"/reencrypt-verbose.sh /sbin/cryptsetup-reencrypt-verbose
 }
index 8fbd44b..5fec191 100755 (executable)
@@ -1,7 +1,9 @@
 #!/bin/sh
 
 REENC=$(getargs rd.luks.reencrypt=)
+# shellcheck disable=SC2086
 REENC_DEV=$(echo $REENC | sed 's/:.*//')
+# shellcheck disable=SC2086
 REENC_SIZE=$(echo $REENC | sed -n 's/.*://p')
 
 REENC_KEY=$(getargs rd.luks.reencrypt_key=)
@@ -14,14 +16,23 @@ if [ -z "$REENC_SLOT" ] ; then
     REENC_SLOT=any
 fi
 
+# shellcheck disable=SC2086
+# shellcheck disable=SC1004
+# shellcheck disable=SC2016
 if [ -n "$REENC_DEV" ] ; then
 {
    printf 'SUBSYSTEM!="block", GOTO="reenc_end"\n'
    printf 'ACTION!="add|change", GOTO="reenc_end"\n'
-   printf 'KERNEL!="%s", GOTO="reenc_end"\n' $REENC_DEV
+   printf 'KERNEL=="%s", ' $REENC_DEV
    printf 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue \
-           --unique --onetime --name crypt-reencrypt-%%k \
+           --unique --onetime --settled --name crypt-reencrypt-%%k \
+           /sbin/reencrypt $env{DEVNAME} %s"\n' "$REENC_KEY $REENC_SLOT $REENC_SIZE"
+
+   printf 'ENV{ID_FS_UUID}=="*%s*", ' $REENC_DEV
+   printf 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue \
+           --unique --onetime --settled --name crypt-reencrypt-%%k \
            /sbin/reencrypt $env{DEVNAME} %s"\n' "$REENC_KEY $REENC_SLOT $REENC_SIZE"
    printf 'LABEL="reenc_end"\n'
 } > /etc/udev/rules.d/69-reencryption.rules
+   initqueue --unique --finished --name crypt-reencrypt-finished-${REENC_DEV} [ -e /tmp/reencrypted ]
 fi
diff --git a/misc/dracut_90reencrypt/reencrypt-verbose.sh b/misc/dracut_90reencrypt/reencrypt-verbose.sh
new file mode 100755 (executable)
index 0000000..109ce6e
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Route stdout to stderr in initrd. Otherwise output is invisible
+# unless we run in debug mode.
+# shellcheck disable=SC2068
+/sbin/cryptsetup-reencrypt $@ 1>&2
index c82f27e..db09e64 100755 (executable)
@@ -18,7 +18,7 @@ else
     device="$1"
 fi
 
-PARAMS="$device -T 1 --use-fsync -B 32"
+PARAMS="$device -T 1 --use-fsync --progress-frequency 5 -B 32"
 if [ "$3" != "any" ]; then
     PARAMS="$PARAMS -S $3"
 fi
@@ -28,30 +28,33 @@ if [ -n "$4" ]; then
 fi
 
 reenc_readkey() {
-    local keypath="${1#*:}"
-    local keydev="${1%%:*}"
+    keypath="${1#*:}"
+    keydev="${1%%:*}"
 
-    local mntp="/tmp/reencrypted-mount-tmp"
+    mntp="/tmp/reencrypted-mount-tmp"
     mkdir "$mntp"
     mount -r "$keydev" "$mntp" && cat "$mntp/$keypath"
     umount "$mntp"
     rm -r "$mntp"
 }
 
+# shellcheck disable=SC2086
+# shellcheck disable=SC2164
 reenc_run() {
-    local cwd=$(pwd)
-    local _prompt="LUKS password for REENCRYPTING $device"
+    cwd=$(pwd)
+    _prompt="LUKS password for REENCRYPTING $device"
     cd /tmp
+    udevadm settle
     if [ "$1" = "none" ] ; then
        if [ "$2" != "any" ]; then
                _prompt="$_prompt, using keyslot $2"
        fi
         /bin/plymouth ask-for-password \
         --prompt "$_prompt" \
-        --command="/sbin/cryptsetup-reencrypt $PARAMS"
+        --command="/sbin/cryptsetup-reencrypt-verbose $PARAMS"
     else
         info "REENCRYPT using key $1"
-        reenc_readkey "$1" | /sbin/cryptsetup-reencrypt -d - $PARAMS
+        reenc_readkey "$1" | /sbin/cryptsetup-reencrypt-verbose -d - $PARAMS
     fi
     _ret=$?
     cd $cwd
@@ -59,12 +62,14 @@ reenc_run() {
 
 info "REENCRYPT $device requested"
 # flock against other interactive activities
+# shellcheck disable=SC2086
 { flock -s 9;
     reenc_run $2 $3
 } 9>/.console_lock
 
 if [ $_ret -eq 0 ]; then
     # do not ask again
+    # shellcheck disable=SC2188
     >> /tmp/reencrypted
     warn "Reencryption of device $device has finished successfully. Use previous"
     warn "initramfs image (without reencrypt module) to boot the system. When"
index fa284aa..d05aad8 100644 (file)
@@ -61,7 +61,7 @@ const char *help =
 "            the threshold down to reduce misdetection. For values\n"
 "            larger than the default you need to adjust the threshold\n"
 "            up to retain sensitivity.\n"
-"  -v        Print found suspicuous sectors verbosely. \n"
+"  -v        Print found suspicious sectors verbosely. \n"
 "  -d        Print decimal addresses instead of hex ones.\n"
 "\n";
 
@@ -321,8 +321,8 @@ int main(int argc, char **argv)
        device = argv[optind];
 
        /* test whether we can open and read device */
-       /* This is neded as we are reading the actual data
-       * in the keyslots dirtectly from the LUKS container.
+       /* This is needed as we are reading the actual data
+       * in the keyslots directly from the LUKS container.
        */
        f_luks = open(device, O_RDONLY);
        if (f_luks == -1) {
diff --git a/misc/luks2_keyslot_example/Makefile b/misc/luks2_keyslot_example/Makefile
new file mode 100644 (file)
index 0000000..777eafa
--- /dev/null
@@ -0,0 +1,24 @@
+TARGET=keyslot_test
+CFLAGS=-O0 -g -Wall -D_GNU_SOURCE -I ../../lib/
+LDLIBS=-ljson-c -luuid -lgcrypt -ldevmapper -lpthread -lssh
+CC=gcc
+
+TARGET2=keyslot_test_remote_pass
+
+SOURCES=keyslot_test.c
+OBJECTS=$(SOURCES:.c=.o)
+SOURCES2=keyslot_test_remote_pass.c
+OBJECTS2=$(SOURCES2:.c=.o)
+
+all: $(TARGET) $(TARGET2) $(TARGET4)
+
+$(TARGET): $(OBJECTS) ../../.libs/libcryptsetup.a
+       $(CC) -o $@ $^ $(LDLIBS)
+
+$(TARGET2): $(OBJECTS2) ../../.libs/libcryptsetup.a
+       $(CC) -o $@ $^ $(LDLIBS)
+
+clean:
+       rm -f *.o *~ core $(TARGET) $(TARGET2)
+
+.PHONY: clean
diff --git a/misc/luks2_keyslot_example/README b/misc/luks2_keyslot_example/README
new file mode 100644 (file)
index 0000000..ac4ab6b
--- /dev/null
@@ -0,0 +1,3 @@
+to create LUKSv2 container run:
+
+$(top_level_dir)/src/cryptsetup --type luks2 luksFormat /dev/xxx
diff --git a/misc/luks2_keyslot_example/keyslot_test.c b/misc/luks2_keyslot_example/keyslot_test.c
new file mode 100644 (file)
index 0000000..a19cd29
--- /dev/null
@@ -0,0 +1,409 @@
+/*
+ * Example of LUKS2 kesylot handler (EXAMPLE)
+ *
+ * Copyright (C) 2016-2020 Milan Broz <gmazyland@gmail.com>
+ *
+ * Use:
+ *  - generate LUKS device
+ *  - store passphrase used in previous step remotely (single line w/o \r\n)
+ *  - add new token using this example
+ *  - activate device by token
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <json-c/json.h>
+#include <libssh/libssh.h>
+#include <libssh/sftp.h>
+#include "libcryptsetup.h"
+
+#define TOKEN_NUM 0
+
+#define PASSWORD_LENGTH 8192
+
+typedef int (*password_cb_func) (char **password);
+
+static json_object *get_token_jobj(struct crypt_device *cd, int token)
+{
+       const char *json_slot;
+
+       /* libcryptsetup API call */
+       if (crypt_token_json_get(cd, token, &json_slot))
+               return NULL;
+
+       return json_tokener_parse(json_slot);
+}
+
+static int download_remote_password(struct crypt_device *cd, ssh_session ssh,
+                                   const char *path, char **password,
+                                   size_t *password_len)
+{
+       char *pass;
+       size_t pass_len;
+       int r;
+       sftp_attributes sftp_attr = NULL;
+       sftp_session sftp = NULL;
+       sftp_file file = NULL;
+
+
+       sftp = sftp_new(ssh);
+       if (!sftp) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot create sftp session: ");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       r = sftp_init(sftp);
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot init sftp session: ");
+               goto out;
+       }
+
+       file = sftp_open(sftp, path, O_RDONLY, 0);
+       if (!file) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot create sftp session: ");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       sftp_attr = sftp_fstat(file);
+       if (!sftp_attr) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot stat sftp file: ");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       pass_len = sftp_attr->size > PASSWORD_LENGTH ? PASSWORD_LENGTH : sftp_attr->size;
+       pass = malloc(pass_len);
+       if (!pass) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Not enough memory.\n");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       r = sftp_read(file, pass, pass_len);
+       if (r < 0 || (size_t)r != pass_len) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot read remote key: ");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       *password = pass;
+       *password_len = pass_len;
+
+       r = SSH_OK;
+out:
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, ssh_get_error(ssh));
+               crypt_log(cd, CRYPT_LOG_ERROR, "\n");
+               free(pass);
+       }
+
+       if (sftp_attr)
+               sftp_attributes_free(sftp_attr);
+
+       if (file)
+               sftp_close(file);
+       if (sftp)
+               sftp_free(sftp);
+       return r == SSH_OK ? 0 : -EINVAL;
+}
+
+static ssh_session ssh_session_init(struct crypt_device *cd,
+                                   const char *host,
+                                   const char *user)
+{
+       int r, port = 22;
+       ssh_session ssh = ssh_new();
+       if (!ssh)
+               return NULL;
+
+       ssh_options_set(ssh, SSH_OPTIONS_HOST, host);
+       ssh_options_set(ssh, SSH_OPTIONS_USER, user);
+       ssh_options_set(ssh, SSH_OPTIONS_PORT, &port);
+
+       crypt_log(cd, CRYPT_LOG_NORMAL, "Initiating ssh session.\n");
+
+       r = ssh_connect(ssh);
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Connection failed: ");
+               goto out;
+       }
+
+       r = ssh_is_server_known(ssh);
+       if (r != SSH_SERVER_KNOWN_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Server not known: ");
+               r = SSH_AUTH_ERROR;
+               goto out;
+       }
+
+       r = SSH_OK;
+
+       /* initialise list of authentication methods. yes, according to official libssh docs... */
+       ssh_userauth_none(ssh, NULL);
+out:
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, ssh_get_error(ssh));
+               crypt_log(cd, CRYPT_LOG_ERROR, "\n");
+               ssh_disconnect(ssh);
+               ssh_free(ssh);
+               ssh = NULL;
+       }
+
+       return ssh;
+}
+
+static void ssh_session_close(ssh_session ssh)
+{
+       if (ssh) {
+               ssh_disconnect(ssh);
+               ssh_free(ssh);
+       }
+}
+
+static int _public_key_auth(struct crypt_device *cd, ssh_session ssh)
+{
+       int r;
+       ssh_key pkey = NULL;
+
+       crypt_log(cd, CRYPT_LOG_DEBUG, "Trying public key authentication method.\n");
+
+       if (!(ssh_userauth_list(ssh, NULL) & SSH_AUTH_METHOD_PUBLICKEY)) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Public key auth method not allowed on host.\n");
+               return SSH_AUTH_ERROR;
+       }
+
+       r = ssh_pki_import_privkey_file("/home/user/.ssh/id_rsa", NULL, NULL, NULL, &pkey);
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Failed to import private key\n");
+
+               return r;
+       }
+
+       r = ssh_userauth_try_publickey(ssh, NULL, pkey);
+       if (r == SSH_AUTH_SUCCESS) {
+               crypt_log(cd, CRYPT_LOG_DEBUG, "Public key method accepted.\n");
+               r = ssh_userauth_publickey(ssh, NULL, pkey);
+       }
+
+       ssh_key_free(pkey);
+
+       if (r != SSH_AUTH_SUCCESS) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Public key authentication error: ");
+               crypt_log(cd, CRYPT_LOG_ERROR, ssh_get_error(ssh));
+               crypt_log(cd, CRYPT_LOG_ERROR, "\n");
+       }
+
+       return r;
+}
+
+static int _password_auth(struct crypt_device *cd, ssh_session ssh, password_cb_func pcb)
+{
+       int r = SSH_AUTH_ERROR;
+       char *ssh_password = NULL;
+
+       if (!(ssh_userauth_list(ssh, NULL) & SSH_AUTH_METHOD_PASSWORD)) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Password auth method not allowed on host.\n");
+               return r;
+       }
+
+       if (pcb(&ssh_password)) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Failed to process password.\n");
+               return r;
+       }
+
+       r = ssh_userauth_password(ssh, NULL, ssh_password);
+
+       free(ssh_password);
+
+       if (r != SSH_AUTH_SUCCESS) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Password authentication error: ");
+               crypt_log(cd, CRYPT_LOG_ERROR, ssh_get_error(ssh));
+               crypt_log(cd, CRYPT_LOG_ERROR, "\n");
+       }
+
+       return r;
+}
+
+static int SSHTEST_token_open(struct crypt_device *cd,
+       int token,
+       char **password,
+       size_t *password_len,
+       void *usrptr)
+{
+       int r;
+       json_object *jobj_server, *jobj_user, *jobj_path, *jobj_token;
+       ssh_session ssh;
+       password_cb_func pcb = usrptr; /* custom password callback */
+
+       jobj_token = get_token_jobj(cd, token);
+       json_object_object_get_ex(jobj_token, "ssh_server", &jobj_server);
+       json_object_object_get_ex(jobj_token, "ssh_user",   &jobj_user);
+       json_object_object_get_ex(jobj_token, "ssh_path",   &jobj_path);
+
+       ssh = ssh_session_init(cd, json_object_get_string(jobj_server),
+                              json_object_get_string(jobj_user));
+       if (!ssh)
+               return -EINVAL;
+
+       r = _public_key_auth(cd, ssh);
+
+       /* try password method fallback. superficial example use case for an usrptr */
+       if (r != SSH_AUTH_SUCCESS && pcb) {
+               crypt_log(cd, CRYPT_LOG_DEBUG, "Trying password method instead.\n");
+               r = _password_auth(cd, ssh, pcb);
+       }
+
+       if (r == SSH_AUTH_SUCCESS)
+               r = download_remote_password(cd, ssh, json_object_get_string(jobj_path),
+                                            password, password_len);
+
+       ssh_session_close(ssh);
+
+       return r ? -EINVAL : r;
+}
+
+const crypt_token_handler SSHTEST_token = {
+       .name  = "sshkeytest",
+       .open  = SSHTEST_token_open,
+};
+
+static int token_add(const char *device, const char *server,
+                  const char *user, const char *path)
+{
+       struct crypt_device *cd = NULL;
+       json_object *jobj = NULL, *jobj_keyslots;
+       int r;
+
+       r = crypt_token_register(&SSHTEST_token);
+       if (r < 0)
+               return EXIT_FAILURE;
+
+       r = crypt_init(&cd, device);
+       if (r < 0)
+               return EXIT_FAILURE;
+
+       r = crypt_load(cd, CRYPT_LUKS2, NULL);
+       if (r < 0) {
+               crypt_free(cd);
+               return EXIT_FAILURE;
+       }
+
+       jobj = json_object_new_object();
+       json_object_object_add(jobj, "type", json_object_new_string(SSHTEST_token.name)); /* mandatory */
+
+       jobj_keyslots = json_object_new_array();
+       json_object_array_add(jobj_keyslots, json_object_new_string("0")); /* assign to first keyslot only */
+       json_object_object_add(jobj, "keyslots", jobj_keyslots); /* mandatory array field (may be empty and assigned later */
+
+       /* custom metadata */
+       json_object_object_add(jobj, "ssh_server", json_object_new_string(server));
+       json_object_object_add(jobj, "ssh_user", json_object_new_string(user));
+       json_object_object_add(jobj, "ssh_path", json_object_new_string(path));
+
+       /* libcryptsetup API call */
+       r = crypt_token_json_set(cd, TOKEN_NUM, json_object_to_json_string_ext(jobj, JSON_C_TO_STRING_PLAIN));
+
+       crypt_free(cd);
+       json_object_put(jobj);
+
+       return EXIT_SUCCESS;
+}
+
+
+/* naive implementation of password prompt. Yes it will print out the password on input :) */
+static int ssh_password_callback(char **ssh_password)
+{
+       ssize_t i;
+       char *pass = malloc(512);
+
+       if (!pass)
+               return -ENOMEM;
+
+       fprintf(stdout, "Host asks for password:\n");
+
+       i = read(STDIN_FILENO, pass, 512);
+       if (i > 0) {
+               pass[i-1] = '\0';
+               i = 0;
+       } else if (i == 0) { /* EOF */
+               *pass = '\0';
+               i = -1;
+       }
+
+       if (!i)
+               *ssh_password = pass;
+       else
+               free(pass);
+
+       return i;
+}
+
+static int open_by_token(const char *device, const char *name)
+{
+       struct crypt_device *cd = NULL;
+       int r;
+
+       r = crypt_token_register(&SSHTEST_token);
+       if (r < 0)
+               return EXIT_FAILURE;
+
+       r = crypt_init(&cd, device);
+       if (r < 0)
+               return EXIT_FAILURE;
+
+       r = crypt_load(cd, CRYPT_LUKS2, NULL);
+       if (r < 0) {
+               crypt_free(cd);
+               return EXIT_FAILURE;
+       }
+
+       r = crypt_activate_by_token(cd, name, TOKEN_NUM, ssh_password_callback, 0);
+
+       crypt_free(cd);
+       return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+static void keyslot_help(void)
+{
+       printf("Use parameters:\n add device server user path\n"
+               " open device name\n");
+       exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+       crypt_set_debug_level(CRYPT_LOG_DEBUG);
+
+       /* Adding slot to device */
+       if (argc == 6 && !strcmp("add", argv[1]))
+               return token_add(argv[2], argv[3], argv[4], argv[5]);
+
+       /* Key check without activation */
+       if (argc == 3 && !strcmp("open", argv[1]))
+               return open_by_token(argv[2], NULL);
+
+       /* Key check with activation (requires root) */
+       if (argc == 4 && !strcmp("open", argv[1]))
+               return open_by_token(argv[2], argv[3]);
+
+       keyslot_help();
+       return 1;
+}
diff --git a/misc/luks2_keyslot_example/keyslot_test_remote_pass.c b/misc/luks2_keyslot_example/keyslot_test_remote_pass.c
new file mode 100644 (file)
index 0000000..838cd6b
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * Example of LUKS2 token storing third party metadata (EXAMPLE)
+ *
+ * Copyright (C) 2016-2020 Milan Broz <gmazyland@gmail.com>
+ *
+ * Use:
+ *  - generate LUKS device
+ *  - store passphrase used in previous step remotely (single line w/o \n\r)
+ *  - add new token using this example
+ *  - activate device with passphrase recovered remotely using the example
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <json-c/json.h>
+#include <libssh/libssh.h>
+#include <libssh/sftp.h>
+#include "libcryptsetup.h"
+
+#define TOKEN_NUM 0
+#define TOKEN_TYPE "sshkeytest"
+
+#define PASSWORD_LENGTH 8192
+
+static json_object *get_token_jobj(struct crypt_device *cd, int token)
+{
+       const char *json_slot;
+
+       if (crypt_token_json_get(cd, token, &json_slot))
+               return NULL;
+
+       return json_tokener_parse(json_slot);
+}
+
+static int read_remote_passphrase(struct crypt_device *cd, const char *host,
+                          const char *user, const char *path,
+                          char *password, size_t password_size)
+{
+       ssh_session ssh = NULL;
+       sftp_session sftp = NULL;
+       sftp_file file = NULL;
+       ssh_key pkey = NULL;
+
+       int r, port = 22;
+
+       ssh = ssh_new();
+       if (!ssh)
+               return -EINVAL;
+
+       ssh_options_set(ssh, SSH_OPTIONS_HOST, host);
+       ssh_options_set(ssh, SSH_OPTIONS_USER, user);
+       ssh_options_set(ssh, SSH_OPTIONS_PORT, &port);
+
+       r = ssh_connect(ssh);
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Connection failed: ");
+               goto out;
+       }
+
+       r = ssh_is_server_known(ssh);
+       if (r != SSH_SERVER_KNOWN_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Server not known: ");
+               r = SSH_AUTH_ERROR;
+               goto out;
+       }
+
+       r = ssh_pki_import_privkey_file("/home/user/.ssh/id_rsa", NULL, NULL, NULL, &pkey);
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "error\n");
+               r = SSH_AUTH_ERROR;
+               goto out;
+       }
+
+       r = ssh_userauth_publickey(ssh, user, pkey);
+       /* or r = ssh_userauth_publickey_auto(ssh, user, NULL); */
+       if (r != SSH_AUTH_SUCCESS) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Public key authentication error: ");
+               goto out;
+       }
+
+       sftp = sftp_new(ssh);
+       if (!sftp) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot create sftp session: ");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       r = sftp_init(sftp);
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot init sftp session: ");
+               goto out;
+       }
+
+       file = sftp_open(sftp, path, O_RDONLY, 0);
+       if (!file) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot create sftp session: ");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       r = sftp_read(file, password, password_size);
+       if (r < 1 || (size_t)r >= password_size) {
+               crypt_log(cd, CRYPT_LOG_ERROR, "Cannot read remote password: ");
+               r = SSH_FX_FAILURE;
+               goto out;
+       }
+
+       r = SSH_OK;
+out:
+       if (r != SSH_OK) {
+               crypt_log(cd, CRYPT_LOG_ERROR, ssh_get_error(ssh));
+               crypt_log(cd, CRYPT_LOG_ERROR, "\n");
+       }
+
+       if (pkey)
+               ssh_key_free(pkey);
+
+       if (file)
+               sftp_close(file);
+       if (sftp)
+               sftp_free(sftp);
+       ssh_disconnect(ssh);
+       ssh_free(ssh);
+       return r == SSH_OK ? 0 : -EINVAL;
+}
+
+static int token_add(const char *device, const char *server,
+                  const char *user, const char *path)
+{
+       struct crypt_device *cd = NULL;
+       json_object *jobj = NULL, *jobj_keyslots;
+       int r;
+
+       r = crypt_init(&cd, device);
+       if (r < 0)
+               return EXIT_FAILURE;
+
+       r = crypt_load(cd, CRYPT_LUKS2, NULL);
+       if (r < 0) {
+               crypt_free(cd);
+               return EXIT_FAILURE;
+       }
+
+       jobj = json_object_new_object();
+
+       /* 'type' is mandatory field */
+       json_object_object_add(jobj, "type", json_object_new_string(TOKEN_TYPE));
+
+       /* 'keyslots' is mandatory field (may be empty) */
+       jobj_keyslots = json_object_new_array();
+       json_object_array_add(jobj_keyslots, json_object_new_string("0"));
+       json_object_array_add(jobj_keyslots, json_object_new_string("1"));
+       json_object_object_add(jobj, "keyslots", jobj_keyslots);
+
+       /* third party values */
+       json_object_object_add(jobj, "ssh_server", json_object_new_string(server));
+       json_object_object_add(jobj, "ssh_user", json_object_new_string(user));
+       json_object_object_add(jobj, "ssh_path", json_object_new_string(path));
+
+       r = crypt_token_json_set(cd, TOKEN_NUM, json_object_to_json_string_ext(jobj, JSON_C_TO_STRING_PLAIN));
+
+       crypt_free(cd);
+       json_object_put(jobj);
+
+       return EXIT_SUCCESS;
+}
+
+static int download_remote_password(struct crypt_device *cd, char *password, size_t password_len)
+{
+       json_object *jobj_server, *jobj_user, *jobj_path, *jobj_keyslot;
+
+       /* get token json object representation as string */
+       jobj_keyslot = get_token_jobj(cd, TOKEN_NUM);
+       if (!jobj_keyslot)
+               return -EINVAL;
+
+
+       /* extract third party metadata necessary to extract passphrase remotely */
+       json_object_object_get_ex(jobj_keyslot, "ssh_server", &jobj_server);
+       json_object_object_get_ex(jobj_keyslot, "ssh_user",   &jobj_user);
+       json_object_object_get_ex(jobj_keyslot, "ssh_path",   &jobj_path);
+
+       return read_remote_passphrase(cd, json_object_get_string(jobj_server),
+                                   json_object_get_string(jobj_user),
+                                   json_object_get_string(jobj_path),
+                                   password, password_len);
+}
+
+static int open_by_remote_password(const char *device, const char *name)
+{
+       char password[PASSWORD_LENGTH+1];
+       struct crypt_device *cd = NULL;
+       int r;
+
+       r = crypt_init(&cd, device);
+       if (r < 0)
+               return EXIT_FAILURE;
+
+       r = crypt_load(cd, CRYPT_LUKS2, NULL);
+       if (r < 0) {
+               crypt_free(cd);
+               return EXIT_FAILURE;
+       }
+
+       /* custom routines to acquire password */
+       r = download_remote_password(cd, password, sizeof(password));
+       if (r < 0) {
+               crypt_free(cd);
+               return EXIT_FAILURE;
+       }
+
+       password[PASSWORD_LENGTH] = '\0';
+
+       /* open first genuine LUKS2 keyslot available provided the password matches */
+       /* for the sake of simplicity password is a string */
+       r = crypt_activate_by_passphrase(cd, name, CRYPT_ANY_SLOT, password, strlen(password), 0);
+
+       crypt_free(cd);
+       return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+static void keyslot_help(void)
+{
+       printf("Use parameters:\n add device server user path\n"
+               " open device name\n");
+       exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+       crypt_set_debug_level(CRYPT_LOG_DEBUG);
+
+       /* Adding slot to device */
+       if (argc == 6 && !strcmp("add", argv[1]))
+               return token_add(argv[2], argv[3], argv[4], argv[5]);
+
+       /* Password check without activation */
+       if (argc == 3 && !strcmp("open", argv[1]))
+               return open_by_remote_password(argv[2], NULL);
+
+       /* Password check with activation (requires root) */
+       if (argc == 4 && !strcmp("open", argv[1]))
+               return open_by_remote_password(argv[2], argv[3]);
+
+       keyslot_help();
+       return 1;
+}
diff --git a/missing b/missing
index db98974..8d0eaad 100755 (executable)
--- a/missing
+++ b/missing
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2013-10-28.13; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -101,9 +101,9 @@ else
   exit $st
 fi
 
-perl_URL=http://www.perl.org/
-flex_URL=http://flex.sourceforge.net/
-gnu_software_URL=http://www.gnu.org/software
+perl_URL=https://www.perl.org/
+flex_URL=https://github.com/westes/flex
+gnu_software_URL=https://www.gnu.org/software
 
 program_details ()
 {
@@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \
 exit $st
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
index 3942a0f..fa53b7b 100644 (file)
@@ -1,12 +1,18 @@
 cs
+da
 de
 es
 fi
 fr
 id
 it
+ja
 nl
 pl
+pt_BR
+ru
+sr
 sv
 uk
 vi
+zh_CN
index 2ed49e6..fabdc76 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for PO directory in any package using GNU gettext.
-# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
 #
 # This file can be copied and used freely without restrictions.  It can
 # be used in projects which are not available under the GNU General Public
@@ -8,12 +8,14 @@
 # Please note that the actual code of GNU gettext is covered by the GNU
 # General Public License and is *not* in the public domain.
 #
-# Origin: gettext-0.15
+# Origin: gettext-0.18.3
+GETTEXT_MACRO_VERSION = 0.18
 
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 
+SED = @SED@
 SHELL = /bin/sh
 @SET_MAKE@
 
@@ -30,7 +32,17 @@ gettextsrcdir = $(datadir)/gettext/po
 
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
+
+# We use $(mkdir_p).
+# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
+# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
+# @install_sh@ does not start with $(SHELL), so we add it.
+# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
+# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
+# versions, $(mkinstalldirs) and $(install_sh) are unused.
 mkinstalldirs = $(SHELL) @install_sh@ -d
+install_sh = $(SHELL) @install_sh@
+MKDIR_P = @MKDIR_P@
 mkdir_p = @mkdir_p@
 
 GMSGFMT_ = @GMSGFMT@
@@ -77,8 +89,8 @@ CATALOGS = @CATALOGS@
 .po.gmo:
        @lang=`echo $* | sed -e 's,.*/,,'`; \
        test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
-       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
-       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
+       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
 
 .sin.sed:
        sed -e '/^#/d' $< > t-$@
@@ -90,6 +102,13 @@ all: all-@USE_NLS@
 all-yes: stamp-po
 all-no:
 
+# Ensure that the gettext macros and this Makefile.in.in are in sync.
+CHECK_MACRO_VERSION = \
+       test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
+         || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \
+              exit 1; \
+            }
+
 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
 # we don't want to bother translators with empty POT files). We assume that
@@ -105,6 +124,7 @@ all-no:
 # $(POFILES) has been designed to not touch files that don't need to be
 # changed.
 stamp-po: $(srcdir)/$(DOMAIN).pot
+       @$(CHECK_MACRO_VERSION)
        test ! -f $(srcdir)/$(DOMAIN).pot || \
          test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
        @test ! -f $(srcdir)/$(DOMAIN).pot || { \
@@ -119,17 +139,43 @@ stamp-po: $(srcdir)/$(DOMAIN).pot
 
 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
+# The determination of whether the package xyz is a GNU one is based on the
+# heuristic whether some file in the top level directory mentions "GNU xyz".
+# If GNU 'find' is available, we avoid grepping through monster files.
 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+       if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
+              LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
+            else \
+              LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
+            fi; \
+          } | grep -v 'libtool:' >/dev/null; then \
+         package_gnu='GNU '; \
+       else \
+         package_gnu=''; \
+       fi; \
        if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
          msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
        else \
          msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
        fi; \
-       $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
-         --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
-         --files-from=$(srcdir)/POTFILES.in \
-         --copyright-holder='$(COPYRIGHT_HOLDER)' \
-         --msgid-bugs-address="$$msgid_bugs_address"
+       case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
+         '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
+           $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+             --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
+             --files-from=$(srcdir)/POTFILES.in \
+             --copyright-holder='$(COPYRIGHT_HOLDER)' \
+             --msgid-bugs-address="$$msgid_bugs_address" \
+           ;; \
+         *) \
+           $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+             --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
+             --files-from=$(srcdir)/POTFILES.in \
+             --copyright-holder='$(COPYRIGHT_HOLDER)' \
+             --package-name="$${package_gnu}@PACKAGE@" \
+             --package-version='@VERSION@' \
+             --msgid-bugs-address="$$msgid_bugs_address" \
+           ;; \
+       esac
        test ! -f $(DOMAIN).po || { \
          if test -f $(srcdir)/$(DOMAIN).pot; then \
            sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
@@ -157,8 +203,15 @@ $(POFILES): $(srcdir)/$(DOMAIN).pot
        @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
        if test -f "$(srcdir)/$${lang}.po"; then \
          test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
-         echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
-         cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
+         echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
+         cd $(srcdir) \
+           && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
+                  '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
+                    $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
+                  *) \
+                    $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
+                esac; \
+              }; \
        else \
          $(MAKE) $${lang}.po-create; \
        fi
@@ -181,7 +234,6 @@ install-data: install-data-@USE_NLS@
        fi
 install-data-no: all
 install-data-yes: all
-       $(mkdir_p) $(DESTDIR)$(datadir)
        @catalogs='$(CATALOGS)'; \
        for cat in $$catalogs; do \
          cat=`basename $$cat`; \
@@ -233,7 +285,6 @@ installdirs-data: installdirs-data-@USE_NLS@
        fi
 installdirs-data-no:
 installdirs-data-yes:
-       $(mkdir_p) $(DESTDIR)$(datadir)
        @catalogs='$(CATALOGS)'; \
        for cat in $$catalogs; do \
          cat=`basename $$cat`; \
@@ -359,9 +410,15 @@ update-po: Makefile
        tmpdir=`pwd`; \
        echo "$$lang:"; \
        test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
-       echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+       echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
        cd $(srcdir); \
-       if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
+       if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
+              '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
+                $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
+              *) \
+                $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
+            esac; \
+          }; then \
          if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
            rm -f $$tmpdir/$$lang.new.po; \
          else \
@@ -382,9 +439,13 @@ $(DUMMYPOFILES):
 update-gmo: Makefile $(GMOFILES)
        @:
 
+# Recreate Makefile by invoking config.status. Explicitly invoke the shell,
+# because execution permission bits may not work on the current file system.
+# Use @SHELL@, which is the shell determined by autoconf for the use by its
+# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
        cd $(top_builddir) \
-         && $(SHELL) ./config.status $(subdir)/$@.in po-directories
+         && @SHELL@ ./config.status $(subdir)/$@.in po-directories
 
 force:
 
index d9e17fa..8940c0a 100644 (file)
@@ -10,6 +10,9 @@ top_builddir = ..
 # These options get passed to xgettext.
 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
 
+# This option gets passed to msgmerge.
+MSGMERGE_OPTIONS = --no-wrap
+
 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
 # package.  (Note that the msgstr strings, extracted from the package's
index 6d8f036..8c1f2b7 100644 (file)
@@ -2,20 +2,49 @@ lib/libdevmapper.c
 lib/random.c
 lib/setup.c
 lib/utils.c
+lib/volumekey.c
 lib/crypt_plain.c
 lib/utils_crypt.c
 lib/utils_loop.c
 lib/utils_fips.c
 lib/utils_device.c
+lib/utils_devpath.c
+lib/utils_pbkdf.c
+lib/utils_benchmark.c
+lib/utils_device_locking.c
+lib/utils_wipe.c
+lib/utils_keyring.c
+lib/utils_blkid.c
+lib/utils_io.c
+lib/utils_storage_wrappers.c
 lib/luks1/af.c
 lib/luks1/keyencryption.c
 lib/luks1/keymanage.c
 lib/loopaes/loopaes.c
 lib/tcrypt/tcrypt.c
+lib/bitlk/bitlk.c
 lib/verity/verity.c
 lib/verity/verity_hash.c
+lib/verity/verity_fec.c
+lib/integrity/integrity.c
+lib/luks2/luks2_digest.c
+lib/luks2/luks2_digest_pbkdf2.c
+lib/luks2/luks2_disk_metadata.c
+lib/luks2/luks2_json_format.c
+lib/luks2/luks2_json_metadata.c
+lib/luks2/luks2_keyslot.c
+lib/luks2/luks2_keyslot_luks2.c
+lib/luks2/luks2_keyslot_reenc.c
+lib/luks2/luks2_luks1_convert.c
+lib/luks2/luks2_reencrypt.c
+lib/luks2/luks2_segment.c
+lib/luks2/luks2_token.c
+lib/luks2/luks2_token_keyring.c
 src/cryptsetup.c
 src/veritysetup.c
+src/integritysetup.c
 src/cryptsetup_reencrypt.c
 src/utils_tools.c
 src/utils_password.c
+src/utils_luks2.c
+src/utils_blockdev.c
index 9c2a995..5931e53 100644 (file)
@@ -14,13 +14,13 @@ en@boldquot.po-update: en@boldquot.po-update-en
 
 .insert-header.po-update-en:
        @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
-       if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
+       if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
        tmpdir=`pwd`; \
        echo "$$lang:"; \
        ll=`echo $$lang | sed -e 's/@.*//'`; \
        LC_ALL=C; export LC_ALL; \
        cd $(srcdir); \
-       if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
+       if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
          if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
            rm -f $$tmpdir/$$lang.new.po; \
          else \
index 29494e1..571c909 100644 (file)
@@ -5,9 +5,9 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: cryptsetup 2.3.3\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,1745 +16,3900 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
 msgstr ""
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
 msgstr ""
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr ""
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr ""
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
 msgstr ""
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
 msgstr ""
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr ""
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
 "Please move mouse or type some text in another window to gather some random "
 "events.\n"
 msgstr ""
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr ""
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
 msgstr ""
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
 msgstr ""
 
-#: lib/random.c:211
-#, c-format
-msgid "Error %d reading from RNG: %s\n"
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr ""
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
 msgstr ""
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
 msgstr ""
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
 msgstr ""
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
+msgid "Hash algorithm %s not supported."
 msgstr ""
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
 #, c-format
-msgid "Key processing error (using hash %s).\n"
+msgid "Key processing error (using hash %s)."
 msgstr ""
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
 msgstr ""
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
 msgstr ""
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
 msgstr ""
 
-#: lib/setup.c:327
-#, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
 msgstr ""
 
-#: lib/setup.c:333
+#: lib/setup.c:434
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
 msgstr ""
 
-#: lib/setup.c:472
+#: lib/setup.c:440
 #, c-format
-msgid "Enter passphrase for %s: "
+msgid "Key slot %d is full, please select another one."
+msgstr ""
+
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
 msgstr ""
 
-#: lib/setup.c:653
+#: lib/setup.c:624
 #, c-format
-msgid "Header detected but device %s is too small.\n"
+msgid "Header detected but device %s is too small."
 msgstr ""
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
 msgstr ""
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr ""
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Device %s is not active.\n"
+msgid "Unsupported LUKS version %d."
+msgstr ""
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
 msgstr ""
 
-#: lib/setup.c:925
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
+msgid "Device %s is not active."
 msgstr ""
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
 msgstr ""
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
 msgstr ""
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
 msgstr ""
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
 msgstr ""
 
-#: lib/setup.c:1089
-#, c-format
-msgid "Cannot format device %s which is still in use.\n"
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
 msgstr ""
 
-#: lib/setup.c:1092
-#, c-format
-msgid "Cannot format device %s, permission denied.\n"
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
 msgstr ""
 
-#: lib/setup.c:1096
-#, c-format
-msgid "Cannot wipe header on device %s.\n"
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
 msgstr ""
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
 msgstr ""
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
 msgstr ""
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
+msgid "Cannot wipe header on device %s."
 msgstr ""
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
+#: lib/setup.c:1744
+msgid ""
+"WARNING: The device activation will fail, dm-crypt is missing support for "
+"requested encryption sector size.\n"
 msgstr ""
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
 msgstr ""
 
-#: lib/setup.c:1285
+#: lib/setup.c:1821
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
+msgid "Cipher %s-%s (key size %zd bits) is not available."
 msgstr ""
 
-#: lib/setup.c:1435
-msgid "Do you really want to change UUID of device?"
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
 msgstr ""
 
-#: lib/setup.c:1545
+#: lib/setup.c:1858
 #, c-format
-msgid "Volume %s is not active.\n"
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
 msgstr ""
 
-#: lib/setup.c:1556
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
 #, c-format
-msgid "Volume %s is already suspended.\n"
+msgid "Device %s is too small."
 msgstr ""
 
-#: lib/setup.c:1563
+#: lib/setup.c:1893 lib/setup.c:1919
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
+msgid "Cannot format device %s in use."
 msgstr ""
 
-#: lib/setup.c:1565
+#: lib/setup.c:1896 lib/setup.c:1922
 #, c-format
-msgid "Error during suspending device %s.\n"
+msgid "Cannot format device %s, permission denied."
 msgstr ""
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:1908 lib/setup.c:2229
 #, c-format
-msgid "Volume %s is not suspended.\n"
+msgid "Cannot format integrity for device %s."
 msgstr ""
 
-#: lib/setup.c:1605
+#: lib/setup.c:1926
 #, c-format
-msgid "Resume is not supported for device %s.\n"
+msgid "Cannot format device %s."
 msgstr ""
 
-#: lib/setup.c:1607 lib/setup.c:1659
-#, c-format
-msgid "Error during resuming device %s.\n"
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
 msgstr ""
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
 msgstr ""
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
 msgstr ""
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
 msgstr ""
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
 msgstr ""
 
-#: lib/setup.c:1798
-#, c-format
-msgid "Key slot %d changed.\n"
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
 msgstr ""
 
-#: lib/setup.c:1801
-#, c-format
-msgid "Replaced with key slot %d.\n"
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
 msgstr ""
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
 msgstr ""
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
 msgstr ""
 
-#: lib/setup.c:1961
+#: lib/setup.c:2208
 #, c-format
-msgid "Key slot %d is invalid.\n"
+msgid ""
+"WARNING: Requested tag size %d bytes differs from %s size output (%d "
+"bytes).\n"
 msgstr ""
 
-#: lib/setup.c:1966
+#: lib/setup.c:2286
 #, c-format
-msgid "Key slot %d is not used.\n"
+msgid "Unknown crypt device type %s requested."
 msgstr ""
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Device %s already exists.\n"
+msgid "Unsupported parameters on device %s."
 msgstr ""
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
 msgstr ""
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
 msgstr ""
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
 msgstr ""
 
-#: lib/setup.c:2259
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, c-format
-msgid "Device %s is still in use.\n"
+msgid "Failed to suspend device %s."
 msgstr ""
 
-#: lib/setup.c:2268
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
 #, c-format
-msgid "Invalid device %s.\n"
+msgid "Failed to resume device %s."
 msgstr ""
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
 msgstr ""
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
+#: lib/setup.c:2735 lib/setup.c:2737
+#, c-format
+msgid "Failed to switch device %s to dm-error."
 msgstr ""
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
 msgstr ""
 
-#: lib/setup.c:2310
-#, c-format
-msgid "This operation is not supported for %s crypt device.\n"
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
 msgstr ""
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
 msgstr ""
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
+#: lib/setup.c:3058
+#, c-format
+msgid "Volume %s is not active."
 msgstr ""
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
 msgstr ""
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
 msgstr ""
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
 msgstr ""
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
 msgstr ""
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
 msgstr ""
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
 msgstr ""
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
 msgstr ""
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
 msgstr ""
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
 msgstr ""
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
 msgstr ""
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
 msgstr ""
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
 msgstr ""
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
-#, c-format
-msgid "Device %s doesn't exist or access denied.\n"
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
 msgstr ""
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
 msgstr ""
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
 msgstr ""
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
 msgstr ""
 
-#: lib/utils_device.c:484
+#: lib/setup.c:4171
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
+msgid "Cannot use device %s, name is invalid or still in use."
 msgstr ""
 
-#: lib/utils_device.c:488
+#: lib/setup.c:4174
 #, c-format
-msgid "Cannot get info about device %s.\n"
+msgid "Device %s already exists."
 msgstr ""
 
-#: lib/utils_device.c:494
-#, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
 msgstr ""
 
-#: lib/utils_device.c:502
-#, c-format
-msgid "Device %s has zero size.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
 msgstr ""
 
-#: lib/utils_device.c:513
-#, c-format
-msgid "Device %s is too small.\n"
+#: lib/setup.c:4412
+msgid "Root hash signature required."
 msgstr ""
 
-#: lib/luks1/keyencryption.c:37
-#, c-format
-msgid ""
-"Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
 msgstr ""
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
 msgstr ""
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
 #, c-format
-msgid "Cannot write to device %s, permission denied.\n"
+msgid "Device %s is still in use."
 msgstr ""
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
 msgstr ""
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
 msgstr ""
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
 msgstr ""
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
 msgstr ""
 
-#: lib/luks1/keymanage.c:90
+#: lib/setup.c:4659
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
+msgid "This operation is not supported for %s crypt device."
 msgstr ""
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
-#, c-format
-msgid "Device %s is not a valid LUKS device.\n"
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
 msgstr ""
 
-#: lib/luks1/keymanage.c:198
+#: lib/setup.c:5190
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
+msgid "Data offset is not multiple of %u bytes."
 msgstr ""
 
-#: lib/luks1/keymanage.c:200
+#: lib/setup.c:5475
 #, c-format
-msgid "Cannot create header backup file %s.\n"
+msgid "Cannot convert device %s which is still in use."
 msgstr ""
 
-#: lib/luks1/keymanage.c:205
+#: lib/setup.c:5772
 #, c-format
-msgid "Cannot write header backup file %s.\n"
+msgid "Failed to assign keyslot %u as the new volume key."
 msgstr ""
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
 msgstr ""
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/setup.c:5851
 #, c-format
-msgid "Cannot open header backup file %s.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr ""
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
 msgstr ""
 
-#: lib/luks1/keymanage.c:258
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Cannot read header backup file %s.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
 msgstr ""
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
 msgstr ""
 
-#: lib/luks1/keymanage.c:277
-#, c-format
-msgid "Device %s %s%s"
+#: lib/utils.c:80
+msgid "Cannot get process priority."
 msgstr ""
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
 msgstr ""
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
 msgstr ""
 
-#: lib/luks1/keymanage.c:280
-msgid ""
-"\n"
-"WARNING: real device header has different UUID than backup!"
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
 msgstr ""
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
+#: lib/utils.c:190
+msgid "Failed to stat key file."
 msgstr ""
 
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
 msgstr ""
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
 msgstr ""
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
+#: lib/utils.c:248
+msgid "Error reading passphrase."
 msgstr ""
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
+#: lib/utils.c:265
+msgid "Nothing to read on input."
 msgstr ""
 
-#: lib/luks1/keymanage.c:363
-#, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
 msgstr ""
 
-#: lib/luks1/keymanage.c:371
-#, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
 msgstr ""
 
-#: lib/luks1/keymanage.c:380
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
+msgid "Device %s does not exist or access denied."
 msgstr ""
 
-#: lib/luks1/keymanage.c:385
+#: lib/utils_device.c:197
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
+msgid "Device %s is not compatible."
 msgstr ""
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
 msgstr ""
 
-#: lib/luks1/keymanage.c:421
+#: lib/utils_device.c:723
 #, c-format
-msgid "Unsupported LUKS version %d.\n"
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
 msgstr ""
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
+#: lib/utils_device.c:727
 #, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
+msgid "Cannot use device %s, permission denied."
 msgstr ""
 
-#: lib/luks1/keymanage.c:442
+#: lib/utils_device.c:730
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
+msgid "Cannot get info about device %s."
 msgstr ""
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
 msgstr ""
 
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
+#: lib/utils_device.c:763
+msgid ""
+"Attaching loopback device failed (loop device with autoclear flag is "
+"required)."
 msgstr ""
 
-#: lib/luks1/keymanage.c:603
+#: lib/utils_device.c:809
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
+msgid "Requested offset is beyond real size of device %s."
 msgstr ""
 
-#: lib/luks1/keymanage.c:654
+#: lib/utils_device.c:817
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
+msgid "Device %s has zero size."
 msgstr ""
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
 msgstr ""
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
+#: lib/utils_pbkdf.c:106
 #, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
+msgid "Unknown PBKDF type %s."
 msgstr ""
 
-#: lib/luks1/keymanage.c:717
+#: lib/utils_pbkdf.c:111
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
+msgid "Requested hash %s is not supported."
 msgstr ""
 
-#: lib/luks1/keymanage.c:782
-#, c-format
-msgid "Key slot %d active, purge first.\n"
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
 msgstr ""
 
-#: lib/luks1/keymanage.c:788
-#, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
 msgstr ""
 
-#: lib/luks1/keymanage.c:950
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Key slot %d unlocked.\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
 msgstr ""
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr ""
-
-#: lib/luks1/keymanage.c:1003
+#: lib/utils_pbkdf.c:148
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
 msgstr ""
 
-#: lib/luks1/keymanage.c:1021
+#: lib/utils_pbkdf.c:155
 #, c-format
-msgid "Cannot wipe device %s.\n"
+msgid ""
+"Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
 msgstr ""
 
-#: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
 msgstr ""
 
-#: lib/loopaes/loopaes.c:147
-msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
 msgstr ""
 
-#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
 msgstr ""
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Error reading keyfile %s.\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:513
-#, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr ""
-
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
+msgid ""
+"Locking aborted. The locking path %s/%s is unusable (not a directory or "
+"missing)."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
+msgid ""
+"Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
+msgid "Device wipe error, offset %<PRIu64>."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
+#: lib/luks1/keyencryption.c:39
+#, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:1020
-msgid "This function is not supported without TCRYPT header load."
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
 msgstr ""
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
-#, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
 msgstr ""
 
-#: lib/verity/verity.c:94
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
+msgid "Cannot write to device %s, permission denied."
 msgstr ""
 
-#: lib/verity/verity.c:101
-#, c-format
-msgid "Unsupported VERITY version %d.\n"
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
 msgstr ""
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
 msgstr ""
 
-#: lib/verity/verity.c:166
-#, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
 msgstr ""
 
-#: lib/verity/verity.c:196
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
+msgid "Cannot open device %s."
 msgstr ""
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
 msgstr ""
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
 msgstr ""
 
-#: lib/verity/verity_hash.c:59
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
+msgid "LUKS keyslot %u is invalid."
 msgstr ""
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
 msgstr ""
 
-#: lib/verity/verity_hash.c:161
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
+msgid "Requested header backup file %s already exists."
 msgstr ""
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
 msgstr ""
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
 msgstr ""
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
 msgstr ""
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, c-format
+msgid "Cannot open header backup file %s."
 msgstr ""
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, c-format
+msgid "Cannot read header backup file %s."
 msgstr ""
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
 msgstr ""
 
-#: lib/verity/verity_hash.c:414
+#: lib/luks1/keymanage.c:325
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
+msgid "Device %s %s%s"
 msgstr ""
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
+#: lib/luks1/keymanage.c:326
+msgid ""
+"does not contain LUKS header. Replacing header can destroy data on that "
+"device."
 msgstr ""
 
-#: src/cryptsetup.c:144
+#: lib/luks1/keymanage.c:327
 msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
+"already contains LUKS header. Replacing header will destroy existing "
+"keyslots."
 msgstr ""
 
-#: src/cryptsetup.c:152
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
+"\n"
+"WARNING: real device header has different UUID than backup!"
 msgstr ""
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
 msgstr ""
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
 msgstr ""
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
 msgstr ""
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
 msgstr ""
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
+#: lib/luks1/keymanage.c:417
+#, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
 msgstr ""
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
 msgstr ""
 
-#: src/cryptsetup.c:587
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Cipher %s is not available.\n"
+msgid "Keyslot %i: salt wiped."
 msgstr ""
 
-#: src/cryptsetup.c:614
-msgid "N/A"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
 msgstr ""
 
-#: src/cryptsetup.c:639
-#, c-format
-msgid "Cannot read keyfile %s.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
 msgstr ""
 
-#: src/cryptsetup.c:643
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
+msgid "Requested LUKS hash %s is not supported."
 msgstr ""
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
 msgstr ""
 
-#: src/cryptsetup.c:697
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
+msgid "Error during update of LUKS header on device %s."
 msgstr ""
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
 msgstr ""
 
-#: src/cryptsetup.c:717
-#, c-format
-msgid "Cannot use %s as on-disk header.\n"
+#: lib/luks1/keymanage.c:744
+msgid ""
+"Data offset for LUKS header must be either 0 or higher than header size."
+msgstr ""
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
 msgstr ""
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
 msgstr ""
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
 msgstr ""
 
-#: src/cryptsetup.c:884
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
+msgid "Key slot %d active, purge first."
 msgstr ""
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
-msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+#: lib/luks1/keymanage.c:854
+#, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
 msgstr ""
 
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
+#: lib/luks1/keymanage.c:990
+#, c-format
+msgid "Cannot open keyslot (using hash %s)."
 msgstr ""
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
+#: lib/luks1/keymanage.c:1066
+#, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
 msgstr ""
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Enter any existing passphrase: "
+msgid "Cannot wipe device %s."
 msgstr ""
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
 msgstr ""
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
 msgstr ""
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
 msgstr ""
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
 msgstr ""
 
-#: src/cryptsetup.c:1304
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
+msgid "Error reading keyfile %s."
 msgstr ""
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
+#: lib/tcrypt/tcrypt.c:554
+#, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
 msgstr ""
 
-#: src/cryptsetup.c:1326
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+msgid "PBKDF2 hash algorithm %s not available, skipping."
 msgstr ""
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
 msgstr ""
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
 msgstr ""
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
 msgstr ""
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
 msgstr ""
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
 msgstr ""
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
 msgstr ""
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
 msgstr ""
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid ""
+"Unexpected metadata entry type '%u' found when parsing supported Volume "
+"Master Key."
 msgstr ""
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
 msgstr ""
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid ""
+"Unexpected string ('%s') found when parsing supported Volume Master Key."
 msgstr ""
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid ""
+"Unexpected metadata entry value '%u' found when parsing supported Volume "
+"Master Key."
 msgstr ""
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
+#: lib/bitlk/bitlk.c:479
+#, c-format
+msgid "Failed to read BITLK signature from %s."
 msgstr ""
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
 msgstr ""
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
 msgstr ""
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
 msgstr ""
 
-#: src/cryptsetup.c:1370
-msgid "changes supplied key or key file of LUKS device"
+#: lib/bitlk/bitlk.c:510
+#, c-format
+msgid "Unsupported sector size %<PRIu16>."
 msgstr ""
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
+#: lib/bitlk/bitlk.c:518
+#, c-format
+msgid "Failed to read BITLK header from %s."
 msgstr ""
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
 msgstr ""
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
 msgstr ""
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
+#: lib/bitlk/bitlk.c:627
+#, c-format
+msgid "Failed to read BITLK metadata entries from %s."
 msgstr ""
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
 msgstr ""
 
-#: src/cryptsetup.c:1375
-msgid "dump TCRYPT device information"
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
 msgstr ""
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
 msgstr ""
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
 msgstr ""
 
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
 msgstr ""
 
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
+#: lib/bitlk/bitlk.c:1205
+msgid ""
+"Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
 msgstr ""
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: lib/bitlk/bitlk.c:1209
 msgid ""
-"\n"
-"<action> is one of:\n"
+"Cannot activate device, kernel dm-crypt is missing support for BITLK "
+"Elephant diffuser."
 msgstr ""
 
-#: src/cryptsetup.c:1402
-msgid ""
-"\n"
-"You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
 msgstr ""
 
-#: src/cryptsetup.c:1406
+#: lib/verity/verity.c:90
 #, c-format
-msgid ""
-"\n"
-"<name> is the device to create under %s\n"
-"<device> is the encrypted device\n"
-"<key slot> is the LUKS key slot number to modify\n"
-"<key file> optional key file for the new key for luksAddKey action\n"
+msgid "Device %s is not a valid VERITY device."
 msgstr ""
 
-#: src/cryptsetup.c:1413
+#: lib/verity/verity.c:97
 #, c-format
-msgid ""
-"\n"
-"Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+msgid "Unsupported VERITY version %d."
+msgstr ""
+
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
 msgstr ""
 
-#: src/cryptsetup.c:1420
+#: lib/verity/verity.c:165
 #, c-format
-msgid ""
-"\n"
-"Default compiled-in device cipher parameters:\n"
-"\tloop-AES: %s, Key %d bits\n"
-"\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgid "Wrong VERITY UUID format provided on device %s."
 msgstr ""
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: lib/verity/verity.c:198
 #, c-format
-msgid "%s: requires %s as arguments"
+msgid "Error during update of verity header on device %s."
 msgstr ""
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
-msgid "Show this help message"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
 msgstr ""
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
-msgid "Display brief usage"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
 msgstr ""
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
 msgstr ""
 
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
-msgid "Print package version"
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
 msgstr ""
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
-msgid "Shows more detailed error messages"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
 msgstr ""
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
-msgid "Show debug messages"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
 msgstr ""
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
-msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+#: lib/verity/verity_hash.c:59
+#, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
-msgid "The hash used to create the encryption key from the passphrase"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
 msgstr ""
 
-#: src/cryptsetup.c:1481
-msgid "Verifies the passphrase by asking for it twice"
+#: lib/verity/verity_hash.c:203
+#, c-format
+msgid "Verification failed at position %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
 msgstr ""
 
-#: src/cryptsetup.c:1483
-msgid "Read the volume (master) key from file."
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
 msgstr ""
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
 msgstr ""
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "The size of the encryption key"
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
 msgstr ""
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "BITS"
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
 msgstr ""
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
-msgid "Limits the read from keyfile"
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
 msgstr ""
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
-msgid "bytes"
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid ""
+"WARNING: Kernel cannot activate device if data block size exceeds page size "
+"(%u)."
 msgstr ""
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
-msgid "Number of bytes to skip in keyfile"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
 msgstr ""
 
-#: src/cryptsetup.c:1488
-msgid "Limits the read from newly added keyfile"
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
 msgstr ""
 
-#: src/cryptsetup.c:1489
-msgid "Number of bytes to skip in newly added keyfile"
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
 msgstr ""
 
-#: src/cryptsetup.c:1490
-msgid "Slot number for new key (default is first free)"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:1491
-msgid "The size of the device"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
-msgid "SECTORS"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:1492
-msgid "The start offset in the backend device"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
 msgstr ""
 
-#: src/cryptsetup.c:1493
-msgid "How many sectors of the encrypted data to skip at the beginning"
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
 msgstr ""
 
-#: src/cryptsetup.c:1494
-msgid "Create a readonly mapping"
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
 msgstr ""
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
 msgstr ""
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
 msgstr ""
 
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
-msgid "Do not ask for confirmation"
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
 msgstr ""
 
-#: src/cryptsetup.c:1497
-msgid "Timeout for interactive passphrase prompt (in seconds)"
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid ""
+"Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
 msgstr ""
 
-#: src/cryptsetup.c:1497
-msgid "secs"
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
 msgstr ""
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid ""
+"WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 "
+"keyslot count is very limited.\n"
 msgstr ""
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
 msgstr ""
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
 msgstr ""
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
 msgstr ""
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid ""
+"Binary header with keyslot areas size differ on device and backup, restore "
+"failed."
 msgstr ""
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
 msgstr ""
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid ""
+"does not contain LUKS2 header. Replacing header can destroy data on that "
+"device."
 msgstr ""
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid ""
+"already contains LUKS2 header. Replacing header will destroy existing "
+"keyslots."
 msgstr ""
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
 msgstr ""
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
 msgstr ""
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
 msgstr ""
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
 msgstr ""
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
 msgstr ""
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
 msgstr ""
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
 msgstr ""
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
 msgstr ""
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
-msgid "[OPTION...] <action> <action-specific>"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
 msgstr ""
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
 msgstr ""
 
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
-msgid "Argument <action> missing."
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid ""
+"Operation incompatible with device marked for legacy reencryption. Aborting."
 msgstr ""
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
-msgid "Unknown action."
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid ""
+"Operation incompatible with device marked for LUKS2 reencryption. Aborting."
 msgstr ""
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
 msgstr ""
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
 msgstr ""
 
-#: src/cryptsetup.c:1657
-msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
 msgstr ""
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
 msgstr ""
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
-msgid "Key size must be a multiple of 8 bits"
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
 msgstr ""
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
-msgid "Key slot is invalid."
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
 msgstr ""
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
 msgstr ""
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
-msgid "Negative number for option not permitted."
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
 msgstr ""
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
-msgid "Only one of --use-[u]random options is allowed."
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
 msgstr ""
 
-#: src/cryptsetup.c:1699
-msgid "Option --use-[u]random is allowed only for luksFormat."
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid ""
+"Cannot convert to LUKS1 format - default segment encryption sector size is "
+"not 512 bytes."
 msgstr ""
 
-#: src/cryptsetup.c:1703
-msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid ""
+"Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
 msgstr ""
 
-#: src/cryptsetup.c:1707
-msgid "Option --align-payload is allowed only for luksFormat."
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
 msgstr ""
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
 msgstr ""
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
 msgstr ""
 
-#: src/cryptsetup.c:1725
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
 msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
+"Cannot convert to LUKS1 format - slot %u (over maximum slots) is still "
+"active."
 msgstr ""
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
 msgstr ""
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
 msgstr ""
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
 msgstr ""
 
-#: src/veritysetup.c:88
+#: lib/luks2/luks2_reencrypt.c:941
 #, c-format
-msgid "Cannot create hash image %s for writing.\n"
+msgid "Unsupported resilience mode %s"
 msgstr ""
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
 msgstr ""
 
-#: src/veritysetup.c:308
-msgid "<data_device> <hash_device>"
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
 msgstr ""
 
-#: src/veritysetup.c:308
-msgid "format device"
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
 msgstr ""
 
-#: src/veritysetup.c:309
-msgid "<data_device> <hash_device> <root_hash>"
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
 msgstr ""
 
-#: src/veritysetup.c:309
-msgid "verify device"
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
 msgstr ""
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
 msgstr ""
 
-#: src/veritysetup.c:310
-msgid "create active device"
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid ""
+"Source and target device sizes don't match. Source %<PRIu64>, target: "
+"%<PRIu64>."
 msgstr ""
 
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
 msgstr ""
 
-#: src/veritysetup.c:312
-msgid "show active device status"
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
 msgstr ""
 
-#: src/veritysetup.c:313
-msgid "<hash_device>"
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
 msgstr ""
 
-#: src/veritysetup.c:313
-msgid "show on-disk information"
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
 msgstr ""
 
-#: src/veritysetup.c:332
+#: lib/luks2/luks2_reencrypt.c:2318
 #, c-format
 msgid ""
-"\n"
-"<name> is the device to create under %s\n"
-"<data_device> is the data device\n"
-"<hash_device> is the device containing verification data\n"
-"<root_hash> hash of the root node on <hash_device>\n"
+"Data shift is not aligned to requested encryption sector size (%<PRIu32> "
+"bytes)."
 msgstr ""
 
-#: src/veritysetup.c:339
+#: lib/luks2/luks2_reencrypt.c:2339
 #, c-format
 msgid ""
-"\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"Data device is not aligned to requested encryption sector size (%<PRIu32> "
+"bytes)."
 msgstr ""
 
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid ""
+"Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> "
+"sectors)."
 msgstr ""
 
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
 msgstr ""
 
-#: src/veritysetup.c:378
-msgid "number"
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
 msgstr ""
 
-#: src/veritysetup.c:379
-msgid "Block size on the data device"
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
 msgstr ""
 
-#: src/veritysetup.c:380
-msgid "Block size on the hash device"
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
 msgstr ""
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
 msgstr ""
 
-#: src/veritysetup.c:381
-msgid "blocks"
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
 msgstr ""
 
-#: src/veritysetup.c:382
-msgid "Starting offset on the hash device"
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
 msgstr ""
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
 msgstr ""
 
-#: src/veritysetup.c:383
-msgid "string"
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
 msgstr ""
 
-#: src/veritysetup.c:384
-msgid "Salt"
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
 msgstr ""
 
-#: src/veritysetup.c:384
-msgid "hex string"
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:147
-#, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:151
-#, c-format
-msgid "Cannot open device %s\n"
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:168
-#, c-format
-msgid "Cannot read device %s.\n"
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:179
-#, c-format
-msgid "Marking LUKS device %s unusable.\n"
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:184
+#: lib/luks2/luks2_reencrypt.c:3058
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:200
+#: lib/luks2/luks2_reencrypt.c:3182
 #, c-format
-msgid "Cannot write device %s.\n"
+msgid ""
+"Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> "
+"sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:374
+#: lib/luks2/luks2_token.c:269
 #, c-format
-msgid "Log file %s exists, resuming reencryption.\n"
+msgid "Failed to create builtin token %s."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr ""
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr ""
+
+#: src/cryptsetup.c:259
+msgid ""
+"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
+"specified.\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
+#: src/cryptsetup.c:267
+msgid ""
+"WARNING: The --keyfile-size option is being ignored, the read size is the "
+"same as the encryption key size.\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:450
+#: src/cryptsetup.c:307
 #, c-format
-msgid "New LUKS header for device %s created.\n"
+msgid ""
+"Detected device signature(s) on %s. Proceeding further may damage existing "
+"data."
+msgstr ""
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr ""
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr ""
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr ""
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr ""
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr ""
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr ""
+
+#: src/cryptsetup.c:541
 #, c-format
-msgid "Activated keyslot %i.\n"
+msgid "Device %s is not a valid BITLK device."
+msgstr ""
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/cryptsetup.c:673
 #, c-format
-msgid "LUKS header backup of device %s created.\n"
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr ""
+
+#: src/cryptsetup.c:701
+msgid ""
+"Resize of active device requires volume key in keyring but --disable-keyring "
+"option is set."
+msgstr ""
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/cryptsetup.c:861
 #, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/cryptsetup.c:875
 #, c-format
-msgid "LUKS header on device %s restored.\n"
+msgid "%-10s N/A\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:669
+#: src/cryptsetup.c:877
 #, c-format
 msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+"%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit "
+"key (requested %u ms time)\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr ""
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
+#: src/cryptsetup.c:1003
+msgid "N/A"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1028
+#: src/cryptsetup.c:1083
 msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
-#, c-format
-msgid "Enter passphrase for key slot %u: "
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "Reencryption block size"
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "MiB"
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will "
+"contain invalid checksum).\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1298
-msgid "[OPTION...] <device>"
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid ""
+"Cannot determine volume key size for LUKS without keyslots, please use --key-"
+"size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr ""
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1312
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
 msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
+"This is the last keyslot. Device will become unusable after purging this key."
+msgstr ""
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr ""
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr ""
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1313
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
 #, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
+msgid "Enter any existing passphrase: "
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1315
-msgid ", set cipher to "
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1320
-msgid "Argument required."
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr ""
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1336
+#: src/cryptsetup.c:2001
 msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1363
-msgid "Maximum device reduce size is 64 MiB."
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1378
-msgid "Option --new cannot be used together with --decrypt."
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1382
-msgid "Option --decrypt is incompatible with specified parameters."
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
 msgstr ""
 
-#: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
 msgstr ""
 
-#: src/utils_tools.c:173
-msgid "Command successful.\n"
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
 msgstr ""
 
-#: src/utils_tools.c:191
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr ""
+
+#: src/cryptsetup.c:2398
 #, c-format
-msgid "Command failed with code %i"
+msgid "Device is already %s type."
 msgstr ""
 
-#: src/utils_password.c:42
+#: src/cryptsetup.c:2403
 #, c-format
-msgid "Cannot check password quality: %s\n"
+msgid "This operation will convert %s to %s format.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
 msgstr ""
 
-#: src/utils_password.c:50
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr ""
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
 #, c-format
-msgid ""
-"Password quality check failed:\n"
-" %s\n"
+msgid "Token %d is invalid."
+msgstr ""
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr ""
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr ""
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr ""
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr ""
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr ""
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr ""
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr ""
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr ""
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr ""
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr ""
+
+#: src/cryptsetup.c:2761
+msgid ""
+"Encryption without detached header (--header) is not possible without data "
+"device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid ""
+"Requested data offset must be less than or equal to half of --reduce-device-"
+"size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid ""
+"Adjusting --reduce-device-size value to twice the --offset %<PRIu64> "
+"(sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr ""
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid ""
+"Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr ""
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr ""
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr ""
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid ""
+"Key file can be used only with --key-slot or with exactly one key slot "
+"active."
+msgstr ""
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr ""
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr ""
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr ""
+
+#: src/cryptsetup.c:3285
+msgid ""
+"Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt "
+"tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid ""
+"Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt "
+"utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr ""
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr ""
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr ""
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr ""
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr ""
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr ""
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr ""
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr ""
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr ""
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr ""
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr ""
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr ""
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr ""
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr ""
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr ""
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr ""
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr ""
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr ""
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr ""
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr ""
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr ""
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr ""
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr ""
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr ""
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr ""
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr ""
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr ""
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr ""
+
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr ""
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr ""
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr ""
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr ""
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr ""
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr ""
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr ""
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, "
+"bitlkClose\n"
+msgstr ""
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
+"(characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+
+#: src/cryptsetup.c:3431
+msgid ""
+"\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr ""
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr ""
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr ""
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr ""
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr ""
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr ""
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr ""
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr ""
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr ""
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr ""
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr ""
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr ""
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr ""
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr ""
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr ""
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr ""
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr ""
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr ""
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr ""
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr ""
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr ""
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr ""
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr ""
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr ""
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr ""
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr ""
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr ""
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr ""
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr ""
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr ""
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr ""
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr ""
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr ""
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr ""
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr ""
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr ""
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr ""
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr ""
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr ""
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr ""
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr ""
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr ""
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr ""
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr ""
+
+#: src/cryptsetup.c:3526
+msgid ""
+"Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr ""
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr ""
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr ""
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr ""
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr ""
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr ""
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr ""
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr ""
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr ""
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr ""
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr ""
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr ""
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr ""
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr ""
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr ""
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr ""
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr ""
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr ""
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr ""
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr ""
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr ""
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr ""
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr ""
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr ""
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr ""
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr ""
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr ""
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr ""
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr ""
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr ""
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr ""
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr ""
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr ""
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr ""
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr ""
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr ""
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr ""
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr ""
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr ""
+
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr ""
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr ""
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr ""
+
+#: src/cryptsetup.c:3738
+msgid ""
+"Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr ""
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr ""
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-"
+"size=(bytes)."
+msgstr ""
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr ""
+
+#: src/cryptsetup.c:3764
+msgid ""
+"Option --integrity-no-wipe can be used only for format action with integrity "
+"extension."
+msgstr ""
+
+#: src/cryptsetup.c:3770
+msgid ""
+"Options --label and --subsystem are allowed only for luksFormat and config "
+"LUKS2 operations."
+msgstr ""
+
+#: src/cryptsetup.c:3776
+msgid ""
+"Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK "
+"devices."
+msgstr ""
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr ""
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr ""
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr ""
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr ""
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr ""
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr ""
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr ""
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr ""
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr ""
+
+#: src/cryptsetup.c:3825
+msgid ""
+"Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only "
+"for luksFormat with LUKS2."
+msgstr ""
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr ""
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr ""
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr ""
+
+#: src/cryptsetup.c:3851
+msgid ""
+"Option --offset is supported only for open of plain and loopaes devices, "
+"luksFormat and device reencryption."
+msgstr ""
+
+#: src/cryptsetup.c:3857
+msgid ""
+"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
+"for TCRYPT device."
+msgstr ""
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr ""
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr ""
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr ""
+
+#: src/cryptsetup.c:3877
+msgid ""
+"Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr ""
+
+#: src/cryptsetup.c:3885
+msgid ""
+"Option --veracrypt-query-pim is supported only for VeraCrypt compatible "
+"devices."
+msgstr ""
+
+#: src/cryptsetup.c:3889
+msgid ""
+"The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr ""
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr ""
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid ""
+"Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/"
+"argon2id."
+msgstr ""
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr ""
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr ""
+
+#: src/cryptsetup.c:3929
+msgid ""
+"Large IV sectors option is supported only for opening plain type device with "
+"sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr ""
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr ""
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr ""
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr ""
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr ""
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr ""
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr ""
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr ""
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr ""
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr ""
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr ""
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4014
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr ""
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr ""
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr ""
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr ""
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr ""
+
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr ""
+
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr ""
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr ""
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr ""
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr ""
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr ""
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr ""
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr ""
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr ""
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr ""
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
+"Hash format: %u\n"
+msgstr ""
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr ""
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr ""
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr ""
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr ""
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr ""
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr ""
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr ""
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr ""
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr ""
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr ""
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr ""
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr ""
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr ""
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr ""
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr ""
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr ""
+
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr ""
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr ""
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr ""
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr ""
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr ""
+
+#: src/veritysetup.c:582
+msgid ""
+"Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks "
+"is allowed only for open operation."
+msgstr ""
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr ""
+
+#: src/veritysetup.c:592
+msgid ""
+"Option --ignore-corruption and --restart-on-corruption cannot be used "
+"together."
+msgstr ""
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr ""
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr ""
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr ""
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr ""
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr ""
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr ""
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr ""
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr ""
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr ""
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr ""
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr ""
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr ""
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr ""
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr ""
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr ""
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr ""
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr ""
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr ""
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr ""
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr ""
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr ""
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr ""
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr ""
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr ""
+
+#: src/integritysetup.c:669
+msgid ""
+"Options --journal-size, --interleave-sectors, --sector-size, --tag-size and "
+"--no-wipe can be used only for format action."
+msgstr ""
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr ""
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr ""
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr ""
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr ""
+
+#: src/integritysetup.c:691
+msgid ""
+"Journal integrity algorithm must be specified if journal integrity key is "
+"used."
+msgstr ""
+
+#: src/integritysetup.c:696
+msgid ""
+"Both journal encryption key file and key size options must be specified."
+msgstr ""
+
+#: src/integritysetup.c:699
+msgid ""
+"Journal encryption algorithm must be specified if journal encryption key is "
+"used."
+msgstr ""
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr ""
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid ""
+"This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid ""
+"No decryption in progress, provided UUID can be used only to resume "
+"suspended decryption process."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1703
+msgid ""
+"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1737
+msgid ""
+"Option --new must be used together with --reduce-device-size or --header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1741
+msgid ""
+"Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-"
+"iterations."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr ""
+
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr ""
+
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr ""
+
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr ""
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr ""
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr ""
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr ""
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr ""
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr ""
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr ""
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr ""
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr ""
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr ""
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr ""
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr ""
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr ""
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr ""
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr ""
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr ""
+
+#: src/utils_tools.c:577
+#, c-format
+msgid ""
+"Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s "
+"will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:580
+#, c-format
+msgid ""
+"Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s "
+"will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr ""
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr ""
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr ""
+
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr ""
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr ""
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr ""
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr ""
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr ""
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr ""
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr ""
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr ""
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr ""
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr ""
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr ""
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr ""
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr ""
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr ""
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr ""
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
 msgstr ""
index 6504e45..1adadce 100644 (file)
Binary files a/po/cs.gmo and b/po/cs.gmo differ
index 81f6552..94db662 100644 (file)
--- a/po/cs.po
+++ b/po/cs.po
 # Copyright (C) 2010 Free Software Foundation, Inc.
 # This file is distributed under the same license as the cryptsetup package.
 # Milan Broz <mbroz@redhat.com>, 2010.
-# Petr Pisar <petr.pisar@atlas.cz>, 2010, 2011, 2012, 2013, 2014, 2015.
+# Petr Pisar <petr.pisar@atlas.cz>, 2010, 2011, 2012, 2013, 2014, 2015, 2016.
+# Petr Pisar <petr.pisar@atlas.cz>, 2017, 2018, 2019, 2020.
 #
 # See `LUKS On-Disk Format Specification' document to clarify some terms.
 #
+# backing device → podpůrné zařízení
+# digest → otisk
 # key slot → pozice klíče
+# keyring → klíčenka
+# online mode → (režim) za běhu
 # plain/LUKS1 crypt → šifra plain/LUKS1 („plain“ nepřekládat)
-# resume → probudit
+# (reencryption) recover → obnova (jedná se o činnost před samotným navázáním
+#   rozdělaného přešifrování, obvykle po výpadku napájení).
+# refresh → reaktivace
+# resume → probudit, dokončit
+# segment → část
+# signature → značka, vzorec nebo podpis (záleží na kontextu)
 # suspend → uspat
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-19 19:00+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-15 18:12+02:00\n"
 "Last-Translator: Petr Pisar <petr.pisar@atlas.cz>\n"
 "Language-Team: Czech <translation-team-cs@lists.sourceforge.net>\n"
 "Language: cs\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr "Nelze inicializovat device-mapper, nespuštěno superuživatelem.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Nelze inicializovat device-mapper, nespuštěno superuživatelem."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr "Nelze inicializovat device-mapper. Je jaderný modul dm_mod zaveden?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Nelze inicializovat device-mapper. Je jaderný modul dm_mod zaveden?"
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Požadovaný příznak pozdrženo není podporován."
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "DM-UUID pro zařízení %s bylo zkráceno.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID pro zařízení %s bylo zkráceno."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Neznámý druh cíle DM."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Požadované výkonnostní volby dm-cryptu nejsou podporovány."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Požadované volby, jak zacházet s poškozením dat dm-verity, nejsou podporovány."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Požadované FEC volby dm-cryptu nejsou podporovány."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Požadované volby integrity dat nejsou podporovány."
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Požadované volby sector_size není podporována."
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Požadovaný automatický přepočet značek integrity není podporován."
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Požadované výkonnostní volby dmcryptu nejsou podporovány.\n"
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Zahazování (TRIM) není podporováno."
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Požadovaný režim bitmapy integrity DM není podporován."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Dotaz na část dm-%s selhal."
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
 "Během vytváření klíče svazku došla systému entropie.\n"
 "Aby bylo možné nasbírat náhodné události, žádáme uživatele, aby pohyboval\n"
 "myší nebo psal text do jiného okna.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Vytváří se klíč (%d %% hotovo).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr "Fatální chyba během přípravy generátoru náhodných čísel.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Režim FIPS zapnut."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Fatální chyba během přípravy generátoru náhodných čísel."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr "Požadována neznámá kvalita generátoru náhodných čísel.\n"
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Požadována neznámá kvalita generátoru náhodných čísel."
 
-#: lib/random.c:211
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Chyba při čtení z generátoru náhodných čísel."
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Implementaci šifrovacího generátoru náhodných čísel nelze inicializovat."
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Implementaci šifrování nelze inicializovat."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
 #, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Chyba %d při čtení z generátoru náhodných čísel: %s\n"
+msgid "Hash algorithm %s not supported."
+msgstr "Hašovací algoritmus %s není podporován."
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr ""
-"Implementaci šifrovacího generátoru náhodných čísel nelze inicializovat.\n"
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Chyba zpracování klíče (za použití haše %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Druh zařízení nelze určit. Nekompatibilní aktivace zařízení?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Tato operace je podporována jen u zařízení LUKS."
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Tato operace je podporována jen u zařízení LUKS2."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Implementaci šifrování nelze inicializovat.\n"
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Všechny pozice klíčů jsou obsazeny."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:434
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "Hašovací algoritmus %s není podporován.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Pozice klíče %d není platná, prosím, vyberte číslo mezi 0 a %d."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:440
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Chyba zpracování klíče (za použití haše %s).\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "Pozice klíče %d je obsazena, prosím, vyberte jinou."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr "Druh zařízení nelze určit. Nekompatibilní aktivace zařízení?\n"
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "Velikost zařízení není zarovnaná na velikost logického sektoru zařízení."
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Tato operace je podporována jen u zařízení LUKS.\n"
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Nalezena hlavička, ale zařízení %s je příliš malé."
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Tato operace není na zařízení tohoto typu podporována."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Všechny pozice klíčů jsou obsazeny.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Zakázaná operace spolu s probíhajícím přešifrování."
 
-#: lib/setup.c:327
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr "Pozice klíče %d není platná, prosím, vyberte číslo mezi 0 a %d.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "Nepodporovaná verze LUKS %d."
 
-#: lib/setup.c:333
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Zařízení s oddělenými metadaty není na šifře tohoto typu podporováno."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "Pozice klíče %d je obsazena, prosím, vyberte jinou.\n"
+msgid "Device %s is not active."
+msgstr "Zařízení %s není aktivní."
 
-#: lib/setup.c:472
+#: lib/setup.c:1444
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Zadejte heslo pro %s: "
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Zařízení nižší úrovně pod šifrovaným zařízením %s zmizelo."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Neplatné parametry plain šifry."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Neplatná velikost klíče."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID není na šifře tohoto typu podporováno."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Nepodporovaná velikost šifrovaného sektoru."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Velikost zařízení není zarovnaná na požadovanou velikost sektoru."
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "LUKS nelze bez zařízení naformátovat."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Požadované zarovnání dat není slučitelné s polohou dat."
 
-#: lib/setup.c:653
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "POZOR: Poloha dat je mimo nyní dostupné zařízení s daty.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Ze zařízení %s nelze odstranit hlavičku."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "POZOR: Aktivace zařízení selže, dm-crypt nepodporuje požadovanou velikost šifrovaného sektoru.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Klíč svazku je příliš malý na šifrovaní s rozšířeními pro integritu."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Šifra %s-%s (velikost klíče %zd bitů) není dostupná."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "POZOR: Metadata LUKS2 změnila velikost na %<PRIu64> bajtů.\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "POZOR: Oblast s pozicemi klíčů pro LUKS2 změnila velikost na %<PRIu64> bajtů.\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "Zařízení %s je příliš malé."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Zařízení %s, které se používá, nelze formátovat."
+
+#: lib/setup.c:1896 lib/setup.c:1922
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "Nalezena hlavička, ale zařízení %s je příliš malé.\n"
+msgid "Cannot format device %s, permission denied."
+msgstr "Zařízení %s nelze formátovat, povolení zamítnuto."
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Tato operace není na zařízení tohoto typu podporována.\n"
+# FIXME "format integrity" is nonsense
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Zařízení %s není možné formátovat integritu."
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1926
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Zařízení %s není aktivní.\n"
+msgid "Cannot format device %s."
+msgstr "Zařízení %s nelze formátovat."
 
-#: lib/setup.c:925
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "LOOPAES nelze bez zařízení naformátovat."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "VERITY nelze bez zařízení naformátovat."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr "Zařízení nižší úrovně pod šifrovaným zařízením %s zmizelo.\n"
+msgid "Unsupported VERITY hash type %d."
+msgstr "Nepodporovaný druh VERITY haše %d."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Nepodporovaná velikost bloku VERITY."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Nepodporovaná poloha haše VERITY."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Neplatné parametry plain šifry.\n"
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Nepodporovaná poloha VERITY FEC."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Neplatná velikost klíče.\n"
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Oblast dat se překrývá s oblastí haše."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "UUID není na šifře tohoto typu podporováno.\n"
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Oblast FEC se překrývá s oblastí haše."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "LUKS nelze bez zařízení naformátovat.\n"
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Oblast dat se překrývá s oblastí FEC."
 
-#: lib/setup.c:1089
+#: lib/setup.c:2208
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Zařízení %s, které se stále používá, nelze formátovat.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "POZOR: Požadovaná velikost značky %d bajtů se liší od výstupu velikosti %s (%d bajtů).\n"
 
-#: lib/setup.c:1092
+#: lib/setup.c:2286
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Zařízení %s nelze formátovat, povolení zamítnuto.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Požadován neznámý typ šifrovaného zařízení %s."
 
-#: lib/setup.c:1096
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Ze zařízení %s nelze odstranit hlavičku.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Nepodporované parametry na zařízení %s."
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "LOOPAES nelze bez zařízení naformátovat.\n"
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Neodpovídající parametry an za zařízení %s."
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Zařízení dmcryptu si neodpovídají."
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "VERITY nelze bez zařízení naformátovat.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "Zařízení %s nebylo možné znovu zavést."
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Nepodporovaný druh VERITY haše %d.\n"
+msgid "Failed to suspend device %s."
+msgstr "Zařízení %s nebylo možné pozastavit."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Nepodporovaná velikost bloku VERITY.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Zařízení %s nebylo možné probudit."
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Nepodporovaná poloha haše VERITY.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Nepřekonatelná chyba při zavádění zařízení %s (nad zařízením %s)."
 
-#: lib/setup.c:1285
+#: lib/setup.c:2735 lib/setup.c:2737
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Požadován neznámý typ šifrovaného zařízení %s.\n"
+msgid "Failed to switch device %s to dm-error."
+msgstr "Zařízení %s nebylo možné přepnout do dm-error."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Nelze změnit velikost zařízení zpětné smyčky."
 
-#: lib/setup.c:1435
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "Opravdu chcete změnit UUID zařízení?"
 
-#: lib/setup.c:1545
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Soubor se zálohou hlavičky neobsahuje kompatibilní hlavičku LUKS."
+
+#: lib/setup.c:3058
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Svazek %s není aktivní.\n"
+msgid "Volume %s is not active."
+msgstr "Svazek %s není aktivní."
 
-#: lib/setup.c:1556
+#: lib/setup.c:3069
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Svazek %s je již uspán.\n"
+msgid "Volume %s is already suspended."
+msgstr "Svazek %s je již uspán."
 
-#: lib/setup.c:1563
+#: lib/setup.c:3082
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "Uspání není na zařízení %s podporováno.\n"
+msgid "Suspend is not supported for device %s."
+msgstr "Uspání není na zařízení %s podporováno."
 
-#: lib/setup.c:1565
+#: lib/setup.c:3084
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Chyba při uspávání zařízení %s.\n"
+msgid "Error during suspending device %s."
+msgstr "Chyba při uspávání zařízení %s."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Svazek %s není uspán.\n"
+msgid "Volume %s is not suspended."
+msgstr "Svazek %s není uspán."
 
-#: lib/setup.c:1605
+#: lib/setup.c:3146
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Probuzení není na zařízení %s podporováno.\n"
+msgid "Resume is not supported for device %s."
+msgstr "Probuzení není na zařízení %s podporováno."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Chyba při probouzení zařízení %s.\n"
+msgid "Error during resuming device %s."
+msgstr "Chyba při probouzení zařízení %s."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Zadejte heslo: "
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Heslo svazku neodpovídá svazku."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Nelze přidat pozici klíče, všechny pozice jsou zakázány a klíč svazku\n"
-"nebyl poskytnut.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Nelze přidat pozici klíče, všechny pozice jsou zakázány a klíč svazku nebyl poskytnut."
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Zadejte jakékoliv heslo: "
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Záměna novou pozicí klíče se nezdařila."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Zadejte nové heslo pro pozici klíče: "
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Pozice klíče %d je neplatná."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Pozice klíče %d není aktivní."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Hlavička zařízení se překrývá s datovou oblastí."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Přešifrování již probíhá. Zařízení nelze aktivovat."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Získání zámku pro přešifrování selhalo."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Obnova přešifrování LUKS2 selhalo."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Typ zařízení není řádně inicializován."
 
-#: lib/setup.c:1798
+#: lib/setup.c:4171
 #, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Pozice klíče %d změněna.\n"
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Zařízení %s nelze použít. Název není platný nebo zařízení se stále používá."
 
-#: lib/setup.c:1801
+#: lib/setup.c:4174
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Nahrazeno pozicí klíče %d.\n"
+msgid "Device %s already exists."
+msgstr "Zařízení %s již existuje."
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Záměna novou pozicí klíče se nezdařila.\n"
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Byl zadán neplatný klíč svazku."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Heslo svazku neodpovídá svazku.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "K zařízení VERITY byl zadán neplatný kořenový haš."
 
-#: lib/setup.c:1961
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Je potřeba podpis kořenového otisku."
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Jaderná klíčenka chybí: je potřeba pro předání podpisu do jádra."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Klíč se nepodařilo přidat do jaderné klíčenky."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Zařízení %s se stále používá."
+
+#: lib/setup.c:4516
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Pozice klíče %d je neplatná.\n"
+msgid "Invalid device %s."
+msgstr "Neplatné zařízení %s."
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Vyhrazená paměť pro klíč svazku je příliš malá."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Nelze získat klíč svazku pro otevřené zařízení."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "K zařízení VERITY nelze získat kořenový otisk."
 
-#: lib/setup.c:1966
+#: lib/setup.c:4659
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Pozice klíče %d není použita.\n"
+msgid "This operation is not supported for %s crypt device."
+msgstr "Na šifrovaném zařízení %s není tato operace podporována."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Operace výpisu není na zařízení tohoto typu podporována."
+
+#: lib/setup.c:5190
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Zařízení %s již existuje.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Počátek dat není násobkem %u bajtů."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr "Byl zadán neplatný klíč svazku.\n"
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Zařízení %s, které se stále používá, nelze konvertovat."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
-msgstr "K zařízení VERITY byl zadán neplatný kořenový haš.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Přiřazení pozice klíče %u jakožto nového klíče svazku se nezdařilo."
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Typ zařízení není řádně inicializován.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Inicializace parametrů výchozí pozice klíče LUKS2 selhala."
 
-#: lib/setup.c:2259
+#: lib/setup.c:5851
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Zařízení %s se stále používá.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Přiřazení pozice klíče %d k otisku se nezdařilo."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Jaderná klíčenka není jádrem podporována."
 
-#: lib/setup.c:2268
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Neplatné zařízení %s.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Čtení hesla z klíčenky selhalo (chyba %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Získání zámku pro tvrdý přístup do globální paměti selhalo."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Nelze zjistit prioritu procesu."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Paměť nelze odemknout."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Soubor s klíčem se nepodařilo otevřít."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "V režimu FIPS není funkce dostupná.\n"
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Soubor s klíčem nelze z terminálu přečíst."
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Vyhrazená paměť pro klíč svazku je příliš malá.\n"
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "O souboru s klíčem nebylo možné zjistit údaje."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Nelze se přesunout na požadované místo v souboru s klíčem."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Při čtení hesla došla paměť."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Chyba při čtení hesla."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Na vstupu není nic k přečtení."
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Maximální délka souboru s klíčem překročena."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Požadované množství dat nelze načíst."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Zařízení %s neexistuje nebo přístup byl zamítnut."
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "Nelze získat klíč svazku pro otevřené zařízení.\n"
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Zařízení %s není kompatibilní."
 
-#: lib/setup.c:2310
+# TODO: Pluralize
+#: lib/utils_device.c:642
 #, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Na šifrovaném zařízení %s není tato operace podporována.\n"
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Zařízení %s je příliš malé. Je třeba alespoň %<PRIu64> bajtů."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr "Operace výpisu není na zařízení tohoto typu podporována.\n"
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Zařízení %s nelze použít, protože se již používá (již namapováno nebo připojeno)."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Nelze zjistit prioritu procesu.\n"
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Zařízení %s nelze použít, povolení zamítnuto."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Paměť nelze odemknout.\n"
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "O zařízení %s nelze získat údaje."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Při čtení hesla došla paměť.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Zařízení typu loopback nelze použít, nespuštěno superuživatelem."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Chyba při čtení hesla z terminálu.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Připojení zařízení zpětné smyčky selhalo (požadováno zařízení s příznakem autoclear)."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Ověřte heslo: "
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Požadovaná poloha je za hranicí skutečné velikosti zařízení %s."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Hesla se neshodují.\n"
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Zařízení %s má nulovou velikost."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Ve vstupu z terminálu nelze měnit polohu.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Požadovaný cílový čas PBKDF nemůže být nula."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "Soubor s klíčem se nepodařilo otevřít.\n"
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Neznámý druh PBKDF %s."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "O souboru s klíčem nebylo možné zjistit údaje.\n"
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Požadovaný haš %s není podporován."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr "Nelze se přesunout na požadované místo v souboru s klíčem.\n"
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Požadovaný druh PBKDF není podporován formátem LUKS1."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Chyba při čtení hesla.\n"
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Při PBKDF2 nesmí být nastavena maximální paměť pro PBKDF nebo počet souběžných vláken."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Maximální délka souboru s klíčem překročena.\n"
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Vynucený počet opakování je pro %s příliš nízký (minimum je %u)."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "Požadované množství dat nelze načíst.\n"
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Vynucená cena paměti je pro %s příliš nízká (minimum je %u kilobajtů)."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/utils_pbkdf.c:155
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Zařízení %s neexistuje nebo přístup byl zamítnut.\n"
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Požadovaná maximální cena PBKDF paměti je příliš vysoká (maximum je %d kilobajtů)."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr "Zařízení typu loopback nelze použít, nespuštěno superuživatelem.\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Požadované maximum paměti PBKDF nemůže být nula."
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Nelze najít volné zařízení zpětné smyčky.\n"
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Požadovaný počet souběžných vláken PBKDF nemůže být nula."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
-"Připojení zařízení zpětné smyčky selhalo (požadováno zařízení s příznakem\n"
-"autoclear).\n"
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "V režimu FIPS je podporován jen PBKDF2."
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Porovnání výkonu PBKDF je zakázáno, ale počet iterací není nastaven."
 
-#: lib/utils_device.c:484
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
-msgstr ""
-"Zařízení %s nelze použít, protože se již používá\n"
-"(již namapováno nebo připojeno).\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Neslučitelné volby PBKDF2 (při použití hašovacího algoritmu %s)."
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Neslučitelné volby PBKDF."
 
-#: lib/utils_device.c:488
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "O zařízení %s nelze získat údaje.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Zamykání zrušeno. Zamykací cesta %s/%s je nepoužitelná (není adresářem nebo neexistuje)."
 
-#: lib/utils_device.c:494
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr "Požadovaná poloha je za hranicí skutečné velikosti zařízení %s.\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "POZOR: Adresář se zámkem %s/%s chybí!\n"
 
-#: lib/utils_device.c:502
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Zařízení %s má nulovou velikost.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Zamykání zrušeno. Zamykací cesta %s/%s je nepoužitelná (%s není adresářem)."
 
-#: lib/utils_device.c:513
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Nelze se přesunout na požadované místo v zařízení."
+
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Zařízení %s je příliš malé.\n"
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Chyba při čištění zařízení na pozici %<PRIu64>."
 
-#: lib/luks1/keyencryption.c:37
+#: lib/luks1/keyencryption.c:39
 #, c-format
 msgid ""
 "Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 "Nepodařilo se nastavit mapování klíče v dm-cryptu pro zařízení %s.\n"
-"Zkontrolujte, že jádro podporuje šifru %s (podrobnosti v syslogu).\n"
-
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "V režimu XTS musí být velikost klíče 256 nebo 512 bitů.\n"
+"Zkontrolujte, že jádro podporuje šifru %s (podrobnosti v syslogu)."
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
-#, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Na zařízení %s nelze zapsat, povolení zamítnuto.\n"
-
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr "Otevření dočasného zařízení s úložištěm klíče selhalo.\n"
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "V režimu XTS musí být velikost klíče 256 nebo 512 bitů."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr "Přístup do dočasného zařízení s úložištěm klíče selhal.\n"
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "Zápis šifry by měl být ve tvaru [šifra]-[režim]-[iv]."
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Chyba vstupu/výstupu při šifrování pozice klíče.\n"
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "Na zařízení %s nelze zapsat, povolení zamítnuto."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Otevření dočasného zařízení s úložištěm klíče selhalo."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Přístup do dočasného zařízení s úložištěm klíče selhal."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Chyba vstupu/výstupu při šifrování pozice klíče."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Zařízení %s nelze otevřít."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "Chyba vstupu/výstupu při dešifrování pozice klíče.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Chyba vstupu/výstupu při dešifrování pozice klíče."
 
-#: lib/luks1/keymanage.c:90
+#: lib/luks1/keymanage.c:110
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr "Zařízení %s je příliš malé. (LUKS vyžaduje alespoň %<PRIu64> bajtů.)\n"
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Zařízení %s je příliš malé. (LUKS1 vyžaduje alespoň %<PRIu64> bajtů.)"
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "Zařízení %s není platným zařízením LUKS.\n"
+msgid "LUKS keyslot %u is invalid."
+msgstr "Pozice %u klíče LUKS není platná."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "Zařízení %s není platným zařízením LUKS."
 
-#: lib/luks1/keymanage.c:198
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Požadovaný soubor se zálohou hlavičky %s již existuje.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Požadovaný soubor se zálohou hlavičky %s již existuje."
 
-#: lib/luks1/keymanage.c:200
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Soubor se zálohou hlavičky %s nelze vytvořit.\n"
+msgid "Cannot create header backup file %s."
+msgstr "Soubor se zálohou hlavičky %s nelze vytvořit."
 
-#: lib/luks1/keymanage.c:205
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Nelze zapsat soubor %s se zálohou hlavičky.\n"
+msgid "Cannot write header backup file %s."
+msgstr "Nelze zapsat soubor %s se zálohou hlavičky."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Záložní soubor neobsahuje platnou hlavičku LUKS.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Záložní soubor neobsahuje platnou hlavičku LUKS."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Nelze otevřít soubor se zálohou hlavičky %s.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Nelze otevřít soubor se zálohou hlavičky %s."
 
-#: lib/luks1/keymanage.c:258
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Soubor se zálohou hlavičky %s nelze načíst.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Soubor se zálohou hlavičky %s nelze načíst."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Počátek dat nebo velikost klíče se liší mezi zařízením a zálohou, obnova se "
-"nezdařila.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Počátek dat nebo velikost klíče se liší mezi zařízením a zálohou, obnova se nezdařila."
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Zařízení %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"neobsahuje hlavičku LUKS. Nahrazení hlavičky může zničit data na daném "
-"zařízení."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "neobsahuje hlavičku LUKS. Nahrazení hlavičky může zničit data na daném zařízení."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"již obsahuje hlavičku LUKS. Nahrazení hlavičky zničí existující pozice "
-"s klíči."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "již obsahuje hlavičku LUKS. Nahrazení hlavičky zničí existující pozice s klíči."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
@@ -538,1342 +886,3229 @@ msgstr ""
 "\n"
 "POZOR: hlavička ve skutečném zařízení má jiné UUID než záloha!"
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Zařízení %s nelze otevřít.\n"
-
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr "Nestandardní velikost klíče, je třeba ruční opravy.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Nestandardní velikost klíče, je třeba ruční opravy."
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr "Nestandardní zarovnání pozice klíče, je třeba ruční opravy.\n"
-
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Opravují se pozice klíčů.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Nestandardní zarovnání pozice klíče, je třeba ruční opravy."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Oprava selhala."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Opravují se pozice klíčů."
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Pozice klíče %i: poloha opravena (%u → %u).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Pozice klíče %i: poloha opravena (%u → %u)."
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Pozice klíče %i: proklad opraven (%u → %u).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Pozice klíče %i: proklad opraven (%u → %u)."
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Pozice klíče %i: chybná značka oddílu.\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Pozice klíče %i: chybná značka oddílu."
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Pozice klíče %i: sůl vymazána.\n"
-
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "Hlavička LUKS se zapisuje na disk.\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Pozice klíče %i: sůl vymazána."
 
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Nepodporovaná verze LUKS %d.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Hlavička LUKS se zapisuje na disk."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "Požadovaný haš LUKSu %s není podporován.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Oprava selhala."
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "Pozice %u klíče LUKS není platná.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Požadovaný haš LUKSu %s není podporován."
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "V hlavičce LUKS nenalezen žádný známý problém.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "V hlavičce LUKS nenalezen žádný známý problém."
 
-#: lib/luks1/keymanage.c:596
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Chyba při aktualizaci hlavičky LUKS na zařízení %s.\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Chyba při aktualizaci hlavičky LUKS na zařízení %s."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:668
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr "Chyba při opakovaném čtení hlavičky LUKS po aktualizaci zařízení %s.\n"
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Chyba při opakovaném čtení hlavičky LUKS po aktualizaci zařízení %s."
 
 # TODO: Pluralize
-#: lib/luks1/keymanage.c:654
-#, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"Poloha dat u oddělené hlavičky LUKS musí být buď 0, nebo více než velikost "
-"hlavičky (sektorů: %d).\n"
-
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Poskytnut UUID LUKSu ve špatném tvaru.\n"
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Poloha dat u hlavičky LUKS musí být buď 0 nebo více než velikost hlavičky."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr "Hlavičku LUKS nelze vytvořit: čtení náhodné soli selhalo.\n"
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Poskytnut UUID LUKSu ve špatném tvaru."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Neslučitelné volby PBKDF2 (při použití hašovacího algoritmu %s).\n"
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Hlavičku LUKS nelze vytvořit: čtení náhodné soli selhalo."
 
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Hlavičku LUKS nelze vytvořit: výpočet otisku hlavičky (haš %s) selhal.\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Hlavičku LUKS nelze vytvořit: výpočet otisku hlavičky (haš %s) selhal."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "Pozice klíče %d je aktivní, nejprve ji uvolněte.\n"
+msgid "Key slot %d active, purge first."
+msgstr "Pozice klíče %d je aktivní, nejprve ji uvolněte."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr "Pozice klíče %d obsahuje příliš málo útržků. Manipulace s hlavičkou?\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Pozice klíče %d obsahuje příliš málo útržků. Manipulace s hlavičkou?"
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:990
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Pozice klíče %d odemknuta.\n"
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Pozici s klíčem nezle otevřít (za použití haše %s)."
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "S tímto heslem není dostupný žádný klíč.\n"
-
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr "Pozice klíče %d není platná, prosím, vyberte pozici mezi 0 a %d.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Pozice klíče %d není platná, prosím, vyberte pozici mezi 0 a %d."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Zařízení %s není možné smazat.\n"
+msgid "Cannot wipe device %s."
+msgstr "Zařízení %s není možné smazat."
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr "Zjištěn dosud nepodporovaný soubor s klíčem šifrovaný pomocí GPG.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Zjištěn dosud nepodporovaný soubor s klíčem šifrovaný pomocí GPG."
 
 #: lib/loopaes/loopaes.c:147
 msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
-msgstr ""
-"Prosím, použijte gpg --decrypt SOUBOR_S_KLÍČEM | cryptsetup --keyfile=- …\n"
+msgstr "Prosím, použijte gpg --decrypt SOUBOR_S_KLÍČEM | cryptsetup --keyfile=- …\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Zjištěn nekompatibilní soubor s klíčem loop-AES.\n"
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Zjištěn nekompatibilní soubor s klíčem loop-AES."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr "Jádro nepodporuje mapování kompatibilní s loop-AES.\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Jádro nepodporuje mapování kompatibilní s loop-AES."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Chyba při čtení souboru s klíčem %s\n"
+msgid "Error reading keyfile %s."
+msgstr "Chyba při čtení souboru s klíčem %s"
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/tcrypt/tcrypt.c:554
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr "Překročena maximální délka hesla TCRYPT (%d).\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Překročena maximální délka hesla TCRYPT (%zu)."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr "Hašovací algoritmus PBKDF2 %s není podporován, přeskakuje se.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "Hašovací algoritmus PBKDF2 %s není podporován, přeskakuje se."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr "Požadované kryptografické rozhraní jádra není dostupné.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Požadované kryptografické rozhraní jádra není dostupné."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr "Ujistěte se, že jaderný modul algif_skcipher je zaveden.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Ujistěte se, že jaderný modul algif_skcipher je zaveden."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "Aktivace nad sektory o velikosti %d není podporována.\n"
+msgid "Activation is not supported for %d sector size."
+msgstr "Aktivace nad sektory o velikosti %d není podporována."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr "Jádro nepodporuje aktivaci v tomto zastaralém režimu TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Jádro nepodporuje aktivaci v tomto zastaralém režimu TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "Aktivuje se systémové šifrování TCRYPT pro oddíl %s.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Aktivuje se systémové šifrování TCRYPT pro oddíl %s."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr "Jádro nepodporuje mapování kompatibilní s TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Jádro nepodporuje mapování kompatibilní s TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Bez dat s hlavičkou TCRYPT není tato funkce podporována."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "Při rozboru podporovaného hlavního klíče svazku byla nalezena položka nečekaného typu „%u“."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Při rozboru hlavního svazku klíče byl nalezen neplatný řetězec."
+
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Zařízení VERITY %s nepoužívá hlavičku uvnitř disku.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Při rozboru hlavního klíče svazku byl nalezen nečekaný řetězec („%s“)."
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:399
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Zařízení %s není platným zařízením VERITY.\n"
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "Při rozboru hlavního klíče svazku byl nalezen záznam metadat s nečekanou hodnotou „%u“."
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:479
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "Nepodporovaná verze VERITY %d.\n"
+msgid "Failed to read BITLK signature from %s."
+msgstr "Z %s nebylo možné načíst vzorec BITLK."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "BITLK verze 1 není v současnosti podporován."
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "Hlavička VERITY je poškozena.\n"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Neplatná nebo neznámá značka zavaděče zařízení BITLK."
 
-#: lib/verity/verity.c:166
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Neplatná nebo neznámá značka zařízení BITLK."
+
+#: lib/bitlk/bitlk.c:510
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Na zařízení %s poskytnuto UUID VERITY ve špatném tvaru.\n"
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Nepodporovaná velikost sektoru %<PRIu16>."
 
-#: lib/verity/verity.c:196
+#: lib/bitlk/bitlk.c:518
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Chyba při aktualizaci hlavičky VERITY na zařízení %s.\n"
+msgid "Failed to read BITLK header from %s."
+msgstr "Z %s nebylo možné načíst hlavičku BITLK."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "Jádro nepodporuje mapování dm-verity.\n"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Z %s nebylo možné přečíst metadata BITLK FVE."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr "Po aktivaci zjistilo zařízení VERITY poškození.\n"
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Neznámý nebo nepodporovaný druh šifrování."
 
-#: lib/verity/verity_hash.c:59
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "Řídká oblast na pozici %<PRIu64> není vynulována.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Z %s nebylo možné načíst položky metadat BITLK."
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Pozice na zařízení přetekla.\n"
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Tato operace není podporována."
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "Ověření na pozici %<PRIu64> selhalo.\n"
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Špatná velikost klíče."
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Neplatné parametry velikosti pro zařízení VERITY.\n"
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Toto zařízení BITLK je v nepodporovaném stavu a nelze jej aktivovat."
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Příliš mnoho úrovní stromu ve svazku VERITY.\n"
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "Zařízení BITLK s typem „%s“ nelze aktivovat."
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "Ověření datové oblasti selhalo.\n"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Aktivace částečně dešifrovaného zařízení BITLK není podporována."
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "Ověření kořenového haše selhalo.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Zařízení nelze aktivovat. Jaderný dm-crypt postrádá podporu inicializačního vektoru BITLK."
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr "Při vytváření oblasti haší došlo k chybě na vstupu/výstupu.\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Zařízení nelze aktivovat. Jaderný dm-crypt postrádá podporu difuzéru Elephant BITLK."
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "Oblast haší se nepodařilo vytvořit.\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Zařízení VERITY %s nepoužívá hlavičku uvnitř disku."
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity.c:90
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-"POZOR: Jádro nemůže aktivovat zařízení, pokud velikost datového bloku "
-"přesahuje velikost stránky (%u).\n"
+msgid "Device %s is not a valid VERITY device."
+msgstr "Zařízení %s není platným zařízením VERITY."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr "Se vstupem mimo terminál nelze ověřit heslo.\n"
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Nepodporovaná verze VERITY %d."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Nelze určit žádnou známou specifikaci šifry.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Hlavička VERITY je poškozena."
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
-msgstr ""
-"POZOR: Jedná-li se o režim plain a je-li určen soubor s klíčem, parametr --"
-"hash se ignoruje.\n"
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Na zařízení %s poskytnuto UUID VERITY ve špatném tvaru."
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
-msgstr ""
-"POZOR: Přepínač --keyfile-size se ignoruje, velikost pro čtení je stejná "
-"jako velikosti šifrovacího klíče.\n"
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Chyba při aktualizaci hlavičky VERITY na zařízení %s."
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "Je vyžadován přepínač --key-file.\n"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "Ověření podpisu kořenového otisku není podporováno."
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "S tímto heslem není rozpoznatelná žádná hlavička zařízení.\n"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Chyby v zařízení FEC nelze opravit."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
-msgstr ""
-"Výpis hlavičky s klíčem svazku je citlivý údaj,\n"
-"který umožňuje přístup k šifrovanému oddílu bez znalosti hesla.\n"
-"Tento výpis by měl být vždy uložen na bezpečném místě a v zašifrované podobě."
+# TODO: Pluralize
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Nalezeno %u opravitelných chyb v zařízení FEC."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Výsledek hodnocení výkonu není spolehlivý.\n"
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Jádro nepodporuje mapování dm-verity."
 
-# ???: are aproximated?
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr "# Testy jsou počítány jen z práce s pamětí (žádné I/O úložiště).\n"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Jádro nepodporuje volbu pro podpis dm-verity."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "#  Algoritmus | Klíč | Šifrování |   Dešifrování\n"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Po aktivaci zjistilo zařízení VERITY poškození."
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Å ifra %s není dostupná.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Å\98ídká oblast na pozici %<PRIu64> není vynulována."
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "–"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Pozice na zařízení přetekla."
 
-#: src/cryptsetup.c:639
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Soubor s klíčem %s nelze číst.\n"
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Ověření na pozici %<PRIu64> selhalo."
 
-# FIXME: Pluralize
-#: src/cryptsetup.c:643
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Neplatné parametry velikosti pro zařízení VERITY."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Přetečení oblasti haše."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Ověření datové oblasti selhalo."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Ověření kořenového haše selhalo."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Při vytváření oblasti haší došlo k chybě na vstupu/výstupu."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Oblast haší se nepodařilo vytvořit."
+
+#: lib/verity/verity_hash.c:433
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Ze souboru s klíčem %2$s nelze přečíst %1$d bajtů.\n"
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "POZOR: Jádro nemůže aktivovat zařízení, pokud velikost datového bloku přesahuje velikost stránky (%u)."
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Opravdu se pokusit opravit hlavičku zařízení LUKS?"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Kontext RS se nepodařilo alokovat."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Vyrovnávací paměť se nepodařilo alokovat."
+
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Toto nevratně přepíše data na %s."
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Čtení bloku RS %<PRIu64> bajtu %d selhalo."
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Čtení parity bloku RS %<PRIu64> selhalo."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "chyba alokace paměti v action_luksFormat"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Oprava parity bloku RS %<PRIu64> selhala."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity_fec.c:188
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "%s nelze použít pro hlavičku uvnitř disku.\n"
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Zápis parity bloku RS %<PRIu64> selhal."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr "Zmenšená poloha dat je dovolena jen u oddělené hlavičky LUKS.\n"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Velikosti bloků musí odpovídat FEC."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Chybný počet paritních bajtů."
+
+#: lib/verity/verity_fec.c:265
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Ke smazání vybrán klíč na pozici %d.\n"
+msgid "Failed to determine size for device %s."
+msgstr "Velikost zařízení %s se nepodařilo určit."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Jádro nepodporuje mapování dm-integrity."
 
-#: src/cryptsetup.c:884
+# Fixed metadata means fix_padding attribute of dm-integrity target
+# documented as "use a smaller padding".
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Jádro nepodporuje drobné zarovnání metadat dm-integrity."
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Klíč %d není aktivní. Nelze jej odstranit.\n"
+msgid "Failed to acquire write lock on device %s."
+msgstr "Získání zámku pro zápis do zařízení %s selhalo."
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Zjištěn pokus o současnou aktualizaci metadat LUKS2. Operace se ruší."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
 msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
-"Toto je poslední pozice klíče. Smazáním tohoto klíče přijdete o možnost\n"
-"zařízení použít."
-
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Zadejte jakékoliv jiné heslo: "
+"Zařízení obsahuje nejednoznačný vzorec. LUKS2 nelze automaticky obnovit.\n"
+"Prosím, spusťte obnovu příkazem „cryptsetup repair“."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Zadejte heslo, které se má smazat: "
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Požadovaná poloha dat je příliš nízká."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+# TODO: Pluralize
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Zadejte jakékoliv existující heslo: "
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "POZOR: oblast s pozicemi klíčů (%<PRIu64> bajtů) je příliš malá, dostupný počet pozic klíčů LUKS2 je značně omezen.\n"
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Zadejte heslo, které má být změněno: "
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Získání zámku pro čtení ze zařízení %s selhalo."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Zadejte nové heslo: "
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "V záloze %s byly zjištěny zakázané požadavky na LUKS2."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr "U operace isLuks je podporován pouze jeden argument se zařízením.\n"
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Počátek dat se liší mezi zařízením a zálohou, obnova se nezdařila."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Je vyžadován přepínač --header-backup-file.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Velikost binární hlavičky s oblastí pro pozice klíčů se liší mezi zařízením a zálohou, obnova se nezdařila."
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:1221
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Nerozpoznaná metadata druhu zařízení %s.\n"
+msgid "Device %s %s%s%s%s"
+msgstr "Zařízení %s %s%s%s%s"
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
-msgstr "Příkaz vyžaduje jako argumenty zařízení a mapovaný název.\n"
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "neobsahuje hlavičku LUKS2. Nahrazení hlavičky může zničit data na daném zařízení."
 
-#: src/cryptsetup.c:1326
-#, c-format
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "již obsahuje hlavičku LUKS2. Nahrazení hlavičky zničí existující pozice s klíči."
+
+#: lib/luks2/luks2_json_metadata.c:1225
 msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"Tento úkon smaže všechny pozice s klíči na zařízení %s.\n"
-"Po jeho dokončení zařízení bude nepoužitelné."
+"\n"
+"POZOR: Ve skutečné hlavičce zařízení byly objeveny neznámé požadavky na LUKS2!\n"
+"Nahrazení hlavičky zálohou může zničit data na zařízení!"
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<zařízení> [--type <druh>] [<název>]"
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"POZOR: Na zařízení bylo objeveno nedokončené offline přešifrování!\n"
+"Nahrazení hlavičky zálohou může zničit data."
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "otevře zařízení jako mapování <název>"
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Neznámý příznak %s ignorován."
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<název>"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Chybí klíč pro dm-crypt část %u."
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "zavře zařízení (odstraní mapování)"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Nastavení části dm-crypt selhalo."
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "změní velikost aktivního zařízení"
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Nastavení části dm-linear selhalo."
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "zobrazí stav zařízení"
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Nepodporovaná konfigurace integrity zařízení."
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "zhodnotí výkon šifry"
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Probíhá přešifrování. Zařízení nelze deaktivovat."
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<zařízení>"
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Výměna pozastaveného zařízení %s za cíl dm-error selhala."
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr "pokusí se opravit metadata uložená na disku"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Čtení požadavků na LUKS2 selhalo."
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
-msgstr "smaže všechny pozice s klíči (odstraní šifrovací klíč)"
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Zjištěny nesplněné požadavky na LUKS2."
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<zařízení> [<soubor_s_novým_klíčem>]"
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Operace se neslučuje se zařízením označeným pro zastaralé přešifrování. Operace se ruší."
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "naformátuje zařízení LUKS"
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Operace se neslučuje se zařízením označeným pro přešifrování LUKS2. Operace se ruší."
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "do zařízení LUKS přidá klíč"
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Nedostatek paměti pro otevření pozice s klíčem."
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Otevření pozice s klíčem selhalo."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Šifru %s-%s nelze použít pro pozici s klíčem."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Pro novou pozicí klíče není místo."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Nelze zjistit stav zařízení s UUID: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Hlavičky s dodatečnými metadaty LUKSMETA nelze převést."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Oblast s pozicemi klíčů nelze přesunout. Nedostatek místa."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Oblast s pozicemi klíčů nelze přesunout. Oblast s pozicemi klíčů LUKS2 je příliš malá."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Oblast s pozicemi klíčů nelze přesunout."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Nelze převést do formátu LUKS1 – výchozí velikost sektoru šifrování části není 512 bajtů."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Nelze převést do formátu LUKS1 – otisky v pozicích s klíči nejsou slučitelné s LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Nelze převést do formátu LUKS1 – zařízení používá šifru se zabaleným klíčem %s."
+
+# TODO: Pluralize
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Nelze převést do formátu LUKS1 – hlavička LUKS2 obsahuje %u token(ů)."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Nelze převést do formátu LUKS1 – pozice s klíče %u je v nesprávném stavu."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Nelze převést do formátu LUKS1 – pozice s klíčem %u (nad maximem pozic) je stále aktivní."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Nelze převést do formátu LUKS1 – pozice s klíče %u není slučitelná s LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Velikost horké zóny musí být násobek vypočteného zarovnání zóny (%zu bajtů)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Velikost zařízení musí být násobek vypočteného zarovnání zóny (%zu bajtů)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Nepodporovaný režim odolnosti %s"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Obálku pro starou část úložiště se nepodařilo inicializovat."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Obálku pro novou část úložiště se nepodařilo inicializovat."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Kontrolní součty pro aktuální horkou zónu se nepodařilo přečíst."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Čtení oblasti s horkou zónou počínaje na %<PRIu64> selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Sektor %zu nebylo možné rozšifrovat."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Sektor %zu nebylo možné obnovit."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Velikosti zdrojového a cílového zařízení se neshodují. Zdroj %<PRIu64>, cíl %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Aktivace zařízení horké zóny %s selhala."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Aktivace překryvného zařízení %s se skutečnou tabulkou původu selhala."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Zavedení nového mapování pro zařízení %s selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Zásobník zařízení k přešifrování se nepodařilo obnovit."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Nastavení velikosti nové oblasti s pozicemi klíčů selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Posun dat není zarovnán s požadovanou velikostí šifrovaného sektoru (%<PRIu32> bajtů)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Zařízení s daty není zarovnáno na požadovanou velikost šifrovaného sektoru (%<PRIu32> bajtů)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Posun dat (%<PRIu64> sektorů) je menší než budoucí poloha dat (%<PRIu64> sektorů)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Zařízení %s nebylo možné otevřít ve výlučném režimu (již namapováno nebo připojeno)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Zařízení není označeno pro přešifrování LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Načtení kontextu přešifrování LUKS2 selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Stavu přešifrování se nepodařilo zjistit."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Zařízení se nepřešifrovává."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Proces přešifrování již běží."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Získání zámku pro přešifrování selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "V přešifrování nelze pokračovat. Spusťte nejprve obnovu přešifrování."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Aktivní velikost zařízení a velikost požadovaná k přešifrování si neodpovídají."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "V parametrech přešifrování je požadována zakázaná velikost zařízení."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Probíhá přešifrování. Obnovu nelze provést."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "V metadatech je přešifrování LUKS2 již inicializováno."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Inicializace přešifrování LUKS2 v metadatech selhala."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Nastavení segmentů zařízení pro další horkou zónu přešifrování selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Metadata pro odolnost při přešifrování se nepodařilo zapsat."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Rozšifrování selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Zápis oblasti s horkou zónou počínaje na %<PRIu64> selhal."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Synchronizace dat selhala."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Po dokončení přešifrování aktuální horké zóny se nepodařilo aktualizovat metadata."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Zápis metadat LUKS2 selhal."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Vyčištění dat záložní části selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Vypnutí příznaku požadavku na přešifrování selhalo."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Nepřekonatelná chyba při přešifrování bloku na pozici %<PRIu64> dlouhého %<PRIu64> sektorů."
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Zařízení neprobouzejte, dokud jej ručně nenahradíte chybovým cílem."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "V přešifrování nelze pokračovat. Přešifrování se nachází v nečekaném stavu."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Chybějící nebo neplatný kontext přešifrování."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Zásobník zařízení k přešifrování se nepodařilo inicializovat."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Kontext přešifrování se nepodařilo aktualizovat."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Žádná volná pozice s tokenem"
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Vestavěný token %s nebylo možné vytvořit"
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Se vstupem mimo terminál nelze ověřit heslo."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Parametry pro šifrování pozice s klíčem lze nastavit jen u zařízení LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Nelze najít žádný známý vzorek se specifikaci šifry."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "POZOR: Jedná-li se o režim plain a je-li určen soubor s klíčem, parametr --hash se ignoruje.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "POZOR: Přepínač --keyfile-size se ignoruje, velikost pro čtení je stejná jako velikosti šifrovacího klíče.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Na %s byla nalezen vzorec zařízení. Pokračování může poškodit existující data."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Operace zrušena.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Je vyžadován přepínač --key-file."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Zadejte PIM VeraCryptu: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Neplatná hodnota VIM: chyba rozboru"
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Neplatná hodnota PIM: 0"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Neplatná hodnota PIM: mimo rozsah"
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "S tímto heslem není rozpoznatelná žádná hlavička zařízení."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Zařízení %s není platným zařízením BITLK."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Výpis hlavičky s klíčem svazku je citlivý údaj,\n"
+"který umožňuje přístup k šifrovanému oddílu bez znalosti hesla.\n"
+"Tento výpis by měl být vždy uložen na bezpečném místě a v zašifrované podobě."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Zařízení %s je stále aktivní a naplánováno pro opožděné odstranění.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Změna velikosti aktivního zařízení vyžaduje klíč svazku v klíčence. Byl však použit přepínač --disable-keyring."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Hodnocení výkonu přerušeno."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     –\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u iterací za sekundu pro %zubitový klíč\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s –\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u iterací, %5u paměti, %1u souběžných vláken (procesorů) pro %zubitový klíč (požadován čas %u ms)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Výsledek hodnocení výkonu není spolehlivý."
+
+# ???: are aproximated?
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Testy jsou počítány jen z práce s pamětí (žádné I/O úložiště).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*sAlgoritmus |      Klíč |       Šifrování |     Dešifrování\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Šifra %s (s %ibitovým klíčem) není dostupná."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#    Algoritmus |      Klíč |       Šifrování |     Dešifrování\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "–"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Zdá se, že zařízení nevyžaduje obnovu přešifrování.\n"
+"Přejete si přesto pokračovat?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Opravdu pokračovat s obnovou přešifrování LUKS2?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Zadejte heslo pro obnovení přešifrování: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Opravdu se pokusit opravit hlavičku zařízení LUKS?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Maže se zařízení, aby se inicializovaly kontrolní součty integrity.\n"
+"Lze přerušit pomocí Ctrl+C (zbytek nesmazaného zařízení bude obsahovat\n"
+"neplatné součty).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Dočasné zařízení %s nelze deaktivovat."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Volby integrity lze použít jen při formátu LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Nepodporované volby velikosti metadat LUKS2."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Soubor s hlavičkou %s nelze vytvořit."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Nelze najít žádný známý vzorek se specifikací integrity."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "%s nelze použít pro hlavičku uvnitř disku."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Toto nevratně přepíše data na %s."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Nastavení parametrů PBKDF selhalo."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Zmenšená poloha dat je dovolena jen u oddělené hlavičky LUKS."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Bez pozic pro klíče nelze určit velikost LUKS klíče svazku. Prosím, použijte přepínač --key-size."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Zařízení aktivováno, ale příznaky nelze učinit trvalými."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Ke smazání vybrán klíč na pozici %d."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr ""
+"Toto je poslední pozice klíče. Smazáním tohoto klíče přijdete o možnost\n"
+"zařízení použít."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Zadejte jakékoliv jiné heslo: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Operace zrušena, pozice klíče NEBYLA vymazána.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Zadejte heslo, které se má smazat: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Zadejte nové heslo pro pozici klíče: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Zadejte jakékoliv existující heslo: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Zadejte heslo, které má být změněno: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Zadejte nové heslo: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Zadejte heslo pro pozici klíče, který má být převeden: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "U operace isLuks je podporován pouze jeden argument se zařízením."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Výpis hlavičky s klíčem svazku je citlivý údaj,\n"
+"který umožňuje přístup k šifrovanému oddílu bez znalosti hesla.\n"
+"Tento výpis by měl být uložen na bezpečném místě a v zašifrované podobě."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Pozice klíče %d neobsahuje nepřiřazený klíč."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Výpis hlavičky s nepřiřazeným klíčem je citlivý údaj.\n"
+"Tento výpis by měl být uložen na bezpečném místě a v zašifrované podobě."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Je vyžadován přepínač --header-backup-file."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s není zařízení spravované nástrojem cryptsetup."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Reaktivace není na zařízení typu %s podporována"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Nerozpoznaná metadata druhu zařízení %s."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Příkaz vyžaduje jako argumenty zařízení a mapovaný název."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Tento úkon smaže všechny pozice s klíči na zařízení %s.\n"
+"Po jeho dokončení zařízení bude nepoužitelné."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Operace zrušena, pozice s klíči NEBYLY smazány.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Neplatný druh formátu LUKS. Podporován je pouze LUKS1 a LUKS2."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Zařízení je již druhu %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Tato operace převede formát %s na %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Operace zrušena, zařízení NEBYLO převedeno.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Chybí přepínač --priority, --label nebo --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Token %d je neplatný."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Token %d se používá."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Přidání tokenu %d klíčenky LUKS2 selhalo."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Přiřazení tokenu %d do pozice s klíčem %d selhalo."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Token %d se nepoužívá."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Import tokenu ze souboru selhal."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Získání tokenu %d za účelem exportu selhalo."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "Parametr --key-description je při přidávání tokenu povinný."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Akce vyžaduje určitý token. Použijte parametr --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Neplatná operace tokenu %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Automaticky nalezené aktivní zařízení DM „%s“ pro datové zařízení %s.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Zařízení %s není blokovým zařízením.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Držitele zařízení %s nebylo možné automaticky nalézt."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Nelze rozhodnout, jestli zařízení %s je nebo není aktivováno.\n"
+"Jste si jisti, že si přejete pokračovat v přešifrování v režimu offline?\n"
+"To může vést k poškození dat, bylo-li zařízení ve skutečnosti aktivováno.\n"
+"Pro přešifrování za běhu použijte parametr --active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Neplatný druh zařízení LUKS."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Přešifrování bez odpojené hlavičky (--header) není možné bez zmenšení velikosti datového zařízení (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Požadovaný počátek dat musí být menší nebo roven polovině parametru --reduce-device-size"
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Upravuje se hodnota --reduce-device-size na dvojnásobek --offset %<PRIu64> (v sektorech).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Šifrování je podporováno jen s formátem LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "Na %s zjištěno zařízeno LUKS. Přejete si toto zařízení LUKS znovu zašifrovat?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Dočasný soubor s hlavičkou %s již existuje. Operace se ruší."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Dočasný soubor s hlavičkou %s nelze vytvořit."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s je nyní aktivní a připraveno pro přešifrování za běhu.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Nedostatek pozic s klíči pro přešifrování."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Soubor s klíčem lze použít jen s přepínačem --key-slot nebo s právě jednou aktivní pozicí klíče."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Zadejte heslo pro pozici klíče %d: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Zadejte heslo pro pozici klíče %u: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Příkaz vyžaduje jako argument zařízení."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "Nyní je podporován pouze formát LUKS2. Pro LUKS1, prosím, použijte nástroj cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Zastaralé offline přešifrování již probíhá. Použijte nástroj cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Přešifrování zařízení s profilem integrity není podporováno."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "Přešifrování LUKS2 je již inicializováno. Operace se ruší."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "Zařízení LUKS2 se nepřešifrovává."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<zařízení> [--type <druh>] [<název>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "otevře zařízení jako <název>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<název>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "zavře zařízení (odstraní mapování)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "změní velikost aktivního zařízení"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "zobrazí stav zařízení"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <šifra>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "zhodnotí výkon šifry"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<zařízení>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "pokusí se opravit metadata uložená na disku"
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "přešifruje zařízení LUKS2"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "smaže všechny pozice s klíči (odstraní šifrovací klíč)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "převede formát LUKS do/z formátu LUKS2"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "nastaví trvalé volby konfigurace pro LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<zařízení> [<soubor_s_novým_klíčem>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "naformátuje zařízení LUKS"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "do zařízení LUKS přidá klíč"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
 msgstr "<zařízení> [<soubor_s_klíčem>]"
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "odstraní zadaný klíč nebo soubor s klíčem ze zařízení LUKS"
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "odstraní zadaný klíč nebo soubor s klíčem ze zařízení LUKS"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "změní zadaný klíč nebo soubor s klíčem u zařízení LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "převede klíč do nových parametrů PBKDF"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<zařízení> <pozice_klíče>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "smaže klíč s číslem <pozice_klíče> ze zařízení LUKS"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "zobrazí UUID zařízení LUKS"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "otestuje <zařízení> na hlavičku oddílu LUKS"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "vypíše údaje o oddílu LUKS"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "vypíše údaje o oddílu TCRYPT"
+
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "vypíše údaje o zařízení BITLK"
+
+# TODO: not consistent with previous line
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Uspí zařízení LUKS a smaže klíč (všechny operace budou zmrazeny)"
+
+# TODO: not consistent with previous line
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Probudí uspané zařízení LUKS"
+
+# TODO: not consistent with previous line
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Zálohuje hlavičku zařízení LUKS a jeho pozice s klíči"
+
+# TODO: not consistent with previous line
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Obnoví hlavičku zařízení LUKS a jeho pozice s klíči"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <zařízení>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Zachází s tokeny LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<akce> je jedna z:\n"
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"Rovněž lze použít aliasy se starým zápisem <akce>:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<název> je zařízení, které se má vytvořit v %s\n"
+"<zařízení> je zašifrované zařízení\n"
+"<pozice_klíče> je číslo pozice klíče LUKS, který se má upravit\n"
+"<soubor_s_klíčem> je volitelný soubor s novým klíčem pro akci luksAddKey\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Výchozí zakompilovaný formát metadat (pro akci luksFormat) je %s.\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Výchozí zakompilované parametry klíče a hesla:\n"
+"\tMaximální velikost souboru s klíčem: %d kB, maximální délka interaktivního hesla %d (znaků)\n"
+"Výchozí PBKDF pro LUKS1: %s, doba opakování: %d (ms)\n"
+"Výchozí PBKDF pro LUKS2: %s\n"
+"\tDoba iterací: %d, nutná paměť: %d kB, souběžná vlákna: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Výchozí zakompilované parametry šifer zařízení:\n"
+"\tloop-AES: %s, Klíč %d bitů\n"
+"\tplain: %s, Klíč: %d bitů, Haš hesla: %s\n"
+"\tLUKS: %s, Klíč: %d bitů, Haš hlavičky LUKS: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: V režimu XTS (dva vnitřní klíče) bude výchozí velikost klíče zdvojnásobena.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: vyžaduje %s jako argumenty"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Zobrazí tuto nápovědu"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Zobrazí stručný návod na použití"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Vypíše verzi balíku"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Přepínače nápovědy:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Zobrazuje podrobnější chybové hlášky"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Zobrazuje ladicí hlášky"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Zobrazuje ladicí hlášky včetně metadat JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "Šifra použita k zašifrování disku (vizte /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "Haš použit k vytvoření šifrovacího klíče z hesla"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Ověřuje heslo dvojitým dotazem"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Klíč načte ze souboru"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "(Hlavní) klíč svazku načte ze souboru."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Vypíše (hlavní) klíč svazku namísto údajů o pozicích klíčů"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "Velikost šifrovacího klíče"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "BITY"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Omezí čtení ze souboru s klíčem"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "bajty"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Přeskočí daný počet bajtů na začátku souboru s klíčem"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Omezí čtení z nově přidaného souboru s klíčem"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Přeskočí daný počet bajtů na začátku nově přidaného souboru s klíčem"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Číslo pozice pro nový klíč (výchozí je první volná)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "Velikost zařízení"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "SEKTORY"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Použije zadanou velikost zařízení (ignoruje zbytek zařízení). NEBEZPEČNÉ!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "Poloha začátku dat v podkladovém zařízení"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Kolik sektorů šifrovaných dat se má na začátku přeskočit"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Vytvoří mapování určené jen pro čtení"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Nevyžaduje potvrzení"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Časový limit pro interaktivní dotaz na heslo (v sekundách)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "sekundy"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Aktualizace ukazatele postupu (v sekundách)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Kolikrát se lze zeptat na heslo"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Zarovnává data na hranici <n> sektorů – pro luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Soubor se zálohou hlavičky LUKS a pozic s klíči"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Pro vytvoření klíče svazku použije /dev/random"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Pro vytvoření klíče svazku použije /dev/urandom"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Zařízení sdílí s jiným nepřekrývajícím se šifrovaným segmentem"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "Použije zařízení s UUID"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Povolí u daného zařízení požadavky na zahození (TRIM)"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Zařízení nebo soubor s oddělenou hlavičkou LUKS"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Zařízení neaktivuje, jen zkontroluje heslo"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Použije se skrytá hlavička (skryté zařízení TCRYPT)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Zařízení je systémová jednotka TCRYPT (se zavaděčem)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Použije se záložní (druhá) hlavička TCRYPT"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Hledá také zařízení kompatibilní s VeraCrypt"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Osobní iterační činitel (PIM) pro zařízení kompatibilní s VeraCrypt"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Zeptá se na Osobní iterační činitel pro zařízení kompatibilní s VeraCrypt"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Druh metadat zařízení: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Vypne kontrolku odolnosti hesla (byla-li zapnuta)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Použije výkonnostně kompatibilní přepínač dmcryptu same_cpu_crypt"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Použije výkonnostně kompatibilní přepínač dmcryptu submit_from_crypt_cpus"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Odstranění zařízení se odloží, dokud jej poslední uživatel neuzavře"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Pro serializaci paměti těžkého PBKDF použije globální zámek (obezlička při nedostatku paměti)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Doba opakování PBKDF pro LUKS (v ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "milisekundy"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Algoritmus PBKDF (pro LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "omezení paměťové náročnosti PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilobajty"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "náročnost paralelizace PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "vlákna"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "náročnost iterací PBKDF (vynuceno, vypne test složitosti)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Priorita pozice klíče: ignore [ignorovat], normal [normální], prefer [upřednostnit]"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Vypne zamykání metadata uložených na disku"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Vypne načítání klíčů svazků přes jadernou klíčenku"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Algoritmus pro integritu dat (pouze LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Vypne žurnál pro zařízení s integritou"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Po formátu nevymazat zařízení"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Použije neefektivní zastaralé vyplňování (stará jádra)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Neptá se na heslo, když aktivace tokenem selže"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Číslo tokenu (výchozí cokoliv)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Popis klíče"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Velikost sektoru šifrování (výchozí: 512 bajtů)"
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Inicializační vektor počítá ve velikostech sektoru (nikoliv po 512 bajtech)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Nastaví trvalé příznaky pro aktivaci zařízení"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Nastaví jmenovku zařízení LUKS2"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Nastaví jmenovku podsystému zařízení LUKS2"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Vytvoří nebo vypíše nepřiřazenou (žádný datový segment nepřiřazen) LUKS2 pozici s klíčem"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Načte nebo zapíše JSON z nebo do souboru"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Velikost oblasti s metadaty hlavičky LUKS2"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Velikost oblasti s pozicemi klíčů hlavičky LUKS"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Reaktivuje zařízení s novými parametry"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Pozice s klíčem LUKS2: Velikost šifrovacího klíče"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "Pozice s klíčem LUKS2: Šifra použitá pro šifrování pozice s klíčem"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Zašifruje zařízení LUKS2 (šifrování bez mezikopie)."
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Natrvalo dešifruje zařízení LUKS2 (odstraní šifrování)."
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Inicializuje přešifrování LUKS2 pouze v metadatech."
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Pouze dokončí již inicializované přešifrování LUKS2."
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Zmenší velikost datového zařízení (posune začátek dat). NEBEZPEČNÉ!"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Maximální velikost horké zóny při přešifrování."
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Druh odolnosti horké zóny při přešifrování (checksum [kontrolní součet], journal [žurnál], none [žádná])"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "Algoritmus kontrolního součtu při přešifrování"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Přebije automatické hledání zařízení DM pro přešifrování"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[PŘEPÍNAČ…] <akce> <přepínače_akce>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Chybí argument <akce>."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Neznámá akce."
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Přepínače --refresh a --test-passphrase se vzájemně vylučují."
+
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "Přepínač --deferred je dovolen jen při příkazu zavření."
+
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Přepínač --shared je dovolen jen při úkonu otevírání zařízení plain."
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Přepínač --allow-discards je dovolen jen při úkonu otevírání."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Přepínač --persistent je dovolen jen při úkonu otevírání."
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Přepínač --serialize-memory-hard-pbkdf je dovolen jen při úkonu otevírání."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Přepínač --persistent není dovolen současně s --test-passphrase."
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"Přepínač --key-size je dovolen jen pro akce luksFormat, luksAddKey,\n"
+"open a benchmark. Čtení ze souboru s klíčem lze omezit\n"
+"pomocí --keyfile-size=(bajty)."
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Přepínač --integrity je dovolen pouze u luksFormat (LUKS2)."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Přepínač --integrity-no-wipe smí být použit jen při formátování s rozšířením integrity."
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Přepínače --label a --subsystem jsou dovoleny jen při úkonech luksFormat a config s LUKS2."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Přepínač --test-passphrase je dovolen pouze při otevírání zařízení LUKS, TCRYPT a BITLK."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Velikost klíče musí být násobkem 8 bitů."
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "Pozice klíče není platná."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Přepínač --key-file má přednost před zadaným argumentem souboru s klíčem."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "U přepínače není záporné číslo dovoleno."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Je dovolen pouze jeden argument přepínače --key-file."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Je dovolen pouze jeden z přepínačů --use-[u]random."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "Přepínač --use-[u]random je dovolen pouze u luksFormat."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "Přepínač --uuid je dovolen pouze u luksFormat a luksUUID."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "Přepínač --align-payload je dovolen pouze u luksFormat."
 
-#: src/cryptsetup.c:1370
-msgid "changes supplied key or key file of LUKS device"
-msgstr "změní zadaný klíč nebo soubor s klíčem u zařízení LUKS"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Přepínače --luks2-metadata-size a --opt-luks2-keyslots-size jsou dovoleny jen při úkonu luksFormat s LUKS2."
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<zařízení> <pozice_klíče>"
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Zadána neplatná velikost metadat LUKS2."
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr "smaže klíč s číslem <pozice_klíče> ze zařízení LUKS"
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Zadána neplatná velikost pozic s klíči LUKS2."
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "zobrazí UUID zařízení LUKS"
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Přepínače --align-payload a --offset nelze kombinovat."
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "otestuje <zařízení> na hlavičku oddílu LUKS"
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Přepínač --skip je podporován jen při otevírání zařízení plain a loopaes."
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
-msgstr "vypíše údaje o oddílu LUKS"
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Přepínač --offset je podporován jen při otevírání zařízení plain a loopaes a při úkonu luksFormat a přešifrování."
 
-#: src/cryptsetup.c:1375
-msgid "dump TCRYPT device information"
-msgstr "vypíše údaje o oddílu TCRYPT"
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Přepínač --tcrypt-hidden, --tcrypt-system nebo --tcrypt-backup je podporován jen u zařízení TCRYPT."
 
-# TODO: not consistent with previous line
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr "uspí zařízení LUKS a smaže klíč (všechny operace budou zmrazeny)"
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Přepínač --tcrypt-hidden nelze použít s přepínačem --allow-discards."
 
-# TODO: not consistent with previous line
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "probudí uspané zařízení LUKS"
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Přepínač --veracrypt je podporován jen u typu zařízení TCRYPT."
 
-# TODO: not consistent with previous line
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
-msgstr "zálohuje hlavičku zařízení LUKS a jeho pozice s klíči"
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Zadán neplatný argument parametru --veracrypt-pim."
 
-# TODO: not consistent with previous line
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
-msgstr "obnoví hlavičku zařízení LUKS a jeho pozice s klíči"
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Přepínač --veracrypt-pim je podporován jen u zařízení kompatibilním s VeraCrypt."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Přepínač --veracrypt-query-pim je podporován jen u zařízení kompatibilním s VeraCrypt."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Přepínače --veracrypt-pim a --veracrypt-query-pim se vzájemně vylučují."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Přepínač --priority smí mít pouze argument ignore, normal a prefer."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Je nutné určit pozici s klíčem."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Funkce pro odvození klíče na základě hesla (PBKDF) smí být pouze pbkdf2 nebo argon2i/argon2id."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Vynucené iterace PBKDF nelze kombinovat s volnou doby iterací."
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "Tento příkaz nepodporuje volbu velikosti sektoru."
+
+# FIXME: "Large IV sectors" should read "IV large sectors".
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "Volba inicializačního vektoru s velkými sektory je podporována jen při otevírání zařízení typu plain s velikostí sektoru větší než 512 bajtů."
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "Přepínač --unbound vyžaduje velikost klíče."
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Přepínač --unbound lze použít pouze s akcemi luksAddKey nebo luksDump."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "Přepínač --refresh lze použít pouze s úkonem otevření."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "Zamykání metadata nelze vypnout."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Zadána neplatná maximální velikost horké zóny při přešifrování."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Zadána neplatná velikost zařízení."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Maximální velikost zmenšení zařízení je 1 GiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Velikost zmenšení musí být násobkem 512bajtových sektorů."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "Zadána neplatná velikost dat."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Velikost ke zmenšení přetekla."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "Dešifrování LUKS2 vyžaduje přepínač --header."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Velikost zařízení musí být násobkem 512bajtových sektorů."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Přepínače --reduce-device-size a --data-size nelze kombinovat."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Přepínače --device-size a --size nelze kombinovat."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Přepínače --ignore-corruption a --restart-on-corruption nelze použít najednou."
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Zadán neplatný řetězec se solí."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Nelze vytvořit obraz hašů %s určený k zápisu."
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Nelze vytvořit obraz FEC %s určený k zápisu."
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Zadán neplatný řetězec s kořenovým hašem."
+
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr "Neplatné soubor s podpisem %s."
+
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Soubor s podpisem %s nelze číst."
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<zařízení_dat> <zařízení_hašů>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "naformátuje zařízení"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<zařízení_dat> <zařízení_hašů> <kořenový_haš>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "ověří zařízení"
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<zařízení_dat> <název> <zařízení_hašů> <kořenový_haš>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "zobrazí stav aktivního zařízení"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<zařízení_hašů>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "zobrazí údaje z disku"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/veritysetup.c:416
+#, c-format
 msgid ""
 "\n"
-"<action> is one of:\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
 msgstr ""
 "\n"
-"<akce> je jedna z:\n"
+"<název> je zařízení, které bude vytvořeno pod %s\n"
+"<zařízení_dat> je datové zařízení\n"
+"<zařízení_hašů> je zařízení obsahující ověřovací data\n"
+"<kořenový_haš> haš kořenového uzlu na <zařízení_hašů>\n"
 
-#: src/cryptsetup.c:1402
+#: src/veritysetup.c:423
+#, c-format
 msgid ""
 "\n"
-"You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
 msgstr ""
 "\n"
-"Rovněž lze použít starý aliasy zápisu <akce>:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"Výchozí zakompilované parametry dm-verity:\n"
+"\tHaš: %s, Datový blok (bajty): %u, Blok hašů (bajty): %u, Velikost soli: %u, Formát haše: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Nepoužije superblok verity"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Druh formátu (1 – běžný, 0 – původní z OS Chrome)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "číslo"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Velikost bloku na zařízení dat"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Velikost bloku na zařízení hašů"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "Paritní bajty FEC"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Počet bloků v datovém souboru"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "bloky"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Cesta k zařízení s daty pro opravu chyb"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "cesta"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Poloha začátku dat v zařízení hašů"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Poloha začátku dat v zařízení FEC"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Hašovací algoritmus"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "řetězec"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Sůl"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "šestnáctkový řetězec"
+
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Cesta k souboru s podpisem kořenového otisku"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Restartuje jádro, pokud je zjištěno poškození"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ignoruje poškození, pouze jej zaznamená"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Neověřuje vynulované bloky"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Ověří datový blok pouze při prvním čtení"
 
-#: src/cryptsetup.c:1406
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Přepínače --ignore-corruption, --restart-on-corruption nebo --ignore-zero-blocks jsou dovoleny jen při úkonu otevírání."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Přepínač --root-hash-signature smí být použit jen při otevírání."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Přepínače --ignore-corruption a --restart-on-corruption nelze použít najednou."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Soubor s klíčem %s nelze číst."
+
+# FIXME: Pluralize
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Ze souboru s klíčem %2$s nelze přečíst %1$d bajtů."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formátováno s velikostí značky %u, vnitřní integrita %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<zařízení_s_daty_integrity>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<zařízení_s_daty_integrity> <název>"
+
+#: src/integritysetup.c:502
 #, c-format
 msgid ""
 "\n"
 "<name> is the device to create under %s\n"
-"<device> is the encrypted device\n"
-"<key slot> is the LUKS key slot number to modify\n"
-"<key file> optional key file for the new key for luksAddKey action\n"
+"<integrity_device> is the device containing data with integrity tags\n"
 msgstr ""
 "\n"
-"<název> je zařízení, které se má vytvořit v %s\n"
-"<zařízení> je zašifrované zařízení\n"
-"<pozice_klíče> je číslo pozice klíče LUKS, který se má upravit\n"
-"<soubor_s_klíčem> je volitelný soubor s novým klíčem pro akci luksAddKey\n"
+"<název> je zařízení, které bude vytvořeno pod %s\n"
+"<zařízení_s_daty_integrity> je zařízení obsahující data se značkami integrity\n"
 
-#: src/cryptsetup.c:1413
+#: src/integritysetup.c:507
 #, c-format
 msgid ""
 "\n"
-"Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
 msgstr ""
 "\n"
-"Výchozí zakompilované parametry klíče a hesla:\n"
-"\tMaximální velikost souboru s klíčem: %d kB, Maximální délka interaktivního "
-"hesla %d (znaků)\n"
-"Výchozí čas opakování PBKDF2 pro LUKS: %d (ms)\n"
+"Výchozí zakompilované parametry dm-integrity:\n"
+"\tAlgoritmus kontrolního součtu: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Cesta k zařízení s daty (je-li odděleno)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Velikost žurnálu"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Prokládat sektory"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Zaplněnost žurnálu"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "procenta"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Perioda vyprazdňování žurnálu"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Počet 512bajtových sektorů na bit (režim bitmapy)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Perioda vyprazdňování při režimu bitmapy"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Velikost značky (na sektor)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Velikost sektoru"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Velikost vyrovnávací paměti"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Algoritmus pro kontrolu integrity dat"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Velikost klíče pro integritu dat"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Klíč pro integritu načte ze souboru"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Algoritmus pro integritu žurnálu"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Velikost klíče integrity žurnálu"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Klíč integrity žurnálu načte ze souboru"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Algoritmus šifrování žurnálu"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Velikost šifrovacího klíče žurnálu"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Šifrovací klíč žurnálu načte ze souboru"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Režim obnovy (žádný žurnál, žádná kontrola značek)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Ke sledování změn použije bitmapu a vypne žurnál pro zařízení s integritou"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Automaticky přepočítá počáteční značky."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Přepínač --integrity-recalculate smí být použit jen při otevírání."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Přepínače --journal-size, --interleave-sectors, --sector-size, --tag-size a --no-wipe lze použít jen při formátování."
 
-#: src/cryptsetup.c:1420
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Zadána neplatná velikost žurnálu."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Musí být zadány oba přepínače pro soubor s klíčem a velikostí klíče."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Je-li použit klíč integrity, musí být zadán algoritmus integrity."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Musí být zadány oba přepínače pro soubor s klíčem žurnálu a velikostí klíče."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Je-li použit klíč integrity žurnálu, musí být zadán algoritmus integrity žurnálu."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Musí být zadány oba přepínače pro soubor s šifrovacím klíčem žurnálu a velikostí klíče."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Je-li použit šifrovací klíč žurnálu, musí být zadán algoritmus šifrování žurnálu."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Přepínače režimu bitmapy a obnovení se vzájemně vylučují."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Přepínače žurnálu nelze použití spolu s režimem bitmapy."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Přepínače bitmapy lze použít jen při režimu bitmapy."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Přešifrování již probíhá."
+
+#: src/cryptsetup_reencrypt.c:208
 #, c-format
-msgid ""
-"\n"
-"Default compiled-in device cipher parameters:\n"
-"\tloop-AES: %s, Key %d bits\n"
-"\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
-msgstr ""
-"\n"
-"Výchozí zakompilované parametry šifer zařízení:\n"
-"\tloop-AES: %s, Klíč %d bitů\n"
-"\tplain: %s, Klíč: %d bitů, Haš hesla: %s\n"
-"\tLUKS1: %s, Klíč: %d bitů, Haš hlavičky LUKS: %s, RNG: %s\n"
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Zařízení %s nelze výlučně otevřít. Zařízení se používá."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Alokace zarovnané paměti se nezdařila."
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup_reencrypt.c:229
 #, c-format
-msgid "%s: requires %s as arguments"
-msgstr "%s: vyžaduje %s jako argumenty"
+msgid "Cannot read device %s."
+msgstr "Ze zařízení %s nelze číst."
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
-msgid "Show this help message"
-msgstr "Zobrazí tuto nápovědu"
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "LUKS1 zařízení %s se označuje za nepoužitelné."
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
-msgid "Display brief usage"
-msgstr "Zobrazí stručný návod na použití"
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Na zařízení %s se nastavuje příznak offline přešifrování."
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Přepínače nápovědy:"
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Zařízení %s není možné zapsat."
 
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
-msgid "Print package version"
-msgstr "Vypíše verzi balíku"
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Nelze zapsat soubor s protokolem přešifrování."
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
-msgid "Shows more detailed error messages"
-msgstr "Zobrazuje podrobnější chybové hlášky"
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Soubor s protokolem přešifrování nelze načíst."
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
-msgid "Show debug messages"
-msgstr "Zobrazuje ladicí hlášky"
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Soubor s protokolem %s existuje, pokračuje se v přerušeném přešifrování.\n"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
-msgid "The cipher used to encrypt the disk (see /proc/crypto)"
-msgstr "Šifra použita k zašifrování disku (vizte /proc/crypto)"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Aktivuje se dočasné zařízení za pomoci staré hlavičky LUKS."
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
-msgid "The hash used to create the encryption key from the passphrase"
-msgstr "Haš použit k vytvoření šifrovacího klíče z hesla"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Aktivuje se dočasné zařízení za pomoci nové hlavičky LUKS."
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Aktivace dočasných zařízení selhala."
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Nastavení polohy dat selhalo."
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Nastavení velikosti metadat selhalo."
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Byla vytvořena nová hlavička LUKS zařízení %s."
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Tato verze cryptsetup-reencrypt neumí zacházet s novým vnitřním druhem tokenů %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Přečtení příznaků pro aktivaci ze záložní hlavičky selhalo."
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Zápis příznaků pro aktivaci do nové hlavičky selhal."
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Čtení požadavků ze záložní hlavičky selhalo."
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "Záloha hlavičky %s zařízení %s byla vytvořena."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Záložní hlavičky LUKS se nepodařilo vytvořit."
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Hlavičku %s na zařízení %s nelze obnovit."
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "Hlavička %s na zařízení %s byla obnovena."
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Nelze otevřít dočasné zařízení LUKS."
 
-#: src/cryptsetup.c:1481
-msgid "Verifies the passphrase by asking for it twice"
-msgstr "Ověřuje heslo dvojitým dotazem"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Velikost zařízení nelze zjistit."
 
-# TODO: Remove period
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
-msgstr "Klíč načte ze souboru"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Chyba vstupu/výstupu během přešifrování."
 
-# TODO: Remove period
-#: src/cryptsetup.c:1483
-msgid "Read the volume (master) key from file."
-msgstr "(Hlavní) klíč svazku načte ze souboru"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Poskytnuté UUID není platné."
 
-# TODO: Remove period
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr "Vypíše (hlavní) klíč svazku namísto údajů o pozicích klíčů"
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Nelze otevřít soubor s protokolem přešifrování."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "The size of the encryption key"
-msgstr "Velikost šifrovacího klíče"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Žádné dešifrování není rozpracované. Poskytnuté UUID lze použít jen k dokončení pozastaveného procesu dešifrování."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "BITS"
-msgstr "BITY"
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Parametry PBKDF pro pozici klíče %i změněny."
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
-msgid "Limits the read from keyfile"
-msgstr "Omezí čtení ze souboru s klíčem"
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Velikost bloku přešifrování"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
-msgid "bytes"
-msgstr "bajty"
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
-msgid "Number of bytes to skip in keyfile"
-msgstr "Přeskočí daný počet bajtů na začátku souboru s klíčem"
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Nezmění klíč, oblast s daty se nepřešifruje"
 
-#: src/cryptsetup.c:1488
-msgid "Limits the read from newly added keyfile"
-msgstr "Omezí čtení z nově přidaného souboru s klíčem"
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Nový (hlavní) klíč svazku načte ze souboru"
 
-#: src/cryptsetup.c:1489
-msgid "Number of bytes to skip in newly added keyfile"
-msgstr "Přeskočí daný počet bajtů na začátku nově přidaného souboru s klíčem"
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Doba opakování PBKDF2 pro LUKS (v ms)"
 
-#: src/cryptsetup.c:1490
-msgid "Slot number for new key (default is first free)"
-msgstr "Číslo pozice pro nový klíč (výchozí je první volná)"
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "K zařízením se bude přistupovat pomocí přímého I/O"
 
-#: src/cryptsetup.c:1491
-msgid "The size of the device"
-msgstr "Velikost zařízení"
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Po každém bloku se zavolá fsync"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
-msgid "SECTORS"
-msgstr "SEKTORY"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Po každém bloku se aktualizuje soubor s protokolem"
 
-#: src/cryptsetup.c:1492
-msgid "The start offset in the backend device"
-msgstr "Poloha začátku dat v podkladovém zařízení"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Použije se pouze tato pozice (ostatní budou zakázány)"
 
-#: src/cryptsetup.c:1493
-msgid "How many sectors of the encrypted data to skip at the beginning"
-msgstr "Kolik sektorů šifrovaných dat se má na začátku přeskočit"
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Vytvoří novou hlavičku na nešifrovaném zařízení"
 
-#: src/cryptsetup.c:1494
-msgid "Create a readonly mapping"
-msgstr "Vytvoří mapování určené jen pro čtení"
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Natrvalo dešifruje zařízení (odstraní šifrování)"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "Doba opakování PBKDF2 pro LUKS (v ms)"
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "UUID, které se použije pro dokončení dešifrování"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "milisekundy"
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Druh metadat LUKS: luks1, luks2"
 
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
-msgid "Do not ask for confirmation"
-msgstr "Nevyžaduje potvrzení"
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[PŘEPÍNAČ…] <zařízení>"
 
-#: src/cryptsetup.c:1497
-msgid "Timeout for interactive passphrase prompt (in seconds)"
-msgstr "Časový limit pro interaktivní dotaz na heslo (v sekundách)"
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Přešifrování změní: %s%s%s%s%s%s."
 
-#: src/cryptsetup.c:1497
-msgid "secs"
-msgstr "sekundy"
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "klíč svazku"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "Kolikrát se lze zeptat na heslo"
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "nastaví haš na "
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr "Zarovnává data na hranici <n> sektorů – pro luksFormat"
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", nastaví šifru na "
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Vyžadován argument."
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Soubor se zálohou hlavičky LUKS a jejích pozic s klíči"
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Velikost bloku při přešifrování může nabývat hodnot pouze mezi 1 a 64 MiB."
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "Klíče svazku vytvoří z /dev/random."
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "Maximální velikost zmenšení zařízení je 64 MiB."
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Klíč svazku vytvoří z /dev/urandom."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Přepínač --new musí být použit spolu s --reduce-device-size nebo --header."
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr "Zařízení sdílí s jiným nepřekrývajícím se šifrovaným segmentem."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Přepínač --keep-key lze použít jen s přepínači --hash, --iter-time nebo --pbkdf-force-iterations."
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "Použije zařízení s UUID."
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "Přepínač --new nelze být použit spolu s --decrypt."
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Povolí u daného zařízení požadavky na zahození (TRIM)."
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "Přepínač --decrypt se neslučuje se zadanými parametry."
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Zařízení nebo soubor s oddělenou hlavičkou LUKS."
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Přepínač --uuid lze použít jen spolu s přepínačem --decrypt."
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Zařízení neaktivuje, jen zkontroluje heslo."
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Neplatný druh LUKS. Použijte jeden z: „luks“, „luks1“ nebo „luks2“"
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Použije se skrytá hlavička (skryté zařízení TCRYPT)."
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Chyba při čtení odpovědi z terminálu."
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Zařízení je systémová jednotka TCRYPT (se zavaděčem)."
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Příkaz úspěšně vykonán.\n"
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Použije se záložní (druhá) hlavička TCRYPT."
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "špatné nebo chybějící parametry"
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Hledá také zařízení kompatibilní s VeraCrypt."
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "žádné oprávnění nebo chybné heslo"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Druh metadat zařízení: luks, plain, loopaes, tcrypt."
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "nedostatek paměti"
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Vypne kontrolku odolnosti hesla (byla-li zapnuta)."
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "zadáno špatné zařízení nebo soubor"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr "Použije výkonnostně kompatibilní přepínač dmcryptu same_cpu_crypt."
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "zařízení již existuje nebo zařízení je zaneprázdněno"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr ""
-"Použije výkonnostně kompatibilní přepínač dmcryptu submit_from_crypt_cpus."
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "neznámá chyba"
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
-msgid "[OPTION...] <action> <action-specific>"
-msgstr "[PŘEPÍNAČ…] <akce> <přepínače_akce>"
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Příkaz selhal s kódem %i (%s).\n"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Režim FIPS zapnut.\n"
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Pozice klíče %i vytvořena."
 
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
-msgid "Argument <action> missing."
-msgstr "Chybí argument <akce>."
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Pozice klíče %i odemknuta."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
-msgid "Unknown action."
-msgstr "Neznámá akce."
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Pozice klíče %i odemknuta."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr "Přepínač --shared je dovolen jen při úkonu otevírání zařízení plain.\n"
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Token %i vytvořen."
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr "Přepínač --allow-discards je dovolen jen při úkonu otevírání.\n"
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Token %i se odstraněn."
 
-#: src/cryptsetup.c:1657
+#: src/utils_tools.c:464
 msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+"\n"
+"Wipe interrupted."
 msgstr ""
-"Přepínač --key-size je dovolen jen u luksFormat, open a benchmark.\n"
-"Čtení ze souboru s klíčem lze omezit pomocí --keyfile-size=(bajty)."
+"\n"
+"Výmaz přerušen."
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
-msgstr ""
-"Přepínač --test-passphrase je dovolen pouze při otevírání zařízení LUKS a "
-"TCRYPT.\n"
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "POZOR: Zařízení %s již obsahuje vzorec oddílu „%s“.\n"
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
-msgid "Key size must be a multiple of 8 bits"
-msgstr "Velikost klíče musí být násobkem 8 bitů."
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "POZOR: Zařízení %s již obsahuje vzorec superbloku „%s“.\n"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
-msgid "Key slot is invalid."
-msgstr "Pozice klíče není platná."
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Sondu vzorců zařízení se nepodařilo inicializovat."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"Přepínač --key-file má přednost před zadaným argumentem souboru s klíčem.\n"
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "O zařízení %s nebylo možné zjistit údaje."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
-msgid "Negative number for option not permitted."
-msgstr "U přepínače není záporné číslo dovoleno."
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Zařízení %s se používá. K formátování nelze přikročit."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
-msgid "Only one of --use-[u]random options is allowed."
-msgstr "Je dovolen pouze jeden z přepínačů --use-[u]random."
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Soubor %s nebylo možné otevřít pro čtení i zápis."
 
-#: src/cryptsetup.c:1699
-msgid "Option --use-[u]random is allowed only for luksFormat."
-msgstr "Přepínač --use-[u]random je dovolen pouze u luksFormat."
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Existující vzorec „%s“ oddílu (poloha: %<PRIi64> bajtů) na zařízení %s bude vymazán."
 
-#: src/cryptsetup.c:1703
-msgid "Option --uuid is allowed only for luksFormat and luksUUID."
-msgstr "Přepínač --uuid je dovolen pouze u luksFormat a luksUUID."
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Existující vzorec superbloku „%s“ (poloha: %<PRIi64> bajtů) na zařízení %s bude vymazán."
 
-#: src/cryptsetup.c:1707
-msgid "Option --align-payload is allowed only for luksFormat."
-msgstr "Přepínač --align-payload je dovolen pouze u luksFormat."
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Odstranění vzorce ze zařízení selhalo."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Přepínač --skip je podporován jen při otevírání zařízení plain a loopaes.\n"
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Otestování zařízení %s na vzorce selhalo."
 
-#: src/cryptsetup.c:1719
+#: src/utils_tools.c:629
 msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
+"\n"
+"Reencryption interrupted."
 msgstr ""
-"Přepínač --offset je podporován jen při otevírání zařízení plain a loopaes.\n"
+"\n"
+"Přešifrování přerušeno."
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Odolnost hesla nelze prověřit: %s"
 
-#: src/cryptsetup.c:1725
+#: src/utils_password.c:51
+#, c-format
 msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
+"Password quality check failed:\n"
+" %s"
 msgstr ""
-"Přepínač --tcrypt-hidden, --tcrypt-system nebo --tcrypt-backup je podporován "
-"jen u zařízení TCRYPT.\n"
-
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
-msgstr "Přepínač --tcrypt-hidden nelze použít s přepínačem --allow-discards.\n"
+"Kontrola odolnosti hesla selhala:\n"
+" %s"
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "Přepínač --veracrypt je podporován jen u typu zařízení TCRYPT.\n"
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Kontrola odolnosti hesla selhala: Špatné heslo (%s)"
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "Zadán neplatný řetězec se solí.\n"
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Chyba při čtení hesla z terminálu."
 
-#: src/veritysetup.c:88
-#, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "Nelze vytvořit obraz hašů %s určený k zápisu.\n"
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Ověřte heslo: "
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "Zadán neplatný řetězec s kořenovým hašem.\n"
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Hesla se neshodují."
 
-#: src/veritysetup.c:308
-msgid "<data_device> <hash_device>"
-msgstr "<zařízení_dat> <zařízení_hašů>"
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Ve vstupu z terminálu nelze měnit polohu."
 
-#: src/veritysetup.c:308
-msgid "format device"
-msgstr "naformátuje zařízení"
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Zadejte heslo: "
 
-#: src/veritysetup.c:309
-msgid "<data_device> <hash_device> <root_hash>"
-msgstr "<zařízení_dat> <zařízení_hašů> <kořenový_haš>"
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Zadejte heslo pro %s: "
 
-#: src/veritysetup.c:309
-msgid "verify device"
-msgstr "ověří zařízení"
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "S tímto heslem není dostupný žádný klíč."
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<název> <zařízení_dat> <zařízení_hašů> <kořenový_haš>"
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Nejsou dostupné žádné použitelné pozice s klíči."
 
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "vytvoří aktivní zařízení"
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Soubor s klíčem %s nelze otevřít pro zápis."
 
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "odstraní (deaktivuje) zařízení"
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Do souboru s klíčem %s nelze zapsat."
 
-#: src/veritysetup.c:312
-msgid "show active device status"
-msgstr "zobrazí stav aktivního zařízení"
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Soubor %s se nepodařilo otevřít pouze pro čtení."
 
-#: src/veritysetup.c:313
-msgid "<hash_device>"
-msgstr "<zařízení_hašů>"
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Poskytněte JSON s platným tokenem LUKS2:\n"
 
-#: src/veritysetup.c:313
-msgid "show on-disk information"
-msgstr "zobrazí údaje z disku"
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Soubor s dokumentem JSON se nepodařilo přečíst."
 
-#: src/veritysetup.c:332
-#, c-format
+#: src/utils_luks2.c:72
 msgid ""
 "\n"
-"<name> is the device to create under %s\n"
-"<data_device> is the data device\n"
-"<hash_device> is the device containing verification data\n"
-"<root_hash> hash of the root node on <hash_device>\n"
+"Read interrupted."
 msgstr ""
 "\n"
-"<název> je zařízení, které bude vytvořeno pod %s\n"
-"<zařízení_dat> je datové zařízení\n"
-"<zařízení_hašů> je zařízení obsahující ověřovací data\n"
-"<kořenový_haš> haš kořenového uzlu na <zařízení_hašů>\n"
+"Čtení přerušeno."
 
-#: src/veritysetup.c:339
+#: src/utils_luks2.c:113
 #, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Otevření souboru %s pro zápis selhalo."
+
+#: src/utils_luks2.c:122
 msgid ""
 "\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"Write interrupted."
 msgstr ""
 "\n"
-"Výchozí zakompilované parametry dm-verity:\n"
-"\tHaš: %s, Datový blok (bajty): %u, Blok hašů (bajty): %u, Velikost soli: "
-"%u, Formát haše: %u\n"
-
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
-msgstr "Nepoužije superblok verity"
-
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
-msgstr "Druh formátu (1 – běžný, 0 – původní z OS Chrome)"
-
-#: src/veritysetup.c:378
-msgid "number"
-msgstr "číslo"
+"Zápis přerušen."
 
-#: src/veritysetup.c:379
-msgid "Block size on the data device"
-msgstr "Velikost bloku na zařízení dat"
-
-#: src/veritysetup.c:380
-msgid "Block size on the hash device"
-msgstr "Velikost bloku na zařízení hašů"
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Zapsaní souboru s dokumentem JSON selhalo."
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
-msgstr "Počet bloků v datovém souboru"
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands."
+#~ msgstr "Přepínač --refresh je dovolen jen při příkazu otevření nebo reaktivace."
 
-#: src/veritysetup.c:381
-msgid "blocks"
-msgstr "bloky"
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Šifra %s není dostupná."
 
-#: src/veritysetup.c:382
-msgid "Starting offset on the hash device"
-msgstr "Poloha začátku dat v zařízení hašů"
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Nepodporovaná velikost šifrovaného sektoru.\n"
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
-msgstr "Hašovací algoritmus"
+#~ msgid "Offline reencryption in progress. Aborting."
+#~ msgstr "Probíhá offline přešifrování. Operace se ruší."
 
-#: src/veritysetup.c:383
-msgid "string"
-msgstr "řetězec"
+#~ msgid "Online reencryption in progress. Aborting."
+#~ msgstr "Probíhá přešifrování za běhu. Operace se ruší."
 
-#: src/veritysetup.c:384
-msgid "Salt"
-msgstr "Sůl"
+#~ msgid "No LUKS2 reencryption in progress."
+#~ msgstr "Neprobíhá žádné přešifrování LUKS2."
 
-#: src/veritysetup.c:384
-msgid "hex string"
-msgstr "šestnáctkový řetězec"
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Přerušeno signálem."
 
-#: src/cryptsetup_reencrypt.c:147
-#, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Zařízení %s nelze výlučně otevřít. Zařízení se používá.\n"
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "V režimu FIPS není funkce dostupná."
 
-#: src/cryptsetup_reencrypt.c:151
-#, c-format
-msgid "Cannot open device %s\n"
-msgstr "Zařízení %s nelze otevřít\n"
+#~ msgid "Failed to write hash."
+#~ msgstr "Zapsaní otisku selhalo."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "Alokace zarovnané paměti se nezdařila.\n"
+#~ msgid "Failed to finalize hash."
+#~ msgstr "Dokončení otisku selhalo."
 
-#: src/cryptsetup_reencrypt.c:168
-#, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Ze zařízení %s nelze číst.\n"
+#~ msgid "Invalid resilience parameters (internal error)."
+#~ msgstr "Neplatné parametry odolnosti (vnitřní chyba)."
 
-#: src/cryptsetup_reencrypt.c:179
-#, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "LUKS zařízení %s se označuje za nepoužitelné.\n"
+#~ msgid "Failed to assign new enc segments."
+#~ msgstr "Přiřazení nových částí k šifrování se nezdařilo."
 
-#: src/cryptsetup_reencrypt.c:184
-#, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "LUKS zařízení %s se označuje za použitelné.\n"
+#~ msgid "Failed to assign digest %u to segment %u."
+#~ msgstr "Přiřazení otisku %u k části %u se nezdařilo."
 
-#: src/cryptsetup_reencrypt.c:200
-#, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Zařízení %s není možné zapsat.\n"
+#~ msgid "Failed to set segments."
+#~ msgstr "Nastavení částí selhalo."
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "Nelze zapsat soubor s protokolem přešifrování.\n"
+#~ msgid "Failed to assign reencrypt previous backup segment."
+#~ msgstr "Přiřazení předchozí zálohové části při přešifrování selhalo."
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "Soubor s protokolem přešifrování nelze načíst.\n"
+#~ msgid "Failed to assign reencrypt final backup segment."
+#~ msgstr "Přiřazení poslední zálohové části při přešifrování selhalo."
 
-#: src/cryptsetup_reencrypt.c:374
-#, c-format
-msgid "Log file %s exists, resuming reencryption.\n"
-msgstr ""
-"Soubor s protokolem %s existuje, pokračuje se v přerušeném přešifrování.\n"
+#~ msgid "Failed generate 2nd segment."
+#~ msgstr "Vytvoření druhé části selhalo."
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr "Aktivuje se dočasné zařízení za pomoci staré hlavičky LUKS.\n"
+#~ msgid "Failed generate 1st segment."
+#~ msgstr "Vytvoření první části selhalo."
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr "Aktivuje se dočasné zařízení za pomoci nové hlavičky LUKS.\n"
+#~ msgid "Failed to allocate device %s."
+#~ msgstr "Alokace zařízení %s selhala."
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Aktivace dočasných zařízení selhala.\n"
+#~ msgid "Failed to allocate dm segments."
+#~ msgstr "Alokace částí DM selhalo."
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Byla vytvořena nová hlavička LUKS zařízení %s.\n"
+#~ msgid "Failed to create dm segments."
+#~ msgstr "Vytvoření částí DM selhalo."
 
-#: src/cryptsetup_reencrypt.c:458
-#, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Pozice klíče %i aktivována.\n"
+#~ msgid "Failed to allocate device for new backing device."
+#~ msgstr "Alokace zařízení pro nové podpůrné zařízení selhalo."
 
-#: src/cryptsetup_reencrypt.c:484
-#, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "Záloha hlavičky LUKS zařízení %s byla vytvořena.\n"
+#~ msgid "Failed to reload overlay device %s."
+#~ msgstr "Znovuzavedení překryvného zařízení %s selhalo."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "Záložní hlavičky LUKS se nepodařilo vytvořit.\n"
+#~ msgid "Failed to refresh helper devices."
+#~ msgstr "Obnovení pomocných zařízení selhalo."
 
-#: src/cryptsetup_reencrypt.c:634
-#, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Hlavičku LUKS na zařízení %s nelze obnovit.\n"
+#~ msgid "Failed to create reencryption backup segments."
+#~ msgstr "Vytvoření záložních částí při přešifrování selhalo."
 
-#: src/cryptsetup_reencrypt.c:636
-#, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "Hlavička LUKS na zařízení %s byla obnovena.\n"
+#~ msgid "Failed to set online-reencryption requirement."
+#~ msgstr "Nastavení požadavků na přešifrování za běhu selhalo."
 
-#: src/cryptsetup_reencrypt.c:669
-#, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Průběh: %5.1f %%, ETA %02llu:%02llu, zapsáno %'4llu MiB, rychlost %'5.1f MiB/"
-"s%s"
+#~ msgid "Failed to hash sector at offset %zu."
+#~ msgstr "Vypočtení otisku sektoru na pozici %zu selhalo."
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Nelze se přesunout na požadované místo v zařízení.\n"
+#~ msgid "Failed to read sector hash."
+#~ msgstr "Načtení otisku sektoru selhalo."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Nelze otevřít dočasný soubor s hlavičkou LUKS.\n"
+#~ msgid "Error: Calculated reencryption offset %<PRIu64> is beyond device size %<PRIu64>."
+#~ msgstr "Chyba: Vypočtená pozice pro přešifrování %<PRIu64> je větší než velikost zařízení %<PRIu64>."
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "Velikost zařízení nelze zjistit.\n"
+#~ msgid "Device is not in clean reencryption state."
+#~ msgstr "Zařízení není v čistém stavu přešifrování."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Přerušeno signálem.\n"
+#~ msgid "Failed to calculate new segments."
+#~ msgstr "Výpočet nových částí selhal."
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "Chyba vstupu/výstupu během přešifrování.\n"
+#~ msgid "Failed to assign pre reenc segments."
+#~ msgstr "Přiřazení částí před přešifrováním selhalo."
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"Soubor s klíčem lze použít jen s přepínačem --key-slot nebo s právě jednou\n"
-"aktivní pozicí klíče.\n"
+#~ msgid "Failed finalize hotzone resilience, retval = %d"
+#~ msgstr "Dokončení odolnosti horké zóny selhalo, návratová hodnota = %d"
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
-#, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Zadejte heslo pro pozici klíče %u: "
+#~ msgid "Failed to write data."
+#~ msgstr "Zápis dat selhal."
 
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Nelze otevřít soubor s protokolem přešifrování.\n"
+#~ msgid "Failed to update metadata or reassign device segments."
+#~ msgstr "Aktualizace metadat nebo opětovné přiřazení částí zařízení selhalo."
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "Reencryption block size"
-msgstr "Velikost bloku přešifrování"
+#~ msgid "Failed to reload %s device."
+#~ msgstr "Opětovné zavedení zařízení %s selhalo."
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "MiB"
-msgstr "MiB"
+#~ msgid "Failed to erase backup segments"
+#~ msgstr "Výmaz záložních částí selhal"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "Nezmění klíč, oblast s daty se nebude přešifrovávat."
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Požadované výkonnostní volby dmcryptu nejsou podporovány."
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr "K zařízením se bude přistupovat pomocí přímého I/O."
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Zařízení %s, které se stále používá, nelze formátovat."
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr "Po každém bloku se zavolá fsync."
+#~ msgid "Key slot %d is not used."
+#~ msgstr "Pozice klíče %d není použita."
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Po každém bloku se aktualizuje soubor s protokolem."
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Ke smazání vybrán klíč na pozici %d."
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr "Použije se pouze tato pozice (ostatní budou zakázány)."
+#~ msgid "open device as mapping <name>"
+#~ msgstr "otevře zařízení jako mapování <název>"
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr "Zmenší velikost datového zařízení (posune začátek dat). NEBEZPEČNÉ!"
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "zavře zařízení (deaktivuje a odstraní mapování)"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Použije zadanou velikost zařízení (ignoruje zbytek zařízení). NEBEZPEČNÉ!"
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Nastavení parametrů PBKDF selhalo."
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Vytvoří novou hlavičku na nešifrovaném zařízení."
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Nelze se přesunout na požadované místo v zařízení.\n"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
-msgstr "Natrvalo dešifruje zařízení (odstraní šifrování)."
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "Zařízení %s je příliš malé. (LUKS2 vyžaduje alespoň %<PRIu64> bajtů.)"
 
-#: src/cryptsetup_reencrypt.c:1298
-msgid "[OPTION...] <device>"
-msgstr "[PŘEPÍNAČ…] <zařízení>"
+#~ msgid "Replaced with key slot %d."
+#~ msgstr "Nahrazeno pozicí klíče %d."
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr "POZOR: toto je pokusný kód, může zničit vaše data.\n"
+#~ msgid "Missing LUKS target type, option --type is required."
+#~ msgstr "Chybí druh cíle LUKS, je potřeba přepínač --type."
 
-#: src/cryptsetup_reencrypt.c:1313
-#, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "Přešifrování změní: klíč svazku%s%s%s%s.\n"
+#~ msgid "Missing --token option specifying token for removal."
+#~ msgstr "Chybí přepínač --token určující token, který se má odebrat."
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
-msgstr ", nastaví haš na "
+#~ msgid "Add or remove keyring token"
+#~ msgstr "Přidá nebo odebere token klíčenky"
 
-#: src/cryptsetup_reencrypt.c:1315
-msgid ", set cipher to "
-msgstr ", nastaví šifru na "
+#~ msgid "Activated keyslot %i."
+#~ msgstr "Pozice klíče %i aktivována."
 
-#: src/cryptsetup_reencrypt.c:1320
-msgid "Argument required."
-msgstr "Vyžadován argument."
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "chyba alokace paměti v action_luksFormat"
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Velikost bloku při přešifrování může nabývat hodnot pouze mezi 1 a 64 MiB."
+#~ msgid "Key slot is invalid.\n"
+#~ msgstr "Pozice klíče není platná.\n"
 
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Zadána neplatná velikost zařízení."
+#~ msgid "Using default pbkdf parameters for new LUKS2 header.\n"
+#~ msgstr "Pro novou hlavičku LUKS2 se použije výchozí parametry PBKDF.\n"
 
-#: src/cryptsetup_reencrypt.c:1363
-msgid "Maximum device reduce size is 64 MiB."
-msgstr "Maximální velikost zmenšení zařízení je 64 MiB."
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Příliš mnoho úrovní stromu ve svazku VERITY.\n"
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Velikost zmenšení musí být násobkem 512bajtových sektorů."
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Klíč %d není aktivní. Nelze jej odstranit.\n"
 
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr "Přepínač --new musí být použit spolu s --reduce-device-size."
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<název> <zařízení_dat> <zařízení_hašů> <kořenový_haš>"
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
-"Přepínač --keep-key lze použít jen s přepínači --hash nebo --iter-time."
+#~ msgid "create active device"
+#~ msgstr "vytvoří aktivní zařízení"
 
-#: src/cryptsetup_reencrypt.c:1378
-msgid "Option --new cannot be used together with --decrypt."
-msgstr "Přepínač --new nelze být použit spolu s --decrypt."
+#~ msgid "remove (deactivate) device"
+#~ msgstr "odstraní (deaktivuje) zařízení"
 
-#: src/cryptsetup_reencrypt.c:1382
-msgid "Option --decrypt is incompatible with specified parameters."
-msgstr "Přepínač --decrypt se neslučuje se zadanými parametry."
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Průběh: %5.1f %%, ETA %02llu:%02llu, zapsáno %'4llu MiB, rychlost %'5.1f MiB/s%s"
 
-#: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Chyba při čtení odpovědi z terminálu.\n"
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Nelze najít volné zařízení zpětné smyčky.\n"
 
-#: src/utils_tools.c:173
-msgid "Command successful.\n"
-msgstr "Příkaz úspěšně vykonán.\n"
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Zařízení %s nelze otevřít\n"
 
-#: src/utils_tools.c:191
-#, c-format
-msgid "Command failed with code %i"
-msgstr "Příkaz selhal s kódem %i"
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Dokud probíhá dešifrování, předaný UUID nelze použít.\n"
 
-#: src/utils_password.c:42
-#, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Odolnost hesla nelze prověřit: %s\n"
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "LUKS zařízení %s se označuje za použitelné.\n"
 
-#: src/utils_password.c:50
-#, c-format
-msgid ""
-"Password quality check failed:\n"
-" %s\n"
-msgstr ""
-"Kontrola odolnosti hesla selhala:\n"
-" %s\n"
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "POZOR: toto je pokusný kód, může zničit vaše data.\n"
 
 #~ msgid "FIPS checksum verification failed.\n"
 #~ msgstr "Ověření kontrolního součtu FIPS selhalo.\n"
 
-#~ msgid ""
-#~ "WARNING: device %s is a partition, for TCRYPT system encryption you "
-#~ "usually need to use whole block device path.\n"
-#~ msgstr ""
-#~ "POZOR: zařízení %s je oddíl. U systémového šifrování TCRYPT je obvykle "
-#~ "třeba použít cestu k celému blokovému zařízení.\n"
+#~ msgid "WARNING: device %s is a partition, for TCRYPT system encryption you usually need to use whole block device path.\n"
+#~ msgstr "POZOR: zařízení %s je oddíl. U systémového šifrování TCRYPT je obvykle třeba použít cestu k celému blokovému zařízení.\n"
 
 #~ msgid "Kernel doesn't support plain64 IV.\n"
 #~ msgstr "Jádro nepodporuje inicializační vektor plain64.\n"
@@ -1887,18 +4122,9 @@ msgstr ""
 #~ msgid "Enter any LUKS passphrase: "
 #~ msgstr "Zadejte jakékoliv heslo LUKS: "
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr "Adresář device-mapperu se nepodařilo získat."
-
 #~ msgid "Backup file %s doesn't exist.\n"
 #~ msgstr "Záložní soubor %s neexistuje.\n"
 
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Soubor %s nelze otevřít.\n"
-
-#~ msgid "<name> <device>"
-#~ msgstr "<název> <zařízení>"
-
 #~ msgid "create device"
 #~ msgstr "vytvoří zařízení"
 
@@ -1914,13 +4140,6 @@ msgstr ""
 #~ msgid "remove loop-AES mapping"
 #~ msgstr "odstraní mapování loop-AES"
 
-#~ msgid ""
-#~ "Option --allow-discards is allowed only for luksOpen, loopaesOpen and "
-#~ "create operation.\n"
-#~ msgstr ""
-#~ "Přepínač --allow-discards je dovolen jen při úkonech luksOpen, "
-#~ "loopaesOpen a create.\n"
-
 #~ msgid "Cannot open device %s for %s%s access.\n"
 #~ msgstr "Zařízení %s nelze otevřít pro %s%s přístup.\n"
 
@@ -1939,25 +4158,12 @@ msgstr ""
 #~ msgid "Unable to obtain sector size for %s"
 #~ msgstr "Není možné zjistit velikost sektoru u %s"
 
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Zápis do úložiště klíče selhal.\n"
-
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr "Čtení z úložiště klíče selhalo.\n"
-
-#~ msgid ""
-#~ "Cannot use device %s (crypt segments overlaps or in use by another "
-#~ "device).\n"
-#~ msgstr ""
-#~ "Zařízení %s nelze použít (šifrované segmenty se překrývají nebo jsou "
-#~ "používány jiným zařízením).\n"
+#~ msgid "Cannot use device %s (crypt segments overlaps or in use by another device).\n"
+#~ msgstr "Zařízení %s nelze použít (šifrované segmenty se překrývají nebo jsou používány jiným zařízením).\n"
 
 #~ msgid "Key slot %d verified.\n"
 #~ msgstr "Pozice klíče %d ověřena.\n"
 
-#~ msgid "Invalid key size %d.\n"
-#~ msgstr "%d není platná velikost klíče.\n"
-
 #~ msgid "Block mode XTS is available since kernel 2.6.24.\n"
 #~ msgstr "Blokový režim XTS je dostupný až od jádra 2.6.24.\n"
 
@@ -1970,9 +4176,5 @@ msgstr ""
 #~ msgid "Negative keyfile size not permitted.\n"
 #~ msgstr "Záporná velikost souboru s klíčen není dovolena.\n"
 
-#~ msgid ""
-#~ "Warning: exhausting read requested, but key file is not a regular file, "
-#~ "function might never return.\n"
-#~ msgstr ""
-#~ "Pozor: požadováno úplné čtení, avšak soubor s klíčem není běžný soubor. "
-#~ "Funkce se možná nikdy nevrátí.\n"
+#~ msgid "Warning: exhausting read requested, but key file is not a regular file, function might never return.\n"
+#~ msgstr "Pozor: požadováno úplné čtení, avšak soubor s klíčem není běžný soubor. Funkce se možná nikdy nevrátí.\n"
diff --git a/po/da.gmo b/po/da.gmo
new file mode 100644 (file)
index 0000000..61f31c2
Binary files /dev/null and b/po/da.gmo differ
diff --git a/po/da.po b/po/da.po
new file mode 100644 (file)
index 0000000..385ae6d
--- /dev/null
+++ b/po/da.po
@@ -0,0 +1,3974 @@
+# Danish translation cryptsetup-2.3.1.da.po.
+# Copyright (C) 2020 Free Software Foundation, Inc.
+# This file is distributed under the same license as the cryptsetup package.
+# Joe Hansen <joedalton2@yahoo.dk>, 2015, 2016, 2017, 2018, 2019, 2020.
+#
+# Konventioner
+# argument -> argument
+# deferred -> udskudt
+# iteration -> iteration (gennemløb)
+# memory hard -> hukommelsestung (bedre mulighed?) det er nok et tilvalg, så
+# evt. bevar den uændret. nok engelsk fejl hvor det er uden bindestreg.
+# parameter -> parameter
+# probe -> undersøge (bedre mulighed?)
+# reencryption -> omkryptering
+# suspended -> suspenderet (skal det være standset i stedet for?)
+# wipe -> rydde
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: cryptsetup-2.3.1-rc0\n"
+"Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-03-08 22:35+0200\n"
+"Last-Translator: Joe Hansen <joedalton2@yahoo.dk>\n"
+"Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
+"Language: da\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Kan ikke initialisere enhedsoversætter, kører som ikke-root bruger."
+
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Kan ikke initialisere enhedsoversætter. Er dm_mod-kernemodulet indlæst?"
+
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Det anmodede udskudte flag er ikke understøttet."
+
+#: lib/libdevmapper.c:1198
+#, c-format
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID for enheden %s blev afkortet."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Ukendt dm-måltype."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Forespurgte dm-crypt-ydelsestilvalg er ikke understøttede."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Forespurgte dm-verity-håndteringstilvalg for datakorruption er ikke understøttede."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Forespurgte dm-verity FEC-tilvalg er ikke understøttede."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Forespurgte dataintegritetstilvalg er ikke understøttede."
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Forespurgte sector_size-tilvalg er ikke understøttet."
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Forespurgte automatiske genberegning af integritetsmærker er ikke understøttet."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Discard/TRIM %s er ikke understøttet."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Forespurgte dm-integritetsbitmaptilstand er ikke understøttet."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Kunne ikke forespørge dm-%s-segment."
+
+#: lib/random.c:75
+msgid ""
+"System is out of entropy while generating volume key.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
+msgstr ""
+"Systemet har ikke nok entropi til oprettelse af diskenhedsnøgle.\n"
+"Flyt venligst musen eller indtast noget tekst i et andet vindue for at samle nogle vilkårlige hændelser.\n"
+
+#: lib/random.c:79
+#, c-format
+msgid "Generating key (%d%% done).\n"
+msgstr "Opretter nøgle (%d%% færdig).\n"
+
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Kører i FIPS-tilstand."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Fatal fejl under RNG-initialisering."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Der blev anmodt om ukendt RNG-kvalitet."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Der opstod en fejl under læsning fra RNG."
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Kan ikke initialisere crypto RNG-motor."
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Kan ikke initialisere crypto-motor."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Hashalgoritmen %s er ikke understøttet."
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Nøglebehandlingsfejl (der bruger hash %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Kan ikke bestemme enhedstype. Er aktivering af enhed ikke kompatibel?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Denne operation er kun understøttet for LUKS-enhed."
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Denne operation er kun understøttet for LUKS2-enhed."
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Alle nøglepladser er udfyldt."
+
+#: lib/setup.c:434
+#, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Nøglepladsen %d er ugyldig, vælg venligst mellem 0 og %d."
+
+#: lib/setup.c:440
+#, c-format
+msgid "Key slot %d is full, please select another one."
+msgstr "Nøglepladsen %d er fuld, vælg venligst en anden."
+
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "Enhedsstørrelsen er ikke justeret til logisk blokstørrelse for enhed."
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Teksthoved registreret men enheden %s er for lille."
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Denne operation er ikke understøttet for denne enhedstype."
+
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Ulovlig operation med omkryptering i gang."
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "LUKS-version %d er ikke understøttet."
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Frakoblet metadataenhed er ikke understøttet for denne crypttype."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, c-format
+msgid "Device %s is not active."
+msgstr "Enheden %s er ikke aktiv."
+
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Underliggende enhed for cryptenheden %s forsvandt."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Ugyldige rene crypt-parametre."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Ugyldig nøglestørrelse."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID er ikke understøttet for denne crypttype."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Sektorstørrelsen på krypteringen er ikke understøttet."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Enhedsstørrelsen er ikke justeret til den anmodede sektorstørrelse."
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Kan ikke formatere LUKS uden enhed."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Forespurgte datajustering er ikke kompatibel med dataforskydning."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "ADVARSEL: Dataforskydning er uden for nuværende tilgængelige dataenhed.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Kan ikke rydde teksthoved på enheden %s."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "ADVARSEL: Enhedsaktiveringen vil fejle, dm-crypt mangler understøttelse for anmodet størrelse på krypteringssektor.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Diskenhedsnøglen er for lille til kryptering med integritetsudvidelser."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Krypteringsalgoritmen %s-%s (nøglestørrelse %zd bit) er ikke tilgængelig."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "ADVARSEL: LUKS2-metadatastørrelse ændret til %<PRIu64> byte.\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "ADVARSEL: LUKS2-nøglepladsens områdestørrelse er ændret til %<PRIu64> byte.\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "Enheden %s er for lille."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Kan ikke formatere enheden %s i brug."
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Kan ikke formatere enheden %s, tilladelse nægtet."
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Kan ikke formatere integritet for enheden %s."
+
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "Kan ikke formatere enheden %s."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Kan ikke formatere LOOPAES uden enhed."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Kan ikke formatere VERITY uden enhed."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "VERITY-hashtypen %d er ikke understøttet."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "VERITY-blokstørrelse er ikke understøttet."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "VERITY-hashforskydning er ikke understøttet."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "VERITY FEC-forskydning er ikke understøttet."
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Dataområde overlapper med hashområde."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Dataområde overlapper med FEC-område."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Dataområde overlapper med FEC-område."
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "ADVARSEL: Anmodte mærkestørrelse %d byte er forskellig fra %s størrelsesuddata (%d byte).\n"
+
+#: lib/setup.c:2286
+#, c-format
+msgid "Unknown crypt device type %s requested."
+msgstr "Der blev anmodt om ukendt crypt-enhedstype %s."
+
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "Ikke understøttede parametre på enheden %s."
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Parametre matcher ikke på enheden %s."
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Crypt-enheder er forskellige."
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "Kunne ikke genindlæse enheden %s."
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, c-format
+msgid "Failed to suspend device %s."
+msgstr "Kunne ikke placere enheden %s i dvale."
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Kunne ikke genoptage enheden %s."
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Der opstod en fatal fejl under genindlæsning af enheden %s (oven på enheden %s)."
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Kunne ikke skifte enheden %s til dm-error."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Kan ikke ændre størrelse på loop-enhed."
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "Ønsker du at ændre UUID for enhed?"
+
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Sikkerhedskopifilen indeholder ikke gyldige LUKS-teksthoveder."
+
+#: lib/setup.c:3058
+#, c-format
+msgid "Volume %s is not active."
+msgstr "Diskenheden %s er ikke aktiv."
+
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
+msgstr "Diskenheden %s er allerede suspenderet."
+
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "Suspension er ikke understøttet for enheden %s."
+
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "Fejl under suspension af enheden %s."
+
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "Diskenheden %s er ikke suspenderet."
+
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
+msgstr "Genoptag er ikke understøttet for enheden %s."
+
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "Fejl under genoptagelse af enheden %s."
+
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Diskenhedsnøgle matcher ikke diskenheden."
+
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Kan ikke tilføje nøgleplads, alle pladser er deaktiveret og ingen diskenhedsnøgle tilbudt."
+
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Kunne ikke swappe ny nøgleplads."
+
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Nøglepladsen %d er ugyldig."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Nøglepladsen %d er ikke aktiv."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Enhedsteksthoved overlapper med dataområde."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Omkryptering er i gang. Kan ikke aktivere enhed."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Kunne ikke indhente omkrypteringslås."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "LUKS2-omkrypteringsgendannelse mislykkedes."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Enhedstypen er ikke ordentlig initialiseret."
+
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Kan ikke bruge enheden %s, navnet er ugyldigt eller stadig i brug."
+
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "Enheden %s findes allerede."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Ukorrekt diskenhedsnøgle specificeret for ren enhed."
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Ukorrekt roothash specificeret for verity-enhed."
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Roothash-signatur er krævet."
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Kernenøglering mangler: krævet for at sende signatur til kernen."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Kunne ikke indlæse nøgle i kernenøglefil."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Enheden %s er stadig i brug."
+
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "Ugyldig enhed %s."
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Diskenhedsnøglebuffer er for lille."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Kan ikke indhente diskenhedsnøgle for ren enhed."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Kan ikke hente roothash for verity-enhed."
+
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Denne operation er ikke understøttet for %s crypt-enhed."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Dump-operation er ikke understøttet for denne enhedstype."
+
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Dataforskydning er ikke et multiplum af %u byte."
+
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Kan ikke konvertere enheden %s som stadig er i brug."
+
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Kunne ikke tildele nøglepladsen %u som den nye diskenhedsnøgle."
+
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Kunne ikke initialisere standardparametre for LUKS2-nøgleplads."
+
+#: lib/setup.c:5851
+#, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Kunne ikke tildele nøglepladsen %d til sammendrag."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Kernenøglering er ikke understøttet af kernen."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Kunne ikke læse adgangsfrase fra nøglering (fejl %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Kunne ikke indhente global adgangsserialiseringslås for memory-hard."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Kan ikke indhente procesprioritet."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Kan ikke låse hukommelsen op."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Kunne ikke åbne nøglefil."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Kan ikke læse nøglefilen fra en terminal."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Kunne ikke køre stat på nøglefil."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Kan ikke søge til anmodede nøglefilsforskydning."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Ikke nok hukommelse under læsning af adgangsfrase."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Der opstod en fejl under læsning af adgangsfrase."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Intet at læse på inddata."
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Nøglefilsstørrelsen er over maksimum."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Kan ikke læse den anmodede datamængde."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Enheden %s findes ikke eller adgang nægtet."
+
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Enheden %s er ikke kompatibel."
+
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Enheden %s er for lille. Kræver mindst %<PRIu64> byte."
+
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Kan ikke bruge enheden %s som er i brug (allerede kortlagt eller monteret)."
+
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Kan ikke bruge enheden %s, tilladelse nægtet."
+
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Kan ikke indhente information om enheden %s."
+
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Kan ikke bruge en loopback-enhed, kører som ikke-root bruger."
+
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Vedhæftelse af loopback-enhed mislykkedes (loop-enhed med flaget autoclear er krævet)."
+
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Anmodt forskydning er mere end den reelle størrelse for enheden %s."
+
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Enheden %s har nul størrelse."
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Anmodede PBKDF-måltidspunkt kan ikke være nul."
+
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Ukendt PBKDF-type %s."
+
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Den anmodede hash %s er ikke understøttet."
+
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Den anmodede PBKDF-type er ikke understøttet for LUKS1."
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "PBKDF maks hukommelse eller parallelle tråde må ikke angives med pbkdf2."
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Tvungen iterationantal er for lavt for %s (minimum er %u)."
+
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Tvungen hukommelsesomkostning er for lav for %s (minimum er %u kilobyte)."
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Anmodede maksimal PBKDF-hukommelsesomkostning er for høj (maksimum er %d kilobyte)."
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Anmodede maksimal PBKDF-hukommelse kan ikke være nul."
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Anmodede PBKDF parallelle tråde kan ikke være nul."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "Kun PBKDF2 er understøttet i FIPS-tilstand."
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "PBKDF-sammenligning deaktiveret men iterationer er ikke angivet."
+
+#: lib/utils_benchmark.c:191
+#, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Ikke kompatible PBKDF2-tilvalg (der bruger hash-algoritme %s)."
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Ikke kompatible PBKDF2-tilvalg."
+
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Låsning afbrudt. Låsestien %s/%s kan ikke bruges (ikke en mappe eller mangler)."
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "ADVARSEL: Låsemappen %s/%s mangler!\n"
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Låsning afbrudt. Låsestien %s/%s kan ikke bruges (%s er ikke en mappe)."
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Kan ikke søge til enhedsforskydning."
+
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Sletningsfejl for enhed (wipe), forskydning %<PRIu64>."
+
+#: lib/luks1/keyencryption.c:39
+#, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"Kunne ikke opsætte dm-crypt nøgleoversættelse for enheden %s.\n"
+"Kontroller at kernen understøtter krypteringsalgoritmen %s (kontroller syslog for yderligere information)."
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Nøglestørrelse i XTS-tilstand skal være 256- eller 512-bit."
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "Specifikation for krypteringsalgoritme skal være i [cipher]-[mode]-[iv]-format."
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "Kan ikke skrive til enheden %s, tilladelse nægtet."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Kunne ikke åbne midlertidig nøglelagerenhed."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Kunne ikke tilgå midlertidig nøglelagerenhed."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "IO-fejl under kryptering af nøgleplads."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Kan ikke åbne enheden %s."
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "IO-fejl under dekryptering af nøgleplads."
+
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Enheden %s er for lille. (LUKS1 kræver mindst %<PRIu64> byte.)"
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "LUKS-nøgleplads %u er ugyldig."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "Enheden %s er ikke en gyldig LUKS-enhed."
+
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, c-format
+msgid "Requested header backup file %s already exists."
+msgstr "Den anmodede sikkerhedskopifil %s for teksthoveder findes allerede."
+
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
+msgstr "Kan ikke oprette sikkerhedskopifilen %s for teksthoveder."
+
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
+msgstr "Kan ikke skrive sikkerhedskopifilen %sf for teksthoveder."
+
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Sikkerhedskopifilen indeholder ikke gyldige LUKS-teksthoveder."
+
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, c-format
+msgid "Cannot open header backup file %s."
+msgstr "Kan ikke åbne sikkerhedskopifilen %s for teksthoveder."
+
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, c-format
+msgid "Cannot read header backup file %s."
+msgstr "Kan ikke læse sikkerhedskopifilen %s for teksthoveder."
+
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Dataforskydning eller nøglestørrelse er forskellige på enhed eller sikkerhedskopi, gendannelse mislykkedes."
+
+#: lib/luks1/keymanage.c:325
+#, c-format
+msgid "Device %s %s%s"
+msgstr "Enheden %s %s%s"
+
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "indeholder ikke LUKS-teksthoveder. Erstatning af teksthoved kan ødelægge data på den enhed."
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "indeholder allerede LUKS-teksthoveder. Erstatning af teksthoveder vil ødelægge eksisterende nøglepladser."
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
+msgstr ""
+"\n"
+"ADVARSEL: reel enhedsteksthoved har en anden UUID end sikkerhedskopien!"
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Nøglestørrelsen følger ikke standarden, en manuel reparation er krævet."
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Nøglepladsopstillingen følger ikke standarden, en manuel reparation er krævet."
+
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Reparerer nøglepladser."
+
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Nøgleplads %i: forskydning repareret (%u -> %u)."
+
+#: lib/luks1/keymanage.c:417
+#, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Nøgleplads %i: striber (»stripes«) repareret (%u -> %u)."
+
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Nøgleplads %i: falsk partitionssignatur."
+
+#: lib/luks1/keymanage.c:431
+#, c-format
+msgid "Keyslot %i: salt wiped."
+msgstr "Nøgleplads %i: salt ryddet."
+
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Skriver LUKS-teksthovedet til disken."
+
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Reparation mislykkedes."
+
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, c-format
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Den anmodede LUKS-hash %s er ikke understøttet."
+
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Ingen kendte problemer registreret for LUKS-teksthoved."
+
+#: lib/luks1/keymanage.c:660
+#, c-format
+msgid "Error during update of LUKS header on device %s."
+msgstr "Fejl under opdatering af LUKS-teksthoved på enheden %s."
+
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Fejl under genlæsning af LUKS-teksthoved efter opdatering på enheden %s."
+
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Dataforskydning for LUKS-teksthoved skal være enten 0 eller større end teksthovedstørrelse."
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Forkert LUKS UUID-format anført."
+
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Kan ikke oprette LUKS-teksthoved: læsning af vilkårlig salt mislykkedes."
+
+#: lib/luks1/keymanage.c:804
+#, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Kan ikke oprette LUKS-teksthoved: Teksthovedsammendrag mislykkedes (bruger hash %s)."
+
+#: lib/luks1/keymanage.c:848
+#, c-format
+msgid "Key slot %d active, purge first."
+msgstr "Nøgleplads %d aktiv, nulstil (purge) den først."
+
+#: lib/luks1/keymanage.c:854
+#, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Nøgleplads %d-materiale inkluderer for få striber (»stribes«). Teksthovedmanipulering?"
+
+#: lib/luks1/keymanage.c:990
+#, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Kan ikke åbne nøgleplads (der bruger hash %s)."
+
+#: lib/luks1/keymanage.c:1066
+#, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Nøgleplads %d er ugyldig, vælg nøgleplads mellem 0 og %d."
+
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, c-format
+msgid "Cannot wipe device %s."
+msgstr "Kan ikke rydde enheden %s."
+
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Registreret endnu ikke understøttet GPG-krypteret nøglefil."
+
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "Brug venligst gpg --decrypt <NØGLEFIL> | cryptsetup --keyfile=- ...\n"
+
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Ikke kompatibel loop-AES-nøglefil registreret."
+
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Kerne understøtter ikke loop-AES-kompatibel oversættelse."
+
+#: lib/tcrypt/tcrypt.c:504
+#, c-format
+msgid "Error reading keyfile %s."
+msgstr "Fejl under læsning af nøglefilen %s."
+
+#: lib/tcrypt/tcrypt.c:554
+#, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Den maksimale længde for TCRYPT-adgangsfrasen (%zu) er overskredet."
+
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "PBKDF2-hashalgoritmen %s er ikke tilgængelig, udelader."
+
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Krævet kernegrænseflade for crypto er ikke tilgængelig."
+
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Sikr dig at du har kernemodulet algif_skcipher indlæst."
+
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "Aktivering er endnu ikke understøttet for %d sektorstørrelse."
+
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Kerne understøtter ikke aktivering for denne TCRYPT legacy-tilstand."
+
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Aktivering af TCRYPT-systemkryptering for partition %s."
+
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Kerne understøtter ikke TCRYPT-kompatibel oversættelse."
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "Denne funktion er ikke understøttet uden TCRYPT-teksthovedindlæsning."
+
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "Uventet metadataindgangstype »%u« fundet da understøttet Volume Master Key blev fortolket."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Ugyldig streng fundet da Volume Master Key blev fortolket."
+
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Uventet streng (»%s«) fundet da Volume Master Key blev fortolket."
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "Uventet metadataindgangsværdi »%u« fundet da Volume Master Key blev fortolket."
+
+#: lib/bitlk/bitlk.c:479
+#, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Kunne ikke læse BITLK-signatur fra %s."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "BITLK version 1 er i øjeblikket ikke understøttet."
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Ugyldig eller ukendt opstartssignatur for BITLK-enhed."
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Ugyldig eller ukendt signatur for BITLK-enhed."
+
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Sektorstørrelsen på krypteringen er ikke understøttet."
+
+#: lib/bitlk/bitlk.c:518
+#, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Kunne ikke læse BITLK-teksthoved fra %s."
+
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Kunne ikke læse BITLK FVE-metadata fra %s."
+
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Ukendt eller ikke understøttet krypteringstype."
+
+#: lib/bitlk/bitlk.c:627
+#, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Kunne ikke læse BITLK-metadataposter fra %s."
+
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Denne operation er ikke understøttet."
+
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Forkert nøglestørrelse."
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Denne BITLK-enhed er i en ikkeunderstøttet tilstand og kan ikke aktiveres."
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "BITLK-enheder med typen »%s« kan ikke aktiveres."
+
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Aktivering af delvist dekrypteret BITLK-enhed er ikke understøttet."
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Kan ikke aktivere enhed, kernel dm-crypt mangler understøttelse for BITLK IV."
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Kan ikke aktivere enhed, kernen dm-crypt mangler understøttelse for BITLK Elephant diffuser."
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Verity-enheden %s bruger ikke on-disk-teksthoved."
+
+#: lib/verity/verity.c:90
+#, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "Enheden %s er ikke en gyldig VERITY-enhed."
+
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Ikke understøttet VERITY-version %d."
+
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "VERITY-teksthovedet er ødelagt."
+
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Forkert VERITY UUID-format indeholdt på enheden %s."
+
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Fejl under opdatering af verity-teksthoved på enheden %s."
+
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "Roothash-signaturverifikation er ikke understøttet."
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Fejl kan ikke repareres med FEC-enhed."
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Fandt %u fejl der kan repareres med FEC-enhed."
+
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Kerne understøtter ikke dm-verity-oversættelse."
+
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Kerne understøtter ikke dm-verity-signaturtilvalg."
+
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Verity-enheden registrerede korruption efter aktivering."
+
+#: lib/verity/verity_hash.c:59
+#, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Ledigt område nulstilles ikke (»not zeroed«) på position %<PRIu64>."
+
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Forskydningsoverløb for enhed."
+
+#: lib/verity/verity_hash.c:203
+#, c-format
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Verificering mislykkedes på position %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Ugyldig størrelse for parametre for verity-enhed."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Hashområdeoverløb."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Verifikation af dataområde mislykkedes."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Verifikation af root-hash mislykkedes."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Inddata/uddata-fejl under oprettelse af hash-område."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Oprettelse af hash-område mislykkedes."
+
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "ADVARSEL: Kerne kan ikke aktivere enhed hvis dataenes blokstørrelse er større end sidestørrelsen (%u)."
+
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Kunne ikke allokere RS-kontekst."
+
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Kunne ikke allokere buffer."
+
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Kunne ikke læse RS-blok %<PRIu64> byte %d."
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Kunne ikke læse paritet for RS-blok %<PRIu64>."
+
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Kunne ikke reparere paritet for blok %<PRIu64>."
+
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Kunne ikke skrive paritet for RS-blok %<PRIu64>.."
+
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Blokstørrelser skal matche for FEC."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Ugyldigt antal paritetsbyte."
+
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Kunne ikke bestemme størrelsen på enheden %s."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Kerne understøtter ikke dm-integrity-oversættelse."
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Kerne understøtter ikke dm-integrity fast metadatajustering."
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Kunne ikke indhente skrivelås på enheden %s."
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Registreret forsøg på samtidig LUKS2-metadataopdering. Afbryder operation."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+"Enhed indeholder tvetydige signaturer, kan ikke gendanne LUKS2 automatisk.\n"
+"Kør venligst »cryptsetup repair« for gendannelse."
+
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Forespurgte dataforskydning er for lille."
+
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "ADVARSEL: nøglepladsområde (%<PRIu64> byte) er meget lille, tilgængelige LUKS2-nøglepladsantal er meget begrænset.\n"
+
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Kunne ikke indhente læselås på enheden %s."
+
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Forbudt LUKS2-krav registreret i sikkerhedskopien %s."
+
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Dataforskydning er forskellig på enhed eller sikkerhedskopi, gendannelse mislykkedes."
+
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Binær teksthoved med nøglepladsområdestørrelse er forskellige på enhed eller sikkerhedskopi, gendannelse mislykkedes."
+
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Enheden %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "indeholder ikke LUKS2-teksthoveder. Erstatning af teksthoved kan ødelægge data på den enhed."
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "indeholder allerede LUKS2-teksthoveder. Erstatning af teksthoveder vil ødelægge eksisterende nøglepladser."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
+msgstr ""
+"\n"
+"ADVARSEL: Ukendte LUKS2-krav registreret i reel enhedsteksthoved!\n"
+"Erstatning af teksthoved med sikkerhedskopi kan ødelægge data på den enhed!"
+
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"ADVARSEL: Ufærdig frakoblet omkryptering registreret på enheden!\n"
+"Erstatning af teksthoved med sikkerhedskopi kan ødelægge data."
+
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Ignorerede ukendt flag %s."
+
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Manglende nøgle for dm-crypt-segmentet %u"
+
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Kunne ikke angive dm-crypt-segmentet."
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Kunne ikke angive dm-linear-segmentet."
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Ikke understøttet konfiguration for enhedsintegritet."
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Omkryptering i gang. Kan ikke deaktivere enhed."
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Kunne ikke erstatte enheden %s i dvale med dm-error-mål."
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Kunne ikke læse LUKS2-krav."
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Uopfyldte LUKS2-krav registreret."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Operation er ikke kompatibel med enhed markeret for forældet omkryptering. Afbryder."
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Operation er ikke kompatibel med enhed markeret for LUKS2-omkryptering. Afbryder."
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Ikke nok hukommelse tilgængelig til at åbne en nøgleplads."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Åbning af nøgleplads mislykkedes."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Kan ikke brug %s-%s-krypteringsalgoritmen til nøglepladskryptering."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Ingen plads for ny nøgleplads."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Kan ikke kontrollere status for enheden med uuid: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Kan ikke konvertere teksthoved med yderligere metadata for LUKSMETA."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Kan ikke flytte nøglepladsområde. Ikke nok plads."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Kan ikke flytte nøglepladsområde. LUKS2-nøglepladsområdet er for lille."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Kan ikke flytte nøglepladsområde."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Kan ikke konvertere til LUKS1-format - krypteringssektorstørrelsen for standardsegmenter er ikke 512 byte."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Kan ikke konverterer til LUKS1-format - nøglepladssammendrag er ikke LUKS1-kompatibel."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr ""
+"Kan ikke konverterer til LUKS1-format - enheden bruger omsluttet\n"
+"nøglekrypteringsalgoritme %s."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr ""
+"Kan ikke konverterer til LUKS1-format - LUKS2-teksthoved indeholder\n"
+"%u symboler (tokens)."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Kan ikke konvertere til LUKS1-format - nøgleplads %u er i ugyldig tilstand."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr ""
+"Kan ikke konverterer til LUKS1-format - plads %u (over maksimalt antal pladser)\n"
+"er stadig aktiv."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr ""
+"Kan ikke konvertere til LUKS1-format - nøglepladsen %u er ikke\n"
+"LUKS1-kompatibel."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Hotzonestørrelsen skal være et multiplum af beregnet zonejustering (%zu byte)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Enhedsstørrelsen skal være et multiplum af beregnet zonejustering (%zu byte)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Resilience-tilstanden %s er ikke understøttet"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Kunne ikke initialisere gammelt lageromslag for segmentet."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Kunne ikke initialisere nyt lageromslag for segmentet."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Kunne ikke læse kontrolsummer for nuværende hotzone."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Kunne ikke læse hotzone-område startende på %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Kunne ikke dekryptere sektor %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Kunne ikke gendanne sektor %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Størrelsen på kilde- og målenhed er forskellig. Kilde %<PRIu64>, mål: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Kunne ikke køre aktivere hotzone-enheden %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Kunne ikke aktivere overlagsenheden %s med faktiske origin-tabel."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Kunne ikke indlæse ny oversættelse for enheden %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Kunne ikke opdatere omkrypteringsenhedsstakken."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Kunne ikke angive områdestørrelse for nye nøglepladser."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Dataflytning er ikke justeret til den anmodede krypteringssektorstørrelse (%<PRIu32> byte)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Datanhed er ikke justeret til den anmodede krypteringssektorstørrelse (%<PRIu32> byte)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Dataskift (%<PRIu64> sektorer) er mindre end fremtidig dataforskydning (%<PRIu64> sektorer)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Kan ikke åbne %s i eksklusiv tilstand (allerede kortlagt eller monteret)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Enhed er ikke markeret for LUKS2-omkryptering."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Kunne ikke indlæse LUKS2-omkrypteringskontekst."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Kunne ikke indhente omkrypteringstilstand."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Enheden er ikke under omkryptering."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Omkrypteringsproces er allerede i gang."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Kunne ikke indhente omkrypteringslås."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "Kan ikke fortsætte med omkryptering. Kør omkrypteringsgendannelse først."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Aktiv enhedsstørrelse og anmodet sektorstørrelse er forskellige."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "Ugyldig enhedsstørrelse i omkrypteringsparametrene."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Omkryptering er i gang. Kan ikke udføre gendannelse."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "LUKS2-omkryptering er allerede initialiseret i metadata."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Kunne ikke initialisere LUKS2-omkryptering i metadata."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Kunne ikke angive enhedssegmenter for næste omkrypteringshotzone."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Kunne ikke skrive resilience-metadata for omkryptering."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Dekryptering mislykkedes."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Kunne ikke skrive hotzoneområde startende på %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Kunne ikke synkronisere data."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Kunne ikke opdatere metadata efter nuværende omkrypteringshotzone var fuldført."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Kunne ikke skrive LUKS2-metadata."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Kunne ikke rydde segmentdata for sikkerhedskopien."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Kunne ikke deaktivere kravflag for omkrypteringen."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Der opstod en fatal fejl under omkryptering af kodestump startende på %<PRIu64>, %<PRIu64> sektorer i alt."
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Genaktiver ikke enheden med mindre erstattet med fejlmål manuelt."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "Kan ikke fortsætte med omkryptering. Uventet omkrypteringsstatus."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Manglende eller ugyldig omkrypteringskontekst."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Kunne ikke initialisere enhedsstak for omkryptering."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Kunne ikke opdatere omkrypteringskontekst."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Ingen frie symbolpladser."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Kunne ikke oprette indbygget symbol %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Kan ikke udføre verificering af adgangsfrase på ikke-tty-inddata."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Parametre til kryptering af nøgleplads kan kun angives for LUKS2-enhed."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Ikke kendt specifikationsmønster for krypteringsalgoritme registreret."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "ADVARSEL: Parameteren --hash bliver ignoreret i ren (plain) tilstand med nøglefil specificeret.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "ADVARSEL: Tilvalget --keyfile-size bliver ignoreret, læsestørrelsen er den samme som størrelsen for krypteringsnøglen.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Registrerede enhedssignaturer på %s. Videre behandling kan beskadige eksisterende data."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Operation afbrudt.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Tilvalget --key-file er krævet."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Indtast VeraCrypt-PIM: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Ugyldig PIM-værdi: fortolkningsfejl."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Ugyldig PIM-værdi: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Ugyldig PIM-værdi: uden for interval."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Intet enhedsteksthoved registreret med denne adgangsfrase."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Enheden %s er ikke en gyldig BITLK-enhed."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Teksthoveddump med diskenhedsnøgle er sensitiv information\n"
+"som giver adgang til krypteret partition uden adgangsfrase.\n"
+"Dette dump bør altid lagres krypteret et sikkert sted."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Enheden %s er stadig aktiv og planlagt til udskudt fjernelse.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Ændring af størrelse på aktiv enhed kræver diskenhedsnøgle i nøglering men tilvalget --disable-keyring er ikke angivet."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Sammenligning afbrudt."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     -\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u iterationer per sekund for %zu-bit nøgle\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s .\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u iterationer, %5u hukommelse, %1u parallelle tråde (CPU'er) for %zu-bit nøgle (anmodet %u ms time)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Sammenligningens resultat er ikke troværdigt."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Test bruger kun hukommelse omtrentlig (ingen lager-IO).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s Algoritme |     Nøgle |      Kryptering |    Dekryptering\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Krypteringsalgoritmen %s-%s (nøglestørrelse %zd bit) er ikke tilgængelig."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#     Algoritme |       Nøgle |    Kryptering |    Dekryptering\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "-"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Ser ud til at enheden ikke kræver omkrypteringsgendannelse.\n"
+"Ønsker du at fortsætte alligevel?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Fortsæt med LUKS2-omkrypteringsgendannelse?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Indtast adgangsfrase for omkrypteringsgendannelse: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Skal LUKS-enhedsteksthovedet forsøges repareres?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Rydder enhed for at initialisere integritetskontrolsum.\n"
+"Du kan afbryde dette ved at trykke på CTRL+c (resten af ikke ryddet enhed vil indeholder ugyldig kontrolsum).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Kan ikke deaktivere midlertidig enhed %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Integritetstilvalg kan kun bruges for LUKS2-format."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Indstillinger for LUKS2-metadatastørrelse er ikke understøttet."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Kan ikke oprette teksthovedfilen %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Ikke kendt specifikationsmønster for krypteringsalgoritme registreret."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Kan ikke bruge %s på on-disk-teksthoved."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Dette vil uigenkaldeligt overskrive data på %s."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Kunne ikke angive pbkdf-parametre."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Reduceret dataforskydning er kun tilladt for frakoblet LUKS-teksthoved."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Kan ikke bestemme nøglestørrelsen på diskenheden for LUKS uden nøglepladser, brug venligst tilvalget --key-size."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Enhed aktiveret men kan ikke gøre flag vedvarende."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Nøgleplads %d valgt for sletning."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Dette er den sidste nøgleplads. Enheden vil blive ubrugelig efter fjernelse af denne nøgle."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Indtast en eventuel tilbageværende adgangsfrase: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Operation afbrudt, nøglepladsen var IKKE ryddet.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Indtast adgangsfrase som skal slettes: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Indtast ny adgangsfrase for nøgleplads: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Indtast en eventuel eksisterende adgangsfrase: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Indtast adgangsfrase som skal ændres: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Indtast ny adgangsfrase: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Indtast adgangsfrase for nøgleplads til konvertering: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Kun et enhedsargument for isLuks-operation er understøttet."
+
+#: src/cryptsetup.c:2001
+#, fuzzy
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Teksthoveddump med diskenhedsnøgle er sensitiv information\n"
+"som giver adgang til krypteret partition uden adgangsfrase.\n"
+"Dette dump bør altid lagres krypteret et sikkert sted."
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Nøglepladsen %d er ikke aktiv."
+
+#: src/cryptsetup.c:2072
+#, fuzzy
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Teksthoveddump med diskenhedsnøgle er sensitiv information\n"
+"som giver adgang til krypteret partition uden adgangsfrase.\n"
+"Dette dump bør altid lagres krypteret et sikkert sted."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Tilvalget --header-backup-file er krævet."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s er ikke en cryptsetup-håndteret enhed."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Opdater er ikke understøttet for enhedstypen %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Metadataenhedstypen %s blev ikke genkendt."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Kommandoen kræver enhedsnavn og oversat navn som argumenter."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Denne operation vil slette alle nøglepladser på enheden %s.\n"
+"Enheden vil blive ubrugelig efter denne operation."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Operation afbrudt, nøglepladser blev IKKE fjernet (wiped).\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Ugyldig LUKS-type, kun luks1 og luks2 er understøttet."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Enheden er allerede %s-type."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Denne operation vil konvertere %s til %s-format.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Operation afbrudt, enheden blev IKKE konverteret.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Tilvalget --priority, --label eller --subsystem mangler."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Symbolet %d er ugyldigt."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Symbolet %d er i brug."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Kunne ikke tilføje luks2-keyringsymbolet %d."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Kunne ikke tildele symbolet %d til nøglepladsen %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Symbolet %d er ikke i brug."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Kunne ikke importere symbol fra fil."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Kunne ikke indhente symbolet %d for eksport."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "parameteren --key-description er obligatorisk for symbol tilføj-handling."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Handling kræver specifik symbol. Brug parameteren --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Ugyldig symboloperation %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Automatisk registreret aktiv dm-enhed »%s« for dataenheden %s.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Enheden %s er ikke en blokenhed.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Kunne ikke automatisk registrere enheds-%s-holdere."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Kan ikke afklare om enheden %s er aktiv eller ej.\n"
+"Er du sikker på, at du ønsker at fortsætte med omkryptering i frakoblet\n"
+"tilstand?\n"
+"Det kan medføre dataødelæggelse, hvis enheden aktiveres.\n"
+"For at afvikle omkryptering i frakoblet tilstand bruges parameteren\n"
+"--active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Ugyldig LUKS-enhedstype."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Kryptering uden frakoblet teksthoved (--header) er ikke muligt uden størrelsesreduktion for dataenhed (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Anmodte dataforskydning skal være mindre end eller lig med halvdelen af --reduce-device-size parameter."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Justerer --reduce-device-size value til det dobbelte af --offset %<PRIu64> (sektorer).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Kryptering er kun understøttet for formatet LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "Registrerede LUKS-enhed på %s. Ønsker du at kryptere den LUKS-enhed igen?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Midlertidig teksthovedfil %s findes allerede. Afbryder."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Kan ikke oprette midlertidig teksthovedfil %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s er nu aktiv og klar til kryptering via nettet.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Ikke nok ledige nøglepladser for omkryptering."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Nøglefil kan kun bruges med --key-slot eller med præcis en aktiv nøgleplads."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Indtast adgangsfrase for nøgleplads %d: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Indtast adgangsfrase for nøgleplads %u: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Kommandoen kræver enhed som argument."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "Kun formatet LUKS2 er i øjeblikket understøttet. Brug venligst værktøjet cryptsetup-reencrypt for LUKS1."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Forældet frakoblet omkryptering er allerede i gang. Brug redskabet cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Omkryptering af enhed med integritetsprofil er ikke understøttet."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "LUKS2-omkryptering er allerede initialiseret. Afbryder operation."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "LUKS2-enheden er ikke i omkryptering."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<enhed> [--type <type>] [<navn>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "åbn enhed som <navn>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<navn>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "luk enhed (fjern oversættelse)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "ændr størrelse på aktiv enhed"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "vis enhedsstatus"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <krypteringsalgoritme>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "krypteringsalgoritme for sammenligning"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<enhed>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "prøv at reparere on-disk-metadata"
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "omkrypter LUKS2-enhed"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "slet alle nøglepladser (fjern krypteringsnøgle)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "konverter LUKS fra/til LUKS2-format"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "angiv permanente konfigurationstilvalg for LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<enhed> [<ny nøglefil>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "formaterer en LUKS-enhed"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "tilføj nøgle til LUKS-enhed"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<enhed> [<nøglefil>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "fjerner leveret nøgle eller nøglefil fra LUKS-enhed"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "ændrer leveret nøgle eller nøglefil for LUKS-enhed"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "konverterer en nøgle til nye pbkdf-parametre"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<enhed> <nøgleplads>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "rydder nøgle med nummer <nøgleplads> fra LUKS-enhed"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "vis UUID for lUKS-enhed"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "tester <enhed> for LUKS-partitionsteksthoved"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "dump LUKS-partitionsinformation"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "dump TCRYPT-enhedsinformation"
+
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "dump BITLK-enhedsinformation"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Suspender LUKS-enhed og ryd nøgle (alle IO'er fryses fast)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Genoptag suspenderet LUKS-enhed"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Lav sikkerhedskopi af LUKS-enhedsteksthoved og nøglepladser"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Gendan LUKS-teksthoved og nøglepladser"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <enhed>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Manipuler LUKS2-symboler"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<handling> er en af:\n"
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"Du kan også bruge gamle <handling> syntaksaliasser:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<navn> er enheden at oprette under %s\n"
+"<enhed> er den krypterede enhed\n"
+"<nøgleplads> er LUKS-nøglens pladsnummer, der skal ændres\n"
+"<nøglefil> valgfri nøglefil for den nye nøgle for luksAddKey-handling\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Standardindkompileret metadataformat er %s (for luksFormat-handling).\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Standardindkompileret nøgle og adgangsfraseparametre.\n"
+"\tMaksimal nøglefilsstørrelse: %dkB, Maksimal interaktiv adgangsfraselængde %d (tegn)\n"
+"Standard-PBKDF for LUKS1: %s, iterationtid: %d (ms)\n"
+"Standard-PBKDF for LUKS2: %s\n"
+"\tTterationtid: %d, hukommelse krævet: %dkB, parallelle tråde: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Standardindkompileret enhedskrypteringsalgoritmeparametre:\n"
+"\tloop-AES: %s, Nøgle %d bit\n"
+"\tplain: %s, Nøgle: %d bit, Adgangskodehashing: %s\n"
+"\tLUKS: %s, Nøgle: %d bit, LUKS-teksthovedhashing: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: Standardstørrelse på nøgle med XTS-tilstand (to interne nøgler) vil blive fordoblet.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: kræver %s som argumenter"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Vis denne hjælpetekst"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Vis en kort brugsmanual"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Vis pakkeversion"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Hjælpetilvalg:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Viser mere detaljerede fejlbeskeder"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Vis fejlsøgningsbeskeder"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Vis fejlsøgningsbeskeder inklusive JSON-metadata"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "Krypteringsalgoritmen brugt til at kryptere disken (se /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "Hashen brugt til at oprette krypteringsnøglen fra adgangsfrasen"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Verificerer adgangsfrasen ved at anmode om den to gange"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Læs nøglen fra en fil"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "Læs diskenhedens (master) nøgle fra fil."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Dump diskenheds (master) nøgle i stedet for information om nøgleplads"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "Krypteringsnøglens størrelse"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "BIT"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Begræns læsningen fra nøglefil"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "byte"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Antallet af byte at udelade i nøglefil"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Begræns læsningnen fra nyligt tilføjet nøglefil"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Antallet af byte at udelade i senest tilføjet nøglefil"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Pladsnummer for ny nøgle (standard er den første ledige)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "Størrelse på enheden"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "SEKTORER"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Brug kun specificeret enhedstørrelse (ignorer resten af enheden). FARLIGT!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "Startforskydningen i motorenheden"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Antal sektorer med krypterede data som skal udelades i begyndelsen"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Opret en skrivebeskyttet oversættelse"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Anmod ikke om bekræftelse"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Tidsudløb for interaktiv adgangsfraseprompt (i sekunder)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "sek"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Statuslinjeopdatering (i sekunder)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Hvor ofte inddata for adgangsfrasen kan indhentes"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Juster belastning ved <n> sektorgrænser - for luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Fil med LUKS-teksthoved og sikkerhedskopi af nøglepladser"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Brug /dev/random til oprettelse af diskenhedsnøgle"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Brug /dev/urandom til oprettelse af diskenhedsnøgle"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Del enhed med et andet ikkeoverlappende kryptsegment"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID som enheden skal bruge"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Tillader fjernelsesforespørgsler (a.k.a. TRIM) for enhed"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Enhed eller fil med adskilt LUKS-teksthoved"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Aktiver ikke enhed, kontroller bare adgangsfrase"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Brug skjult teksthoved (skjult TCRYPT-enhed)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Enhed er system-TCRYPT-drev (med opstartsindlæser)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Brug sikkerhedskopi (sekundær) TCRYPT-teksthoved"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Skan også for VeraCrypt-kompatibel enhed"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Personlig iterationmultiplikator for VeraCrypt-kompatibel enhed"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Forespørg personlig iterationmultiplikator for VeraCrypt-kompatibel enhed"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Type for enhedsmetadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Deaktiver kontrol af adgangskodens kvalitet (hvis aktiveret)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Brug tilvalgene dm-crypt og same_cpu_crypt for ydelseskompatibilitet"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Brug tilvalgene dm-crypt og submit_from_crypt_cpus for ydelseskompatibilitet"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Enhedsfjernelse er udskudt indtil den sidste bruger lukker enheden"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Brug global lås til at serialisere memory-hard-PBKDF (OOM-alternativ)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "PBKDF-iterationstid for LUKS (i ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ms"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "PBKDF-algoritme (for LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "PBKDF-hukommelsesomkostningsbegrænsning"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilobyte"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "PBKDF-parallel omkostning"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "tråde"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "PBKDF-iterationsomkostning (tvunget, deaktiverer sammenligning)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Nøglepladsprioritet: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Deaktiver låsning af on-disk-metadata"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Deaktiver indlæsning af diskenhedsnøgler via kernenøglering"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Dataintegritetsalgoritme (kun LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Deaktiver journal for integritetsenhed"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Ryd ikke enhed efter formatering"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Brug ineffektive forældede mellemrum (gamle kerner)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Spørg ikke om adgangsfrase hvis aktivering via symbol mislykkes"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Symbolnummer (standard: alle)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Nøglebeskrivelse"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Sektorstørrelse for kryptering (standard: 512 byte)"
+
+#: src/cryptsetup.c:3548
+#, fuzzy
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Sektorstørrelse for kryptering (standard: 512 byte)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Angiv aktiveringsflag vedvarende for enhed"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Angiv etiket for LUKS2-enhed"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Angiv undersystemetiket for LUKS2-enhed"
+
+#: src/cryptsetup.c:3552
+#, fuzzy
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Opret ubunden (intet tildelt datasegment) LUKS2-nøgleplads"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Læs eller skriv json fra eller til en fil"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Størrelse på metadataområdet for LUKS2-teksthovedet"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Størrelse på nøglepladsområdet for LUKS2-teksthovedet"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Opdater (genaktiver) enhed med nye parametre"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "LUKS2-nøgleplads: Krypteringsnøglens størrelse"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "LUKS2-nøgleplads: krypteringsalgoritmen brugt for nøglepladskryptering"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Krypter LUKS2-enhed (på stedet kryptering)."
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Dekrypter LUKS2-enhed (fjern kryptering)."
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Initialiser LUKS2-omkryptering kun i metadata."
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Genoptag kun initialiseret LUKS2-omkryptering."
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Reducer dataenhedstørrelse (flyt dataforskydning). FARLIGT!"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Maksimal størrelse for omkrypteringshotzone."
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Resilience-type for omkrypteringshotzonen (checksum,journal,none)"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "Kontrolsumshash for omkrypteringshotzonen"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Overskriv automatisk registrering af enhed for dm-enhed der skal omkrypteres"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[TILVALG...] <handling> <handling-specifik>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Argument <handling> mangler."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Ukendt handling."
+
+#: src/cryptsetup.c:3713
+#, fuzzy
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Tilvalgene --refresh og --test-passphrase udelukker hinanden.\n"
+
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr "Tilvalget --deferred er kun tilladt for kommandoen close (luk).\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Tilvalget --shared er kun tilladt for åbning af en ren enhed.\n"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Tilvalget --allow-discards er kun tilladt for åbne operationer.\n"
+
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Tilvalget --persistent er kun tilladt for åben operation.\n"
+
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Tilvalget --serialize-memory-hard-pbkdf er kun tilladt for åbne operationer.\n"
+
+#: src/cryptsetup.c:3743
+#, fuzzy
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Tilvalget --persistent er ikke tilladt med --test-passphrase.\n"
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"Tilvalget --key-size er kun tilladt for luksFormat, luksAddKey,\n"
+"åbn- og sammenligningshandlinger. For at begrænse læsning fra nøglefilen bruges\n"
+"--keyfile-size=(bytes)."
+
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Tilvalget --integrity er kun tilladt for luksFormat (LUKS2).\n"
+
+#: src/cryptsetup.c:3764
+#, fuzzy
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Tilvalget --integrity-no-wipe kan kun bruges for formathandling med integritetudvidelse.\n"
+
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Tilvalget --label og --subsystem er kun tilladt for luksFormat og config LUKS2-operationer.\n"
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Tilvalget --test-passphrase er kun tilladt for åbning af LUKS- TCRYPT- og BITLK-enheder.\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Nøglestørrelse skal gå op i 8 bit"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "Nøgleplads er ugyldig."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Tilvalget --key-file har forrang over specificeret nøglefilsargument."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "Negativ nummer for tilvalg er ikke tilladt."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Kun et argument for --key-file er tilladt."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Kun et af tilvalgene --use-[u]random er tilladt."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "Tilvalget --use-[u]random er kun tilladt for luksFormat."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "Tilvalget --uid er kun tilladt for luksFormat og luksUUID."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "Tilvalget --align-payload er kun tilladt for luksFormat."
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Tilvalgene --luks2-metadata-size og --opt-luks2-keyslots-size er kun tilladt for luksFormat med LUKS2."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Ugyldig specifikation for størrelsen på LUKS2-metadata."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Ugyldig specifikation for størrelsen på LUKS2-nøgleplads."
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Tilvalgene --align-payload og --offset kan ikke kombineres."
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Tilvalget --skip er kun understøttet for åbning af plain- og loopaes-enheder.\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Tilvalget --offset er kun understøttet for åbning af plain- og loopaes-enheder, luksFormat og enhedsomkryptering.\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Tilvalgene --tcrypt-hidden, --tcrypt-system eller --tcrypt-backup er kun understøttet for TCRYPT-enhed.\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Tilvaget --tcrypt-hidden kan ikke kombineres med --allow-discards.\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Tilvalget --veracrypt er kun understøttet for TCRYPT-enhedstype.\n"
+
+#: src/cryptsetup.c:3873
+#, fuzzy
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Ugyldigt argument for parameteren --veracrypt-pim angivet.\n"
+
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Tilvalget --veracrypt-pim er kun understøttet for VeraCrypt-kompatible enheder.\n"
+
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Tilvalget --veracrypt-query-pim er kun understøttet for VeraCrypt-kompatible enheder.\n"
+
+#: src/cryptsetup.c:3889
+#, fuzzy
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Tilvalgene --veracrypt-pim og --veracrypt-query-pm udelukker hinanden.\n"
+
+#: src/cryptsetup.c:3896
+#, fuzzy
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Tilvalget --priority kan kun være ignore/normal/prefer.\n"
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+#, fuzzy
+msgid "Keyslot specification is required."
+msgstr "Nøglepladsspecifikation er krævet.\n"
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+#, fuzzy
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Adgangskodebaseret nøgleudledningsfunktion (PBKDF) kan kun være pbkdf2 eller argon2i/argon2id.\n"
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+#, fuzzy
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "PBKDF-tvungne iterationer kan ikke kombineres med tilvalg for iterationstid.\n"
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "Tilvalg for sektorstørrelse er ikke understøttet for denne kommando.\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+#, fuzzy
+msgid "Key size is required with --unbound option."
+msgstr "Nøglestørrelse er krævet med tilvalget --unbound.\n"
+
+#: src/cryptsetup.c:3944
+#, fuzzy
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Tilvalget --unbound kan kun bruges med luksAddKey-handlingen.\n"
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "Tilvalget --refresh kan kun bruges med open-handlingen.\n"
+
+#: src/cryptsetup.c:3960
+#, fuzzy
+msgid "Cannot disable metadata locking."
+msgstr "Kan ikke deaktivere metadatalåsning.\n"
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Ugyldig maksimal størrelsesspecifikation for omkrypteringshotzonen."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Ugyldig specifikation for enhedsstørrelse."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Maksimal reduceringsstørrelse for enhed er 1 GiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Reducer størrelse skal være multiplum af 512 byte sektor."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "Ugyldig størrelsesspecifikation for data."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Reducer størrelsesoverløb."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "LUKS2-omkryptering kræver tilvalget --header."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Enhedsstørrelse skal være multiplum af 512 byte sektor."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Tilvalgene --reduce-device-size og --data-size kan ikke kombineres."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Tilvalgene --device-size og --size kan ikke kombineres."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Tilvalgene --ignore-corruption og --restart-on-corruption kan ikke bruges sammen.\n"
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Ugyldig salt-streng angivet."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Kan ikke oprette hashaftryk %s for skriving."
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Kan ikke oprette FEC-aftryk %s for skriving."
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Ugyldig root-hash-streng angivet."
+
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr "Ugyldig signaturfil %s."
+
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Kan ikke læse signaturfilen %s."
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<data_enhed> <hash_device>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "formater enhed"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<data_enhed> <hash_enhed> <root_hash>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "verificer enhed"
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<data_enhed> <navn> <hash_enhed> <root_hash>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "vis aktiv enhedsstatus"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<hash_enhed>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "vis on-disk-information"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<navn> er enheden der skal opretttes under %s\n"
+"<data_enhed> er dataenheden\n"
+"<hash_enhed> er enheden indeholdende verifikationsdata\n"
+"<root_hash> hash for root-knuden på <hash_enhed>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Standardindkompilerede dm-verity-parametre:\n"
+"\tHash: %s, Databok (byte): %u, Hashblok (byte): %u, Salt-str.: %u, Hashformat: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Brug ikke verity-superblok"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Formatype (1 - normal, 0 - original Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "nummer"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Blokstørrelse på dataenheden"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Blokstørrelse på hashenheden"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "FEC-paritetbyte"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Antallet af blokke i datafilen"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "blokke"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Sti til enhed med fejlkorrektionsdata"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "sti"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Starter forskydning på hashenheden"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Starter forskydning på FEC-enheden"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Hashalgoritme"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "streng"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Salt"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "hex-streng"
+
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Stil til roothash-signaturfil"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Genstart kerne hvis korruption er registreret"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ignorer korruption, log den kun"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Bekræft ikke nulstillede blokke"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Verificer kun datablok første gang den læses"
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Tilvalgene --ignore-corruption, --restart-on-corruption eller --ignore-zero-blocks er kun tilladt for åben operation.\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Tilvalget --root-hash-signature kan kun bruges til åben operation.\n"
+
+#: src/veritysetup.c:592
+#, fuzzy
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Tilvalgene --ignore-corruption og --restart-on-corruption kan ikke bruges sammen.\n"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Kan ikke læse nøglefilen %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Kan ikke læse %d byte fra nøglefilen %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formateret med mærkestørrelse %u, intern integritet %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<integritet_enhed>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<integritet_enhed> <navn>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<navn> er enheden der skal opretttes under %s\n"
+"<integritet_enhed> er enheden indeholdende data med integritetsmærker\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Standardindkompilerede dm-integrity-parametre:\n"
+"\tkontrolsumalgoritme: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Sti til dataenhed (hvis adskilt)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Journalstørrelse"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Interleave-sektorer"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Journalvandmærke"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "procent"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Journal commit-tid"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Antallet af 512-byte sektorer per bit (bitmap-tilstand)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Flush-tid for Bitmap-tilstand"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Mærkestørrelse (per-sektor)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Sektorstørrelse"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Bufferstørrelse"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Dataintegritetsalgoritme"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Størrelsen for dataintegritetsnøglen"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Læs integritetsnøglen fra en fil"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Journalintegritetsalgoritme"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Størrelsen for journalintegritetsnøglen"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Læs journalintegritetsnøglen fra en fil"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Journalkrypteringsalgoritme"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Størrelsen for journalkrypteringsnøglen"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Læs journalkrypteringsnøglen fra en fil"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Gendannelsestilstand (ingen journal, ingen mærkekontrol)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Brug bitmap til at registrere ændringer og deaktivere journal for integritetsenhed"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Genberegn oprindelige mærker automatisk."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Tilvalget --integrity-recalculate kan kun bruges for open-handling."
+
+#: src/integritysetup.c:669
+#, fuzzy
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Tilvalgene --journal-size, --interleave-sectors, --sector-size, --tag-size og --no-wipe kan kun bruges for formathandlingen.\n"
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Ugyldig specifikation for journalstørrelse."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Både nøglefil og tilvalg for nøglestørrelse skal være angivet."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Integritetsalgoritme skal være angivet hvis der bruges integritetsnøgle."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Både journalintegritetsnøglefil og tilvalg for nøglestørrelse skal være angivet."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Journalintegritetsalgoritme skal være angivet hvis journalintegritetsnøgle anvendes."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Både journalkrypteringsnøglefil og tilvalg for nøglestørrelse skal være angivet."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Journalkrypteringsalgoritme skal være angivet hvis journalkrypteringsnøgle bruges."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Tilvalgene recovery og bitmap udelukker hinanden."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Journaltilvalg kan ikke bruges i bitmap-tilstand."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Bitmap-tilvalg kan kun bruges i bitmap-tilstand."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Omkryptering er allerede i gang."
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Kan ikke eksklusivt åbne %s, enheden er i brug."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Allokering af tilpasset hukommelse mislykkedes."
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "Kan ikke læse enheden %s."
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Markerer LUKS-enheden %s som ubrugelig."
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Angivelse af LUKS2 som frakoblet omkrypterer flag på enheden %s."
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Kan ikke skrive enhed %s."
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Kan ikke skrive omkrypteringslogfilen."
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Kan ikke læse omkrypteringslogfilen."
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Logfilen %s findes, genoptager omkryptering.\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Aktiverer midlertidig enhed via brug af gammelt LUKS-teksthoved."
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Aktiverer midlertidig enhed via brug af nyt LUKS-teksthoved."
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Aktivering af midlertidige enheder mislykkedes."
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Kunne ikke angive dataforskydning."
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Kunne ikke angive metadatastørrelse."
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Nyt LUKS-teksthoved for enheden %s oprettet."
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Denne version af cryptsetup-reencrypt kan ikke håndtere ny intern symboltype %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Kunne ikke læse aktiveringsflag fra sikkerhedskopiteksthoved."
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Kunne ikke skrive aktiveringsflag til nyt teksthoved."
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Kunne ikke læse krav fra sikkerhedskopiteksthoved."
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "%s-sikkerhedskopi af teksthoved for enheden %s er oprettet."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Oprettelse af LUKS-sikkerhedskopiteksthoveder mislykkedes."
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Kan ikke gendanne %s-teksthoved på enheden %s."
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "%s-teksthoved på enheden %s er gendannet."
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Kan ikke åbne midlertidig LUKS-enhed."
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Kan ikke indhente enhedsstørrelse."
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "IO-fejl under omkryptering."
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Angivet UUID er ugyldig."
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Kan ikke åbne omkrypteringslogfilen."
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Ingen dekryptering i gang, angivet UUID kan kun bruges til at genoptage suspenderet dekrypteringsproces."
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Ændret pbkdf-parameter i nøgleplads %i."
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Blokstørrelse for omkryptering"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Ændr ikke nøgle, ingen dataområdeomkryptering"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Læs ny diskenhednøgle (master) fra fil"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "PBKDF2-iterationstid for LUKS (i ms)"
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Brug direct-io når enheder tilgås"
+
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Brug fsync efter hver blok"
+
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Opdater logfil efter hver blok"
+
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Brug kun denne plads (andre vil blive deaktiveret)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Opret nyt teksthoved på ikke krypteret enhed"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Dekrypter enhed permanent (fjern kryptering)"
+
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "UUID'en brugt til at genoptage dekryptering"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Type for LUKS-metadata: luks1, luks2"
+
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[TILVALG...] <enhed>"
+
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Omkryptering vil ændre: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "diskenhedsnøgle"
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "sæt hash til "
+
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", set krypteringsalgoritme til "
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Argument krævet."
+
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Kun værdier mellem 1 MiB og 64 MiB tilladt for omkrypteringsblokstørrelsen."
+
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "Maksimal reduceringsstørrelse for enhed er 64 MiB."
+
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Tilvalget --new skal bruges sammen med --reduce-device-size eller --header."
+
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Tilvalget --keep-key kan kun bruges med --hash, --iter-time eller --pbkdf-force-iterations."
+
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "Tilvalget --new kan ikke bruges sammen med --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "Tilvalget --decrypt er ikke kompatibelt med specificerede parametre."
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Tilvalget --uuid er kun tilladt sammen med --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Ugyldig luks-type. Brug en af disse: »luks«, »luks2« eller »luks2«."
+
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Fejl ved læsning af svar fra terminal."
+
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Kommando succesfuld.\n"
+
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "forkert eller manglende parametre"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "ingen tilladelse eller ugyldg adgangsfrase"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "ikke nok hukommelse"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "forkert enhed eller fil angivet"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "enheden findes allerede eller enheden er optaget"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "ukendt fejl"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Kommando mislykkedes med kode %i (%s).\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Nøglepladsen %i oprettet."
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Nøgleplads %i låst op."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Nøgleplads %i fjernet."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Symbol %i oprettet."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Symbol %i fjernet."
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Sletning (wipe) afbrudt."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "ADVARSEL: Enheden %s indeholder allerede en »%s«-partitionsignatur.\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "ADVARSEL: Enheden %s indeholder allerede en »%s«-superbloksignatur.\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Kunne ikke initialisere enhedssignaturundersøgelser."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Kunne ikke køre stat på enheden %s."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Enheden %s er i brug. Kan ikke fortsætte med formatoperation."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Kunne ikke åbne filen %s i læs/skriv-tilstand."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Eksisterende »%s«-partitionsignatur (forskydning: %<PRIi64> byte) på enheden %s vil blive slettet."
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Eksisterende »%s«-superbloksignatur (forskydning: %<PRIi64> byte) på enheden %s vil blive slettet."
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Kunne ikke rydde enhedssignatur."
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Kunne ikke undersøge enheden %s for en signatur."
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Omkryptering afbrudt."
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Kan ikke kontrollere adganskodekvalitet: %s"
+
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+"Kontrol af adgangskodens kvalitet mislykkedes:\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Kontrol af adgangskodens kvalitet mislykkedes: Ugyldig adgangsfrase (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Kunne ikke læse adgangsfrase fra terminal."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Verificer adgangsfrase: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Adgangsfraser matcher ikke."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Kan ikke bruge forskydning med terminalinddata."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Indtast adgangsfrase: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Indtast adgangsfrase for %s: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Ingen nøgle tilgængelig med denne adgangsfrase."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Ingen brugbar nøgleplads tilgængelig."
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Kan ikke bne nøglefilen %s for skrivning."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Kan ikke skrive til nøglefilen %s."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Kunne ikke åbne filen %s i skrivebeskyttet tilstand."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Tilbyd gyldig LUKS2-symbol JSON:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Kunne ikke læse JSON-fil."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Læsning afbrudt."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Kunne ikke åbne filen %s i skrive-tilstand."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Skrivning afbrudt."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Kunne ikke skrive JSON-fil."
+
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Krypteringsalgoritmen %s er ikke tilgængelig."
+
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands.\n"
+#~ msgstr "Parameteren --refresh er kun tilladt for kommandoerne open (åbn) eller refresh (opdater).\n"
+
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Krypteringsektorstørrelsen er ikke understøttet.\n"
+
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Forespurgte dmcrypt-ydelsestilvalg er ikke understøttede."
+
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Kan ikke formatere enheden %s som stadig er i brug."
+
+#~ msgid "Key slot %d is not used."
+#~ msgstr "Nøglepladsen %d er ikke brugt."
+
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Funktion er ikke tilgængelig i FIPS-tilstand."
+
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Nøgleplads %d valgt for sletning."
+
+#~ msgid "open device as mapping <name>"
+#~ msgstr "åbn enhed som oversættelse <navn>"
+
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "luk enhed (deaktiver og fjern oversættelse)"
+
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Kunne ikke angive PBKDF-parametre."
+
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Kan ikke søge til enhedsforskydning.\n"
+
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Afbrudt af et signal."
+
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "Enheden %s er for lille. (LUKS2 kræver mindst %<PRIu64> byte.)"
index b03ec22..301c436 100644 (file)
Binary files a/po/de.gmo and b/po/de.gmo differ
index 66d895b..808523c 100644 (file)
--- a/po/de.po
+++ b/po/de.po
 # German translation for the cryptsetup package.
 # Copyright (C) 2010 Free Software Foundation, Inc.
 # This file is distributed under the same license as the cryptsetup package.
-# Roland Illig <roland.illig@gmx.de>, 2010-2015.
+# Roland Illig <roland.illig@gmx.de>, 2010-2020.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-20 12:19+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-15 15:19+0200\n"
 "Last-Translator: Roland Illig <roland.illig@gmx.de>\n"
 "Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
 "Language: de\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 1.7.5\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+"X-Generator: Poedit 2.3.1\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"Das Kernelmodul »device-mapper« kann nicht initialisiert werden, da das "
-"Programm nicht mit Root-Rechten läuft.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Das Kernelmodul »device-mapper« kann nicht initialisiert werden, da das Programm nicht mit Root-Rechten läuft."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"Das Kernelmodul »device-mapper« kann nicht initialisiert werden. Ist das "
-"Kernelmodul »dm_mod« geladen?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Das Kernelmodul »device-mapper« kann nicht initialisiert werden. Ist das Kernelmodul »dm_mod« geladen?"
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Verlangter »deferred«-Schalter wird nicht unterstützt."
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "DM-UUID für Gerät »%s« wurde verkürzt.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID für Gerät »%s« wurde verkürzt."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Unbekannte Art des dm-Ziels."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Die verlangten dm-crypt-Performance-Optionen werden nicht unterstützt."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Die verlangten dm-verity-Datenbeschädigungs-Optionen werden nicht unterstützt."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Die verlangten dm-verity-FEC-Optionen werden nicht unterstützt."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Die verlangten Datenintegritäts-Optionen werden nicht unterstützt."
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Verlangte dmcrypt-Performance-Optionen werden nicht unterstützt.\n"
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Die verlangte sector_size-Option wird nicht unterstützt."
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Die verlangte automatische Berechnung der Integritätsangaben wird nicht unterstützt."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "»Discard/TRIM« wird nicht unterstützt."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Der verlangte Bitmap-Modus für dm-Integrität wird nicht unterstützt."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Fehler beim Abfragen des »dm-%s«-Segments."
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
-"Das System hat keine Entropie mehr, um den Laufwerksschlüssel zu "
-"generieren.\n"
-"Bitte bewegen Sie die Maus oder tippen Sie etwas Text in ein anderes "
-"Fenster, um einige zufällige Ereignisse zu sammeln.\n"
+"Das System hat keine Entropie mehr, um den Laufwerksschlüssel zu generieren.\n"
+"Bitte bewegen Sie die Maus oder tippen Sie etwas Text in ein anderes Fenster, um einige zufällige Ereignisse zu sammeln.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Schlüssel wird generiert (%d %% erledigt).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr ""
-"Fataler Fehler während der Initialisierung des Zufallszahlengenerators.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Laufe im FIPS-Modus."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Fataler Fehler während der Initialisierung des Zufallszahlengenerators."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Unbekannte Qualität des Zufallszahlengenerators verlangt."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr "Unbekannte Qualität des Zufallszahlengenerators verlangt.\n"
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Fehler beim Einlesen vom Zufallszahlengenerator."
 
-#: lib/random.c:211
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Fehler beim Initialisieren des Krypto-Zufallszahlengenerator-Backends."
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Fehler beim Initialisieren des Krypto-Backends."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
 #, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Fehler %d beim Einlesen vom Zufallszahlengenerator: %s\n"
+msgid "Hash algorithm %s not supported."
+msgstr "Hash-Algorithmus »%s« wird nicht unterstützt."
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr ""
-"Fehler beim Initialisieren des Krypto-Zufallszahlengenerator-Backends.\n"
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Fehler beim Verarbeiten des Schlüssels (mit Hash-Algorithmus »%s«)."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Fehler beim Initialisieren des Krypto-Backends.\n"
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Geräte-Art kann nicht bestimmt werden. Inkompatible Aktivierung des Geräts?"
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Diese Operation wird nur für LUKS-Geräte unterstützt."
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Diese Operation wird nur für LUKS2-Geräte unterstützt."
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Alle Schlüsselfächer sind voll."
+
+#: lib/setup.c:434
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "Hash-Algorithmus »%s« wird nicht unterstützt.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Schlüsselfach %d ist ungültig, bitte wählen Sie eins zwischen 0 und %d."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:440
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Fehler beim Verarbeiten des Schlüssels (mit Hash-Algorithmus »%s«).\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "Schlüsselfach %d ist voll, bitte wählen Sie ein anderes."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"Geräte-Art kann nicht bestimmt werden. Inkompatible Aktivierung des Geräts?\n"
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "Gerätegröße ist nicht an logischer Sektorgröße ausgerichtet."
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Diese Operation wird nur für LUKS-Geräte unterstützt.\n"
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Header gefunden, aber Gerät »%s« ist zu klein."
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Diese Operation wird für diese Geräteart nicht unterstützt."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Alle Schlüsselfächer sind voll.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Ungültige Operation, während die Wiederverschlüsselung läuft."
 
-#: lib/setup.c:327
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr ""
-"Schlüsselfach %d ist ungültig, bitte wählen Sie eins zwischen 0 und %d.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "Nicht unterstützte LUKS-Version %d."
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Gerät für separierte Metadaten wird für diese Verschlüsselungsart nicht unterstützt."
 
-#: lib/setup.c:333
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "Schlüsselfach %d ist voll, bitte wählen Sie ein anderes.\n"
+msgid "Device %s is not active."
+msgstr "Gerät »%s« ist nicht aktiv."
 
-#: lib/setup.c:472
+#: lib/setup.c:1444
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Geben Sie die Passphrase für »%s« ein: "
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Zugrundeliegendes Gerät für das Kryptogerät »%s« ist verschwunden."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Ungültige Parameter für Plain-Verschlüsselung."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Ungültige Schlüsselgröße."
 
-#: lib/setup.c:653
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID wird für diese Verschlüsselungsart nicht unterstützt."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Nicht unterstützte Sektorengröße für Verschlüsselung."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Gerätegröße ist nicht an verlangter Sektorgröße ausgerichtet."
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Ohne Gerät kann LUKS nicht formatiert werden."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Die angeforderte Datenausrichtung ist nicht mit dem Datenoffset kompatibel."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "WARNING: Der Datenoffset ist außerhalb des derzeit verfügbaren Datengeräts.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Fehler beim Auslöschen des Headers auf Gerät »%s«."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "WARNUNG: Die Geräteaktivierung wird fehlschlagen, dm-crypt fehlt die Unterstützung für die angeforderte Verschlüsselungsgröße.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Laufwerksschlüssel ist zu klein für die Verschlüsselung mit Integritätserweiterungen."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Verschlüsselung »%s-%s« (Schlüsselgröße %zd Bits) ist nicht verfügbar."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "Warnung: Größe der LUKS2-Metadaten wurde auf %<PRIu64> geändert.\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "Warnung: Größe des LUKS2-Schlüsselfachbereichs wurde auf %<PRIu64> Bytes geändert.\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "Header gefunden, aber Gerät »%s« ist zu klein.\n"
+msgid "Device %s is too small."
+msgstr "Gerät »%s« ist zu klein."
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Diese Operation wird für diese Geräteart nicht unterstützt.\n"
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Gerät »%s« kann nicht formatiert werden, da es gerade benutzt wird."
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Gerät »%s« kann nicht formatiert werden, Zugriff verweigert."
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Fehler beim Formatieren der Integrität auf Gerät »%s«."
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1926
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Gerät »%s« ist nicht aktiv.\n"
+msgid "Cannot format device %s."
+msgstr "Gerät »%s« kann nicht formatiert werden."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Ohne Gerät kann LOOPAES nicht formatiert werden."
 
-#: lib/setup.c:925
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Ohne Gerät kann VERITY nicht formatiert werden."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr "Zugrundeliegendes Gerät für das Kryptogerät »%s« ist verschwunden.\n"
+msgid "Unsupported VERITY hash type %d."
+msgstr "Nicht unterstützte VERITY-Hash-Art %d."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Nicht unterstützte VERITY-Blockgröße."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Ungültige Parameter für Plain-Verschlüsselung.\n"
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Nicht unterstützter VERITY-Hash-Offset."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Ungültige Schlüsselgröße.\n"
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Nicht unterstützter VERITY-FEC-Offset."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "UUID wird für diese Verschlüsselungsart nicht unterstützt.\n"
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Datenbereich und Hashbereich überlappen sich."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Ohne Gerät kann LUKS nicht formatiert werden.\n"
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Hashbereich und FEC-Bereich überlappen sich."
 
-#: lib/setup.c:1089
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Datenbereich und FEC-Bereich überlappen sich."
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "WARNUNG: Angeforderte Taggröße mit %d Bytes unterscheidet sich von der Ausgabe der Größe %s (%d Bytes).\n"
+
+#: lib/setup.c:2286
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Gerät »%s« kann nicht formatiert werden, da es gerade benutzt wird.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Unbekannte Art des Verschlüsselungsgeräts »%s« verlangt."
 
-#: lib/setup.c:1092
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Gerät »%s« kann nicht formatiert werden, Zugriff verweigert.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Nicht unterstützte Parameter für Gerät %s."
 
-#: lib/setup.c:1096
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Fehler beim Auslöschen des Headers auf Gerät »%s«.\n"
+msgid "Mismatching parameters on device %s."
+msgstr "Parameter für Gerät %s sind durcheinander."
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Ohne Gerät kann LOOPAES nicht formatiert werden.\n"
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Verschlüsselungsgeräte passen nicht zusammen."
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "Ohne Gerät kann VERITY nicht formatiert werden.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "Gerät »%s« konnte nicht neugeladen werden."
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Nicht unterstützte VERITY-Hash-Art %d.\n"
+msgid "Failed to suspend device %s."
+msgstr "Gerät »%s« konnte nicht stillgelegt werden."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Nicht unterstützte VERITY-Blockgröße.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Gerät »%s« konnte nicht fortgesetzt werden."
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Nicht unterstützter VERITY-Hash-Offset.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Schwerwiegender Fehler beim Neuladen von Gerät »%s« (über Gerät »%s«)."
 
-#: lib/setup.c:1285
+#: lib/setup.c:2735 lib/setup.c:2737
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Unbekannte Art des Verschlüsselungsgeräts »%s« verlangt.\n"
+msgid "Failed to switch device %s to dm-error."
+msgstr "Gerät »%s« konnte nicht auf dm-error umgeschaltet werden."
 
-#: lib/setup.c:1435
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Fehler beim Ändern der Größe des Loopback-Geräts."
+
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "Wollen Sie wirklich die UUID des Geräts ändern?"
 
-#: lib/setup.c:1545
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Header-Backupdatei enthält keinen kompatiblen LUKS-Header."
+
+#: lib/setup.c:3058
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Laufwerk »%s« ist nicht aktiv.\n"
+msgid "Volume %s is not active."
+msgstr "Laufwerk »%s« ist nicht aktiv."
 
-#: lib/setup.c:1556
+#: lib/setup.c:3069
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Laufwerk »%s« ist bereits im Ruhezustand.\n"
+msgid "Volume %s is already suspended."
+msgstr "Laufwerk »%s« ist bereits im Ruhezustand."
 
-#: lib/setup.c:1563
+#: lib/setup.c:3082
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "Das Gerät »%s« unterstützt keinen Ruhezustand.\n"
+msgid "Suspend is not supported for device %s."
+msgstr "Das Gerät »%s« unterstützt keinen Ruhezustand."
 
-#: lib/setup.c:1565
+#: lib/setup.c:3084
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Das Gerät »%s« kann nicht in den Ruhezustand versetzt werden.\n"
+msgid "Error during suspending device %s."
+msgstr "Das Gerät »%s« kann nicht in den Ruhezustand versetzt werden."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Laufwerk »%s« ist nicht im Ruhezustand.\n"
+msgid "Volume %s is not suspended."
+msgstr "Laufwerk »%s« ist nicht im Ruhezustand."
 
-#: lib/setup.c:1605
+#: lib/setup.c:3146
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Das Gerät »%s« kann nicht aus dem Ruhezustand aufgeweckt werden.\n"
+msgid "Resume is not supported for device %s."
+msgstr "Das Gerät »%s« kann nicht aus dem Ruhezustand aufgeweckt werden."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Fehler beim Aufwecken von Gerät »%s« aus dem Ruhezustand.\n"
+msgid "Error during resuming device %s."
+msgstr "Fehler beim Aufwecken von Gerät »%s« aus dem Ruhezustand."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Passphrase eingeben: "
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Der Laufwerksschlüssel passt nicht zum Laufwerk."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Schlüsselfach kann nicht hinzugefügt werden, da alle Fächer deaktiviert sind "
-"und kein Laufwerksschlüssel angegeben wurde.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Schlüsselfach kann nicht hinzugefügt werden, da alle Fächer deaktiviert sind und kein Laufwerksschlüssel angegeben wurde."
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Geben Sie irgendeine Passphrase ein: "
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Neues Schlüsselfach konnte nicht ausgewechselt werden."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Geben Sie die neue Passphrase für das Schlüsselfach ein: "
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Schlüsselfach %d ist ungültig."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Schlüsselfach %d ist nicht aktiv."
 
-#: lib/setup.c:1798
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Geräteheader und Datenbereich überlappen sich."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Wiederverschlüsselung läuft bereits. Das Gerät kann nicht aktiviert werden."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Fehler beim Zugriff auf die Sperre zur Wiederverschlüsselung."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Fehler beim Wiederherstellen der LUKS2-Wiederverschlüsselung."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Geräteart ist nicht richtig initialisiert."
+
+#: lib/setup.c:4171
 #, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Schlüsselfach %d geändert.\n"
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Gerät »%s« kann nicht verwendet werden, da es gerade benutzt wird oder der Name ungültig ist."
 
-#: lib/setup.c:1801
+#: lib/setup.c:4174
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Ersetzt durch Schlüsselfach %d.\n"
+msgid "Device %s already exists."
+msgstr "Das Gerät »%s« existiert bereits."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Falscher Laufwerksschlüssel für Plain-Gerät angegeben."
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Falscher Root-Hash-Schlüssel für VERITY-Gerät angegeben."
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Signatur des Stammhashes erforderlich."
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Neues Schlüsselfach konnte nicht ausgewechselt werden.\n"
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Der Kernel-Schlüsselbund fehlt. Wird benötigt, um die Signatur zum Kernel zu übergeben."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Der Laufwerksschlüssel passt nicht zum Laufwerk.\n"
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Fehler beim Laden des Schlüssels im Kernel-Schlüsselbund."
 
-#: lib/setup.c:1961
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Schlüsselfach %d ist ungültig.\n"
+msgid "Device %s is still in use."
+msgstr "Gerät »%s« wird gerade benutzt."
 
-#: lib/setup.c:1966
+#: lib/setup.c:4516
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Schlüsselfach %d ist unbenutzt.\n"
+msgid "Invalid device %s."
+msgstr "Ungültiges Gerät »%s«."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Laufwerks-Schlüsselpuffer zu klein."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Fehler beim Ermitteln des Laufwerksschlüssels für Plain-Gerät."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Root-Hash für Verity-Gerät kann nicht ermittelt werden."
+
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Diese Operation wird für Kryptogerät »%s« nicht unterstützt."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Die Dump-Operation wird für diese Geräteart nicht unterstützt."
+
+#: lib/setup.c:5190
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Das Gerät »%s« existiert bereits.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Datenoffset ist kein Vielfaches von %u Bytes."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr "Falscher Laufwerksschlüssel für Plain-Gerät angegeben.\n"
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Gerät »%s« kann nicht konvertiert werden, da es gerade benutzt wird."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
-msgstr "Falscher Root-Hash-Schlüssel für VERITY-Gerät angegeben.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Schlüsselfach %u konnte nicht dem Laufwerksschlüssel zugeordnet werden."
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Geräteart ist nicht richtig initialisiert.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Fehler beim Initialisieren der LUKS2-Schlüsselfach-Parameter."
 
-#: lib/setup.c:2259
+#: lib/setup.c:5851
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Gerät »%s« wird gerade benutzt.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Schlüsselfach %d konnte nicht dem Digest zugeordnet werden."
 
-#: lib/setup.c:2268
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Der Kernel-Schlüsselbund wird vom Kernel nicht unterstützt."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Ungültiges Gerät »%s«.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Fehler beim Lesen der Passphrase vom Schlüsselbund (Fehler %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Globale Speicherzugriffsserialisierungssperre konnte nicht angefordert werden."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Fehler beim Ermitteln der Prozesspriorität."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Fehler beim Entsperren des Speichers."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Fehler beim Öffnen der Schlüsseldatei."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Fehler beim Einlesen der Schlüsseldatei »%s« vom Terminal."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Fehler beim Öffnen der Schlüsseldatei."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Fehler beim Zugriff auf die Schlüsseldatei."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Diese Funktion ist im FIPS-Modus nicht verfügbar.\n"
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Zu wenig Speicher zum Einlesen der Passphrase."
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Laufwerks-Schlüsselpuffer zu klein.\n"
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Fehler beim Einlesen der Passphrase."
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "Fehler beim Ermitteln des Laufwerksschlüssels für Plain-Gerät.\n"
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Nichts zu lesen in der Eingabe."
 
-#: lib/setup.c:2310
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Größenbegrenzung für die Schlüsseldatei überschritten."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Die gewünschte Menge an Daten kann nicht eingelesen werden."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
 #, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Diese Operation wird für Kryptogerät »%s« nicht unterstützt.\n"
+msgid "Device %s does not exist or access denied."
+msgstr "Gerät »%s« existiert nicht oder Zugriff verweigert."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr "Die Dump-Operation wird für diese Geräteart nicht unterstützt.\n"
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Gerät »%s« ist nicht kompatibel."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Fehler beim Ermitteln der Prozesspriorität.\n"
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Gerät »%s« ist zu klein. Mindestens %<PRIu64> Bytes erforderlich."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Fehler beim Entsperren des Speichers.\n"
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Gerät »%s« kann nicht benutzt werden, da es bereits anderweitig benutzt wird."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Zu wenig Speicher zum Einlesen der Passphrase.\n"
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Gerät »%s« kann nicht verwendet werden, Zugriff verweigert."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Fehler beim Lesen der Passphrase vom Terminal.\n"
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Fehler beim Abrufen der Infos über Gerät »%s«."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Passphrase bestätigen: "
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Das Loopback-Gerät kann nicht benutzt werden, da das Programm nicht mit Root-Rechten läuft."
+
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Anklemmen des Loopback-Geräts fehlgeschlagen (das Loopback-Gerät benötigt den »autoclear«-Schalter)."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Passphrasen stimmen nicht überein.\n"
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Der angeforderte Offset ist jenseits der wirklichen Größe des Geräts »%s«."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Offset kann nicht zusammen mit Terminaleingabe benutzt werden.\n"
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Gerät »%s« hat die Größe 0."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "Fehler beim Öffnen der Schlüsseldatei.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Verlangte Vorgabezeit für PBKDF darf nicht 0 sein."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "Fehler beim Öffnen der Schlüsseldatei.\n"
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Unbekannte PBKDF, Typ »%s«."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr "Fehler beim Zugriff auf die Schlüsseldatei.\n"
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Verlangter Hash »%s« wird nicht unterstützt."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Fehler beim Einlesen der Passphrase.\n"
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Verlangter PBKDF-Typ wird von LUKS1 nicht unterstützt."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Größenbegrenzung für die Schlüsseldatei überschritten.\n"
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Für pbkdf2 dürfen weder das Speichermaximum noch die Anzahl der Threads angegeben werden."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "Die gewünschte Menge an Daten kann nicht eingelesen werden.\n"
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Anzahl der verlangten Durchläufe ist zu gering für %s (Minimum ist %u)."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/utils_pbkdf.c:148
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Gerät »%s« existiert nicht oder Zugriff verweigert.\n"
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Verlangte Speicherkosten sind zu gering für %s (Minimum sind %u Kilobyte)."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr ""
-"Das Loopback-Gerät kann nicht benutzt werden, da das Programm nicht mit Root-"
-"Rechten läuft.\n"
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Das verlangte Speicherkosten-Maximum ist zu hoch (maximal %d Kilobyte)."
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Kein freies Loopback-Gerät gefunden.\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Der verlangte PBKDF-Speicherbedarf darf nicht 0 sein."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
-"Anklemmen des Loopback-Geräts fehlgeschlagen (das Loopback-Gerät benötigt "
-"den »autoclear«-Schalter).\n"
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Die Anzahl der verlangten parallelen Threads für PBKDF darf nicht 0 sein."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "Im FIPS-Modus wird ausschließlich PBKDF2 unterstützt."
 
-#: lib/utils_device.c:484
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "PBKDF-Benchmark deaktiviert, aber Anzahl der Iterationen nicht angegeben."
+
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
-msgstr ""
-"Gerät »%s« kann nicht benutzt werden, da es bereits anderweitig benutzt "
-"wird.\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Inkompatible PBKDF2-Optionen (mit Hash-Algorithmus »%s«)."
 
-#: lib/utils_device.c:488
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Inkompatible PBKDF2-Optionen."
+
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Fehler beim Abrufen der Infos über Gerät »%s«.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Sperren abgebrochen. Der Sperrpfad %s/%s ist unbenutzbar (kein Verzeichnis oder existiert nicht)."
 
-#: lib/utils_device.c:494
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr ""
-"Der angeforderte Offset ist jenseits der wirklichen Größe des Geräts »%s«.\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "WARNUNG: Zugriffssperren-Verzeichnis %s/%s ist nicht vorhanden!\n"
 
-#: lib/utils_device.c:502
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Gerät »%s« hat die Größe 0.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Sperren abgebrochen. Der Sperrpfad %s/%s ist unbenutzbar (%s ist kein Verzeichnis)."
 
-#: lib/utils_device.c:513
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Fehler beim Springen zum Gerät-Offset."
+
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Gerät »%s« ist zu klein.\n"
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Fehler beim gründlichen Löschen des Geräts, an Offset %<PRIu64>."
 
-#: lib/luks1/keyencryption.c:37
+#: lib/luks1/keyencryption.c:39
 #, c-format
 msgid ""
 "Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 "Einrichten der dm-crypt-Schlüsselzuordnung für Gerät »%s« fehlgeschlagen.\n"
 "Stellen Sie sicher, dass der Kernel die Verschlüsselung »%s« unterstützt.\n"
-"(Sehen Sie im System-Log nach, ob sich dort Hinweise finden.)\n"
+"(Sehen Sie im System-Log nach, ob sich dort Hinweise finden.)"
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Schlüsselgröße im XTS-Modus muss entweder 256 oder 512 Bits sein."
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "Schlüsselgröße im XTS-Modus muss entweder 256 oder 512 Bits sein.\n"
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "Verschlüsselungsverfahren sollte im Format [Verfahren]-[Modus]-[IV] sein."
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
 #, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Fehler beim Schreiben auf Gerät »%s«, Zugriff verweigert.\n"
+msgid "Cannot write to device %s, permission denied."
+msgstr "Fehler beim Schreiben auf Gerät »%s«, Zugriff verweigert."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Fehler beim Öffnen des temporären Schlüsselspeichergeräts."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Fehler beim Zugriff auf das temporäre Schlüsselspeichergerät."
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr "Fehler beim Öffnen des temporären Schlüsselspeichergeräts.\n"
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "E/A-Fehler beim Verschlüsseln des Schlüsselfachs."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr "Fehler beim Zugriff auf das temporäre Schlüsselspeichergerät.\n"
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Fehler beim Öffnen des Geräts »%s«."
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "E/A-Fehler beim Verschlüsseln des Schlüsselfachs.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "E/A-Fehler beim Entschlüsseln des Schlüsselfachs."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "E/A-Fehler beim Entschlüsseln des Schlüsselfachs.\n"
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Gerät »%s« ist zu klein. (LUKS1 benötigt mindestens %<PRIu64> Bytes.)"
 
-#: lib/luks1/keymanage.c:90
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr "Gerät »%s« ist zu klein. (LUKS benötigt mindestens %<PRIu64> Bytes.)\n"
+msgid "LUKS keyslot %u is invalid."
+msgstr "LUKS-Schlüsselfach %u ist ungültig."
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "Gerät »%s« ist kein gültiges LUKS-Gerät.\n"
+msgid "Device %s is not a valid LUKS device."
+msgstr "Gerät »%s« ist kein gültiges LUKS-Gerät."
 
-#: lib/luks1/keymanage.c:198
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Angeforderte Header-Backupdatei »%s« existiert bereits.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Angeforderte Header-Backupdatei »%s« existiert bereits."
 
-#: lib/luks1/keymanage.c:200
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Fehler beim Anlegen der Header-Backupdatei »%s«.\n"
+msgid "Cannot create header backup file %s."
+msgstr "Fehler beim Anlegen der Header-Backupdatei »%s«."
 
-#: lib/luks1/keymanage.c:205
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Fehler beim Speichern der Header-Backupdatei »%s«.\n"
+msgid "Cannot write header backup file %s."
+msgstr "Fehler beim Speichern der Header-Backupdatei »%s«."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Backupdatei enthält keinen gültigen LUKS-Header.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Backupdatei enthält keinen gültigen LUKS-Header."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Fehler beim Öffnen der Header-Backupdatei »%s«.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Fehler beim Öffnen der Header-Backupdatei »%s«."
 
-#: lib/luks1/keymanage.c:258
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Fehler beim Einlesen der Header-Backupdatei »%s«.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Fehler beim Einlesen der Header-Backupdatei »%s«."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Unterschiedlicher Offset oder Schlüsselgröße zwischen Gerät und Backup. "
-"Wiederherstellung fehlgeschlagen.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Unterschiedlicher Offset oder Schlüsselgröße zwischen Gerät und Backup. Wiederherstellung fehlgeschlagen."
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Gerät »%s« %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"enthält keinen LUKS-Header. Das Ersetzen des Headers kann Daten auf dem "
-"Gerät zerstören."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "enthält keinen LUKS-Header. Das Ersetzen des Headers kann Daten auf dem Gerät zerstören."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"enthält bereits einen LUKS-Header. Das Ersetzen des Headers wird bestehende "
-"Schlüsselfächer zerstören."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "enthält bereits einen LUKS-Header. Das Ersetzen des Headers wird bestehende Schlüsselfächer zerstören."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
@@ -543,586 +867,1470 @@ msgstr ""
 "\n"
 "WARNUNG: Der Header des echten Geräts hat eine andere UUID als das Backup!"
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Fehler beim Öffnen des Geräts »%s«.\n"
-
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr "Ungewöhnliche Schlüsselgröße, manuelles Reparieren erforderlich.\n"
-
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
-"Ungewöhnliche Ausrichtung der Schlüsselfächer, manuelles Reparieren "
-"erforderlich.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Ungewöhnliche Schlüsselgröße, manuelles Reparieren erforderlich."
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Schlüsselfächer werden repariert.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Ungewöhnliche Ausrichtung der Schlüsselfächer, manuelles Reparieren erforderlich."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Fehler beim Reparieren der Schlüsselfächer."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Schlüsselfächer werden repariert."
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Schlüsselfach %i: Offset repariert (%u -> %u).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Schlüsselfach %i: Offset repariert (%u -> %u)."
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Schlüsselfach %i: Streifen repariert (%u -> %u).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Schlüsselfach %i: Streifen repariert (%u -> %u)."
 
 # XXX
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Schlüsselfach %i: schwindlerische Partitions-Signatur.\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Schlüsselfach %i: schwindlerische Partitions-Signatur."
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Schlüsselfach %i: Salt gelöscht.\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Schlüsselfach %i: Salt gelöscht."
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "LUKS-Header wird auf den Datenträger geschrieben.\n"
-
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Nicht unterstützte LUKS-Version %d.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "LUKS-Header wird auf den Datenträger geschrieben."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "Verlangter LUKS-Hash »%s« wird nicht unterstützt.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Fehler beim Reparieren."
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "LUKS-Schlüsselfach %u ist ungültig.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Verlangter LUKS-Hash »%s« wird nicht unterstützt."
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "Keine bekannten Probleme im LUKS-Header erkannt.\n"
-
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Fehler beim Aktualisieren des LUKS-Headers auf Gerät »%s«.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Keine bekannten Probleme im LUKS-Header erkannt."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Fehler beim Neueinlesen des LUKS-Headers nach dem Aktualisieren auf Gerät "
-"»%s«.\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Fehler beim Aktualisieren des LUKS-Headers auf Gerät »%s«."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keymanage.c:668
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"Daten-Offset für separaten LUKS-Header muss entweder 0 sein oder mehr als "
-"die Headergröße (%d Sektoren).\n"
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Fehler beim Neueinlesen des LUKS-Headers nach dem Aktualisieren auf Gerät »%s«."
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Falsches LUKS-UUID-Format angegeben.\n"
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Daten-Offset für LUKS-Header muss entweder 0 sein oder mehr als die Headergröße."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-"LUKS-Header kann nicht angelegt werden: Fehler beim Einlesen des zufälligen "
-"Salts.\n"
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Falsches LUKS-UUID-Format angegeben."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Inkompatible PBKDF2-Optionen (mit Hash-Algorithmus »%s«).\n"
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "LUKS-Header kann nicht angelegt werden: Fehler beim Einlesen des zufälligen Salts."
 
 # XXX
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"LUKS-Header kann nicht angelegt werden: Fehler beim Hashen des Headers (mit "
-"Hash-Algorithmus »%s«).\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "LUKS-Header kann nicht angelegt werden: Fehler beim Hashen des Headers (mit Hash-Algorithmus »%s«)."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "Schlüsselfach %d aktiv, löschen Sie es erst.\n"
+msgid "Key slot %d active, purge first."
+msgstr "Schlüsselfach %d aktiv, löschen Sie es erst."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Material für Schlüsselfach %d enthält zu wenige Streifen. Manipulation des "
-"Headers?\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Material für Schlüsselfach %d enthält zu wenige Streifen. Manipulation des Headers?"
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:990
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Schlüsselfach %d entsperrt.\n"
-
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Kein Schlüssel mit dieser Passphrase verfügbar.\n"
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Schlüsselfach kann nicht geöffnet werden (mit Hash-Algorithmus »%s«)."
 
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr ""
-"Schlüsselfach %d ist ungültig, bitte wählen Sie ein Schlüsselfach zwischen 0 "
-"und %d.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Schlüsselfach %d ist ungültig, bitte wählen Sie ein Schlüsselfach zwischen 0 und %d."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Gerät »%s« kann nicht ausgelöscht werden.\n"
+msgid "Cannot wipe device %s."
+msgstr "Gerät »%s« kann nicht ausgelöscht werden."
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr "Noch nicht unterstützte GPG-Schlüsseldatei erkannt.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Noch nicht unterstützte verschlüsselte GPG-Schlüsseldatei erkannt."
 
 #: lib/loopaes/loopaes.c:147
 msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
-msgstr ""
-"Bitte benutzen Sie »gpg --decrypt <SCHLÜSSELDATEI> | cryptsetup --keyfile=- "
-"…«\n"
+msgstr "Bitte benutzen Sie »gpg --decrypt <SCHLÜSSELDATEI> | cryptsetup --keyfile=- …«\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Inkompatible Loop-AES-Schlüsseldatei erkannt.\n"
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Inkompatible Loop-AES-Schlüsseldatei erkannt."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr "Kernel unterstützt Loop-AES-kompatibles Mapping nicht.\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Kernel unterstützt Loop-AES-kompatibles Mapping nicht."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Fehler beim Einlesen der Schlüsseldatei »%s«.\n"
+msgid "Error reading keyfile %s."
+msgstr "Fehler beim Einlesen der Schlüsseldatei »%s«."
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/tcrypt/tcrypt.c:554
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr "Maximale Länge der TCRYPT-Passphrase (%d) überschritten.\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Maximale Länge der TCRYPT-Passphrase (%zu) überschritten."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr ""
-"Der Hash-Algorithmus »%s« für PBKDF2 wird nicht unterstützt, überspringe "
-"diesen Teil.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "Der Hash-Algorithmus »%s« für PBKDF2 wird nicht unterstützt, überspringe diesen Teil."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr "Die benötigte Crypto-Kernel-Schnittstelle ist nicht verfügbar.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Die benötigte Crypto-Kernel-Schnittstelle ist nicht verfügbar."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr ""
-"Stellen Sie sicher, dass das Kernelmodul »algif_skcipher« geladen ist.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Stellen Sie sicher, dass das Kernelmodul »algif_skcipher« geladen ist."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "Aktivierung wird für die Sektorengröße %d nicht unterstützt.\n"
+msgid "Activation is not supported for %d sector size."
+msgstr "Aktivierung wird für die Sektorengröße %d nicht unterstützt."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr ""
-"Der Kernel unterstützt die Aktivierung für diesen TCRYPT-Legacymodus nicht.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Der Kernel unterstützt die Aktivierung für diesen TCRYPT-Legacymodus nicht."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "TCRYPT-Systemverschlüsselung für Partition »%s« wird aktiviert.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "TCRYPT-Systemverschlüsselung für Partition »%s« wird aktiviert."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr "Kernel unterstützt TCRYPT-kompatibles Mapping nicht.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Kernel unterstützt TCRYPT-kompatibles Mapping nicht."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Diese Funktionalität braucht einen geladenen TCRYPT-Header."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "Unerwartete Art »%u« des Metadaten-Eintrags beim Parsen des unterstützten Volume Master Keys gefunden."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Ungültige Zeichenkette beim Parsen des Volume Master Key gefunden."
+
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Verity-Gerät »%s« benutzt keinen Header auf dem Datenträger.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Unerwartete Zeichenkette »%s« beim Parsen des Volume Master Key gefunden."
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:399
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Gerät »%s« ist kein gültiges VERITY-Gerät.\n"
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "Unerwarteter Metadaten-Eintrag %u beim Einlesen des unterstützten Volume Master Key gefunden."
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:479
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "Nicht unterstützte VERITY-Version %d.\n"
+msgid "Failed to read BITLK signature from %s."
+msgstr "Fehler beim Lesen der BITLK-Signatur von »%s«."
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "VERITY-Header verfälscht.\n"
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "BITLK Version 1 wird derzeit nicht unterstützt."
 
-#: lib/verity/verity.c:166
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Ungültige oder unbekannte Bootsignatur für BITLK-Gerät."
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Ungültige oder unbekannte Signatur für BITLK-Gerät."
+
+#: lib/bitlk/bitlk.c:510
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Falsches VERITY-UUID-Format über Gerät »%s« angegeben.\n"
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Nicht unterstützte Sektorengröße %<PRIu16>."
 
-#: lib/verity/verity.c:196
+#: lib/bitlk/bitlk.c:518
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Fehler beim Aktualisieren des VERITY-Headers auf Gerät »%s«.\n"
+msgid "Failed to read BITLK header from %s."
+msgstr "Fehler beim Lesen des BITLK-Headers von »%s«."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "Kernel unterstützt dm-verity-Zuordnung nicht.\n"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Fehler beim Schreiben der BITLK-FVE-Metadaten von »%s«."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr ""
-"Verity-Gerät hat eine Verfälschung nach der Aktivierung festgestellt.\n"
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Unbekannte oder nicht unterstützte Verschlüsselungsart."
 
-#: lib/verity/verity_hash.c:59
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "Zusätzlicher Platz an Position %<PRIu64> ist nicht ausgenullt.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Fehler beim Lesen der BITLK-Metadaten von »%s«."
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Überlauf beim Geräte-Offset.\n"
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Diese Operation wird nicht unterstützt."
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "Fehler beim Verifizieren an Position %<PRIu64>.\n"
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Falsche Schlüsselgröße."
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Ungültige Größenparameter für Verity-Gerät.\n"
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Dieses BITLK-Gerät ist in einem nicht unterstützten Zustand und kann daher nicht aktiviert werden."
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Zu viele Ebenen für Verity-Laufwerk.\n"
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "BITLK-Geräte der Art »%s« können nicht aktiviert werden."
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "Fehler beim Verifizieren des Datenbereichs.\n"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Aktivieren eines teilweise entschlüsselten BITLK-Geräts wird nicht unterstützt."
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "Fehler beim Verifizieren des Root-Hashes.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Gerät kann nicht aktiviert werden, dem Kernelmodul dm-crypt fehlt die Unterstützung für BITLK-IV."
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr "E/A-Fehler beim Anlegen des Hash-Bereiches.\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Gerät kann nicht aktiviert werden, da dem Kernelmodul dm-crypt die Unterstützung für BITLK-Elephant-Verschleierer fehlt."
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "Fehler beim Anlegen des Hash-Bereiches.\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Verity-Gerät »%s« benutzt keinen Header auf dem Datenträger."
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity.c:90
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-"WARNUNG: Kernel kann das Gerät nicht aktivieren, wenn die Datenblockgröße "
-"die Seitengröße (%u) übersteigt.\n"
+msgid "Device %s is not a valid VERITY device."
+msgstr "Gerät »%s« ist kein gültiges VERITY-Gerät."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr "Passphrase-Verifikation ist nur auf Terminal-Eingaben möglich.\n"
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Nicht unterstützte VERITY-Version %d."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Kein bekanntes Verschlüsselungsmuster entdeckt.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "VERITY-Header verfälscht."
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
-msgstr ""
-"WARNUNG: Der Parameter --hash wird im Plain-Modus ignoriert, wenn eine "
-"Schlüsseldatei angegeben ist.\n"
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Falsches VERITY-UUID-Format über Gerät »%s« angegeben."
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
-msgstr ""
-"WARNUNG: Die Option --keyfile-size wird ignoriert, da die Lesegröße die "
-"gleiche ist wie die Verschlüsselungsschlüsselgröße ist.\n"
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Fehler beim Aktualisieren des VERITY-Headers auf Gerät »%s«."
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "Die Option »--key-file« muss angegeben werden.\n"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "Verifikation der Stammhash-Signatur wird nicht unterstützt."
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Kein Geräte-Header mit dieser Passphrase gefunden.\n"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Fehler können mit einem FEC-Gerät nicht repariert werden."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
-msgstr ""
-"Der Headerdump zusammen mit dem Laufwerksschlüssel sind\n"
-"sensible Daten, mit deren Hilfe man ohne Passphrase auf die\n"
-"verschlüsselte Partition zugreifen kann. Dieser Dump sollte\n"
-"daher ausschließlich an einem sicheren Ort und verschlüsselt\n"
-"aufbewahrt werden."
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "%u reparierbare Fehler mit FEC-Gerät gefunden."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Das Ergebnis des Benchmarks ist nicht zuverlässig.\n"
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Kernel unterstützt dm-verity-Zuordnung nicht."
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr ""
-"# Die Tests sind nur annähernd genau, da sie nicht auf den Datenträger "
-"zugreifen.\n"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Kernel unterstützt Signatur-Option für dm-verity nicht."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "# Algorithmus | Schlüssel | Verschlüsselung | Entschlüsselung\n"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Verity-Gerät hat eine Verfälschung nach der Aktivierung festgestellt."
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Verschlüsselung »%s« ist nicht verfügbar.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Zusätzlicher Platz an Position %<PRIu64> ist nicht ausgenullt."
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "N/A"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Überlauf beim Geräte-Offset."
 
-#: src/cryptsetup.c:639
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Fehler beim Einlesen der Schlüsseldatei »%s«.\n"
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Fehler beim Verifizieren an Position %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Ungültige Größenparameter für Verity-Gerät."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Überlauf des Hashbereichs."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Fehler beim Verifizieren des Datenbereichs."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Fehler beim Verifizieren des Root-Hashes."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "E/A-Fehler beim Anlegen des Hash-Bereiches."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Fehler beim Anlegen des Hash-Bereiches."
 
-#: src/cryptsetup.c:643
+#: lib/verity/verity_hash.c:433
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Fehler beim Einlesen von %d Bytes aus der Schlüsseldatei »%s«.\n"
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "WARNUNG: Kernel kann das Gerät nicht aktivieren, wenn die Datenblockgröße die Seitengröße (%u) übersteigt."
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Wirklich versuchen, den LUKS-Geräteheader wiederherzustellen?"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Fehler beim Reservieren des RS-Kontexts."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Fehler beim Reservieren des Puffers."
+
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Hiermit werden die Daten auf »%s« unwiderruflich überschrieben."
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Fehler beim Lesen des RS-Blocks %<PRIu64>, Byte %d."
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Fehler beim Lesen der Parität für RS-Block %<PRIu64>."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "Speicherproblem in action_luksFormat"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Fehler beim Reparieren der Parität für RS-Block %<PRIu64>."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity_fec.c:188
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Das Gerät »%s« kann nicht als Datenträger-Header benutzt werden.\n"
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Fehler beim Schreiben der Parität für RS-Block %<PRIu64>."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr "Verringerter Datenoffset ist nur für separaten LUKS-Header erlaubt.\n"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Blockgrößen müssen für FEC zusammen passen."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Ungültige Anzahl von Paritätsbytes."
+
+#: lib/verity/verity_fec.c:265
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Schlüsselfach %d zum Löschen ausgewählt.\n"
+msgid "Failed to determine size for device %s."
+msgstr "Fehler beim Ermitteln der Größe von Gerät »%s«."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Kernel unterstützt dm-integrity-Zuordnung nicht."
 
-#: src/cryptsetup.c:884
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Kernel unterstützt feste Ausrichtung der Metadaten für dm-integrity nicht."
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr ""
-"Schlüssel %d ist nicht aktiv und kann daher nicht ausgelöscht werden.\n"
+msgid "Failed to acquire write lock on device %s."
+msgstr "Fehler beim exklusiven Schreibzugriff auf Gerät »%s«."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Es wurde ein Versuch erkannt, die LUKS2-Metadaten nebenläufig zu ändern. Die Operation wird abgebrochen."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
 msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
-"Dies ist das letzte Schlüsselfach. Wenn Sie diesen Schlüssel löschen, wird "
-"das Gerät unbrauchbar."
-
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Geben Sie irgendeine verbleibende Passphrase ein: "
+"Gerät enthält mehrdeutige Signaturen, LUKS2 kann nicht automatisch wiederhergestellt werden.\n"
+"Bitte führen Sie \"cryptsetup repair\" zur Wiederherstellung aus."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Geben Sie die zu löschende Passphrase ein: "
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Verlangter Daten-Offset ist zu klein."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Geben Sie irgendeine bestehende Passphrase ein: "
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "WARNING: Der Schlüsselfach-Bereich (%<PRIu64> Bytes) ist sehr klein, die LUKS2-Schlüsselfachanzahl ist sehr begrenzt.\n"
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Geben Sie die zu ändernde Passphrase ein: "
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Fehler beim Zugriff auf die Lesesperre für das Gerät »%s«."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Geben Sie die neue Passphrase ein: "
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Verbotene LUKS2-Anforderungen in Backup »%s« entdeckt."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr "Die Operation »isLuks« unterstützt nur genau ein Geräte-Argument.\n"
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Unterschiedliche Datenoffsets auf Gerät und Backup. Wiederherstellung fehlgeschlagen."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Option »--header-backup-file« muss angegeben werden.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Unterschiedliche Größe der Binärheader mit Schlüsselfach-Bereichen zwischen Gerät und Backup. Wiederherstellung fehlgeschlagen."
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:1221
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Unbekannte Art »%s« des Metadaten-Geräts.\n"
+msgid "Device %s %s%s%s%s"
+msgstr "Gerät »%s« %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "enthält keinen LUKS2-Header. Das Ersetzen des Headers kann Daten auf dem Gerät zerstören."
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "enthält bereits einen LUKS2-Header. Das Ersetzen des Headers wird bestehende Schlüsselfächer zerstören."
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"Dieser Befehl benötigt den Gerätenamen und den zugeordneten Namen als "
-"Argumente.\n"
+"\n"
+"WARNUNG: Unbekannte LUKS2-Anforderungen im echten Geräteheader entdeckt!\n"
+"Das Ersetzen des Headers mit dem Backup kann zu Datenverlust auf dem Gerät führen!"
 
-#: src/cryptsetup.c:1326
-#, c-format
+#: lib/luks2/luks2_json_metadata.c:1227
 msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
 msgstr ""
-"Diese Operation wird alle Schlüsselfächer auf Gerät »%s« löschen.\n"
-"Dadurch wird das Gerät unbrauchbar."
+"\n"
+"WARNUNG: Unvollendete Offline-Wiederverschlüsselung auf dem Gerät entdeckt!\n"
+"Das Ersetzen des Headers mit dem Backup kann zu Datenverlust auf dem Gerät führen."
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<Gerät> [--type <Art>] [<Name>]"
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Unbekannter Schalter »%s« wird ignoriert."
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "Gerät als Zuordnung <Name> öffnen"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Fehlender Schlüssel für dm-crypt-Segment %u"
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<Name>"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Fehler beim Festlegen des »dm-crypt«-Segments."
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "Gerät schließen (Zuordnung entfernen)"
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Fehler beim Festlegen des »dm-linear«-Segments."
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "Größe des aktiven Geräts ändern"
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Nicht unterstützte Konfiguration für Geräteintegrität."
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "Gerätestatus anzeigen"
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Wiederverschlüsselung läuft gerade. Das Gerät kann nicht deaktiviert werden."
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "Verschlüsselungsalgorithmus benchmarken"
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Das stillgelegte Gerät »%s« mit dm-error-Ziel konnte nicht in den Fehlerzustand gesetzt werden."
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<Gerät>"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Fehler beim Lesen der LUKS2-Anforderungen."
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Unerfüllte LUKS2-Anforderungen entdeckt."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Diese Operation kann nicht mit einem Gerät durchgeführt werden, das für Altlasten-Wiederverschlüsselung markiert ist. Wird abgebrochen."
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Diese Operation kann nicht mit einem Gerät durchgeführt werden, das für LUKS2-Wiederverschlüsselung markiert ist. Wird abgebrochen."
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Nicht genügend Speicher, um ein Schlüsselfach zu öffnen."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Fehler beim Öffnen des Schlüsselfachs."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Der Algorithmus %s-%s kann nicht für Schlüsselfach-Verschlüsselung verwendet werden."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Nicht genug Speicherplatz für neues Schlüsselfach."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Fehler beim Prüfen des Zustands von Gerät mit der UUID %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Fehler beim Konvertieren des Headers mit zusätzlichen LUKSMETA-Metadaten."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Fehler beim Verschieben des Schlüsselfach-Bereichs. Nicht genug Speicherplatz."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Fehler beim Verschieben des Schlüsselfach-Bereichs. Bereich für die LUKS2-Schlüsselfächer ist zu klein."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Fehler beim Verschieben des Schlüsselfach-Bereichs."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Fehler beim Konvertieren in LUKS1-Format: Standardgröße für Verschlüsselungssektoren ist nicht 512 Bytes."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Fehler beim Konvertieren in LUKS1-Format: Schlüsselfach-Digeste sind nicht zu LUKS1 kompatibel."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Fehler beim Konvertieren in LUKS1-Format: Gerät verwendet eingepacktes Verschlüsselungsverfahren %s."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Fehler beim Konvertieren in LUKS1-Format: LUKS2-Header enthält %u Token."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Fehler beim Konvertieren in LUKS1-Format: Schlüsselfach %u ist in ungültigem Zustand."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Fehler beim Konvertieren in LUKS1-Format: Schlüsselfach %u (über Maximalfach) ist noch aktiv."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Fehler beim Konvertieren in LUKS1-Format: Schlüsselfach %u ist nicht zu LUKS1 kompatibel."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Die Größe der Hotzone muss ein Vielfaches der berechneten Zonenausrichtung (%zu Bytes) sein."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Gerätegröße muss ein Vielfaches der berechneten Zonenausrichtung (%zu Bytes) sein."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Nicht unterstützter Modus »%s« für Widerstandsfähigkeit"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Fehler beim Initialisieren der Umverpackung für den Speicher alter Segmente."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Fehler beim Initialisieren der Umverpackung für den Speicher neuer Segmente."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Fehler beim Lesen der Prüfsummen für die aktuelle Hotzone."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Fehler beim Lesen des Hotzone-Bereichs, der bei %<PRIu64> beginnt."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Fehler beim Entschlüsseln von Sektor %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Fehler beim Wiederherstellen von Sektor %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Die Größe der Quell- und Zielgeräte stimmt nicht überein. Quelle %<PRIu64>, Ziel: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Fehler beim Aktivieren des Hotzone-Geräts »%s«."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Fehler beim Aktivieren des Überlagerungsgeräts »%s« mit der tatsächlichen Ursprungstabelle."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Fehler beim Laden der neuen Zuordnung für Gerät »%s«."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Fehler beim Auffrischen des Gerätestapels für Wiederverschlüsselung."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Fehler beim Festlegen der neuen Bereichsgröße für Schlüsselfächer."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Datenverschiebung ist nicht an der angeforderten Verschlüsselungs-Sektorgröße (%<PRIu32> Bytes) ausgerichtet."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Datengerät ist nicht an der angeforderten Verschlüsselungs-Sektorgröße (%<PRIu32> Bytes) ausgerichtet."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Datenverschiebung (%<PRIu64> Sektoren) ist weniger als der zukünftige Datenoffset (%<PRIu64> Sektoren)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Fehler beim exklusiven Öffnen von »%s« (wird bereits anderweitig benutzt)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Das Gerät ist nicht für LUKS2-Wiederverschlüsselung markiert."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Fehler beim Laden des LUKS2-Wiederverschlüsselungs-Kontextes."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Fehler beim Einlesen des Wiederverschlüsselungs-Zustands."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Das Gerät befindet sich nicht in der Wiederverschlüsselung."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Der Wiederverschlüsselungs-Vorgang läuft bereits."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Fehler beim Zugriff auf die Schreibsperre für die Wiederverschlüsselung."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "Wiederverschlüsselung kann nicht fortgesetzt werden. Führen Sie zuerst die Wiederverschlüsselungs-Wiederherstellung durch."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Aktive Gerätegröße und angeforderte Wiederverschlüsselungsgröße passen nicht zusammen."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "Ungültige Gerätegröße wurde in den Wiederverschlüsselungsparametern angefordert."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Wiederverschlüsselung läuft bereits. Wiederherstellung ist nicht möglich."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "LUKS2-Wiederverschlüsselung ist in den Metadaten bereits initialisiert."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "LUKS2-Wiederverschlüsselung konnte in den Metadaten nicht initialisiert werden."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Fehler beim Festlegen der Gerätesegmente für die nächste Wiederverschlüsselungs-Hotzone."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Fehler beim Schreiben der Metadaten für robuste Wiederverschlüsselung."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Fehler beim Entschlüsseln."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Fehler beim Schreiben des Hotzone-Bereichs, der bei %<PRIu64> beginnt."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Fehler beim Synchronisieren von Daten."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Fehler beim Aktualisieren der Metadaten, nachdem die aktuelle Wiederverschlüsselungs-Hotzone beendet wurde."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Fehler beim Schreiben der LUKS2-Metadaten."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Fehler beim gründlichen Löschen der Backupsegmentdaten."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Fehler beim Deaktivieren der Wiederverschlüsselungsanforderung."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Schwerwiegender Fehler beim Wiederverschlüsseln des Blocks bei %<PRIu64>, %<PRIu64> Sektoren lang."
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Das Gerät nicht fortsetzen, außer es wird manuell durch das Fehlerziel ersetzt."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "Wiederverschlüsselung kann nicht fortgesetzt werden. Unerwarteter Zustand der Wiederverschlüsselung."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Fehlender oder ungültiger Wiederverschlüsselungs-Kontext."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Fehler beim Initialisieren des Gerätestapels für Wiederverschlüsselung."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Fehler beim Aktualisieren des Wiederverschlüsselungskontexts."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Kein freies Fach für Token."
+
+# upstream: period missing
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Fehler beim Erzeugen des eingebauten Tokens »%s«."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Passphrase-Verifikation ist nur auf Terminal-Eingaben möglich."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Verschlüsselungsparameter für Schlüsselfach wird nur für LUKS2-Geräte unterstützt."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Kein bekanntes Verschlüsselungsmuster entdeckt."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "WARNUNG: Der Parameter --hash wird im Plain-Modus ignoriert, wenn eine Schlüsseldatei angegeben ist.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "WARNUNG: Die Option --keyfile-size wird ignoriert, da die Lesegröße die gleiche ist wie die Verschlüsselungsschlüsselgröße ist.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Gerätesignaturen auf »%s« erkannt. Wenn Sie fortfahren, könnte das bestehende Daten beschädigen."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Vorgang abgebrochen.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Die Option »--key-file« muss angegeben werden."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "VeraCrypt-PIM eingeben: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Ungültiger PIM-Wert: Formatfehler."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Ungültiger PIM-Wert: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Ungültiger PIM-Wert: außerhalb des gültigen Bereichs."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Kein Geräte-Header mit dieser Passphrase gefunden."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Gerät »%s« ist kein gültiges BITLK-Gerät."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Der Headerdump zusammen mit dem Laufwerksschlüssel sind\n"
+"sensible Daten, mit deren Hilfe man ohne Passphrase auf die\n"
+"verschlüsselte Partition zugreifen kann. Dieser Dump sollte\n"
+"daher ausschließlich an einem sicheren Ort und verschlüsselt\n"
+"aufbewahrt werden."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Gerät »%s« ist noch aktiv und zum verzögerten Entfernen eingeplant.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Um die Größe von aktiven Geräten zu öndern, muss der Laufwerksschlüssel im Schlüsselbund sein, aber die Option --disable-keyring wurde angegeben."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Benchmark unterbrochen."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     (nicht zutreffend)\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u Iterationen pro Sekunde für %zu-Bit-Schlüssel\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s (nicht zutreffend)\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u Iterationen, %5u Speicher, %1u parallele Threads (CPUs) für %zu-Bit-Schlüssel (Zieldauer %u Millisekunden)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Das Ergebnis des Benchmarks ist nicht zuverlässig."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Die Tests sind nur annähernd genau, da sie nicht auf den Datenträger zugreifen.\n"
+
+# upstream: the following line should also be translated. This is because the long word "Schlüssel" for "Key" will break the layout, as well as "Verschlüsselung" for "Encryption".
+# To help the translators, you should provide an example for what goes into the %x placeholders, since I had to make an educated guess that the second %s would be exactly 4 characters long. This is an unnecessary burden for the translators.
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s   Algorithmus | Schlüssel | Verschlüsselung | Entschlüsselung\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Verschlüsselung »%s« (mit Schlüsselgröße %i Bits) ist nicht verfügbar."
+
+# upstream: the following line should also be translated. This is because the long word "Schlüssel" for "Key" will break the layout, as well as "Verschlüsselung" for "Encryption".
+# To help the translators, you should provide an example for what goes into the %x placeholders, since I had to make an educated guess that the second %s would be exactly 4 characters long. This is an unnecessary burden for the translators.
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#   Algorithmus | Schlüssel | Verschlüsselung | Entschlüsselung\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/A"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Es scheint, dass das Gerät keine Wiederherstellung der Wiederverschlüsselung braucht.\n"
+"Trotzdem fortsetzen?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Wirklich mit der Wiederherstellung der LUKS2-Wiederverschlüsselung fortfahren?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Geben Sie die Passphrase für die Wiederherstellung der Wiederverschlüsselung ein: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Wirklich versuchen, den LUKS-Geräteheader wiederherzustellen?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Gerät wird gesäubert, um die Prüfsumme für die Integrität zu initialisieren.\n"
+"Sie können diesen Vorgang mit Strg+C unterbrechen (der nicht gesäuberte Bereich des Geräts wird dann ungültige Prüfsummen haben).\n"
+
+# upstream: it is boring that I have to translate the newline at the end of each of these messages. Translating strings without newlines is much easier and faster. Since it is redundant anyway (all calls to log_err have a trailing newline), this newline should be written implicitly.
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Fehler beim Deaktivieren des temporären Geräts »%s«."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Die Integritätsoption kann nur für das LUKS2-Format verwendet werden."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Nicht unterstützte Optionen für Größe der LUKS-Metadaten."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Fehler beim Anlegen der Headerdatei »%s«."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Kein bekanntes Integritätsspezifikationsmuster entdeckt."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Das Gerät »%s« kann nicht als Datenträger-Header benutzt werden."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Hiermit werden die Daten auf »%s« unwiderruflich überschrieben."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Fehler beim Festlegen der PBKDF-Parameter."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Verringerter Datenoffset ist nur für separaten LUKS-Header erlaubt."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Die Größe des Laufwerksschlüssels erfordert Schlüsselfächer, bitte nutzen Sie dazu die Option »--key-size«."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Gerät aktiviert, aber die Schalter können nicht dauerhaft gespeichert werden."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Schlüsselfach %d zum Löschen ausgewählt."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Dies ist das letzte Schlüsselfach. Wenn Sie diesen Schlüssel löschen, wird das Gerät unbrauchbar."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Geben Sie irgendeine verbleibende Passphrase ein: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Vorgang abgebrochen, das Schlüsselfach wurde NICHT gesäubert.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Geben Sie die zu löschende Passphrase ein: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Geben Sie die neue Passphrase für das Schlüsselfach ein: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Geben Sie irgendeine bestehende Passphrase ein: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Geben Sie die zu ändernde Passphrase ein: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Geben Sie die neue Passphrase ein: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Geben Sie die Passphrase für das umzuwandelnde Schlüsselfach ein: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Die Operation »isLuks« unterstützt nur genau ein Geräte-Argument."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Der Headerdump zusammen mit dem Laufwerksschlüssel sind\n"
+"sensible Daten, mit deren Hilfe man ohne Passphrase auf die\n"
+"verschlüsselte Partition zugreifen kann. Dieser Dump sollte\n"
+"daher ausschließlich an einem sicheren Ort und verschlüsselt\n"
+"aufbewahrt werden."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Schlüsselfach %d enthält keinen unverbundenen Schlüssel."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Der Headerdump zusammen mit dem Laufwerksschlüssel sind sensible Daten.\n"
+"Dieser Dump sollte daher ausschließlich an einem sicheren Ort und\n"
+"verschlüsselt aufbewahrt werden."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Option »--header-backup-file« muss angegeben werden."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s ist kein von cryptsetup verwaltetes Gerät."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Die Geräteart »%s« kann nicht aufgefrischt werden"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Unbekannte Art »%s« des Metadaten-Geräts."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Dieser Befehl benötigt den Gerätenamen und den zugeordneten Namen als Argumente."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Diese Operation wird alle Schlüsselfächer auf Gerät »%s« löschen.\n"
+"Dadurch wird das Gerät unbrauchbar."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Vorgang abgebrochen, die Schlüsselfächer wurden NICHT gesäubert.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Invalid LUKS type, only luks1 and luks2 are supported."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Das Gerät hat bereits den Typ »%s«."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Diese Operation wird für »%s« ins Format »%s« umwandeln.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Vorgang abgebrochen, das Gerät wurde NICHT konvertiert.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Die Option --priority, --label oder --subsystem fehlt."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Token %d ist ungültig."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Token %d ist in Benutzung."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Fehler beim Hinzufügen des LUKS2-Schlüsselring-Tokens %d."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Token %d kann nicht dem Schlüsselfach %d zugeordnet werden."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Token %d wird gerade nicht verwendet."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Token konnte nicht aus der Datei importiert werden."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Auf Token %d kann nicht für den Export zugegriffen werden."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "Der Parameter --key-description ist Pflicht für die Aktion »token add«."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Die Aktion erfordert ein bestimmtes Token. Verwenden Sie den Parameter --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Ungültige Token-Operation »%s«."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Automatisch erkanntes aktives dm-Gerät »%s« für Datengerät »%s«.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Gerät »%s« ist kein Blockgerät.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Fehler bei der automatischen Erkennung von Gerät »%s«."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Es ist unklar, ob das Gerät »%s« aktiviert ist oder nicht.\n"
+"Möchten Sie wirklich mit der Wiederverschlüsselung im Offline-Modus fortfahren?\n"
+"Es kann zu Datenverlust kommen, wenn das Gerät gerade aktiviert ist.\n"
+"Um die Wiederverschlüsselung im Online-Modus durchzuführen, verwenden Sie stattdessen den Parameter --active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Ungültige LUKS-Geräteart."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Verschlüsselung ohne separaten Kopfbereich (--header) ist nur möglich, wenn die Größe des Hauptgeräts reduziert wird (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Der angeforderte Datenoffset darf maximal die Hälfte des Parameters --reduce-device-size betragen."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Der Wert von --reduce-device-size wird auf das Doppelte von --offset %<PRIu64> (in Sektoren) angepasst.\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Verschlüsselung wird nur für das LUKS2-Format unterstützt."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "LUKS-Gerät auf »%s« erkannt. Möchten Sie dieses LUKS-Gerät erneut verschlüsseln?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Temporäre Headerdatei »%s« existiert bereits. Wird abgebrochen."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Fehler beim Anlegen der temporären Headerdatei »%s«."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s ist jetzt aktiv und bereit für die Onlineverschlüsselung.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Nicht genügend freie Schlüsselfächer für Wiederverschlüsselung."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Schlüsseldatei kann nur mit --key-slot oder mit genau einem aktiven Schlüsselfach benutzt werden."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Geben Sie die Passphrase für Schlüsselfach %d ein: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Geben Sie die Passphrase für Schlüsselfach %u ein: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Dieser Befehl benötigt den Gerätenamen als Argument."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "Derzeit wird nur das LUKS2-Format unterstützt. Bitte verwenden Sie das Werkzeug cryptsetup-reencrypt für LUKS1."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Veraltete Offline-Wiederverschlüsselung wird gerade durchgeführt. Verwenden Sie das Hilfsprogramm cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Wiederverschlüsselung von Geräten mit Integritätsprofil wird nicht unterstützt."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "Die LUKS2-Wiederverschlüsselung wurde bereits begonnen. Die Operation wird abgebrochen."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "LUKS2-Gerät wird derzeit nicht wiederverschlüsselt."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<Gerät> [--type <Art>] [<Name>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "Gerät als <Name> öffnen"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<Name>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "Gerät schließen (Zuordnung entfernen)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "Größe des aktiven Geräts ändern"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "Gerätestatus anzeigen"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <Algorithmus>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "Verschlüsselungsalgorithmus benchmarken"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<Gerät>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
 msgstr "Versuchen, die Metadaten auf dem Datenträger zu reparieren"
 
-#: src/cryptsetup.c:1366
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "LUKS2-Gerät wiederverschlüsseln"
+
+#: src/cryptsetup.c:3353
 msgid "erase all keyslots (remove encryption key)"
 msgstr "Alle Schlüsselfächer löschen (Verschlüsselungsschlüssel entfernen)"
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "Zwischen den Formaten LUKS und LUKS2 umwandeln"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "Permanente Konfigurationsoptionen für LUKS2 festlegen"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
 msgid "<device> [<new key file>]"
 msgstr "<Gerät> [<neue Schlüsseldatei>]"
 
-#: src/cryptsetup.c:1367
+#: src/cryptsetup.c:3356
 msgid "formats a LUKS device"
 msgstr "Ein LUKS-Gerät formatieren"
 
-#: src/cryptsetup.c:1368
+#: src/cryptsetup.c:3357
 msgid "add key to LUKS device"
 msgstr "Schlüssel zu LUKS-Gerät hinzufügen"
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
 msgid "<device> [<key file>]"
 msgstr "<Gerät> [<Schlüsseldatei>]"
 
-#: src/cryptsetup.c:1369
+#: src/cryptsetup.c:3358
 msgid "removes supplied key or key file from LUKS device"
 msgstr "Entfernt bereitgestellten Schlüssel oder Schlüsseldatei vom LUKS-Gerät"
 
-#: src/cryptsetup.c:1370
+#: src/cryptsetup.c:3359
 msgid "changes supplied key or key file of LUKS device"
-msgstr ""
-"Ändert den angegebenen Schlüssel oder die Schlüsseldatei des LUKS-Geräts"
+msgstr "Ändert den angegebenen Schlüssel oder die Schlüsseldatei des LUKS-Geräts"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "Wandelt einen Schlüssel in neue PBKDF-Parameter um"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3361
 msgid "<device> <key slot>"
 msgstr "<Gerät> <Schlüsselfach>"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3361
 msgid "wipes key with number <key slot> from LUKS device"
 msgstr "Löscht Schlüssel mit Nummer <Schlüsselfach> vom LUKS-Gerät"
 
-#: src/cryptsetup.c:1372
+#: src/cryptsetup.c:3362
 msgid "print UUID of LUKS device"
 msgstr "UUID des LUKS-Geräts ausgeben"
 
-#: src/cryptsetup.c:1373
+#: src/cryptsetup.c:3363
 msgid "tests <device> for LUKS partition header"
 msgstr "Testet <Gerät> auf Header einer LUKS-Partition"
 
-#: src/cryptsetup.c:1374
+#: src/cryptsetup.c:3364
 msgid "dump LUKS partition information"
 msgstr "LUKS-Partitionsinformationen ausgeben"
 
-#: src/cryptsetup.c:1375
+#: src/cryptsetup.c:3365
 msgid "dump TCRYPT device information"
 msgstr "TCRYPT-Geräteinformationen ausgeben"
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"LUKS-Gerät in Ruhezustand versetzen und alle Schlüssel auslöschen (alle IOs "
-"werden eingefroren)."
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "BITLK-Geräteinformationen ausgeben"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "LUKS-Gerät in Ruhezustand versetzen und alle Schlüssel auslöschen (alle IOs werden eingefroren)"
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "LUKS-Gerät aus dem Ruhezustand aufwecken."
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "LUKS-Gerät aus dem Ruhezustand aufwecken"
 
-#: src/cryptsetup.c:1378
+#: src/cryptsetup.c:3369
 msgid "Backup LUKS device header and keyslots"
 msgstr "Header und Schlüsselfächer eines LUKS-Geräts sichern"
 
-#: src/cryptsetup.c:1379
+#: src/cryptsetup.c:3370
 msgid "Restore LUKS device header and keyslots"
 msgstr "Header und Schlüsselfächer eines LUKS-Geräts wiederherstellen"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <Gerät>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "LUKS2-Token manipulieren"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
 msgid ""
 "\n"
 "<action> is one of:\n"
@@ -1130,19 +2338,19 @@ msgstr ""
 "\n"
 "<Aktion> ist eine von:\n"
 
-#: src/cryptsetup.c:1402
+#: src/cryptsetup.c:3395
 msgid ""
 "\n"
 "You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 msgstr ""
 "\n"
 "Sie können auch die alten <Aktion>-Aliase benutzen:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, lookaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 
-#: src/cryptsetup.c:1406
+#: src/cryptsetup.c:3399
 #, c-format
 msgid ""
 "\n"
@@ -1155,418 +2363,749 @@ msgstr ""
 "<Name> ist das Gerät, das unter »%s« erzeugt wird\n"
 "<Gerät> ist das verschlüsselte Gerät\n"
 "<Schlüsselfach> ist die Nummer des zu verändernden LUKS-Schlüsselfachs\n"
-"<Schlüsseldatei> optionale Schlüsseldatei für den neuen Schlüssel der "
-"»luksAddKey«-Aktion\n"
+"<Schlüsseldatei> optionale Schlüsseldatei für den neuen Schlüssel der »luksAddKey«-Aktion\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Vorgegebenes festeingebautes Metadatenformat ist %s (für luksFormat-Aktion).\n"
 
-#: src/cryptsetup.c:1413
+#: src/cryptsetup.c:3411
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
 msgstr ""
 "\n"
-"Vorgabewerte für Schlüssel und Passphrasen:\n"
-"\tMaximale Größe der Schlüsseldatei: %dkB, Maximale Länge der interaktiven "
-"Passphrase: %d Zeichen\n"
-"Vorgabe für die Durchlaufzeit für PBKDF2 mit LUKS: %d Millisekunden\n"
+"Werkseinstellungen für Schlüssel und Passphrasen:\n"
+"\tMaximale Größe der Schlüsseldatei: %d kB, Maximale Länge der interaktiven Passphrase: %d Zeichen\n"
+"Vorgabe-PBKDF für LUKS1: %s, Durchlaufzeit: %d Millisekunden\n"
+"Vorgabe-PBKDF für LUKS2: %s\n"
+"\tIterationszeit: %d, benötigter Speicher: %d kB, parallele Threads: %d\n"
 
-#: src/cryptsetup.c:1420
+#: src/cryptsetup.c:3422
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in device cipher parameters:\n"
 "\tloop-AES: %s, Key %d bits\n"
 "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
 msgstr ""
 "\n"
 "Standard-Verschlüsselungsparameter:\n"
 "\tLoop-AES: %s, Schlüssel %d Bits\n"
 "\tplain: %s, Schlüssel: %d Bits, Passphrase-Hashen: %s\n"
-"\tLUKS1: %s, Schlüssel: %d Bits, LUKS-Header-Hashen: %s, "
-"Zufallszahlengenerator: %s\n"
+"\tLUKS: %s, Schlüssel: %d Bits, LUKS-Header-Hashen: %s, Zufallszahlengenerator: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: Standard-Schlüsselgröße mit XTS-Modus (zwei interne Schlüssel) wird verdoppelt.\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
 #, c-format
 msgid "%s: requires %s as arguments"
 msgstr "%s: Benötigt %s als Argumente"
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
 msgid "Show this help message"
 msgstr "Diese Hilfe anzeigen"
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
 msgid "Display brief usage"
 msgstr "Kurze Aufrufsyntax anzeigen"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Hilfe-Optionen:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
 msgid "Print package version"
 msgstr "Paketversion ausgeben"
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Hilfe-Optionen:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
 msgid "Shows more detailed error messages"
 msgstr "Zeigt detailliertere Fehlermeldungen an"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
 msgid "Show debug messages"
 msgstr "Zeigt Debugging-Meldungen an"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Debugging-Meldungen anzeigen, inclusive JSON-Metadaten"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
 msgid "The cipher used to encrypt the disk (see /proc/crypto)"
-msgstr ""
-"Der Algorithmus zum Verschlüsseln des Datenträgers (siehe /proc/crypto)"
+msgstr "Der Algorithmus zum Verschlüsseln des Datenträgers (siehe /proc/crypto)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
 msgid "The hash used to create the encryption key from the passphrase"
-msgstr ""
-"Das Hashverfahren, um den Verschlüsselungsschlüssel aus der Passphrase zu "
-"erzeugen"
+msgstr "Das Hashverfahren, um den Verschlüsselungsschlüssel aus der Passphrase zu erzeugen"
 
-#: src/cryptsetup.c:1481
+#: src/cryptsetup.c:3492
 msgid "Verifies the passphrase by asking for it twice"
 msgstr "Verifiziert die Passphrase durch doppeltes Nachfragen"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
-msgstr "Schlüssel aus einer Datei lesen."
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Schlüssel aus einer Datei lesen"
 
-#: src/cryptsetup.c:1483
+#: src/cryptsetup.c:3494
 msgid "Read the volume (master) key from file."
 msgstr "Laufwerks-(Master-)Schlüssel aus Datei lesen."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr ""
-"Laufwerks-(Master-)schlüssel anstelle der Schlüsselfach-Informationen "
-"wegschreiben."
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Laufwerks-(Master-)schlüssel anstelle der Schlüsselfach-Informationen wegschreiben"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
 msgid "The size of the encryption key"
 msgstr "Die Größe des Verschlüsselungsschlüssels"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
 msgid "BITS"
 msgstr "BITS"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
 msgid "Limits the read from keyfile"
 msgstr "Begrenzt das Lesen aus der Schlüsseldatei"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
 msgid "bytes"
 msgstr "Bytes"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
 msgid "Number of bytes to skip in keyfile"
 msgstr "Anzahl der Bytes, die in der Schlüsseldatei übersprungen werden"
 
-#: src/cryptsetup.c:1488
+#: src/cryptsetup.c:3499
 msgid "Limits the read from newly added keyfile"
 msgstr "Begrenzt das Lesen aus der neu erzeugten Schlüsseldatei"
 
-#: src/cryptsetup.c:1489
+#: src/cryptsetup.c:3500
 msgid "Number of bytes to skip in newly added keyfile"
-msgstr ""
-"Anzahl der Bytes, die in der neu erzeugten Schlüsseldatei übersprungen werden"
+msgstr "Anzahl der Bytes, die in der neu erzeugten Schlüsseldatei übersprungen werden"
 
-#: src/cryptsetup.c:1490
+#: src/cryptsetup.c:3501
 msgid "Slot number for new key (default is first free)"
 msgstr "Fachnummer für den neuen Schlüssel (im Zweifel das nächste freie)"
 
-#: src/cryptsetup.c:1491
+#: src/cryptsetup.c:3502
 msgid "The size of the device"
 msgstr "Die Größe des Geräts"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
 msgid "SECTORS"
 msgstr "SEKTOREN"
 
-#: src/cryptsetup.c:1492
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Nur die angegebene Gerätegröße benutzen (Rest des Gerätes ignorieren). GEFÄHRLICH!"
+
+#: src/cryptsetup.c:3504
 msgid "The start offset in the backend device"
 msgstr "Der Startoffset im Backend-Gerät"
 
-#: src/cryptsetup.c:1493
+#: src/cryptsetup.c:3505
 msgid "How many sectors of the encrypted data to skip at the beginning"
-msgstr ""
-"Wieviele Sektoren der verschlüsselten Daten am Anfang übersprungen werden "
-"sollen"
+msgstr "Wieviele Sektoren der verschlüsselten Daten am Anfang übersprungen werden sollen"
 
-#: src/cryptsetup.c:1494
+#: src/cryptsetup.c:3506
 msgid "Create a readonly mapping"
 msgstr "Eine schreibgeschützte Zuordnung erzeugen"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "PBKDF2 Iterationszeit for LUKS (in ms)"
-
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "msek"
-
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
 msgid "Do not ask for confirmation"
 msgstr "Nicht nach Bestätigung fragen"
 
 # XXX
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508
 msgid "Timeout for interactive passphrase prompt (in seconds)"
 msgstr "Frist für interaktive Eingabe der Passphrase (in Sekunden)"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
 msgid "secs"
 msgstr "sek"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Aktualisierungsintervall für Fortschrittszeile (in Sekunden)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
 msgid "How often the input of the passphrase can be retried"
 msgstr "Wie oft die Eingabe der Passphrase wiederholt werden kann"
 
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3511
 msgid "Align payload at <n> sector boundaries - for luksFormat"
 msgstr "Nutzdaten an Grenzen von <n> Sektoren ausrichten - für luksFormat"
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Datei mit dem Backup der LUKS-Header und den Schlüsselfächern."
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Datei mit dem Backup der LUKS-Header und den Schlüsselfächern"
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "/dev/random zum Generieren des Laufwerksschlüssels benutzen."
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "/dev/random zum Generieren des Laufwerksschlüssels benutzen"
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "/dev/urandom zum Generieren des Laufwerksschlüssels benutzen."
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "/dev/urandom zum Generieren des Laufwerksschlüssels benutzen"
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr "Gerät mit einem anderen nicht-überlappenden Kryptosegment teilen."
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Gerät mit einem anderen nicht-überlappenden Kryptosegment teilen"
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID für das zu verwendende Gerät."
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID für das zu verwendende Gerät"
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Auswurf-Anfragen (»TRIM«-Befehl) für das Gerät zulassen."
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Auswurf-Anfragen (»TRIM«-Befehl) für das Gerät zulassen"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Gerät oder Datei mit separatem LUKS-Header."
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Gerät oder Datei mit separatem LUKS-Header"
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Gerät nicht aktivieren, nur Passphrase überprüfen."
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Gerät nicht aktivieren, nur Passphrase überprüfen"
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Versteckten Header benutzen (verstecktes TCRYPT-Gerät)."
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Versteckten Header benutzen (verstecktes TCRYPT-Gerät)"
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Das Gerät ist das System-TCRYPT-Laufwerk (mit Bootlader)."
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Das Gerät ist das System-TCRYPT-Laufwerk (mit Bootlader)"
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Backup-(Zweit-)-TCRYPT-Header benutzen."
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Backup-(Zweit-)-TCRYPT-Header benutzen"
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Auch nach VeryCrypt-kompatiblen Geräten suchen."
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Auch nach VeryCrypt-kompatiblen Geräten suchen"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Art der Geräte-Metadaten: luks, plain, loopaes, tcrypt."
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Persönlicher Interations-Multiplizierer (PIM) für VeryCrypt-kompatibles Gerät"
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Passwort-Qualitätsprüfung deaktivieren (wenn sie aktiviert ist)."
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Bei VeraCrypt-kompatiblem Gerät nach persönlichem Iterations-Multiplizierer (PIM) fragen"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr ""
-"Kompatibilitäts-Performance-Option »same_cpu_crypt« für dm-crypt benutzen."
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Art der Geräte-Metadaten: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr ""
-"Kompatibilitäts-Performance-Option »submit_from_crypt_cpus« für dm-crypt "
-"benutzen."
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Passwort-Qualitätsprüfung deaktivieren (wenn sie aktiviert ist)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Kompatibilitäts-Performance-Option »same_cpu_crypt« für dm-crypt benutzen"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Kompatibilitäts-Performance-Option »submit_from_crypt_cpus« für dm-crypt benutzen"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Das Entfernen des Geräts wird aufgeschoben, bis der letzte Benutzer es schließt"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Globale Sperre verwenden, um speicherintensive PBKDF zu serialisieren (um Speicherprobleme zu umgehen)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "PBKDF-Iterationszeit for LUKS (in ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "msek"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "PBKDF-Algorithmus (für LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "PBKDF-Speicherkostengrenze"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "Kilobytes"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "PBKDF-Parallelitätskosten"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "Threads"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "PBKDF-Iterationskosten (erzwungen, deaktiviert Benchmark)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Schlüsselfach-Priorität: ignore (ignorieren), normal, prefer (bevorzugen)"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Dateisperrung von Metadaten auf der Platte deaktivieren"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Deaktivieren, dass Laufwerksschlüssel über den Kernel-Schlüsselbund geladen werden"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Datenintegritätsalgorithmus (nur LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Aufzeichnung für Integritätsgerät deaktivieren"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Gerät nach dem Formatieren nicht säubern"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Ineffizientes Altlasten-Padding verwenden (für alte Kernel)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Nicht nach einer Passphrase fragen, wenn die Aktivierung durch Token fehlschlägt"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Token-Nummer (Vorgabe: eine beliebige)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Schlüsselbeschreibung"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Verschlüsselungs-Sektorgröße (Vorgabe: 512 Bytes)"
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "IV verwenden (in Sektorgröße gezählt statt in Einheiten von 512 Bytes)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Aktivierungsschalter für Gerät permanent festlegen"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Beschriftung für das LUKS2-Gerät festlegen"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Teilsystem-Beschriftung für das LUKS2-Gerät festlegen"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Unbeschränktes LUKS2-Schlüsselfach (ohne zugeordnetem Datensegment) anlegen oder wegschreiben"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "JSON aus einer Datei lesen oder in eine Datei schreiben"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Größe des Bereichs für LUKS2-Header-Metadaten"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Größe des Bereichs für Schlüsselfächer im LUKS2-Header"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Gerät mit neuen Parametern auffrischen (reaktivieren)"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "LUKS2-Schlüsselfach: Die Größe des Verschlüsselungsschlüssels"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "LUKS2-Keyslot: Der Algorithmus, der für die Keyslot-Verschlüsselung verwendet wird"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "LUKS2-Gerät verschlüsseln (direkt am Ort)."
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "LUKS2-Gerät entschlüsseln (Verschlüsselung entfernen)."
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "LUKS2-Wiederverschlüsselung nur in Metadaten beginnen."
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Nur eine begonnene LUKS2-Wiederverschlüsselung fortsetzen."
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Größe des Datengeräts reduzieren (Datenoffset verschieben). GEFÄHRLICH!"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Maximalgröße der Wiederverschlüsselungs-Hotzone."
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Widerstandsfähigkeit der Hotzone für die Wiederverschlüsselung (checksum,journal,none)"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "Hash für Prüfsummen der Wiederverschlüsselungs-Hotzone"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Automatische Geräteerkennung der dm-Geräte für die Wiederverschlüsselung übersteuern"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
 msgid "[OPTION...] <action> <action-specific>"
 msgstr "[OPTION...] <Aktion> <aktionsabhängig>"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Laufe im FIPS-Modus.\n"
-
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
 msgid "Argument <action> missing."
 msgstr "Argument <Aktion> fehlt."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
 msgid "Unknown action."
 msgstr "Unbekannte Aktion."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr "Die Option --shared ist nur beim Öffnen eines Plain-Geräts erlaubt.\n"
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Die Optionen --refresh und --test-passphrase schließen sich gegenseitig aus."
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr "Die Option --allow-discards ist nur beim Öffnen erlaubt.\n"
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "Die Option --deferred ist nur beim »close«-Befehl erlaubt."
 
-#: src/cryptsetup.c:1657
-msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
-msgstr ""
-"Die Option --key-size ist nur für »luksFormat«, »open« und »benchmark« "
-"erlaubt.\n"
-"Benutzen Sie stattdessen »--keyfile-size=(Bytes)«, um das Lesen aus der "
-"Schlüsseldatei zu begrenzen."
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Die Option --shared ist nur beim beim »open«-Befehl eines Plain-Gerätes erlaubt."
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Die Option --allow-discards ist nur beim »open«-Befehl erlaubt."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Die Option --persistent ist nur beim »open«-Befehl erlaubt."
 
-#: src/cryptsetup.c:1664
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Die Option --serialize-memory-hard-pbkdf ist nur beim »open«-Befehl erlaubt."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Die Option --persistent ist nicht mit --test-passphrase kombinierbar."
+
+#: src/cryptsetup.c:3753
 msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
 msgstr ""
-"Die Option --test-passphrase ist nur beim Öffnen von LUKS- und TCRYPT-"
-"Geräten erlaubt.\n"
+"Die Option --key-size ist nur für »luksFormat«, »luksAddKey«,\n"
+"»open« und »benchmark« erlaubt. Benutzen Sie stattdessen »--keyfile-size=(Bytes)«,\n"
+"um das Lesen aus der Schlüsseldatei zu begrenzen."
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Die Option --integrity ist nur für luksFormat (LUKS2) erlaubt."
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Die Option --integrity-no-wipe ist nur für die »format«-Aktion mit Integritätserweiterung erlaubt."
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Die Optionen --label und --subsystem sind nur für die Aktionen »luksFormat« und »config LUKS2« erlaubt."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Die Option --test-passphrase ist nur beim Öffnen von LUKS, TCRYPT- und BITLK-Geräten erlaubt."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
 msgid "Key size must be a multiple of 8 bits"
 msgstr "Schlüsselgröße muss ein Vielfaches von 8 Bit sein"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
 msgid "Key slot is invalid."
 msgstr "Schlüsselfach ist ungültig."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"Die Option --key-file wirkt stärker als das angegebene Schlüsseldatei-"
-"Argument.\n"
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Die Option --key-file wirkt stärker als das angegebene Schlüsseldatei-Argument."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
 msgid "Negative number for option not permitted."
 msgstr "Negative Zahl für die Option nicht erlaubt."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Die Option --key-file ist nur einmal erlaubt."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
 msgid "Only one of --use-[u]random options is allowed."
 msgstr "Nur eine der Optionen --use-[u]random ist erlaubt."
 
-#: src/cryptsetup.c:1699
+#: src/cryptsetup.c:3813
 msgid "Option --use-[u]random is allowed only for luksFormat."
 msgstr "Die Option --use-[u]random ist nur für luksFormat erlaubt."
 
-#: src/cryptsetup.c:1703
+#: src/cryptsetup.c:3817
 msgid "Option --uuid is allowed only for luksFormat and luksUUID."
 msgstr "Die Option --uuid ist nur für luksFormat und luksUUID erlaubt."
 
-#: src/cryptsetup.c:1707
+#: src/cryptsetup.c:3821
 msgid "Option --align-payload is allowed only for luksFormat."
 msgstr "Die Option --align-payload ist nur für luksFormat erlaubt."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Die Option --skip ist nur beim Öffnen von plain- und loopaes-Geräten "
-"erlaubt.\n"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Die Optionen --luks2-metadata-size und --opt-luks2-keyslots-size sind nur für luksFormat mit LUKS2 erlaubt."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Ungültige Angabe für die Größe der LUKS2-Metadaten."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Ungültige Angabe für die Größe der LUKS2-Schlüsselfächer."
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Die Optionen --align-payload und --offset können nicht kombiniert werden."
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Die Option --skip ist nur beim Öffnen von plain- und loopaes-Geräten erlaubt."
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Die Option --offset ist nur beim Öffnen von plain- und loopaes-Geräten erlaubt, sowie für luksFormat und Geräte-Wiederverschlüsselung."
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Die Optionen --tcrypt-hidden, --tcrypt-system und --tcrypt-backup sind nur zusammen mit einem TCRYPT-Gerät erlaubt."
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Die Option --tcrypt-hidden kann nicht mit --allow-discards kombiniert werden."
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Die Option --veracrypt wird nur für TCRYPT-kompatible Geräte unterstützt."
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Ungültiges Argument für Parameter --veracrypt-pim angegeben."
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Die Option --veracrypt-pim wird nur für VeraCrypt-kompatible Geräte unterstützt."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Die Option --veracrypt-query-pim wird nur für VeraCrypt-kompatible Geräte unterstützt."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Die Optionen --veracrypt-pim und --veracrypt-query-pim schließen sich gegenseitig aus."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Die Option --priority kann nur »ignore/normal/prefer« sein."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Das Schlüsselfach muss angegeben werden."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Passwortbasierte Schlüsselableitungsfunktion (PBKDF) kann nur »pbkdf2« oder »argon2i/argon2id« sein."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Bei PBKDF darf nur entweder die Anzahl der Durchläufe oder die Zeitbegrenzung angegeben werden."
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "Die Option Sektorgröße wird für diesen Befehl nicht unterstützt."
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "Die Option für große IV-Sektoren wird nur unterstützt, wenn das geöffnete Gerät Sektoren größer als 512 Bytes hat."
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "Die Option »--unbound« erfordert die Schlüsselgröße."
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Die Option »--unbound« kann nur zusammen mit den Aktionen »luksAddKey« und »luksDump« benutzt werden."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "Die Option --refresh kann nur zusammen mit der Aktion »open« benutzt werden."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "Fehler beim Deaktivieren der Metadaten-Dateisperre."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Ungültige Angabe der Maximalgröße für die Wiederverschlüsselungs-Hotzone."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Ungültige Angabe der Gerätegröße."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Die maximale Verkleinerungsgröße ist 1 GiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Die verkleinerte Größe muss ein Vielfaches von 512-Byte-Sektoren sein."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "Ungültige Angabe der Datengröße."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Überlauf bei der Verringerungsgröße."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "LUKS2-Entschlüsselung erfordert die Option --header."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Die Gerätegröße muss ein Vielfaches von 512-Byte-Sektoren sein."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Die Optionen --reduce-device-size und --data-size können nicht kombiniert werden."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Die Optionen --device-size und --size können nicht kombiniert werden."
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Die Option --offset ist nur beim Öffnen von plain- und loopaes-Geräten "
-"erlaubt.\n"
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Die Optionen --ignore-corruption und --restart-on-corruption können nicht zusammen benutzt werden."
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
-msgstr ""
-"Die Optionen --tcrypt-hidden, --tcrypt-system und --tcrypt-backup sind nur "
-"zusammen mit einem TCRYPT-Gerät erlaubt.\n"
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Ungültiger Salt-String angegeben."
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
-msgstr ""
-"Die Option --tcrypt-hidden kann nicht mit --allow-discards kombiniert "
-"werden.\n"
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Fehler beim Schreiben des Hash-Abbilds »%s«."
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr ""
-"Die Option --veracrypt wird nur für TCRYPT-kompatible Geräte unterstützt.\n"
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Fehler beim Schreiben des FEC-Abbilds »%s«."
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "Ungültiger Salt-String angegeben.\n"
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Ungültiger Root-Hash-String angegeben."
 
-#: src/veritysetup.c:88
+#: src/veritysetup.c:187
 #, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "Fehler beim Schreiben des Hash-Abbilds »%s«.\n"
+msgid "Invalid signature file %s."
+msgstr "Ungültige Signaturdatei »%s«."
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "Ungültiger Root-Hash-String angegeben.\n"
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Fehler beim Einlesen der Signaturdatei »%s«."
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392
 msgid "<data_device> <hash_device>"
 msgstr "<Datengerät> <Hash-Gerät>"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392 src/integritysetup.c:479
 msgid "format device"
 msgstr "Gerät formatieren"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "<data_device> <hash_device> <root_hash>"
 msgstr "<Datengerät> <Hash-Gerät> <Root-Hash>"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "verify device"
 msgstr "Gerät verifizieren"
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<Name> <Datengerät> <Hash-Gerät> <Root-Hash>"
-
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "Aktives Gerät anlegen"
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<Datengerät> <Name> <Hash-Gerät> <Root-Hash>"
 
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "Gerät entfernen (deaktivieren)"
-
-#: src/veritysetup.c:312
+#: src/veritysetup.c:396 src/integritysetup.c:482
 msgid "show active device status"
 msgstr "Status der aktiven Geräte anzeigen"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397
 msgid "<hash_device>"
 msgstr "<Hash-Gerät>"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397 src/integritysetup.c:483
 msgid "show on-disk information"
 msgstr "Auf dem Datenträger gespeicherte Informationen anzeigen"
 
-#: src/veritysetup.c:332
+#: src/veritysetup.c:416
 #, c-format
 msgid ""
 "\n"
@@ -1581,342 +3120,932 @@ msgstr ""
 "<Hash-Gerät> ist das Gerät, das die Verifikationsdaten enthält\n"
 "<Root-Hash> ist der Hash des Rootknotens auf <Hash-Gerät>\n"
 
-#: src/veritysetup.c:339
+#: src/veritysetup.c:423
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
 msgstr ""
 "\n"
 "Einkompilierte Vorgabewerte für dm-verity:\n"
-"\tHash: %s, Datenblock (Bytes): %u, Hashblock (Bytes): %u, Salt-Größe: %u, "
-"Hashformat: %u\n"
+"\tHash: %s, Datenblock (Bytes): %u, Hashblock (Bytes): %u, Salt-Größe: %u, Hashformat: %u\n"
 
-#: src/veritysetup.c:377
+#: src/veritysetup.c:466
 msgid "Do not use verity superblock"
 msgstr "Verity-Superblock nicht benutzen"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "Format type (1 - normal, 0 - original Chrome OS)"
 msgstr "Format-Art (1 - normal, 0 - originales Chrome-OS)"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "number"
 msgstr "Zahl"
 
-#: src/veritysetup.c:379
+#: src/veritysetup.c:468
 msgid "Block size on the data device"
 msgstr "Blockgröße auf dem Datengerät"
 
-#: src/veritysetup.c:380
+#: src/veritysetup.c:469
 msgid "Block size on the hash device"
 msgstr "Blockgröße auf dem Hash-Gerät"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "FEC-Paritätsbytes"
+
+#: src/veritysetup.c:471
 msgid "The number of blocks in the data file"
 msgstr "Die Anzahl der Blöcke in der Datendatei"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:471
 msgid "blocks"
 msgstr "Blöcke"
 
-#: src/veritysetup.c:382
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Pfad zum Gerät mit Fehlerkorrekturdaten"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "Pfad"
+
+#: src/veritysetup.c:473
 msgid "Starting offset on the hash device"
 msgstr "Start-Offset auf dem Hash-Gerät"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Start-Offset auf dem FEC-Gerät"
+
+#: src/veritysetup.c:475
 msgid "Hash algorithm"
 msgstr "Hash-Algorithmus"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:475
 msgid "string"
 msgstr "Zeichenkette"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "Salt"
 msgstr "Salt"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "hex string"
 msgstr "Hex-Zeichenkette"
 
-#: src/cryptsetup_reencrypt.c:147
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Pfad zur Signaturdatei des Stammhashes"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Kernel neustarten wenn Beschädigung festgestellt wird"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Beschädigung ignorieren, nur mitloggen"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Ausgenullte Blöcke nicht überprüfen"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Datenblock nur beim erstmaligen Lesen verifizieren"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Die Optionen --ignore-corruption, --restart-on-corruption und --ignore-zero-blocks sind nur für die »open«-Aktion erlaubt."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Die Option --root-hash-signature kann nur zusammen mit der Aktion »open« benutzt werden."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Die Optionen --ignore-corruption und --restart-on-corruption können nicht zusammen benutzt werden."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Fehler beim Einlesen der Schlüsseldatei »%s«."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Fehler beim Einlesen von %d Bytes aus der Schlüsseldatei »%s«."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formatiert mit Etikettgröße %u und interner Integrität %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<Integritätsgerät>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<Integritätsgerät> <Name>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<Name> ist das Gerät, das unter »%s« angelegt werden soll\n"
+"<Integritätsgerät> ist das Gerät, das die Daten mit Integritätsangaben enthält\n"
+
+#: src/integritysetup.c:507
 #, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
 msgstr ""
-"Gerät »%s« kann nicht exklusiv geöffnet werden, da es bereits benutzt wird.\n"
+"\n"
+"Einkompilierte Vorgabewerte für dm-integrity:\n"
+"\tPrüfalgorithmus: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Pfad zum Datengerät (wenn getrennt)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Journalgröße"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Sektoren verschränken"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Jornal-Wasserzeichen"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "Prozent"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Journal-Commitzeit"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Anzahl der 512-Byte-Sektoren pro Bit (Bitmap-Modus)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Zeit für sicheres Speichern im Bitmap-Modus"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Etikettgröße pro Sektor"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Sektorengröße"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Puffergröße"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Datenintegritäts-Algorithmus"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Die Größe des Datenintegritätsschlüssels"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Integritätsschlüssel aus einer Datei lesen"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Integritätsalgorithmus für Journal"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Die Größe des Integritätsschlüssels für das Journal"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Integritätsschlüssel für das Journal aus einer Datei lesen"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Algorithmus für Journalverschlüsselung"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Die Größe des Journal-Verschlüsselungsschlüssels"
 
-#: src/cryptsetup_reencrypt.c:151
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Journal-Verschlüsselungsschlüssel aus einer Datei lesen"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Wiederherstellungsmodus (kein Journal, keine Etikettprüfung)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Bitmap verwenden, um Änderungen nachzuverfolgen und Journal für Integritätsgerät deaktivieren"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Initiale Integritätsangaben automatisch neu berechnen."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Die Option --integrity-recalculate kann nur zusammen mit der Aktion »open« benutzt werden."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Die Optionen --journal-size, --interleave-sectors, --sector-size, --tag-size und --no-wipe können nur bei der Aktion »format« verwendet werden."
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Ungültige Angabe der Journalgröße."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Sowohl die Schlüsseldatei als auch die Schlüsselgröße müssen angegeben werden."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Wenn ein Integritätsschlüssel verwendet wird, muss auch der Integritätsalgorithmus angegeben werden."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Sowohl die Schlüsseldatei als auch die Schlüsselgröße müssen für die Journalintegrität angegeben werden."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Wenn ein Integritätsschlüssel für das Journal verwendet wird, muss auch der Integritätsalgorithmus angegeben werden."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Sowohl der Verschlüsselungsschlüssel als auch die Schlüsselgröße müssen für die Journalverschlüsselung angegeben werden."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Wenn ein Verschlüsselungsschlüssel für das Journal verwendet wird, muss auch der Verschlüsselungsalgorithmus angegeben werden."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Die Modi Wiederherstellung und Bitmap schließen sich gegenseitig aus."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Die Journal-Optionen können nicht im Bitmap-Modus verwendet werden."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Die Bitmapoptionen können nur im Bitmapmodus verwendet werden."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Wiederverschlüsselung läuft bereits."
+
+#: src/cryptsetup_reencrypt.c:208
 #, c-format
-msgid "Cannot open device %s\n"
-msgstr "Fehler beim Öffnen von Gerät »%s«.\n"
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Gerät »%s« kann nicht exklusiv geöffnet werden, da es bereits benutzt wird."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "Belegen des ausgerichteten Speichers fehlgeschlagen.\n"
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Belegen des ausgerichteten Speichers fehlgeschlagen."
 
-#: src/cryptsetup_reencrypt.c:168
+#: src/cryptsetup_reencrypt.c:229
 #, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Fehler beim Lesen von Gerät »%s«.\n"
+msgid "Cannot read device %s."
+msgstr "Fehler beim Lesen von Gerät »%s«."
 
-#: src/cryptsetup_reencrypt.c:179
+#: src/cryptsetup_reencrypt.c:240
 #, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "LUKS-Gerät »%s« wird als unbenutzbar markiert.\n"
+msgid "Marking LUKS1 device %s unusable."
+msgstr "LUKS1-Gerät »%s« wird als unbenutzbar markiert."
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "LUKS-Gerät »%s« wird als benutzbar markiert.\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "LUKS2-Offline-Wiederverschlüsselungs-Kennzeichen wird auf Gerät »%s« festgelegt."
 
-#: src/cryptsetup_reencrypt.c:200
+#: src/cryptsetup_reencrypt.c:261
 #, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Fehler beim Schreiben auf Gerät »%s«.\n"
+msgid "Cannot write device %s."
+msgstr "Fehler beim Schreiben auf Gerät »%s«."
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "Fehler beim Speichern der Wiederverschlüsselungs-Logdatei.\n"
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Fehler beim Speichern der Wiederverschlüsselungs-Logdatei."
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "Fehler beim Einlesen der Wiederverschlüsselungs-Logdatei.\n"
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Fehler beim Einlesen der Wiederverschlüsselungs-Logdatei."
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
 msgstr "Logdatei »%s« existiert, Wiederverschlüsselung wird fortgesetzt.\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr "Temporäres Gerät mit dem alten LUKS-Header wird aktiviert.\n"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Temporäres Gerät mit dem alten LUKS-Header wird aktiviert."
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr "Temporäres Gerät mit dem neuen LUKS-Header wird aktiviert.\n"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Temporäres Gerät mit dem neuen LUKS-Header wird aktiviert."
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Fehler beim Aktivieren der temporären Geräte.\n"
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Fehler beim Aktivieren der temporären Geräte."
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Neuer LUKS-Header für Gerät »%s« angelegt.\n"
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Fehler beim Festlegen des Daten-Offsets."
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Fehler beim Festlegen der Metadatengröße."
+
+#: src/cryptsetup_reencrypt.c:573
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Schlüsselfach %i aktiviert.\n"
+msgid "New LUKS header for device %s created."
+msgstr "Neuer LUKS-Header für Gerät »%s« angelegt."
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "LUKS-Backup-Header von Gerät »%s« angelegt.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Diese Version von cryptsetup-reencrypt kann internen Tokentyp %s nicht verarbeiten."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Fehler beim Lesen der Aktivierungsschalter aus dem Backup-Header."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "Fehler beim Anlegen des LUKS-Backup-Headers.\n"
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Fehler beim Schreiben der Aktivierungsschalter in den neuen Header."
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Fehler beim Lesen der Anforderungen aus dem Backup-Header."
+
+#: src/cryptsetup_reencrypt.c:705
 #, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Fehler beim Wiederherstellen des LUKS-Headers auf Gerät »%s«.\n"
+msgid "%s header backup of device %s created."
+msgstr "%s-Backup-Header von Gerät »%s« angelegt."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Fehler beim Anlegen des LUKS-Backup-Headers."
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/cryptsetup_reencrypt.c:901
 #, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "LUKS-Header auf Gerät »%s« wiederhergestellt.\n"
+msgid "Cannot restore %s header on device %s."
+msgstr "Fehler beim Wiederherstellen des %s-Headers auf Gerät »%s«."
 
-#: src/cryptsetup_reencrypt.c:669
+#: src/cryptsetup_reencrypt.c:903
 #, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Fortschritt: %5.1f%%, noch %02llu:%02llu, %4llu MiB geschrieben bei %5.1f "
-"MiB/s%s"
+msgid "%s header on device %s restored."
+msgstr "%s-Header auf Gerät »%s« wiederhergestellt."
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Fehler beim Springen zum Gerät-Offset.\n"
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Fehler beim Öffnen des temporären LUKS-Geräts."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Fehler beim Öffnen der temporären LUKS-Header-Datei.\n"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Fehler beim Ermitteln der Gerätegröße."
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "Fehler beim Ermitteln der Gerätegröße.\n"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "E/A-Fehler während der Wiederverschlüsselung."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Durch ein Signal unterbrochen.\n"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Die angegebene UUID ist ungültig."
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "E/A-Fehler während der Wiederverschlüsselung.\n"
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Fehler beim Öffnen der Wiederverschlüsselungs-Logdatei."
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"Schlüsseldatei kann nur mit --key-slot oder mit genau einem aktiven "
-"Schlüsselfach benutzt werden.\n"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Derzeit ist keine Entschlüsselung im Gange, die angegebene UUID kann nur benutzt werden, um einen unterbrochenen Entschlüsselungsvorgang fortzusetzen."
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
+#: src/cryptsetup_reencrypt.c:1504
 #, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Geben Sie die Passphrase für Schlüsselfach %u ein: "
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "PBKDF-Parameter in Schlüsselfach %i wurden geändert."
 
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Fehler beim Öffnen der Wiederverschlüsselungs-Logdatei.\n"
-
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "Reencryption block size"
 msgstr "Wiederverschlüsselungs-Blockgröße"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "MiB"
 msgstr "MiB"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "Schlüssel nicht ändern, Datenbereich nicht neu verschlüsseln."
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Schlüssel nicht ändern, Datenbereich nicht neu verschlüsseln"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Laufwerks-(Master-)Schlüssel aus Datei lesen"
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr "Beim Zugriff auf die Geräte direct-io benutzen."
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "PBKDF2 Iterationszeit for LUKS (in ms)"
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr "Nach jedem Block fsync aufrufen."
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Beim Zugriff auf die Geräte direct-io benutzen"
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Logdatei nach jedem Block aktualisieren."
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Nach jedem Block fsync aufrufen"
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr "Nur dieses Schlüsselfach benutzen (alle anderen werden deaktiviert)."
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Logdatei nach jedem Block aktualisieren"
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
-"Größe des Datengeräts reduzieren (Datenoffset verschieben). GEFÄHRLICH!"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Nur dieses Schlüsselfach benutzen (alle anderen werden deaktiviert)"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Nur die angegebene Gerätegröße benutzen (Rest des Gerätes ignorieren). "
-"GEFÄHRLICH!"
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Neuen Header auf unverschlüsseltem Gerät anlegen"
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Neuen Header auf unverschlüsseltem Gerät anlegen."
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Gerät dauerhaft entschlüsseln (Verschlüsselung entfernen)"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
-msgstr "Gerät dauerhaft entschlüsseln (Verschlüsselung entfernen)."
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "Die UUID, um das Entschlüsseln fortzusetzen"
 
-#: src/cryptsetup_reencrypt.c:1298
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Art der LUKS-Metadaten: luks1, luks2"
+
+#: src/cryptsetup_reencrypt.c:1659
 msgid "[OPTION...] <device>"
 msgstr "[OPTION...] <Gerät>"
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
-"WARNUNG: Dies ist experimenteller Code, es kann sein, dass er Ihre Daten "
-"komplett zerstört.\n"
-
-#: src/cryptsetup_reencrypt.c:1313
+#: src/cryptsetup_reencrypt.c:1667
 #, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "Wiederverschlüsselung ändert: Laufwerkskennung%s%s%s%s.\n"
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Wiederverschlüsselung ändert: %s%s%s%s%s%s."
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "Laufwerksschlüssel"
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
 msgstr ", Hash auf "
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ", Verschlüsselung auf "
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr "Argument muss angegeben werden."
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Für die Wiederverschlüsselungs-Blockgröße sind nur Werte zwischen 1 MiB und "
-"64 MiB erlaubt."
-
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Ungültige Angabe der Gerätegröße."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Für die Wiederverschlüsselungs-Blockgröße sind nur Werte zwischen 1 MiB und 64 MiB erlaubt."
 
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
 msgstr "Die maximale Verkleinerungsgröße ist 64 MiB."
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Die verkleinerte Größe muss ein Vielfaches von 512-Byte-Sektoren sein."
-
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr ""
-"Die Option »--new« muss zusammen mit »--reduce-device-size« benutzt werden."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Die Option »--new« muss zusammen mit »--reduce-device-size« oder »--header« benutzt werden."
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
-"Die Option »--keep-new« kann nur zusammen mit »--hash« oder »--iter-time« "
-"benutzt werden."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Die Option »--keep-new« kann nur zusammen mit »--hash«, »--iter-time« oder »--pbkdf-force-iterations« benutzt werden."
 
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr "Die Option »--new« kann nicht zusammen mit »--decrypt« benutzt werden."
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
-msgstr ""
-"Die Option --decrypt verträgt sich nicht mit den angegebenen Parametern."
+msgstr "Die Option --decrypt verträgt sich nicht mit den angegebenen Parametern."
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Die Option »--uuid« kann nur zusammen mit »--decrypt« benutzt werden."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Ungültiger LUKS-Typ. Verwenden Sie einen von diesen: luks, luks1, luks2."
 
 #: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Fehler beim Lesen der Antwort vom Terminal.\n"
+msgid "Error reading response from terminal."
+msgstr "Fehler beim Lesen der Antwort vom Terminal."
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Befehl erfolgreich.\n"
 
-#: src/utils_tools.c:191
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "Falsche oder fehlende Parameter"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "Kein Zugriff, oder falsche Passphrase"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "Nicht genug Speicher"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "Falsches Gerät oder falsche Datei angegeben"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "Das Gerät existiert bereits oder wird bereits benutzt"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "Unbekannter Fehler"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Fehler %i beim Ausführen eines Befehls »%s«.\n"
+
+#: src/utils_tools.c:283
 #, c-format
-msgid "Command failed with code %i"
-msgstr "Fehler %i beim Ausführen eines Befehls"
+msgid "Key slot %i created."
+msgstr "Schlüsselfach %i erstellt."
 
-#: src/utils_password.c:42
+#: src/utils_tools.c:285
 #, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Fehler beim Prüfen der Passwortqualität: %s\n"
+msgid "Key slot %i unlocked."
+msgstr "Schlüsselfach %i entsperrt."
 
-#: src/utils_password.c:50
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Schlüsselfach %i entfernt."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Token %i erstellt."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Token %i entfernt."
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Gründlich löschen unterbrochen."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "WARNUNG: Gerät %s enthält bereits eine '%s'-Partitionssignatur.\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "WARNUNG: Gerät %s enthält bereits eine '%s'-Superblock-Signatur.\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Fehler beim Initialisieren der Gerätesignatursonden."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Gerät %s konnte nicht gefunden werden."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Gerät %s wird gerade benutzt. Das Formatieren ist gerade nicht möglich."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Datei %s konnte nicht im Lese-/Schreibmodus geöffnet werden."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Die bestehende Partitionssignatur »%s« (Offset: %<PRIi64> Bytes) auf Gerät %s wird dadurch gelöscht."
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Die bestehende Superblocksignatur »%s« (Offset: %<PRIi64> Bytes) auf Gerät %s wird dadurch gelöscht."
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Fehler beim Löschen der Gerätesignatur."
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Gerät %s konnte nicht auf eine Signatur geprüft werden."
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Wiederverschlüsselung unterbrochen."
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Fehler beim Prüfen der Passwortqualität: %s"
+
+#: src/utils_password.c:51
 #, c-format
 msgid ""
 "Password quality check failed:\n"
-" %s\n"
+" %s"
 msgstr ""
 "Passwort-Qualitätsüberprüfung fehlgeschlagen:\n"
-" %s\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Passwort-Qualitätsüberprüfung fehlgeschlagen: Falsche Passphrase (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Fehler beim Lesen der Passphrase vom Terminal."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Passphrase bestätigen: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Passphrasen stimmen nicht überein."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Offset kann nicht zusammen mit Terminaleingabe benutzt werden."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Passphrase eingeben: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Geben Sie die Passphrase für »%s« ein: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Kein Schlüssel mit dieser Passphrase verfügbar."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Es ist kein nutzbares Schlüsselfach verfügbar."
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Fehler beim Schreiben der Schlüsseldatei »%s«."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Fehler beim Schreiben der Schlüsseldatei »%s«."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Datei %s konnte nicht im Nur-Lese-Modus geöffnet werden."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Geben Sie gültiges LUKS2-Token-JSON an:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "JSON-Datei konnte nicht gelesen werden."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Lesen unterbrochen."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Datei %s konnte nicht im Schreibmodus geöffnet werden."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Schreiben unterbrochen."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "JSON-Datei konnte nicht geschrieben werden."
+
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands."
+#~ msgstr "Die Option --refresh ist nur beim »open«- oder »refresh«-Befehl erlaubt."
+
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Verschlüsselung »%s« ist nicht verfügbar."
+
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Nicht unterstützte Sektorengröße für Verschlüsselung.\n"
+
+#~ msgid "Offline reencryption in progress. Aborting."
+#~ msgstr "Offline-Wiederverschlüsselung läuft gerade. Wird abgebrochen."
+
+#~ msgid "Online reencryption in progress. Aborting."
+#~ msgstr "Online-Wiederverschlüsselung läuft gerade. Wird abgebrochen."
+
+#~ msgid "No LUKS2 reencryption in progress."
+#~ msgstr "Derzeit läuft keine LUKS2-Wiederverschlüsselung."
+
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Durch ein Signal unterbrochen."
+
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Diese Funktion ist im FIPS-Modus nicht verfügbar."
+
+#~ msgid "Failed to write hash."
+#~ msgstr "Fehler beim Schreiben des Hashes."
+
+#~ msgid "Failed to finalize hash."
+#~ msgstr "Fehler beim Berechnen des Hashes."
+
+#~ msgid "Invalid resilience parameters (internal error)."
+#~ msgstr "Interner Fehler: ungültige Parameter für Widerstandsfähigkeit."
+
+#~ msgid "Failed to assign new enc segments."
+#~ msgstr "Fehler beim Zuweisen neuer Verschlüsselungssegmente."
+
+#~ msgid "Failed to assign digest %u to segment %u."
+#~ msgstr "Digest %u konnte dem Segment %u nicht zugewiesen werden."
+
+#~ msgid "Failed to set segments."
+#~ msgstr "Fehler beim Festlegen der Segmente."
+
+#~ msgid "Failed to assign reencrypt previous backup segment."
+#~ msgstr "Fehler beim Wiederverschlüsseln des vorigen Backupsegments."
+
+#~ msgid "Failed to assign reencrypt final backup segment."
+#~ msgstr "Fehler beim Wiederverschlüsseln des letzten Backupsegments."
+
+#~ msgid "Failed generate 2nd segment."
+#~ msgstr "Fehler beim Generieren des 2. Segments."
+
+#~ msgid "Failed generate 1st segment."
+#~ msgstr "Fehler beim Generieren des 1. Segments."
+
+#~ msgid "Failed to allocate device %s."
+#~ msgstr "Fehler beim Öffnen des Geräts »%s«."
+
+#~ msgid "Failed to allocate dm segments."
+#~ msgstr "Fehler beim Reservieren der dm-Segmente."
+
+#~ msgid "Failed to create dm segments."
+#~ msgstr "Fehler beim Anlegen der dm-Segmente."
+
+#~ msgid "Failed to allocate device for new backing device."
+#~ msgstr "Fehler beim Reservieren des Geräts für das neue Hintergrundgerät."
+
+#~ msgid "Failed to reload overlay device %s."
+#~ msgstr "Fehler beim Neuladen des Überlagerungsgeräts »%s«."
+
+#~ msgid "Failed to refresh helper devices."
+#~ msgstr "Fehler beim Auffrischen der Hilfsgeräte."
+
+#~ msgid "Failed to create reencryption backup segments."
+#~ msgstr "Fehler beim Erzeugen der Backupsegmente für die Wiederverschlüsselung."
+
+#~ msgid "Failed to set online-reencryption requirement."
+#~ msgstr "Fehler beim Festlegen der Anforderungen für Online-Wiederverschlüsselung."
+
+#~ msgid "Failed to hash sector at offset %zu."
+#~ msgstr "Fehler beim Hashen des Sektors an Offset %zu."
+
+#~ msgid "Failed to read sector hash."
+#~ msgstr "Fehler beim Lesen des Hashes des Sektors."
+
+#~ msgid "Error: Calculated reencryption offset %<PRIu64> is beyond device size %<PRIu64>."
+#~ msgstr "Fehler: Der berechnete Offset für die Wiederverschlüsselung %<PRIu64> liegt jenseits der Gerätegröße %<PRIu64>."
+
+#~ msgid "Device is not in clean reencryption state."
+#~ msgstr "Das Gerät ist nicht in einem sauberen Wiederverschlüsselungszustand."
+
+#~ msgid "Failed to calculate new segments."
+#~ msgstr "Fehler beim Berechnen der neuen Segmente."
+
+#~ msgid "Failed to assign pre reenc segments."
+#~ msgstr "Fehler beim Zuweisen der Segmente vor der Wiederverschlüsselung."
+
+#~ msgid "Failed finalize hotzone resilience, retval = %d"
+#~ msgstr "Interner Fehler beim Finalisieren der Hotzonen-Widerstandsfähigkeit, retval = %d"
+
+#~ msgid "Failed to write data."
+#~ msgstr "Fehler beim Schreiben von Daten."
+
+#~ msgid "Failed to update metadata or reassign device segments."
+#~ msgstr "Fehler beim Aktualisieren der Metadaten oder bei der Zuordnung von Gerätesegmenten."
+
+#~ msgid "Failed to reload %s device."
+#~ msgstr "Fehler beim Neuladen des Geräts »%s«."
+
+#~ msgid "Failed to erase backup segments"
+#~ msgstr "Fehler beim Löschen der Backupsegmente."
+
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Die verlangten dmcrypt-Performance-Optionen werden nicht unterstützt."
+
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Gerät »%s« kann nicht formatiert werden, da es gerade benutzt wird."
+
+#~ msgid "Key slot %d is not used."
+#~ msgstr "Schlüsselfach %d ist unbenutzt."
+
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Schlüsselfach %d zum Löschen ausgewählt."
+
+#~ msgid "open device as mapping <name>"
+#~ msgstr "Gerät als Zuordnung <Name> öffnen"
+
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "Gerät schließen (deaktivieren und Zuordnung entfernen)"
+
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Fehler beim Festlegen der PBKDF-Parameter."
+
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Fehler beim Springen zum Gerät-Offset.\n"
+
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "Gerät »%s« ist zu klein. (LUKS2 benötigt mindestens %<PRIu64> Bytes.)"
+
+#~ msgid "Replaced with key slot %d."
+#~ msgstr "Ersetzt durch Schlüsselfach %d."
+
+#~ msgid "Missing LUKS target type, option --type is required."
+#~ msgstr "Fehlender LUKS-Zieltyp, die Option --type ist Pflicht."
+
+#~ msgid "Missing --token option specifying token for removal."
+#~ msgstr "Um ein Token zu löschen, muss die Option --token angegeben werden."
+
+#~ msgid "Add or remove keyring token"
+#~ msgstr "Schlüsselring-Token hinzufügen oder entfernen"
+
+#~ msgid "Activated keyslot %i."
+#~ msgstr "Schlüsselfach %i aktiviert."
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "Speicherproblem in action_luksFormat"
+
+#~ msgid "Key slot is invalid.\n"
+#~ msgstr "Schlüsselfach ist ungültig.\n"
 
-#~ msgid "FIPS checksum verification failed.\n"
-#~ msgstr "FIPS-Prüfsummen-Verifizierung fehlgeschlagen.\n"
+#~ msgid "Using default pbkdf parameters for new LUKS2 header.\n"
+#~ msgstr "Für den neuen LUKS2-Header werden die vorgegebenen PBKDF-Parameter verwendet.\n"
index 3a8397f..1c8f11f 100644 (file)
Binary files a/po/es.gmo and b/po/es.gmo differ
index 4ee6678..5cf861e 100644 (file)
--- a/po/es.po
+++ b/po/es.po
@@ -1,8 +1,8 @@
 # Spanish translations for cryptsetup package
 # Traducciones al español para el paquete cryptsetup.
-# Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+# Copyright (C) 2014, 2015, 2016, 2017, 2018, 2019, 2020 Free Software Foundation, Inc.
 # This file is put in the public domain.
-# Antonio Ceballos <aceballos@gmail.com>, 2013, 2014, 2015
+# Antonio Ceballos <aceballos@gmail.com>, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
 #
 # ######################################################################
 # Traducciones dudosas:
@@ -41,6 +41,9 @@
 # temporary = temporal
 # reencryption = recifrado
 # invalid = no válido, -a
+# lock = bloqueo
+# hotzone = zona activa
+# unbound key = clave independiente
 #
 # #######################################################################
 # Términos no traducidos
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-19 11:45+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-16 08:46+0200\n"
 "Last-Translator: Antonio Ceballos <aceballos@gmail.com>\n"
 "Language-Team: Spanish <es@tp.org.es>\n"
 "Language: es\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"No se puede inicializar el «device mapper», ejecutando como usuario no "
-"administrador.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "No se puede inicializar el «device mapper», ejecutando como usuario no administrador."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"No se puede inicializar el «device-mapper». ¿Está cargado el módulo del "
-"núcleo dm_mod?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "No se puede inicializar el «device-mapper». ¿Está cargado el módulo del núcleo dm_mod?"
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "El indicador diferido solicitado no está disponible."
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "El DM-UUID del dispositivo %s ha sido truncado.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "El DM-UUID del dispositivo %s ha sido truncado."
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr ""
-"Las opciones de rendimiento de dmcrypt solicitadas no están disponibles.\n"
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Tipo de objetivo dm desconocido."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Las opciones de rendimiento de dm-crypt solicitadas no están disponibles."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Las opciones de manejo de corrupción de datos de dm-verity solicitadas no están disponibles."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Las opciones FEC de dm-verity solicitadas no están disponibles."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Las opciones de integridad de datos solicitadas no están disponibles."
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "La opción sector_size solicitada no está disponible."
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "El recómputo automático de las etiquetas de integridad solicitado no está disponible."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Descartar/TRIM no disponible."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "El modo de mapa de bits de dm-integrity solicitado no está disponible."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "No se ha podido consultar el segmento de dm-%s."
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
-"El sistema se ha quedado sin entropía mientras estaba generando la clave del "
-"volumen.\n"
-"Por favor, mueva el ratón o pulse alguna tecla en otra ventana para provocar "
-"algún evento aleatorio.\n"
+"El sistema se ha quedado sin entropía mientras estaba generando la clave del volumen.\n"
+"Por favor, mueva el ratón o pulse alguna tecla en otra ventana para provocar algún evento aleatorio.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Generando la clave (%d%% hecho).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr ""
-"Error fatal durante la inicialización del generador de números aleatorios.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Modo FIPS en funcionamiento."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr ""
-"La calidad solicitada para el generador de números aleatorios es "
-"desconocida.\n"
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Error fatal durante la inicialización del generador de números aleatorios."
 
-#: lib/random.c:211
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "La calidad solicitada para el generador de números aleatorios es desconocida."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Error leyendo del generador de números aleatorios."
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "No se puede inicializar el «backend» del generador de números aleatorios de cifrado."
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "No se puede inicializar el «backend» de cifrado."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
 #, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Error %d leyendo del generador de números aleatorios: %s\n"
+msgid "Hash algorithm %s not supported."
+msgstr "Algoritmo «hash» %s no disponible."
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr ""
-"No se puede inicializar el «backend» del generador de números aleatorios de "
-"cifrado.\n"
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Error de procesamiento de la clave (usando «hash» %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "No se puede determinar el tipo de dispositivo. ¿Es incompatible la activación del dispositivo?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Esta operación solamente está disponible para dispositivos LUKS."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "No se puede inicializar el «backend» de cifrado.\n"
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Esta operación solamente está disponible para dispositivos LUKS2."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Todas las ranuras de claves están llenas."
+
+#: lib/setup.c:434
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "Algoritmo «hash» %s no disponible.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "La ranura de claves %d no es válida; seleccione un número entre 0 y %d."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:440
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Error de procesamiento de la clave (usando «hash» %s).\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "La ranura de claves %d está llena; seleccione otra."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"No se puede determinar el tipo de dispositivo. ¿Es incompatible la "
-"activación del dispositivo?\n"
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "El tamaño del dispositivo no está alineado con el tamaño de bloque lógico del dispositivo."
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Cabecera detectada pero el dispositivo %s es demasiado pequeño."
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Esta operación solamente está disponible para dispositivos LUKS.\n"
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Esta operación no está disponible para este tipo de dispositivo."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Todas las ranuras de claves están llenas.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Operación con recifrado en curso no válida."
 
-#: lib/setup.c:327
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr ""
-"La ranura de claves %d no es válida; seleccione un número entre 0 y %d.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "Versión LUKS no disponible %d."
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "El dispositivo de metadatos separado no está disponible para este tipo de cifrado."
 
-#: lib/setup.c:333
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "La ranura de claves %d está llena; seleccione otra.\n"
+msgid "Device %s is not active."
+msgstr "El dispositivo %s no está activo."
 
-#: lib/setup.c:472
+#: lib/setup.c:1444
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Introduzca la frase contraseña de %s: "
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "El dispositivo subyacente asociado al dispositivo cifrado %s ha desaparecido."
 
-#: lib/setup.c:653
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Parámetros de cifrado para modo claro no válidos."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Tamaño de clave no válido."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "El UUID no está disponible para este tipo de cifrado."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Tamaño de sector de cifrado no admitido."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "El tamaño del dispositivo no está alineado con el tamaño del sector solicitado."
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Imposible dar formato LUKS sin dispositivo."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "El alineamiento de datos solicitado no es compatible con el desplazamiento de los datos."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "ATENCIÓN: El desplazamiento de los datos está fuera del dispositivo de datos actualmente disponible.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "Cabecera detectada pero el dispositivo %s es demasiado pequeño.\n"
+msgid "Cannot wipe header on device %s."
+msgstr "No se puede limpiar la cabecera del dispositivo %s."
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Esta operación no está disponible para este tipo de dispositivo.\n"
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "ATENCIÓN: La activación del dispositivo va a fallar; dm-crypt no admite el tamaño de sector de cifrado solicitado.\n"
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "La clave del volumen es demasiado pequeña para cifrado con extensiones de integridad."
+
+#: lib/setup.c:1821
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "El dispositivo %s no está activo.\n"
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "El algoritmo de cifrado %s-%s (tamaño de clave %zd bits) no está disponible."
 
-#: lib/setup.c:925
+#: lib/setup.c:1854
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr ""
-"El dispositivo subyacente asociado al dispositivo cifrado %s ha "
-"desaparecido.\n"
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "ATENCIÓN: el tamaño de los metadatos LUKS2 ha cambiado a %<PRIu64> bytes.\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "ATENCIÓN: el tamaño de la zona de ranuras de claves LUKS2 ha cambiado a %<PRIu64> bytes.\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "El dispositivo %s es demasiado pequeño."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "No se puede dar formato al dispositivo %s en uso."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Parámetros de cifrado para modo claro no válidos.\n"
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "No se puede dar formato al dispositivo %s; permiso denegado."
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "No se puede dar formato a la integridad del dispositivo %s."
+
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "No se puede dar formato al dispositivo %s."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Imposible dar formato LOOPAES sin dispositivo."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Imposible dar formato VERITY sin dispositivo."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "Tipo de «hash» VERITY %d no disponible."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Tamaño de bloque VERITY no disponible."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Desplazamiento «hash» VERITY no disponible."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Desplazamiento FEC VERITY no disponible."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Tamaño de clave no válido.\n"
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "La zona de datos se solapa con la zona «hash»."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "El UUID no está disponible para este tipo de cifrado.\n"
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "La zona «hash» se solapa con la zona FEC."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Imposible dar formato LUKS sin dispositivo.\n"
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "La zona de datos se solapa con la zona FEC."
 
-#: lib/setup.c:1089
+#: lib/setup.c:2208
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "No se puede dar formato al dispositivo %s que todavía está en uso.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "ATENCIÓN: El tamaño de etiqueta de %d bytes solicitado difiere del tamaño de salida de %s (%d bytes).\n"
 
-#: lib/setup.c:1092
+#: lib/setup.c:2286
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "No se puede dar formato al dispositivo %s; permiso denegado.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "El tipo de dispositivo cifrado % solicitado es desconocido."
 
-#: lib/setup.c:1096
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "No se puede limpiar la cabecera del dispositivo %s.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Parámetros no admitidos para el dispositivo %s."
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Imposible dar formato LOOPAES sin dispositivo.\n"
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Parámetros discordantes en el dispositivo %s."
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Los dispositivos de cifrado no concuerdan."
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "Imposible dar formato VERITY sin dispositivo.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "No se ha podido recargar el dispositivo %s."
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Tipo de «hash» VERITY %d no disponible.\n"
+msgid "Failed to suspend device %s."
+msgstr "No se ha podido suspender el dispositivo %s."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Tamaño de bloque VERITY no disponible.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "No se ha podido reanudar el dispositivo %s."
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Desplazamiento «hash» VERITY no disponible.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Error grave durante la recarga del dispositivo %s (por encima del dispositivo %s)."
 
-#: lib/setup.c:1285
+#: lib/setup.c:2735 lib/setup.c:2737
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "El tipo de dispositivo cifrado % solicitado es desconocido.\n"
+msgid "Failed to switch device %s to dm-error."
+msgstr "No se ha podido conmutar el dispositivo %s a dm-error."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "No se ha podido cambiar el tamaño del dispositivo de bucle."
 
-#: lib/setup.c:1435
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "¿Está seguro de que quiere cambiar el UUID del dispositivo?"
 
-#: lib/setup.c:1545
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "El fichero de copia de seguridad de la cabecera no contiene una cabecera LUKS compatible."
+
+#: lib/setup.c:3058
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "El volumen %s no está activo.\n"
+msgid "Volume %s is not active."
+msgstr "El volumen %s no está activo."
 
-#: lib/setup.c:1556
+#: lib/setup.c:3069
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "El volumen %s ya está suspendido.\n"
+msgid "Volume %s is already suspended."
+msgstr "El volumen %s ya está suspendido."
 
-#: lib/setup.c:1563
+#: lib/setup.c:3082
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "La suspensión no está disponible para el dispositivo %s.\n"
+msgid "Suspend is not supported for device %s."
+msgstr "La suspensión no está disponible para el dispositivo %s."
 
-#: lib/setup.c:1565
+#: lib/setup.c:3084
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Error durante la suspensión del dispositivo %s.\n"
+msgid "Error during suspending device %s."
+msgstr "Error durante la suspensión del dispositivo %s."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "EL volumen %s no está suspendido.\n"
+msgid "Volume %s is not suspended."
+msgstr "EL volumen %s no está suspendido."
 
-#: lib/setup.c:1605
+#: lib/setup.c:3146
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "La reanudación no está disponible para el dispositivo %s.\n"
+msgid "Resume is not supported for device %s."
+msgstr "La reanudación no está disponible para el dispositivo %s."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Error durante la reanudación del dispositivo %s.\n"
+msgid "Error during resuming device %s."
+msgstr "Error durante la reanudación del dispositivo %s."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Introduzca la frase contraseña: "
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "La clave de volumen no corresponde a este volumen."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"No se puede añadir ranura de claves; todas las ranuras están desactivadas y "
-"no se ha proporcionado una clave para el volumen.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "No se puede añadir ranura de claves; todas las ranuras están desactivadas y no se ha proporcionado una clave para el volumen."
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Introduzca una frase contraseña cualquiera: "
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "No se ha logrado intercambiar la nueva ranura de claves."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Introduzca una nueva frase contraseña para la ranura de claves: "
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "La ranura de claves %d no es válida."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "La ranura de claves %d no está activa."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "La cabecera del dispositivo se solapa con la zona de datos."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Recifrado en curso. No se puede activar el dispositivo."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "No se ha podido conseguir el bloqueo de recifrado."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "La recuperación del recifrado LUKS2 ha fallado."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Este tipo de dispositivo no se ha inicializado adecuadamente."
 
-#: lib/setup.c:1798
+#: lib/setup.c:4171
 #, c-format
-msgid "Key slot %d changed.\n"
-msgstr "LA ranura de claves %d ha cambiado.\n"
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "No se puede utilizar el dispositivo %s; el nombre no es válido o todavía está en uso."
 
-#: lib/setup.c:1801
+#: lib/setup.c:4174
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Reemplazado con ranura de claves %d.\n"
+msgid "Device %s already exists."
+msgstr "El dispositivo %s ya existe."
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "No se ha logrado intercambiar la nueva ranura de claves.\n"
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Clave de volumen incorrecta para dispositivo no cifrado."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "La clave de volumen no corresponde a este volumen.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "«Hash» raíz incorrecta para dispositivo «verity»."
 
-#: lib/setup.c:1961
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Se requiere la firma «hash» raíz."
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "El llavero de núcleo está ausente: se necesita para pasar la firma al núcleo."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "No se ha podido cargar la clave en el llavero del núcleo."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "El dispositivo %s todavía se está utilizando."
+
+#: lib/setup.c:4516
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "La ranura de claves %d no es válida.\n"
+msgid "Invalid device %s."
+msgstr "Dispositivo inválido %s."
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "El «buffer» de la clave del volumen es demasiado pequeño."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "No se puede recuperar la clave para el dispositivo no cifrado."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "No se puede recuperar el «hash» raíz para dispositivo «verity»."
 
-#: lib/setup.c:1966
+#: lib/setup.c:4659
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "La ranura de claves %d no se está utilizando.\n"
+msgid "This operation is not supported for %s crypt device."
+msgstr "Esta operación no está disponible para el dispositivo cifrado %s."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Operación de volcado no deisponible para este tipo de dispositivo."
+
+#: lib/setup.c:5190
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "El dispositivo %s ya existe.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr "El desplazamiento de datos no es múltiplo de %u bytes."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr "Clave de volumen incorrecta para dispositivo no cifrado.\n"
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "No se puede convertir el dispositivo %s que todavía está en uso."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
-msgstr "«Hash» raíz incorrecta para dispositivo «verity».\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "No se ha logrado asignar la ranura de claves %u como nueva clave del volumen."
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Este tipo de dispositivo no se ha inicializado adecuadamente.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "No se han podido inicializar los parámetros predefinidos de la ranura de claves LUKS2."
 
-#: lib/setup.c:2259
+#: lib/setup.c:5851
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "El dispositivo %s todavía se está utilizando.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "No se ha logrado asignar la ranura de claves %d al resumen."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "El llavero de núcleo no está admitido en el núcleo."
 
-#: lib/setup.c:2268
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Dispositivo inválido %s.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "No se ha podido leer la frase contraseña desde el llavero (error %d)"
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "No se ha podido adquirir el bloqueo de la serialización de acceso duro de memoria global."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "No se puede obtener la prioridad del proceso."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "No se puede desbloquear la memoria."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "No se ha podido abrir el fichero de claves."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Función no disponible en modo FIPS.\n"
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "No se puede leer el fichero de claves desde un terminal."
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "El «buffer» de la clave del volumen es demasiado pequeño.\n"
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "No se ha podido efectuar «stat» sobre el fichero de claves."
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "No se puede recuperar la clave para el dispositivo no cifrado.\n"
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "No es posible situarse en la posición solicitada del fichero de claves."
 
-#: lib/setup.c:2310
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Memoria agotada mientras se estaba leyendo la frase contraseña."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Error al leer la frase contraseña."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "No hay nada para leer en la entrada."
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Se ha excedido el tamaño máximo de fichero de claves."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "No se puede leer la cantidad de datos solicitada."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
 #, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Esta operación no está disponible para el dispositivo cifrado %s.\n"
+msgid "Device %s does not exist or access denied."
+msgstr "El dispositivo %s no existe o el acceso al mismo ha sido denegado."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr "Operación de volcado no deisponible para este tipo de dispositivo.\n"
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "El dispositivo %s no es compatible."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "No se puede obtener la prioridad del proceso.\n"
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "El dispositivo %s es demasiado pequeño. Se necesitan %<PRIu64> bytes como mínimo."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "No se puede desbloquear la memoria.\n"
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "No se puede usar el dispositivo %s porque ya está en uso (asignado o montado)."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Memoria agotada mientras se estaba leyendo la frase contraseña.\n"
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "No se puede utilizar el dispositivo %s; permiso denegado."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Error al leer la frase contraseña desde el terminal.\n"
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "No se puede obtener información del dispositivo %s."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Verifique la frase contraseña: "
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "No se puede utilizar un dispositivo de bucle invertido como usuario no administrador."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "La frase contraseña no coincide.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "No se ha logrado asociar el dispositivo de bucle invertido (hace falta un dispositivo de bucle con marcador de auto-limpieza)."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "No se puede usar «offset» con entrada desde terminal.\n"
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "El «offset» solicitado está más allá del tamaño real del dispositivo %s."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "No se ha podido abrir el fichero de claves.\n"
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "El dispositivo %s tiene tamaño cero."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "No se ha podido efectuar «stat» sobre el fichero de claves.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "El tiempo objetivo máximo de PBKDF no puede ser cero."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr ""
-"No es posible situarse en la posición solicitada del fichero de claves.\n"
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Tipo de PBKDF %s desconocido."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Error al leer la frase contraseña.\n"
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "La «hash» solicitada %s no está disponible."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Se ha excedido el tamaño máximo de fichero de claves.\n"
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "El tipo de PBKDF solicitado no está disponible para LUKS1."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "No se puede leer la cantidad de datos solicitada.\n"
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "No se pueden establecer la memoria máxima de PBKDF ni los hilos paralelos con pbkdf2."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "El dispositivo %s no existe o el acceso al mismo ha sido denegado.\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "El número de iteraciones forzadas es demasiado pequeño para %s (el mínimo es %u)."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr ""
-"No se puede utilizar un dispositivo de bucle invertido como usuario no "
-"administrador.\n"
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "El coste de la memoria forzada es demasiado bajo para %s (el mínimo es %u kilobytes)."
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "El coste de la memoria máxima solicitada de PBKDF es demasiado alto (el máximo es %d kilobytes)."
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "No se ha encontrado ningún dispositivo de bucle invertido libre.\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "La memoria máxima solicitada de PBKDF no puede ser cero."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
-"No se ha logrado asociar el dispositivo de bucle invertido (hace falta un "
-"dispositivo de bucle con marcador de auto-limpieza).\n"
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Los hilos paralelos solicitados de PBKDF no pueden ser cero."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "Solo se admite PBKDF2 en el modo FIPS."
 
-#: lib/utils_device.c:484
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Banco de pruebas PBKDF desactivado pero las iteraciones no están establecidas."
+
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
-msgstr ""
-"No se puede usar el dispositivo %s porque ya está en uso (asignado o "
-"montado).\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Opciones PBKDF2 no compatibles (usando el algoritmo «hash» %s)."
 
-#: lib/utils_device.c:488
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Opciones PBKDF no compatibles."
+
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "No se puede obtener información del dispositivo %s.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Bloqueo abortado. La ruta del bloqueo %s/%s no puede utilizarse (o no es un directorio o no existe)."
 
-#: lib/utils_device.c:494
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr ""
-"El «offset» solicitado está más allá del tamaño real del dispositivo %s.\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "ATENCIÓN: ¡Falta el directorio de bloqueo %s/%s!\n"
 
-#: lib/utils_device.c:502
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "El dispositivo %s tiene tamaño cero.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Bloqueo abortado. La ruta del bloqueo %s/%s no puede utilizarse (%s no es un directorio)."
 
-#: lib/utils_device.c:513
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "No es posible situarse en la posición del dispositivo."
+
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "El dispositivo %s es demasiado pequeño.\n"
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Error al limpiar el dispositivo, desplazamiento %<PRIu64>."
 
-#: lib/luks1/keyencryption.c:37
+#: lib/luks1/keyencryption.c:39
 #, c-format
 msgid ""
 "Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 "No se ha podido establecer asignación de clave dm-crypt al dispositivo %s.\n"
-"Compruebe que el núcleo admite el algoritmo de cifrado %s (consulte syslog "
-"para más información).\n"
-
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "El tamaño de clave en modo XTS debe ser 256 o 512 bits.\n"
-
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
-#, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "No se puede escribir en el dispositivo %s; permiso denegado.\n"
+"Compruebe que el núcleo admite el algoritmo de cifrado %s (consulte syslog para más información)."
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr ""
-"No se ha podido abrir el dispositivo de almacenamiento de claves temporal.\n"
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "El tamaño de clave en modo XTS debe ser 256 o 512 bits."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr ""
-"No se ha podido acceder al dispositivo de almacenamiento de claves "
-"temporal.\n"
+# TODO
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "La especificación de cifrado debería estar en formato [cipher]-[mode]-[iv]."
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Error de entrada/salida mientras se cifraba una ranura de claves.\n"
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "No se puede escribir en el dispositivo %s; permiso denegado."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "No se ha podido abrir el dispositivo de almacenamiento de claves temporal."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "No se ha podido acceder al dispositivo de almacenamiento de claves temporal."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Error de entrada/salida mientras se cifraba una ranura de claves."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "No se puede abrir el dispositivo %s."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "Error de entrada/salida mientras se descifraba una ranura de claves.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Error de entrada/salida mientras se descifraba una ranura de claves."
 
-#: lib/luks1/keymanage.c:90
+#: lib/luks1/keymanage.c:110
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr ""
-"El dispositivo %s es demasiado pequeño. (LUKS necesita %<PRIu64> btyes como "
-"mínimo.)\n"
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "El dispositivo %s es demasiado pequeño. (LUKS1 necesita %<PRIu64> btyes como mínimo.)"
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "La ranura de claves LUKS %u no es válida."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "El dispositivo %s no es un dispositivo LUKS válido.\n"
+msgid "Device %s is not a valid LUKS device."
+msgstr "El dispositivo %s no es un dispositivo LUKS válido."
 
-#: lib/luks1/keymanage.c:198
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr ""
-"El fichero de copia de seguridad de cabecera solicitado %s ya existe.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "El fichero de copia de seguridad de cabecera solicitado %s ya existe."
 
-#: lib/luks1/keymanage.c:200
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "No se puede crear el fichero de copia de seguridad %s.\n"
+msgid "Cannot create header backup file %s."
+msgstr "No se puede crear el fichero de copia de seguridad %s."
 
-#: lib/luks1/keymanage.c:205
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "No se puede escribir en el fichero de copia de seguridad %s.\n"
+msgid "Cannot write header backup file %s."
+msgstr "No se puede escribir en el fichero de copia de seguridad %s."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr ""
-"El fichero de copia de seguridad no contiene una cabecera LUKS válida.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "El fichero de copia de seguridad no contiene una cabecera LUKS válida."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "No se puede abrir el fichero de copia de seguridad de cabecerda %s.\n"
+msgid "Cannot open header backup file %s."
+msgstr "No se puede abrir el fichero de copia de seguridad de cabecerda %s."
 
-#: lib/luks1/keymanage.c:258
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "No se puede leer el fichero de copia de seguridad de cabecerda %s.\n"
+msgid "Cannot read header backup file %s."
+msgstr "No se puede leer el fichero de copia de seguridad de cabecerda %s."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"La posición de los datos o el tamaño de la clave no coinciden en el "
-"dispositivo y en la copia de seguridad.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "La posición de los datos o el tamaño de la clave no coinciden en el dispositivo y en la copia de seguridad."
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Dispositivo %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"no contiene cabecera LUKS. Reemplazar la cabecera puede destruir los datos "
-"en ese dispositivo."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "no contiene cabecera LUKS. Reemplazar la cabecera puede destruir los datos en ese dispositivo."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"ya contiene cabecera LUKS. Reemplazar la cabecera destruirá las ranuras de "
-"claves existentes."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "ya contiene cabecera LUKS. Reemplazar la cabecera destruirá las ranuras de claves existentes."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
 msgstr ""
 "\n"
-"ATENCIÓN: ¡la cabecera del dispositivo real tiene un UUID distinto que el de "
-"la copia de seguridad!"
-
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "No se puede abrir el dispositivo %s.\n"
-
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr ""
-"El tamaño de la clave no es estándar; se requiere una reparación manual.\n"
+"ATENCIÓN: ¡la cabecera del dispositivo real tiene un UUID distinto que el de la copia de seguridad!"
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
-"El alineamiento de las ranuras de claves no es estándar; se requiere una "
-"reparación manual.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "El tamaño de la clave no es estándar; se requiere una reparación manual."
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Reparando ranuras de claves.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "El alineamiento de las ranuras de claves no es estándar; se requiere una reparación manual."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "La reparación ha fallado."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Reparando ranuras de claves."
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Ranura de claves %i: posición reparada (%u -> %u).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Ranura de claves %i: posición reparada (%u -> %u)."
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Ranura de claves %i: bandas reparadas (%u -> %u).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Ranura de claves %i: bandas reparadas (%u -> %u)."
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Ranura de claves %i: la firma de la partición es falsa.\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Ranura de claves %i: la firma de la partición es falsa."
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Ranura de claves %i: «salt wiped».\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Ranura de claves %i: «salt wiped»."
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "Escribiendo cabecera LUKS en el disco.\n"
-
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Versión LUKS no disponible %d.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Escribiendo cabecera LUKS en el disco."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "La «hash» LUKS solicitada %s no está disponible.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "La reparación ha fallado."
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "La ranura de claves LUKS %u no es válida.\n"
-
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "No se ha detectado ningún problema en la cabecera LUKS.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "La «hash» LUKS solicitada %s no está disponible."
 
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Error al actualizar la cabecera LUKS en el dispositivo %s.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "No se ha detectado ningún problema en la cabecera LUKS."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Error al leer la cabecera LUKS después de actualizarla en el dispositivo "
-"%s.\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Error al actualizar la cabecera LUKS en el dispositivo %s."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keymanage.c:668
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"La posición de los datos de una cabecera LUKS separada debe ser 0 o superior "
-"al tamaño de la cabecera (%d sectores).\n"
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Error al leer la cabecera LUKS después de actualizarla en el dispositivo %s."
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "El formato de UUID LUKS proporcionado es incorrecto.\n"
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "La posición de los datos de una cabecera LUKS debe ser 0 o superior al tamaño de la cabecera."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-"No se puede crear la cabecera LUKS: fallo en la lectura «random salt».\n"
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "El formato de UUID LUKS proporcionado es incorrecto."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Opciones PBKDF2 no compatibles (usando el algoritmo «hash» %s).\n"
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "No se puede crear la cabecera LUKS: fallo en la lectura «random salt»."
 
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"No se puede crear la cabecera LUKS: fallo en la cabecera (usando «hash» "
-"%s).\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "No se puede crear la cabecera LUKS: fallo en la cabecera (usando «hash» %s)."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "La ranura de claves %d está activa; primero hay que purgar.\n"
+msgid "Key slot %d active, purge first."
+msgstr "La ranura de claves %d está activa; primero hay que purgar."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"El material de la ranura de claves %d no tiene suficientes bandas. Quizá se "
-"haya manipulado la cabecera.\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "El material de la ranura de claves %d no tiene suficientes bandas. Quizá se haya manipulado la cabecera."
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:990
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Ranura de claves %d desbloqueada.\n"
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "No se puede abrir la ranura de claves (usando «hash» %s)."
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "No hay ninguna clave disponible con esa frase contraseña.\n"
-
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr ""
-"La ranura %d no es válida; seleccione una ranura de claves entre 0 y %d.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "La ranura %d no es válida; seleccione una ranura de claves entre 0 y %d."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "No se puede limpiar el dispositivo %s.\n"
+msgid "Cannot wipe device %s."
+msgstr "No se puede limpiar el dispositivo %s."
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr ""
-"Se ha detectado un fichero de claves cifrado con GPG que el programa no "
-"puede procesar en la actualidad.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Se ha detectado un fichero de claves cifrado con GPG que el programa aún no no puede procesar."
 
 #: lib/loopaes/loopaes.c:147
 msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
-msgstr ""
-"Utilice 'gpg --decrypt <FICHERO-DE-CLAVES> | cryptsetup --keyfile=- ...'\n"
+msgstr "Utilice 'gpg --decrypt <FICHERO-DE-CLAVES> | cryptsetup --keyfile=- ...'\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Se ha detectado un fichero de claves incompatible con «loop-AES».\n"
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Se ha detectado un fichero de claves incompatible con «loop-AES»."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr "El núcleo no admite asignación compatible con «loop-AES».\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "El núcleo no admite asignación compatible con «loop-AES»."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Error leyendo el fichero de claves %s.\n"
+msgid "Error reading keyfile %s."
+msgstr "Error leyendo el fichero de claves %s."
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/tcrypt/tcrypt.c:554
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr ""
-"Se ha excedido la longitud máxima (%d) de la frase contraseña TCRYPT.\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Se ha excedido la longitud máxima (%zu) de la frase contraseña TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr ""
-"El algoritmo «hash» %s no está disponible, por lo que se ha ignorado.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "El algoritmo «hash» %s no está disponible, por lo que se ha ignorado."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr "La interfaz de cifrado del núcleo requerida no está disponible.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "La interfaz de cifrado del núcleo requerida no está disponible."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr "Asegúrese de que el módulo del núcleo algof_skcipher está cargado.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Asegúrese de que el módulo del núcleo algof_skcipher está cargado."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "No es posible la activación para el tamaño de sector %d.\n"
+msgid "Activation is not supported for %d sector size."
+msgstr "No es posible la activación para el tamaño de sector %d."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr "El núcleo no dispone de activación para este modo antiguo TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "El núcleo no dispone de activación para este modo antiguo TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "Activando el sistema de cifrado TCRYPT para la partición %s.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Activando el sistema de cifrado TCRYPT para la partición %s."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr "El núcleo no admite asignación compatible con TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "El núcleo no admite asignación compatible con TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Esta función no está disponible sin carga de cabecera TCRYPT."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "El tipo de entrada de metadatos '%u' no esperado se ha encontrado mientras se analizaba la clave maestra del volumen soportado."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Se ha encontrado una cadena no válida mientras se analizaba la clave maestra del volumen."
+
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "El dispositivo «verity» %s no utiliza cabecera en disco.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Se ha encontrado una cadena no esperada ('%s') mientras se analizaba la clave maestra del volumen soportado."
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:399
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "El dispositivo %s no es un dispositivo VERITY válido.\n"
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "El valor de entrada de metadatos '%u' no esperado se ha encontrado mientras se analizaba la clave maestra del volumen soportado."
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:479
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "Versión VERITY %d no disponible.\n"
+msgid "Failed to read BITLK signature from %s."
+msgstr "No se ha podido leer la firma BITLK de %s."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "BITLK versión 1 no está admitido actualmente."
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "Cabecera VERITY corrupta.\n"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Firma de arranque no válida o desconocida para el dispositivo BITLK"
 
-#: lib/verity/verity.c:166
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Firma no válida o desconocida para el dispositivo BITLK"
+
+#: lib/bitlk/bitlk.c:510
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr ""
-"El formato UUID VERITY proporcionado en el dispositivo %s es incorrecto.\n"
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Tamaño de sector no admitido %<PRIu16>."
 
-#: lib/verity/verity.c:196
+#: lib/bitlk/bitlk.c:518
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Error al actualizar la cabecera «verity» en el dispositivo %s.\n"
+msgid "Failed to read BITLK header from %s."
+msgstr "No se ha podido leer la cabecera BITLK de %s."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "El núcleo no dispone de asignación «dm-verity».\n"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "No se han podido leer los metadatos BITLK FVE de %s."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr ""
-"El dispositivo «verity» ha detectado algo corrupto después de la "
-"activación.\n"
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Tipo de cifrado desconocido o no admitido."
 
-#: lib/verity/verity_hash.c:59
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "El área de reserva no tiene ceros en la posición %<PRIu64>.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "No se han podido leer las entradas de los metadatos BITLK de %s."
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Desbordamiento de la posición del dispositivo.\n"
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Esta operación no está disponible."
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "La verificación ha fallado en la posición %<PRIu64>.\n"
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Tamaño de clave incorrecto."
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Parámetros de tamaño inválido para un dispositivo «verity».\n"
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Este dispositivo BITLK se encuentra en un estado en el que no puede activarse."
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Demasiados niveles de arborescencia en el volumen «verity».\n"
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "Los dispositivos BITLK con tipo '%s' no puede activarse."
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "Fallo en la verificación del área de datos.\n"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "La activación de un dispositivo BITLK parcialmente descifrado no puede hacerse."
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "Fallo en la verificación de la «hash» raíz.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "No se puede activar el dispositivo; el dm-crypt del núcleo no sirve para BITLK IV."
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr "Error de entrada/salida al crear el área «hash».\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "No se puede activar el dispositivo; el dm-crypt del núcleo no sirve para difusor BITLK «Elephant»."
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "La creación del área «hash» ha fallado.\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "El dispositivo «verity» %s no utiliza cabecera en disco."
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity.c:90
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-"ATENCIÓN: el núcleo no puede activar un dispositivo si el tamaño del bloque "
-"de datos excede el tamaño de página (%u).\n"
+msgid "Device %s is not a valid VERITY device."
+msgstr "El dispositivo %s no es un dispositivo VERITY válido."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr ""
-"No se puede hacer verificación de frase contraseña en entradas no tty.\n"
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Versión VERITY %d no disponible."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr ""
-"No se ha detectado ningún patrón conocido de especificación de cifrado.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Cabecera VERITY corrupta."
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
-msgstr ""
-"ATENCIÓN: No se va a hacer caso del parámetro --hash en modo no cifrado con "
-"el fichero de claves especificado.\n"
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "El formato UUID VERITY proporcionado en el dispositivo %s es incorrecto."
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
-msgstr ""
-"ATENCIÓN: No se va a hacer caso de la opción --keyfile-size; el tamaño de "
-"lectura es igual al tamaño de la clave de cifrado.\n"
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Error al actualizar la cabecera «verity» en el dispositivo %s."
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "Es necesaria la opción --key-file.\n"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "La verificación de firma «hash» raíz solicitada no está disponible."
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr ""
-"No se ha detectado ninguna cabecera de dispositivo con esa frase "
-"contraseña.\n"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Los errores no pueden repararse con dispositivo FEC."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
-msgstr ""
-"El volcado de la cabecera con la clave del volumen es información\n"
-"sensible que permite el acceso a una partición cifrada sin frase "
-"contraseña.\n"
-"Este volcado debería almacenarse siempre cifrado en un lugar seguro."
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Se han encontrado %u errores reparables con dispositivo FEC."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "El resultado de la comparativa no es fiable.\n"
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "El núcleo no dispone de asignación «dm-verity»."
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr ""
-"# Las pruebas son solo aproximadas usando memoria (no hay entrada/salida de "
-"almacenadmiento).\n"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "El núcleo no dispone de opción de firma «dm-verity»."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "# Algoritmo | Clave | Cifrado | Descifrado\n"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "El dispositivo «verity» ha detectado algo corrupto después de la activación."
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "El algoritmo de cifrado %s no está disponible.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "El área de reserva no tiene ceros en la posición %<PRIu64>."
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "/N/A"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Desbordamiento de la posición del dispositivo."
 
-#: src/cryptsetup.c:639
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "No se puede leer el fichero de claves %s.\n"
+msgid "Verification failed at position %<PRIu64>."
+msgstr "La verificación ha fallado en la posición %<PRIu64>."
 
-#: src/cryptsetup.c:643
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Parámetros de tamaño inválido para un dispositivo «verity»."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Desbordamiento del área «hash»."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Fallo en la verificación del área de datos."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Fallo en la verificación de la «hash» raíz."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Error de entrada/salida al crear el área «hash»."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "La creación del área «hash» ha fallado."
+
+#: lib/verity/verity_hash.c:433
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "No se pueden leer %d «bytes» en el fichero de claves %s.\n"
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "ATENCIÓN: el núcleo no puede activar un dispositivo si el tamaño del bloque de datos excede el tamaño de página (%u)."
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr ""
-"¿Está seguro de que quiere intentar reparar la cabecera del dispositivo LUKS?"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "No se ha podido asignar contexto RS."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "No se ha podido asignar «buffer»."
+
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Esto sobreescribirá los datos en %s de forma irrevocable."
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "No se ha podido leer el bloque RS %<PRIu64> byte %d."
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "No se ha podido leer la paridad para el bloque RS %<PRIu64>."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "error de reserva de memoria en action_luksFormat"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "No se ha podido reparar la paridad para el bloque %<PRIu64>."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity_fec.c:188
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "No se puede utilizar %s como cabecera en disco.\n"
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "No se ha podido escribir la paridad para el bloque RS %<PRIu64>."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
-"La posición de datos reducida está permitida solamente para cabecera LUKS "
-"separada.\n"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Los tamaños de bloque deben coincidir para FEC."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Número no válido de bytes de paridad."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity_fec.c:265
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "La ranura de claves %d se va a borrar.\n"
+msgid "Failed to determine size for device %s."
+msgstr "No se ha podido determinar el tamaño para el dispositivo %s."
 
-#: src/cryptsetup.c:884
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "El núcleo no dispone de asociación «dm-integrity»."
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "El núcleo no dispone de alineamiento de metadatos fijo «dm-integrity»."
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "La clave %d no está activa. No se puede limpiar.\n"
+msgid "Failed to acquire write lock on device %s."
+msgstr "No se ha podido adquirir el bloqueo de escritura del dispositivo %s."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Se ha detectado un intento de actualizar los metadatos LUKS2 concurrentemente. Se aborta la operación."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
 msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
-"Esta es la última ranura de claves. El dispositivo quedará inutilizado "
-"después de purgar esta clave."
-
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Introduzca cualquier frase contraseña que quede: "
+"El dispositivo contiene firmas ambiguas; no se puede autorecuperar LUKS2.\n"
+"Por favor, ejecute \"cryptsetup repair\" para recuperación."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Introduzca la frase contraseña que hay que borrar: "
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "El desplazamiento de datos solicitado es demasiado pequeño."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Introduzca cualquier frase contraseña que exista: "
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "ATENCIÓN: la zona de ranuras de claves (%<PRIu64> bytes) es muy pequeña; el número de ranuras de claves LUKS2 disponibles es muy limitado.\n"
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Introduzca la frase contraseña que hay que cambiar: "
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "No se ha podido adquirir el bloqueo de lectura para el dispositivo %s."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Introduzca una nueva frase contraseña: "
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Se han detectado requisitos prohibidos para LUKS2 en la copia de seguridad %s."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr "La operación isLuks solo admite un argumento de dispositivo.\n"
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "La posición de los datos no coinciden en el dispositivo y en la copia de seguridad; ha fallado la restauración."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Es necesaria la opción --header-backup-file.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "La cabecera binaria con el tamaño de las áreas de ranuras de claves no coinciden en el dispositivo y en la copia de seguridad; la restauración ha fallado."
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:1221
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Tipo de dispositivo de metadatos %s no reconocido.\n"
+msgid "Device %s %s%s%s%s"
+msgstr "Dispositivo %s %s%s%s%s"
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "no contiene cabecera LUKS2. Reemplazar la cabecera puede destruir los datos en ese dispositivo."
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "ya contiene cabecera LUKS2. Reemplazar la cabecera destruirá las ranuras de claves existentes."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"Esta orden necesita como argumentos el dispositivo y el nombre asociado.\n"
+"\n"
+"AVISO: ¡Se han detectado requisitos LUKS2 desconocidos en cabecera de\n"
+"dispositivo real! Reemplazar la cabecera con la copia de seguridad puede\n"
+"corromper los datos en ese dispositivo!"
 
-#: src/cryptsetup.c:1326
-#, c-format
+#: lib/luks2/luks2_json_metadata.c:1227
 msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
 msgstr ""
-"Esta operación borrará todas las ranuras de claves en el dispositivo %s.\n"
-"El dispositivo quedará inutilizable después de esta operación."
+"\n"
+"AVISO: ¡Se ha detectado recifrado «offline» no terminado en el dispositivo!\n"
+"¡Reemplazar la cabecera con la copia de seguridad puede corromper los datos!"
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<dispositivo> [--type <tipo> [<nombre>]"
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Se hará caso omiso del indicador desconocido %s."
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "abrir el dispositivo como asociado a <nombre>"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Falta la clave para el segmento dm-crypt %u"
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "No se ha podido establecer el segmento de dm-crypt."
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "No se ha podido establecer el segmento de dm-linear."
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Configuración de integridad de dispositivo no admitida."
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Recifrado en curso. No se puede desactivar el dispositivo."
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "No se ha podido reemplazar el dispositivo suspendido %s con el objetivo dm-error."
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "No se ha podido leer los requisitos LUKS2."
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Se han detectado requisitos LUKS2 no satisfechos."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Operación incompatible con dispositivo marcado para recifrado obsoleto. Se aborta."
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Operación incompatible con dispositivo marcado para recifrado LUKS2. Se aborta."
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "No hay memoria disponible suficiente para abrir una ranura de claves."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Fallo al abrir la ranura de claves."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "No se puede utilizar el algoritmo de cifrado %s-%s para el cifrado de ranuras de clave."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "No hay espacio para la nueva ranura de claves."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "No se puede comprobar el estado del dispositivo con uuid: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Imposible convertir cabecera con metadatos adicionales LUKSMETA."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Imposible mover el área de la ranura de claves. No hay suficiente espacio."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Imposible mover el área de la ranura de claves. Área de ranuras de clave LUKS2 demasiado pequeña."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Imposible mover el área de la ranura de claves."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "No se puede convertir a formato LUKS1 - el tamaño predefinido de sector de cifrado del segmento no es 512 bytes."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "No se puede convertir a formato LUKS1 - los resúmenes de rarunas de claves no son compatibles con LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "No se puede convertir a formato LUKS1 - el dispositivo utiliza el cifrado de clave encapsulado %s."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "No se puede convertir a formato LUKS1 - la cabecera LUKS2 contiene %u «token(s)»."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "No se puede convertir a formato LUKS1 - la ranura de claves %u está en un estado no válido."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "No se puede convertir a formato LUKS1 - la ranura %u (sobre las ranuras máximas) todavía está activa."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "No se puede convertir a formato LUKS1 - la ranura de claves %u no es compatible con LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "El tamaño de la zona activa debe ser múltiplo del alineamiento de zona calculado (%zu bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "El tamaño del dispositivo debe ser múltiplo del alineamiento de zona calculado (%zu bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Modo de resiliencia %s no admitido."
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "No se ha podido inicializar la envoltura antigua de almacenamiento del segmento."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "No se ha podido inicializar la envoltura nueva de almacenamiento del segmento."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "No se han podido leer las sumas de comprobación para la zona activa actual."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "No se ha podido leer la zona activa que comienza en %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "No se ha podido descifrar el sector %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "No se ha podido recuperar el sector %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Los tamaños de los dispositivos origen y destino no coinciden. Origen %<PRIu64>, destino: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "No se ha podido activar el dispositivo con zona activa %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "No se ha podido activar el dispositivo de superposición %s con la tabla de orígenes actual."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "No se ha podido cargar el nuevo mapa para el dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "No se ha podido refrescar la pila del dispositivo de recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "No se ha logrado establecer el tamaño de las nuevas ranuras de claves."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "El desplazamiento de datos no está alineado con el tamaño del sector de cifrado solicitado (%<PRIu32> bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "El dispositivo de datos no está alineado con el tamaño del sector de cifrado solicitado (%<PRIu32> bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "El desplazamiento de datos (%<PRIu64> sectores) es menor que el desplazamiento de datos futuros (%<PRIu64> sectores)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "No se ha podido abrir %s en modo exclusivo (ya está asignado o montado)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "El dispositivo no está marcado para recifrado LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "No se ha podido cargar el contexto del recifrado LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "No se ha podido obtener el estado del recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "El dispositivo no está en recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "El proceso de recifrado ya está en marcha."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "No se ha podido adquirir el bloqueo de recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "No se puede proceder con el recifrado. Ejecute primero la recuperación de recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "El tamaño del dispositivo activo y el tamaño de recifrado solicitado no coinciden."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "El tamaño de dispositivo solicitado en los parámetros de recifrado no es válido."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Recifrado en proceso. No se puede llevar a cabo una recuperación."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "Recifrado LUKS2 ya inicializado en los metadatos."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "No se ha podido inicializar el recifrado LUKS2 en los metadatos."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "No se han podido establecer los segmentos del dispositivo para la siguiente zona activa de recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "No se han podido escribir los metadatos de resiliencia de recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "El descifrado ha fallado."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "No se ha podido escribir la zona activa que comienza en %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "No se han podido sincronizar los datos."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "No se han podido actualizar los metadatos tras completar la zona activa de recifrado actual."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "No se han podido escribir los metadatos de LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "No se han podido limpiar los datos de segmentos de respaldo."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "No se ha podido desactivar el indicador del requisito de descifrado."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Error fatal mientras se recifraba una porción que comienza en %<PRIu64>, de %<PRIu64> sectores de longitud."
+
+# No sé cómo traducir 'error target'.
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "No reanudar el dispositivo a menos que se reemplace con «error target» manualmente."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "No se puede proceder con el recifrado. Estado de recifrado inesperado."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Contexto de recifrado ausente o no válido."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "No se ha podido inicializar la pila del dispositivo de recifrado."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "No se ha podido actualizar el contexto de recifrado."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "No hay ninguna ranura de «token» libre."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "No se ha podido crear el «token» interno %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "No se puede hacer verificación de frase contraseña en entradas no tty."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Los parámetros de cifrado de ranura de claves solo pueden configurarse para dispositivos LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "No se ha detectado ningún patrón conocido de especificación de cifrado."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "ATENCIÓN: No se va a hacer caso del parámetro --hash en modo no cifrado con el fichero de claves especificado.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "ATENCIÓN: No se va a hacer caso de la opción --keyfile-size; el tamaño de lectura es igual al tamaño de la clave de cifrado.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Se ha(n) detectado firma(s) de dispositivo en %s. Si se prosigue, pueden dañarse los datos existentes."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Operación abortada.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Es necesaria la opción --key-file."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Introduzca PIM de VeraCrypt: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Valor de PIM no válido: error de análisis."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Valor de PIM no válido: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Valor de PIM no válido: fuera de rango."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "No se ha detectado ninguna cabecera de dispositivo con esa frase contraseña."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "El dispositivo %s no es un dispositivo BITLK válido."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"El volcado de la cabecera con la clave del volumen es información\n"
+"sensible que permite el acceso a una partición cifrada sin frase contraseña.\n"
+"Este volcado debería almacenarse siempre cifrado en un lugar seguro."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "El dispositivo %s todavía está activo y programado para borrado diferido.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "El cambio de tamaño del dispositivo activo requiere clave de volumen en el llavero pero la opción --disable-keyring está puesta."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Comparativa interrumpida."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     N/A\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u iteraciones por segundo para clave de %zu bits\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s N/A\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u iteraciones, %5u memora, %1u hilos paralelos (CPUs) para clave de %zu bits (tiempo solicitado %u ms)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "El resultado de la comparativa no es fiable."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Las pruebas son solo aproximadas usando memoria (no hay entrada/salida de almacenadmiento).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s Algoritmo |     Clave |         Cifrado |      Descifrado\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "El algoritmo de cifrado %s (con clave de %i bits) no está disponible."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#     Algoritmo |     Clave |         Cifrado |      Descifrado\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "/N/A"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Parece que el dispositivo no necesita recuperación del recifrado.\n"
+"¿Desea continuar de todos modos?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "¿Está seguro de proceder con la recuperación del recifrado LUKS2?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Introduzca la frase contraseña para la recuperación del recifrado: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "¿Está seguro de que quiere intentar reparar la cabecera del dispositivo LUKS?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Limpieza de dispositivo para inicializar la suma de comprobación de integridad.\n"
+"Puede interrumpirse pulsando CTRL+c (el resto de dispositivo no limpiado contendrá sumas de comprobación no válidas.\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "No se puede desactivar el dispositivo temporal %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "La opción de integridad solo puede utilizarse para formato LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Opciones de tamaño de metadatos LUKS2 no admitidas."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "No se puede crear el fichero de cabecera %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "No se ha detectado ningún patrón conocido de especificación de integridad."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "No se puede utilizar %s como cabecera en disco."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Esto sobreescribirá los datos en %s de forma irrevocable."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "No se han podido establecer los parámetros pbkdf."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "La posición de datos reducida está permitida solamente para cabecera LUKS separada."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "No se puede determinar el tamaño de la clave del volumen para LUKS2 sin ranuras de claves; utilice la opción --key-size."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Dispositivo activado pero los indicadores no pueden hacerse persistentes."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "La ranura de claves %d se va a borrar."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Esta es la última ranura de claves. El dispositivo quedará inutilizado después de purgar esta clave."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Introduzca cualquier frase contraseña que quede: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Operación abortada; la ranura de claves NO estaba limpia.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Introduzca la frase contraseña que hay que borrar: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Introduzca una nueva frase contraseña para la ranura de claves: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Introduzca cualquier frase contraseña que exista: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Introduzca la frase contraseña que hay que cambiar: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Introduzca una nueva frase contraseña: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Introduzca la frase contraseña para la ranura de claves que se va a convertir: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "La operación isLuks solo admite un argumento de dispositivo."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"El volcado de la cabecera con la clave del volumen es información\n"
+"sensible que permite el acceso a una partición cifrada sin frase contraseña.\n"
+"Este volcado debería almacenarse cifrado en un lugar seguro."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "La ranura de claves %d no contiene clave independiente."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"El volcado de la cabecera con clave independiente del volumen es información\n"
+"sensible. Este volcado debería almacenarse cifrado en un lugar seguro."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Es necesaria la opción --header-backup-file."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s no es un dispositivo gestionable por cryptsetup."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "El refresco no está disponible para el tipo de dispositivo %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Tipo de dispositivo de metadatos %s no reconocido."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Esta orden necesita como argumentos el dispositivo y el nombre asociado."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Esta operación borrará todas las ranuras de claves en el dispositivo %s.\n"
+"El dispositivo quedará inutilizable después de esta operación."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Operación abortada; las ranuras de claves NO estaban limpias.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Tipo LUKS no válido; solo se admiten luks1 y luks2."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "El dispositivo ya es de tipo %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Esta operación convertirá el formato %s a %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Operación abortada; el dispositivo NO estaba convertido.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Falta la opción --priority, --label o --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "El «token» %d no es válido."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "El «token» %d está en uso."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "No se ha podido añadir el «token» %d al llavero luks."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "No se ha logrado asignar el «token» %d a la ranura de claves %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "El «token» %d no está en uso."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "No se ha podido importar el «token» del fichero."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "No se ha logrado obtener el «token» %d para exportar."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "El parámetro --key-description es obligatorio para la acción de añadir «token»."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "La acción requiere un «token» específico. Utilice el parámetro --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Operación de «token» no válida %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Se ha detectado automáticamente el dispositivo dm activo '%s' para el dispositivo de datos %s.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "El dispositivo %s no es un dispositivo de bloques.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "No se han podido detectar automáticamente los propietarios del dispositivo %s."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Imposible decidir si el dispositivo %s está activado o no.\n"
+"¿Está seguro de que desea proceder con el recifrado en modo «offline»?\n"
+"Puede provocarse corrupción de datos si el dispositivo está realmente\n"
+"activado. Para realizar recifrado en modo «online», utilice en su lugar\n"
+"el parámetro --active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Tipo de dispositivo LUKS no válido."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "El cifrado sin cabecera separada (--header) no es posible sin reducción del tamaño del dispositivo de datos (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "El desplazamiento de datos solicitado debe ser menor o igual que la mitad del parámetro --reduce-device-size."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Ajustando el valor de --reduce-device-size al doble de --offset %<PRIu64> (sectores).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "El cifrado solo puede hacerse con formato LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "Se ha detectado un dispositivo LUKS en %s. ¿Desea cifrar de nuevo ese dispositivo LUKS?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "El fichero de cabecera temporal %s ya existe. Se aborta."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "No se puede crear el fichero de cabecera temporal %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s ahora está activo y preparado para cifrado «online».\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "No hay suficientes ranuras de claves para el recifrado."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "El fichero de claves solo puede usarse con --key-slot o con una sola ranura de claves activa exactamente."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Introduzca la frase contraseña para la ranura de claves %d: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Introduzca la frase contraseña para la ranura de claves %u: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Esta orden necesita un dispositivo como argumento."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "Actualmente solo se admite el formato LUKS2. Utilice la herramienta cryptsetup-reencrypt para LUKS1."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Ya hay un recifrado «offline» heredado en proceso. Utilice la utilidad cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "El recifrado de dispositivo con perfil de integridad no está admitido."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "El recifrado LUKS2 ya está inicializado. Se aborta la operación."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "El dispositivo LUKS2 no está en recifrado."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<dispositivo> [--type <tipo> [<nombre>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "abrir el dispositivo como <nombre>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
 msgid "<name>"
 msgstr "<nombre>"
 
-#: src/cryptsetup.c:1361
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
 msgid "close device (remove mapping)"
 msgstr "cerrar dispositivo (eliminar asociación)"
 
-#: src/cryptsetup.c:1362
+#: src/cryptsetup.c:3348
 msgid "resize active device"
 msgstr "cambiar el tamaño del dispositivo activo"
 
-#: src/cryptsetup.c:1363
+#: src/cryptsetup.c:3349
 msgid "show device status"
 msgstr "mostrar el estado del dispositivo"
 
-#: src/cryptsetup.c:1364
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cypher <algoritmo_de_cifrador>]"
+
+#: src/cryptsetup.c:3350
 msgid "benchmark cipher"
 msgstr "algoritmo de cifrado para pruebas"
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
 msgid "<device>"
 msgstr "<dispositivo>"
 
-#: src/cryptsetup.c:1365
+#: src/cryptsetup.c:3351
 msgid "try to repair on-disk metadata"
 msgstr "intentar reparar metadatos en disco"
 
-#: src/cryptsetup.c:1366
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "recifrar dispositivo LUKS2"
+
+#: src/cryptsetup.c:3353
 msgid "erase all keyslots (remove encryption key)"
 msgstr "borrar todas las ranuras de claves (eliminar clave de cifrado)"
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "convertir formato LUKS de/en LUKS2"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "establecer opciones de configuración permanentes para LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
 msgid "<device> [<new key file>]"
 msgstr "<dispositivo> [<nuevo fichero de claves>]"
 
-#: src/cryptsetup.c:1367
+#: src/cryptsetup.c:3356
 msgid "formats a LUKS device"
 msgstr "da formato a un dispositivo LUKS"
 
-#: src/cryptsetup.c:1368
+#: src/cryptsetup.c:3357
 msgid "add key to LUKS device"
 msgstr "añadir clave a un dispositivo LUKS"
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
 msgid "<device> [<key file>]"
 msgstr "<dispositivo> [<fichero de claves>]"
 
-#: src/cryptsetup.c:1369
+#: src/cryptsetup.c:3358
 msgid "removes supplied key or key file from LUKS device"
-msgstr ""
-"elimina la clave suministrada o el fichero de claves del dispositivo LUKS"
+msgstr "elimina la clave suministrada o el fichero de claves del dispositivo LUKS"
 
-#: src/cryptsetup.c:1370
+#: src/cryptsetup.c:3359
 msgid "changes supplied key or key file of LUKS device"
-msgstr ""
-"cambia la clave suministrada o el fichero de claves del dispositivo LUKS"
+msgstr "cambia la clave suministrada o el fichero de claves del dispositivo LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "convierte una clave a los nuevos parámetros pbkdf"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3361
 msgid "<device> <key slot>"
 msgstr "<dispositivo> <ranura de claves>"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3361
 msgid "wipes key with number <key slot> from LUKS device"
 msgstr "borra la clave con el número <ranura de clave> del dispositivo LUKS"
 
-#: src/cryptsetup.c:1372
+#: src/cryptsetup.c:3362
 msgid "print UUID of LUKS device"
 msgstr "imprimir el UUID del dispositivo LUKS"
 
-#: src/cryptsetup.c:1373
+#: src/cryptsetup.c:3363
 msgid "tests <device> for LUKS partition header"
 msgstr "comprueba si <dispositivo> tiene cabecera de partición LUKS"
 
-#: src/cryptsetup.c:1374
+#: src/cryptsetup.c:3364
 msgid "dump LUKS partition information"
 msgstr "volcar información sobre la partición LUKS"
 
-#: src/cryptsetup.c:1375
+#: src/cryptsetup.c:3365
 msgid "dump TCRYPT device information"
 msgstr "volcar información sobre el dispositivo TCRYPT"
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"Suspender el dispositivo LUKS y limpiar la clave (todas las entradas/salidas "
-"congeladas)."
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "volcar información sobre el dispositivo BITLK"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Suspender el dispositivo LUKS y limpiar la clave (todas las entradas/salidas congeladas)."
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
 msgstr "Reanudar el dispositivo LUKS suspendido."
 
-#: src/cryptsetup.c:1378
+#: src/cryptsetup.c:3369
 msgid "Backup LUKS device header and keyslots"
-msgstr ""
-"Hacer copia de seguridad de la cabecera y de las ranuras de claves del "
-"dispositivo LUKS"
+msgstr "Hacer copia de seguridad de la cabecera y de las ranuras de claves del dispositivo LUKS"
 
-#: src/cryptsetup.c:1379
+#: src/cryptsetup.c:3370
 msgid "Restore LUKS device header and keyslots"
 msgstr "Restaurar la cabecera y las ranuras de claves del dispositivo LUKS"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<añade|elimina|importa|exporta> <dispositivo>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Manipular «tokens» LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
 msgid ""
 "\n"
 "<action> is one of:\n"
@@ -1215,20 +2395,19 @@ msgstr ""
 "\n"
 "<acción> es una de:\n"
 
-#: src/cryptsetup.c:1402
+#: src/cryptsetup.c:3395
 msgid ""
 "\n"
 "You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 msgstr ""
 "\n"
-"También se pueden utilizar los alias del tipo <acción> de la antigua "
-"sintaxis:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"También se pueden utilizar los alias del tipo <acción> de la antigua sintaxis:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 
-#: src/cryptsetup.c:1406
+#: src/cryptsetup.c:3399
 #, c-format
 msgid ""
 "\n"
@@ -1240,425 +2419,748 @@ msgstr ""
 "\n"
 "<nombre> es el dispositivo que se va a crear en %s\n"
 "<dispositivo> es el dispositivo cifrado\n"
-"<ranura de claves> es el número de la ranura de claves que se va a "
-"modificar\n"
-"<fichero de claves> fichero de claves opcional para la nueva clave para la "
-"acción 'luksAddKey'\n"
+"<ranura de claves> es el número de la ranura de claves que se va a modificar\n"
+"<fichero de claves> fichero de claves opcional para la nueva clave para la acción 'luksAddKey'\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"El formato de metadatos predefinido de fábrica es %s (para la acción luksFormat).\n"
 
-#: src/cryptsetup.c:1413
+#: src/cryptsetup.c:3411
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
 msgstr ""
 "\n"
 "Parámetros predefinidos de fábrica de clave y de frase contraseña:\n"
-"\tTamaño máximo del fichero de claves: %dk8, Longitud máxima de frase "
-"contraseña interactiva: %d (caracteres)\n"
-"Tiempo PBKDF2 de iteración de LUKS predefinido: %d (ms)\n"
+"\tTamaño máximo del fichero de claves: %dk8, Longitud máxima de frase contraseña interactiva: %d (caracteres)\n"
+"PBKDF predefinido para LUKS1: %s, tiempo de iteración: %d (ms)\n"
+"PBKDF predefinido para LUKS2: %s\n"
+"\tTiempo de iteración: %d, Memoria requerida: %dkB, hilos en paralelo: %d\n"
 
-#: src/cryptsetup.c:1420
+#: src/cryptsetup.c:3422
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in device cipher parameters:\n"
 "\tloop-AES: %s, Key %d bits\n"
 "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
 msgstr ""
 "\n"
-"Parámetros predefinidos de fábrica del algoritmo de cifrado de "
-"dispositivos:\n"
+"Parámetros predefinidos de fábrica del algoritmo de cifrado de dispositivos:\n"
 "\tbucle-AES: %s, Clave %d bits\n"
 "\tsin cifrado: %s, Clave: %d bits, Contraseña «hashing»: %s\n"
-"\tLUKS1: %s, Clave: %d bits, «hashing» de la cabecera LUKS: %s, Generador de "
-"números aleatorios: %s\n"
+"\tLUKS: %s, Clave: %d bits, «hashing» de la cabecera LUKS: %s, Generador de números aleatorios: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: El tamaño de clave predefinido con modo XTS (dos claves internas) va a ser duplicado.\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
 #, c-format
 msgid "%s: requires %s as arguments"
 msgstr "%s: necesita %s como argumentos"
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
 msgid "Show this help message"
 msgstr "Mostrar este mensaje de ayuda"
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
 msgid "Display brief usage"
 msgstr "Mostrar brevemente cómo se usa"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Opciones de ayuda:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
 msgid "Print package version"
 msgstr "Imprimir versión del paquete"
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Opciones de ayuda:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
 msgid "Shows more detailed error messages"
 msgstr "Muestra mensajes de error más detallados"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
 msgid "Show debug messages"
 msgstr "Mostrar mensajes de depuración"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Mostrar mensajes de depuración incluidos los metadatos JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
 msgid "The cipher used to encrypt the disk (see /proc/crypto)"
 msgstr "Algoritmo de cifrado utilizado para cifrar el disco (ver /proc/crypto)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
 msgid "The hash used to create the encryption key from the passphrase"
-msgstr ""
-"Algoritmo «hash» utilizado para crear la clave de cifrado a partir de la "
-"frase contraseña"
+msgstr "Algoritmo «hash» utilizado para crear la clave de cifrado a partir de la frase contraseña"
 
-#: src/cryptsetup.c:1481
+#: src/cryptsetup.c:3492
 msgid "Verifies the passphrase by asking for it twice"
 msgstr "Verifica la frase contraseña preguntándola dos veces"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
 msgstr "Leer la clave de un fichero."
 
-#: src/cryptsetup.c:1483
+#: src/cryptsetup.c:3494
 msgid "Read the volume (master) key from file."
 msgstr "Leer la clave (maestra) del volumen desde fichero."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr ""
-"Volcar la clave (maestra) del volumen en lugar de la información de las "
-"ranuras de claves."
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Volcar la clave (maestra) del volumen en lugar de la información de las ranuras de claves."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
 msgid "The size of the encryption key"
 msgstr "Tamaño de la clave de cifrado"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
 msgid "BITS"
 msgstr "BITS"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
 msgid "Limits the read from keyfile"
 msgstr "Limita la lectura desde fichero de claves"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
 msgid "bytes"
 msgstr "bytes"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
 msgid "Number of bytes to skip in keyfile"
 msgstr "Número de bytes que hay que saltar en el fichero de claves"
 
-#: src/cryptsetup.c:1488
+#: src/cryptsetup.c:3499
 msgid "Limits the read from newly added keyfile"
 msgstr "Limita la lectura desde un fichero de claves recién añadido"
 
-#: src/cryptsetup.c:1489
+#: src/cryptsetup.c:3500
 msgid "Number of bytes to skip in newly added keyfile"
-msgstr ""
-"Número de bytes que hay que saltar en el fichero de claves recién añadido"
+msgstr "Número de bytes que hay que saltar en el fichero de claves recién añadido"
 
-#: src/cryptsetup.c:1490
+#: src/cryptsetup.c:3501
 msgid "Slot number for new key (default is first free)"
-msgstr ""
-"Número de ranura para la nueva clave (el primero libre es lo predefinido)"
+msgstr "Número de ranura para la nueva clave (el primero libre es lo predefinido)"
 
-#: src/cryptsetup.c:1491
+#: src/cryptsetup.c:3502
 msgid "The size of the device"
 msgstr "Tamaño del dispositivo"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
 msgid "SECTORS"
 msgstr "SECTORES"
 
-#: src/cryptsetup.c:1492
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Utilizar solamente el tamaño especificado de dispositivo (ignorar el resto del dispositivo). ¡PELIGROSO!"
+
+#: src/cryptsetup.c:3504
 msgid "The start offset in the backend device"
 msgstr "iPosición de comienzo en el dispositivo «backend»"
 
-#: src/cryptsetup.c:1493
+#: src/cryptsetup.c:3505
 msgid "How many sectors of the encrypted data to skip at the beginning"
 msgstr "Cuántos sectores de los datos cifrados hay que saltar al principio"
 
-#: src/cryptsetup.c:1494
+#: src/cryptsetup.c:3506
 msgid "Create a readonly mapping"
 msgstr "Crear una asignación alatoria"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "Tiempo de iteración PBKDF2 para LUKS (en ms)"
-
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "ms"
-
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
 msgid "Do not ask for confirmation"
 msgstr "No pedir confirmación"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508
 msgid "Timeout for interactive passphrase prompt (in seconds)"
-msgstr ""
-"Tiempo de espera máximo para petición interactiva de frase contraseña (en "
-"segundos)"
+msgstr "Tiempo de espera máximo para petición interactiva de frase contraseña (en segundos)"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
 msgid "secs"
 msgstr "s"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Actualización de la línea de progreso (en segundos)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
 msgid "How often the input of the passphrase can be retried"
-msgstr ""
-"Con qué frecuencia se puede volver a intentar introducir la frase contraseña"
+msgstr "Con qué frecuencia se puede volver a intentar introducir la frase contraseña"
 
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3511
 msgid "Align payload at <n> sector boundaries - for luksFormat"
 msgstr "Alinear los datos a <n> bordes de sector - para luksFormat"
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
 msgstr "Fichero con copia de seguridad de cabecera LUKS y de ranuras de clave."
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
 msgstr "Usar /dev/random para generar la clave del volumen."
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
 msgstr "Usar /dev/urandom para generar la clave del volumen."
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
 msgstr "Compartir dispositivo con otro segmento cifrado no solapado."
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID del dispositivo que se va a usar."
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID del dispositivo que se va a usar"
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr ""
-"Permitir solicitudes de descarte (también llamadas TRIM) para el dispositivo."
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Permitir solicitudes de descarte (también llamadas TRIM) para el dispositivo"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Dispositivo o fichero con cabecera LUKS separada."
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Dispositivo o fichero con cabecera LUKS separada"
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "No activar dispositivo; comprobar frase contraseña solamente."
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "No activar dispositivo; comprobar frase contraseña solamente"
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Utilizar cabecera oculta (dispositivo TCRYPT oculto)."
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Utilizar cabecera oculta (dispositivo TCRYPT oculto)"
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr ""
-"El dispositivo es una unidad con sistema TCRYPT (con cargador de arranque)."
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "El dispositivo es una unidad con sistema TCRYPT (con cargador de arranque)"
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Utilizar la cabecera TCRYPT de respaldo (secundaria)."
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Utilizar la cabecera TCRYPT de respaldo (secundaria)"
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Explorar también si es un dispositivo compatible con VeraCrypt."
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Explorar también si es un dispositivo compatible con VeraCrypt"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr ""
-"Tipo de metadatos del dispositivo: «luks», no cifrado, «loopaes», «tcrypt»."
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Multiplicador de iteración personal para dispositivo compatible con VeraCrypt"
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr ""
-"Desactivar la comprobación de la calidad de la contraseña (si estaba "
-"activada)."
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Consulta el multiplicador de iteración personal para dispositivo compatible con VeraCrypt"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr ""
-"Utilizar la opción de compatibilidad de rendimiento same_cpu_crypt de dm-"
-"crypt."
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Tipo de metadatos del dispositivo: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr ""
-"Utilizar la opción de compatibilidad de rendimiento submit_from_crypt_cpus "
-"de dm-crypt."
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Desactivar la comprobación de la calidad de la contraseña (si estaba activada)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Utilizar la opción de compatibilidad de rendimiento same_cpu_crypt de dm-crypt"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Utilizar la opción de compatibilidad de rendimiento submit_from_crypt_cpus de dm-crypt"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "La eliminación del dispositivo está diferida hasta que el último usuario lo cierre"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Utilizar un bloqueo global para serializar PBKDF estricto en memoria (solución OOM)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Tiempo de iteración PBKDF para LUKS (en ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ms"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Algoritmo PBKDF (para LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Límite del coste de memoria PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilobytes"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Coste del paralelismo PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "hilos"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Coste de las iteraciones PBKDF (forzado, desactiva el banco de pruebas)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Prioridad de la ranura de claves: ignorada, normal, preferente"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Desactiva el bloqueo de metadatos en disco"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Desactiva la carga de las claves del volumen mediante el llavero del núcleo"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Algoritmo de integridad de datos (solo LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Desactiva el diario para dispositivo de integridad"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "No limpiar dispositivo después de dar formato"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Utilizar relleno obsoleto ineficiente (núcleos antiguos)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "No pedir frase de paso si falla la activación por «token»"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Número de «token» (predefinido: cualquiera)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Descripción de la clave"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Tamaño de sector de cifrado (predeterminado: 512 bytes)"
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Utiliza IV contado en tamaño de sector (no en unidades de 512 bytes)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Establecer indicadores de activación persistentes para el dispositivo"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Poner etiqueta al dispositivo LUKS2"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Poner etiqueta de subsistema al dispositivo LUKS2"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Crear o volcar ranura de claves LUKS2 independiente (sin segmento de datos asignado)"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Leer o escribir el json de o en un fichero"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Tamaño de la zona de metadatos de la cabecera LUKS2"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Tamaño de la zona de ranuras de clave de la cabecera LUKS2"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Refrescar (reactivar) el dispositivo con los nuevos parámetros"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Ranura de clave de LUKS2: Tamaño de la clave de cifrado"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "Ranura de clave de LUKS2: El algoritmo de cifrado utilizado para el cifrado de ranuras de clave"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Crifrar el dispositivo LUKS2 (cifrado in situ)."
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Descifrar el dispositivo LUKS2 (elimina cifrado)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Inicializar solamente recifrado LUKS2 de los metadatos."
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Reanudar solamente recifrado LUKS2 inicializado."
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Reducir el tamaño del dispositivo de datos (mover la posición de los datos). ¡PELIGROSO!"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Tamaño de zona activa de recifrado máximo."
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Tipo de resiliencia de zona activa de recifrado (checksum,journal,none)"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "«Hash» de suma de comprobación de zona activa de recifrado"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Anular la autodetección de dispositivos del dispositivo dm que se va a recifrar"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
 msgid "[OPTION...] <action> <action-specific>"
 msgstr "[OPCIÓN...] <acción> <acción-específica>"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Modo FIPS en funcionamiento.\n"
-
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
 msgid "Argument <action> missing."
 msgstr "El argumento <acción> no se ha proporcionado."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
 msgid "Unknown action."
 msgstr "Acción desconocida."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr ""
-"La opción --shared solo se permite para abrir dispositivos no cifrados.\n"
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Las opciones --refresh y --test-passphrase son mutuamente excluyentes."
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr ""
-"La opción --allow-discards solo se permite para la operación de abrir.\n"
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "La opción --deferred solo se permite con la orden de cerrar."
 
-#: src/cryptsetup.c:1657
-msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
-msgstr ""
-"La opción --key-size solo se permite con luksFormat, open y benchmark.\n"
-"Para limitar la lectura del fichero de claves, utilizar --keyfile-"
-"size=(bytes)."
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "La opción --shared solo se permite para abrir dispositivos no cifrados."
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "La opción --allow-discards solo se permite para la operación de abrir."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "La opción --persistent solo se permite para la operación de abrir."
 
-#: src/cryptsetup.c:1664
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "La opción --serialize-memory-hard-pbkdf solo se permite para la operación de abrir."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "La opción --persistent no se permite con --test-passphrase."
+
+#: src/cryptsetup.c:3753
 msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
 msgstr ""
-"La opción --test-passphrase solo se permite para abrir dispositivos LUKS y "
-"TCRYPT.\n"
+"La opción --key-size solo se permite con las acciones luksFormat, luksAddKey,\n"
+"open y benchmark. Para limitar la lectura del fichero de claves, utilizar --keyfile-size=(bytes)."
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "La opción --integrity solo se permite con luksFormat (LUKS2)."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "La opción --integrity-no-wipe solo puede usarse para la acción de formato con extensión de integridad."
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Las opciones --label y --subsystem solo se permiten con las operaciones luksFormat y config LUKS2."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "La opción --test-passphrase solo se permite para abrir dispositivos LUKS, TCRYPT y BITLK."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
 msgid "Key size must be a multiple of 8 bits"
 msgstr "El tamaño de clave debe ser un múltiplo de 8 bits"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
 msgid "Key slot is invalid."
 msgstr "La ranura de claves no es válida."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"La opción --key-file tiene precedencia sobre el argumento de fichero de "
-"claves especificado.\n"
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "La opción --key-file tiene precedencia sobre el argumento de fichero de claves especificado."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
 msgid "Negative number for option not permitted."
 msgstr "No se permiten números negativos para esta opción."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Solo se permite un argumento --key-file."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
 msgid "Only one of --use-[u]random options is allowed."
 msgstr "Solo se permite una de las opciones --use-[u]random."
 
-#: src/cryptsetup.c:1699
+#: src/cryptsetup.c:3813
 msgid "Option --use-[u]random is allowed only for luksFormat."
 msgstr "La opción --use-[u]random solo se permite con luksFormat."
 
-#: src/cryptsetup.c:1703
+#: src/cryptsetup.c:3817
 msgid "Option --uuid is allowed only for luksFormat and luksUUID."
 msgstr "La opción --uuid solo se permite con luksFormat luksUUID."
 
-#: src/cryptsetup.c:1707
+#: src/cryptsetup.c:3821
 msgid "Option --align-payload is allowed only for luksFormat."
 msgstr "La opción --align-payload solo se permite con luksFormat."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"La opción --skip solo está disponible para abrir dispositivos no cifrados y "
-"«loopaes».\n"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Las opciones --luks2-metadata-size y --opt-luks2-keyslots-size solo se permiten para luksFormat con LUKS2."
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"La opción --offset solo está disponible para abrir dispositivos no cifrados "
-"y «loopaes».\n"
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "La especificación del tamaño de los metadatos LUKS2 no es válida."
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
-msgstr ""
-"La opción --tcrypt-hidden o --tcrypt-system o --tcrypt-backup solo está "
-"disponible para dispositivos TCRYPT.\n"
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "La especificación del tamaño de las ranuras de claves LUKS2 no es válida."
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Las opciones --align-payload y --offset no pueden combinarse."
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "La opción --skip solo está disponible para abrir dispositivos no cifrados y «loopaes»."
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "La opción --offset solo está disponible para abrir dispositivos no cifrados y «loopaes», «luksFormat» y recifrado de dispositivo."
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "La opción --tcrypt-hidden o --tcrypt-system o --tcrypt-backup solo está disponible para dispositivos TCRYPT."
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "La opción --tcrypt-hidden no puede combinarse con --allow-discards."
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "La opción --veracrypt solo está disponible para dispositivos TCRYPT."
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Argumento no válido para el parámetro --veracrypt-pim supplied."
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "La opción --veracrypt-pim solo está disponible para dispositivos compatibles con VeraCrypt."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "La opción --veracrypt-query-pim  solo está disponible para dispositivos compatibles con VeraCrypt."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Las opciones --veracrypt-pim y --veracrypt-query-pim son mutuamente excluyentes."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "La opción --priority solo puede ser ignore/normal/prefer."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Se requiere especificación de ranura de claves."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "La función de derivación de clave basada en contraseña (PBKDF) solo puede ser pbkdf2 o argon2i/argon2id."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Las iteraciones forzadas de PBKDF no pueden combinarse con la opción de tiempo de iteración."
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
-msgstr "La opción --tcrypt-hidden no puede combinarse con --allow-discards.\n"
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "La opción de tamaño de sector no está disponible para esta orden."
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "La opción --veracrypt solo está disponible para dispositivos TCRYPT.\n"
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "La opción de sectores IV grandes solo se admite para abrir dispositivo de tipo plano con tamaño de sector mayor de 512 bytes."
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "La cadena «salt» especificada no es válida.\n"
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "El tamaño de la clave es requerido con la opción --unbound."
 
-#: src/veritysetup.c:88
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "La opción --unbound solo puede utilizarse con las acciones luksAddKey y luksDump."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "La opción --refresh solo puede utilizarse con la acción de abrir."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "No se puede desactivar el bloqueo de metadatos."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "La especificación del tamaño máximo de zona activa del dispositivo no es válida."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "La especificación del tamaño del dispositivo no es válida."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "El tamaño máximo de reducción del dispositivo es de 1 GiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "El tamaño de reducción debe ser múltiplo de sectores de 512 bytes."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "La especificación del tamaño de los datos no es válida."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Desbordamiento del tamaño de la reducción."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "El descifrado LUKS2 requiere la opción --header."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "El tamaño del dispositivo debe ser múltiplo de sectores de 512 bytes."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Las opciones --reduce-device-size y --data-size no pueden combinarse."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Las opciones --device-size y --size no pueden combinarse."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Las opciones --ignore-corruption y --restart-on-corruption no pueden utilizarse juntas."
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "La cadena «salt» especificada no es válida."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "No se puede crear la imagen «hash» %s para escribir."
+
+#: src/veritysetup.c:107
 #, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "No se puede crear la imagen «hash» %s para escribir.\n"
+msgid "Cannot create FEC image %s for writing."
+msgstr "No se puede crear la imagen FEC %s para escribir."
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "La cadena «hash» raíz especificada no es válida.\n"
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "La cadena «hash» raíz especificada no es válida."
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr "Fichero de firmas inválido %s."
+
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "No se puede leer el fichero de firmas %s."
+
+#: src/veritysetup.c:392
 msgid "<data_device> <hash_device>"
 msgstr "<dispositivo_de_datos> <dispositivo_«hash»>"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392 src/integritysetup.c:479
 msgid "format device"
 msgstr "dar formato al dispositivo"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "<data_device> <hash_device> <root_hash>"
 msgstr "<dispositivo_de_datos> <dispositivo_«hash»> <«hash»_raíz>"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "verify device"
 msgstr "verificar dispositivo"
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<nombre> <dispositivo_de_datos> <dispositivo_«hash»> <«hash»_raíz>"
-
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "crear dispositivo activo"
-
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "eliminar (desactivar) dispositivo"
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<dispositivo_de_datos> <nombre> <dispositivo_«hash»> <«hash»_raíz>"
 
-#: src/veritysetup.c:312
+#: src/veritysetup.c:396 src/integritysetup.c:482
 msgid "show active device status"
 msgstr "mostrar el estado del dispositivo activo"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397
 msgid "<hash_device>"
 msgstr "<dispositivo_«hash»>"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397 src/integritysetup.c:483
 msgid "show on-disk information"
 msgstr "mostrar información sobre el disco"
 
-#: src/veritysetup.c:332
+#: src/veritysetup.c:416
 #, c-format
 msgid ""
 "\n"
@@ -1670,353 +3172,974 @@ msgstr ""
 "\n"
 "<nombre> es el dispositivo que se va a crear bajo %s\n"
 "<dispositivo_de_datos> es el dispositivo de datos\n"
-"<dispositivo_«hash»> es el dispositivo que contiene los datos de "
-"verificación\n"
+"<dispositivo_«hash»> es el dispositivo que contiene los datos de verificación\n"
 "<«hash»_raíz> «hash» del nodo raíz en «dispositivo—«hash»>\n"
 
-#: src/veritysetup.c:339
+#: src/veritysetup.c:423
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
 msgstr ""
 "\n"
 "Parámetros dm-verity predefinidos de fábrica:\n"
-"\tAlgoritmo «hash»: %s, Bloque de datos (bytes): %u, Bloque «hash» (bytes): "
-"%u, Tamaño de «salt»: %u, Formato «hash»: %u\n"
+"\tAlgoritmo «hash»: %s, Bloque de datos (bytes): %u, Bloque «hash» (bytes): %u, Tamaño de «salt»: %u, Formato «hash»: %u\n"
 
-#: src/veritysetup.c:377
+#: src/veritysetup.c:466
 msgid "Do not use verity superblock"
 msgstr "No utilizar superbloque «verity»"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "Format type (1 - normal, 0 - original Chrome OS)"
 msgstr "Tipo de formato (1 - normal, 0 - Chrome OS original)"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "number"
 msgstr "número"
 
-#: src/veritysetup.c:379
+#: src/veritysetup.c:468
 msgid "Block size on the data device"
 msgstr "Tamaño de bloque en el dispositivo de datos"
 
-#: src/veritysetup.c:380
+#: src/veritysetup.c:469
 msgid "Block size on the hash device"
 msgstr "Tamaño de bloque en el dispositivo «hash»"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "Bytes de paridad FEC"
+
+#: src/veritysetup.c:471
 msgid "The number of blocks in the data file"
 msgstr "Número de bloques en el fichero de datos"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:471
 msgid "blocks"
 msgstr "bloques"
 
-#: src/veritysetup.c:382
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Ruta a dispositivo con datos de corrección de errores"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "ruta"
+
+#: src/veritysetup.c:473
 msgid "Starting offset on the hash device"
 msgstr "Posición inicial en el dispositivo «hash»"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Posición inicial en el dispositivo FEC"
+
+#: src/veritysetup.c:475
 msgid "Hash algorithm"
 msgstr "Algoritmo «hash»"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:475
 msgid "string"
 msgstr "cadena"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "Salt"
 msgstr "«Salt»"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "hex string"
 msgstr "cadena hexadecimal"
 
-#: src/cryptsetup_reencrypt.c:147
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Ruta al fichero de firmas «hash» raíz"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Reiniciar el núcleo si se detecta corrupción"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ignorar corrupción, tomar nota únicamente"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "No verificar bloques con zeros"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Verificar el bloque de datos solo en la primera lectura"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Las opciones --ignore-corruption, --restart-on-corruption y --ignore-zero-blocks solo están permitidas para la operación de abrir."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "La opción --root-hash-signature solo puede usarse para la acción de abrir."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Las opciones --ignore-corruption y --restart-on-corruption no pueden utilizarse juntas."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "No se puede leer el fichero de claves %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "No se pueden leer %d «bytes» en el fichero de claves %s."
+
+#: src/integritysetup.c:254
 #, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "No se puede abrir %s en exclusividad; el dispositivo está en uso.\n"
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formato dado con tamaño de etiqueta %u, integridad interna %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<dispositivo_de_integridad>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<dispositivo_de_integridad> <nombre>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<nombre> es el dispositivo que se va a crear bajo %s\n"
+"<dispositivo_de_integridad> es el dispositivo que contiene datos con etiquetas de integridad\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Parámetros dm-integrity predefinidos de fábrica:\n"
+"\tAlgoritmo de la suma de comprobación: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Ruta al dispositivo de datos (si está separado)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Tamaño del diario"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Sectores de entrelazado"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Marca de agua del diario"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "por ciento"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Tiempo de escritura en el diario"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Número de sectores de 512 bytes por bit (modo mapa de bits)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Tiempo de «flush» del modo mapa de bits"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Tamaño de etiqueta (por sector)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Tamaño de sector"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Tamaño de los «buffers»"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Algoritmo para la integridad de datos"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Tamaño de la clave de integridad de datos"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Leer la clave de integridad de un fichero"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Algoritmo de integridad del diario"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Tamaño de la clave de integridad del diario"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Leer la clave de integridad del diario de un fichero"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Algoritmo de cifrado del diario"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Tamaño de la clave de cifrado del diario"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Leer la clave de cifrado del diario de un fichero"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Modo de recuperación (sin diario, sin comprobación de etiqueta)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Utilice bitmap para seguir los cambios y desactive el diario para el dispositivo de integridad"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Recalcular las etiquetas iniciales automáticamente."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "La opción --integrity-recalculate solo puede usarse para la acción de abrir."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Las opciones --journal-size, --interleave-sectors, --sector-size, --tag-size y --no-wipe solo pueden utilizarse para la acción de dar formato."
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "La especificación del tamaño del diario no es válida."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Deben especificarse las opciones tanto de fichero de claves como tamaño de clave."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "El algoritmo para la integridad debe especificarse si se va a utilizar clave de integridad."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Deben especificarse la opción del fichero de clave de integridad del diario y la del tamaño de la clave."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Debe especificarse el algoritmo de integridad del diario si va a utilizarse la clave de integridad del diario."
 
-#: src/cryptsetup_reencrypt.c:151
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Deben especificarse la opción del fichero de la clave de cifrado del diario y la del tamaño de la clave."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Debe especificarse el algoritmo de cifrado del diario si va a utilizarse la clave de cifrado del diario."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Las opciones de recuperación y de modo mapa de bits son mutuamente excluyentes."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Las opciones de diario no pueden utilizarse en modo mapa de bits."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Las opciones de mapa de bits solo pueden utilizarse en el modo mapa de bits."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Recifrado ya en curso."
+
+#: src/cryptsetup_reencrypt.c:208
 #, c-format
-msgid "Cannot open device %s\n"
-msgstr "No se puede abrir el dispositivo %s\n"
+msgid "Cannot exclusively open %s, device in use."
+msgstr "No se puede abrir %s en exclusividad; el dispositivo está en uso."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "La reserva de memoria alineada ha fallado.\n"
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "La reserva de memoria alineada ha fallado."
 
-#: src/cryptsetup_reencrypt.c:168
+#: src/cryptsetup_reencrypt.c:229
 #, c-format
-msgid "Cannot read device %s.\n"
-msgstr "No se puede leer el dispositivo %s.\n"
+msgid "Cannot read device %s."
+msgstr "No se puede leer el dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:179
+#: src/cryptsetup_reencrypt.c:240
 #, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "Marcando el dispositivo LUKS %s como inutilizable.\n"
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Marcando el dispositivo LUKS1 %s como inutilizable."
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "Marcando el dispositivo LUKS %s como utilizable.\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Estableciendo el indicador de recifrado fuera de línea LUKS2 en el dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:200
+#: src/cryptsetup_reencrypt.c:261
 #, c-format
-msgid "Cannot write device %s.\n"
-msgstr "No se puede escribir en el dispositivo %s.\n"
+msgid "Cannot write device %s."
+msgstr "No se puede escribir en el dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "No se puede escribir en el fichero de registro de recifrado.\n"
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "No se puede escribir en el fichero de registro de recifrado."
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "No se puede leer el fichero de registro de recifrado.\n"
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "No se puede leer el fichero de registro de recifrado."
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
 msgstr "El fichero de registro %s ya existe; reanudando el recifrado.\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr "Activando dispositivo temporal utilizando cabecera LUKS antigua.\n"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Activando dispositivo temporal utilizando cabecera LUKS antigua."
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr "Activando dispositivo temporal utilizando cabecera LUKS nueva.\n"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Activando dispositivo temporal utilizando cabecera LUKS nueva."
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Fallo en la activación de los dispositivos temporales.\n"
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Fallo en la activación de los dispositivos temporales."
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Se ha creado una nueva cabecera LUKS para el dispositivo %s.\n"
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "No se ha podido establecer el desplazamiento de los datos."
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "No se ha podido establecer el tamaño de los metadatos."
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:573
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Se ha activado la ranura de claves %i.\n"
+msgid "New LUKS header for device %s created."
+msgstr "Se ha creado una nueva cabecera LUKS para el dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr ""
-"Se ha creado una copia de seguridad de la cabecera LUKS del dispositivo %s.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Esta versión de cryptsetup-reencrypt no sabe manejar el nuevo tipo de «token» interno %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "No se ha podido leer los indicadores de activación en la cabecera de respaldo."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "Fallo al crear la copia de seguridad de las cabeceras LUKS.\n"
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "No se ha podido escribir los indicadores de activación en la nueva cabecera."
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "No se ha podido leer los requisitos en la cabecera de respaldo."
+
+#: src/cryptsetup_reencrypt.c:705
 #, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "No se puede restaurar la cabecera LUKS en el dispositivo %s.\n"
+msgid "%s header backup of device %s created."
+msgstr "Se ha creado una copia de seguridad de la cabecera %s del dispositivo %s."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "No se ha podido crear la copia de seguridad de las cabeceras LUKS."
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/cryptsetup_reencrypt.c:901
 #, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "Se ha restaurado la cabecera LUKS en el dispositivo %s.\n"
+msgid "Cannot restore %s header on device %s."
+msgstr "No se puede restaurar la cabecera %s en el dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:669
+#: src/cryptsetup_reencrypt.c:903
 #, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Progreso: %5.1f%%, ETA %02llu:%02llu, %4llu MiB escritos, velocidad %5.1f "
-"MiB/s%s"
+msgid "%s header on device %s restored."
+msgstr "Se ha restaurado la cabecera %s en el dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "No es posible situarse en la posición del dispositivo.\n"
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "No se puede abrir el dispositivo LUKS temporal."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "No se puede abrir el fichero temporal de la cabecera LUKS.\n"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "No se puede obtener el tamaño del dispositivo."
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "No se puede obtener el tamaño del dispositivo.\n"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Error de entrada/salida durante el recifrado."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Interrumpido por una señal.\n"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "El UUID proporcionado no es válido."
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "Error de entrada/salida durante el recifrado.\n"
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "No se puede abrir el fichero de registro de recifrado."
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"El fichero de claves solo puede usarse con --key-slot o con una sola ranura "
-"de claves activa exactamente.\n"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "No hay ningún proceso de descifrado en marcha; el UUID proporcionado solo puede utilizarse para reanudar un proceso de descifrado suspendido."
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
+#: src/cryptsetup_reencrypt.c:1504
 #, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Introduzca la fase contraseña para la ranura de claves %u: "
-
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "No se puede abrir el fichero de registro de recifrado.\n"
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Se han cambiado los parámetros pbkdf en la ranura de claves %i."
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "Reencryption block size"
 msgstr "Tamaño de bloque de recifrado"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "MiB"
 msgstr "MiB"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "No cambie la clave; no hay recifrado en la zona de datos."
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "No cambie la clave; no hay recifrado en la zona de datos"
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr "Utilizar entrada/salida directa para acceder a los dispositivos."
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Leer la clave (maestra) del volumen desde fichero"
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr "Utilizar fsync después de cada bloque."
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Tiempo de iteración PBKDF2 para LUKS (en ms)"
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Actualizar el fichero de registro después de cada bloque."
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Utilizar entrada/salida directa para acceder a los dispositivos"
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr "Utilizar solamente esta ranura (se desactivarán las demás)."
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Utilizar fsync después de cada bloque"
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
-"Reducir el tamaño del dispositivo de datos (mover la posición de los datos). "
-"¡PELIGROSO!"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Actualizar el fichero de registro después de cada bloque"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Utilizar solamente el tamaño especificado de dispositivo (ignorar el resto "
-"del dispositivo). ¡PELIGROSO!"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Utilizar solamente esta ranura (se desactivarán las demás)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Crear nueva cabecera en dispositivo no cifrado"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Descifrar el dispositivo de forma permanente (eliminar cifrado)"
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Crear nueva cabecera en dispositivo no cifrado."
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "El UUID utilizado para reanudar el descifrado"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
-msgstr "Descrifrar el dispositivo de forma permanente (eliminar cifrado)."
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Tipo de metadato LUKS: luks1, luks2"
 
-#: src/cryptsetup_reencrypt.c:1298
+#: src/cryptsetup_reencrypt.c:1659
 msgid "[OPTION...] <device>"
 msgstr "[OPCIÓN...] <dispositivo>"
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
-"ATENCIÓN: este código es experimental; puede ser que sus datos queden "
-"deteriorados por completo.\n"
-
-#: src/cryptsetup_reencrypt.c:1313
+#: src/cryptsetup_reencrypt.c:1667
 #, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "El recifrado va a cambiar: clave del volumen%s%s%s%s.\n"
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "El recifrado va a cambiar: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "clave del volumen"
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid "set hash to "
-msgstr ", nuevo algoritmo «hash»: "
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "nuevo algoritmo «hash» "
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ", nuevo algoritmo de cifrado: "
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr "Hace falta argumento."
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Solo se permiten valores entre 1 MiB y 64 MiB para el tamaño de bloque de "
-"recifrado."
-
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "La especificación del tamaño del dispositivo no es válida."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Solo se permiten valores entre 1 MiB y 64 MiB para el tamaño de bloque de recifrado."
 
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
 msgstr "El tamaño máximo de reducción del dispositivo es de 64 MiB."
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "El tamaño de reducción debe ser múltiplo de sectores de 512 bytes."
-
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr ""
-"La opción --new debe utilizarse conjuntamente con --reduce-device-size."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "La opción --new debe utilizarse conjuntamente con --reduce-device-size o --header."
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
-"La opción --keep-key solamente puede utilizarse con --hash o --iter-time."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "La opción --keep-key solamente puede utilizarse con --hash, --iter-time o --pbkdf-force-iterations."
 
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr "La opción --new no puede utilizarse conjuntamente con --decrypt."
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
 msgstr "La opción --decrypt es incompatible con los parámetros especificados."
 
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "La opción --uuid solo está permitida conjuntamente con --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Tipo de luks no válido. Utilice uno de estos: 'luks', 'luks1' o 'luks2'."
+
 #: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Error de lectura de la respuesta recibida desde el terminal.\n"
+msgid "Error reading response from terminal."
+msgstr "Error de lectura de la respuesta recibida desde el terminal."
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Orden ejecutada correctamente.\n"
 
-#: src/utils_tools.c:191
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "parámetros incorrectos u omisos"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "sin permiso o frase de paso mala"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "sin memoria"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "se ha especificado un dispositivo o fichero incorrecto"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "el dispositivo ya existe o está ocupado"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "error desconocido"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "La orden ha fallado con código %i (%s).\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Ranura de claves %i creada."
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Ranura de claves %i desbloqueada."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Ranura de claves %i eliminada."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "«Token» %i creado."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "«Token» %i eliminado."
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Limpieza interrumpida."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "AVISO: El dispositivo %s ya contiene una firma de partición '%s'.\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "AVISO: El dispositivo %s ya contiene uan firma de superbloque '%s'.\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "No se han podido inicializar los sondeos de firma del dispositivo."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "No se ha podido efectuar «stat» sobre el dispositivo %s."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "El dispositivo %s está en uso. No se puede proceder con la operación de dar formato."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "No se ha podido abrir el fichero %s para lectura y escritura."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "La firma de la partición '%s' existente (desplazamiento: %<PRIi64> bytes) en el dispositivo %s va a limpiarse."
+
+#: src/utils_tools.c:580
 #, c-format
-msgid "Command failed with code %i"
-msgstr "La orden ha fallado con código %i"
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "La firma del superbloque '%s' existente (desplazamiento: %<PRIi64> bytes) en el dispositivo %s va a limpiarse."
 
-#: src/utils_password.c:42
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "No se ha podido limpiar la firma del dispositivo."
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "No se ha podido sondear el dispositivo %s para una firma."
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Recifrado interrumpido."
+
+#: src/utils_password.c:43 src/utils_password.c:75
 #, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "No se puede comprobar la calidad de la contraseña: %s\n"
+msgid "Cannot check password quality: %s"
+msgstr "No se puede comprobar la calidad de la contraseña: %s"
 
-#: src/utils_password.c:50
+#: src/utils_password.c:51
 #, c-format
 msgid ""
 "Password quality check failed:\n"
-" %s\n"
+" %s"
 msgstr ""
 "Fallo en la comprobación de la calidad de la contraseña:\n"
-" %s\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Fallo en la comprobación de la calidad de la contraseña: frase contraseña incorrecta (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Error al leer la frase contraseña desde el terminal."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Verifique la frase contraseña: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "La frase contraseña no coincide."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "No se puede usar «offset» con entrada desde terminal."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Introduzca la frase contraseña: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Introduzca la frase contraseña de %s: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "No hay ninguna clave disponible con esa frase contraseña."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "No hay niguna ranura de claves utilizable disponible."
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "No se puede abrir el fichero de claves %s para escritura."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "No se puede escribir en el fichero de claves %s."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "No se ha podido abrir el fichero %s para solo lectura."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Proporciona «token» LUKS2 válido en JSON:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "No se ha podido leer el fichero JSON."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Lectura interrumpida."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "No se ha podido abrir el fichero %s para escritura."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Escritura interrumpida."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "No se ha podido escribir el fichero JSON."
+
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands."
+#~ msgstr "El parámetro --refresh solo se permite con las órdenes de abrir y de refrescar."
+
+#~ msgid "Cipher %s is not available."
+#~ msgstr "El algoritmo de cifrado %s no está disponible."
+
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Tamaño de sector de cifrado no admitido.\n"
+
+#~ msgid "Offline reencryption in progress. Aborting."
+#~ msgstr "Recifrado «offline» en curso. Se aborta."
+
+#~ msgid "Online reencryption in progress. Aborting."
+#~ msgstr "Recifrado «online» en curso. Se aborta."
+
+#~ msgid "No LUKS2 reencryption in progress."
+#~ msgstr "No hay ningún recifrado LUKS2 en proceso."
+
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Interrumpido por una señal."
+
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Función no disponible en modo FIPS."
+
+#~ msgid "Failed to write hash."
+#~ msgstr "No se ha podido escribir el «hash»."
+
+#~ msgid "Failed to finalize hash."
+#~ msgstr "No se ha podido finalizar el «hash»."
+
+#~ msgid "Invalid resilience parameters (internal error)."
+#~ msgstr "Parámetros de resiliencia no válidos (error interno)."
+
+#~ msgid "Failed to assign new enc segments."
+#~ msgstr "No se han logrado asignar los nuevos segmentos enc."
+
+#~ msgid "Failed to assign digest %u to segment %u."
+#~ msgstr "No se ha logrado asignar el resumen %u al segmento %u."
+
+#~ msgid "Failed to set segments."
+#~ msgstr "No se han podido poner los segmentos."
+
+#~ msgid "Failed to assign reencrypt previous backup segment."
+#~ msgstr "No se ha podido asignar recifrado al segmento de respaldo anterior."
+
+#~ msgid "Failed to assign reencrypt final backup segment."
+#~ msgstr "No se ha podido asignar recifrado al segmento de respaldo final."
+
+#~ msgid "Failed generate 2nd segment."
+#~ msgstr "No se ha podido generar el segundo segmento."
+
+#~ msgid "Failed generate 1st segment."
+#~ msgstr "No se ha podido generar el primer segmento."
+
+#~ msgid "Failed to allocate device %s."
+#~ msgstr "No se ha podido asignar el dispositivo %s."
+
+#~ msgid "Failed to allocate dm segments."
+#~ msgstr "No se han podido asignar los segmentos dm."
+
+#~ msgid "Failed to create dm segments."
+#~ msgstr "No se han podido crear los segmentos dm."
+
+#~ msgid "Failed to allocate device for new backing device."
+#~ msgstr "No se ha podido asignar el dispositivo para el nuevo dispositivo de respaldo."
+
+#~ msgid "Failed to reload overlay device %s."
+#~ msgstr "No se ha podido recargar el dispositivo de superposición %s."
+
+#~ msgid "Failed to refresh helper devices."
+#~ msgstr "No se han podido actualizar los dispositivos de ayuda."
+
+#~ msgid "Failed to create reencryption backup segments."
+#~ msgstr "No se ha podido crear los segmentos de respaldo de recifrado."
+
+#~ msgid "Failed to set online-reencryption requirement."
+#~ msgstr "No se ha podido establecer el requisito de recifrado «online»."
+
+#~ msgid "Failed to hash sector at offset %zu."
+#~ msgstr "No se ha podido hacer «hash» del sector en el desplazamiento %zu."
+
+#~ msgid "Failed to read sector hash."
+#~ msgstr "No se ha podido leer el «hash« del sector."
+
+#~ msgid "Error: Calculated reencryption offset %<PRIu64> is beyond device size %<PRIu64>."
+#~ msgstr "Error: El desplazamiento %<PRIu64> de recifrado calculado sobrepasa el tamaño %<PRIu64> del dispositivo."
+
+#~ msgid "Device is not in clean reencryption state."
+#~ msgstr "El dispositivo no está en un estado de recifrado limpio."
+
+#~ msgid "Failed to calculate new segments."
+#~ msgstr "No se ha podido calcular los nuevos segmentos."
+
+#~ msgid "Failed to assign pre reenc segments."
+#~ msgstr "No se han podido asignar los segmentos pre reenc."
+
+#~ msgid "Failed finalize hotzone resilience, retval = %d"
+#~ msgstr "No se ha podido finalizar la resiliencia de zona caliente, retval = %d"
+
+#~ msgid "Failed to write data."
+#~ msgstr "No se han podido escribir los datos."
+
+#~ msgid "Failed to update metadata or reassign device segments."
+#~ msgstr "No se han podido actualizar los metadatos o reasignar los segmentos del dispositivo."
+
+#~ msgid "Failed to reload %s device."
+#~ msgstr "No se ha podido recargar el dispositivo %s."
+
+#~ msgid "Failed to erase backup segments"
+#~ msgstr "No se han podido borrar los segmentos de respaldo."
+
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Las opciones de rendimiento de dmcrypt solicitadas no están disponibles."
+
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "No se puede dar formato al dispositivo %s que todavía está en uso."
+
+#~ msgid "Key slot %d is not used."
+#~ msgstr "La ranura de claves %d no se está utilizando."
+
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "La ranura de claves %d se va a borrar."
+
+#~ msgid "open device as mapping <name>"
+#~ msgstr "abrir el dispositivo como asociado a <nombre>"
+
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "cerrar dispositivo (desactivar y eliminar la asociación)"
+
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "No se han podido establecer los parámetros PBKDF."
+
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "No es posible situarse en la posición del dispositivo.\n"
+
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "El dispositivo %s es demasiado pequeño. (LUKS3 necesita %<PRIu64> btyes como mínimo.)"
+
+#~ msgid "Replaced with key slot %d."
+#~ msgstr "Reemplazado con ranura de claves %d."
+
+#~ msgid "Missing LUKS target type, option --type is required."
+#~ msgstr "Falta el tipo de objetivo LUKS, se requiere la opción --type."
+
+#~ msgid "Missing --token option specifying token for removal."
+#~ msgstr "Falta la opción --token que especifica el «token» que se va a borrar."
+
+#~ msgid "Add or remove keyring token"
+#~ msgstr "Añadir o eliminar «token» de llavero"
+
+#~ msgid "Activated keyslot %i."
+#~ msgstr "Se ha activado la ranura de claves %i."
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "error de reserva de memoria en action_luksFormat"
+
+#~ msgid "Key slot is invalid.\n"
+#~ msgstr "La ranura de claves no es válida.\n"
+
+#~ msgid "Using default pbkdf parameters for new LUKS2 header.\n"
+#~ msgstr "Se está utilizando los parámetros pbkdf predeterminados para la nueva cabecera LUKS2.\n"
+
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Demasiados niveles de arborescencia en el volumen «verity».\n"
+
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "La clave %d no está activa. No se puede limpiar.\n"
+
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<nombre> <dispositivo_de_datos> <dispositivo_«hash»> <«hash»_raíz>"
+
+#~ msgid "create active device"
+#~ msgstr "crear dispositivo activo"
+
+#~ msgid "remove (deactivate) device"
+#~ msgstr "eliminar (desactivar) dispositivo"
+
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Progreso: %5.1f%%, ETA %02llu:%02llu, %4llu MiB escritos, velocidad %5.1f MiB/s%s"
+
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "No se ha encontrado ningún dispositivo de bucle invertido libre.\n"
+
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "No se puede abrir el dispositivo %s\n"
+
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "No se puede utilizar el UUID pasado a menos que haya descifrado en curso.\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "Marcando el dispositivo LUKS %s como utilizable.\n"
+
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "ATENCIÓN: este código es experimental; puede ser que sus datos queden deteriorados por completo.\n"
 
 #~ msgid "FIPS checksum verification failed.\n"
 #~ msgstr "La verificación de suma («checksum») FIPS ha fallado.\n"
 
-#~ msgid ""
-#~ "WARNING: device %s is a partition, for TCRYPT system encryption you "
-#~ "usually need to use whole block device path.\n"
-#~ msgstr ""
-#~ "ATENCIÓN: el dispositivo %s es una partición; para el sistema de cifrado "
-#~ "TCRYPT normalmente se necesita usar la ruta de un dispositivo de bloque "
-#~ "entero.\n"
+#~ msgid "WARNING: device %s is a partition, for TCRYPT system encryption you usually need to use whole block device path.\n"
+#~ msgstr "ATENCIÓN: el dispositivo %s es una partición; para el sistema de cifrado TCRYPT normalmente se necesita usar la ruta de un dispositivo de bloque entero.\n"
index e33059a..191ae9f 100644 (file)
Binary files a/po/fi.gmo and b/po/fi.gmo differ
index ab92db1..63cd31e 100644 (file)
--- a/po/fi.po
+++ b/po/fi.po
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 1.7.0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-20 02:26+0200\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2015-11-08 12:48+0200\n"
 "Last-Translator: Jorma Karvonen <karvonen.jorma@gmail.com>\n"
 "Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n"
 "Language: fi\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
+#: lib/libdevmapper.c:399
+#, fuzzy
+msgid "Cannot initialize device-mapper, running as non-root user."
 msgstr "Laitekuvaimen alustus epäonnistui, suoritetaan ei-root-käyttäjänä.\n"
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"Laitekuvaimen alustus epäonnistui. Onko dm_mod-käyttöjärjestelmäydinmoduuli "
-"ladattu?\n"
+#: lib/libdevmapper.c:402
+#, fuzzy
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Laitekuvaimen alustus epäonnistui. Onko dm_mod-käyttöjärjestelmäydinmoduuli ladattu?\n"
 
-#: lib/libdevmapper.c:550
-#, c-format
-msgid "DM-UUID for device %s was truncated.\n"
+#: lib/libdevmapper.c:1131
+#, fuzzy
+msgid "Requested deferred flag is not supported."
+msgstr "Pyydetty LUKS-tiiviste %s ei ole tuettu.\n"
+
+#: lib/libdevmapper.c:1198
+#, fuzzy, c-format
+msgid "DM-UUID for device %s was truncated."
 msgstr "DM-UUID laitteelle %s typistettiin.\n"
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr ""
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+#, fuzzy
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Pyydetyt dmcrypt-suorituskykyvalitsimet eivät ole tuettuja.\n"
+
+#: lib/libdevmapper.c:1630
+#, fuzzy
+msgid "Requested dm-verity data corruption handling options are not supported."
 msgstr "Pyydetyt dmcrypt-suorituskykyvalitsimet eivät ole tuettuja.\n"
 
+#: lib/libdevmapper.c:1634
+#, fuzzy
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Pyydetyt dmcrypt-suorituskykyvalitsimet eivät ole tuettuja.\n"
+
+#: lib/libdevmapper.c:1638
+#, fuzzy
+msgid "Requested data integrity options are not supported."
+msgstr "Pyydetyt dmcrypt-suorituskykyvalitsimet eivät ole tuettuja.\n"
+
+#: lib/libdevmapper.c:1640
+#, fuzzy
+msgid "Requested sector_size option is not supported."
+msgstr "Pyydetyt dmcrypt-suorituskykyvalitsimet eivät ole tuettuja.\n"
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+#, fuzzy
+msgid "Discard/TRIM is not supported."
+msgstr "Tiivistealgoritmia %s ei tueta.\n"
+
+#: lib/libdevmapper.c:1653
+#, fuzzy
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Pyydetty LUKS-tiiviste %s ei ole tuettu.\n"
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr ""
+
 #  Entropy viittaa tässä ilmeisesti tiivistettävän tekstin satunnaisuuteen. Mitä satunnaisempi se on, sitä vähemmän sitä voi tiivistää.
-#: lib/random.c:76
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
 "Järjestelmässä ei ole satunnaisuutta taltioavainta tuotettaessa.\n"
-"Siirrä hiirtä tai kirjoita jotain tekstiä toiseen ikkunaan joidenkin "
-"satunnaistapahtumien keräämiseksi.\n"
+"Siirrä hiirtä tai kirjoita jotain tekstiä toiseen ikkunaan joidenkin satunnaistapahtumien keräämiseksi.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Avainta tuotetaan (%d%% valmis).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
+#: lib/random.c:165
+#, fuzzy
+msgid "Running in FIPS mode."
+msgstr "Suoritetaan FIPS-tilassa.\n"
+
+#: lib/random.c:171
+#, fuzzy
+msgid "Fatal error during RNG initialisation."
 msgstr "Kohtalokas virhe RNG-alustuksen aikana.\n"
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
+#: lib/random.c:208
+#, fuzzy
+msgid "Unknown RNG quality requested."
 msgstr "Tuntematonta RNG-laatua pyydetty.\n"
 
-#: lib/random.c:211
-#, c-format
-msgid "Error %d reading from RNG: %s\n"
+#: lib/random.c:213
+#, fuzzy
+msgid "Error reading from RNG."
 msgstr "Virhe %d luettaessa kohteesta RNG: %s\n"
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
+#: lib/setup.c:229
+#, fuzzy
+msgid "Cannot initialize crypto RNG backend."
 msgstr "RNG-salaustaustaohjelman alustus epäonnistui.\n"
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
+#: lib/setup.c:235
+#, fuzzy
+msgid "Cannot initialize crypto backend."
 msgstr "Salaustaustaohjelman alustus epäonnistui.\n"
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
-#, c-format
-msgid "Hash algorithm %s not supported.\n"
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, fuzzy, c-format
+msgid "Hash algorithm %s not supported."
 msgstr "Tiivistealgoritmia %s ei tueta.\n"
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
-#, c-format
-msgid "Key processing error (using hash %s).\n"
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, fuzzy, c-format
+msgid "Key processing error (using hash %s)."
 msgstr "Avainkäsittelyvirhe (käytetään tiivistealgoritmia %s).\n"
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"Laitetyypin määritteleminen epäonnistui. Laitteen yhteensopimaton "
-"aktivointi?\n"
+#: lib/setup.c:335 lib/setup.c:362
+#, fuzzy
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Laitetyypin määritteleminen epäonnistui. Laitteen yhteensopimaton aktivointi?\n"
+
+#: lib/setup.c:341 lib/setup.c:3050
+#, fuzzy
+msgid "This operation is supported only for LUKS device."
+msgstr "Tätä toimintoa tuetaan vain LUKS-laitteelle.\n"
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
+#: lib/setup.c:368
+#, fuzzy
+msgid "This operation is supported only for LUKS2 device."
 msgstr "Tätä toimintoa tuetaan vain LUKS-laitteelle.\n"
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+#, fuzzy
+msgid "All key slots full."
 msgstr "Kaikki avainvälit ovat täynnä.\n"
 
-#: lib/setup.c:327
-#, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
+#: lib/setup.c:434
+#, fuzzy, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
 msgstr "Avainväli %d on virheellinen, valitse väliltä 0 ... %d.\n"
 
-#: lib/setup.c:333
-#, c-format
-msgid "Key slot %d is full, please select another one.\n"
+#: lib/setup.c:440
+#, fuzzy, c-format
+msgid "Key slot %d is full, please select another one."
 msgstr "Avainväli %d on täynnä, valitse joku toinen.\n"
 
-#: lib/setup.c:472
-#, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Kirjoita salasanalause kohteelle %s: "
+#: lib/setup.c:525 lib/setup.c:2824
+#, fuzzy
+msgid "Device size is not aligned to device logical block size."
+msgstr "Laite %s ei ole kelvollinen LUKS-laite.\n"
 
-#: lib/setup.c:653
-#, c-format
-msgid "Header detected but device %s is too small.\n"
+#: lib/setup.c:624
+#, fuzzy, c-format
+msgid "Header detected but device %s is too small."
 msgstr "Otsake havaittu, mutta laite %s on liian pieni.\n"
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
+#: lib/setup.c:661
+#, fuzzy
+msgid "This operation is not supported for this device type."
 msgstr "Tätä toimintoa ei tueta tälle laitetyypille.\n"
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
-#, c-format
-msgid "Device %s is not active.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr ""
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, fuzzy, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "Tukematon LUKS-versio %d.\n"
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+#, fuzzy
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "UUID ei ole tuettu tälle laitetyypille.\n"
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, fuzzy, c-format
+msgid "Device %s is not active."
 msgstr "Laite %s ei ole aktiivinen.\n"
 
-#: lib/setup.c:925
-#, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
+#: lib/setup.c:1444
+#, fuzzy, c-format
+msgid "Underlying device for crypt device %s disappeared."
 msgstr "Salauslaitteen %s perustana oleva laite hävisi.\n"
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
+#: lib/setup.c:1524
+#, fuzzy
+msgid "Invalid plain crypt parameters."
 msgstr "Virheelliset tavalliset salausparametrit.\n"
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+#, fuzzy
+msgid "Invalid key size."
 msgstr "Virheellinen avainkoko.\n"
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+#, fuzzy
+msgid "UUID is not supported for this crypt type."
 msgstr "UUID ei ole tuettu tälle laitetyypille.\n"
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+#, fuzzy
+msgid "Unsupported encryption sector size."
+msgstr "Uudelleensalauslokitiedoston lukeminen epäonnistui.\n"
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+#, fuzzy
+msgid "Device size is not aligned to requested sector size."
+msgstr "Laite %s ei ole kelvollinen LUKS-laite.\n"
+
+#: lib/setup.c:1608 lib/setup.c:1727
+#, fuzzy
+msgid "Can't format LUKS without device."
 msgstr "Kohteen LUKS pohjustus ilman laitetta epäonnistui.\n"
 
-#: lib/setup.c:1089
-#, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Laitteen %s pohjustus epäonnistui, koska se on yhä käytössä.\n"
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr ""
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr ""
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, fuzzy, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Otsakkeen pyyhkiminen pois laitteesta %s epäonnistui.\n"
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr ""
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr ""
+
+#: lib/setup.c:1821
+#, fuzzy, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Salaus %s ei ole käytettävissä.\n"
 
-#: lib/setup.c:1092
+#: lib/setup.c:1854
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
 msgstr ""
-"Laitteen %s pohjustus epäonnistui, koska pääsy laitteeseen on kielletty.\n"
 
-#: lib/setup.c:1096
+#: lib/setup.c:1858
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Otsakkeen pyyhkiminen pois laitteesta %s epäonnistui.\n"
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, fuzzy, c-format
+msgid "Device %s is too small."
+msgstr "Laite %s on liian pieni.\n"
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, fuzzy, c-format
+msgid "Cannot format device %s in use."
+msgstr "Laitteen %s pohjustus epäonnistui, koska se on yhä käytössä.\n"
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, fuzzy, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Laitteen %s pohjustus epäonnistui, koska pääsy laitteeseen on kielletty.\n"
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, fuzzy, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Laitteelle %s kirjoittaminen epäonnistui.\n"
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
+#: lib/setup.c:1926
+#, fuzzy, c-format
+msgid "Cannot format device %s."
+msgstr "Laitteen %s lukeminen epäonnistui.\n"
+
+#: lib/setup.c:1944
+#, fuzzy
+msgid "Can't format LOOPAES without device."
 msgstr "Kohteen LOOPAES pohjustus ilman laitetta epäonnistui.\n"
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
+#: lib/setup.c:1989
+#, fuzzy
+msgid "Can't format VERITY without device."
 msgstr "Kohteen VERITY pohjustus ilman laitetta epäonnistui.\n"
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
-#, c-format
-msgid "Unsupported VERITY hash type %d.\n"
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, fuzzy, c-format
+msgid "Unsupported VERITY hash type %d."
 msgstr "Tukematon VERITY-tiivistetyyppi %d.\n"
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
+#: lib/setup.c:2006 lib/verity/verity.c:110
+#, fuzzy
+msgid "Unsupported VERITY block size."
 msgstr "Tukematon VERITY-lohkokoko.\n"
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
+#: lib/setup.c:2011 lib/verity/verity.c:74
+#, fuzzy
+msgid "Unsupported VERITY hash offset."
+msgstr "Tukematon VERITY-tiivistesiirros.\n"
+
+#: lib/setup.c:2016
+#, fuzzy
+msgid "Unsupported VERITY FEC offset."
 msgstr "Tukematon VERITY-tiivistesiirros.\n"
 
-#: lib/setup.c:1285
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr ""
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr ""
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr ""
+
+#: lib/setup.c:2208
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
+
+#: lib/setup.c:2286
+#, fuzzy, c-format
+msgid "Unknown crypt device type %s requested."
 msgstr "Tuntematon salauslaitetyyppi %s pyydetty.\n"
 
-#: lib/setup.c:1435
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, fuzzy, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "Otsakkeen pyyhkiminen pois laitteesta %s epäonnistui.\n"
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, fuzzy, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Otsakkeen pyyhkiminen pois laitteesta %s epäonnistui.\n"
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr ""
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "Laitteen %s lukeminen epäonnistui.\n"
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, fuzzy, c-format
+msgid "Failed to suspend device %s."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "Laitteen %s lukeminen epäonnistui.\n"
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr ""
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Laitekuvaajahakemiston hankkiminen epäonnistui."
+
+#: lib/setup.c:2809
+#, fuzzy
+msgid "Cannot resize loop device."
+msgstr "Silmukkalaitteen koon muuttaminen epäonnistui.\n"
+
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "Haluatko todella vaihtaa laitteen UUID-tunnistetta?"
 
-#: lib/setup.c:1545
-#, c-format
-msgid "Volume %s is not active.\n"
+#: lib/setup.c:2958
+#, fuzzy
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Varmuuskopiotiedosto ei sisällä kelvollista LUKS-otsaketta.\n"
+
+#: lib/setup.c:3058
+#, fuzzy, c-format
+msgid "Volume %s is not active."
 msgstr "Taltio %s ei ole käytössä.\n"
 
-#: lib/setup.c:1556
-#, c-format
-msgid "Volume %s is already suspended.\n"
+#: lib/setup.c:3069
+#, fuzzy, c-format
+msgid "Volume %s is already suspended."
 msgstr "Taltio %s on jo keskeytetty.\n"
 
-#: lib/setup.c:1563
-#, c-format
-msgid "Suspend is not supported for device %s.\n"
+#: lib/setup.c:3082
+#, fuzzy, c-format
+msgid "Suspend is not supported for device %s."
 msgstr "Keskeyttämistä ei tueta laitetyypille %s.\n"
 
-#: lib/setup.c:1565
-#, c-format
-msgid "Error during suspending device %s.\n"
+#: lib/setup.c:3084
+#, fuzzy, c-format
+msgid "Error during suspending device %s."
 msgstr "Virhe keskeytettäessä laitetta %s.\n"
 
-#: lib/setup.c:1591 lib/setup.c:1638
-#, c-format
-msgid "Volume %s is not suspended.\n"
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, fuzzy, c-format
+msgid "Volume %s is not suspended."
 msgstr "Taltiota %s ei ole keskeytetty.\n"
 
-#: lib/setup.c:1605
-#, c-format
-msgid "Resume is not supported for device %s.\n"
+#: lib/setup.c:3146
+#, fuzzy, c-format
+msgid "Resume is not supported for device %s."
 msgstr "Jatkamista ei tueta laiteelle %s.\n"
 
-#: lib/setup.c:1607 lib/setup.c:1659
-#, c-format
-msgid "Error during resuming device %s.\n"
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, fuzzy, c-format
+msgid "Error during resuming device %s."
 msgstr "Virhe jatkettaessa laitteella %s.\n"
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Kirjoita salasanalause: "
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+#, fuzzy
+msgid "Volume key does not match the volume."
+msgstr "Taltioavain ei täsmää taltion kanssa.\n"
 
 #  Volume key tarkoittaa yleensä äänenvoimakkuussäädintä, ei välttämättä tässä.
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Avainvälin lisäys epäonnistui, kaikki välit on otettu pois käytöstä ja "
-"yhtään taltioavainta ei ole tarjottu.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+#, fuzzy
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Avainvälin lisäys epäonnistui, kaikki välit on otettu pois käytöstä ja yhtään taltioavainta ei ole tarjottu.\n"
+
+#: lib/setup.c:3483
+#, fuzzy
+msgid "Failed to swap new key slot."
+msgstr "Uuden avainvälin vaihtaminen epäonnistui.\n"
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Kirjoita mikä tahansa salasanalause: "
+#: lib/setup.c:3669
+#, fuzzy, c-format
+msgid "Key slot %d is invalid."
+msgstr "Avainväli %d on virheellinen.\n"
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Kirjoita uusi salasanalause avainvälille: "
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, fuzzy, c-format
+msgid "Keyslot %d is not active."
+msgstr "Avainväli %d ei ole käytössä.\n"
 
-#: lib/setup.c:1798
-#, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Avaivälin %d vaihtui.\n"
+#: lib/setup.c:3694
+#, fuzzy
+msgid "Device header overlaps with data area."
+msgstr "Tälle salasanalauseelle ei ole saatavissa laiteotsaketta.\n"
 
-#: lib/setup.c:1801
-#, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Korvattiin avainvälillä %d.\n"
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr ""
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Uuden avainvälin vaihtaminen epäonnistui.\n"
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+#, fuzzy
+msgid "Failed to get reencryption lock."
+msgstr "Uudelleensalauslokitiedoston lukeminen epäonnistui.\n"
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Taltioavain ei täsmää taltion kanssa.\n"
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+#, fuzzy
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Uudelleensalauslokitiedoston avaus epäonnistui.\n"
 
-#: lib/setup.c:1961
-#, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Avainväli %d on virheellinen.\n"
+#: lib/setup.c:4127 lib/setup.c:4379
+#, fuzzy
+msgid "Device type is not properly initialized."
+msgstr "Laitetyyppi ei ole alustettu oikein.\n"
 
-#: lib/setup.c:1966
-#, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Avainväli %d ei ole käytössä.\n"
+#: lib/setup.c:4171
+#, fuzzy, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Laitteen %s pohjustus epäonnistui, koska se on yhä käytössä.\n"
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
-#, c-format
-msgid "Device %s already exists.\n"
+#: lib/setup.c:4174
+#, fuzzy, c-format
+msgid "Device %s already exists."
 msgstr "Laite %s on jo olemassa.\n"
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
+#: lib/setup.c:4296
+#, fuzzy
+msgid "Incorrect volume key specified for plain device."
 msgstr "Virheellinen taltioavain määritelty tavalliselle laitteelle.\n"
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
+#: lib/setup.c:4405
+#, fuzzy
+msgid "Incorrect root hash specified for verity device."
 msgstr "Virheellinen root-tiiviste määritelty verity-laitteelle.\n"
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Laitetyyppi ei ole alustettu oikein.\n"
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr ""
 
-#: lib/setup.c:2259
-#, c-format
-msgid "Device %s is still in use.\n"
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr ""
+
+#: lib/setup.c:4438 lib/setup.c:5915
+#, fuzzy
+msgid "Failed to load key in kernel keyring."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, fuzzy, c-format
+msgid "Device %s is still in use."
 msgstr "Laite %s on yhä käytössä.\n"
 
-#: lib/setup.c:2268
-#, c-format
-msgid "Invalid device %s.\n"
+#: lib/setup.c:4516
+#, fuzzy, c-format
+msgid "Invalid device %s."
 msgstr "Virheellinen laite %s.\n"
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Funktio ei ole käytettävissä FIPS-tilassa.\n"
-
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
+#: lib/setup.c:4632
+#, fuzzy
+msgid "Volume key buffer too small."
 msgstr "Taltioavainpuskuri on liian pieni.\n"
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
+#: lib/setup.c:4640
+#, fuzzy
+msgid "Cannot retrieve volume key for plain device."
 msgstr "Taltioavaimen nouto tavalliselle laitteelle epäonnistui.\n"
 
-#: lib/setup.c:2310
-#, c-format
-msgid "This operation is not supported for %s crypt device.\n"
+#: lib/setup.c:4657
+#, fuzzy
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Virheellinen root-tiiviste määritelty verity-laitteelle.\n"
+
+#: lib/setup.c:4659
+#, fuzzy, c-format
+msgid "This operation is not supported for %s crypt device."
 msgstr "Tätä toimintoa ei tueta %s-salauslaitteelle.\n"
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
+#: lib/setup.c:4865
+#, fuzzy
+msgid "Dump operation is not supported for this device type."
 msgstr "Dump-toimintoa ei tueta tälle laitetyypille.\n"
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Prosessiprioriteetin hakeminen epäonnistui.\n"
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr ""
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Muistin lukituksen avaus epäonnistui.\n"
+#: lib/setup.c:5475
+#, fuzzy, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Laitteen %s pohjustus epäonnistui, koska se on yhä käytössä.\n"
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Muisti loppui luettaessa salasanalausetta.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr ""
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Virhe luettaessa salasanalausetta pääteikkunasta.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr ""
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Todenna salasanalause: "
+#: lib/setup.c:5851
+#, fuzzy, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Uuden avainvälin vaihtaminen epäonnistui.\n"
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Salasanalauseet eivät täsmää.\n"
+#: lib/setup.c:5982
+#, fuzzy
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Tätä toimintoa ei tueta tälle laitetyypille.\n"
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Siirrososoitteen käyttö pääteikkunasyötteellä epäonnistui.\n"
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, fuzzy, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr ""
+
+#: lib/utils.c:80
+#, fuzzy
+msgid "Cannot get process priority."
+msgstr "Prosessiprioriteetin hakeminen epäonnistui.\n"
+
+#: lib/utils.c:94
+#, fuzzy
+msgid "Cannot unlock memory."
+msgstr "Muistin lukituksen avaus epäonnistui.\n"
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+#, fuzzy
+msgid "Failed to open key file."
 msgstr "Avaintiedoston avaus epäonnistui.\n"
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
+#: lib/utils.c:173
+#, fuzzy
+msgid "Cannot read keyfile from a terminal."
+msgstr "Avaintiedoston %s lukeminen epäonnistui.\n"
+
+#: lib/utils.c:190
+#, fuzzy
+msgid "Failed to stat key file."
 msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
+#: lib/utils.c:198 lib/utils.c:219
+#, fuzzy
+msgid "Cannot seek to requested keyfile offset."
 msgstr "Pyydetyn avaintiedostosiirrososoitteen etsintä epäonnistui.\n"
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+#, fuzzy
+msgid "Out of memory while reading passphrase."
+msgstr "Muisti loppui luettaessa salasanalausetta.\n"
+
+#: lib/utils.c:248
+#, fuzzy
+msgid "Error reading passphrase."
 msgstr "Virhe luettaessa salasanalausetta.\n"
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr ""
+
+#: lib/utils.c:272
+#, fuzzy
+msgid "Maximum keyfile size exceeded."
 msgstr "Avaintiedoston enimmäiskoko ylitettiin.\n"
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
+#: lib/utils.c:277
+#, fuzzy
+msgid "Cannot read requested amount of data."
 msgstr "Pyydetyn tietomäärän lukeminen epäonnistui.\n"
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
-#, c-format
-msgid "Device %s doesn't exist or access denied.\n"
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, fuzzy, c-format
+msgid "Device %s does not exist or access denied."
 msgstr "Laite %s ei ole olemassa tai pääsy siihen on kielletty.\n"
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
+#: lib/utils_device.c:197
+#, fuzzy, c-format
+msgid "Device %s is not compatible."
+msgstr "Laite %s ei ole aktiivinen.\n"
+
+#: lib/utils_device.c:642
+#, fuzzy, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Laite %s on liian pieni. (LUKS vaatii vähintään %<PRIu64> tavua.)\n"
+
+#: lib/utils_device.c:723
+#, fuzzy, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Laitteen %s käyttö epäonnistui, koska se on jo käytössä (jo kuvattu tai liitetty).\n"
+
+#: lib/utils_device.c:727
+#, fuzzy, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Laitteeseen %s kirjoittaminen epäonnistui, pääsy kielletty.\n"
+
+#: lib/utils_device.c:730
+#, fuzzy, c-format
+msgid "Cannot get info about device %s."
+msgstr "Tietojen hakeminen laitteesta %s epäonnistui.\n"
+
+#: lib/utils_device.c:753
+#, fuzzy
+msgid "Cannot use a loopback device, running as non-root user."
 msgstr "Silmukkalaitteen käyttö epäonnistui, suoritetaan ei-root-käyttäjänä.\n"
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Vapaan silmukkalaiteen löytäminen epäonnistui.\n"
+#: lib/utils_device.c:763
+#, fuzzy
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Silmukkalaitteeseen liittyminen epäonnistui (vaaditaan silmukkalaite autoclear-lipulla).\n"
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
+#: lib/utils_device.c:809
+#, fuzzy, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Pyydetty siirrososoite on laitteen %s todellisen koon ulkopuolella.\n"
+
+#: lib/utils_device.c:817
+#, fuzzy, c-format
+msgid "Device %s has zero size."
+msgstr "Laitteen %s koko on nolla.\n"
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
 msgstr ""
-"Silmukkalaitteeseen liittyminen epäonnistui (vaaditaan silmukkalaite "
-"autoclear-lipulla).\n"
 
-#: lib/utils_device.c:484
+#: lib/utils_pbkdf.c:106
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
+msgid "Unknown PBKDF type %s."
 msgstr ""
-"Laitteen %s käyttö epäonnistui, koska se on jo käytössä (jo kuvattu tai "
-"liitetty).\n"
 
-#: lib/utils_device.c:488
+#: lib/utils_pbkdf.c:111
+#, fuzzy, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Pyydetty LUKS-tiiviste %s ei ole tuettu.\n"
+
+#: lib/utils_pbkdf.c:122
+#, fuzzy
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Pyydetty LUKS-tiiviste %s ei ole tuettu.\n"
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr ""
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Tietojen hakeminen laitteesta %s epäonnistui.\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr ""
 
-#: lib/utils_device.c:494
+#: lib/utils_pbkdf.c:148
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr "Pyydetty siirrososoite on laitteen %s todellisen koon ulkopuolella.\n"
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr ""
 
-#: lib/utils_device.c:502
+#: lib/utils_pbkdf.c:155
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Laitteen %s koko on nolla.\n"
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr ""
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr ""
 
-#: lib/utils_device.c:513
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr ""
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr ""
+
+#: lib/utils_benchmark.c:191
+#, fuzzy, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Ei ole yhteensopiva PBKDF2-valitsimien kanssa (käytetään tiivitstealgoritmia %s).\n"
+
+#: lib/utils_benchmark.c:211
+#, fuzzy
+msgid "Not compatible PBKDF options."
+msgstr "Ei ole yhteensopiva PBKDF2-valitsimien kanssa (käytetään tiivitstealgoritmia %s).\n"
+
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Laite %s on liian pieni.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr ""
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr ""
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr ""
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+#, fuzzy
+msgid "Cannot seek to device offset."
+msgstr "Laitteen siirrososoitteen etsintä epäonnistui.\n"
 
-#: lib/luks1/keyencryption.c:37
+#: lib/utils_wipe.c:208
 #, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:39
+#, fuzzy, c-format
 msgid ""
 "Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 "Dm-crypt -avainkuvausasetus laitteelle %s epäonnistui.\n"
-"Tarkista, että käyttöjärjestelmäydin tukee %s-salakirjoitusmenetelmää "
-"(lisätietoja tarkistamalla syslog).\n"
+"Tarkista, että käyttöjärjestelmäydin tukee %s-salakirjoitusmenetelmää (lisätietoja tarkistamalla syslog).\n"
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
+#: lib/luks1/keyencryption.c:44
+#, fuzzy
+msgid "Key size in XTS mode must be 256 or 512 bits."
 msgstr "Avainkoon on oltava XTS-tilassa 256 tai 512 bittiä.\n"
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
-#, c-format
-msgid "Cannot write to device %s, permission denied.\n"
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, fuzzy, c-format
+msgid "Cannot write to device %s, permission denied."
 msgstr "Laitteeseen %s kirjoittaminen epäonnistui, pääsy kielletty.\n"
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
+#: lib/luks1/keyencryption.c:120
+#, fuzzy
+msgid "Failed to open temporary keystore device."
 msgstr "Tilapäisen avainsäiliön avaaminen epäonnistui.\n"
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
+#: lib/luks1/keyencryption.c:127
+#, fuzzy
+msgid "Failed to access temporary keystore device."
 msgstr "Pääsy tilapäiseen avainsäiliölaitteeseen epäonnistui.\n"
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+#, fuzzy
+msgid "IO error while encrypting keyslot."
 msgstr "Siirräntävirhe salattaessa avainväliä.\n"
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, fuzzy, c-format
+msgid "Cannot open device %s."
+msgstr "Laitteen %s avaus epäonnistui.\n"
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+#, fuzzy
+msgid "IO error while decrypting keyslot."
 msgstr "Siirräntävirhe purettaessa avainvälin salausta.\n"
 
-#: lib/luks1/keymanage.c:90
-#, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
+#: lib/luks1/keymanage.c:110
+#, fuzzy, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
 msgstr "Laite %s on liian pieni. (LUKS vaatii vähintään %<PRIu64> tavua.)\n"
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
-#, c-format
-msgid "Device %s is not a valid LUKS device.\n"
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, fuzzy, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "LUKS-avainväli %u on virheellinen.\n"
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, fuzzy, c-format
+msgid "Device %s is not a valid LUKS device."
 msgstr "Laite %s ei ole kelvollinen LUKS-laite.\n"
 
-#: lib/luks1/keymanage.c:198
-#, c-format
-msgid "Requested header backup file %s already exists.\n"
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, fuzzy, c-format
+msgid "Requested header backup file %s already exists."
 msgstr "Pyydetty otsakevarmuuskopiotiedosto %s on jo olemassa.\n"
 
-#: lib/luks1/keymanage.c:200
-#, c-format
-msgid "Cannot create header backup file %s.\n"
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, fuzzy, c-format
+msgid "Cannot create header backup file %s."
 msgstr "Otsakevarmuuskopiotiedoston %s luominen epäonnistui.\n"
 
-#: lib/luks1/keymanage.c:205
-#, c-format
-msgid "Cannot write header backup file %s.\n"
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, fuzzy, c-format
+msgid "Cannot write header backup file %s."
 msgstr "Otsakevarmuuskopiotiedoston %s kirjoittaminen epäonnistui.\n"
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+#, fuzzy
+msgid "Backup file does not contain valid LUKS header."
 msgstr "Varmuuskopiotiedosto ei sisällä kelvollista LUKS-otsaketta.\n"
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
-#, c-format
-msgid "Cannot open header backup file %s.\n"
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, fuzzy, c-format
+msgid "Cannot open header backup file %s."
 msgstr "Otsakevarmuuskopiotiedoston %s avaus epäonnistui.\n"
 
-#: lib/luks1/keymanage.c:258
-#, c-format
-msgid "Cannot read header backup file %s.\n"
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, fuzzy, c-format
+msgid "Cannot read header backup file %s."
 msgstr "Otsakevarmuuskopiotiedoston %s lukeminen epäonnistui.\n"
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Tietosiirrososoite tai avainkoko eroaa laitteessa ja varmuuskopiossa, "
-"palautus epäonnistui.\n"
+#: lib/luks1/keymanage.c:317
+#, fuzzy
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Tietosiirrososoite tai avainkoko eroaa laitteessa ja varmuuskopiossa, palautus epäonnistui.\n"
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Laite %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"ei sisällä LUKS-otsaketta. Otsakkeen korvaaminen voi tuhota tietoja tuossa "
-"laitteessa."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "ei sisällä LUKS-otsaketta. Otsakkeen korvaaminen voi tuhota tietoja tuossa laitteessa."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"sisältää jo LUKS-otsakkeen. Otsakkeen korvaaminen tuhoaa olemassaolevat "
-"avainvälit."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "sisältää jo LUKS-otsakkeen. Otsakkeen korvaaminen tuhoaa olemassaolevat avainvälit."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
 msgstr ""
 "\n"
-"VAROITUS: oikealla laiteotsakkeella on eri UUID-tunniste kuin "
-"varmuuskopiolla!"
-
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Laitteen %s avaus epäonnistui.\n"
+"VAROITUS: oikealla laiteotsakkeella on eri UUID-tunniste kuin varmuuskopiolla!"
 
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
+#: lib/luks1/keymanage.c:375
+#, fuzzy
+msgid "Non standard key size, manual repair required."
 msgstr "Ei-vakio avainkoko, manuaalinen korjaus pyydetty.\n"
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
+#: lib/luks1/keymanage.c:380
+#, fuzzy
+msgid "Non standard keyslots alignment, manual repair required."
 msgstr "Ei-vakiot avainvälitasaukset, manuaalinen korjaus pyydetty.\n"
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
+#: lib/luks1/keymanage.c:390
+#, fuzzy
+msgid "Repairing keyslots."
 msgstr "Korjataan avainvälit.\n"
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Korjaus epäonnistui."
-
-#: lib/luks1/keymanage.c:363
-#, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
+#: lib/luks1/keymanage.c:409
+#, fuzzy, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
 msgstr "Avainväli %i: siirrososoite korjattu (%u -> %u).\n"
 
-#: lib/luks1/keymanage.c:371
-#, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
+#: lib/luks1/keymanage.c:417
+#, fuzzy, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
 msgstr "Avainväli %i: raidat korjattu (%u -> %u).\n"
 
-#: lib/luks1/keymanage.c:380
-#, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
+#: lib/luks1/keymanage.c:426
+#, fuzzy, c-format
+msgid "Keyslot %i: bogus partition signature."
 msgstr "Avainväli %i: valeosiotunniste.\n"
 
-#: lib/luks1/keymanage.c:385
-#, c-format
-msgid "Keyslot %i: salt wiped.\n"
+#: lib/luks1/keymanage.c:431
+#, fuzzy, c-format
+msgid "Keyslot %i: salt wiped."
 msgstr "Avainväli %i: satunnaisarvosiemen tuhottu.\n"
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
+#: lib/luks1/keymanage.c:448
+#, fuzzy
+msgid "Writing LUKS header to disk."
 msgstr "Kirjoitetaan LUKS-otsake levylle.\n"
 
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Tukematon LUKS-versio %d.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Korjaus epäonnistui."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, fuzzy, c-format
+msgid "Requested LUKS hash %s is not supported."
 msgstr "Pyydetty LUKS-tiiviste %s ei ole tuettu.\n"
 
-#: lib/luks1/keymanage.c:442
-#, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "LUKS-avainväli %u on virheellinen.\n"
-
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+#, fuzzy
+msgid "No known problems detected for LUKS header."
 msgstr "Tuntemattomat pulmat havaittu LUKS-otsakkeelle.\n"
 
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
+#: lib/luks1/keymanage.c:660
+#, fuzzy, c-format
+msgid "Error during update of LUKS header on device %s."
 msgstr "Virhe LUKS-otsakkeen päivityksen aikana laitteessa %s.\n"
 
-#: lib/luks1/keymanage.c:603
-#, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Virhe luettaessa uudelleen LUKS-otsaketta päivityksen jälkeen laitteessa "
-"%s.\n"
-
-#: lib/luks1/keymanage.c:654
-#, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"Tietosiirrososoitteen irrotetulle LUKS-otsakkeelle on oltava joko 0 tai "
-"suurempi kuin otsakekoko (%d sektoria).\n"
-
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
+#: lib/luks1/keymanage.c:668
+#, fuzzy, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Virhe luettaessa uudelleen LUKS-otsaketta päivityksen jälkeen laitteessa %s.\n"
+
+#: lib/luks1/keymanage.c:744
+#, fuzzy
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Tietosiirrososoitteen irrotetulle LUKS-otsakkeelle on oltava joko 0 tai suurempi kuin otsakekoko (%d sektoria).\n"
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+#, fuzzy
+msgid "Wrong LUKS UUID format provided."
 msgstr "Väärä LUKS UUID-muoto tarjottu.\n"
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-"LUKS-otsakkeen luominen epäonnistui: satunnaisarvosiemenen lukeminen "
-"epäonnistui.\n"
-
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr ""
-"Ei ole yhteensopiva PBKDF2-valitsimien kanssa (käytetään tiivitstealgoritmia "
-"%s).\n"
+#: lib/luks1/keymanage.c:778
+#, fuzzy
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "LUKS-otsakkeen luominen epäonnistui: satunnaisarvosiemenen lukeminen epäonnistui.\n"
 
-#: lib/luks1/keymanage.c:717
-#, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"LUKS-otsakkeen luominen epäonnistui: otsaketiiviste epäonnistui (käytettäen "
-"tiivistettä %s).\n"
+#: lib/luks1/keymanage.c:804
+#, fuzzy, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "LUKS-otsakkeen luominen epäonnistui: otsaketiiviste epäonnistui (käytettäen tiivistettä %s).\n"
 
-#: lib/luks1/keymanage.c:782
-#, c-format
-msgid "Key slot %d active, purge first.\n"
+#: lib/luks1/keymanage.c:848
+#, fuzzy, c-format
+msgid "Key slot %d active, purge first."
 msgstr "Avainväli %d aktiivinen, puhdista ensimmäinen.\n"
 
-#: lib/luks1/keymanage.c:788
-#, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Avainvälin %d materiaali sisältää liian vähän raitoja. Otsaketta on "
-"käsitelty?\n"
-
-#: lib/luks1/keymanage.c:950
-#, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Avaivälin %d lukitus avattu.\n"
+#: lib/luks1/keymanage.c:854
+#, fuzzy, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Avainvälin %d materiaali sisältää liian vähän raitoja. Otsaketta on käsitelty?\n"
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Tälle salasanalauseelle ei ole saatavissa avainta.\n"
+#: lib/luks1/keymanage.c:990
+#, fuzzy, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Avainkäsittelyvirhe (käytetään tiivistealgoritmia %s).\n"
 
-#: lib/luks1/keymanage.c:1003
-#, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
+#: lib/luks1/keymanage.c:1066
+#, fuzzy, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
 msgstr "Avainväli %d on virheellinen, valitse avainväli välillä 0 ... %d.\n"
 
-#: lib/luks1/keymanage.c:1021
-#, c-format
-msgid "Cannot wipe device %s.\n"
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, fuzzy, c-format
+msgid "Cannot wipe device %s."
 msgstr "Laitteen %s pyyhkiminen tyhjäksi epäonnistui.\n"
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
+#, fuzzy
+msgid "Detected not yet supported GPG encrypted keyfile."
 msgstr "Havaittu vielä tukematon GPG-salausavaintiedosto.\n"
 
 #: lib/loopaes/loopaes.c:147
@@ -692,417 +1062,1408 @@ msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
 msgstr "Käytä gpg --decrypt <AVAINTIEDOSTO> | cryptsetup --keyfile=- ...\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
+#, fuzzy
+msgid "Incompatible loop-AES keyfile detected."
 msgstr "Yhteensopimaton loop-AES -avaintiedosto havaittu.\n"
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
+#: lib/loopaes/loopaes.c:245
+#, fuzzy
+msgid "Kernel does not support loop-AES compatible mapping."
 msgstr "Käyttöjärjestelmäydin ei tule loop-AES -yhteensopivaa kuvausta.\n"
 
-#: lib/tcrypt/tcrypt.c:475
-#, c-format
-msgid "Error reading keyfile %s.\n"
+#: lib/tcrypt/tcrypt.c:504
+#, fuzzy, c-format
+msgid "Error reading keyfile %s."
 msgstr "Virhe luettaessa avaintiedostoa %s.\n"
 
-#: lib/tcrypt/tcrypt.c:513
-#, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
+#: lib/tcrypt/tcrypt.c:554
+#, fuzzy, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
 msgstr "TCRYPT-salasanalauseen enimmäispituus (%d) ylitettiin.\n"
 
-#: lib/tcrypt/tcrypt.c:543
-#, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
+#: lib/tcrypt/tcrypt.c:595
+#, fuzzy, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
 msgstr "PBKDF2-tiivistealgoritmi %s ei ole käytettävissä, ohitetaan.\n"
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+#, fuzzy
+msgid "Required kernel crypto interface not available."
 msgstr "Pyydetty ydinsalauskäyttöliittymä ei ole käytettävissä.\n"
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr ""
-"Varmista, että algif_skcipher-käyttöjärjestelmäydinmoduuli on ladattu.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+#, fuzzy
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Varmista, että algif_skcipher-käyttöjärjestelmäydinmoduuli on ladattu.\n"
 
-#: lib/tcrypt/tcrypt.c:707
-#, c-format
-msgid "Activation is not supported for %d sector size.\n"
+#: lib/tcrypt/tcrypt.c:753
+#, fuzzy, c-format
+msgid "Activation is not supported for %d sector size."
 msgstr "Aktivointia ei tueta sektorikoolle %d.\n"
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr ""
-"Käyttöjärjestelmäydin ei tue aktivointia tälle TCRYPT-perinnetilassa.\n"
+#: lib/tcrypt/tcrypt.c:759
+#, fuzzy
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Käyttöjärjestelmäydin ei tue aktivointia tälle TCRYPT-perinnetilassa.\n"
 
-#: lib/tcrypt/tcrypt.c:744
-#, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
+#: lib/tcrypt/tcrypt.c:793
+#, fuzzy, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
 msgstr "Aktivoidaan TCRYPT-järjestelmäsalaus osiolle %s.\n"
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
+#: lib/tcrypt/tcrypt.c:871
+#, fuzzy
+msgid "Kernel does not support TCRYPT compatible mapping."
 msgstr "Käyttöjärjestelmäydin ei tue TCRYPT -yhteensopivaa kuvausta.\n"
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Tätä toimintoa ei tueta ilman TCRYPT-otsakelatausta."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Verity-laite %s ei käytä paikallista levyotsaketta.\n"
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr ""
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Laite %s ei ole kelvollinen VERITY-laite.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Tukematon LUKS-versio %d.\n"
+
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
+
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:594
+#, fuzzy
+msgid "Unknown or unsupported encryption type."
+msgstr "UUID ei ole tuettu tälle laitetyypille.\n"
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:921
+#, fuzzy
+msgid "This operation is not supported."
+msgstr "Tätä toimintoa ei tueta %s-salauslaitteelle.\n"
+
+#: lib/bitlk/bitlk.c:929
+#, fuzzy
+msgid "Wrong key size."
+msgstr "Virheellinen avainkoko.\n"
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr ""
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, fuzzy, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Verity-laite %s ei käytä paikallista levyotsaketta.\n"
+
+#: lib/verity/verity.c:90
+#, fuzzy, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "Laite %s ei ole kelvollinen VERITY-laite.\n"
+
+#: lib/verity/verity.c:97
+#, fuzzy, c-format
+msgid "Unsupported VERITY version %d."
 msgstr "Tukematon VERITY-versio %d.\n"
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
+#: lib/verity/verity.c:128
+#, fuzzy
+msgid "VERITY header corrupted."
 msgstr "VERITY-otsake rikkinäinen.\n"
 
-#: lib/verity/verity.c:166
-#, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
+#: lib/verity/verity.c:165
+#, fuzzy, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
 msgstr "Väärä VERITY UUID-muoto tarjottu laitteessa %s.\n"
 
-#: lib/verity/verity.c:196
-#, c-format
-msgid "Error during update of verity header on device %s.\n"
+#: lib/verity/verity.c:198
+#, fuzzy, c-format
+msgid "Error during update of verity header on device %s."
 msgstr "Virhe verity-otsakkeen päivityksen aikana laitteessa %s.\n"
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
+#: lib/verity/verity.c:256
+#, fuzzy
+msgid "Root hash signature verification is not supported."
+msgstr "Tiivistealgoritmia %s ei tueta.\n"
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:308
+#, fuzzy
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Käyttöjärjestelmäydin ei tule dm-verity -yhteensopivaa kuvausta.\n"
+
+#: lib/verity/verity.c:312
+#, fuzzy
+msgid "Kernel does not support dm-verity signature option."
 msgstr "Käyttöjärjestelmäydin ei tule dm-verity -yhteensopivaa kuvausta.\n"
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
+#: lib/verity/verity.c:323
+#, fuzzy
+msgid "Verity device detected corruption after activation."
 msgstr "Verity-laite havaitsi rikkoutumisen aktivoinnin jälkeen.\n"
 
 #: lib/verity/verity_hash.c:59
-#, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
+#, fuzzy, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
 msgstr "Vapaa-aluetta ei ole nollattu sijainnissa %<PRIu64>.\n"
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+#, fuzzy
+msgid "Device offset overflow."
 msgstr "Laitesiirrososoitteen ylivuoto.\n"
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
+#: lib/verity/verity_hash.c:203
+#, fuzzy, c-format
+msgid "Verification failed at position %<PRIu64>."
 msgstr "Todennus epäonnistui sijainnissa %<PRIu64>.\n"
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
+#: lib/verity/verity_hash.c:276
+#, fuzzy
+msgid "Invalid size parameters for verity device."
 msgstr "Virheelliset kokoparametrit verity-laitteelle.\n"
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Verity-taltiolla liian monta puutasoa.\n"
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr ""
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
+#: lib/verity/verity_hash.c:373
+#, fuzzy
+msgid "Verification of data area failed."
 msgstr "Data-alueen todentaminen epäonnistui.\n"
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
+#: lib/verity/verity_hash.c:378
+#, fuzzy
+msgid "Verification of root hash failed."
 msgstr "Root-tiivisteen todentaminen epäonnistui.\n"
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
+#: lib/verity/verity_hash.c:384
+#, fuzzy
+msgid "Input/output error while creating hash area."
 msgstr "Syöte/tulostevirhe luotaessa tiivistealuetta.\n"
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
+#: lib/verity/verity_hash.c:386
+#, fuzzy
+msgid "Creation of hash area failed."
 msgstr "Tiivistealueen luominen epäonnistui.\n"
 
-#: lib/verity/verity_hash.c:414
-#, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
+#: lib/verity/verity_hash.c:433
+#, fuzzy, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "VAROITUS: Käyttöjärjestelmäydin ei voi aktivoida laitetta, jos lohkokoko ylittää sivukoon (%u).\n"
+
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
 msgstr ""
-"VAROITUS: Käyttöjärjestelmäydin ei voi aktivoida laitetta, jos lohkokoko "
-"ylittää sivukoon (%u).\n"
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr "Salasanalauseiden todennus epäonnistui ei-tty-syötteissä.\n"
+#: lib/verity/verity_fec.c:146
+#, fuzzy
+msgid "Failed to allocate buffer."
+msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Havaittu tuntematon salakirjoitusmenetelmämäärittelymalli.\n"
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr ""
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
 msgstr ""
-"VAROITUS: Parametri --hash ohitetaan tavallisessa tilassa kun avaintiedosto "
-"on määritelty.\n"
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
 msgstr ""
-"VAROITUS: Valitsin --keyfile-size ohitetaan , lukukoko on sama kuin "
-"salausavaimen koko.\n"
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "Vaaditaan valitsin --key-file.\n"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr ""
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Tälle salasanalauseelle ei ole saatavissa laiteotsaketta.\n"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr ""
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
 msgstr ""
-"Otsakevedos taltioavaimella on arkaluonteista tietoa,\n"
-"joka sallii pääsyn salatulle osiolle ilman salasanaa.\n"
-"Tämä vedos pitäisi aina tallentaa salattuna turvallisessa paikasssa."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Suorituskykytestin tulos ei ole luotettava.\n"
+#: lib/verity/verity_fec.c:265
+#, fuzzy, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Tilapäisen avainsäiliön avaaminen epäonnistui.\n"
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr "# Testit käyttävät vain muistia ylimalkaan (ei tallennussiirtos).\n"
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+#, fuzzy
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Käyttöjärjestelmäydin ei tule dm-verity -yhteensopivaa kuvausta.\n"
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "#  Algoritmi | Avain |  Salaus |  Salauksen purku\n"
+#: lib/integrity/integrity.c:277
+#, fuzzy
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Käyttöjärjestelmäydin ei tule dm-verity -yhteensopivaa kuvausta.\n"
 
-#: src/cryptsetup.c:587
-#, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Salaus %s ei ole käytettävissä.\n"
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, fuzzy, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Pääsy tilapäiseen avainsäiliölaitteeseen epäonnistui.\n"
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "Ei käytössä"
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
 
-#: src/cryptsetup.c:639
-#, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Avaintiedoston %s lukeminen epäonnistui.\n"
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+
+#: lib/luks2/luks2_json_format.c:227
+#, fuzzy
+msgid "Requested data offset is too small."
+msgstr "Laite %s on liian pieni.\n"
 
-#: src/cryptsetup.c:643
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Ei voida lukea %d tavua avaintiedostosta %s.\n"
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr ""
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Yritetäänkö todella korjata LUKS-laiteotsake?"
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, fuzzy, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Pääsy tilapäiseen avainsäiliölaitteeseen epäonnistui.\n"
 
-#: src/cryptsetup.c:697
+#: lib/luks2/luks2_json_metadata.c:1167
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Tämä korvaa tiedot kohteella %s peruuttamattomasti."
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr ""
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "muistivarausvirhe kohteessa action_luksFormat"
+#: lib/luks2/luks2_json_metadata.c:1208
+#, fuzzy
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Tietosiirrososoite tai avainkoko eroaa laitteessa ja varmuuskopiossa, palautus epäonnistui.\n"
 
-#: src/cryptsetup.c:717
-#, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Kohteen %s käyttö paikallisena levyotsakkeena epäonnistui.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+#, fuzzy
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Tietosiirrososoite tai avainkoko eroaa laitteessa ja varmuuskopiossa, palautus epäonnistui.\n"
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
-"Pienennetty tietosiirrososoite sallitaan vain irrotetulle LUKS-otsakkeelle.\n"
+#: lib/luks2/luks2_json_metadata.c:1221
+#, fuzzy, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Laite %s %s%s"
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
-#, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Avainväli %d valittu poistoa varten.\n"
+#: lib/luks2/luks2_json_metadata.c:1222
+#, fuzzy
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "ei sisällä LUKS-otsaketta. Otsakkeen korvaaminen voi tuhota tietoja tuossa laitteessa."
 
-#: src/cryptsetup.c:884
-#, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Avain %d ei ole käytössä. Ei voida pyyhkiä pois.\n"
+#: lib/luks2/luks2_json_metadata.c:1223
+#, fuzzy
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "sisältää jo LUKS-otsakkeen. Otsakkeen korvaaminen tuhoaa olemassaolevat avainvälit."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
+#: lib/luks2/luks2_json_metadata.c:1225
 msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"Tämä on viimeinen avainväli. Laite tulee käyttökelvottomaksi tämän avaimen "
-"poistamisen jälkeen."
 
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Kirjoita mikä tahansa jäljellä oleva salasanalause: "
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Kirjoita poistettava salasanalause: "
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr ""
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Kirjoita mikä tahansa olemassa oleva salasanalause: "
+msgid "Missing key for dm-crypt segment %u"
+msgstr ""
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Kirjoita vaihdettava salasanalause: "
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Kirjoita uusi salasanalause: "
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr ""
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr "Tuetaan vain yhtä laiteargumenttia isLuks-toiminnolle.\n"
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr ""
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Vaaditaan valitsin --header-backup-file.\n"
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr ""
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Tunnistamaton metatietolaitetyyppi %s.\n"
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr ""
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
-msgstr "Komento vaatii laitteen ja kuvausnimen argumenttina.\n"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr ""
 
-#: src/cryptsetup.c:1326
-#, c-format
-msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
 msgstr ""
-"Tämä toiminto poistaa kaikki avainvälit laitteesta %s.\n"
-"Laite tulee käyttökelvottomaksi tämän toiminnon jälkeen."
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<laite> [--type <tyyppi>] [<nimi>]"
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr ""
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "avaa laite kuvauksena <nimi>"
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr ""
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<nimi>"
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr ""
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "sulje laite (poista kuvaus)"
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "Avainväli %d on todennettu.\n"
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "muuta käytössä olevan laitteen kokoa"
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr ""
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "näytä laitetila"
+#: lib/luks2/luks2_keyslot_luks2.c:480
+#, fuzzy
+msgid "No space for new keyslot."
+msgstr "Uuden avainvälin vaihtaminen epäonnistui.\n"
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "koestussalaus"
+#: lib/luks2/luks2_luks1_convert.c:482
+#, fuzzy, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Salasanan laatutarkistus epäonnistui: %s\n"
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<laite>"
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr ""
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr "yritä korjata levyn sisäiset metatiedot"
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr ""
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
-msgstr "poista kaikki avainvälit (poista salausavain)"
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr ""
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<laite> [<uusi avaintiedosto>]"
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+#, fuzzy
+msgid "Unable to move keyslot area."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "pohjustaa LUKS-laitteen"
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr ""
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "lisää avain LUKS-laitteeseen"
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr ""
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
-msgstr "<laite> [<avaintiedosto>]"
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr ""
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "poistaa tarjotun avaimen tai avaintiedoston LUKS-laitteesta"
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr ""
 
-#: src/cryptsetup.c:1370
-msgid "changes supplied key or key file of LUKS device"
-msgstr "vaihtaa LUKS-laitteen tarjotun avaimen tai avaintiedoston"
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr ""
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<laite> <avainväli>"
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr ""
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr "pyyhkäisee pois avaimen numerolla <avainväli> LUKS-laitteesta"
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr ""
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "tulostaa LUKS-laitteen UUID-tunnuksen"
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "testaa <laite> LUKS-osio-otsakkeesta"
+#: lib/luks2/luks2_reencrypt.c:897
+#, fuzzy, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Pienennyskoon on oltava 512-tavuisen sektorin monikerta."
 
-#: src/cryptsetup.c:1374
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Tukematon LUKS-versio %d.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+#, fuzzy
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, fuzzy, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Vapaa-aluetta ei ole nollattu sijainnissa %<PRIu64>.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Pääsy tilapäiseen avainsäiliölaitteeseen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Tilapäisen avainsäiliön avaaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "Uuden avainvälin vaihtaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, fuzzy, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Laitteen %s käyttö epäonnistui, koska se on jo käytössä (jo kuvattu tai liitetty).\n"
+
+#: lib/luks2/luks2_reencrypt.c:2534
+#, fuzzy
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Älä vaihda avainta, yhtään data-aluetta ei ole salattu uudelleen."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "Laite %s ei ole aktiivinen.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2632
+#, fuzzy
+msgid "Failed to acquire reencryption lock."
+msgstr "Uudelleensalauslokitiedoston lukeminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3046
+#, fuzzy
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Uudelleensalauslokitiedoston kirjoittaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3053
+#, fuzzy
+msgid "Decryption failed."
+msgstr "Korjaus epäonnistui."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3063
+#, fuzzy
+msgid "Failed to sync data."
+msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "Salaustaustaohjelman alustus epäonnistui.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+#, fuzzy
+msgid "Failed to update reencryption context."
+msgstr "Uudelleensalauslokitiedoston avaus epäonnistui.\n"
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr ""
+
+#: lib/luks2/luks2_token.c:269
+#, fuzzy, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: src/cryptsetup.c:164
+#, fuzzy
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Salasanalauseiden todennus epäonnistui ei-tty-syötteissä.\n"
+
+#: src/cryptsetup.c:221
+#, fuzzy
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Tätä toimintoa tuetaan vain LUKS-laitteelle.\n"
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+#, fuzzy
+msgid "No known cipher specification pattern detected."
+msgstr "Havaittu tuntematon salakirjoitusmenetelmämäärittelymalli.\n"
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "VAROITUS: Parametri --hash ohitetaan tavallisessa tilassa kun avaintiedosto on määritelty.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "VAROITUS: Valitsin --keyfile-size ohitetaan , lukukoko on sama kuin salausavaimen koko.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr ""
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:381
+#, fuzzy
+msgid "Option --key-file is required."
+msgstr "Vaaditaan valitsin --key-file.\n"
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr ""
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr ""
+
+#: src/cryptsetup.c:446
+#, fuzzy
+msgid "Invalid PIM value: 0."
+msgstr "Virheellinen laite %s.\n"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr ""
+
+#: src/cryptsetup.c:472
+#, fuzzy
+msgid "No device header detected with this passphrase."
+msgstr "Tälle salasanalauseelle ei ole saatavissa laiteotsaketta.\n"
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Laite %s ei ole kelvollinen LUKS-laite.\n"
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Otsakevedos taltioavaimella on arkaluonteista tietoa,\n"
+"joka sallii pääsyn salatulle osiolle ilman salasanaa.\n"
+"Tämä vedos pitäisi aina tallentaa salattuna turvallisessa paikasssa."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr ""
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr ""
+
+#: src/cryptsetup.c:838
+#, fuzzy
+msgid "Benchmark interrupted."
+msgstr "koestussalaus"
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr ""
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr ""
+
+#: src/cryptsetup.c:901
+#, fuzzy
+msgid "Result of benchmark is not reliable."
+msgstr "Suorituskykytestin tulos ei ole luotettava.\n"
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Testit käyttävät vain muistia ylimalkaan (ei tallennussiirtos).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, fuzzy, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  Algoritmi | Avain |  Salaus |  Salauksen purku\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Salaus %s ei ole käytettävissä.\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+#, fuzzy
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  Algoritmi | Avain |  Salaus |  Salauksen purku\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "Ei käytössä"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Kirjoita salasanalause avainvälille %u: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Yritetäänkö todella korjata LUKS-laiteotsake?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, fuzzy, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Tilapäisen LUKS-laitteen avaaminen epäonnistui.\n"
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr ""
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+#, fuzzy
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Tukematon LUKS-versio %d.\n"
+
+#: src/cryptsetup.c:1253
+#, fuzzy, c-format
+msgid "Cannot create header file %s."
+msgstr "Otsakevarmuuskopiotiedoston %s luominen epäonnistui.\n"
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+#, fuzzy
+msgid "No known integrity specification pattern detected."
+msgstr "Havaittu tuntematon salakirjoitusmenetelmämäärittelymalli.\n"
+
+#: src/cryptsetup.c:1289
+#, fuzzy, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Kohteen %s käyttö paikallisena levyotsakkeena epäonnistui.\n"
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Tämä korvaa tiedot kohteella %s peruuttamattomasti."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+#, fuzzy
+msgid "Failed to set pbkdf parameters."
+msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
+
+#: src/cryptsetup.c:1439
+#, fuzzy
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Pienennetty tietosiirrososoite sallitaan vain irrotetulle LUKS-otsakkeelle.\n"
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr ""
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, fuzzy, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Avainväli %d valittu poistoa varten.\n"
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Tämä on viimeinen avainväli. Laite tulee käyttökelvottomaksi tämän avaimen poistamisen jälkeen."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Kirjoita mikä tahansa jäljellä oleva salasanalause: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Kirjoita poistettava salasanalause: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Kirjoita uusi salasanalause avainvälille: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Kirjoita mikä tahansa olemassa oleva salasanalause: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Kirjoita vaihdettava salasanalause: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Kirjoita uusi salasanalause: "
+
+#: src/cryptsetup.c:1927
+#, fuzzy
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Kirjoita salasanalause avainvälille %u: "
+
+#: src/cryptsetup.c:1951
+#, fuzzy
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Tuetaan vain yhtä laiteargumenttia isLuks-toiminnolle.\n"
+
+#: src/cryptsetup.c:2001
+#, fuzzy
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Otsakevedos taltioavaimella on arkaluonteista tietoa,\n"
+"joka sallii pääsyn salatulle osiolle ilman salasanaa.\n"
+"Tämä vedos pitäisi aina tallentaa salattuna turvallisessa paikasssa."
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Avainväli %d ei ole käytössä.\n"
+
+#: src/cryptsetup.c:2072
+#, fuzzy
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Otsakevedos taltioavaimella on arkaluonteista tietoa,\n"
+"joka sallii pääsyn salatulle osiolle ilman salasanaa.\n"
+"Tämä vedos pitäisi aina tallentaa salattuna turvallisessa paikasssa."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+#, fuzzy
+msgid "Option --header-backup-file is required."
+msgstr "Vaaditaan valitsin --header-backup-file.\n"
+
+#: src/cryptsetup.c:2258
+#, fuzzy, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s ei ole LUKS-laite."
+
+#: src/cryptsetup.c:2269
+#, fuzzy, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Jatkamista ei tueta laiteelle %s.\n"
+
+#: src/cryptsetup.c:2311
+#, fuzzy, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Tunnistamaton metatietolaitetyyppi %s.\n"
+
+#: src/cryptsetup.c:2314
+#, fuzzy
+msgid "Command requires device and mapped name as arguments."
+msgstr "Komento vaatii laitteen ja kuvausnimen argumenttina.\n"
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Tämä toiminto poistaa kaikki avainvälit laitteesta %s.\n"
+"Laite tulee käyttökelvottomaksi tämän toiminnon jälkeen."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr ""
+
+#: src/cryptsetup.c:2398
+#, fuzzy, c-format
+msgid "Device is already %s type."
+msgstr "Laite %s on jo olemassa.\n"
+
+#: src/cryptsetup.c:2403
+#, fuzzy, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Tätä toimintoa ei tueta %s-salauslaitteelle.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr ""
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, fuzzy, c-format
+msgid "Token %d is invalid."
+msgstr "Avainväli %d on virheellinen.\n"
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr ""
+
+#: src/cryptsetup.c:2493
+#, fuzzy, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, fuzzy, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: src/cryptsetup.c:2519
+#, fuzzy, c-format
+msgid "Token %d is not in use."
+msgstr "Avainväli %d ei ole käytössä.\n"
+
+#: src/cryptsetup.c:2554
+#, fuzzy
+msgid "Failed to import token from file."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
+
+#: src/cryptsetup.c:2579
+#, fuzzy, c-format
+msgid "Failed to get token %d for export."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr ""
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2613
+#, fuzzy, c-format
+msgid "Invalid token operation %s."
+msgstr "Virheellinen avainkoko %d.\n"
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Laite %s ei ole kelvollinen LUKS-laite.\n"
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Laitekuvaajahakemiston hankkiminen epäonnistui."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "Virheellinen laite %s.\n"
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Tätä toimintoa tuetaan vain LUKS-laitteelle.\n"
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Pyydetty otsakevarmuuskopiotiedosto %s on jo olemassa.\n"
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Otsakevarmuuskopiotiedoston %s luominen epäonnistui.\n"
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+#, fuzzy
+msgid "Not enough free keyslots for reencryption."
+msgstr "Älä vaihda avainta, yhtään data-aluetta ei ole salattu uudelleen."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+#, fuzzy
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Avaintiedostoa voidaan käyttää vain valitsimen --key-slot kanssa tai täsmälleen yhden avainvälin ollessa aktiivisena.\n"
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Kirjoita salasanalause avainvälille %u: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Kirjoita salasanalause avainvälille %u: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "Komento vaatii laitteen ja kuvausnimen argumenttina.\n"
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr ""
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+#, fuzzy
+msgid "LUKS2 device is not in reencryption."
+msgstr "Lokitiedosto %s on olemassa, aloitetaan salaus uudelleen.\n"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<laite> [--type <tyyppi>] [<nimi>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+#, fuzzy
+msgid "open device as <name>"
+msgstr "avaa laite kuvauksena <nimi>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<nimi>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "sulje laite (poista kuvaus)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "muuta käytössä olevan laitteen kokoa"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "näytä laitetila"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr ""
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "koestussalaus"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<laite>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "yritä korjata levyn sisäiset metatiedot"
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "lisää avain LUKS-laitteeseen"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "poista kaikki avainvälit (poista salausavain)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr ""
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr ""
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<laite> [<uusi avaintiedosto>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "pohjustaa LUKS-laitteen"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "lisää avain LUKS-laitteeseen"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<laite> [<avaintiedosto>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "poistaa tarjotun avaimen tai avaintiedoston LUKS-laitteesta"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "vaihtaa LUKS-laitteen tarjotun avaimen tai avaintiedoston"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<laite> <avainväli>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "pyyhkäisee pois avaimen numerolla <avainväli> LUKS-laitteesta"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "tulostaa LUKS-laitteen UUID-tunnuksen"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "testaa <laite> LUKS-osio-otsakkeesta"
+
+#: src/cryptsetup.c:3364
 msgid "dump LUKS partition information"
 msgstr "vedosta LUKS-osiotiedot"
 
-#: src/cryptsetup.c:1375
+#: src/cryptsetup.c:3365
 msgid "dump TCRYPT device information"
 msgstr "vedosta TCRYPT-laitetiedot"
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"Keskeytä LUKS-laite ja pyyhi pois avain (kaikki siirräntäliitännät "
-"jäädytetään)."
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "vedosta TCRYPT-laitetiedot"
+
+#: src/cryptsetup.c:3367
+#, fuzzy
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Keskeytä LUKS-laite ja pyyhi pois avain (kaikki siirräntäliitännät jäädytetään)."
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
+#: src/cryptsetup.c:3368
+#, fuzzy
+msgid "Resume suspended LUKS device"
 msgstr "Aloita uudelleen pysäytetty LUKS-laite."
 
-#: src/cryptsetup.c:1378
+#: src/cryptsetup.c:3369
 msgid "Backup LUKS device header and keyslots"
 msgstr "Varmuuskopioi LUKS-laiteotsake ja avainvälit"
 
-#: src/cryptsetup.c:1379
+#: src/cryptsetup.c:3370
 msgid "Restore LUKS device header and keyslots"
 msgstr "Palauta LUKS-laiteotsake ja avainvälit"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr ""
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr ""
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
 msgid ""
 "\n"
 "<action> is one of:\n"
@@ -1110,19 +2471,20 @@ msgstr ""
 "\n"
 "<toiminto> on yksi seuraavista:\n"
 
-#: src/cryptsetup.c:1402
+#: src/cryptsetup.c:3395
+#, fuzzy
 msgid ""
 "\n"
 "You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 msgstr ""
 "\n"
 "Voit myös käyttää vanhaa <toiminto>-syntaksialiasta:\n"
 "\topen: luo (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
 "\tclose: poista (plainClose), luksClose, loopaesClose, tcryptClose\n"
 
-#: src/cryptsetup.c:1406
+#: src/cryptsetup.c:3399
 #, c-format
 msgid ""
 "\n"
@@ -1135,17 +2497,24 @@ msgstr ""
 "<nimi> on laite, joka luodaan kohteen %s alaisena\n"
 "<laite> on salaussuojattu laite\n"
 "<avainväli> on LUKS-avainväli muokattavaksi\n"
-"<avaintiedosto> valinnainen avaintiedosto uudelle avaimelle luksAddKey-"
-"toimintoa varten\n"
+"<avaintiedosto> valinnainen avaintiedosto uudelle avaimelle luksAddKey-toimintoa varten\n"
 
-#: src/cryptsetup.c:1413
+#: src/cryptsetup.c:3406
 #, c-format
 msgid ""
 "\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+
+#: src/cryptsetup.c:3411
+#, fuzzy, c-format
+msgid ""
+"\n"
 "Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
 msgstr ""
 "\n"
 "Käännetyn avaintiedoston ja salasanan oletusparametrit:\n"
@@ -1153,14 +2522,14 @@ msgstr ""
 "\tsalasanalauseen enimmäispituus %d (merkkiä)\n"
 "PBKDF2-iteroinnin enimmäisaika LUKS-avainvälille: %d (millisekuntia)\n"
 
-#: src/cryptsetup.c:1420
-#, c-format
+#: src/cryptsetup.c:3422
+#, fuzzy, c-format
 msgid ""
 "\n"
 "Default compiled-in device cipher parameters:\n"
 "\tloop-AES: %s, Key %d bits\n"
 "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
 msgstr ""
 "\n"
 "Käännetyn laitesalakirjoitusmenetelmän oletusparametrit:\n"
@@ -1168,373 +2537,766 @@ msgstr ""
 "\tplain-tyyppi: %s, Avain: %d bittiä, Salasanatiivistys: %s\n"
 "\tLUKS1: %s, Avain: %d bittiä, LUKS-otsaketiivistys: %s, RNG: %s\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
 #, c-format
 msgid "%s: requires %s as arguments"
 msgstr "%s: vaatii %s argumentteina"
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
 msgid "Show this help message"
 msgstr "Näytä tämä opastesanoma"
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
 msgid "Display brief usage"
 msgstr "Näytä lyhyt käyttöopaste"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Opastevalitsimet:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
 msgid "Print package version"
 msgstr "Tulosta pakkausversio"
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Opastevalitsimet:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
 msgid "Shows more detailed error messages"
 msgstr "Näyttää yksityiskohtaisemmat virheilmoitukset"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
 msgid "Show debug messages"
 msgstr "Näytä vianjäljityssanomat"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
+#: src/cryptsetup.c:3489
+#, fuzzy
+msgid "Show debug messages including JSON metadata"
+msgstr "Näytä vianjäljityssanomat"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
 msgid "The cipher used to encrypt the disk (see /proc/crypto)"
-msgstr ""
-"Salakirjoitusmenetelmä, jota käytetään salaamaan levy (katso /proc/crypto)"
+msgstr "Salakirjoitusmenetelmä, jota käytetään salaamaan levy (katso /proc/crypto)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
 msgid "The hash used to create the encryption key from the passphrase"
-msgstr ""
-"Tiivisteavain, jota käytetään salausavaimen luomiseen salasanalauseesta"
+msgstr "Tiivisteavain, jota käytetään salausavaimen luomiseen salasanalauseesta"
 
-#: src/cryptsetup.c:1481
+#: src/cryptsetup.c:3492
 msgid "Verifies the passphrase by asking for it twice"
 msgstr "Todentaa salasanalauseen kysymällä kahdesti"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+#, fuzzy
+msgid "Read the key from a file"
 msgstr "Lue avain tiedostosta."
 
-#: src/cryptsetup.c:1483
+#: src/cryptsetup.c:3494
 msgid "Read the volume (master) key from file."
 msgstr "Lue taltion (pää)avain tiedostosta."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
+#: src/cryptsetup.c:3495
+#, fuzzy
+msgid "Dump volume (master) key instead of keyslots info"
 msgstr "Vedosta taltion (pää)avain eikä avainvälien tiedot."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
 msgid "The size of the encryption key"
 msgstr "Salausavaimen koko"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
 msgid "BITS"
 msgstr "BITTIÄ"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
 msgid "Limits the read from keyfile"
 msgstr "Avaintiedostosta luettavat rajat"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
 msgid "bytes"
 msgstr "tavua"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
 msgid "Number of bytes to skip in keyfile"
 msgstr "Avaintiedostossa ohitettavien tavujen määrä"
 
-#: src/cryptsetup.c:1488
+#: src/cryptsetup.c:3499
 msgid "Limits the read from newly added keyfile"
 msgstr "Äskettäin lisätystä avaintiedostosta luetut rajat"
 
-#: src/cryptsetup.c:1489
+#: src/cryptsetup.c:3500
 msgid "Number of bytes to skip in newly added keyfile"
 msgstr "Ohitettu tavumäärä äskettäin lisätyssä avaintiedostossa"
 
-#: src/cryptsetup.c:1490
+#: src/cryptsetup.c:3501
 msgid "Slot number for new key (default is first free)"
 msgstr "Välinumero uudelle avaimelle (oletus on ensimmäinen vapaa)"
 
-#: src/cryptsetup.c:1491
+#: src/cryptsetup.c:3502
 msgid "The size of the device"
 msgstr "Laitteen koko"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
 msgid "SECTORS"
 msgstr "SEKTORIA"
 
-#: src/cryptsetup.c:1492
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Käytä vain määriteltyä laitekokoa (ohita laitteen loppu). VAARALLINEN!"
+
+#: src/cryptsetup.c:3504
 msgid "The start offset in the backend device"
 msgstr "Alkusiirrososoite taustalaitteessa"
 
-#: src/cryptsetup.c:1493
+#: src/cryptsetup.c:3505
 msgid "How many sectors of the encrypted data to skip at the beginning"
 msgstr "Kuinka monta salaustietojen sektoria ohitetaan alussa"
 
-#: src/cryptsetup.c:1494
+#: src/cryptsetup.c:3506
 msgid "Create a readonly mapping"
 msgstr "Luo kirjoitussuojattu kuvaus"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "PBKDF2-iterointiaika kohteelle LUKS (millisekunneissa)"
-
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "ms"
-
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
 msgid "Do not ask for confirmation"
 msgstr "Älä pyydä vahvistusta"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508
 msgid "Timeout for interactive passphrase prompt (in seconds)"
 msgstr "Aikakatkaisu vuorovaikutteiselle salasanalausekyselylle (sekunteina)"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
 msgid "secs"
 msgstr "s"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr ""
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
 msgid "How often the input of the passphrase can be retried"
 msgstr "Kuinka usein salasanasyötettä voidaan yrittää uudelleen"
 
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3511
 msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr ""
-"Tasaa tietosisältö osoitteessa <n> sektorirajoihin - kohdetta luksFormat "
-"varten"
+msgstr "Tasaa tietosisältö osoitteessa <n> sektorirajoihin - kohdetta luksFormat varten"
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
+#: src/cryptsetup.c:3512
+#, fuzzy
+msgid "File with LUKS header and keyslots backup"
 msgstr "Tiedosto LUKS-otsakkeella ja avainvälien varmuuskopiolla."
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+#, fuzzy
+msgid "Use /dev/random for generating volume key"
 msgstr "Käytä /dev/random taltioavaimen synnyttämiseen."
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Käytä /dev/urandom taltioavaimen synnyttämiseen."
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+#, fuzzy
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Käytä /dev/urandom taltioavaimen synnyttämiseen."
+
+#: src/cryptsetup.c:3515
+#, fuzzy
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Jaa laite toisen ei-päällekkäisen salaussegmentin kanssa."
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+#, fuzzy
+msgid "UUID for device to use"
+msgstr "UUID laitteelle käytettäväksi."
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+#, fuzzy
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Salli hylkäys(lempinimeltään TRIM)-pyynnöt laitteelle."
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+#, fuzzy
+msgid "Device or file with separated LUKS header"
+msgstr "Laite tai tiedosto erillisellä LUKS-otsakkeella."
+
+#: src/cryptsetup.c:3519
+#, fuzzy
+msgid "Do not activate device, just check passphrase"
+msgstr "Älä aktivoi laitetta, tarkista vain salasanalauseke."
+
+#: src/cryptsetup.c:3520
+#, fuzzy
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Käytä piilotettua otsaketta (piilotettu TCRYPT-laite)."
+
+#: src/cryptsetup.c:3521
+#, fuzzy
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Laite on järjestelmä-TCRYPT-levyasema (alkulatausohjelmalla)."
+
+#: src/cryptsetup.c:3522
+#, fuzzy
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Käytä (toissijaista) TCRYPT-varmuuskopio-otsaketta."
+
+#: src/cryptsetup.c:3523
+#, fuzzy
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Tutkinta myös VeraCrypt-yhteensopivalle laitteelle."
+
+#: src/cryptsetup.c:3524
+#, fuzzy
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Tutkinta myös VeraCrypt-yhteensopivalle laitteelle."
+
+#: src/cryptsetup.c:3525
+#, fuzzy
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Tutkinta myös VeraCrypt-yhteensopivalle laitteelle."
+
+#: src/cryptsetup.c:3526
+#, fuzzy
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Laitemetatietojen tyyppi: luks, plain, loopaes, tcrypt."
+
+#: src/cryptsetup.c:3527
+#, fuzzy
+msgid "Disable password quality check (if enabled)"
+msgstr "Ota pois käytöstä salasanan laatutarkistus (jos käytössä)."
+
+#: src/cryptsetup.c:3528
+#, fuzzy
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Käytä dm-crypt same_cpu_crypt-suorituskyky-yhteensopivuusvalitsinta."
+
+#: src/cryptsetup.c:3529
+#, fuzzy
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Käytä dm-crypt submit_from_crypt_cpus-suorituskyky-yhteensopivuusvalitsinta."
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr ""
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr ""
+
+#: src/cryptsetup.c:3532
+#, fuzzy
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "PBKDF2-iterointiaika kohteelle LUKS (millisekunneissa)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ms"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+#, fuzzy
+msgid "kilobytes"
+msgstr "tavua"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr ""
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr ""
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr ""
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr ""
+
+#: src/cryptsetup.c:3538
+#, fuzzy
+msgid "Disable locking of on-disk metadata"
+msgstr "yritä korjata levyn sisäiset metatiedot"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr ""
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr ""
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr ""
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr ""
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr ""
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr ""
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr ""
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr ""
+
+#: src/cryptsetup.c:3550
+#, fuzzy
+msgid "Set label for the LUKS2 device"
+msgstr "pohjustaa LUKS-laitteen"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr ""
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr ""
+
+#: src/cryptsetup.c:3553
+#, fuzzy
+msgid "Read or write the json from or to a file"
+msgstr "Lue avain tiedostosta."
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr ""
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr "Jaa laite toisen ei-päällekkäisen salaussegmentin kanssa."
+#: src/cryptsetup.c:3555
+#, fuzzy
+msgid "LUKS2 header keyslots area size"
+msgstr "Tiedosto LUKS-otsakkeella ja avainvälien varmuuskopiolla."
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID laitteelle käytettäväksi."
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr ""
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Salli hylkäys(lempinimeltään TRIM)-pyynnöt laitteelle."
+#: src/cryptsetup.c:3557
+#, fuzzy
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Salausavaimen koko"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Laite tai tiedosto erillisellä LUKS-otsakkeella."
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr ""
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Älä aktivoi laitetta, tarkista vain salasanalauseke."
+#: src/cryptsetup.c:3559
+#, fuzzy
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Poista laitteen salaus pysyvästi (poista salaus)"
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Käytä piilotettua otsaketta (piilotettu TCRYPT-laite)."
+#: src/cryptsetup.c:3560
+#, fuzzy
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Poista laitteen salaus pysyvästi (poista salaus)"
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Laite on järjestelmä-TCRYPT-levyasema (alkulatausohjelmalla)."
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Käytä (toissijaista) TCRYPT-varmuuskopio-otsaketta."
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Tutkinta myös VeraCrypt-yhteensopivalle laitteelle."
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Pienennä datalaitekokoa (siirrä datasiirrososoitetta). VAARALLINEN!"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Laitemetatietojen tyyppi: luks, plain, loopaes, tcrypt."
+#: src/cryptsetup.c:3564
+#, fuzzy
+msgid "Maximal reencryption hotzone size."
+msgstr "Uudelleensalauslohkon koko"
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Ota pois käytöstä salasanan laatutarkistus (jos käytössä)."
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr "Käytä dm-crypt same_cpu_crypt-suorituskyky-yhteensopivuusvalitsinta."
+#: src/cryptsetup.c:3566
+#, fuzzy
+msgid "Reencryption hotzone checksums hash"
+msgstr "Uudelleensalauslohkon koko"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
 msgstr ""
-"Käytä dm-crypt submit_from_crypt_cpus-suorituskyky-yhteensopivuusvalitsinta."
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
 msgid "[OPTION...] <action> <action-specific>"
 msgstr "[VALITSIN...] <toiminto> <toimintokohtainen>"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Suoritetaan FIPS-tilassa.\n"
-
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
 msgid "Argument <action> missing."
 msgstr "Argumentti <toiminto> puuttuu."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
 msgid "Unknown action."
 msgstr "Tuntematon toiminto."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr "Valitsin --shared sallitaan vain pelkän laitteen avaukseen.\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
 msgstr "Valitsin --shared sallitaan vain pelkän laitteen avaukseen.\n"
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Valitsin --allow-discards sallitaan vain open-toiminnolle.\n"
+
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Valitsin --allow-discards sallitaan vain open-toiminnolle.\n"
+
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
 msgstr "Valitsin --allow-discards sallitaan vain open-toiminnolle.\n"
 
-#: src/cryptsetup.c:1657
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr ""
+
+#: src/cryptsetup.c:3753
+#, fuzzy
 msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
 msgstr ""
 "Valitsin --key-size sallitaan vain muodoille luksFormat, open ja benchmark.\n"
-"Käytä avaintiedostosta lukemisen rajoittamiseksi valitsinta --keyfile-"
-"size=(tavua)."
+"Käytä avaintiedostosta lukemisen rajoittamiseksi valitsinta --keyfile-size=(tavua)."
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Valitsin --align-payload sallitaan vain luksFormat-muodolle."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
 msgstr ""
-"Valitsin --test-passphrase sallitaan vain LUKS- ja TCRYPT-laitteiden "
-"avaamiseen.\n"
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Valitsin --uuid sallitaan vain luksFormat-muodolle ja luksUUID-muodolle."
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Valitsin --test-passphrase sallitaan vain LUKS- ja TCRYPT-laitteiden avaamiseen.\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
 msgid "Key size must be a multiple of 8 bits"
 msgstr "Avainkoon on oltava 8-bitin monikerta"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
 msgid "Key slot is invalid."
 msgstr "Avainväli on virheellinen."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"Valitsin --key-file on ensisijainen määritellylle "
-"avaintiedostoargumentille.\n"
+#: src/cryptsetup.c:3794
+#, fuzzy
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Valitsin --key-file on ensisijainen määritellylle avaintiedostoargumentille.\n"
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
 msgid "Negative number for option not permitted."
 msgstr "Valitsimelle ei sallita negatiivista numeroa."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
+#: src/cryptsetup.c:3805
+#, fuzzy
+msgid "Only one --key-file argument is allowed."
+msgstr "Vain yksi --use-[u]random -valitsin on sallittu."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
 msgid "Only one of --use-[u]random options is allowed."
 msgstr "Vain yksi --use-[u]random -valitsin on sallittu."
 
-#: src/cryptsetup.c:1699
+#: src/cryptsetup.c:3813
 msgid "Option --use-[u]random is allowed only for luksFormat."
 msgstr "Valitsin --use-[u]random sallitaan vain luksFormat-muodolle."
 
-#: src/cryptsetup.c:1703
+#: src/cryptsetup.c:3817
 msgid "Option --uuid is allowed only for luksFormat and luksUUID."
-msgstr ""
-"Valitsin --uuid sallitaan vain luksFormat-muodolle ja luksUUID-muodolle."
+msgstr "Valitsin --uuid sallitaan vain luksFormat-muodolle ja luksUUID-muodolle."
 
-#: src/cryptsetup.c:1707
+#: src/cryptsetup.c:3821
 msgid "Option --align-payload is allowed only for luksFormat."
 msgstr "Valitsin --align-payload sallitaan vain luksFormat-muodolle."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
 msgstr ""
-"Valitsinta --skip tuetaan vain plain- ja loopaes-laitteiden avaamiseen.\n"
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
+#: src/cryptsetup.c:3830
+#, fuzzy
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Virheellinen laitekokomäärittely."
+
+#: src/cryptsetup.c:3834
+#, fuzzy
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Virheellinen laitekokomäärittely."
+
+#: src/cryptsetup.c:3838
+#, fuzzy
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Valitsin --align-payload sallitaan vain luksFormat-muodolle."
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Valitsinta --skip tuetaan vain plain- ja loopaes-laitteiden avaamiseen.\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Valitsinta --offset tuetaan vain plain- ja loopaes-laitteiden avaamiseen.\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Valitsinta --tcrypt-hidden, --tcrypt-system tai --tcrypt-backup tuetaan vain TCRYPT-laiteeelle.\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Valitsinta --tcrypt-hidden ei voida yhdistää valitsimeen --allow-discards.\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Valitsinta --veracrypt tuetaan vain TCRYPT-laiteeelle.\n"
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
 msgstr ""
-"Valitsinta --offset tuetaan vain plain- ja loopaes-laitteiden avaamiseen.\n"
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Valitsinta --veracrypt tuetaan vain TCRYPT-laiteeelle.\n"
+
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Valitsinta --veracrypt tuetaan vain TCRYPT-laiteeelle.\n"
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
 msgstr ""
-"Valitsinta --tcrypt-hidden, --tcrypt-system tai --tcrypt-backup tuetaan vain "
-"TCRYPT-laiteeelle.\n"
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
 msgstr ""
-"Valitsinta --tcrypt-hidden ei voida yhdistää valitsimeen --allow-discards.\n"
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "Valitsinta --veracrypt tuetaan vain TCRYPT-laiteeelle.\n"
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr ""
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr ""
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr ""
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "Tätä toimintoa ei tueta tälle laitetyypille.\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr ""
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr ""
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "Valitsinta --keep-key voidaan käyttää vain valitsimen --hash tai --iter-time kanssa."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr ""
+
+#: src/cryptsetup.c:3970
+#, fuzzy
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Virheellinen laitekokomäärittely."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Virheellinen laitekokomäärittely."
+
+#: src/cryptsetup.c:3981
+#, fuzzy
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Maksimi laitepienennyskoko on 64 mebitavua."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Pienennyskoon on oltava 512-tavuisen sektorin monikerta."
+
+#: src/cryptsetup.c:3989
+#, fuzzy
+msgid "Invalid data size specification."
+msgstr "Virheellinen laitekokomäärittely."
+
+#: src/cryptsetup.c:3994
+#, fuzzy
+msgid "Reduce size overflow."
+msgstr "Laitesiirrososoitteen ylivuoto.\n"
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Pienennyskoon on oltava 512-tavuisen sektorin monikerta."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4014
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr ""
+
+#: src/veritysetup.c:66
+#, fuzzy
+msgid "Invalid salt string specified."
 msgstr "Määritelty virheellinen satunnaisarvosiemenmerkkijono.\n"
 
-#: src/veritysetup.c:88
-#, c-format
-msgid "Cannot create hash image %s for writing.\n"
+#: src/veritysetup.c:97
+#, fuzzy, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Tiivistevedoksen %s luominen kirjoittamista varten epäonnistui.\n"
+
+#: src/veritysetup.c:107
+#, fuzzy, c-format
+msgid "Cannot create FEC image %s for writing."
 msgstr "Tiivistevedoksen %s luominen kirjoittamista varten epäonnistui.\n"
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
+#: src/veritysetup.c:179
+#, fuzzy
+msgid "Invalid root hash string specified."
 msgstr "Virheellinen root-tiivistemerkkijono määritelty.\n"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "Virheellinen laite %s.\n"
+
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr "Avaintiedoston %s lukeminen epäonnistui.\n"
+
+#: src/veritysetup.c:392
 msgid "<data_device> <hash_device>"
 msgstr "<data_laite> <tiiviste_laite>"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392 src/integritysetup.c:479
 msgid "format device"
 msgstr "pohjusta laite"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "<data_device> <hash_device> <root_hash>"
 msgstr "<data_laite> <tiiviste_laite> <root_tiiviste>"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "verify device"
 msgstr "todenna laite"
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<nimi> <data_laite> <tiiviste_laite> <root_tiiviste>"
-
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "luo aktiivilaite"
-
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "poista (deaktivoi) laite"
+#: src/veritysetup.c:394
+#, fuzzy
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<data_laite> <tiiviste_laite> <root_tiiviste>"
 
-#: src/veritysetup.c:312
+#: src/veritysetup.c:396 src/integritysetup.c:482
 msgid "show active device status"
 msgstr "näytä aktiivilaitteen tila"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397
 msgid "<hash_device>"
 msgstr "<tiiviste_laite>"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397 src/integritysetup.c:483
 msgid "show on-disk information"
 msgstr "näytä paikallisen levyn tiedot"
 
-#: src/veritysetup.c:332
+#: src/veritysetup.c:416
 #, c-format
 msgid ""
 "\n"
@@ -1543,355 +3305,880 @@ msgid ""
 "<hash_device> is the device containing verification data\n"
 "<root_hash> hash of the root node on <hash_device>\n"
 msgstr ""
-"\n"
-"<nimi> on kohteen alle %s luotava laite\n"
-"<data_laite> on datalaite\n"
-"<tiiviste_laite> on todennusdataa sisältävä laite\n"
-"<root_tiiviste> root-solmun tiiviste kohteella <tiiviste_laite>\n"
+"\n"
+"<nimi> on kohteen alle %s luotava laite\n"
+"<data_laite> on datalaite\n"
+"<tiiviste_laite> on todennusdataa sisältävä laite\n"
+"<root_tiiviste> root-solmun tiiviste kohteella <tiiviste_laite>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Käännetyt dm-verity oletusparametrit:\n"
+"\tTiiviste: %s, Data-lohko (tavua): %u, Tiivistelohko (tavua): %u, Satunnaislukuarvosiemenen koko: %u, Tiivistemuoto: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Älä käytä verity-superlohkoa"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Muototyyppi (1 - normaali, 0 - alkuperäinen Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "numero"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Data-laitteen lohkokoko"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Tiivistelaitteen lohkokoko"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr ""
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Data-tiedoston lohkojen määrä"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "lohkoa"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr ""
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr ""
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Tiivistelaitteen alkusiirrososoite"
+
+#: src/veritysetup.c:474
+#, fuzzy
+msgid "Starting offset on the FEC device"
+msgstr "Tiivistelaitteen alkusiirrososoite"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Tiivistealgoritmi"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "merkkijono"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Satunnaisarvosiemenluku"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "heksadesimaalimerkkijono"
+
+#: src/veritysetup.c:478
+#, fuzzy
+msgid "Path to root hash signature file"
+msgstr "Tiivistealueen luominen epäonnistui.\n"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr ""
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr ""
+
+#: src/veritysetup.c:481
+#, fuzzy
+msgid "Do not verify zeroed blocks"
+msgstr "Älä käytä verity-superlohkoa"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr ""
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Valitsin --allow-discards sallitaan vain open-toiminnolle.\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Valitsin --allow-discards sallitaan vain open-toiminnolle.\n"
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr ""
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, fuzzy, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Avaintiedoston %s lukeminen epäonnistui.\n"
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, fuzzy, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Ei voida lukea %d tavua avaintiedostosta %s.\n"
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr ""
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+#, fuzzy
+msgid "<integrity_device>"
+msgstr "todenna laite"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr ""
+
+#: src/integritysetup.c:502
+#, fuzzy, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<nimi> on kohteen alle %s luotava laite\n"
+"<data_laite> on datalaite\n"
+"<tiiviste_laite> on todennusdataa sisältävä laite\n"
+"<root_tiiviste> root-solmun tiiviste kohteella <tiiviste_laite>\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr ""
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr ""
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr ""
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr ""
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr ""
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr ""
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr ""
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr ""
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:562
+#, fuzzy
+msgid "The size of the data integrity key"
+msgstr "Salausavaimen koko"
+
+#: src/integritysetup.c:563
+#, fuzzy
+msgid "Read the integrity key from a file"
+msgstr "Lue avain tiedostosta."
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:566
+#, fuzzy
+msgid "The size of the journal integrity key"
+msgstr "Salausavaimen koko"
+
+#: src/integritysetup.c:567
+#, fuzzy
+msgid "Read the journal integrity key from a file"
+msgstr "Lue avain tiedostosta."
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr ""
+
+#: src/integritysetup.c:570
+#, fuzzy
+msgid "The size of the journal encryption key"
+msgstr "Salausavaimen koko"
+
+#: src/integritysetup.c:571
+#, fuzzy
+msgid "Read the journal encryption key from a file"
+msgstr "Lue avain tiedostosta."
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr ""
 
-#: src/veritysetup.c:339
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
 msgstr ""
-"\n"
-"Käännetyt dm-verity oletusparametrit:\n"
-"\tTiiviste: %s, Data-lohko (tavua): %u, Tiivistelohko (tavua): %u, "
-"Satunnaislukuarvosiemenen koko: %u, Tiivistemuoto: %u\n"
 
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
-msgstr "Älä käytä verity-superlohkoa"
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr ""
 
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
-msgstr "Muototyyppi (1 - normaali, 0 - alkuperäinen Chrome OS)"
+#: src/integritysetup.c:649
+#, fuzzy
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Valitsin --allow-discards sallitaan vain open-toiminnolle.\n"
 
-#: src/veritysetup.c:378
-msgid "number"
-msgstr "numero"
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr ""
 
-#: src/veritysetup.c:379
-msgid "Block size on the data device"
-msgstr "Data-laitteen lohkokoko"
+#: src/integritysetup.c:675
+#, fuzzy
+msgid "Invalid journal size specification."
+msgstr "Virheellinen laitekokomäärittely."
 
-#: src/veritysetup.c:380
-msgid "Block size on the hash device"
-msgstr "Tiivistelaitteen lohkokoko"
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
-msgstr "Data-tiedoston lohkojen määrä"
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr ""
 
-#: src/veritysetup.c:381
-msgid "blocks"
-msgstr "lohkoa"
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:382
-msgid "Starting offset on the hash device"
-msgstr "Tiivistelaitteen alkusiirrososoite"
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr ""
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
-msgstr "Tiivistealgoritmi"
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:383
-msgid "string"
-msgstr "merkkijono"
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr ""
 
-#: src/veritysetup.c:384
-msgid "Salt"
-msgstr "Satunnaisarvosiemenluku"
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr ""
 
-#: src/veritysetup.c:384
-msgid "hex string"
-msgstr "heksadesimaalimerkkijono"
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:147
-#, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
 msgstr ""
-"Kohteen %s avaaminen eksklusiivisesti epäonnistui, laite on käytössä.\n"
 
-#: src/cryptsetup_reencrypt.c:151
-#, c-format
-msgid "Cannot open device %s\n"
-msgstr "Laitteen %s avaus epäonnistui.\n"
+#: src/cryptsetup_reencrypt.c:172
+#, fuzzy
+msgid "Reencryption already in-progress."
+msgstr "Uudelleensalauslohkon koko"
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
+#: src/cryptsetup_reencrypt.c:208
+#, fuzzy, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Kohteen %s avaaminen eksklusiivisesti epäonnistui, laite on käytössä.\n"
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+#, fuzzy
+msgid "Allocation of aligned memory failed."
 msgstr "Tasatun muistin varaaminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:168
-#, c-format
-msgid "Cannot read device %s.\n"
+#: src/cryptsetup_reencrypt.c:229
+#, fuzzy, c-format
+msgid "Cannot read device %s."
 msgstr "Laitteen %s lukeminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:179
-#, c-format
-msgid "Marking LUKS device %s unusable.\n"
+#: src/cryptsetup_reencrypt.c:240
+#, fuzzy, c-format
+msgid "Marking LUKS1 device %s unusable."
 msgstr "Merkitään LUKS-laite %s käyttökelvottomaksi.\n"
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "Merkitään LUKS-laite %s käyttökelpoiseksi.\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:200
-#, c-format
-msgid "Cannot write device %s.\n"
+#: src/cryptsetup_reencrypt.c:261
+#, fuzzy, c-format
+msgid "Cannot write device %s."
 msgstr "Laitteelle %s kirjoittaminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
+#: src/cryptsetup_reencrypt.c:309
+#, fuzzy
+msgid "Cannot write reencryption log file."
 msgstr "Uudelleensalauslokitiedoston kirjoittaminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
+#: src/cryptsetup_reencrypt.c:365
+#, fuzzy
+msgid "Cannot read reencryption log file."
 msgstr "Uudelleensalauslokitiedoston lukeminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
 msgstr "Lokitiedosto %s on olemassa, aloitetaan salaus uudelleen.\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
+#: src/cryptsetup_reencrypt.c:452
+#, fuzzy
+msgid "Activating temporary device using old LUKS header."
 msgstr "Aktivoidaan tilapäinen laite käyttäen vanhaa LUKS-otsaketta.\n"
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
+#: src/cryptsetup_reencrypt.c:462
+#, fuzzy
+msgid "Activating temporary device using new LUKS header."
 msgstr "Aktivoidaan tilapäinen laite käyttäen uutta LUKS-otsaketta.\n"
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
+#: src/cryptsetup_reencrypt.c:472
+#, fuzzy
+msgid "Activation of temporary devices failed."
 msgstr "Tilapäisten laitteiden aktivoiminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
+#: src/cryptsetup_reencrypt.c:559
+#, fuzzy
+msgid "Failed to set data offset."
+msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
+
+#: src/cryptsetup_reencrypt.c:565
+#, fuzzy
+msgid "Failed to set metadata size."
+msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
+
+#: src/cryptsetup_reencrypt.c:573
+#, fuzzy, c-format
+msgid "New LUKS header for device %s created."
 msgstr "Luotiin uusi LUKS-otsake laitteelle %s.\n"
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Aktivoitiin avainväli %i.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:484
-#, c-format
-msgid "LUKS header backup of device %s created.\n"
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:659
+#, fuzzy
+msgid "Failed to write activation flags to new header."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+#, fuzzy
+msgid "Failed to read requirements from backup header."
+msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
+
+#: src/cryptsetup_reencrypt.c:705
+#, fuzzy, c-format
+msgid "%s header backup of device %s created."
 msgstr "Laitteen %s LUKS-otsakkeen varmuuskopio luotu.\n"
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
+#: src/cryptsetup_reencrypt.c:768
+#, fuzzy
+msgid "Creation of LUKS backup headers failed."
 msgstr "LUKS-varmuuskopio-otsakkeiden luominen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:634
-#, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
+#: src/cryptsetup_reencrypt.c:901
+#, fuzzy, c-format
+msgid "Cannot restore %s header on device %s."
 msgstr "LUKS-otsakkeen palautus laitteeseen %s epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:636
-#, c-format
-msgid "LUKS header on device %s restored.\n"
+#: src/cryptsetup_reencrypt.c:903
+#, fuzzy, c-format
+msgid "%s header on device %s restored."
 msgstr "LUKS-otsake palautettu laitteessa %s.\n"
 
-#: src/cryptsetup_reencrypt.c:669
-#, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Eteneminen: %5.1f%%, ETA %02llu:%02llu, %4llu Mebitavua kirjoitettu, nopeus "
-"%5.1f Mebitavua/s%s"
-
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Laitteen siirrososoitteen etsintä epäonnistui.\n"
-
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Tilapäisen LUKS-otsaketiedoston avaaminen epäonnistui.\n"
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+#, fuzzy
+msgid "Cannot open temporary LUKS device."
+msgstr "Tilapäisen LUKS-laitteen avaaminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+#, fuzzy
+msgid "Cannot get device size."
 msgstr "Laitekoon hakeminen epäonnistui.\n"
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Signaalin keskeyttämä.\n"
-
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
+#: src/cryptsetup_reencrypt.c:1158
+#, fuzzy
+msgid "IO error during reencryption."
 msgstr "Siirräntävirhe uudelleensalauksen aikana.\n"
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
+#: src/cryptsetup_reencrypt.c:1189
+#, fuzzy
+msgid "Provided UUID is invalid."
+msgstr "Avainväli on virheellinen."
+
+#: src/cryptsetup_reencrypt.c:1423
+#, fuzzy
+msgid "Cannot open reencryption log file."
+msgstr "Uudelleensalauslokitiedoston avaus epäonnistui.\n"
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
 msgstr ""
-"Avaintiedostoa voidaan käyttää vain valitsimen --key-slot kanssa tai "
-"täsmälleen yhden avainvälin ollessa aktiivisena.\n"
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
+#: src/cryptsetup_reencrypt.c:1504
 #, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Kirjoita salasanalause avainvälille %u: "
-
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Uudelleensalauslokitiedoston avaus epäonnistui.\n"
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "Reencryption block size"
 msgstr "Uudelleensalauslohkon koko"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "MiB"
 msgstr "Mebitavua"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
+#: src/cryptsetup_reencrypt.c:1620
+#, fuzzy
+msgid "Do not change key, no data area reencryption"
 msgstr "Älä vaihda avainta, yhtään data-aluetta ei ole salattu uudelleen."
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
+#: src/cryptsetup_reencrypt.c:1622
+#, fuzzy
+msgid "Read new volume (master) key from file"
+msgstr "Lue taltion (pää)avain tiedostosta."
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "PBKDF2-iterointiaika kohteelle LUKS (millisekunneissa)"
+
+#: src/cryptsetup_reencrypt.c:1629
+#, fuzzy
+msgid "Use direct-io when accessing devices"
 msgstr "Käytä direct-io -siirräntää laitteisiin yhdistettäessä."
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
+#: src/cryptsetup_reencrypt.c:1630
+#, fuzzy
+msgid "Use fsync after each block"
 msgstr "Käytä fsync-komentoa jokaisen lohkon jälkeen."
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
+#: src/cryptsetup_reencrypt.c:1631
+#, fuzzy
+msgid "Update log file after every block"
 msgstr "Päivitä lokitiedosto jokaisen lohkon jälkeen."
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
+#: src/cryptsetup_reencrypt.c:1632
+#, fuzzy
+msgid "Use only this slot (others will be disabled)"
 msgstr "Käytä vain tätä väliä (muut ovat pois käytöstä)."
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr "Pienennä datalaitekokoa (siirrä datasiirrososoitetta). VAARALLINEN!"
-
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr "Käytä vain määriteltyä laitekokoa (ohita laitteen loppu). VAARALLINEN!"
-
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
+#: src/cryptsetup_reencrypt.c:1637
+#, fuzzy
+msgid "Create new header on not encrypted device"
 msgstr "Luo uusi otsake ei-salattuun laitteeseen."
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
+#: src/cryptsetup_reencrypt.c:1638
+#, fuzzy
+msgid "Permanently decrypt device (remove encryption)"
 msgstr "Poista laitteen salaus pysyvästi (poista salaus)"
 
-#: src/cryptsetup_reencrypt.c:1298
+#: src/cryptsetup_reencrypt.c:1639
+#, fuzzy
+msgid "The UUID used to resume decryption"
+msgstr "Salausavaimen koko"
+
+#: src/cryptsetup_reencrypt.c:1640
+#, fuzzy
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Laitemetatietojen tyyppi: luks, plain, loopaes, tcrypt."
+
+#: src/cryptsetup_reencrypt.c:1659
 msgid "[OPTION...] <device>"
 msgstr "[VALITSIN...] <laite>"
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
-"VAROITUS: tämä on kokeellista koodia, se voi rikkoa tietosi kokonaan.\n"
-
-#: src/cryptsetup_reencrypt.c:1313
-#, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
+#: src/cryptsetup_reencrypt.c:1667
+#, fuzzy, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
 msgstr "Uudelleensalauas muuttuu: taltio key%s%s%s%s.\n"
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1670
+#, fuzzy
+msgid "set hash to "
 msgstr ", aseta tiivisteeksi "
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ", aseta salaukseksi "
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr "Argumentti vaadittu."
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Vain arvot välillä 1 mebitavua ja 64 mebitavua ovat sallittuja "
-"uudelleensalauslohkokokoja."
-
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Virheellinen laitekokomäärittely."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Vain arvot välillä 1 mebitavua ja 64 mebitavua ovat sallittuja uudelleensalauslohkokokoja."
 
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
 msgstr "Maksimi laitepienennyskoko on 64 mebitavua."
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Pienennyskoon on oltava 512-tavuisen sektorin monikerta."
-
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr ""
-"Valitsinta --new on käytettävä yhdessä valitsimen --reduce-device-size "
-"kanssa."
+#: src/cryptsetup_reencrypt.c:1737
+#, fuzzy
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Valitsinta --new on käytettävä yhdessä valitsimen --reduce-device-size kanssa."
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
-"Valitsinta --keep-key voidaan käyttää vain valitsimen --hash tai --iter-time "
-"kanssa."
+#: src/cryptsetup_reencrypt.c:1741
+#, fuzzy
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Valitsinta --keep-key voidaan käyttää vain valitsimen --hash tai --iter-time kanssa."
 
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr "Valitsinta --new ei voi käytttää yhdessä valitsimen --decrypt kanssa."
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "Valitsin --decrypt on yhteensopimaton määriteltyjen parametrien kanssa."
+
+#: src/cryptsetup_reencrypt.c:1753
+#, fuzzy
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Valitsinta --new ei voi käytttää yhdessä valitsimen --decrypt kanssa."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
 msgstr ""
-"Valitsin --decrypt on yhteensopimaton määriteltyjen parametrien kanssa."
 
 #: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
+#, fuzzy
+msgid "Error reading response from terminal."
 msgstr "Virhe luettaessa vastausta pääteikkunasta.\n"
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Komento onnistui.\n"
 
-#: src/utils_tools.c:191
-#, c-format
-msgid "Command failed with code %i"
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr ""
+
+#: src/utils_tools.c:196
+#, fuzzy
+msgid "no permission or bad passphrase"
+msgstr "Kirjoita mikä tahansa salasanalause: "
+
+#: src/utils_tools.c:198
+#, fuzzy
+msgid "out of memory"
+msgstr "Muistin lukituksen avaus epäonnistui.\n"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr ""
+
+#: src/utils_tools.c:202
+#, fuzzy
+msgid "device already exists or device is busy"
+msgstr "Laite %s on jo olemassa.\n"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr ""
+
+#: src/utils_tools.c:206
+#, fuzzy, c-format
+msgid "Command failed with code %i (%s).\n"
 msgstr "Komento epäonnistui koodilla %i"
 
-#: src/utils_password.c:42
+#: src/utils_tools.c:283
+#, fuzzy, c-format
+msgid "Key slot %i created."
+msgstr "Avaivälin %d vaihtui.\n"
+
+#: src/utils_tools.c:285
+#, fuzzy, c-format
+msgid "Key slot %i unlocked."
+msgstr "Avaivälin %d lukitus avattu.\n"
+
+#: src/utils_tools.c:287
+#, fuzzy, c-format
+msgid "Key slot %i removed."
+msgstr "Avaivälin %d lukitus avattu.\n"
+
+#: src/utils_tools.c:296
 #, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Salasanan laatutarkistus epäonnistui: %s\n"
+msgid "Token %i created."
+msgstr ""
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr ""
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+#, fuzzy
+msgid "Failed to initialize device signature probes."
+msgstr "Laitekuvaajahakemiston hankkiminen epäonnistui."
+
+#: src/utils_tools.c:548
+#, fuzzy, c-format
+msgid "Failed to stat device %s."
+msgstr "Avaintiedoston kutsuminen stat-funktiolla epäonnistui.\n"
 
-#: src/utils_password.c:50
+#: src/utils_tools.c:561
 #, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr ""
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr ""
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:583
+#, fuzzy
+msgid "Failed to wipe device signature."
+msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
+
+#: src/utils_tools.c:590
+#, fuzzy, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Laitekuvaajahakemiston hankkiminen epäonnistui."
+
+#: src/utils_tools.c:629
+#, fuzzy
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr "Uudelleensalauslohkon koko"
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, fuzzy, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Salasanan laatutarkistus epäonnistui: %s\n"
+
+#: src/utils_password.c:51
+#, fuzzy, c-format
 msgid ""
 "Password quality check failed:\n"
-" %s\n"
+" %s"
 msgstr ""
 "Salasanan laatutarkistus epäonnistui:\n"
 " %s\n"
 
+#: src/utils_password.c:83
+#, fuzzy, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Salasanan laatutarkistus epäonnistui: Virheellinen salasana (%s)\n"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+#, fuzzy
+msgid "Error reading passphrase from terminal."
+msgstr "Virhe luettaessa salasanalausetta pääteikkunasta.\n"
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Todenna salasanalause: "
+
+#: src/utils_password.c:213
+#, fuzzy
+msgid "Passphrases do not match."
+msgstr "Salasanalauseet eivät täsmää.\n"
+
+#: src/utils_password.c:250
+#, fuzzy
+msgid "Cannot use offset with terminal input."
+msgstr "Siirrososoitteen käyttö pääteikkunasyötteellä epäonnistui.\n"
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Kirjoita salasanalause: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Kirjoita salasanalause kohteelle %s: "
+
+#: src/utils_password.c:287
+#, fuzzy
+msgid "No key available with this passphrase."
+msgstr "Tälle salasanalauseelle ei ole saatavissa avainta.\n"
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr ""
+
+#: src/utils_password.c:328
+#, fuzzy, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Tiedoston %s avaus epäonnistui.\n"
+
+#: src/utils_password.c:335
+#, fuzzy, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Avaintiedoston %s lukeminen epäonnistui.\n"
+
+#: src/utils_luks2.c:47
+#, fuzzy, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr ""
+
+#: src/utils_luks2.c:67
+#, fuzzy
+msgid "Failed to read JSON file."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
+
+#: src/utils_luks2.c:72
+#, fuzzy
+msgid ""
+"\n"
+"Read interrupted."
+msgstr "VERITY-otsake rikkinäinen.\n"
+
+#: src/utils_luks2.c:113
+#, fuzzy, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+
+#: src/utils_luks2.c:126
+#, fuzzy
+msgid "Failed to write JSON file."
+msgstr "Avaintiedoston avaus epäonnistui.\n"
+
+#~ msgid "Replaced with key slot %d.\n"
+#~ msgstr "Korvattiin avainvälillä %d.\n"
+
+#~ msgid "Function not available in FIPS mode.\n"
+#~ msgstr "Funktio ei ole käytettävissä FIPS-tilassa.\n"
+
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Vapaan silmukkalaiteen löytäminen epäonnistui.\n"
+
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Verity-taltiolla liian monta puutasoa.\n"
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "muistivarausvirhe kohteessa action_luksFormat"
+
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Avain %d ei ole käytössä. Ei voida pyyhkiä pois.\n"
+
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<nimi> <data_laite> <tiiviste_laite> <root_tiiviste>"
+
+#~ msgid "create active device"
+#~ msgstr "luo aktiivilaite"
+
+#~ msgid "remove (deactivate) device"
+#~ msgstr "poista (deaktivoi) laite"
+
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Laitteen %s avaus epäonnistui.\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "Merkitään LUKS-laite %s käyttökelpoiseksi.\n"
+
+#~ msgid "Activated keyslot %i.\n"
+#~ msgstr "Aktivoitiin avainväli %i.\n"
+
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Eteneminen: %5.1f%%, ETA %02llu:%02llu, %4llu Mebitavua kirjoitettu, nopeus %5.1f Mebitavua/s%s"
+
+#~ msgid "Interrupted by a signal.\n"
+#~ msgstr "Signaalin keskeyttämä.\n"
+
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "VAROITUS: tämä on kokeellista koodia, se voi rikkoa tietosi kokonaan.\n"
+
 #~ msgid "FIPS checksum verification failed.\n"
 #~ msgstr "FIPS-tarkistussummavarmennus epäonnistui.\n"
 
-#~ msgid ""
-#~ "WARNING: device %s is a partition, for TCRYPT system encryption you "
-#~ "usually need to use whole block device path.\n"
-#~ msgstr ""
-#~ "VAROITUS: laite %s on osio, TCRYPT-järjestelmäsalaukselle tarvitaan "
-#~ "normaalisti koko lohkolaitepolun käyttö.\n"
+#~ msgid "WARNING: device %s is a partition, for TCRYPT system encryption you usually need to use whole block device path.\n"
+#~ msgstr "VAROITUS: laite %s on osio, TCRYPT-järjestelmäsalaukselle tarvitaan normaalisti koko lohkolaitepolun käyttö.\n"
 
 #~ msgid "Kernel doesn't support plain64 IV.\n"
 #~ msgstr "Käyttöjärjestelmäydin ei tule plain64 IV.\n"
@@ -1908,15 +4195,9 @@ msgstr ""
 #~ msgid "Cannot check passsword quality: %s\n"
 #~ msgstr "Salasanan laatutarkistus epäonnistui: %s\n"
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr "Laitekuvaajahakemiston hankkiminen epäonnistui."
-
 #~ msgid "Backup file %s doesn't exist.\n"
 #~ msgstr "Varmuuskopiotiedostoa %s ei ole olemassa.\n"
 
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Tiedoston %s avaus epäonnistui.\n"
-
 #~ msgid "<name> <device>"
 #~ msgstr "<nimi> <laite>"
 
@@ -1935,12 +4216,8 @@ msgstr ""
 #~ msgid "remove loop-AES mapping"
 #~ msgstr "poista loop-AES -kuvaus"
 
-#~ msgid ""
-#~ "Option --allow-discards is allowed only for luksOpen, loopaesOpen and "
-#~ "create operation.\n"
-#~ msgstr ""
-#~ "Valitsin --allow-discards sallitaan vain luksOpen-, loopaesOpen- ja "
-#~ "create-toiminnoille .\n"
+#~ msgid "Option --allow-discards is allowed only for luksOpen, loopaesOpen and create operation.\n"
+#~ msgstr "Valitsin --allow-discards sallitaan vain luksOpen-, loopaesOpen- ja create-toiminnoille .\n"
 
 #~ msgid "Cannot open device %s for %s%s access.\n"
 #~ msgstr "Ei voida avata laitetta %s kohteeseen %s%s pääsyä varten.\n"
@@ -1960,51 +4237,26 @@ msgstr ""
 #~ msgid "Unable to obtain sector size for %s"
 #~ msgstr "Ei kyetä samaan sektorikokoa kohteelle %s"
 
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Avainsäiliöön kirjoittaminen epäonnistui.\n"
-
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr "Avainsäiliöstä lukeminen epäonnistui.\n"
-
-#~ msgid ""
-#~ "Cannot use device %s (crypt segments overlaps or in use by another "
-#~ "device).\n"
-#~ msgstr ""
-#~ "Ei voida käyttää laitetta %s (salatut segmentit ovat päällekkäin tai "
-#~ "toisen laitteen käyttämiä).\n"
-
-#~ msgid "Key slot %d verified.\n"
-#~ msgstr "Avainväli %d on todennettu.\n"
-
-#~ msgid "Invalid key size %d.\n"
-#~ msgstr "Virheellinen avainkoko %d.\n"
+#~ msgid "Cannot use device %s (crypt segments overlaps or in use by another device).\n"
+#~ msgstr "Ei voida käyttää laitetta %s (salatut segmentit ovat päällekkäin tai toisen laitteen käyttämiä).\n"
 
 #~ msgid "Block mode XTS is available since kernel 2.6.24.\n"
-#~ msgstr ""
-#~ "Lohkotila XTS on käytetettävissä käyttöjärjestelmäytimestä 2.6.24 "
-#~ "alkaen.\n"
+#~ msgstr "Lohkotila XTS on käytetettävissä käyttöjärjestelmäytimestä 2.6.24 alkaen.\n"
 
 #~ msgid "Key size in LRW mode must be 256 or 512 bits.\n"
 #~ msgstr "Avainkoon on oltava LRW-tilassa 256 tai 512 bittiä.\n"
 
 #~ msgid "Block mode LRW is available since kernel 2.6.20.\n"
-#~ msgstr ""
-#~ "Lohkotila LRW on käytettävissä käyttöjärjestelmäytimestä 2.6.20 alkaen.\n"
+#~ msgstr "Lohkotila LRW on käytettävissä käyttöjärjestelmäytimestä 2.6.20 alkaen.\n"
 
 #~ msgid "Negative keyfile size not permitted.\n"
 #~ msgstr "Negatiivinen avaintiedostokoko ei ole sallittu.\n"
 
-#~ msgid ""
-#~ "Warning: exhausting read requested, but key file is not a regular file, "
-#~ "function might never return.\n"
-#~ msgstr ""
-#~ "Varoitus: uuvuttava luku pyydetty, mutta avaintiedosto ei ole tavallinen "
-#~ "tiedosto, funktio ei ehkä koskaan palaa.\n"
+#~ msgid "Warning: exhausting read requested, but key file is not a regular file, function might never return.\n"
+#~ msgstr "Varoitus: uuvuttava luku pyydetty, mutta avaintiedosto ei ole tavallinen tiedosto, funktio ei ehkä koskaan palaa.\n"
 
 #~ msgid "Cannot find compatible device-mapper kernel modules.\n"
-#~ msgstr ""
-#~ "Ei voida löytää yhteensopivia laitekuvaimen "
-#~ "käyttöjärjestelmäydinmoduuleja.\n"
+#~ msgstr "Ei voida löytää yhteensopivia laitekuvaimen käyttöjärjestelmäydinmoduuleja.\n"
 
 #~ msgid "Cannot open device: %s\n"
 #~ msgstr "Ei voida avata laitetta: %s\n"
@@ -2022,15 +4274,11 @@ msgstr ""
 #~ msgstr "muokkaa aktiivista laitetta - VANHENTUNUT - katso man-sivua"
 
 #~ msgid ""
-#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case "
-#~ "you really need this functionality.\n"
-#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, "
-#~ "hit Ctrl-C now.\n"
+#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case you really need this functionality.\n"
+#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, hit Ctrl-C now.\n"
 #~ msgstr ""
-#~ "Uudelleenlataustoiminto on vanhentunut. Käytä ”dmsetup reload” siinä "
-#~ "tapauksessa, että todella tarvitset tätä toiminnallisuutta.\n"
-#~ "VAROITUS: älä käytä uudelleenlatausta koskettamaan LUKS-laitteita. Jos "
-#~ "näin on laita, paina nyt näppäimiä Ctrl-C.\n"
+#~ "Uudelleenlataustoiminto on vanhentunut. Käytä ”dmsetup reload” siinä tapauksessa, että todella tarvitset tätä toiminnallisuutta.\n"
+#~ "VAROITUS: älä käytä uudelleenlatausta koskettamaan LUKS-laitteita. Jos näin on laita, paina nyt näppäimiä Ctrl-C.\n"
 
 #~ msgid "Obsolete option --non-exclusive is ignored.\n"
 #~ msgstr "Vanhentunut valitsin --non-exclusive ohitetaan.\n"
@@ -2044,9 +4292,6 @@ msgstr ""
 #~ msgid "%s is not LUKS device.\n"
 #~ msgstr "%s ei ole LUKS-laite.\n"
 
-#~ msgid "%s is not LUKS device."
-#~ msgstr "%s ei ole LUKS-laite."
-
 #~ msgid "Unknown crypto device type %s requesed.\n"
 #~ msgstr "Tuntematon salauslaitetyyppi %s pyydetty.\n"
 
index 950e0fa..7797e6a 100644 (file)
Binary files a/po/fr.gmo and b/po/fr.gmo differ
index 379874e..8bb2297 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
 # Messages français pour cryptsetup.
-# Copyright (C) 2015 Free Software Foundation, Inc.
+# Copyright (C) 2020 Free Software Foundation, Inc.
 # This file is put in the public domain.
 #
 # Solveig <perso@solveig.org>, 2009.
 # Nicolas Provost <nprovost@quadriv.com>, 2011.
-# Frédéric Marchal <fmarchal@perso.be>, 2015.
+# Frédéric Marchal <fmarchal@perso.be>, 2020.
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-19 11:29+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-19 11:00+0200\n"
 "Last-Translator: Frédéric Marchal <fmarchal@perso.be>\n"
 "Language-Team: French <traduc@traduc.org>\n"
 "Language: fr\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms:  nplurals=2; plural=(n > 1);\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+"Plural-Forms: nplurals=2; plural=(n >= 2);\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"Impossible d'initialiser le gestionnaire « device-mapper ». Fonctionne comme "
-"un utilisateur non-root.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Impossible d'initialiser le gestionnaire « device-mapper ». Exécution comme un utilisateur non-root."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"Impossible d'initialiser le gestionnaire « device-mapper ». Le module noyau "
-"dm_mod est-il chargé ?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Impossible d'initialiser le gestionnaire « device-mapper ». Le module noyau dm_mod est-il chargé ?"
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Le fanion différé demandé n'est pas supporté."
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "Le DM-UUID du périphérique %s a été tronqué.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "Le DM-UUID du périphérique %s a été tronqué."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Type de cible dm inconnu."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Les options de performance dm-crypt demandées ne sont pas supportées."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Les options demandées de gestion de corruption des données dm-verity ne sont pas supportées."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Les options dm-verity FEC demandées ne sont pas supportées."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Les options d'intégrité de données demandées ne sont pas supportées."
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Les options de performance dmcrypt demandées ne sont pas supportées.\n"
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "L'option sector_size demandée n'est pas supportée."
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Le recalcule automatique des balises de sécurité demandés n'est pas supporté."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Discard/TRIM n'est pas supporté."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Le mode de carte de bits d'intégrité dm demandé n'est pas supporté."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Échec lors de l'interrogation du segment dm-%s."
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
 "Le système a manqué d'entropie lors de la génération de la clef de volume.\n"
-"Veuillez remuer la souris ou taper du texte dans une autre fenêtre pour "
-"générer des événements aléatoires.\n"
+"Veuillez remuer la souris ou taper du texte dans une autre fenêtre pour générer des événements aléatoires.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Génération de la clef (%d%% effectués).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr "Erreur fatale d'initialisation RNG.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Fonctionne en mode FIPS."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr "La qualité du générateur aléatoire RNG demandé est inconnue.\n"
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Erreur fatale d'initialisation RNG."
 
-#: lib/random.c:211
-#, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Erreur %d en lecture du générateur aléatoire RNG :%s\n"
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "La qualité du générateur aléatoire RNG demandé est inconnue."
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr ""
-"Impossible d'initialiser le moteur aléatoire RNG pour le chiffrement.\n"
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Erreur en lecture du générateur aléatoire RNG "
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Impossible d'initialiser le moteur aléatoire RNG pour le chiffrement."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Impossible d'initialiser le moteur de chiffrement.\n"
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Impossible d'initialiser le moteur de chiffrement."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "L'algorithme de hachage %s n'est pas supporté.\n"
+msgid "Hash algorithm %s not supported."
+msgstr "L'algorithme de hachage %s n'est pas supporté."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Erreur de traitement de clé (valeur hachage %s).\n"
+msgid "Key processing error (using hash %s)."
+msgstr "Erreur de traitement de clé (valeur hachage %s)."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"Impossible de déterminer le type de périphérique. Activation du périphérique "
-"incompatible ?\n"
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Impossible de déterminer le type de périphérique. Activation du périphérique incompatible ?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Cette opération n'est possible que pour les périphériques LUKS."
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Cette opération n'est possible que pour les périphériques LUKS.\n"
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Cette opération n'est possible que pour les périphériques LUKS2."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Tous les emplacements de clés sont utilisés.\n"
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Tous les emplacements de clés sont utilisés."
 
-#: lib/setup.c:327
+#: lib/setup.c:434
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr ""
-"L'emplacement de clé %d n'est pas valide, merci d'en choisir un entre 0 et "
-"%d.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "L'emplacement de clé %d n'est pas valide, merci d'en choisir un entre 0 et %d."
 
-#: lib/setup.c:333
+#: lib/setup.c:440
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr ""
-"L'emplacement de clé %d est utilisé, merci d'en sélectionner un autre.\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "L'emplacement de clé %d est utilisé, merci d'en sélectionner un autre."
 
-#: lib/setup.c:472
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "La taille du périphérique n'est pas alignée avec la taille d'un bloc logique du périphérique."
+
+#: lib/setup.c:624
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Saisissez la phrase secrète pour %s : "
+msgid "Header detected but device %s is too small."
+msgstr "En-tête détecté mais le périphérique %s est trop petit."
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Cette opération n'est pas supportée pour ce type de périphérique."
 
-#: lib/setup.c:653
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Opération illégale avec une re-chiffrement en cours."
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "En-tête détecté mais le périphérique %s est trop petit.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "La version %d de LUKS n'est pas supportée."
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Cette opération n'est pas supportée pour ce type de périphérique.\n"
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Un périphérique avec des métadonnées détachées n'est pas supporté avec ce type de chiffrement."
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Le périphérique %s n'est pas activé.\n"
+msgid "Device %s is not active."
+msgstr "Le périphérique %s n'est pas activé."
 
-#: lib/setup.c:925
+#: lib/setup.c:1444
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr ""
-"Le périphérique sous-jacent pour le périphérique chiffré %s a disparu.\n"
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Le périphérique sous-jacent pour le périphérique chiffré %s a disparu."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Paramètres de chiffrement non valides."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "La taille de la clé n'est pas valide."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Paramètres de chiffrement non valides.\n"
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "le UUID n'est pas supporté avec ce type de chiffrement."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "La taille de la clé n'est pas valide.\n"
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Taille de secteur de chiffrement non supportée."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "le UUID n'est pas supporté avec ce type de chiffrement.\n"
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "La taille du périphérique n'est pas alignée avec la taille de secteur demandée."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Impossible de formater en LUKS sans périphérique.\n"
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Impossible de formater en LUKS sans périphérique."
 
-#: lib/setup.c:1089
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "L'alignement de données demandé n'est pas compatible avec le décalage des données."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "AVERTISSEMENT: L'offset des données est en dehors du périphérique de données actuellement disponible.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr ""
-"Impossible de formater le périphérique %s qui est déjà en cours "
-"d'utilisation.\n"
+msgid "Cannot wipe header on device %s."
+msgstr "Impossible d'effacer l'en-tête du périphérique %s."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "AVERTISSEMENT: L'activation du périphérique va échouer, dm-crypt ne supporte pas la taille de secteur de chiffrement demandée.\n"
 
-#: lib/setup.c:1092
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "La clé de volume est trop petite pour chiffrer avec les extensions d'intégrité."
+
+#: lib/setup.c:1821
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Impossible de formater le périphérique %s. Permission refusée.\n"
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Le chiffrement %s-%s (clé de %zd bits) n'est pas disponible."
 
-#: lib/setup.c:1096
+#: lib/setup.c:1854
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Impossible d'effacer l'en-tête du périphérique %s.\n"
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "ATTENTION: La taille des métadonnées LUKS2 est devenue %<PRIu64> octets.\n"
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Impossible de formater LOOPAES sans périphérique.\n"
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "ATTENTION: La taille de la zone des emplacements de clés LUKS2 est devenue %<PRIu64> octets.\n"
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "Impossible de formater VERITY sans périphérique.\n"
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "Le périphérique %s est trop petit."
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:1893 lib/setup.c:1919
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Type de hachage VERITY %d non supporté.\n"
+msgid "Cannot format device %s in use."
+msgstr "Impossible de formater le périphérique %s qui est en cours d'utilisation."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Taille de bloc VERITY non supportée.\n"
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Impossible de formater le périphérique %s. Permission refusée."
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Décalage de hachage VERITY non supporté.\n"
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Impossible de formater l'intégrité du périphérique %s."
 
-#: lib/setup.c:1285
+#: lib/setup.c:1926
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Type de chiffrement de périphérique demandé (%s) inconnu.\n"
+msgid "Cannot format device %s."
+msgstr "Impossible de formater le périphérique %s"
 
-#: lib/setup.c:1435
-msgid "Do you really want to change UUID of device?"
-msgstr "Voulez vous réellement changer l'UUID du périphérique ?"
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Impossible de formater LOOPAES sans périphérique."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Impossible de formater VERITY sans périphérique."
 
-#: lib/setup.c:1545
+#: lib/setup.c:2000 lib/verity/verity.c:102
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Le volume %s n'est pas actif.\n"
+msgid "Unsupported VERITY hash type %d."
+msgstr "Type de hachage VERITY %d non supporté."
 
-#: lib/setup.c:1556
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Taille de bloc VERITY non supportée."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Décalage de hachage VERITY non supporté."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Décalage VERITY FEC non supporté."
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "La zone de données recouvre la zone de hachage."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "La zone de hachage recouvre la zone FEC."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "La zone de données recouvre la zone FEC."
+
+#: lib/setup.c:2208
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Le volume %s est déjà en suspendu.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "ATTENTION : La taille %d demandée pour l'étiquette est différente de la taille de sortie de %s (%d octets).\n"
 
-#: lib/setup.c:1563
+#: lib/setup.c:2286
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "Le périphérique %s ne supporte pas la suspension.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Type de chiffrement de périphérique demandé (%s) inconnu."
 
-#: lib/setup.c:1565
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Erreur lors de la suspension du périphérique %s.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Paramètres non supportés sur le périphérique %s."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Le volume %s n'est pas suspendu.\n"
+msgid "Mismatching parameters on device %s."
+msgstr "Paramètres non concordants sur le périphérique %s."
 
-#: lib/setup.c:1605
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Désaccord entre les périphériques crypt."
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Le périphérique %s ne supporte pas la remise en service.\n"
+msgid "Failed to reload device %s."
+msgstr "Impossible de recharger le périphérique %s."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Erreur lors de la remise en service du périphérique %s.\n"
+msgid "Failed to suspend device %s."
+msgstr "Impossible de suspendre le périphérique %s."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Saisissez la phrase secrète : "
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Impossible de redémarrer le périphérique %s."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Impossible d'ajouter un emplacement de clé, tous les emplacements sont "
-"désactivés et aucune clé n'a été fournie pour ce volume.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Erreur fatale en rechargeant le périphérique %s (au dessus du périphérique %s)"
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Entrez une phrase de passe : "
+#: lib/setup.c:2735 lib/setup.c:2737
+#, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Impossible de basculer le périphérique %s en dm-error."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Entrez une nouvelle phrase secrète pour l'emplacement de clé : "
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Impossible de redimensionner le périphérique loopback."
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "Voulez vous réellement changer l'UUID du périphérique ?"
 
-#: lib/setup.c:1798
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Le fichier de sauvegarde de l'en-tête ne contient pas d'en-tête compatible LUKS."
+
+#: lib/setup.c:3058
 #, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Emplacement de clef %d modifié.\n"
+msgid "Volume %s is not active."
+msgstr "Le volume %s n'est pas actif."
 
-#: lib/setup.c:1801
+#: lib/setup.c:3069
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Remplacé par l'emplacement de clé %d.\n"
+msgid "Volume %s is already suspended."
+msgstr "Le volume %s est déjà suspendu."
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Nouvel emplacement de clé impossible à échanger.\n"
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "Le périphérique %s ne supporte pas la suspension."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Ceci n'est pas la clé du volume.\n"
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "Erreur lors de la suspension du périphérique %s."
 
-#: lib/setup.c:1961
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "L'emplacement de clé %d n'est pas valide.\n"
+msgid "Volume %s is not suspended."
+msgstr "Le volume %s n'est pas suspendu."
 
-#: lib/setup.c:1966
+#: lib/setup.c:3146
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "L'emplacement de clé %d n'est pas utilisé.\n"
+msgid "Resume is not supported for device %s."
+msgstr "Le périphérique %s ne supporte pas la remise en service."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Le périphérique %s existe déjà.\n"
+msgid "Error during resuming device %s."
+msgstr "Erreur lors de la remise en service du périphérique %s."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr "Clé de volume incorrecte pour le périphérique en clair.\n"
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Ceci n'est pas la clé du volume."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
-msgstr "Hachage racine incorrect spécifié pour le périphérique verity.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Impossible d'ajouter un emplacement de clé, tous les emplacements sont désactivés et aucune clé n'a été fournie pour ce volume."
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Type de périphérique non proprement initialisé.\n"
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Nouvel emplacement de clé impossible à échanger."
 
-#: lib/setup.c:2259
+#: lib/setup.c:3669
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Le périphérique %s est toujours occupé.\n"
+msgid "Key slot %d is invalid."
+msgstr "L'emplacement de clé %d n'est pas valide."
 
-#: lib/setup.c:2268
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Le périphérique %s n'est pas valide.\n"
+msgid "Keyslot %d is not active."
+msgstr "L'emplacement de clé %d n'est pas actif."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Fonction pas disponible en mode FIPS.\n"
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "L'en-tête du périphérique recouvre la zone de données."
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Le tampon de la clé du volume est trop petit.\n"
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Re-chiffrement en cours. Impossible d'activer le périphérique."
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr ""
-"Impossible de récupérer la clé du volume pour ce périphérique de type "
-"« plain ».\n"
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Impossible d'obtenir le verrou de re-chiffrement."
 
-#: lib/setup.c:2310
-#, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Cette opération n'est pas possible pour le périphérique chiffré %s.\n"
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "La récupération du rechiffrement LUKS2 a échoué."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr ""
-"L'opération de vidage n'est pas supportée pour ce type de périphérique.\n"
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Type de périphérique improprement initialisé."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Impossible d'obtenir la priorité du processus.\n"
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Impossible d'utiliser le périphérique %s, le nom est invalide ou est toujours utilisé."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Impossible de déverrouiller la mémoire.\n"
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "Le périphérique %s existe déjà."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Plus assez de mémoire lors de la lecture de la phrase secrète.\n"
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Clé de volume incorrecte pour le périphérique en clair."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Erreur de lecture de la phrase secrète depuis la console.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Hachage racine incorrect spécifié pour le périphérique verity."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Vérifiez la phrase secrète : "
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Signature de hachage racine requise."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Les phrases secrètes ne sont pas identiques.\n"
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Le porte-clé du noyau est manquant : il est requis pour passer une signature au noyau."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Le décalage n'est pas possible si l'entrée provient de la console.\n"
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Impossible de charger la clé dans le porte-clé du noyau."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "Impossible d'ouvrir le fichier de clef.\n"
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Le périphérique %s est toujours occupé."
+
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "Le périphérique %s n'est pas valide."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "Impossible d'exécuter « stat » sur le fichier de clef.\n"
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Le tampon de la clé du volume est trop petit."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr "Impossible de sauter au décalage demandé dans le fichier de clé.\n"
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Impossible de récupérer la clé du volume pour ce périphérique de type « plain »."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Erreur de lecture de la phrase secrète.\n"
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Impossible de récupérer le hachage racine pour le périphérique verity."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Taille max. de fichier de clé dépassée.\n"
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Cette opération n'est pas possible pour le périphérique chiffré %s."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "Impossible de lire la quantité de données demandée.\n"
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "L'opération de vidage n'est pas supportée pour ce type de périphérique."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/setup.c:5190
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Le périphérique %s n'existe pas ou l'accès y est interdit.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Le décalage des données n'est pas un multiple de %u octets."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr ""
-"Impossible d'utiliser un périphérique loopback. Fonctionne comme un "
-"utilisateur non-root.\n"
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Impossible de convertir le périphérique %s qui est toujours en cours d'utilisation."
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Impossible de trouver un périphérique loopback libre.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Échec de l'affectation de l'emplacement de clé %u pour la nouvelle clé de volume."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
-"Impossible d'associer le périphérique loopback (le drapeau « autoclear » est "
-"requis).\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Échec de l'initialisation des paramètres par défaut des emplacement de clé LUKS2."
 
-#: lib/utils_device.c:484
+#: lib/setup.c:5851
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
-msgstr ""
-"Impossible d'utiliser le périphérique %s actuellement en usage (déjà mappé "
-"ou monté).\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Échec de l'affectation de l'emplacement de clé %d aux résumé."
 
-#: lib/utils_device.c:488
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Le porte-clé du noyau n'est pas supporté par ce noyau."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Impossible d'obtenir des informations au sujet du périphérique %s.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Échec lors de la lecture du mot de passe depuis le porte-clé (erreur %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Erreur lors de l'acquisition du verrou global de sérialisation des accès strictes à la mémoire"
 
-#: lib/utils_device.c:494
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Impossible d'obtenir la priorité du processus."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Impossible de déverrouiller la mémoire."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Impossible d'ouvrir le fichier de clef."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Impossible de lire le fichier de clé depuis un terminal."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Impossible d'exécuter « stat » sur le fichier de clef."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Impossible de sauter au décalage demandé dans le fichier de clé."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Plus assez de mémoire lors de la lecture de la phrase secrète."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Erreur de lecture de la phrase secrète."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Rien à lire en entrée."
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Taille max. de fichier de clé dépassée."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Impossible de lire la quantité de données demandée."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr ""
-"Le décalage demandé est au delà de la taille réelle du périphérique %s.\n"
+msgid "Device %s does not exist or access denied."
+msgstr "Le périphérique %s n'existe pas ou l'accès y est interdit."
 
-#: lib/utils_device.c:502
+#: lib/utils_device.c:197
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Le périphérique %s a une taille nulle.\n"
+msgid "Device %s is not compatible."
+msgstr "Le périphérique %s n'est pas compatible."
 
-#: lib/utils_device.c:513
+#: lib/utils_device.c:642
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Le périphérique %s est trop petit.\n"
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Le périphérique %s est trop petit. Il a besoin d'au moins %<PRIu64> octets."
 
-#: lib/luks1/keyencryption.c:37
+#: lib/utils_device.c:723
 #, c-format
-msgid ""
-"Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
-msgstr ""
-"Impossible de configurer la correspondance des clés dm-crypt du périphérique "
-"%s.\n"
-"Vérifiez que le noyau supporte le chiffrement %s (pour plus d'informations, "
-"voir les journaux syslog).\n"
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Impossible d'utiliser le périphérique %s actuellement utilisé (déjà mappé ou monté)."
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr ""
-"La taille de la clé en mode XTS doit être un multiple de 256 ou 512 bits.\n"
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Impossible d'utiliser le périphérique %s, permission refusée."
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/utils_device.c:730
 #, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Impossible d'écrire sur le périphérique %s. Permission refusée.\n"
+msgid "Cannot get info about device %s."
+msgstr "Impossible d'obtenir des informations au sujet du périphérique %s."
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr ""
-"Échec lors de l'ouverture du périphérique de stockage temporaire de clés.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Impossible d'utiliser un périphérique loopback. Fonctionne comme un utilisateur non-root."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr "Impossible d'accéder au périphérique de stockage temporaire de clé.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Impossible d'associer le périphérique loopback (le drapeau « autoclear » est requis)."
+
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Le décalage demandé est au delà de la taille réelle du périphérique %s."
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Erreur E/S pendant le chiffrement de l'emplacement de clé.\n"
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Le périphérique %s a une taille nulle."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "Erreur E/S pendant le déchiffrement de l'emplacement de clé.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Le temps cible PBKDF demandé ne peut pas être zéro."
 
-#: lib/luks1/keymanage.c:90
+#: lib/utils_pbkdf.c:106
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr ""
-"Le périphérique %s est trop petit (LUKS a besoin d'au moins %<PRIu64> "
-"octets).\n"
+msgid "Unknown PBKDF type %s."
+msgstr "Type PBKDF %s inconnu."
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/utils_pbkdf.c:111
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "%s n'est pas un périphérique LUKS valide.\n"
+msgid "Requested hash %s is not supported."
+msgstr "L'algorithme de hachage %s demandé n'est pas supporté."
+
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Le type PBKDF demandé n'est pas supporté par LUKS1."
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "La mémoire maximum ou les threads parallèles de PBKDF ne peuvent pas être définis avec pbkdf2."
 
-#: lib/luks1/keymanage.c:198
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Le fichier de sauvegarde d'en-tête demandé %s existe déjà.\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Le nombre d'itérations forcées est trop petit pour %s (le minimum est %u)."
 
-#: lib/luks1/keymanage.c:200
+#: lib/utils_pbkdf.c:148
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Impossible de créer le fichier de sauvegarde d'en-tête %s.\n"
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Le coût de la mémoire forcé est trop petit pour %s (le minimum est %u kilooctets)."
 
-#: lib/luks1/keymanage.c:205
+#: lib/utils_pbkdf.c:155
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Impossible d'écrire le fichier de sauvegarde d'en-tête %s.\n"
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Le coût de la mémoire PBKDF maximum demandée est trop grand (maximum est %d kilooctets)."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Le fichier de sauvegarde ne contient pas d'en-tête LUKS valide.\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "La mémoire PBKDF maximum demandée ne peut pas être zéro."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Le nombre de threads parallèles PBKDF demandé ne peut pas être zéro."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "Seul PBKDF2 est supporté en mode FIPS."
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "L'étalon PBKDF est désactivé mais les itérations ne sont pas définies."
+
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Impossible d'ouvrir le fichier de sauvegarde d'en-tête %s.\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Options PBKDF2 incompatibles (en utilisant l'algorithme de hachage %s)."
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Options PBKDF incompatibles."
 
-#: lib/luks1/keymanage.c:258
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Impossible de lire le fichier de sauvegarde d'en-tête %s.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Verrouillage interrompu. Le chemin de verrouillage %s/%s est inutilisable (pas un répertoire ou est manquant)."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Le décalage des données (« offset ») ou la taille de la clé ne sont pas "
-"identiques dans le périphérique et la sauvegarde. La restauration a "
-"échouée.\n"
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "ATTENTION: Le répertoire verrou %s/%s est manquant !\n"
 
-#: lib/luks1/keymanage.c:277
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Device %s %s%s"
-msgstr "Périphérique %s %s%s"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Verrouillage interrompu. Le chemin de verrouillage %s/%s est inutilisable (%s n'est pas un répertoire)."
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"ne contient pas d'en-tête LUKS. Remplacer l'en-tête peut détruire les "
-"données de ce périphérique."
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Impossible de se déplacer au décalage du périphérique."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"contient déjà un en-tête LUKS. Remplacer l'en-tête détruira les emplacements "
-"de clés actuels."
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Erreur durant l'effacement total, offset %<PRIu64>"
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keyencryption.c:39
+#, c-format
 msgid ""
-"\n"
-"WARNING: real device header has different UUID than backup!"
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
-"\n"
-"ATTENTION : l'en-tête du périphérique a un UUID différent de celui de la "
-"sauvegarde !"
+"Impossible de configurer la correspondance des clés dm-crypt du périphérique %s.\n"
+"Vérifiez que le noyau supporte le chiffrement %s (pour plus d'informations, voir les journaux syslog)."
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Impossible d'ouvrir le périphérique %s.\n"
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "La taille de la clé en mode XTS doit être un multiple de 256 ou 512 bits."
 
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr "Taille de clé non standard. Réparation manuelle requise.\n"
+# Frédéric: Je laisse iv (initialisation vector) sous cette forme car elle est plus habituelle que vi
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "La spécification du chiffrement devrait être au format [chiffrement]-[mode]-[iv]."
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
-"Alignement non standard des emplacements de clé. Réparation manuelle "
-"requise.\n"
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "Impossible d'écrire sur le périphérique %s. Permission refusée."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Échec lors de l'ouverture du périphérique de stockage temporaire de clés."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Impossible d'accéder au périphérique de stockage temporaire de clés."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Erreur E/S pendant le chiffrement de l'emplacement de clé."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Impossible d'ouvrir le périphérique %s."
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Réparation des emplacements de clé.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Erreur E/S pendant le déchiffrement de l'emplacement de clé."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Échec de la réparation."
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Le périphérique %s est trop petit (LUKS1 a besoin d'au moins %<PRIu64> octets)."
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "L'emplacement de clé LUKS %u n'est pas valide."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Emplacement de clé %i : décalage réparé (%u -> %u).\n"
+msgid "Device %s is not a valid LUKS device."
+msgstr "%s n'est pas un périphérique LUKS valide."
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Emplacement de clé %i : bandes réparées (%u -> %u).\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Le fichier de sauvegarde d'en-tête demandé %s existe déjà."
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Emplacement de clé %i : signature de partition contrefaite.\n"
+msgid "Cannot create header backup file %s."
+msgstr "Impossible de créer le fichier de sauvegarde d'en-tête %s."
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Emplacement de clé %i : aléa effacé.\n"
+msgid "Cannot write header backup file %s."
+msgstr "Impossible d'écrire le fichier de sauvegarde d'en-tête %s."
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "Écriture de l'en-tête LUKS sur le disque.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Le fichier de sauvegarde ne contient pas d'en-tête LUKS valide."
 
-#: lib/luks1/keymanage.c:421
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "La version %d de LUKS n'est pas supportée.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Impossible d'ouvrir le fichier de sauvegarde d'en-tête %s."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "L'algorithme de hachage LUKS demandé (%s) n'est pas supporté.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Impossible de lire le fichier de sauvegarde d'en-tête %s."
+
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Le décalage des données (« offset ») ou la taille de la clé ne sont pas identiques dans le périphérique et la sauvegarde. La restauration a échouée."
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:325
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "L'emplacement de clé LUKS %u n'est pas valide.\n"
+msgid "Device %s %s%s"
+msgstr "Périphérique %s %s%s"
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "Aucun problème connu détecté pour l'en-tête LUKS.\n"
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "ne contient pas d'en-tête LUKS. Remplacer l'en-tête peut détruire les données de ce périphérique."
 
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "contient déjà un en-tête LUKS. Remplacer l'en-tête détruira les emplacements de clés actuels."
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
 msgstr ""
-"Erreur lors de la mise à jour de l'en-tête LUKS sur le périphérique %s.\n"
+"\n"
+"ATTENTION : l'en-tête du périphérique a un UUID différent de celui de la sauvegarde !"
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Taille de clé non standard. Réparation manuelle requise."
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Alignement non standard des emplacements de clé. Réparation manuelle requise."
+
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Réparation des emplacements de clé."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Erreur lors de la relecture de l'en-tête LUKS après la mise à jour sur le "
-"périphérique %s.\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Emplacement de clé %i : décalage réparé (%u -> %u)."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"L'offset des données d'un en-tête LUKS détachés doit être soit 0 ou soit "
-"plus grand que la taille de l'en-tête (%d secteurs).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Emplacement de clé %i : bandes réparées (%u -> %u)."
+
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Emplacement de clé %i : signature de partition contrefaite."
+
+#: lib/luks1/keymanage.c:431
+#, c-format
+msgid "Keyslot %i: salt wiped."
+msgstr "Emplacement de clé %i : aléa effacé."
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Mauvais format fourni pour le UUID LUKS.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Écriture de l'en-tête LUKS sur le disque."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-"Impossible de créer un en-tête LUKS : échec lors de la lecture de l'aléa.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Échec de la réparation."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr ""
-"Options PBKDF2 incompatibles (en utilisant l'algorithme de hachage %s).\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "L'algorithme de hachage LUKS demandé (%s) n'est pas supporté."
+
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Aucun problème connu détecté pour l'en-tête LUKS."
 
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Impossible de créer un en-tête LUKS : le résumé (« digest ») de l'en-tête a "
-"échoué (en utilisant l'algorithme de hachage %s).\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Erreur lors de la mise à jour de l'en-tête LUKS sur le périphérique %s."
+
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Erreur lors de la relecture de l'en-tête LUKS après la mise à jour sur le périphérique %s."
+
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "L'offset des données d'un en-tête LUKS doit être soit 0 ou soit plus grand que la taille de l'en-tête."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Mauvais format fourni pour le UUID LUKS."
+
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Impossible de créer un en-tête LUKS : échec lors de la lecture de l'aléa."
+
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "L'emplacement de clé %d est activé, effacez le d'abord.\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Impossible de créer un en-tête LUKS : le résumé (« digest ») de l'en-tête a échoué (en utilisant l'algorithme de hachage %s)."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Le matériel de l'emplacement de clé %d a trop peu de bandes. L'en-tête a-t-"
-"il été modifié ?\n"
+msgid "Key slot %d active, purge first."
+msgstr "L'emplacement de clé %d est activé, effacez le d'abord."
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Emplacement de clé %d déverrouillé.\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Le matériel de l'emplacement de clé %d a trop peu de bandes. L'en-tête a-t-il été modifié ?"
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Aucune clé disponible avec cette phrase secrète.\n"
+#: lib/luks1/keymanage.c:990
+#, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Impossible d'ouvrir l'emplacement de clé (en utilisant le hachage %s)."
 
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr ""
-"L'emplacement de clé %d n'est pas valide, merci de sélectionner un "
-"emplacement entre 0 et %d.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "L'emplacement de clé %d n'est pas valide, merci de sélectionner un emplacement entre 0 et %d."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Impossible d'effacer de façon sécurisée le périphérique %s.\n"
+msgid "Cannot wipe device %s."
+msgstr "Impossible d'effacer de façon sécurisée le périphérique %s."
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr "Fichier de clé GPG chiffré détecté mais pas encore supporté.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Fichier de clé GPG chiffré détecté mais pas encore supporté."
 
 #: lib/loopaes/loopaes.c:147
 msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
-msgstr ""
-"SVP utilisez gpg --decrypt <FICHIER DE CLE> | cryptsetup --keyfile=-...\n"
+msgstr "SVP utilisez gpg --decrypt <FICHIER DE CLE> | cryptsetup --keyfile=-...\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Fichier de clé incompatible pour boucle « loop-AES ».\n"
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Fichier de clé incompatible pour boucle « loop-AES »."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr ""
-"Le noyau ne supporte pas les associations de type boucle « loop-AES ».\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Le noyau ne supporte pas les associations de type boucle « loop-AES »."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Erreur lors de la lecture du fichier de clé %s.\n"
+msgid "Error reading keyfile %s."
+msgstr "Erreur lors de la lecture du fichier de clé %s."
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/tcrypt/tcrypt.c:554
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr "Longueur maximum de la phrase secrète TCRYPT (%d) dépassée.\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Longueur maximum de la phrase secrète TCRYPT (%zu) dépassée."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr "L'algorithme de hachage PBKDF2 %s n'est pas supporté, ignoré.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "L'algorithme de hachage PBKDF2 %s n'est pas supporté, ignoré."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr ""
-"L'interface du noyau requise pour le chiffrement n'est pas disponible.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "L'interface du noyau requise pour le chiffrement n'est pas disponible."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr "Vérifiez que le module du noyau algif_skcipher est chargé.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Vérifiez que le module du noyau algif_skcipher est chargé."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "L'activation n'est pas supportée pour des secteurs de taille %d.\n"
+msgid "Activation is not supported for %d sector size."
+msgstr "L'activation n'est pas supportée pour des secteurs de taille %d."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr ""
-"Le noyau ne supporte pas l'activation pour ce mode TCRYPT historique.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Le noyau ne supporte pas l'activation pour ce mode TCRYPT historique."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "Activation du chiffrement du système TCRYPT sur la partition %s.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Activation du chiffrement du système TCRYPT sur la partition %s."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr "Le noyau ne supporte pas les associations de type TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Le noyau ne supporte pas les associations de type TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
-msgstr ""
-"Cette fonction n'est pas supportée sans le chargement de l'en-tête TCRYPT."
+msgstr "Cette fonction n'est pas supportée sans le chargement de l'en-tête TCRYPT."
+
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "Un type d'entrée « %u » inattendu a été trouvé dans la méta-donnée en analysant la Clé Maître du Volume supportée."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Chaîne texte invalide rencontrée en analysant la Clé Maître du Volume."
+
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Le périphérique verity %s n'utilise pas l'en-tête sur le disque.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Chaîne texte (« %s ») inattendue rencontrée en analysant la Clé Maître du Volume supportée."
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:399
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Le périphérique %s n'est pas un périphérique VERITY valable.\n"
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "La valeur « %u » pour l'entrée de la méta-donnée est inattendue en analysant la Clé Maître du Volume supportée."
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:479
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "La version VERITY %d n'est pas supportée.\n"
+msgid "Failed to read BITLK signature from %s."
+msgstr "Impossible de lire la signature BITLK depuis %s."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "La version 1 de BITLK n'est actuellement pas supportée."
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "En-tête VERITY corrompu.\n"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Signature d'amorce invalide ou inconnue pour le périphérique BITLK."
 
-#: lib/verity/verity.c:166
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Signature invalide ou inconnue pour le périphérique BITLK."
+
+#: lib/bitlk/bitlk.c:510
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Mauvais format d'UUID VERITY fourni sur le périphérique %s.\n"
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Taille de secteur %<PRIu16> non supportée."
 
-#: lib/verity/verity.c:196
+#: lib/bitlk/bitlk.c:518
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr ""
-"Erreur lors de la mise à jour de l'en-tête verity sur le périphérique %s.\n"
+msgid "Failed to read BITLK header from %s."
+msgstr "Impossible de lire l'en-tête BITLK depuis %s."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "Le noyau ne supporte pas les associations de type dm-verity.\n"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Impossible de lire les méta-données BITLK FVE depuis %s."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr "Le périphérique verity a détecté une corruption après l'activation.\n"
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Type de chiffrement inconnu ou non supporté."
 
-#: lib/verity/verity_hash.c:59
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "La zone de réserve n'a pas été mise à zéro à la positon %<PRIu64>.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Impossible de lire les entrées des méta-données de BITLK depuis %s."
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Débordement du décalage du périphérique.\n"
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Cette opération n'est pas supportée."
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "La vérification a échoué à la position %<PRIu64>.\n"
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Mauvaise taille de clé."
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Mauvais paramètres de taille pour le périphérique verity.\n"
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Ce périphérique BITLK est dans un état non supporté et ne peut pas être activé."
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Trop de niveaux dans l'arborescence du volume verity.\n"
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "Les périphériques BITLK avec le type « %s » ne peuvent pas être activés."
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "La vérification de la zone de données a échoué.\n"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "L'activation d'un périphérique BITLK partiellement déchiffré n'est pas supporté."
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "La vérification du hachage de la racine a échoué.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Impossible d'activer le périphérique car dm-crypt dans le noyau ne supporte pas BITLK IV."
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr "Erreur d'entrée/sortie lors de la création de la zone de hachage.\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Impossible d'activer le périphérique car dm-crypt dans le noyau ne supporte pas le diffuseur BITLK Elephant."
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "La création de la zone de hachage a échoué.\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Le périphérique verity %s n'utilise pas l'en-tête sur le disque."
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity.c:90
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-"ATTENTION : Le kernel ne peut pas activer le périphérique si la taille des "
-"blocs de données dépasse la taille d'une page (%u).\n"
+msgid "Device %s is not a valid VERITY device."
+msgstr "Le périphérique %s n'est pas un périphérique VERITY valable."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr ""
-"Impossible de vérifier une phrase secrète non saisie sur une console.\n"
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "La version VERITY %d n'est pas supportée."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Aucun motif connu d'algorithme de chiffrement n'a été détecté.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "En-tête VERITY corrompu."
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
-msgstr ""
-"ATTENTION: Le paramètre --hash est ignoré en mode non chiffré quand le "
-"fichier de clé est spécifié.\n"
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Mauvais format d'UUID VERITY fourni sur le périphérique %s."
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
-msgstr ""
-"ATTENTION: L'option --keyfile-size est ignorée. La taille de lecture est la "
-"même que la taille de la clé de chiffrement.\n"
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Erreur lors de la mise à jour de l'en-tête verity sur le périphérique %s."
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "L'option --key-file est requise.\n"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "La vérification de la signature du hachage racine n'est pas supportée."
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Aucun en-tête détecté avec cette phrase secrète sur le périphérique.\n"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Les erreurs ne savent pas être réparées avec un périphérique FEC."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
-msgstr ""
-"Le contenu de l'en-tête avec la clé de volume est une information\n"
-"sensible qui permet d'accéder à la partition chiffrée sans mot de passe.\n"
-"Ce contenu devrait toujours être stocké, chiffré, en lieu sûr."
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "%u erreurs réparables ont été trouvées avec le périphérique FEC."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Le résultat de l'évaluation de performance n'est pas fiable.\n"
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Le noyau ne supporte pas les associations de type dm-verity."
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr ""
-"# Tests approximatifs en utilisant uniquement la mémoire (pas de stockage E/"
-"S).\n"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Le noyau ne supporte pas les options de signature dm-verity."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "# Algorithme | Clé | Chiffrement | Déchiffrement\n"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Le périphérique verity a détecté une corruption après l'activation."
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Le chiffrement %s n'est pas disponible.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "La zone de réserve n'a pas été mise à zéro à la positon %<PRIu64>."
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "N/D"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Débordement du décalage du périphérique."
 
-#: src/cryptsetup.c:639
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Impossible de lire le fichier de clé %s.\n"
+msgid "Verification failed at position %<PRIu64>."
+msgstr "La vérification a échoué à la position %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Mauvais paramètres de taille pour le périphérique verity."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Débordement de la zone de hachage."
 
-#: src/cryptsetup.c:643
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "La vérification de la zone de données a échoué."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "La vérification du hachage de la racine a échoué."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Erreur d'entrée/sortie lors de la création de la zone de hachage."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "La création de la zone de hachage a échoué."
+
+#: lib/verity/verity_hash.c:433
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Échec à la lecture de %d octets du fichier de clé %s.\n"
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "ATTENTION : Le kernel ne peut pas activer le périphérique si la taille des blocs de données dépasse la taille d'une page (%u)."
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Réellement essayer de réparer l'en-tête du périphérique LUKS ?"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Échec de l'allocation du contexte RS."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Échec de l'allocation du tampon."
+
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Cette action écrasera définitivement les données sur %s."
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Échec de lecture du bloc RS %<PRIu64> octet %d."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "erreur d'allocation de mémoire dans action_luksFormat"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Échec de la lecture de la parité du bloc RS %<PRIu64>."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity_fec.c:177
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Ne peut utiliser %s comme en-tête sur disque.\n"
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Échec de la réparation de la parité du bloc %<PRIu64>."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
-"Décalage réduit de données est uniquement permis dans un en-tête LUKS "
-"détaché.\n"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Échec de l'écriture de la parité du bloc RS %<PRIu64>."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Les tailles des blocs doivent concorder pour FEC."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Nombre d'octets de parité invalide."
+
+#: lib/verity/verity_fec.c:265
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Emplacement de clé %d sélectionné pour suppression.\n"
+msgid "Failed to determine size for device %s."
+msgstr "Impossible de déterminer la taille du périphérique %s."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Le noyau ne supporte pas les associations de type dm-integrity."
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Le noyau ne supporte pas les alignements de méta-données fixés de dm-integrity."
 
-#: src/cryptsetup.c:884
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "La clé %d n'est pas active. Impossible de l'effacer.\n"
+msgid "Failed to acquire write lock on device %s."
+msgstr "Impossible d'acquérir un verrou en écriture sur le périphérique %s."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Tentative détectée de mettre à jour les métadonnées LUKS2 de manière concurrent. L'opération est abandonnée."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
 msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
-"Ceci est le dernier emplacement de clé. Le périphérique sera inutilisable "
-"après la suppression de cette clé."
-
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Entrez toute phrase secrète restante : "
+"Le périphérique contient une signature ambigüe, impossible de récupérer automatiquement LUKS2.\n"
+"Veuillez exécuter « cryptsetup repair » pour la récupération."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Entrez la phrase secrète à effacer : "
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Le décalage de données demandé est trop petit."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Entrez une phrase de passe existante : "
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "ATTENTION: la zone des emplacements de clés (%<PRIu64> octets) est très petite, le nombre d'emplacements de clés LUKS2 est très limité.\n"
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Entrez la phrase secrète à changer : "
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Impossible d'acquérir le verrou de lecture sur le périphérique %s."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Entrez la nouvelle phrase secrète : "
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Des exigences LUKS2 interdites ont été détectées dans la sauvegarde %s."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr "L'opération isLuks supporte seulement un périphérique en argument.\n"
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Les décalages des données ne sont pas identiques sur le périphérique et la sauvegarde, la restauration a échoué."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "L'option --header-backup-file est requise.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Les en-têtes binaires avec des tailles de zones d'emplacements de clés sont différents sur le périphérique et la sauvegarde, la restauration a échouée."
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:1221
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Type de métadonnée du périphérique %s non reconnu.\n"
+msgid "Device %s %s%s%s%s"
+msgstr "Périphérique %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "ne contient pas d'en-tête LUKS2. Remplacer l'en-tête peut détruire les données de ce périphérique."
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "contient déjà un en-tête LUKS2. Remplacer l'en-tête détruira les emplacements de clés actuels."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"La commande exige un périphérique et un nom de correspondance comme "
-"arguments.\n"
+"\n"
+"ATTENTION: des exigences LUKS2 inconnues ont été détectées sur l'en-tête du périphérique réel !\n"
+"Remplacer l'en-tête par la sauvegarde peut corrompre les données sur ce périphérique !"
 
-#: src/cryptsetup.c:1326
-#, c-format
+#: lib/luks2/luks2_json_metadata.c:1227
 msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
 msgstr ""
-"Cette opération va supprimer tous les emplacements de clés du périphérique "
-"%s.\n"
-"Le périphérique sera inutilisable après cette opération."
+"\n"
+"ATTENTION: Un rechiffrement hors-ligne non terminé a été détecté sur le périphérique !\n"
+"Remplacer l'en-tête par la sauvegarde peut corrompre les données."
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<périphérique> [--type <type>] [<nom>]"
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Fanion inconnu %s ignoré."
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "ouvrir un périphérique avec <nom> comme « mapping »"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Clé manquante pour le segment %u de dm-crypt"
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<nom>"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Impossible de définir le segment dm-crypt."
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "fermeture du périphérique (supprime le « mapping »)"
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Impossible de définir le segment dm-linear."
 
-#: src/cryptsetup.c:1362
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Configuration d'intégrité du périphérique non supportée."
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Re-chiffrement en cours. Le périphérique ne peut être désactivé."
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Échec du remplacement du périphérique suspendu %s avec la cible dm-error."
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Échec lors de la lecture des exigences LUKS2."
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Des exigences LUKS2 non rencontrées ont été détectées."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Opération incompatible avec un périphérique marqué pour le rechiffrement historique. Abandon."
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Opération incompatible avec un périphérique marqué pour le rechiffrement LUKS2. Abandon."
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Pas assez de mémoire disponible pour ouvrir l'emplacement de clé."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Échec de l'ouverture de l'emplacement de clé."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Impossible d'utiliser le chiffrement %s-%s pour le chiffrement de l'emplacement de clé"
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Plus d'espace pour le nouvel emplacement de clé."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Ne peut vérifier le statut du périphérique avec le uuid : %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Impossible de convertir un en-tête avec des métadonnées LUKSMETA supplémentaires."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Impossible de déplacer la zone des emplacements de clés. Pas assez d'espace."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Impossible de déplacer la zone des emplacements de clés. Les emplacements de clés LULS2 sont trop petits."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Impossible de déplacer la zone des emplacements de clés."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Impossible de convertir au format LUKS1 – la taille du secteur de chiffrement du segment par défaut n'est pas 512 octets."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Impossible de convertir au format LUKS1 – les résumés des emplacements de clés ne sont pas compatibles avec LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Impossible de convertir au format LUKS1 – le périphérique utilise des clés de chiffrement %s emballées."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Impossible de convertir au format LUKS1 – l'en-tête LUKS2 contient %u jeton(s)."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Impossible de convertir au format LUKS1 – l'emplacement de clé %u est dans un état invalide."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Impossible de convertir au format LUKS1 – l'emplacement %u (sur les emplacements maximum) est toujours actif."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Impossible de convertir au format LUKS1 – l'emplacement de clé %u n'est pas compatible avec LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "La taille de la zone chaude doit être un multiple de l'alignement de zone calculé (%zu octets)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "La taille du périphérique doit être un multiple de l'alignement de zone calculé (%zu octets)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Mode de résilience %s non supporté"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Impossible d'initialiser l'encapsulation pour le stockage de l'ancien segment."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Impossible d'initialiser l'encapsulation pour le stockage du nouveau segment."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Impossible de lire les sommes de contrôle pour la zone chaude actuelle."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Échec de la lecture de la zone chaude démarrant à %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Échec lors du déchiffrement du secteur %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Échec lors de la récupération du secteur %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Les tailles des périphériques source et cible ne correspondent pas. Source %<PRIu64>, cible: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Échec de l'activation du périphérique de zone chaude %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Impossible d'activer le périphérique de surcouche %s avec la table d'origine actuelle."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Impossible de charger la nouvelle cartographie du périphérique %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Impossible de rafraîchir la pile des périphériques de rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Impossible de définir la taille de la nouvelle zone des emplacements de clés."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Le décalage de données n'est pas aligné sur la taille de secteur de chiffrement demandée (%<PRIu32> octets)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Le périphérique de données n'est pas aligné sur la taille de secteur de chiffrement demandée (%<PRIu32> octets)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Le décalage de données (%<PRIu64> secteurs) est plus petit que le décalage de données future (%<PRIu64> secteurs)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Erreur lors de l'ouverture de %s en mode exclusif (déjà mappé ou monté)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Le périphérique n'est pas marqué pour le rechiffrement LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Échec du chargement du contexte de rechiffrement LUKS2"
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Impossible d'obtenir l'état de rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Le périphérique n'est pas en rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Le rechiffrement est déjà en cours."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Impossible d'acquérir le verrou de rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "Impossible de réaliser le rechiffrement. Exécutez d'abord la récupération du rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "La taille du périphérique actif et la taille de rechiffrement demandée ne correspondent pas."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "Taille de périphérique illégale demandée dans les paramètres de rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Rechiffrement en cours. La récupération ne peut pas être réalisée."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "Rechiffrement LUKS2 déjà initialisé dans les métadonnées."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Échec de l'initialisation du rechiffrement LUKS2 dans les métadonnées."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Impossible de définir les segments du périphérique pour le rechiffrement suivant de la zone chaude."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Échec lors de l'écriture des métadonnées de la résilience du rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Échec du déchiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Échec de l'écriture de la zone chaude démarrant à %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Erreur lors de la synchronisation des données."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Échec de la mise à jour des métadonnées après la fin du rechiffrement de la zone chaude courante."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Échec lors de l'écriture des métadonnées LUKS2"
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Échec lors de l'effacement des données du segment de sauvegarde."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Impossible de désactiver le fanion de demande de rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Erreur fatale en rechiffrant le morceau commençant à %<PRIu64> d'une longueur de %<PRIu64> secteurs."
+
+# Frédéric: Je n'ai pas la moindre idée de ce que le développeur a voulu écrire. Qu'est-ce que "error target" dans ce contexte ?
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Ne pas redémarrer le périphérique à moins qu'il ait été remplacé manuellement par la cible en erreur."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "Impossible de réaliser le rechiffrement. Statut de rechiffrement inattendu."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Contexte de rechiffrement manquant ou invalide."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Impossible d'initialiser la pile du périphérique de rechiffrement."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Échec de la mise à jour du contexte de rechiffrement."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Aucun emplacement de jeton libre"
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Échec lors de la création du jeton intégré %s"
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Impossible de vérifier une phrase secrète non saisie sur une console."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Les paramètres de chiffrement des emplacement de clés peuvent uniquement être définis pour un périphérique LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Aucun motif connu d'algorithme de chiffrement n'a été détecté."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "ATTENTION: Le paramètre --hash est ignoré en mode non chiffré quand le fichier de clé est spécifié.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "ATTENTION: L'option --keyfile-size est ignorée. La taille de lecture est la même que la taille de la clé de chiffrement.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Signature(s) de périphérique détectée(s) sur %s. Continuer risque d'endommager les données existantes."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Opération interrompue.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "L'option --key-file est requise."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Entrez le PIN VeraCrypt : "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Valeur PIN invalide : erreur d'analyse"
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Valeur PIN invalide: 0"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Valeur PIN invalide: hors des limites."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Aucun en-tête détecté avec cette phrase secrète sur le périphérique."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Le périphérique %s n'est pas un périphérique BITLK valide."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Le contenu de l'en-tête avec la clé de volume est une information\n"
+"sensible qui permet d'accéder à la partition chiffrée sans mot de passe.\n"
+"Ce contenu devrait toujours être stocké, chiffré, en lieu sûr."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Le périphérique %s est toujours actif et prévu pour une suppression différée.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Le redimensionnement d'un périphérique actif requiert que la clé du volume soit dans le porte-clé mais l'option --disable-keyring est définie."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Test de performance interrompu."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     N/A\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u itérations par seconde pour une clé de %zu bits\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s N/A\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u itérations, %5u mémoire, %1u threads parallèles (CPUs) pour une clé de %zu bits (temps de %u ms demandé)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Le résultat de l'évaluation de performance n'est pas fiable."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Tests approximatifs en utilisant uniquement la mémoire (pas de stockage E/S).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s Algorithme |       Clé |     Chiffrement |    Déchiffrement\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Le chiffrement %s (avec une clé de %i bits) n'est pas disponible."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#    Algorithme |       Clé |     Chiffrement |    Déchiffrement\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/D"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Le périphérique seems ne requière pas de récupération de rechiffrement.\n"
+"Voulez-vous quand-même continuer ?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Réellement procéder à la récupération du rechiffrement LUKS2 ?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Entrez la phrase secrète pour la récupération du rechiffrement : "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Réellement essayer de réparer l'en-tête du périphérique LUKS ?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Effacement du périphérique pour initialiser les sommes de contrôle d'intégrité.\n"
+"Vous pouvez interrompre ceci en appuyant sur CTRL+c (le reste du périphérique effacé contiendra toujours des sommes de contrôle invalides).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Impossible de désactiver le périphérique temporaire %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "L'option d'intégrité peut uniquement être utilisée avec le format LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Options de taille des métadonnées LUKS2 non supportées."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Impossible de créer le fichier d'en-tête %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Aucun motif connu de spécification d'intégrité n'a été détecté."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Ne peut utiliser %s comme en-tête sur disque."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Cette action écrasera définitivement les données sur %s."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Impossible de définir les paramètres pbkdf."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Décalage réduit de données est uniquement permis dans un en-tête LUKS détaché."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Impossible de déterminer la taille de la clé de volume pour LUKS sans emplacement de clé, veuillez utiliser l'option --key-size."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Le périphérique a été activé mais les fanions ne peuvent pas être rendus permanents."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Emplacement de clé %d sélectionné pour suppression."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Ceci est le dernier emplacement de clé. Le périphérique sera inutilisable après la suppression de cette clé."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Entrez toute phrase secrète restante : "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Opération interrompue, l'emplacement de clé n'a PAS été effacé.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Entrez la phrase secrète à effacer : "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Entrez une nouvelle phrase secrète pour l'emplacement de clé : "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Entrez une phrase secrète existante : "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Entrez la phrase secrète à changer : "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Entrez la nouvelle phrase secrète : "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Entrez la phrase secrète pour l'emplacement de clé à convertir: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "L'opération isLuks supporte seulement un périphérique en argument."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Le contenu de l'en-tête avec la clé de volume est une information\n"
+"sensible qui permet d'accéder à la partition chiffrée sans mot de passe.\n"
+"Ce contenu devrait être stocké, chiffré, en lieu sûr."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "L'emplacement de clé %d ne contient pas de clé non liée."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Le contenu de l'en-tête avec une clé non liée est une information sensible.\n"
+"Ce contenu devrait être stocké, chiffré, en lieu sûr."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "L'option --header-backup-file est requise."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s n'est pas un périphérique géré par cryptsetup."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Le rafraîchissement n'est pas supporté pour un périphérique de type %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Type de métadonnée du périphérique %s non reconnu."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "La commande exige un périphérique et un nom de correspondance comme arguments."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Cette opération va supprimer tous les emplacements de clés du périphérique %s.\n"
+"Le périphérique sera inutilisable après cette opération."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Opération interrompue, les emplacements de clés n'ont PAS été effacés.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Type LUKS invalide, seuls luks1 et luks2 sont supportés."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Le périphérique est déjà du type %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Cette opération va convertir %s au format %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Opération interrompue, le périphérique n'a PAS été converti.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "L'option --priority, --label ou --subsystem est manquante."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Le jeton %d est invalide."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Le jeton %d est utilisé."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Échec lors de l'ajout du jeton %d au porte-clé luks2."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Échec lors de l'affectation du jeton %d à l'emplacement de clé %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Le jeton %d n'est pas utilisé."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Impossible d'importer le jeton depuis le fichier."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Impossible d'obtenir le jeton %d pour l'export."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "Le paramètre --key-description est requis pour l'action d'ajout d'un jeton."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "L'action requiert un jeton spécifique. Utilisez le paramètre --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "L'opération de jeton %s est invalide."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Périphérique dm actif auto-détecté « %s » pour le périphérique de données %s.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Le périphérique %s n'est pas un périphérique blocs.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Échec de l'auto-détection des containers du périphérique %s."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Impossible de décider si le périphérique %s est actif ou non.\n"
+"Êtes-vous sûr de vouloir procéder au rechiffrement en mode hors-ligne ?\n"
+"Les données pourraient être corrompues si le périphérique est réellement activé.\n"
+"Pour exécuter le rechiffrement en mode en ligne, utilisez le paramètre --active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Type de périphérique LUKS invalide."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Le chiffrement sans en-tête détaché (--header) n'est pas possible sans une réduction de la taille du périphérique de données (--reduce-device-size)"
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Le décalage de données demandé doit être inférieur ou égal à la moitié du paramètre --reduce-device-size."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Ajustement de la valeur de --reduce-device-size à deux fois --offset %<PRIu64> (secteurs).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Le chiffrement est uniquement supporté avec le format LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "Périphérique LUKS détecté sur %s. Voulez-vous chiffrer à nouveau ce périphérique LUKS ?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Le fichier temporaire d'en-tête %s existe déjà. Abandon."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Impossible de créer le fichier temporaire d'en-tête %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s est maintenant actif et prêt pour un chiffrement en ligne.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Pas assez d'emplacements de clés libres pour le rechiffrement."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Le fichier de clé peut uniquement être utilisé avec --key-slot ou avec exactement un seul emplacement de clé actif."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Entrez la phrase secrète pour l'emplacement de clé %d : "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Entrez la phrase secrète pour l'emplacement de clé %u : "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "La commande exige un périphérique comme argument."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "Seul le format LUKS2 est actuellement supporté. Veuillez utiliser l'outil cryptsetup-reencrypt pour LUKS1."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Un rechiffrement hors-ligne historique est déjà en cours. Utilisez l'utilitaire cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Le rechiffrement d'un périphérique avec un profil d'intégrité n'est pas supporté."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "Rechiffrement LUKS2 déjà initialisé. Abandon de l'opération."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "Le périphérique LUKS2 n'est pas en rechiffrement."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<périphérique> [--type <type>] [<nom>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "ouvrir le périphérique comme <nom>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<nom>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "fermeture du périphérique (supprime le « mapping »)"
+
+#: src/cryptsetup.c:3348
 msgid "resize active device"
 msgstr "redimensionner le périphérique actif"
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "afficher le statut du périphérique"
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "afficher le statut du périphérique"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <chiffrement>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "chiffrement pour test de performance"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<périphérique>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "essayer de réparer les métadonnées sur le disque"
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "rechiffrer le périphérique LUKS2"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "supprimer tous les emplacements de clés (supprime la clé de chiffrement)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "convertir LUKS depuis/vers le format LUKS2"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "définir les options de configuration permanentes pour LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<périphérique> [<fichier de la nouvelle clé>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "formater un périphérique LUKS"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "ajouter une clé au périphérique LUKS"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<périphérique> [<fichier de clé>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "retire du périphérique LUKS la clé ou le fichier de clé fourni"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "modifie la clé ou le fichier de clé fourni pour le périphérique LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "converti une clé vers les nouveaux paramètres pbkdf"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<périphérique> <emplacement de clé>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "efface de façon sécurisée la clé avec le numéro <emplacement de clé> du périphérique LUKS"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "afficher l'UUID du périphérique LUKS"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "teste si <périphérique> a un en-tête de partition LUKS"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "affiche les informations LUKS de la partition"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "affiche les informations du périphérique TCRYPT"
+
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "affiche les informations du périphérique BITLK"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Suspendre le périphérique LUKS et effacer de façon sécurisée la clé (toutes les entrées/sorties sont suspendues)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Remettre en service le périphérique LUKS suspendu"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Sauvegarder l'en-tête et les emplacements de clés du périphérique LUKS"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Restaurer l'en-tête et les emplacements de clés du périphérique LUKS"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <périphérique>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Manipuler les jetons LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<action> est l'une de :\n"
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"Vous pouvez aussi utiliser les alias de l'ancienne syntaxe <action> :\n"
+"\touvrir : create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tfermer : remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<nom> est le périphérique à créer dans %s\n"
+"<périphérique> est le périphérique chiffré\n"
+"<emplacement> est le numéro de l'emplacement de clé LUKS à modifier\n"
+"<fichier de clé> est un fichier optionnel contenant la nouvelle clé pour l'action luksAddKey\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Le format de métadonnées compilé par défaut est %s (pour l'action luksFormat).\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Clé compilée par défaut et paramètres de phrase secrète :\n"
+"\tTaille max. fichier de clé : %d ko, longueur max. interactive de phrase secrète %d (caractères)\n"
+"PBKDF par défaut pour LUKS1 : %s, temps d'itération : %d (ms)\n"
+"PBKDF par défaut pour LUKS2 : %s\n"
+"\tTemps d'itération: %d, Mémoire requise: %d ko, Threads parallèles: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Paramètres de chiffrement compilés par défaut :\n"
+"\tloop-AES: %s, Clé %d bits\n"
+"\tplain: %s, Clé: %d bits, Hachage mot de passe: %s\n"
+"\tLUKS: %s, Clé: %d bits, Hachage en-tête LUKS: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: La taille de clé par défaut en mode XTS (deux clés internes) sera doublée.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s : exige %s comme arguments."
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Afficher ce message d'aide"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Afficher, en résumé, la syntaxe d'invocation"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Afficher la version du paquet"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Options d'aide :"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Afficher des messages d'erreur plus détaillés"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Afficher les messages de débogage"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Montrer les messages de débogage incluant les métadonnées JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "L'algorithme de chiffrement utilisé pour chiffrer le disque (voir /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "L'algorithme de hachage utilisé pour créer la clé de chiffrement à partir de la phrase secrète"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Vérifier la phrase secrète en la demandant deux fois"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Lire la clef depuis un fichier"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "Lire la clé (maîtresse) du volume depuis un fichier."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Lister les informations de la clé (maîtresse) de volume au lieu des autres emplacements de clefs"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "La taille de la clé de chiffrement"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "BITS"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Limite la lecture d'un fichier de clé"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "octets"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Nombre d'octets à ignorer dans le fichier de clé"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Limite la lecture d'un nouveau fichier de clé ajouté"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Nombre d'octets à ignorer dans le fichier de clé nouvellement ajouté"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Numéro de l'emplacement pour la nouvelle clé (par défaut, le premier disponible)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "La taille du périphérique"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "SECTEURS"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Utiliser uniquement la taille demandée du périphérique (ignore le reste du périphérique). DANGEREUX !"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "Le décalage de départ dans le périphérique sous-jacent"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Combien de secteurs de données chiffrées à ignorer au début"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Crée une association en lecture seule"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Ne pas demander confirmation"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Délai d'expiration de la demande interactive de phrase secrète (en secondes)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "s"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Mise à jour de la ligne de progression (en secondes)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Nombre de tentatives possibles pour entrer la phrase secrète"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Utiliser une limite de <n> secteurs pour aligner les données – pour luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Fichier contenant une sauvegarde de l'en-tête LUKS et des emplacements de clés"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Utiliser /dev/random pour générer la clé de volume"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Utiliser /dev/urandom pour générer la clé de volume"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Partager le périphérique avec un autre segment chiffré sans recouvrement"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID du périphérique à utiliser"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Autoriser les demandes d'abandon (TRIM) pour le périphérique"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Périphérique ou fichier avec un en-tête LUKS séparé"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Ne pas activer le périphérique. Vérifie simplement le phrase secrète"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Utilise l'en-tête caché (périphérique TCRYPT caché)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Le périphérique est un lecteur TCRYPT système (avec secteur d'amorçage)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Utiliser l'en-tête TCRYPT de secours (secondaire)"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Recherche aussi des périphériques compatibles avec VeraCrypt"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Multiplicateur d'Itération Personnel pour le périphérique compatible avec VeraCrypt"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Interroger le Multiplicateur d'Itération Personnel pour le périphérique compatible avec VeraCrypt"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Type de métadonnées du périphérique : luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Désactive la vérification de la qualité du mot de passe (si activé)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Utilise l'option de compatibilité de performance dm-crypt same_cpu_crypt"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Utilise l'option de compatibilité de performance dm-crypt submit_from_crypt_cpus"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "La suppression du périphérique est différée jusqu'à ce que le dernier utilisateur le ferme"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Utiliser un verrou global pour sérialiser PBKDF qui utilise beaucoup de mémoire (évite le OOM)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Temps d'itération de PBKDF pour LUKS (en ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ms"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Algorithme PBKDF (pour LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Limite de coût mémoire PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilooctets"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Coût parallèle PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "threads"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Coût d'itération PBKDF (forcé, désactive l'étalon)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Priorité de l'emplacement de clé: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Désactiver le verrouillage des métadonnées sur le disque"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Désactiver le chargement des clés de volume via le porte-clé du noyau"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Algorithme d'intégrité des données (uniquement LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Désactiver le journal pour le périphérique d'intégrité"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Ne pas effacer le périphérique après le formatage"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Utiliser le rembourrage historique inefficace (vieux noyaux)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Ne pas demander le mot de passe si l'activation par jeton échoue"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Numéro de jeton (défaut: n'importe lequel)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Description de clé"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Taille du secteur de chiffrement (défaut: 512 octets)"
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Utiliser le IV (vecteur d'initialisation) compté en taille de secteurs (pas en multiple de 512 octets)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Définir les fanions d'activation comme permanents pour le périphérique"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Définir l'étiquette pour le périphérique LUKS2"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Définir l'étiquette de sous-système pour le périphérique LUKS2"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Créer ou déverser un emplacement de clé LUKS2 non lié (aucun segment de donnée assigné)"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Lire ou écrire le json depuis ou vers un fichier"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Taille de la zone de métadonnées de l'en-tête LUKS2"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Taille de la zone des emplacements de clés de l'en-tête LUKS2"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Rafraîchir (réactiver) le périphérique avec de nouveaux paramètres"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Emplacement de clé LUKS2: La taille de la clé de chiffrement"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "Emplacement de clé LUKS2: Le chiffrement utilisé pour le chiffrement de l'emplacement de clé"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Chiffrer le périphérique LUKS2 (chiffrement sur place)."
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Déchiffrer le périphérique LUKS2 (supprime le chiffrement)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Initialiser le rechiffrement LUKS2 uniquement dans les métadonnées."
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Redémarrer uniquement le rechiffrement LUKS2 initialisé."
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Réduire la taille des données du périphérique (déplace le décalage des données). DANGEREUX !"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Taille maximale de la zone chaude de rechiffrement."
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Rechiffre le type de résilience de la zone chaude (checksum,journal,none)"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "Rechiffrer le hachage des sommes de contrôle de la zone chaude"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Outrepasser l'auto-détection du périphérique pour le périphérique dm à rechiffrer"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[OPTION...] <action> <paramètres de l'action>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Il manque l'argument <action>."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Action inconnue."
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Les options --refresh et --test-passphrase sont mutuellement exclusives."
+
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "L'option --deferred est permise uniquement avec la commande close."
+
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "L'option --shared est permise uniquement pour ouvrir un périphérique ordinaire."
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "L'option --allow-discards est permise uniquement pour une opération d'ouverture."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "L'option --persistent est permise uniquement pour une opération d'ouverture."
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "L'option --serialize-memory-hard-pbkdf est permise uniquement pour une opération d'ouverture."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "L'option --persistent n'est pas permise avec --test-passphrase."
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"L'option --key-size est permise seulement avec les actions luksFormat, luksAddKey,\n"
+"open et benchmark. Pour limiter la lecture depuis un fichier de clé, utilisez --keyfile-size=(octets)."
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "L'option --integrity est autorisée uniquement avec luksFormat (LUKS2)."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "L'option --integrity-no-wipe peut uniquement être utilisée pour une action de formatage avec l'extension d'intégrité."
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Les options --label et --subsystem sont permises uniquement pour les opérations luksFormat et config LUKS2."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "L'option --test-passphrase est autorisée uniquement pour ouvrir des périphériques LUKS, TCRYPT et BITLK."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "La taille de la clé doit être un multiple de 8 bits"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "Emplacement de clé non valide."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "L'option --key-file est prioritaire par rapport à un fichier de clé spécifié en argument."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "Nombre négatif non autorisé pour l'option."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Un seul argument --key-file est autorisé."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Seule une des deux possibilités --use-[u]random est autorisée."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "L'option --use-[u]random est autorisée seulement avec luksFormat."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "L'option --uuid est autorisée seulement avec luksFormat et luksUUID."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "L'option --align-payload est autorisée uniquement avec luksFormat."
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Les options --luks2-metadata-size et --opt-luks2-keyslots-size sont permises uniquement pour luksFormat avec LUKS2."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Spécification de taille de métadonnées LUKS2 invalide."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Spécification de taille d'emplacements de clés LUKS2 invalide."
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Les options --align-payload et --offset ne peuvent pas être combinées."
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "L'option --skip est supportée uniquement pour ouvrir des périphériques ordinaires et loopaes."
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "L'option --offset est supportée uniquement pour ouvrir des périphériques ordinaires et loopaes, luksFormat et le rechiffrement de périphérique."
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Les options --tcrypt-hidden, --tcrypt-system ou --tcrypt-backup sont supportées seulement pour un périphérique TCRYPT."
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "L'option --tcrypt-hidden ne peut pas être combinée avec --allow-discards."
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "L'option --veracrypt est uniquement supportée pour un périphérique de type TCRYPT."
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Argument invalide fourni pour le paramètre --veracrypt-pim."
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "L'option --veracrypt-pim est uniquement supportée pour un périphérique compatible avec VeraCrypt."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "L'option --veracrypt-query-pim est uniquement supportée pour un périphérique compatible avec VeraCrypt."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Les options --veracrypt-pim et --veracrypt-query-pim sont mutuellement exclusives."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "L'option --priority peut uniquement être ignore/normal/prefer."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Une spécification d'emplacement de clé est requise."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "La fonction de dérivation d'une clé basée sur un mot de passe (PBKDF = Password-Based Key Derivation Function) peut uniquement être pbkdf2 ou argon2i/argon2id."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Les itérations forcées de PBKDF ne peuvent pas être combinées avec l'option de temps d'itération."
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "L'option de taille de secteur n'est pas supportée pour cette commande."
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "L'option des secteurs IV (vecteur d'initialisation) de grande taille est supportée uniquement à l'ouverture de périphériques de type simple avec une taille de secteur supérieure à 512 octets."
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "La taille de clé est requise avec l'option --unbound."
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "L'option --unbound peut uniquement être utilisée avec les actions luksAddKey et luksDump."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "L'option --refresh peut uniquement être utilisée avec l'action open."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "Impossible de désactiver le verrouillage des métadonnées."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "La spécification de la taille maximale de la zone chaude de rechiffrement est invalide."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "La taille de périphérique spécifiée est invalide."
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "chiffrement pour test de performance"
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "La taille maximum réduite pour le périphérique est 1 GiB."
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<périphérique>"
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "La taille réduite doit être un multiple d'un secteur de 512 octets."
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr "essayer de réparer les métadonnées sur le disque"
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "La taille des données spécifiée est invalide."
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
-msgstr ""
-"supprime tous les emplacements de clés (supprime la clé de chiffrement)"
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Débordement de la taille de réduction."
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<périphérique> [<fichier de la nouvelle clé>]"
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "Le déchiffrement LUKS2 requiert l'option --header."
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "formate un périphérique LUKS"
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "La taille du périphérique doit être un multiple d'un secteur de 512 octets."
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "ajouter une clé au périphérique LUKS"
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Les options --reduce-device-size et --data-size ne peuvent pas être combinées."
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
-msgstr "<périphérique> [<fichier de clé>]"
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Les options --device-size et --size ne peuvent pas être combinées."
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "retire du périphérique LUKS la clé ou le fichier de clé fourni"
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Les options --ignore-corruption et --restart-on-corruption ne peuvent être utilisées ensembles."
 
-#: src/cryptsetup.c:1370
-msgid "changes supplied key or key file of LUKS device"
-msgstr "modifie la clé ou le fichier de clé fourni pour le périphérique LUKS"
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Chaîne d'aléa spécifiée invalide."
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<périphérique> <emplacement de clé>"
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Impossible de créer l'image de hachage %s en écriture."
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr ""
-"efface de façon sécurisée la clé avec le numéro <emplacement de clé> du "
-"périphérique LUKS"
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Impossible de créer l'image FEC %s en écriture."
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "afficher l'UUID du périphérique LUKS"
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Chaîne de hachage racine invalide."
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "teste si <périphérique> a un en-tête de partition LUKS"
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr "Fichier de signature %s invalide."
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
-msgstr "affiche les informations LUKS de la partition"
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Impossible de lire le fichier de signature %s."
 
-#: src/cryptsetup.c:1375
-msgid "dump TCRYPT device information"
-msgstr "affiche les informations du périphérique TCRYPT"
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<périph_données> <périph_hachage>"
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"Suspend le périphérique LUKS et effacer de façon sécurisée la clé (toutes "
-"les entrées/sorties sont suspendues)."
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "formater le périphérique"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<périph_données> <périph_hachage> <hachage_racine>"
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Remettre en service le périphérique LUKS suspendu."
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "vérifier le périphérique"
 
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
-msgstr "Sauvegarder l'en-tête et les emplacements de clés du périphérique LUKS"
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<périph_données> <nom> <périph_hachage> <hachage_racine>"
 
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
-msgstr "Restaurer l'en-tête et les emplacements de clés du périphérique LUKS"
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "afficher le statut du périphérique actif"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<périph_hachage>"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "afficher les informations sur le disque"
+
+#: src/veritysetup.c:416
+#, c-format
 msgid ""
 "\n"
-"<action> is one of:\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
 msgstr ""
 "\n"
-"<action> est l'une de :\n"
+"<nom> est le périphérique à créer sous %s\n"
+"<périph_données> est le périphérique de données\n"
+"<périph_hachage> est le périphérique contenant les données de vérification\n"
+"<hachage_racine> hachage du nœud racine sur <périph_hachage>\n"
 
-#: src/cryptsetup.c:1402
+#: src/veritysetup.c:423
+#, c-format
 msgid ""
 "\n"
-"You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
 msgstr ""
 "\n"
-"Vous pouvez aussi utiliser les alias de l'ancienne syntaxe <action> :\n"
-"\touvrir : create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tfermer : remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"Paramètres compilés par défaut dans dm-verity :\n"
+"\tHachage: %s, Bloc données (octets): %u, Bloc hachage (octets): %u, Taille aléa: %u, Format hachage: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Ne pas utiliser le superbloc de verity"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Type de format (1: normal ; 0: Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "nombre"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Taille de bloc sur le périphérique de données"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Taille de bloc sur le périphérique de hachage"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "Octets de parité FEC"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Le nombre de blocs dans le fichier de données"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "blocs"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Chemin vers le périphérique avec les données de correction d'erreurs"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "chemin"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Décalage de départ sur le périphérique de hachage"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Décalage de départ sur le périphérique FEC"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Algorithme de hachage"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "chaîne"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Aléa"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "chaîne hexa"
+
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Chemin du fichier de signature du hachage racine"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Redémarrer le noyau si une corruption est détectée"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ignore la corruption, elle est seulement enregistrée dans le journal"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Ne pas vérifier les blocs mis à zéro"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Vérifier le bloc de données uniquement à la première lecture"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "L'option --ignore-corruption, --restart-on-corruption ou --ignore-zero-blocks est seulement permise pour une opération d'ouverture."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "L'option --root-hash-signature peut uniquement être utilisée avec l'opération open."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Les options --ignore-corruption et --restart-on-corruption ne peuvent être utilisées ensembles."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Impossible de lire le fichier de clé %s."
 
-#: src/cryptsetup.c:1406
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Échec à la lecture de %d octets du fichier de clé %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formaté avec une taille de balise de %u, intégrité interne %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<périph_intégrité>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<périph_intégrigé> <nom>"
+
+#: src/integritysetup.c:502
 #, c-format
 msgid ""
 "\n"
 "<name> is the device to create under %s\n"
-"<device> is the encrypted device\n"
-"<key slot> is the LUKS key slot number to modify\n"
-"<key file> optional key file for the new key for luksAddKey action\n"
+"<integrity_device> is the device containing data with integrity tags\n"
 msgstr ""
 "\n"
-"<nom> est le périphérique à créer dans %s\n"
-"<périphérique> est le périphérique chiffré\n"
-"<emplacement> est le numéro de l'emplacement de clé LUKS à modifier\n"
-"<fichier de clé> est un fichier optionnel contenant la nouvelle clé pour "
-"l'action luksAddKey\n"
+"<nom> est le périphérique à créer sous %s\n"
+"<périph_intégrité> est le périphérique contenant les données avec les balises d'intégrité\n"
 
-#: src/cryptsetup.c:1413
+#: src/integritysetup.c:507
 #, c-format
 msgid ""
 "\n"
-"Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
 msgstr ""
 "\n"
-"Clé compilée par défaut et paramètres de phrase secrète :\n"
-"\tTaille max. fichier de clé : %d ko, longueur max. interactive de phrase "
-"secrète %d (caractères)\n"
-"Temps d'itération PBKDF2 par défaut pour LUKS : %d (ms)\n"
+"Paramètres compilés par défaut dans dm-integrity :\n"
+"\tAlgorithme de somme de contrôle : %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Chemin vers le périphérique de données (si séparé)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Taille du journal"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Secteurs d'entrelacement"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Filigrane du journal"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "pourcent"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Temps pour écrire le journal"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Nombre de secteurs de 512 octets par bit (mode champ de bit)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Temps de purge du mode champ de bit"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Taille de balise (par secteur)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Taille de secteur"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Taille des tampons"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Algorithme d'intégrité des données"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "La taille de la clé d'intégrité des données"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Lire la clef d'intégrité depuis un fichier"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Algorithme d'intégrité du journal"
 
-#: src/cryptsetup.c:1420
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "La taille de la clé du journal d'intégrité"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Lire la clé du journal d'intégrité depuis un fichier"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Algorithme de chiffrement du journal"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "La taille de la clé de chiffrement du journal"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Lire la clé de chiffrement du journal depuis un fichier"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Mode récupération (pas de journal, pas de vérification des balises)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Utiliser un champ de bits pour garder une trace des changements et désactiver le journal sur le périphérique d'intégrité"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Recalculer les balises initiales automatiquement."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "L'option --integrity-recalculate peut uniquement être utilisée avec l'action open."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Les options --journal-size, --interleave-sectors, --sector-size, --tag-size et --no-wipe peuvent uniquement être utilisée avec l'action de format."
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "La spécification de la taille du journal est invalide."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Les options du fichier de clé et de la taille de la clé doivent être spécifiées toutes les deux."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "L'algorithme d'intégrité doit être spécifié si la clé d'intégrité est utilisée."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Les options du fichier de clé de l'intégrité du journal et de la taille de la clé doivent être spécifiées toutes les deux."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "L'algorithme d'intégrité du journal doit être spécifié si la clé d'intégrité du journal est utilisée."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Les options du fichier de clé de chiffrement du journal et de la taille de la clé doivent être spécifiées toutes les deux."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "L'algorithme de chiffrement du journal doit être spécifié si la clé de chiffrement du journal est utilisée."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Les options de mode récupération et champ de bits sont mutuellement exclusives."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Les options de journal ne peuvent pas être utilisées en mode champ de bits."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Les options de champ de bits peuvent uniquement être utilisées en mode champ de bits."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Re-chiffrement déjà en cours."
+
+#: src/cryptsetup_reencrypt.c:208
 #, c-format
-msgid ""
-"\n"
-"Default compiled-in device cipher parameters:\n"
-"\tloop-AES: %s, Key %d bits\n"
-"\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
-msgstr ""
-"\n"
-"Paramètres de chiffrement compilés par défaut :\n"
-"\tloop-AES: %s, Clé %d bits\n"
-"\tplain: %s, Clé: %d bits, Hachage mot de passe: %s\n"
-"\tLUKS1: %s, Clé: %d bits, Hachage en-tête LUKS: %s, RNG: %s\n"
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Impossible d'ouvrir exclusivement %s : périphérique utilisé."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "La réservation de la mémoire alignée a échoué."
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup_reencrypt.c:229
 #, c-format
-msgid "%s: requires %s as arguments"
-msgstr "%s : exige %s comme arguments."
+msgid "Cannot read device %s."
+msgstr "Impossible de lire le périphérique %s."
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
-msgid "Show this help message"
-msgstr "Afficher ce message d'aide"
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Marque le périphérique LUKS1 %s comme inutilisable."
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
-msgid "Display brief usage"
-msgstr "Afficher, en résumé, la syntaxe d'invocation"
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Activation du fanion de re-chiffrement hors-ligne de LUKS2 sur le périphérique %s."
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Options d'aide :"
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Impossible d'écrire le périphérique %s."
 
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
-msgid "Print package version"
-msgstr "Afficher la version du paquet"
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Impossible d'écrire le journal de re-chiffrement."
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
-msgid "Shows more detailed error messages"
-msgstr "Affiche des messages d'erreur plus détaillés"
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Impossible de lire le journal de re-chiffrement."
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
-msgid "Show debug messages"
-msgstr "Afficher les messages de débogage"
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Fichier journal %s existe. Reprise du re-chiffrement.\n"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
-msgid "The cipher used to encrypt the disk (see /proc/crypto)"
-msgstr ""
-"L'algorithme de chiffrement utilisé pour chiffrer le disque (voir /proc/"
-"crypto)"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Activation du périphérique temporaire en utilisant l'ancien en-tête LUKS."
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
-msgid "The hash used to create the encryption key from the passphrase"
-msgstr ""
-"L'algorithme de hachage utilisé pour créer la clé de chiffrement à partir de "
-"la phrase secrète"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Activation du périphérique temporaire un utilisant le nouvel en-tête LUKS."
 
-#: src/cryptsetup.c:1481
-msgid "Verifies the passphrase by asking for it twice"
-msgstr "Vérifie la phrase secrète en la demandant deux fois"
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Échec de l'activation des périphériques temporaires."
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
-msgstr "Lit la clef depuis un fichier."
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Impossible de définir les offsets des données."
 
-#: src/cryptsetup.c:1483
-msgid "Read the volume (master) key from file."
-msgstr "Lit la clé (maîtresse) du volume depuis un fichier."
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Impossible de définir la taille des métadonnées."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr ""
-"Liste les informations de la clé (maîtresse) de volume au lieu des autres "
-"emplacements de clefs."
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Nouvel en-tête LUKS créé pour le périphérique %s."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "The size of the encryption key"
-msgstr "La taille de la clé de chiffrement"
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Cette version de cryptsetup-reencrypt ne gère pas le nouveau type de jeton interne %s."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "BITS"
-msgstr "BITS"
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Échec lors de la lecture des fanions d'activation depuis l'en-tête de sauvegarde."
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
-msgid "Limits the read from keyfile"
-msgstr "Limite la lecture d'un fichier de clé"
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Échec lors de l'écriture des fanions d'activation dans le nouvel en-tête."
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
-msgid "bytes"
-msgstr "octets"
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Échec lors de la lecture des exigences de l'en-tête de sauvegarde."
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
-msgid "Number of bytes to skip in keyfile"
-msgstr "Nombre d'octets à ignorer dans le fichier de clé"
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "Sauvegarde de l'en-tête %s du périphérique %s créée."
 
-#: src/cryptsetup.c:1488
-msgid "Limits the read from newly added keyfile"
-msgstr "Limite la lecture d'un nouveau fichier de clé ajouté"
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "La création de la sauvegarde des en-têtes LUKS a échoué."
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Impossible de rétablir l'en-tête %s sur le périphérique %s."
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "En-tête %s rétabli sur le périphérique %s."
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Impossible d'ouvrir le périphérique LUKS temporaire."
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Impossible d'obtenir la taille du périphérique."
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Erreur E/S pendant le re-chiffrement."
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Le UUID fourni est invalide."
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Impossible d'ouvrir le journal de re-chiffrement."
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Pas de déchiffrement en cours. Le UUID fourni ne peut être utilisé que pour reprendre un déchiffrement suspendu."
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Les paramètres pbkdf ont été changés dans l'emplacement de clé %i."
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Taille de bloc de re-chiffrement"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Ne pas changer la clé, pas de re-chiffrement de la zone de donnée"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Lire la nouvelle clé (maîtresse) du volume depuis un fichier"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Temps d'itération de PBKDF2 pour LUKS (en ms)"
 
-#: src/cryptsetup.c:1489
-msgid "Number of bytes to skip in newly added keyfile"
-msgstr "Nombre d'octets à ignorer dans le fichier de clé nouvellement ajouté"
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Utiliser direct-io pour accéder aux périphériques"
 
-#: src/cryptsetup.c:1490
-msgid "Slot number for new key (default is first free)"
-msgstr ""
-"Numéro de l'emplacement pour la nouvelle clé (par défaut, le premier "
-"disponible)"
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Utiliser fsync après chaque bloc"
 
-#: src/cryptsetup.c:1491
-msgid "The size of the device"
-msgstr "La taille du périphérique"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Mettre le journal à jour après chaque bloc"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
-msgid "SECTORS"
-msgstr "SECTEURS"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Utiliser uniquement cet emplacement (les autres seront désactivés)"
 
-#: src/cryptsetup.c:1492
-msgid "The start offset in the backend device"
-msgstr "Le décalage de départ dans le périphérique sous-jacent"
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Créer un nouvel en-tête sur le périphérique non chiffré"
 
-#: src/cryptsetup.c:1493
-msgid "How many sectors of the encrypted data to skip at the beginning"
-msgstr "Combien de secteurs de données chiffrées à ignorer au début"
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Déchiffrer le périphérique de manière permanente (supprime le chiffrement)"
 
-#: src/cryptsetup.c:1494
-msgid "Create a readonly mapping"
-msgstr "Crée une association en lecture seule"
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "Le UUID utilisé pour poursuivre le déchiffrement"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "Temps d'itération de PBKDF2 pour LUKS (en ms)"
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Type de métadonnées LUKS: luks1, luks2"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "ms"
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[OPTION...] <périph>"
 
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
-msgid "Do not ask for confirmation"
-msgstr "Ne pas demander confirmation"
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Le re-chiffrement va changer : %s%s%s%s%s%s."
 
-#: src/cryptsetup.c:1497
-msgid "Timeout for interactive passphrase prompt (in seconds)"
-msgstr ""
-"Délai d'expiration de la demande interactive de phrase secrète (en secondes)"
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "clé de volume"
 
-#: src/cryptsetup.c:1497
-msgid "secs"
-msgstr "s"
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "change hachage en "
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "Nombre de tentatives possibles pour entrer la phrase secrète"
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", change chiffrement en "
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr ""
-"Utiliser une limite de <n> secteurs pour aligner les données – pour "
-"luksFormat"
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Argument requis."
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr ""
-"Fichier contenant une sauvegarde de l'en-tête LUKS et des emplacements de "
-"clés."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Seules les valeurs entre 1 MiB et 64 MiB sont permises pour la taille des blocs de re-chiffrement."
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "Utiliser /dev/random pour générer la clé de volume."
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "La taille maximum réduite pour le périphérique est 64 MiB."
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Utiliser /dev/urandom pour générer la clé de volume."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "L'option --new doit être utilisée avec --reduce-device-size ou --header."
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr ""
-"Partager le périphérique avec un autre segment chiffré sans recouvrement."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "L'option --keep-key ne peut être utilisée que avec --hash, --iter-time ou --pbkdf-force-iterations²."
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID du périphérique à utiliser."
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "L'option --new ne peut pas être utilisée avec --decrypt."
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Autoriser les demandes d'abandon (TRIM) pour le périphérique."
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "L'option --decrypt est incompatible avec les paramètres spécifiés."
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Périphérique ou fichier avec un en-tête LUKS séparé."
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "L'option --uuid ne peut être utilisée qu'avec --decrypt."
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Ne pas activer le périphérique. Vérifie simplement le phrase secrète."
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Type luks invalide. Utilisez « luks », « luks1 » ou « luks2 »."
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Utilise l'en-tête caché (périphérique TCRYPT caché)."
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Erreur de lecture de la réponse depuis le terminal."
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr ""
-"Le périphérique est un lecteur TCRYPT système (avec secteur d'amorçage)."
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Opération réussie.\n"
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Utiliser l'en-tête TCRYPT de secours (secondaire)."
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "paramètres erronés ou manquants"
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Recherche aussi des périphériques compatibles avec VeraCrypt."
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "Aucune permission ou mauvais mot de passe"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Type de métadonnées du périphérique : luks, plain, loopaes, tcrypt."
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "mémoire épuisée"
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Désactive la vérification de la qualité du mot de passe (si activé)."
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "mauvais périphérique ou fichier spécifié"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr ""
-"Utilise l'option de compatibilité de performance dm-crypt same_cpu_crypt."
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "le périphérique existe déjà ou est utilisé"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr ""
-"Utilise l'option de compatibilité de performance dm-crypt "
-"submit_from_crypt_cpus."
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "erreur inconnue"
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
-msgid "[OPTION...] <action> <action-specific>"
-msgstr "[OPTION...] <action> <paramètres de l'action>"
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "La commande a échoué avec le code %i (%s).\n"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Fonctionne en mode FIPS.\n"
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Emplacement de clef %i créé."
 
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
-msgid "Argument <action> missing."
-msgstr "Il manque l'argument <action>."
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Emplacement de clé %i déverrouillé."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
-msgid "Unknown action."
-msgstr "Action inconnue."
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Emplacement de clé %i supprimé."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr ""
-"L'option --shared est permise uniquement pour ouvrir un périphérique "
-"ordinaire.\n"
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Jeton %i créé."
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr ""
-"L'option --allow-discards est permise uniquement pour une opération "
-"d'ouverture.\n"
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Jeton %i supprimé."
 
-#: src/cryptsetup.c:1657
+#: src/utils_tools.c:464
 msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+"\n"
+"Wipe interrupted."
 msgstr ""
-"L'option --key-size est permise seulement avec luksFormat, open et "
-"benchmark.\n"
-"Pour limiter la lecture depuis un fichier de clé, utilisez --keyfile-"
-"size=(octets)."
+"\n"
+"Effacement interrompu."
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
-msgstr ""
-"L'option --test-passphrase est autorisée uniquement pour ouvrir des "
-"périphériques LUKS et TCRYPT.\n"
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "ATTENTION: Le périphérique %s contient déjà une signature pour une partition « %s ».\n"
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
-msgid "Key size must be a multiple of 8 bits"
-msgstr "La taille de la clé doit être un multiple de 8 bits"
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "ATTENTION: Le périphérique %s contient déjà une signature pour un superblock « %s ».\n"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
-msgid "Key slot is invalid."
-msgstr "Emplacement de clé non valide."
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Impossible d'initialiser les sondes de la signature du périphérique."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"L'option --key-file est prioritaire par rapport à un fichier de clé spécifié "
-"en argument.\n"
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Impossible d'exécuter « stat » sur le périphérique %s."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
-msgid "Negative number for option not permitted."
-msgstr "Nombre négatif non autorisé pour l'option."
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Le périphérique %s est utilisé. Impossible de continuer avec l'opération de formatage."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
-msgid "Only one of --use-[u]random options is allowed."
-msgstr "Seule une des deux possibilités --use-[u]random est autorisée."
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Impossible d'ouvrir le fichier %s en mode lecture/écriture."
 
-#: src/cryptsetup.c:1699
-msgid "Option --use-[u]random is allowed only for luksFormat."
-msgstr "L'option --use-[u]random est autorisée seulement avec luksFormat."
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "La signature de partition « %s » existante (offset: %<PRIi64> octets) sur le périphérique %s sera effacée."
 
-#: src/cryptsetup.c:1703
-msgid "Option --uuid is allowed only for luksFormat and luksUUID."
-msgstr "L'option --uuid est autorisée seulement avec luksFormat et luksUUID."
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "La signature de superbloc « %s » existante (offset: %<PRIi64> octets) sur le périphérique %s sera effacée."
 
-#: src/cryptsetup.c:1707
-msgid "Option --align-payload is allowed only for luksFormat."
-msgstr "L'option --align-payload est autorisée uniquement avec luksFormat."
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Impossible d'effacer la signature du périphérique."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"L'option --skip est supportée uniquement pour ouvrir des périphériques "
-"ordinaires et loopaes.\n"
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Impossible de sonder le périphérique %s pour une signature."
 
-#: src/cryptsetup.c:1719
+#: src/utils_tools.c:629
 msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
+"\n"
+"Reencryption interrupted."
 msgstr ""
-"L'option --offset est supportée uniquement pour ouvrir des périphériques "
-"ordinaires et loopaes.\n"
+"\n"
+"Rechiffrement interrompu."
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
-msgstr ""
-"Les options --tcrypt-hidden, --tcrypt-system ou --tcrypt-backup sont "
-"supportées seulement pour un périphérique TCRYPT.\n"
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Ne peut vérifier la qualité du mot de passe : %s"
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
 msgstr ""
-"L'option --tcrypt-hidden ne peut pas être combinée avec --allow-discards.\n"
+"Échec de la vérification de la qualité du mot de passe :\n"
+" %s"
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr ""
-"L'option --veracrypt est uniquement supportée pour un périphérique de type "
-"TCRYPT.\n"
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Échec de la vérification de la qualité du mot de passe : Mauvais mot de passe (%s)"
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "Chaîne d'aléa spécifiée invalide.\n"
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Erreur de lecture de la phrase secrète depuis la console."
 
-#: src/veritysetup.c:88
-#, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "Impossible de créer l'image de hachage %s en écriture.\n"
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Vérifiez la phrase secrète : "
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "Chaîne de hachage racine invalide.\n"
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Les phrases secrètes ne sont pas identiques."
 
-#: src/veritysetup.c:308
-msgid "<data_device> <hash_device>"
-msgstr "<périph_données> <périph_hachage>"
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Le décalage n'est pas possible si l'entrée provient de la console."
 
-#: src/veritysetup.c:308
-msgid "format device"
-msgstr "formater le périphérique"
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Saisissez la phrase secrète : "
 
-#: src/veritysetup.c:309
-msgid "<data_device> <hash_device> <root_hash>"
-msgstr "<périph_données> <périph_hachage> <hachage_racine>"
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Saisissez la phrase secrète pour %s : "
 
-#: src/veritysetup.c:309
-msgid "verify device"
-msgstr "vérifier le périphérique"
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Aucune clé disponible avec cette phrase secrète."
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<nom> <périph_données> <périph_hachage> <hachage_racine>"
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Aucun emplacement de clé utilisable est disponible."
 
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "créer le périphérique actif"
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Impossible d'ouvrir le fichier de clé %s en écriture."
 
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "supprime (désactive) le périphérique"
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Impossible d'écrire dans le fichier de clé %s."
 
-#: src/veritysetup.c:312
-msgid "show active device status"
-msgstr "afficher le statut du périphérique actif"
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Impossible d'ouvrir le fichier %s en lecture seule."
 
-#: src/veritysetup.c:313
-msgid "<hash_device>"
-msgstr "<périph_hachage>"
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Fournissez le jeton LUKS valide au format JSON:\n"
 
-#: src/veritysetup.c:313
-msgid "show on-disk information"
-msgstr "afficher les informations sur le disque"
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Impossible de lire le fichier JSON."
 
-#: src/veritysetup.c:332
-#, c-format
+#: src/utils_luks2.c:72
 msgid ""
 "\n"
-"<name> is the device to create under %s\n"
-"<data_device> is the data device\n"
-"<hash_device> is the device containing verification data\n"
-"<root_hash> hash of the root node on <hash_device>\n"
+"Read interrupted."
 msgstr ""
 "\n"
-"<nom> est le périphérique à créer sous %s\n"
-"<périph_données> est le périphérique de données\n"
-"<périph_hachage> est le périphérique contenant les données de vérification\n"
-"<hachage_racine> hachage du nœud racine sur <périph_hachage>\n"
+"Lecture interrompue."
 
-#: src/veritysetup.c:339
+#: src/utils_luks2.c:113
 #, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Impossible d'ouvrir le fichier %s en écriture seule."
+
+#: src/utils_luks2.c:122
 msgid ""
 "\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"Write interrupted."
 msgstr ""
 "\n"
-"Paramètres compilés par défaut dans dm-verity :\n"
-"\tHachage: %s, Bloc données (octets): %u, Bloc hachage (octets): %u, Taille "
-"aléa: %u, Format hachage: %u\n"
-
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
-msgstr "Ne pas utiliser le superbloc de verity"
-
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
-msgstr "Type de format (1: normal ; 0: Chrome OS)"
-
-#: src/veritysetup.c:378
-msgid "number"
-msgstr "nombre"
+"Écriture interrompue."
 
-#: src/veritysetup.c:379
-msgid "Block size on the data device"
-msgstr "Taille de bloc sur le périphérique de données"
-
-#: src/veritysetup.c:380
-msgid "Block size on the hash device"
-msgstr "Taille de bloc sur le périphérique de hachage"
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Erreur lors de l'écriture du fichier JSON."
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
-msgstr "Le nombre de blocs dans le fichier de données"
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands."
+#~ msgstr "Le paramètre --refresh est permis uniquement avec les commandes open ou refresh."
 
-#: src/veritysetup.c:381
-msgid "blocks"
-msgstr "blocs"
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Le chiffrement %s n'est pas disponible."
 
-#: src/veritysetup.c:382
-msgid "Starting offset on the hash device"
-msgstr "Décalage de départ dans le périphérique de hachage"
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Taille de secteur de chiffrement non supportée.\n"
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
-msgstr "Algorithme de hachage"
+#~ msgid "Offline reencryption in progress. Aborting."
+#~ msgstr "Un rechiffrement hors-ligne est en cours. Interruption."
 
-#: src/veritysetup.c:383
-msgid "string"
-msgstr "chaîne"
+#~ msgid "Online reencryption in progress. Aborting."
+#~ msgstr "Un rechiffrement en-ligne est en cours. Interruption."
 
-#: src/veritysetup.c:384
-msgid "Salt"
-msgstr "Aléa"
+#~ msgid "No LUKS2 reencryption in progress."
+#~ msgstr "Pas de rechiffrement LUKS2 en cours."
 
-#: src/veritysetup.c:384
-msgid "hex string"
-msgstr "chaîne hexa"
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Interrompu par un signal."
 
-#: src/cryptsetup_reencrypt.c:147
-#, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Impossible d'ouvrir exclusivement %s : périphérique utilisé.\n"
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Fonction pas disponible en mode FIPS."
 
-#: src/cryptsetup_reencrypt.c:151
-#, c-format
-msgid "Cannot open device %s\n"
-msgstr "Impossible d'ouvrir le périphérique %s\n"
+#~ msgid "Failed to write hash."
+#~ msgstr "Erreur lors de l'écriture du hachage."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "La réservation de la mémoire alignée a échoué.\n"
+#~ msgid "Failed to finalize hash."
+#~ msgstr "Impossible de terminer le hachage."
 
-#: src/cryptsetup_reencrypt.c:168
-#, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Impossible de lire le périphérique %s.\n"
+#~ msgid "Invalid resilience parameters (internal error)."
+#~ msgstr "Paramètres de résilience invalides (erreur interne)."
 
-#: src/cryptsetup_reencrypt.c:179
-#, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "Marque le périphérique LUKS %s comme inutilisable.\n"
+#~ msgid "Failed to assign new enc segments."
+#~ msgstr "Échec lors de l'assignation des nouveaux segments enc."
 
-#: src/cryptsetup_reencrypt.c:184
-#, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "Marque le périphérique LUKS %s comme utilisable.\n"
+#~ msgid "Failed to assign digest %u to segment %u."
+#~ msgstr "Impossible d'affecter le résumé %u au segment %u."
 
-#: src/cryptsetup_reencrypt.c:200
-#, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Impossible d'écrire le périphérique %s.\n"
+#~ msgid "Failed to set segments."
+#~ msgstr "Échec lors de la définition des segments."
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "Impossible d'écrire le journal de re-chiffrement.\n"
+#~ msgid "Failed to assign reencrypt previous backup segment."
+#~ msgstr "Échec lors de l'assignation du segment de sauvegarde précédent rechiffré."
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "Impossible de lire le journal de re-chiffrement.\n"
+#~ msgid "Failed to assign reencrypt final backup segment."
+#~ msgstr "Échec lors de l'assignation du segment de sauvegarde final rechiffré."
 
-#: src/cryptsetup_reencrypt.c:374
-#, c-format
-msgid "Log file %s exists, resuming reencryption.\n"
-msgstr "Fichier journal %s existe. Reprise du re-chiffrement.\n"
+#~ msgid "Failed generate 2nd segment."
+#~ msgstr "Échec lors de la génération du 2ème segment."
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr ""
-"Activation du périphérique temporaire en utilisant l'ancien en-tête LUKS.\n"
+#~ msgid "Failed generate 1st segment."
+#~ msgstr "Échec lors de la génération du 1er segment."
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr ""
-"Activation du périphérique temporaire un utilisant le nouvel en-tête LUKS.\n"
+#~ msgid "Failed to allocate device %s."
+#~ msgstr "Impossible d'allouer le périphérique %s."
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Échec de l'activation des périphériques temporaires.\n"
+#~ msgid "Failed to allocate dm segments."
+#~ msgstr "Échec de l'allocation des segments dm."
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Nouvel en-tête LUKS créé pour le périphérique %s.\n"
+#~ msgid "Failed to create dm segments."
+#~ msgstr "Échec lors de la création des segments dm."
 
-#: src/cryptsetup_reencrypt.c:458
-#, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Emplacement de clé activé %i.\n"
+#~ msgid "Failed to allocate device for new backing device."
+#~ msgstr "Impossible d'allouer le périphérique pour le nouveau périphérique de soutien."
 
-#: src/cryptsetup_reencrypt.c:484
-#, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "Sauvegarde de l'en-tête LUKS du périphérique %s créée.\n"
+#~ msgid "Failed to reload overlay device %s."
+#~ msgstr "Impossible de recharger le périphérique de surcouche %s."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "La création de la sauvegarde des en-têtes LUKS a échoué.\n"
+#~ msgid "Failed to refresh helper devices."
+#~ msgstr "Échec lors du rafraichissement des périphériques de support."
 
-#: src/cryptsetup_reencrypt.c:634
-#, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Impossible de rétablir l'en-tête LUKS sur le périphérique %s.\n"
+#~ msgid "Failed to create reencryption backup segments."
+#~ msgstr "Échec lors de la création des segments de sauvegarde du rechiffrement."
 
-#: src/cryptsetup_reencrypt.c:636
-#, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "En-tête LUKS rétabli sur le périphérique %s.\n"
+#~ msgid "Failed to set online-reencryption requirement."
+#~ msgstr "Impossible de définir les exigences du rechiffrement en ligne."
 
-#: src/cryptsetup_reencrypt.c:669
-#, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Progression: %5.1f%%, ETA %02llu:%02llu, %4llu MiB écrits, vitesse %5.1f MIB/"
-"s%s"
+#~ msgid "Failed to hash sector at offset %zu."
+#~ msgstr "Échec du hachage du secteur à l'offset %zu."
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Impossible de se déplacer au décalage du périphérique.\n"
+#~ msgid "Failed to read sector hash."
+#~ msgstr "Erreur de lecture du hachage du secteur."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Impossible d'ouvrir le fichier temporaire de l'en-tête LUKS.\n"
+#~ msgid "Error: Calculated reencryption offset %<PRIu64> is beyond device size %<PRIu64>."
+#~ msgstr "Erreur: Le décalage de rechiffrement calculé %<PRIu64> est au delà de la taille du périphérique %<PRIu64>"
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "Impossible d'obtenir la taille du périphérique.\n"
+#~ msgid "Device is not in clean reencryption state."
+#~ msgstr "Le périphérique n'est pas dans un état de rechiffrement propre."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Interrompu par un signal.\n"
+#~ msgid "Failed to calculate new segments."
+#~ msgstr "Échec lors du calcul des nouveaux segments."
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "Erreur E/S pendant le re-chiffrement.\n"
+#~ msgid "Failed to assign pre reenc segments."
+#~ msgstr "Échec de l'affectation des segments pre reenc."
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"Le fichier de clé peut uniquement être utilisé avec --key-slot ou avec "
-"exactement un seul emplacement de clé actif.\n"
+#~ msgid "Failed finalize hotzone resilience, retval = %d"
+#~ msgstr "Échec de finalisation de la résilience de la zone chaude, retval = %d"
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
-#, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Entrez la phrase secrète pour l'emplacement de clé %u : "
+#~ msgid "Failed to write data."
+#~ msgstr "Erreur lors de l'écriture des données."
 
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Impossible d'ouvrir le journal de re-chiffrement.\n"
+#~ msgid "Failed to update metadata or reassign device segments."
+#~ msgstr "Échec de la mise à jour des métadonnées ou de la réaffectation des segments du périphérique."
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "Reencryption block size"
-msgstr "Taille de bloc de re-chiffrement"
+#~ msgid "Failed to reload %s device."
+#~ msgstr "Erreur au rechargement du périphérique %s."
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "MiB"
-msgstr "MiB"
+#~ msgid "Failed to erase backup segments"
+#~ msgstr "Échec lors de l'effacement des segments de sauvegarde."
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "Ne change pas la clé, pas de re-chiffrement de la zone de donnée."
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Les options de performance dmcrypt demandées ne sont pas supportées."
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr "Utilise direct-io pour accéder aux périphériques."
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Impossible de formater le périphérique %s qui est déjà en cours d'utilisation."
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr "Utiliser fsync après chaque bloc."
+#~ msgid "Key slot %d is not used."
+#~ msgstr "L'emplacement de clé %d n'est pas utilisé."
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Met le journal à jour après chaque bloc."
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Emplacement de clé %d sélectionné pour suppression."
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr "Utiliser uniquement cet emplacement (les autres seront désactivés)."
+#~ msgid "open device as mapping <name>"
+#~ msgstr "ouvrir un périphérique avec <nom> comme « mapping »"
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
-"Réduire la taille des données du périphérique (déplace le décalage des "
-"données). DANGEREUX !"
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "fermeture du périphérique (désactive et supprime le « mapping »)"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Utilise uniquement la taille demandée du périphérique (ignore le reste du "
-"périphérique). DANGEREUX !"
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Impossible de définir les paramètres PBKDF."
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Créer un nouvel en-tête sur le périphérique non chiffré."
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Impossible de se déplacer au décalage du périphérique.\n"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
-msgstr ""
-"Déchiffre le périphérique de manière permanente (supprime le chiffrement)"
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "Le périphérique %s est trop petit (LUKS2 a besoin d'au moins %<PRIu64> octets)."
 
-#: src/cryptsetup_reencrypt.c:1298
-msgid "[OPTION...] <device>"
-msgstr "[OPTION...] <périph>"
+#~ msgid "Replaced with key slot %d."
+#~ msgstr "Remplacé par l'emplacement de clé %d."
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
-"ATTENTION : ce code est expérimental. Il peut complètement détruire vos "
-"données.\n"
+#~ msgid "Missing LUKS target type, option --type is required."
+#~ msgstr "Type de cible LUKS manquant, l'option --type est requise."
 
-#: src/cryptsetup_reencrypt.c:1313
-#, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "Le re-chiffrement va changer : clé de volume%s%s%s%s.\n"
+#~ msgid "Missing --token option specifying token for removal."
+#~ msgstr "Il manque l'option --token pour spécifier le jeton à retirer."
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
-msgstr ", change hachage en "
+#~ msgid "Add or remove keyring token"
+#~ msgstr "Ajoute ou retire le jeton du porte-clé"
 
-#: src/cryptsetup_reencrypt.c:1315
-msgid ", set cipher to "
-msgstr ", change chiffrement en "
+#~ msgid "Activated keyslot %i."
+#~ msgstr "Emplacement de clé activé %i."
 
-#: src/cryptsetup_reencrypt.c:1320
-msgid "Argument required."
-msgstr "Argument requis."
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "erreur d'allocation de mémoire dans action_luksFormat"
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Seules les valeurs entre 1 MiB et 64 MiB sont permises pour la taille des "
-"blocs de re-chiffrement."
+#~ msgid "Key slot is invalid.\n"
+#~ msgstr "Emplacement de clé non valide.\n"
 
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "La taille de périphérique spécifiée est invalide."
+#~ msgid "Using default pbkdf parameters for new LUKS2 header.\n"
+#~ msgstr "Utilisation des paramètres pbkdf par défaut pour le nouvel en-tête LUKS2.\n"
 
-#: src/cryptsetup_reencrypt.c:1363
-msgid "Maximum device reduce size is 64 MiB."
-msgstr "La taille maximum réduite pour le périphérique est 64 MiB."
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Trop de niveaux dans l'arborescence du volume verity.\n"
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "La taille réduite doit être un multiple d'un secteur de 512 octets."
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "La clé %d n'est pas active. Impossible de l'effacer.\n"
 
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr "L'option --new doit être utilisée avec --reduce-device-size."
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<nom> <périph_données> <périph_hachage> <hachage_racine>"
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
-"L'option --keep-key ne peut être utilisée que avec --hash ou --iter-time."
+#~ msgid "create active device"
+#~ msgstr "créer le périphérique actif"
 
-#: src/cryptsetup_reencrypt.c:1378
-msgid "Option --new cannot be used together with --decrypt."
-msgstr "L'option --new ne peut pas être utilisée avec --decrypt."
+#~ msgid "remove (deactivate) device"
+#~ msgstr "supprime (désactive) le périphérique"
 
-#: src/cryptsetup_reencrypt.c:1382
-msgid "Option --decrypt is incompatible with specified parameters."
-msgstr "L'option --decrypt est incompatible avec les paramètres spécifiés."
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Progression: %5.1f%%, ETA %02llu:%02llu, %4llu MiB écrits, vitesse %5.1f MIB/s%s"
 
-#: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Erreur de lecture de la réponse depuis le terminal.\n"
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Impossible de trouver un périphérique loopback libre.\n"
 
-#: src/utils_tools.c:173
-msgid "Command successful.\n"
-msgstr "Opération réussie.\n"
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Impossible d'ouvrir le périphérique %s\n"
 
-#: src/utils_tools.c:191
-#, c-format
-msgid "Command failed with code %i"
-msgstr "L'opération a échoué avec le code %i"
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Le UUID passé ne peut pas être utilisé à moins qu'un déchiffrement ne soit en cours.\n"
 
-#: src/utils_password.c:42
-#, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Ne peut vérifier la qualité du mot de passe : %s\n"
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "Marque le périphérique LUKS %s comme utilisable.\n"
 
-#: src/utils_password.c:50
-#, c-format
-msgid ""
-"Password quality check failed:\n"
-" %s\n"
-msgstr ""
-"Échec de la vérification de la qualité du mot de passe :\n"
-" %s\n"
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "ATTENTION : ce code est expérimental. Il peut complètement détruire vos données.\n"
 
 #~ msgid "FIPS checksum verification failed.\n"
 #~ msgstr "La vérification de la somme de contrôle FIPS a échoué.\n"
 
-#~ msgid ""
-#~ "WARNING: device %s is a partition, for TCRYPT system encryption you "
-#~ "usually need to use whole block device path.\n"
-#~ msgstr ""
-#~ "ATTENTION : le périphérique %s est une partition. Pour le chiffrement de "
-#~ "système TCRYPT, vous avez généralement besoin du chemin d'un périphérique "
-#~ "bloc entier.\n"
+#~ msgid "WARNING: device %s is a partition, for TCRYPT system encryption you usually need to use whole block device path.\n"
+#~ msgstr "ATTENTION : le périphérique %s est une partition. Pour le chiffrement de système TCRYPT, vous avez généralement besoin du chemin d'un périphérique bloc entier.\n"
 
 #~ msgid "Kernel doesn't support plain64 IV.\n"
 #~ msgstr "Le noyau ne supporte pas plain64 IV.\n"
@@ -1966,19 +4088,9 @@ msgstr ""
 #~ msgid "Enter any LUKS passphrase: "
 #~ msgstr "Entrez n'importe quelle phrase secrète LUKS : "
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr ""
-#~ "Impossible d'obtenir le répertoire du gestionnaire « device mapper »."
-
 #~ msgid "Backup file %s doesn't exist.\n"
 #~ msgstr "Le fichier de sauvegarde %s n'existe pas.\n"
 
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Impossible d'ouvrir le fichier %s.\n"
-
-#~ msgid "<name> <device>"
-#~ msgstr "<nom> <périphérique>"
-
 #~ msgid "create device"
 #~ msgstr "créer un périphérique"
 
@@ -1994,19 +4106,9 @@ msgstr ""
 #~ msgid "remove loop-AES mapping"
 #~ msgstr "enlève une association loop-AES"
 
-#~ msgid ""
-#~ "Option --allow-discards is allowed only for luksOpen, loopaesOpen and "
-#~ "create operation.\n"
-#~ msgstr ""
-#~ "L'option --allow-discards est utilisable uniquement avec les commandes "
-#~ "luksOpen, loopaesOpen et create.\n"
-
 #~ msgid "Key slot %d verified.\n"
 #~ msgstr "L'emplacement de clé %d a été vérifié.\n"
 
-#~ msgid "Invalid key size %d.\n"
-#~ msgstr "%d n'est pas une taille de clé valide.\n"
-
 #~ msgid "Cannot open device %s for %s%s access.\n"
 #~ msgstr "Impossible d'ouvrir le périphérique %s pour un accès %s%s.\n"
 
@@ -2020,9 +4122,7 @@ msgstr ""
 #~ msgstr "en lecture seule"
 
 #~ msgid "WARNING!!! Possibly insecure memory. Are you root?\n"
-#~ msgstr ""
-#~ "ATTENTION !!! La mémoire n'est peut-être pas sécurisée. Êtes-vous super-"
-#~ "utilisateur ?\n"
+#~ msgstr "ATTENTION !!! La mémoire n'est peut-être pas sécurisée. Êtes-vous super-utilisateur ?\n"
 
 #~ msgid "Negative keyfile size not permitted.\n"
 #~ msgstr "Taille négative de fichier de clé non autorisée.\n"
@@ -2034,30 +4134,16 @@ msgstr ""
 #~ msgstr "Le mode \"bloc\" XTS est disponible depuis le noyau 2.6.24.\n"
 
 #~ msgid "Key size in LRW mode must be 256 or 512 bits.\n"
-#~ msgstr ""
-#~ "La taille de la clé en mode LRW doit être un multiple de 256 ou 512 "
-#~ "bits.\n"
+#~ msgstr "La taille de la clé en mode LRW doit être un multiple de 256 ou 512 bits.\n"
 
 #~ msgid "Block mode LRW is available since kernel 2.6.20.\n"
 #~ msgstr "Le mode \"bloc\" LRW est disponible depuis le noyau 2.6.20.\n"
 
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Échec lors de l'écriture à l'emplacement de stockage de la clé.\n"
-
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr ""
-#~ "Échec lors de la lecture depuis l'emplacement de stockage de la clé.\n"
-
-#~ msgid ""
-#~ "Warning: exhausting read requested, but key file is not a regular file, "
-#~ "function might never return.\n"
-#~ msgstr ""
-#~ "Attention : requête de lecture, mais le fichier de clef n'est pas "
-#~ "régulier, la procédure peut rester bloquée.\n"
+#~ msgid "Warning: exhausting read requested, but key file is not a regular file, function might never return.\n"
+#~ msgstr "Attention : requête de lecture, mais le fichier de clef n'est pas régulier, la procédure peut rester bloquée.\n"
 
 #~ msgid "Cannot find compatible device-mapper kernel modules.\n"
-#~ msgstr ""
-#~ "Impossible de trouver des modules noyau compatibles avec device-mapper.\n"
+#~ msgstr "Impossible de trouver des modules noyau compatibles avec device-mapper.\n"
 
 #~ msgid "Cannot open device: %s\n"
 #~ msgstr "Impossible d'ouvrir le périphérique : %s\n"
@@ -2075,15 +4161,11 @@ msgstr ""
 #~ msgstr "modifier le périphérique actif - OBSOLÈTE - voir la page de man"
 
 #~ msgid ""
-#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case "
-#~ "you really need this functionality.\n"
-#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, "
-#~ "hit Ctrl-C now.\n"
+#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case you really need this functionality.\n"
+#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, hit Ctrl-C now.\n"
 #~ msgstr ""
-#~ "L'action « reload » est obsolète. Merci d'utiliser « dmsetup reload » si "
-#~ "vous avez vraiment besoin de cette fonctionnalité.\n"
-#~ "ATTENTION : n'utilisez pas « reload » sur des périphériques LUKS. Si "
-#~ "c'est le cas, tapez Ctrl-C.\n"
+#~ "L'action « reload » est obsolète. Merci d'utiliser « dmsetup reload » si vous avez vraiment besoin de cette fonctionnalité.\n"
+#~ "ATTENTION : n'utilisez pas « reload » sur des périphériques LUKS. Si c'est le cas, tapez Ctrl-C.\n"
 
 #~ msgid "Obsolete option --non-exclusive is ignored.\n"
 #~ msgstr "L'option obsolète --non-exclusive est ignorée.\n"
@@ -2093,9 +4175,3 @@ msgstr ""
 
 #~ msgid "(Obsoleted, see man page.)"
 #~ msgstr "(Obsolète, voir la page de man)."
-
-#~ msgid "%s is not LUKS device.\n"
-#~ msgstr "%s n'est pas un périphérique LUKS.\n"
-
-#~ msgid "%s is not LUKS device."
-#~ msgstr "%s n'est pas un périphérique LUKS."
index b06d339..474e367 100644 (file)
Binary files a/po/id.gmo and b/po/id.gmo differ
index 54ed975..b1b0a7b 100644 (file)
--- a/po/id.po
+++ b/po/id.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: cryptsetup 1.1.0-rc4\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
 "PO-Revision-Date: 2010-01-27 07:30+0700\n"
 "Last-Translator: Arif E. Nugroho <arif_endro@yahoo.com>\n"
 "Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n"
@@ -15,531 +15,897 @@ msgstr ""
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 
-#: lib/libdevmapper.c:252
+#: lib/libdevmapper.c:399
 #, fuzzy
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Tidak dapat menginisialisasi pemeta-perangkat. Apakah kernel modul dm_mod telah dimuat?\n"
+
+#: lib/libdevmapper.c:402
+#, fuzzy
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Tidak dapat menginisialisasi pemeta-perangkat. Apakah kernel modul dm_mod telah dimuat?\n"
+
+#: lib/libdevmapper.c:1131
+#, fuzzy
+msgid "Requested deferred flag is not supported."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
+
+#: lib/libdevmapper.c:1198
+#, fuzzy, c-format
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID untuk perangkat %s telah terpotong.\n"
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
 msgstr ""
-"Tidak dapat menginisialisasi pemeta-perangkat. Apakah kernel modul dm_mod "
-"telah dimuat?\n"
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+#, fuzzy
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
 msgstr ""
-"Tidak dapat menginisialisasi pemeta-perangkat. Apakah kernel modul dm_mod "
-"telah dimuat?\n"
 
-#: lib/libdevmapper.c:550
-#, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "DM-UUID untuk perangkat %s telah terpotong.\n"
+#: lib/libdevmapper.c:1634
+#, fuzzy
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
 
-#: lib/libdevmapper.c:698
+#: lib/libdevmapper.c:1638
 #, fuzzy
-msgid "Requested dmcrypt performance options are not supported.\n"
+msgid "Requested data integrity options are not supported."
 msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1640
+#, fuzzy
+msgid "Requested sector_size option is not supported."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr ""
+
+#: lib/libdevmapper.c:1653
+#, fuzzy
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr ""
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr ""
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr ""
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
 msgstr ""
 
-#: lib/random.c:206
+#: lib/random.c:208
 #, fuzzy
-msgid "Unknown RNG quality requested.\n"
+msgid "Unknown RNG quality requested."
 msgstr "Tipe perangkat sandi %s yang diminta tidak diketahui.\n"
 
-#: lib/random.c:211
-#, fuzzy, c-format
-msgid "Error %d reading from RNG: %s\n"
+#: lib/random.c:213
+#, fuzzy
+msgid "Error reading from RNG."
 msgstr "Kesalahan dalam pembacaan kata sandi.\n"
 
-#: lib/setup.c:200
+#: lib/setup.c:229
 #, fuzzy
-msgid "Cannot initialize crypto RNG backend.\n"
+msgid "Cannot initialize crypto RNG backend."
 msgstr "Tidak dapat menginisialisasi backend crypto.\n"
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
+#: lib/setup.c:235
+#, fuzzy
+msgid "Cannot initialize crypto backend."
 msgstr "Tidak dapat menginisialisasi backend crypto.\n"
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
 #, fuzzy, c-format
-msgid "Hash algorithm %s not supported.\n"
+msgid "Hash algorithm %s not supported."
 msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
 #, fuzzy, c-format
-msgid "Key processing error (using hash %s).\n"
+msgid "Key processing error (using hash %s)."
 msgstr "Terjadi kesalahan dalam pengolahan kunci.\n"
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
 msgstr ""
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
+#: lib/setup.c:341 lib/setup.c:3050
+#, fuzzy
+msgid "This operation is supported only for LUKS device."
+msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
+
+#: lib/setup.c:368
+#, fuzzy
+msgid "This operation is supported only for LUKS2 device."
 msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+#, fuzzy
+msgid "All key slots full."
 msgstr "Semua slot kunci telah penuh.\n"
 
-#: lib/setup.c:327
-#, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
+#: lib/setup.c:434
+#, fuzzy, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
 msgstr "Slot kunci %d tidak valid, mohon pilih diantara 0 dan %d.\n"
 
-#: lib/setup.c:333
-#, c-format
-msgid "Key slot %d is full, please select another one.\n"
+#: lib/setup.c:440
+#, fuzzy, c-format
+msgid "Key slot %d is full, please select another one."
 msgstr "Slot kunci %d penuh, mohon pilih yang lain.\n"
 
-#: lib/setup.c:472
-#, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Masukan kata sandi untuk %s: "
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr ""
 
-#: lib/setup.c:653
+#: lib/setup.c:624
 #, fuzzy, c-format
-msgid "Header detected but device %s is too small.\n"
+msgid "Header detected but device %s is too small."
 msgstr "Header LUKS terdeteksi tetapi perangkat %s terlalu kecil.\n"
 
-#: lib/setup.c:669 lib/setup.c:1420
+#: lib/setup.c:661
 #, fuzzy
-msgid "This operation is not supported for this device type.\n"
+msgid "This operation is not supported for this device type."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
-#, c-format
-msgid "Device %s is not active.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr ""
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, fuzzy, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "versi LUKS %d tidak didukung.\n"
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+#, fuzzy
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, fuzzy, c-format
+msgid "Device %s is not active."
 msgstr "Perangkat %s tidak aktif.\n"
 
-#: lib/setup.c:925
+#: lib/setup.c:1444
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
+msgid "Underlying device for crypt device %s disappeared."
 msgstr ""
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
+#: lib/setup.c:1524
+#, fuzzy
+msgid "Invalid plain crypt parameters."
 msgstr "Parameter crypt tidak valid.\n"
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+#, fuzzy
+msgid "Invalid key size."
 msgstr "Ukuran kunci tidak valid.\n"
 
-#: lib/setup.c:1004 lib/setup.c:1124
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
 #, fuzzy
-msgid "UUID is not supported for this crypt type.\n"
+msgid "UUID is not supported for this crypt type."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr ""
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr ""
+
+#: lib/setup.c:1608 lib/setup.c:1727
+#, fuzzy
+msgid "Can't format LUKS without device."
 msgstr "Tidak dapat memformat LUKS tanpat perangkat.\n"
 
-#: lib/setup.c:1089
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr ""
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr ""
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
 #, fuzzy, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Tidak dapat membuka perangkat %s untuk akses %s%s.\n"
+msgid "Cannot wipe header on device %s."
+msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr ""
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr ""
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr ""
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr ""
 
-#: lib/setup.c:1092
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, fuzzy, c-format
+msgid "Device %s is too small."
+msgstr "Perangkat %s terlalu kecil.\n"
+
+#: lib/setup.c:1893 lib/setup.c:1919
 #, fuzzy, c-format
-msgid "Cannot format device %s, permission denied.\n"
+msgid "Cannot format device %s in use."
 msgstr "Tidak dapat membaca perangkat %s.\n"
 
-#: lib/setup.c:1096
+#: lib/setup.c:1896 lib/setup.c:1922
 #, fuzzy, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
+msgid "Cannot format device %s, permission denied."
+msgstr "Tidak dapat membuka perangkat %s untuk akses %s%s.\n"
 
-#: lib/setup.c:1114
+#: lib/setup.c:1908 lib/setup.c:2229
+#, fuzzy, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Tidak dapat mendapatkan informasi mengenai perangkat %s.\n"
+
+#: lib/setup.c:1926
+#, fuzzy, c-format
+msgid "Cannot format device %s."
+msgstr "Tidak dapat membaca perangkat %s.\n"
+
+#: lib/setup.c:1944
 #, fuzzy
-msgid "Can't format LOOPAES without device.\n"
+msgid "Can't format LOOPAES without device."
 msgstr "Tidak dapat memformat LUKS tanpat perangkat.\n"
 
-#: lib/setup.c:1152
+#: lib/setup.c:1989
 #, fuzzy
-msgid "Can't format VERITY without device.\n"
+msgid "Can't format VERITY without device."
 msgstr "Tidak dapat memformat LUKS tanpat perangkat.\n"
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
-#, fuzzy, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "versi LUKS %d tidak didukung.\n"
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr ""
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr ""
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr ""
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr ""
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
 msgstr ""
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
 msgstr ""
 
-#: lib/setup.c:1285
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr ""
+
+#: lib/setup.c:2208
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
+
+#: lib/setup.c:2286
+#, fuzzy, c-format
+msgid "Unknown crypt device type %s requested."
 msgstr "Tipe perangkat sandi %s yang diminta tidak diketahui.\n"
 
-#: lib/setup.c:1435
-msgid "Do you really want to change UUID of device?"
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, fuzzy, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, fuzzy, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
 msgstr ""
 
-#: lib/setup.c:1545
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "Tidak dapat membaca perangkat %s.\n"
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, fuzzy, c-format
+msgid "Failed to suspend device %s."
+msgstr "Gagal membuka berkas kunci %s.\n"
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "Gagal membuka berkas kunci %s.\n"
+
+#: lib/setup.c:2732
 #, c-format
-msgid "Volume %s is not active.\n"
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr ""
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Gagal untuk memperoleh direktori pemeta-perangkat."
+
+#: lib/setup.c:2809
+#, fuzzy
+msgid "Cannot resize loop device."
+msgstr "Tidak dapat membaca perangkat %s.\n"
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr ""
+
+#: lib/setup.c:2958
+#, fuzzy
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Berkas cadangan tidak berisi header LUKS yang valid.\n"
+
+#: lib/setup.c:3058
+#, fuzzy, c-format
+msgid "Volume %s is not active."
 msgstr "Volume %s tidak aktif.\n"
 
-#: lib/setup.c:1556
-#, c-format
-msgid "Volume %s is already suspended.\n"
+#: lib/setup.c:3069
+#, fuzzy, c-format
+msgid "Volume %s is already suspended."
 msgstr "Volume %s telah disuspend.\n"
 
-#: lib/setup.c:1563
+#: lib/setup.c:3082
 #, fuzzy, c-format
-msgid "Suspend is not supported for device %s.\n"
+msgid "Suspend is not supported for device %s."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/setup.c:1565
+#: lib/setup.c:3084
 #, fuzzy, c-format
-msgid "Error during suspending device %s.\n"
+msgid "Error during suspending device %s."
 msgstr "Error selama memperbarui header LUKS di perangkat %s.\n"
 
-#: lib/setup.c:1591 lib/setup.c:1638
-#, c-format
-msgid "Volume %s is not suspended.\n"
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, fuzzy, c-format
+msgid "Volume %s is not suspended."
 msgstr "Volume %s tidak disuspend.\n"
 
-#: lib/setup.c:1605
+#: lib/setup.c:3146
 #, fuzzy, c-format
-msgid "Resume is not supported for device %s.\n"
+msgid "Resume is not supported for device %s."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, fuzzy, c-format
-msgid "Error during resuming device %s.\n"
+msgid "Error during resuming device %s."
 msgstr "Error selama memperbarui header LUKS di perangkat %s.\n"
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Masukan kata sandi: "
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+#, fuzzy
+msgid "Volume key does not match the volume."
+msgstr "Kunci volume tidak cocok dengan volume.\n"
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Tidak dapat menambahkan slot kunci, seluruh slot tidak aktif dan tidak ada "
-"volume kunci yang disediakan.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+#, fuzzy
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Tidak dapat menambahkan slot kunci, seluruh slot tidak aktif dan tidak ada volume kunci yang disediakan.\n"
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Masukan kata sandi: "
+#: lib/setup.c:3483
+#, fuzzy
+msgid "Failed to swap new key slot."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Masukan kasa sandi baru untuk slot kunci: "
+#: lib/setup.c:3669
+#, fuzzy, c-format
+msgid "Key slot %d is invalid."
+msgstr "Slot kunci %d tidak valid.\n"
 
-#: lib/setup.c:1798
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
 #, fuzzy, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Slot kunci %d tidak terkunci.\n"
+msgid "Keyslot %d is not active."
+msgstr "Slot kunci %d tidak digunakan.\n"
 
-#: lib/setup.c:1801
-#, c-format
-msgid "Replaced with key slot %d.\n"
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr ""
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
 msgstr ""
 
-#: lib/setup.c:1806
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
 #, fuzzy
-msgid "Failed to swap new key slot.\n"
-msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+msgid "Failed to get reencryption lock."
+msgstr "Besar dari kunci enkripsi"
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Kunci volume tidak cocok dengan volume.\n"
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr ""
 
-#: lib/setup.c:1961
-#, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Slot kunci %d tidak valid.\n"
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr ""
 
-#: lib/setup.c:1966
+#: lib/setup.c:4171
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Slot kunci %d tidak digunakan.\n"
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr ""
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
-#, c-format
-msgid "Device %s already exists.\n"
+#: lib/setup.c:4174
+#, fuzzy, c-format
+msgid "Device %s already exists."
 msgstr "Perangkat %s telah ada.\n"
 
-#: lib/setup.c:2171
+#: lib/setup.c:4296
 #, fuzzy
-msgid "Incorrect volume key specified for plain device.\n"
+msgid "Incorrect volume key specified for plain device."
 msgstr "Tidak dapat mendapatkan kunci volume untuk perangkat.\n"
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr ""
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr ""
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
 msgstr ""
 
-#: lib/setup.c:2227
+#: lib/setup.c:4438 lib/setup.c:5915
 #, fuzzy
-msgid "Device type is not properly initialised.\n"
-msgstr "Perangkat %s tidak aktif.\n"
+msgid "Failed to load key in kernel keyring."
+msgstr "Gagal membuka berkas kunci %s.\n"
 
-#: lib/setup.c:2259
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
 #, fuzzy, c-format
-msgid "Device %s is still in use.\n"
+msgid "Device %s is still in use."
 msgstr "Perangkat %s sibuk.\n"
 
-#: lib/setup.c:2268
-#, c-format
-msgid "Invalid device %s.\n"
+#: lib/setup.c:4516
+#, fuzzy, c-format
+msgid "Invalid device %s."
 msgstr "Perangkat %s tidak valid.\n"
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr ""
-
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
+#: lib/setup.c:4632
+#, fuzzy
+msgid "Volume key buffer too small."
 msgstr "Penyangga kunci volume terlalu kecil.\n"
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
+#: lib/setup.c:4640
+#, fuzzy
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Tidak dapat mendapatkan kunci volume untuk perangkat.\n"
+
+#: lib/setup.c:4657
+#, fuzzy
+msgid "Cannot retrieve root hash for verity device."
 msgstr "Tidak dapat mendapatkan kunci volume untuk perangkat.\n"
 
-#: lib/setup.c:2310
-#, c-format
-msgid "This operation is not supported for %s crypt device.\n"
+#: lib/setup.c:4659
+#, fuzzy, c-format
+msgid "This operation is not supported for %s crypt device."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/setup.c:2506
+#: lib/setup.c:4865
 #, fuzzy
-msgid "Dump operation is not supported for this device type.\n"
+msgid "Dump operation is not supported for this device type."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Tidak dapat mendapatkan prioritas proses.\n"
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr ""
 
-#: lib/utils.c:258
-#, fuzzy
-msgid "Cannot unlock memory.\n"
-msgstr "Tidak dapat membuka kunci memori."
+#: lib/setup.c:5475
+#, fuzzy, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Tidak dapat membuka perangkat %s untuk akses %s%s.\n"
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Kehabisan memori ketika membaca kata sandi.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr ""
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Kesalahan dalam pembacaan kata sandi dari terminal.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr ""
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Memverifikasi kata sandi: "
+#: lib/setup.c:5851
+#, fuzzy, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Gagal untuk mengakses perangkat penyimpan kunci sementara.\n"
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Kata sandi tidak cocok.\n"
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr ""
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, fuzzy, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Gagal untuk membaca dari penyimpanan kunci.\n"
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
 msgstr ""
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
+#: lib/utils.c:80
+#, fuzzy
+msgid "Cannot get process priority."
+msgstr "Tidak dapat mendapatkan prioritas proses.\n"
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Tidak dapat membuka kunci memori."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
 #, fuzzy
-msgid "Failed to open key file.\n"
+msgid "Failed to open key file."
 msgstr "Gagal membuka berkas kunci %s.\n"
 
-#: lib/utils_crypt.c:378
+#: lib/utils.c:173
+#, fuzzy
+msgid "Cannot read keyfile from a terminal."
+msgstr "Tidak dapat membaca %d bytes dari berkas kunci %s.\n"
+
+#: lib/utils.c:190
 #, fuzzy
-msgid "Failed to stat key file.\n"
+msgid "Failed to stat key file."
 msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
 msgstr ""
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+#, fuzzy
+msgid "Out of memory while reading passphrase."
+msgstr "Kehabisan memori ketika membaca kata sandi.\n"
+
+#: lib/utils.c:248
+#, fuzzy
+msgid "Error reading passphrase."
 msgstr "Kesalahan dalam pembacaan kata sandi.\n"
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
+#: lib/utils.c:265
+msgid "Nothing to read on input."
 msgstr ""
 
-#: lib/utils_crypt.c:447
-#, fuzzy
-msgid "Cannot read requested amount of data.\n"
-msgstr "Tidak dapat membaca berkas cadangan header %s.\n"
-
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
-#, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Perangkat %s tidak ada atau akses ditolak.\n"
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr ""
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
 msgstr ""
 
-#: lib/utils_device.c:433
-#, fuzzy
-msgid "Cannot find a free loopback device.\n"
-msgstr "Tidak dapat membaca perangkat %s.\n"
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, fuzzy, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Perangkat %s tidak ada atau akses ditolak.\n"
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
+#: lib/utils_device.c:197
+#, fuzzy, c-format
+msgid "Device %s is not compatible."
+msgstr "Perangkat %s tidak aktif.\n"
 
-#: lib/utils_device.c:484
+#: lib/utils_device.c:642
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
 msgstr ""
 
-#: lib/utils_device.c:488
+#: lib/utils_device.c:723
 #, c-format
-msgid "Cannot get info about device %s.\n"
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr ""
+
+#: lib/utils_device.c:727
+#, fuzzy, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Tidak dapat membuka perangkat %s untuk akses %s%s.\n"
+
+#: lib/utils_device.c:730
+#, fuzzy, c-format
+msgid "Cannot get info about device %s."
 msgstr "Tidak dapat mendapatkan informasi mengenai perangkat %s.\n"
 
-#: lib/utils_device.c:494
-#, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
 msgstr ""
 
-#: lib/utils_device.c:502
-#, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Perangkat %s memiliki ukuran nol.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr ""
 
-#: lib/utils_device.c:513
+#: lib/utils_device.c:809
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Perangkat %s terlalu kecil.\n"
+msgid "Requested offset is beyond real size of device %s."
+msgstr ""
 
-#: lib/luks1/keyencryption.c:37
+#: lib/utils_device.c:817
 #, fuzzy, c-format
-msgid ""
-"Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
-msgstr ""
-"Gagal untuk mengkonfigurasi pemetaan kunci dm-crypt untuk perangkat %s.\n"
-"Periksa apakah kernel mendukung cipher %s (periksa syslog untuk informasi "
-"lebih lanjut).\n"
-"%s"
+msgid "Device %s has zero size."
+msgstr "Perangkat %s memiliki ukuran nol.\n"
 
-#: lib/luks1/keyencryption.c:42
-#, fuzzy
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "Kunci harus kelipatan dari 8 bit"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr ""
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr ""
+
+#: lib/utils_pbkdf.c:111
+#, fuzzy, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
+
+#: lib/utils_pbkdf.c:122
+#, fuzzy
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr ""
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr ""
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr ""
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr ""
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr ""
+
+#: lib/utils_benchmark.c:191
+#, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Pilihan PBKDF2 tidak kompatibel (menggunakan algoritma hash %s)."
+
+#: lib/utils_benchmark.c:211
+#, fuzzy
+msgid "Not compatible PBKDF options."
+msgstr "Pilihan PBKDF2 tidak kompatibel (menggunakan algoritma hash %s)."
+
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr ""
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr ""
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr ""
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+#, fuzzy
+msgid "Cannot seek to device offset."
+msgstr "Tidak dapat membaca perangkat %s.\n"
+
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:39
+#, fuzzy, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"Gagal untuk mengkonfigurasi pemetaan kunci dm-crypt untuk perangkat %s.\n"
+"Periksa apakah kernel mendukung cipher %s (periksa syslog untuk informasi lebih lanjut).\n"
+"%s"
+
+#: lib/luks1/keyencryption.c:44
+#, fuzzy
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Kunci harus kelipatan dari 8 bit"
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
 #, fuzzy, c-format
-msgid "Cannot write to device %s, permission denied.\n"
+msgid "Cannot write to device %s, permission denied."
 msgstr "Tidak dapat menghapus perangkat %s.\n"
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
+#: lib/luks1/keyencryption.c:120
+#, fuzzy
+msgid "Failed to open temporary keystore device."
 msgstr "Gagal untuk membuka perangkat penyimpan kunci sementara.\n"
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
+#: lib/luks1/keyencryption.c:127
+#, fuzzy
+msgid "Failed to access temporary keystore device."
 msgstr "Gagal untuk mengakses perangkat penyimpan kunci sementara.\n"
 
-#: lib/luks1/keyencryption.c:191
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
 #, fuzzy
-msgid "IO error while encrypting keyslot.\n"
+msgid "IO error while encrypting keyslot."
 msgstr "Besar dari kunci enkripsi"
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, fuzzy, c-format
+msgid "Cannot open device %s."
+msgstr "Tidak dapat membuka perangkat %s.\n"
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
 msgstr ""
 
-#: lib/luks1/keymanage.c:90
+#: lib/luks1/keymanage.c:110
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
 msgstr ""
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, fuzzy, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "Slot kunci %d tidak valid.\n"
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, fuzzy, c-format
-msgid "Device %s is not a valid LUKS device.\n"
+msgid "Device %s is not a valid LUKS device."
 msgstr "Perangkat %s bukan perangkat LUKS.\n"
 
-#: lib/luks1/keymanage.c:198
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, fuzzy, c-format
-msgid "Requested header backup file %s already exists.\n"
+msgid "Requested header backup file %s already exists."
 msgstr "Berkas %s yang diminta telah ada.\n"
 
-#: lib/luks1/keymanage.c:200
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, fuzzy, c-format
-msgid "Cannot create header backup file %s.\n"
+msgid "Cannot create header backup file %s."
 msgstr "Tidak dapat membaca berkas cadangan header %s.\n"
 
-#: lib/luks1/keymanage.c:205
-#, c-format
-msgid "Cannot write header backup file %s.\n"
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, fuzzy, c-format
+msgid "Cannot write header backup file %s."
 msgstr "Tidak dapat menulis berkas cadangan header %s.\n"
 
-#: lib/luks1/keymanage.c:239
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
 #, fuzzy
-msgid "Backup file doesn't contain valid LUKS header.\n"
+msgid "Backup file does not contain valid LUKS header."
 msgstr "Berkas cadangan tidak berisi header LUKS yang valid.\n"
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
-#, c-format
-msgid "Cannot open header backup file %s.\n"
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, fuzzy, c-format
+msgid "Cannot open header backup file %s."
 msgstr "Tidak dapat membuka berkas cadangan header %s.\n"
 
-#: lib/luks1/keymanage.c:258
-#, c-format
-msgid "Cannot read header backup file %s.\n"
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, fuzzy, c-format
+msgid "Cannot read header backup file %s."
 msgstr "Tidak dapat membaca berkas cadangan header %s.\n"
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Data offset atau ukuran kunci berbeda di perangkat dan cadangan, "
-"pengembalian gagal.\n"
+#: lib/luks1/keymanage.c:317
+#, fuzzy
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Data offset atau ukuran kunci berbeda di perangkat dan cadangan, pengembalian gagal.\n"
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Perangkat %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"tidak berisi header LUKS. Mengganti header dapat menghancurkan data di "
-"perangkat itu."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "tidak berisi header LUKS. Mengganti header dapat menghancurkan data di perangkat itu."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"telah berisi header LUKS. Mengganti header dapat mengganti slot kunci yang "
-"telah ada."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "telah berisi header LUKS. Mengganti header dapat mengganti slot kunci yang telah ada."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
@@ -547,145 +913,113 @@ msgstr ""
 "\n"
 "PERINGATAN: header perangkat ril memiliki UUID berbeda dengan cadangan!"
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Tidak dapat membuka perangkat %s.\n"
-
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
 msgstr ""
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
-
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
 msgstr ""
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
 msgstr ""
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
 msgstr ""
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
 msgstr ""
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
+msgid "Keyslot %i: bogus partition signature."
 msgstr ""
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:431
 #, fuzzy, c-format
-msgid "Keyslot %i: salt wiped.\n"
+msgid "Keyslot %i: salt wiped."
 msgstr "Slot kunci %d tidak valid.\n"
 
-#: lib/luks1/keymanage.c:396
-#, fuzzy
-msgid "Writing LUKS header to disk.\n"
-msgstr "Error selama memperbarui header LUKS di perangkat %s.\n"
-
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "versi LUKS %d tidak didukung.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr ""
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr ""
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, fuzzy, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "Slot kunci %d tidak valid.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Hash %s LUKS yang diminta tidak didukung.\n"
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
 msgstr ""
 
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
+#: lib/luks1/keymanage.c:660
+#, fuzzy, c-format
+msgid "Error during update of LUKS header on device %s."
 msgstr "Error selama memperbarui header LUKS di perangkat %s.\n"
 
-#: lib/luks1/keymanage.c:603
-#, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Error membaca-kembali header LUKS setelah memperbarui di perangkat %s.\n"
+#: lib/luks1/keymanage.c:668
+#, fuzzy, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Error membaca-kembali header LUKS setelah memperbarui di perangkat %s.\n"
 
-#: lib/luks1/keymanage.c:654
-#, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
 msgstr ""
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
 #, fuzzy
-msgid "Wrong LUKS UUID format provided.\n"
+msgid "Wrong LUKS UUID format provided."
 msgstr "Format UUID yang disediakan berbeda, membuat yang baru.\n"
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
+#: lib/luks1/keymanage.c:778
+#, fuzzy
+msgid "Cannot create LUKS header: reading random salt failed."
 msgstr "Tidak dapat membuat header LUKS: pembacaan garam acak gagal.\n"
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
+#: lib/luks1/keymanage.c:804
 #, fuzzy, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Pilihan PBKDF2 tidak kompatibel (menggunakan algoritma hash %s)."
-
-#: lib/luks1/keymanage.c:717
-#, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Tidak dapat membuat header LUKS: digest header gagal (menggunakan hash %s).\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Tidak dapat membuat header LUKS: digest header gagal (menggunakan hash %s).\n"
 
-#: lib/luks1/keymanage.c:782
-#, c-format
-msgid "Key slot %d active, purge first.\n"
+#: lib/luks1/keymanage.c:848
+#, fuzzy, c-format
+msgid "Key slot %d active, purge first."
 msgstr "Slot kunci %d aktif, hapus terlebih dahulu.\n"
 
-#: lib/luks1/keymanage.c:788
-#, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Slot kunci %d material terdapat terlalu sedikit stripes. Manipulasi header?\n"
-
-#: lib/luks1/keymanage.c:950
-#, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Slot kunci %d tidak terkunci.\n"
+#: lib/luks1/keymanage.c:854
+#, fuzzy, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Slot kunci %d material terdapat terlalu sedikit stripes. Manipulasi header?\n"
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Tidak ada kunci tersedia dengan kata sandi ini.\n"
+#: lib/luks1/keymanage.c:990
+#, fuzzy, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Tidak dapat membuka perangkat %s.\n"
 
-#: lib/luks1/keymanage.c:1003
-#, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
+#: lib/luks1/keymanage.c:1066
+#, fuzzy, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
 msgstr "Slot kunci %d tidak valid, mohon pilih slot kunci diantara 0 dan %d.\n"
 
-#: lib/luks1/keymanage.c:1021
-#, c-format
-msgid "Cannot wipe device %s.\n"
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, fuzzy, c-format
+msgid "Cannot wipe device %s."
 msgstr "Tidak dapat menghapus perangkat %s.\n"
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
 msgstr ""
 
 #: lib/loopaes/loopaes.c:147
@@ -693,1187 +1027,2950 @@ msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
 msgstr ""
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
+msgid "Incompatible loop-AES keyfile detected."
 msgstr ""
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, fuzzy, c-format
-msgid "Error reading keyfile %s.\n"
+msgid "Error reading keyfile %s."
 msgstr "Kesalahan dalam pembacaan kata sandi.\n"
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/tcrypt/tcrypt.c:554
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, fuzzy, c-format
-msgid "Activation is not supported for %d sector size.\n"
+msgid "Activation is not supported for %d sector size."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
 msgstr ""
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 #, fuzzy
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
 msgstr ""
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Gagal untuk membaca dari penyimpanan kunci.\n"
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "versi LUKS %d tidak didukung.\n"
+
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Gagal untuk membaca dari penyimpanan kunci.\n"
+
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:627
+#, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:921
+#, fuzzy
+msgid "This operation is not supported."
+msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
+
+#: lib/bitlk/bitlk.c:929
+#, fuzzy
+msgid "Wrong key size."
+msgstr "Ukuran kunci tidak valid.\n"
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr ""
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr ""
+
+#: lib/verity/verity.c:90
 #, fuzzy, c-format
-msgid "Device %s is not a valid VERITY device.\n"
+msgid "Device %s is not a valid VERITY device."
 msgstr "Perangkat %s bukan perangkat LUKS.\n"
 
-#: lib/verity/verity.c:101
+#: lib/verity/verity.c:97
 #, fuzzy, c-format
-msgid "Unsupported VERITY version %d.\n"
+msgid "Unsupported VERITY version %d."
 msgstr "versi LUKS %d tidak didukung.\n"
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
 msgstr ""
 
-#: lib/verity/verity.c:166
+#: lib/verity/verity.c:165
 #, fuzzy, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
+msgid "Wrong VERITY UUID format provided on device %s."
 msgstr "Format UUID yang disediakan berbeda, membuat yang baru.\n"
 
-#: lib/verity/verity.c:196
+#: lib/verity/verity.c:198
 #, fuzzy, c-format
-msgid "Error during update of verity header on device %s.\n"
+msgid "Error during update of verity header on device %s."
 msgstr "Error selama memperbarui header LUKS di perangkat %s.\n"
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr ""
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
 msgstr ""
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr ""
+
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
 msgstr ""
 
 #: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
 msgstr ""
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
 msgstr ""
 
-#: lib/verity/verity_hash.c:161
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
+msgid "Verification failed at position %<PRIu64>."
 msgstr ""
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
 msgstr ""
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
 msgstr ""
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
 msgstr ""
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
 msgstr ""
 
-#: lib/verity/verity_hash.c:365
+#: lib/verity/verity_hash.c:384
 #, fuzzy
-msgid "Input/output error while creating hash area.\n"
+msgid "Input/output error while creating hash area."
 msgstr "Kehabisan memori ketika membaca kata sandi.\n"
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
 msgstr ""
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity_hash.c:433
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
 msgstr ""
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr "Tidak dapat melakukan verifikasi kata sandi di masukan bukan tty.\n"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr ""
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Tidak ada pola spesifikasi cipher yang dikenal terdeteksi.\n"
+#: lib/verity/verity_fec.c:146
+#, fuzzy
+msgid "Failed to allocate buffer."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
 msgstr ""
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:218
-#, fuzzy
-msgid "Option --key-file is required.\n"
-msgstr "Pilihan --header-backup-file dibutuhkan.\n"
-
-#: src/cryptsetup.c:267
-#, fuzzy
-msgid "No device header detected with this passphrase.\n"
-msgstr "Tidak ada kunci tersedia dengan kata sandi ini.\n"
-
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
 msgstr ""
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
 msgstr ""
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
 msgstr ""
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity_fec.c:265
 #, fuzzy, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Perangkat %s tidak aktif.\n"
+msgid "Failed to determine size for device %s."
+msgstr "Gagal membuka berkas kunci %s.\n"
 
-#: src/cryptsetup.c:614
-msgid "N/A"
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
 msgstr ""
 
-#: src/cryptsetup.c:639
-#, fuzzy, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Tidak dapat membaca perangkat %s.\n"
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr ""
 
-#: src/cryptsetup.c:643
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
 #, fuzzy, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Tidak dapat membaca %d bytes dari berkas kunci %s.\n"
+msgid "Failed to acquire write lock on device %s."
+msgstr "Gagal untuk mengakses perangkat penyimpan kunci sementara.\n"
 
-#: src/cryptsetup.c:672
-#, fuzzy
-msgid "Really try to repair LUKS device header?"
-msgstr "Kembalikan header perangkat LUKS dan slot kunci"
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
 
-#: src/cryptsetup.c:697
-#, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Ini akan memaksa menulis data di %s secara permanen."
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "alokasi memori error dalam action_luksFormat"
+#: lib/luks2/luks2_json_format.c:227
+#, fuzzy
+msgid "Requested data offset is too small."
+msgstr "Perangkat %s terlalu kecil.\n"
 
-#: src/cryptsetup.c:717
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr ""
-
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
 msgstr ""
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
 #, fuzzy, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "slot kunci %d terpilih untuk penghapusan.\n"
+msgid "Failed to acquire read lock on device %s."
+msgstr "Gagal untuk mengakses perangkat penyimpan kunci sementara.\n"
 
-#: src/cryptsetup.c:884
+#: lib/luks2/luks2_json_metadata.c:1167
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Kunci %d tidak aktif. Tidak dapat menghapus.\n"
-
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
-msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+msgid "Forbidden LUKS2 requirements detected in backup %s."
 msgstr ""
-"Ini adalah slot kunci terakhir. Perangkat mungkin akan menjadi tidak stabil "
-"setelah menghapus kunci ini."
 
-#: src/cryptsetup.c:893
+#: lib/luks2/luks2_json_metadata.c:1208
 #, fuzzy
-msgid "Enter any remaining passphrase: "
-msgstr "Masukan kata sandi LUKS yang tersisa: "
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Data offset atau ukuran kunci berbeda di perangkat dan cadangan, pengembalian gagal.\n"
 
-#: src/cryptsetup.c:921
+#: lib/luks2/luks2_json_metadata.c:1214
 #, fuzzy
-msgid "Enter passphrase to be deleted: "
-msgstr "Masukan kata sandi LUKS yang akan dihapus: "
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Data offset atau ukuran kunci berbeda di perangkat dan cadangan, pengembalian gagal.\n"
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_metadata.c:1221
 #, fuzzy, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Masukan kata sandi: "
+msgid "Device %s %s%s%s%s"
+msgstr "Perangkat %s %s%s"
 
-#: src/cryptsetup.c:1052
+#: lib/luks2/luks2_json_metadata.c:1222
 #, fuzzy
-msgid "Enter passphrase to be changed: "
-msgstr "Masukan kata sandi LUKS yang akan dihapus: "
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "tidak berisi header LUKS. Mengganti header dapat menghancurkan data di perangkat itu."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
+#: lib/luks2/luks2_json_metadata.c:1223
 #, fuzzy
-msgid "Enter new passphrase: "
-msgstr "Masukan kata sandi: "
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "telah berisi header LUKS. Mengganti header dapat mengganti slot kunci yang telah ada."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Pilihan --header-backup-file dibutuhkan.\n"
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:1323
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
+msgid "Ignored unknown flag %s."
 msgstr ""
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
 msgstr ""
 
-#: src/cryptsetup.c:1326
-#, fuzzy, c-format
-msgid ""
-"This operation will erase all keyslots on device %s.\n"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+#, fuzzy
+msgid "Failed to set dm-linear segment."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "Slot kunci %d telah terverifikasi.\n"
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "versi LUKS %d tidak didukung.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+#, fuzzy
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "Gagal untuk membaca dari penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Gagal untuk membaca dari penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Gagal untuk membuka perangkat penyimpan kunci sementara.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "Perangkat %s tidak aktif.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "Tidak dapat menginisialisasi backend crypto.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr ""
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr ""
+
+#: lib/luks2/luks2_token.c:269
+#, fuzzy, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: src/cryptsetup.c:164
+#, fuzzy
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Tidak dapat melakukan verifikasi kata sandi di masukan bukan tty.\n"
+
+#: src/cryptsetup.c:221
+#, fuzzy
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+#, fuzzy
+msgid "No known cipher specification pattern detected."
+msgstr "Tidak ada pola spesifikasi cipher yang dikenal terdeteksi.\n"
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr ""
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr ""
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr ""
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:381
+#, fuzzy
+msgid "Option --key-file is required."
+msgstr "Pilihan --header-backup-file dibutuhkan.\n"
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr ""
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr ""
+
+#: src/cryptsetup.c:446
+#, fuzzy
+msgid "Invalid PIM value: 0."
+msgstr "Perangkat %s tidak valid.\n"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr ""
+
+#: src/cryptsetup.c:472
+#, fuzzy
+msgid "No device header detected with this passphrase."
+msgstr "Tidak ada kunci tersedia dengan kata sandi ini.\n"
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Perangkat %s bukan perangkat LUKS.\n"
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr ""
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr ""
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr ""
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr ""
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr ""
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr ""
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr ""
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr ""
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr ""
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr ""
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr ""
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Masukan kasa sandi baru untuk slot kunci: "
+
+#: src/cryptsetup.c:1141
+#, fuzzy
+msgid "Really try to repair LUKS device header?"
+msgstr "Kembalikan header perangkat LUKS dan slot kunci"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, fuzzy, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Tidak dapat membaca perangkat %s.\n"
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr ""
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+#, fuzzy
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "versi LUKS %d tidak didukung.\n"
+
+#: src/cryptsetup.c:1253
+#, fuzzy, c-format
+msgid "Cannot create header file %s."
+msgstr "Tidak dapat membaca berkas cadangan header %s.\n"
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+#, fuzzy
+msgid "No known integrity specification pattern detected."
+msgstr "Tidak ada pola spesifikasi cipher yang dikenal terdeteksi.\n"
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr ""
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Ini akan memaksa menulis data di %s secara permanen."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+#, fuzzy
+msgid "Failed to set pbkdf parameters."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr ""
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr ""
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, fuzzy, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "slot kunci %d terpilih untuk penghapusan.\n"
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Ini adalah slot kunci terakhir. Perangkat mungkin akan menjadi tidak stabil setelah menghapus kunci ini."
+
+#: src/cryptsetup.c:1582
+#, fuzzy
+msgid "Enter any remaining passphrase: "
+msgstr "Masukan kata sandi LUKS yang tersisa: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:1621
+#, fuzzy
+msgid "Enter passphrase to be deleted: "
+msgstr "Masukan kata sandi LUKS yang akan dihapus: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Masukan kasa sandi baru untuk slot kunci: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, fuzzy, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Masukan kata sandi: "
+
+#: src/cryptsetup.c:1861
+#, fuzzy
+msgid "Enter passphrase to be changed: "
+msgstr "Masukan kata sandi LUKS yang akan dihapus: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+#, fuzzy
+msgid "Enter new passphrase: "
+msgstr "Masukan kata sandi: "
+
+#: src/cryptsetup.c:1927
+#, fuzzy
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Masukan kasa sandi baru untuk slot kunci: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr ""
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Slot kunci %d tidak digunakan.\n"
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+#, fuzzy
+msgid "Option --header-backup-file is required."
+msgstr "Pilihan --header-backup-file dibutuhkan.\n"
+
+#: src/cryptsetup.c:2258
+#, fuzzy, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s bukan perangkat LUKS."
+
+#: src/cryptsetup.c:2269
+#, fuzzy, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr ""
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr ""
+
+#: src/cryptsetup.c:2336
+#, fuzzy, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
 "Device will become unusable after this operation."
+msgstr "Ini adalah slot kunci terakhir. Perangkat mungkin akan menjadi tidak stabil setelah menghapus kunci ini."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr ""
+
+#: src/cryptsetup.c:2398
+#, fuzzy, c-format
+msgid "Device is already %s type."
+msgstr "Perangkat %s telah ada.\n"
+
+#: src/cryptsetup.c:2403
+#, fuzzy, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr ""
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, fuzzy, c-format
+msgid "Token %d is invalid."
+msgstr "Slot kunci %d tidak valid.\n"
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr ""
+
+#: src/cryptsetup.c:2493
+#, fuzzy, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, fuzzy, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: src/cryptsetup.c:2519
+#, fuzzy, c-format
+msgid "Token %d is not in use."
+msgstr "Slot kunci %d tidak digunakan.\n"
+
+#: src/cryptsetup.c:2554
+#, fuzzy
+msgid "Failed to import token from file."
+msgstr "Gagal membuka berkas kunci %s.\n"
+
+#: src/cryptsetup.c:2579
+#, fuzzy, c-format
+msgid "Failed to get token %d for export."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr ""
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2613
+#, fuzzy, c-format
+msgid "Invalid token operation %s."
+msgstr "Besar kunci %d tidak valid.\n"
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Perangkat %s bukan perangkat LUKS.\n"
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Gagal untuk memperoleh direktori pemeta-perangkat."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "Perangkat %s tidak valid.\n"
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Berkas %s yang diminta telah ada.\n"
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Tidak dapat membaca berkas cadangan header %s.\n"
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr ""
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr ""
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Masukan kasa sandi baru untuk slot kunci: "
+
+#: src/cryptsetup.c:3096
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Masukan kasa sandi baru untuk slot kunci: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "%s: membutuhkan %s sebagai argumen"
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr ""
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr ""
+
+#: src/cryptsetup.c:3346
+#, fuzzy
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<perangkat> <nama>"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+#, fuzzy
+msgid "open device as <name>"
+msgstr "buka perangkat LUKS sebagai pemetaan <nama>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<nama>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr ""
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "ubah ukuran perangkat aktif"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "tampilkan status perangkat"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr ""
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr ""
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<perangkat>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr ""
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "tambahkan kunci ke perangkat LUKS"
+
+#: src/cryptsetup.c:3353
+#, fuzzy
+msgid "erase all keyslots (remove encryption key)"
+msgstr "Besar dari kunci enkripsi"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr ""
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr ""
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<perangkat> [<berkas kunci baru>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "format sebuah perangkat LUKS"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "tambahkan kunci ke perangkat LUKS"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<perangkat> [<berkas kunci>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "hapus kunci yang diberikan atau berkas kunci dari perangkat LUKS"
+
+#: src/cryptsetup.c:3359
+#, fuzzy
+msgid "changes supplied key or key file of LUKS device"
+msgstr "hapus kunci yang diberikan atau berkas kunci dari perangkat LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<perangkat> <slot kunci>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "hapus kunci dengan nomor <slot kunci> dari perangkat LUKS"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "tampilkan UUID dari perangkat LUKS"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "periksa <perangkat> untuk header partisi LUKS"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "dump informasi  partisi LUKS"
+
+#: src/cryptsetup.c:3365
+#, fuzzy
+msgid "dump TCRYPT device information"
+msgstr "dump informasi  partisi LUKS"
+
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "dump informasi  partisi LUKS"
+
+#: src/cryptsetup.c:3367
+#, fuzzy
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Hentikan perangkat LUKS dan hapus kunci (semua IO dihentikan)."
+
+#: src/cryptsetup.c:3368
+#, fuzzy
+msgid "Resume suspended LUKS device"
+msgstr "Lanjutkan perangkat LUKS yang dihentikan."
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Buat cadangan header perangkat LUKS dan slot kunci"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Kembalikan header perangkat LUKS dan slot kunci"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr ""
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr ""
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<aksi> adalah salah satu dari:\n"
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<nama> adalah perangkat untuk dibuat dibawah %s\n"
+"<perangkat> adalah perangkat terenkripsi\n"
+"<slot kunci> adalah nomor slot kunci LUKS untuk dimodifikasi\n"
+"<berkas kunci> adalah berkas kunci opsional untuk kunci baru untuk aksi luksAddKey\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+
+#: src/cryptsetup.c:3422
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Parameter baku yang terkompilasi dalam perangkat penyandi:\n"
+"\tterbuka: %s, Kunci: %d bits, Hash kata sandi : %s\n"
+"\tLUKS1  : %s, Kunci: %d bits, Hash kepala LUKS: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: membutuhkan %s sebagai argumen"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Tampilkan pesan bantuan ini"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Tampilkan penggunaan singkat"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Tampilkan versi paket"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Pilihan bantuan:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Tampilkan pesan kesalahan secara lebih detail"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Tampilkan pesan penelusuran"
+
+#: src/cryptsetup.c:3489
+#, fuzzy
+msgid "Show debug messages including JSON metadata"
+msgstr "Tampilkan pesan penelusuran"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "Cipher yang digunakan untuk mengenkripsi ke disk (lihat /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "Hash yang digunakan untuk membuat kunci enkripsi dari kata sandi"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Verifikasi kata sandi dengan menanyakan itu dua kali"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+#, fuzzy
+msgid "Read the key from a file"
+msgstr "Baca volume (master) kunci dari berkas."
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "Baca volume (master) kunci dari berkas."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr ""
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "Besar dari kunci enkripsi"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "BITS"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr ""
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr ""
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Nomor slot untuk kunci baru (baku adalah yang kosong pertama)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "Besar dari perangkat"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "SEKTOR"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr ""
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "Awal ofset dalam perangkat backend"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Berapa banyak sektor dari data terenkripsi yang dilewatkan di awal"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Buat pemetaan baca-saja"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Jangan tanya untuk konfirmasi"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Waktu habis untuk pertanyaan interaktif kata sandi (dalam detik)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "detik"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
 msgstr ""
-"Ini adalah slot kunci terakhir. Perangkat mungkin akan menjadi tidak stabil "
-"setelah menghapus kunci ini."
 
-#: src/cryptsetup.c:1360
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Seberapa sering masukan dari kata sandi dapat dicoba"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Sesuaikan muatan di batas sektor <n> - untuk luksFormat"
+
+#: src/cryptsetup.c:3512
 #, fuzzy
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<perangkat> <nama>"
+msgid "File with LUKS header and keyslots backup"
+msgstr "Berkas dengan header LUKS dan cadangan slot kunci."
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr ""
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr ""
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr ""
 
-#: src/cryptsetup.c:1360
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
 #, fuzzy
-msgid "open device as mapping <name>"
-msgstr "buka perangkat LUKS sebagai pemetaan <nama>"
+msgid "UUID for device to use"
+msgstr "DM-UUID untuk perangkat %s telah terpotong.\n"
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<nama>"
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr ""
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
 msgstr ""
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "ubah ukuran perangkat aktif"
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr ""
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "tampilkan status perangkat"
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr ""
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
 msgstr ""
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<perangkat>"
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr ""
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr ""
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr ""
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr ""
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr ""
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr ""
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr ""
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr ""
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr ""
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
 msgstr ""
 
-#: src/cryptsetup.c:1366
+#: src/cryptsetup.c:3532
 #, fuzzy
-msgid "erase all keyslots (remove encryption key)"
-msgstr "Besar dari kunci enkripsi"
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "waktu iterasi PBKDF2 untuk LUKS (dalam mdet)"
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<perangkat> [<berkas kunci baru>]"
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "mdetik"
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr ""
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr ""
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr ""
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr ""
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr ""
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr ""
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr ""
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr ""
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr ""
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr ""
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr ""
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr ""
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr ""
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr ""
+
+#: src/cryptsetup.c:3550
+#, fuzzy
+msgid "Set label for the LUKS2 device"
 msgstr "format sebuah perangkat LUKS"
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "tambahkan kunci ke perangkat LUKS"
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr ""
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
-msgstr "<perangkat> [<berkas kunci>]"
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr ""
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "hapus kunci yang diberikan atau berkas kunci dari perangkat LUKS"
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr ""
 
-#: src/cryptsetup.c:1370
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr ""
+
+#: src/cryptsetup.c:3555
 #, fuzzy
-msgid "changes supplied key or key file of LUKS device"
-msgstr "hapus kunci yang diberikan atau berkas kunci dari perangkat LUKS"
+msgid "LUKS2 header keyslots area size"
+msgstr "Berkas dengan header LUKS dan cadangan slot kunci."
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<perangkat> <slot kunci>"
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr ""
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr "hapus kunci dengan nomor <slot kunci> dari perangkat LUKS"
+#: src/cryptsetup.c:3557
+#, fuzzy
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Besar dari kunci enkripsi"
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "tampilkan UUID dari perangkat LUKS"
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr ""
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "periksa <perangkat> untuk header partisi LUKS"
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr ""
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
-msgstr "dump informasi  partisi LUKS"
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr ""
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr ""
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr ""
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr ""
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+#, fuzzy
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[PILIHAN...] <aksi> <aksi-spesifik>]"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Argumen <aksi> hilang."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Aksi tidak diketahui."
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr ""
+
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr ""
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr ""
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr ""
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr ""
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr ""
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr ""
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr ""
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr ""
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr ""
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Kunci harus kelipatan dari 8 bit"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+#, fuzzy
+msgid "Key slot is invalid."
+msgstr "Slot kunci %d tidak valid.\n"
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr ""
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr ""
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr ""
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr ""
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr ""
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr ""
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr ""
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr ""
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr ""
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr ""
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr ""
 
-#: src/cryptsetup.c:1375
+#: src/cryptsetup.c:3844
 #, fuzzy
-msgid "dump TCRYPT device information"
-msgstr "dump informasi  partisi LUKS"
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr "Hentikan perangkat LUKS dan hapus kunci (semua IO dihentikan)."
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr ""
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Lanjutkan perangkat LUKS yang dihentikan."
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr ""
 
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
-msgstr "Buat cadangan header perangkat LUKS dan slot kunci"
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr ""
 
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
-msgstr "Kembalikan header perangkat LUKS dan slot kunci"
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
-msgid ""
-"\n"
-"<action> is one of:\n"
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
 msgstr ""
-"\n"
-"<aksi> adalah salah satu dari:\n"
 
-#: src/cryptsetup.c:1402
-msgid ""
-"\n"
-"You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
 msgstr ""
 
-#: src/cryptsetup.c:1406
-#, c-format
-msgid ""
-"\n"
-"<name> is the device to create under %s\n"
-"<device> is the encrypted device\n"
-"<key slot> is the LUKS key slot number to modify\n"
-"<key file> optional key file for the new key for luksAddKey action\n"
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
 msgstr ""
-"\n"
-"<nama> adalah perangkat untuk dibuat dibawah %s\n"
-"<perangkat> adalah perangkat terenkripsi\n"
-"<slot kunci> adalah nomor slot kunci LUKS untuk dimodifikasi\n"
-"<berkas kunci> adalah berkas kunci opsional untuk kunci baru untuk aksi "
-"luksAddKey\n"
 
-#: src/cryptsetup.c:1413
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
 msgstr ""
 
-#: src/cryptsetup.c:1420
-#, fuzzy, c-format
-msgid ""
-"\n"
-"Default compiled-in device cipher parameters:\n"
-"\tloop-AES: %s, Key %d bits\n"
-"\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
 msgstr ""
-"\n"
-"Parameter baku yang terkompilasi dalam perangkat penyandi:\n"
-"\tterbuka: %s, Kunci: %d bits, Hash kata sandi : %s\n"
-"\tLUKS1  : %s, Kunci: %d bits, Hash kepala LUKS: %s\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
-#, c-format
-msgid "%s: requires %s as arguments"
-msgstr "%s: membutuhkan %s sebagai argumen"
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr ""
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
-msgid "Show this help message"
-msgstr "Tampilkan pesan bantuan ini"
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr ""
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
-msgid "Display brief usage"
-msgstr "Tampilkan penggunaan singkat"
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "Operasi ini tidak didukung untuk perangkat crypt %s.\n"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Pilihan bantuan:"
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
 
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
-msgid "Print package version"
-msgstr "Tampilkan versi paket"
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr ""
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
-msgid "Shows more detailed error messages"
-msgstr "Tampilkan pesan kesalahan secara lebih detail"
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr ""
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
-msgid "Show debug messages"
-msgstr "Tampilkan pesan penelusuran"
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr ""
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
-msgid "The cipher used to encrypt the disk (see /proc/crypto)"
-msgstr "Cipher yang digunakan untuk mengenkripsi ke disk (lihat /proc/crypto)"
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr ""
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
-msgid "The hash used to create the encryption key from the passphrase"
-msgstr "Hash yang digunakan untuk membuat kunci enkripsi dari kata sandi"
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr ""
 
-#: src/cryptsetup.c:1481
-msgid "Verifies the passphrase by asking for it twice"
-msgstr "Verifikasi kata sandi dengan menanyakan itu dua kali"
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+#, fuzzy
+msgid "Invalid device size specification."
+msgstr "Perangkat %s tidak valid.\n"
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr ""
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
 #, fuzzy
-msgid "Read the key from a file."
-msgstr "Baca volume (master) kunci dari berkas."
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Kunci harus kelipatan dari 8 bit"
 
-#: src/cryptsetup.c:1483
-msgid "Read the volume (master) key from file."
-msgstr "Baca volume (master) kunci dari berkas."
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr ""
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
 msgstr ""
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "The size of the encryption key"
-msgstr "Besar dari kunci enkripsi"
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "BITS"
-msgstr "BITS"
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Kunci harus kelipatan dari 8 bit"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
-msgid "Limits the read from keyfile"
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
 msgstr ""
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
-msgid "bytes"
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
 msgstr ""
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
-msgid "Number of bytes to skip in keyfile"
+#: src/cryptsetup.c:4014
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
 msgstr ""
 
-#: src/cryptsetup.c:1488
-msgid "Limits the read from newly added keyfile"
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
 msgstr ""
 
-#: src/cryptsetup.c:1489
-msgid "Number of bytes to skip in newly added keyfile"
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
 msgstr ""
 
-#: src/cryptsetup.c:1490
-msgid "Slot number for new key (default is first free)"
-msgstr "Nomor slot untuk kunci baru (baku adalah yang kosong pertama)"
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr ""
 
-#: src/cryptsetup.c:1491
-msgid "The size of the device"
-msgstr "Besar dari perangkat"
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr ""
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
-msgid "SECTORS"
-msgstr "SEKTOR"
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "Perangkat %s tidak valid.\n"
 
-#: src/cryptsetup.c:1492
-msgid "The start offset in the backend device"
-msgstr "Awal ofset dalam perangkat backend"
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr "Tidak dapat membaca perangkat %s.\n"
 
-#: src/cryptsetup.c:1493
-msgid "How many sectors of the encrypted data to skip at the beginning"
-msgstr "Berapa banyak sektor dari data terenkripsi yang dilewatkan di awal"
+#: src/veritysetup.c:392
+#, fuzzy
+msgid "<data_device> <hash_device>"
+msgstr "<nama> <perangkat>"
 
-#: src/cryptsetup.c:1494
-msgid "Create a readonly mapping"
-msgstr "Buat pemetaan baca-saja"
+#: src/veritysetup.c:392 src/integritysetup.c:479
+#, fuzzy
+msgid "format device"
+msgstr "buat perangkat"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "waktu iterasi PBKDF2 untuk LUKS (dalam mdet)"
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr ""
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "mdetik"
+#: src/veritysetup.c:393
+#, fuzzy
+msgid "verify device"
+msgstr "hapus perangkat"
 
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
-msgid "Do not ask for confirmation"
-msgstr "Jangan tanya untuk konfirmasi"
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr ""
 
-#: src/cryptsetup.c:1497
-msgid "Timeout for interactive passphrase prompt (in seconds)"
-msgstr "Waktu habis untuk pertanyaan interaktif kata sandi (dalam detik)"
+#: src/veritysetup.c:396 src/integritysetup.c:482
+#, fuzzy
+msgid "show active device status"
+msgstr "tampilkan status perangkat"
 
-#: src/cryptsetup.c:1497
-msgid "secs"
-msgstr "detik"
+#: src/veritysetup.c:397
+#, fuzzy
+msgid "<hash_device>"
+msgstr "<perangkat>"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "Seberapa sering masukan dari kata sandi dapat dicoba"
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr ""
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr "Sesuaikan muatan di batas sektor <n> - untuk luksFormat"
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Berkas dengan header LUKS dan cadangan slot kunci."
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
 msgstr ""
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
 msgstr ""
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
+#: src/veritysetup.c:467
+msgid "number"
 msgstr ""
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
+#: src/veritysetup.c:468
 #, fuzzy
-msgid "UUID for device to use."
-msgstr "DM-UUID untuk perangkat %s telah terpotong.\n"
+msgid "Block size on the data device"
+msgstr "Besar dari perangkat"
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr ""
+#: src/veritysetup.c:469
+#, fuzzy
+msgid "Block size on the hash device"
+msgstr "Besar dari perangkat"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
 msgstr ""
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
 msgstr ""
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
+#: src/veritysetup.c:471
+msgid "blocks"
 msgstr ""
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
 msgstr ""
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
 msgstr ""
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
+#: src/veritysetup.c:473
+#, fuzzy
+msgid "Starting offset on the hash device"
+msgstr "Awal ofset dalam perangkat backend"
+
+#: src/veritysetup.c:474
+#, fuzzy
+msgid "Starting offset on the FEC device"
+msgstr "Awal ofset dalam perangkat backend"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
 msgstr ""
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
+#: src/veritysetup.c:475
+msgid "string"
 msgstr ""
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
+#: src/veritysetup.c:476
+msgid "Salt"
 msgstr ""
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
+#: src/veritysetup.c:476
+msgid "hex string"
 msgstr ""
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
 msgstr ""
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
-#, fuzzy
-msgid "[OPTION...] <action> <action-specific>"
-msgstr "[PILIHAN...] <aksi> <aksi-spesifik>]"
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr ""
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
 msgstr ""
 
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
-msgid "Argument <action> missing."
-msgstr "Argumen <aksi> hilang."
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr ""
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
-msgid "Unknown action."
-msgstr "Aksi tidak diketahui."
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr ""
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
 msgstr ""
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
 msgstr ""
 
-#: src/cryptsetup.c:1657
-msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
 msgstr ""
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, fuzzy, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Tidak dapat membaca perangkat %s.\n"
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, fuzzy, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Tidak dapat membaca %d bytes dari berkas kunci %s.\n"
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
 msgstr ""
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
-msgid "Key size must be a multiple of 8 bits"
-msgstr "Kunci harus kelipatan dari 8 bit"
+#: src/integritysetup.c:479 src/integritysetup.c:483
+#, fuzzy
+msgid "<integrity_device>"
+msgstr "<perangkat>"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/integritysetup.c:480
 #, fuzzy
-msgid "Key slot is invalid."
-msgstr "Slot kunci %d tidak valid.\n"
+msgid "<integrity_device> <name>"
+msgstr "<perangkat> <nama>"
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
 msgstr ""
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
-msgid "Negative number for option not permitted."
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
 msgstr ""
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
-msgid "Only one of --use-[u]random options is allowed."
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
 msgstr ""
 
-#: src/cryptsetup.c:1699
-msgid "Option --use-[u]random is allowed only for luksFormat."
+#: src/integritysetup.c:551
+msgid "Journal size"
 msgstr ""
 
-#: src/cryptsetup.c:1703
-msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
 msgstr ""
 
-#: src/cryptsetup.c:1707
-msgid "Option --align-payload is allowed only for luksFormat."
+#: src/integritysetup.c:553
+msgid "Journal watermark"
 msgstr ""
 
-#: src/cryptsetup.c:1713
-#, fuzzy
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
-
-#: src/cryptsetup.c:1719
-#, fuzzy
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
-msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
-
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
+#: src/integritysetup.c:553
+msgid "percent"
 msgstr ""
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
+#: src/integritysetup.c:554
+msgid "Journal commit time"
 msgstr ""
 
-#: src/cryptsetup.c:1735
-#, fuzzy
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "Operasi ini hanya didukunga untuk perangkat LUKS.\n"
-
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
 msgstr ""
 
-#: src/veritysetup.c:88
-#, c-format
-msgid "Cannot create hash image %s for writing.\n"
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
 msgstr ""
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
 msgstr ""
 
-#: src/veritysetup.c:308
-#, fuzzy
-msgid "<data_device> <hash_device>"
-msgstr "<nama> <perangkat>"
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr ""
 
-#: src/veritysetup.c:308
-#, fuzzy
-msgid "format device"
-msgstr "buat perangkat"
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr ""
 
-#: src/veritysetup.c:309
-msgid "<data_device> <hash_device> <root_hash>"
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr ""
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
 msgstr ""
 
-#: src/veritysetup.c:309
+#: src/integritysetup.c:562
 #, fuzzy
-msgid "verify device"
-msgstr "hapus perangkat"
+msgid "The size of the data integrity key"
+msgstr "Besar dari kunci enkripsi"
+
+#: src/integritysetup.c:563
+#, fuzzy
+msgid "Read the integrity key from a file"
+msgstr "Baca volume (master) kunci dari berkas."
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
 msgstr ""
 
-#: src/veritysetup.c:310
+#: src/integritysetup.c:566
 #, fuzzy
-msgid "create active device"
-msgstr "ubah ukuran perangkat aktif"
+msgid "The size of the journal integrity key"
+msgstr "Besar dari kunci enkripsi"
 
-#: src/veritysetup.c:311
+#: src/integritysetup.c:567
 #, fuzzy
-msgid "remove (deactivate) device"
-msgstr "ubah ukuran perangkat aktif"
+msgid "Read the journal integrity key from a file"
+msgstr "Baca volume (master) kunci dari berkas."
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr ""
 
-#: src/veritysetup.c:312
+#: src/integritysetup.c:570
 #, fuzzy
-msgid "show active device status"
-msgstr "tampilkan status perangkat"
+msgid "The size of the journal encryption key"
+msgstr "Besar dari kunci enkripsi"
 
-#: src/veritysetup.c:313
+#: src/integritysetup.c:571
 #, fuzzy
-msgid "<hash_device>"
-msgstr "<perangkat>"
+msgid "Read the journal encryption key from a file"
+msgstr "Baca volume (master) kunci dari berkas."
 
-#: src/veritysetup.c:313
-msgid "show on-disk information"
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
 msgstr ""
 
-#: src/veritysetup.c:332
-#, c-format
-msgid ""
-"\n"
-"<name> is the device to create under %s\n"
-"<data_device> is the data device\n"
-"<hash_device> is the device containing verification data\n"
-"<root_hash> hash of the root node on <hash_device>\n"
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
 msgstr ""
 
-#: src/veritysetup.c:339
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
 msgstr ""
 
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
 msgstr ""
 
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
 msgstr ""
 
-#: src/veritysetup.c:378
-msgid "number"
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
 msgstr ""
 
-#: src/veritysetup.c:379
-#, fuzzy
-msgid "Block size on the data device"
-msgstr "Besar dari perangkat"
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:380
-#, fuzzy
-msgid "Block size on the hash device"
-msgstr "Besar dari perangkat"
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr ""
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
 msgstr ""
 
-#: src/veritysetup.c:381
-msgid "blocks"
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
 msgstr ""
 
-#: src/veritysetup.c:382
-#, fuzzy
-msgid "Starting offset on the hash device"
-msgstr "Awal ofset dalam perangkat backend"
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
 msgstr ""
 
-#: src/veritysetup.c:383
-msgid "string"
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
 msgstr ""
 
-#: src/veritysetup.c:384
-msgid "Salt"
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
 msgstr ""
 
-#: src/veritysetup.c:384
-msgid "hex string"
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:147
-#, fuzzy, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Tidak dapat membuka perangkat %s.\n"
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:151
+#: src/cryptsetup_reencrypt.c:208
 #, fuzzy, c-format
-msgid "Cannot open device %s\n"
+msgid "Cannot exclusively open %s, device in use."
 msgstr "Tidak dapat membuka perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:168
-#, c-format
-msgid "Cannot read device %s.\n"
+#: src/cryptsetup_reencrypt.c:229
+#, fuzzy, c-format
+msgid "Cannot read device %s."
 msgstr "Tidak dapat membaca perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:179
+#: src/cryptsetup_reencrypt.c:240
 #, c-format
-msgid "Marking LUKS device %s unusable.\n"
+msgid "Marking LUKS1 device %s unusable."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:200
+#: src/cryptsetup_reencrypt.c:261
 #, fuzzy, c-format
-msgid "Cannot write device %s.\n"
+msgid "Cannot write device %s."
 msgstr "Tidak dapat menghapus perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:281
+#: src/cryptsetup_reencrypt.c:309
 #, fuzzy
-msgid "Cannot write reencryption log file.\n"
+msgid "Cannot write reencryption log file."
 msgstr "Tidak dapat menulis berkas cadangan header %s.\n"
 
-#: src/cryptsetup_reencrypt.c:337
+#: src/cryptsetup_reencrypt.c:365
 #, fuzzy
-msgid "Cannot read reencryption log file.\n"
+msgid "Cannot read reencryption log file."
 msgstr "Tidak dapat membaca berkas cadangan header %s.\n"
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:450
+#: src/cryptsetup_reencrypt.c:559
+#, fuzzy
+msgid "Failed to set data offset."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: src/cryptsetup_reencrypt.c:565
+#, fuzzy
+msgid "Failed to set metadata size."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: src/cryptsetup_reencrypt.c:573
 #, fuzzy, c-format
-msgid "New LUKS header for device %s created.\n"
+msgid "New LUKS header for device %s created."
 msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "Activated keyslot %i.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/cryptsetup_reencrypt.c:659
+#, fuzzy
+msgid "Failed to write activation flags to new header."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+#, fuzzy
+msgid "Failed to read requirements from backup header."
+msgstr "Gagal untuk membaca dari penyimpanan kunci.\n"
+
+#: src/cryptsetup_reencrypt.c:705
 #, fuzzy, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "Header LUKS terdeteksi tetapi perangkat %s terlalu kecil.\n"
+msgid "%s header backup of device %s created."
+msgstr "Pilihan --header-backup-file dibutuhkan.\n"
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/cryptsetup_reencrypt.c:901
 #, fuzzy, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
+msgid "Cannot restore %s header on device %s."
 msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/cryptsetup_reencrypt.c:903
 #, fuzzy, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "Header LUKS terdeteksi tetapi perangkat %s terlalu kecil.\n"
-
-#: src/cryptsetup_reencrypt.c:669
-#, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-#, fuzzy
-msgid "Cannot seek to device offset.\n"
-msgstr "Tidak dapat membaca perangkat %s.\n"
+msgid "%s header on device %s restored."
+msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
 #, fuzzy
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Tidak dapat membuka berkas cadangan header %s.\n"
+msgid "Cannot open temporary LUKS device."
+msgstr "Gagal untuk membuka perangkat penyimpan kunci sementara.\n"
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
 #, fuzzy
-msgid "Cannot get device size.\n"
+msgid "Cannot get device size."
 msgstr "Tidak dapat membaca perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr ""
-
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
-#, fuzzy, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Masukan kasa sandi baru untuk slot kunci: "
-
-#: src/cryptsetup_reencrypt.c:1136
+#: src/cryptsetup_reencrypt.c:1423
 #, fuzzy
-msgid "Cannot open reencryption log file.\n"
+msgid "Cannot open reencryption log file."
 msgstr "Tidak dapat membuka berkas cadangan header %s.\n"
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "Reencryption block size"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "MiB"
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
+#: src/cryptsetup_reencrypt.c:1622
+#, fuzzy
+msgid "Read new volume (master) key from file"
+msgstr "Baca volume (master) kunci dari berkas."
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "waktu iterasi PBKDF2 untuk LUKS (dalam mdet)"
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1281
+#: src/cryptsetup_reencrypt.c:1637
 #, fuzzy
-msgid "Create new header on not encrypted device."
+msgid "Create new header on not encrypted device"
 msgstr "Tidak dapat menghapus kepala di perangkat %s.\n"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1298
-msgid "[OPTION...] <device>"
+#: src/cryptsetup_reencrypt.c:1639
+#, fuzzy
+msgid "The UUID used to resume decryption"
+msgstr "Besar dari kunci enkripsi"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1313
+#: src/cryptsetup_reencrypt.c:1667
 #, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
+msgid "Reencryption will change: %s%s%s%s%s%s."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-#, fuzzy
-msgid "Invalid device size specification."
-msgstr "Perangkat %s tidak valid.\n"
-
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1366
-#, fuzzy
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Kunci harus kelipatan dari 8 bit"
-
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
 msgstr ""
 
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr ""
+
 #: src/utils_tools.c:151
 #, fuzzy
-msgid "Error reading response from terminal.\n"
+msgid "Error reading response from terminal."
 msgstr "Kesalahan dalam pembacaan kata sandi dari terminal.\n"
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Perintah berhasil.\n"
 
-#: src/utils_tools.c:191
-#, c-format
-msgid "Command failed with code %i"
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr ""
+
+#: src/utils_tools.c:196
+#, fuzzy
+msgid "no permission or bad passphrase"
+msgstr "Masukan kata sandi: "
+
+#: src/utils_tools.c:198
+#, fuzzy
+msgid "out of memory"
+msgstr "Tidak dapat membuka kunci memori."
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr ""
+
+#: src/utils_tools.c:202
+#, fuzzy
+msgid "device already exists or device is busy"
+msgstr "Perangkat %s telah ada.\n"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr ""
+
+#: src/utils_tools.c:206
+#, fuzzy, c-format
+msgid "Command failed with code %i (%s).\n"
 msgstr "Perintah gagal dengan kode %i"
 
-#: src/utils_password.c:42
+#: src/utils_tools.c:283
+#, fuzzy, c-format
+msgid "Key slot %i created."
+msgstr "Slot kunci %d telah terverifikasi.\n"
+
+#: src/utils_tools.c:285
+#, fuzzy, c-format
+msgid "Key slot %i unlocked."
+msgstr "Slot kunci %d tidak terkunci.\n"
+
+#: src/utils_tools.c:287
+#, fuzzy, c-format
+msgid "Key slot %i removed."
+msgstr "Slot kunci %d telah terverifikasi.\n"
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr ""
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr ""
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+#, fuzzy
+msgid "Failed to initialize device signature probes."
+msgstr "Gagal untuk memperoleh direktori pemeta-perangkat."
+
+#: src/utils_tools.c:548
+#, fuzzy, c-format
+msgid "Failed to stat device %s."
+msgstr "Gagal memperoleh data statistik berkas kunci %s.\n"
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr ""
+
+#: src/utils_tools.c:563
+#, fuzzy, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Gagal membuka berkas kunci %s.\n"
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:583
+#, fuzzy
+msgid "Failed to wipe device signature."
+msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
+
+#: src/utils_tools.c:590
+#, fuzzy, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Gagal untuk memperoleh direktori pemeta-perangkat."
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+
+#: src/utils_password.c:43 src/utils_password.c:75
 #, c-format
-msgid "Cannot check password quality: %s\n"
+msgid "Cannot check password quality: %s"
 msgstr ""
 
-#: src/utils_password.c:50
+#: src/utils_password.c:51
 #, fuzzy, c-format
 msgid ""
 "Password quality check failed:\n"
-" %s\n"
+" %s"
 msgstr "setpriority %u gagal: %s"
 
-#~ msgid "Key slot %d verified.\n"
-#~ msgstr "Slot kunci %d telah terverifikasi.\n"
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr ""
+
+#: src/utils_password.c:193 src/utils_password.c:208
+#, fuzzy
+msgid "Error reading passphrase from terminal."
+msgstr "Kesalahan dalam pembacaan kata sandi dari terminal.\n"
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Memverifikasi kata sandi: "
+
+#: src/utils_password.c:213
+#, fuzzy
+msgid "Passphrases do not match."
+msgstr "Kata sandi tidak cocok.\n"
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr ""
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Masukan kata sandi: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Masukan kata sandi untuk %s: "
+
+#: src/utils_password.c:287
+#, fuzzy
+msgid "No key available with this passphrase."
+msgstr "Tidak ada kunci tersedia dengan kata sandi ini.\n"
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr ""
+
+#: src/utils_password.c:328
+#, fuzzy, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Tidak dapat membuka berkas %s.\n"
+
+#: src/utils_password.c:335
+#, fuzzy, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Tidak dapat menulis berkas cadangan header %s.\n"
+
+#: src/utils_luks2.c:47
+#, fuzzy, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Gagal membuka berkas kunci %s.\n"
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr ""
+
+#: src/utils_luks2.c:67
+#, fuzzy
+msgid "Failed to read JSON file."
+msgstr "Gagal membuka berkas kunci %s.\n"
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+
+#: src/utils_luks2.c:113
+#, fuzzy, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Gagal membuka berkas kunci %s.\n"
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+
+#: src/utils_luks2.c:126
+#, fuzzy
+msgid "Failed to write JSON file."
+msgstr "Gagal membuka berkas kunci %s.\n"
 
-#~ msgid "Invalid key size %d.\n"
-#~ msgstr "Besar kunci %d tidak valid.\n"
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Kunci %d tidak aktif. Tidak dapat menghapus.\n"
 
 #~ msgid "Enter LUKS passphrase: "
 #~ msgstr "Masukan kata sandi LUKS: "
 
-#~ msgid ""
-#~ "Warning: exhausting read requested, but key file %s is not a regular "
-#~ "file, function might never return.\n"
-#~ msgstr ""
-#~ "Peringatan: pembacaan yang melelahkan diminta, tetapi berkas kunci %s "
-#~ "bukan sebuah berkas biasa, fungsi mungkin tidak pernah kembali.\n"
+#~ msgid "Warning: exhausting read requested, but key file %s is not a regular file, function might never return.\n"
+#~ msgstr "Peringatan: pembacaan yang melelahkan diminta, tetapi berkas kunci %s bukan sebuah berkas biasa, fungsi mungkin tidak pernah kembali.\n"
 
 #~ msgid "exclusive "
 #~ msgstr "ekslusif "
@@ -1894,56 +3991,35 @@ msgstr "setpriority %u gagal: %s"
 #~ msgstr "BLKGETSIZE gagal di perangkat %s.\n"
 
 #~ msgid "WARNING!!! Possibly insecure memory. Are you root?\n"
-#~ msgstr ""
-#~ "PERINGATAN!!! Kemungkinan menggunakan memori tidak aman. Apakah anda "
-#~ "root?\n"
+#~ msgstr "PERINGATAN!!! Kemungkinan menggunakan memori tidak aman. Apakah anda root?\n"
 
 #~ msgid "Unable to obtain sector size for %s"
 #~ msgstr "Tidak dapat mendapatkan ukuran sektor untuk %s"
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr "Gagal untuk memperoleh direktori pemeta-perangkat."
-
 #~ msgid "Backup file %s doesn't exist.\n"
 #~ msgstr "Berkas cadangan %s tidak ada.\n"
 
 #~ msgid "%s is not LUKS device.\n"
 #~ msgstr "%s bukan perangkat LUKS.\n"
 
-#~ msgid "%s is not LUKS device."
-#~ msgstr "%s bukan perangkat LUKS."
-
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Tidak dapat membuka berkas %s.\n"
-
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Gagal untuk menulis di penyimpanan kunci.\n"
-
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr "Gagal untuk membaca dari penyimpanan kunci.\n"
-
 #~ msgid "remove LUKS mapping"
 #~ msgstr "hapus pemetaan LUKS"
 
 #~ msgid "identical to luksKillSlot - DEPRECATED - see man page"
-#~ msgstr ""
-#~ "identik ke luksKillSlot - DITINGGALKAN - lihat halaman petunjuk penggunaan"
+#~ msgstr "identik ke luksKillSlot - DITINGGALKAN - lihat halaman petunjuk penggunaan"
 
 #~ msgid "modify active device - DEPRECATED - see man page"
-#~ msgstr ""
-#~ "modifikasi perangkat aktif - DITINGGALKAN - lihat halaman petunjuk "
-#~ "penggunaan"
+#~ msgstr "modifikasi perangkat aktif - DITINGGALKAN - lihat halaman petunjuk penggunaan"
 
 #~ msgid ""
-#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case "
-#~ "you really need this functionality.\n"
-#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, "
-#~ "hit Ctrl-C now.\n"
+#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case you really need this functionality.\n"
+#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, hit Ctrl-C now.\n"
 #~ msgstr ""
-#~ "Aksi muat kembali telah ditinggalkan. Mohon gunakan \"dmsetup reload\" "
-#~ "dalam kasus anda benar benar membutuhkan fungsi ini.\n"
-#~ "PERINGATAN: jangan gunakan muat-kembali untuk menyentuk perangkat LUKS. "
-#~ "Jika itu masalahnya, tekan Ctrl-C sekarang.\n"
+#~ "Aksi muat kembali telah ditinggalkan. Mohon gunakan \"dmsetup reload\" dalam kasus anda benar benar membutuhkan fungsi ini.\n"
+#~ "PERINGATAN: jangan gunakan muat-kembali untuk menyentuk perangkat LUKS. Jika itu masalahnya, tekan Ctrl-C sekarang.\n"
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "alokasi memori error dalam action_luksFormat"
 
 #~ msgid "Obsolete option --non-exclusive is ignored.\n"
 #~ msgstr "Pilihan sudah ditinggalkan --no-exclusive diabaikan.\n"
index 637a4d0..00e249d 100644 (file)
Binary files a/po/it.gmo and b/po/it.gmo differ
index 9b362a7..82891ab 100644 (file)
--- a/po/it.po
+++ b/po/it.po
 # Italian translation for cryptsetup.
-# Copyright (C) 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018 Free Software Foundation, Inc.
 # This file is put in the public domain.
 # Sergio Zanchetta <primes2h@ubuntu.com>, 2010, 2011, 2012.
-# Milo Casagrande <milo@milo.name>, 2013, 2014.
+# Milo Casagrande <milo@milo.name>, 2013, 2014, 2015, 2016, 2018, 2019.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup-1.6.7\n"
+"Project-Id-Version: cryptsetup-2.1.0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-19 14:15+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2019-01-28 09:18+0100\n"
 "Last-Translator: Milo Casagrande <milo@milo.name>\n"
 "Language-Team: Italian <tp@lists.linux.it>\n"
 "Language: it\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=2; plural=(n!=1);\n"
-"X-Generator: Poedit 1.7.5\n"
+"X-Generator: Poedit 2.2.1\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"Impossibile inizializzare device-mapper: in esecuzione come utente non-"
-"root.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Impossibile inizializzare device-mapper: in esecuzione come utente non-root."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"Impossibile inizializzare device-mapper. Forse il modulo kernel dm_mod non è "
-"caricato.\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Impossibile inizializzare device-mapper. Forse il modulo kernel dm_mod non è caricato."
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Il flag posticipato richiesto non è supportato."
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "Il DM-UUID per il device %s è stato troncato.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "Il DM-UUID per il dispositivo %s è stato troncato."
+
+#: lib/libdevmapper.c:1520
+#, fuzzy
+msgid "Unknown dm target type."
+msgstr "Tipo PBKDF %s non riconosciuto."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Le opzioni di prestazioni richieste per dm-crypt non sono supportate."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Le opzioni di gestione dei dati rovinati richieste per dm-verity non sono supportate."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Le opzioni FEC dm-verity richieste non sono supportate."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Le opzioni di integrità dei dati richieste non sono supportate."
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Le opzioni di prestazioni richieste per dmcrypt non sono supportate.\n"
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "L'opzione sector_size richiesta non è supportata."
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Il ricalcolo automatico dei tag d'integrità non è supportato."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Discard/TRIM non è supportato."
+
+#: lib/libdevmapper.c:1653
+#, fuzzy
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Le opzioni di integrità dei dati richieste non sono supportate."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Interrogazione del segmento dm-%s non riuscita."
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
-"Il sistema non ha un'entropia sufficiente mentre viene generata la chiave di "
-"volume.\n"
-"Muovere il mouse o digitare del testo in un'altra finestra per accumulare "
-"più eventi casuali.\n"
+"Il sistema non ha un'entropia sufficiente mentre viene generata la chiave di volume.\n"
+"Muovere il mouse o digitare del testo in un'altra finestra per accumulare più eventi casuali.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Generazione chiave (%d%% completato).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr "Errore fatale durante l'inizializzazione dell'RNG.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Esecuzione in modalità FIPS."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr "Qualità richiesta per l'RNG sconosciuta.\n"
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Errore fatale durante l'inizializzazione dell'RNG."
 
-#: lib/random.c:211
-#, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Errore %d nel leggere dall'RNG: %s\n"
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Qualità richiesta per l'RNG sconosciuta."
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr "Impossibile inizializzare il backend crypto RNG.\n"
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Errore nel leggere dall'RNG."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Impossibile inizializzare il backend crypto.\n"
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Impossibile inizializzare il backend crypto RNG."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Impossibile inizializzare il backend crypto."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "L'algoritmo di hash %s non è supportato.\n"
+msgid "Hash algorithm %s not supported."
+msgstr "Algoritmo di hash %s non supportato."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Errore nell'elaborazione della chiave (usando l'hash %s).\n"
+msgid "Key processing error (using hash %s)."
+msgstr "Errore nell'elaborazione della chiave (usando l'hash %s)."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"Impossibile determinare il tipo di device. Attivazione incompatibile del "
-"device?\n"
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Impossibile determinare il tipo di dispositivo. Attivazione incompatibile del dispositivo?"
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Questa operazione è supportata solo per i device LUKS.\n"
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Questa operazione è supportata solo per il dispositivo LUKS."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Tutti gli slot di chiave sono pieni.\n"
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Questa operazione è supportata solo per il dispositivo LUKS2."
 
-#: lib/setup.c:327
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Tutti gli slot di chiave sono pieni."
+
+#: lib/setup.c:434
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr "Lo slot di chiave %d non è valido, selezionarne uno tra 0 e %d.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Lo slot di chiave %d non è valido, selezionarne uno tra 0 e %d."
 
-#: lib/setup.c:333
+#: lib/setup.c:440
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "Lo slot di chiave %d è pieno, selezionarne un altro.\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "Lo slot di chiave %d è pieno, selezionarne un altro."
+
+#: lib/setup.c:525 lib/setup.c:2824
+#, fuzzy
+msgid "Device size is not aligned to device logical block size."
+msgstr "La dimensione del dispositivo non è allineata con la dimensione del settore richiesta."
 
-#: lib/setup.c:472
+#: lib/setup.c:624
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Inserire la passphrase per %s: "
+msgid "Header detected but device %s is too small."
+msgstr "Rilevato un header, ma il dispositivo %s è troppo piccolo."
 
-#: lib/setup.c:653
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Questa operazione non è supportata per questo tipo di dispositivo."
+
+#: lib/setup.c:666
+#, fuzzy
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Re-cifratura offline in corso. Terminato."
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "Rilevato un header, ma il device %s è troppo piccolo.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "Versione %d di LUKS non supportata."
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Questa operazione non è supportata per questo tipo di device.\n"
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Il dispositivo di metadati scollegato non è supportato per questo tipo di cifratura."
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Il device %s non è attivo.\n"
+msgid "Device %s is not active."
+msgstr "Il dispositivo %s non è attivo."
 
-#: lib/setup.c:925
+#: lib/setup.c:1444
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr "Device sottostante a quello cifrato %s scomparso.\n"
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Device sottostante a quello cifrato %s scomparso."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Parametri di cifratura in chiaro non validi.\n"
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Parametri di cifratura in chiaro non validi."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Dimensione della chiave non valida.\n"
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Dimensione della chiave non valida."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "UUID non è supportato per questo tipo di cifratura.\n"
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID non è supportato per questo tipo di cifratura."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Impossibile formattare LUKS senza device.\n"
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Dimensione settore di cifratura non supportato."
 
-#: lib/setup.c:1089
-#, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Impossibile formattare il device %s che risulta ancora in uso.\n"
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "La dimensione del dispositivo non è allineata con la dimensione del settore richiesta."
 
-#: lib/setup.c:1092
-#, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Impossibile formattare il device %s, permessi non concessi.\n"
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Impossibile formattare LUKS senza dispositivo."
 
-#: lib/setup.c:1096
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "L'allineamento dei dati richiesti non è compatibile con l'offset dei dati."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "Attenzione: l'offset dei dati è al di fuori del dispositivo dati attualmente disponibile.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Impossibile ripulire l'header sul device %s.\n"
+msgid "Cannot wipe header on device %s."
+msgstr "Impossibile ripulire l'header sul dispositivo %s."
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Impossibile formattare LOOPAES senza device.\n"
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "Attenzione: l'attivazione del dispositivo non riuscirà, dm-crypt manca il supporto per la dimensione del settore di crittografia richiesta.\n"
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "Impossibile formattare VERITY senza device.\n"
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "La chiave di volume è troppo piccola per la cifratura con estensioni di integrità."
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:1821
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Tipo di hash %d VERITY non supportato.\n"
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Il cifrario %s-%s (dimensione chiave di %zd byte) non è disponibile."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Dimensione blocco VERITY non supportata.\n"
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr ""
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Offset hash VERITY non supportato.\n"
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
 
-#: lib/setup.c:1285
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Richiesto device cifrato di tipo %s sconosciuto.\n"
+msgid "Device %s is too small."
+msgstr "Il dispositivo %s è troppo piccolo."
 
-#: lib/setup.c:1435
-msgid "Do you really want to change UUID of device?"
-msgstr "Cambiare veramente l'UUID del device?"
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Impossibile formattare il dispositivo %s che risulta ancora in uso."
 
-#: lib/setup.c:1545
+#: lib/setup.c:1896 lib/setup.c:1922
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Il volume %s non è attivo.\n"
+msgid "Cannot format device %s, permission denied."
+msgstr "Impossibile formattare il dispositivo %s, permessi non concessi."
 
-#: lib/setup.c:1556
+#: lib/setup.c:1908 lib/setup.c:2229
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Il volume %s è già sospeso.\n"
+msgid "Cannot format integrity for device %s."
+msgstr "Impossibile formattare l'integrità per il dispositivo %s."
 
-#: lib/setup.c:1563
+#: lib/setup.c:1926
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "La sospensione non è supportata per il device %s.\n"
+msgid "Cannot format device %s."
+msgstr "Impossibile formattare il dispositivo %s."
 
-#: lib/setup.c:1565
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Impossibile formattare LOOPAES senza dispositivo."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Impossibile formattare VERITY senza dispositivo."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Errore durante la sospensione del device %s.\n"
+msgid "Unsupported VERITY hash type %d."
+msgstr "Tipo di hash %d VERITY non supportato."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Dimensione blocco VERITY non supportata."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Offset hash VERITY non supportato."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Offset FEC VERITY non supportato."
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "L'area dati si sovrappone a quella di hash."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "L'area di hash si sovrappone a quella FEC."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "L'area dati si sovrappone a quella FEC."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:2208
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Il volume %s non è sospeso.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
 
-#: lib/setup.c:1605
+#: lib/setup.c:2286
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Il ripristino non è supportato per il device %s.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Richiesto dispositivo cifrato di tipo %s sconosciuto."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Errore durante il ripristino del device %s.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Parametri non supportati sul dispositivo %s."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Inserire la passphrase: "
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Parametri non corrispondenti sul dispositivo %s."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
 msgstr ""
-"Impossibile aggiungere uno slot di chiave, tutti gli slot sono disabilitati "
-"e nessuna chiave di volume è stata fornita.\n"
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Inserire una delle passphrase esistenti: "
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "Stat del dispositivo %s non riuscita."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Inserire la nuova passphrase per lo slot di chiave: "
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, fuzzy, c-format
+msgid "Failed to suspend device %s."
+msgstr "Stat del dispositivo %s non riuscita."
 
-#: lib/setup.c:1798
-#, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Slot di chiave %d cambiato.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "Stat del dispositivo %s non riuscita."
 
-#: lib/setup.c:1801
+#: lib/setup.c:2732
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Sostituito con lo slot di chiave %d.\n"
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr ""
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Sostituzione del nuovo slot di chiave non riuscita.\n"
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Stat del dispositivo %s non riuscita."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "La chiave di volume non corrisponde al volume.\n"
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Impossibile ridimensionare un dispositivo di loopback."
 
-#: lib/setup.c:1961
-#, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Lo slot di chiave %d non è valido.\n"
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "Cambiare veramente l'UUID del dispositivo?"
+
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Il file di backup dell'header non contiene un header LUKS compatibile."
 
-#: lib/setup.c:1966
+#: lib/setup.c:3058
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Lo slot di chiave %d non è utilizzato.\n"
+msgid "Volume %s is not active."
+msgstr "Il volume %s non è attivo."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:3069
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Esiste già un device %s.\n"
+msgid "Volume %s is already suspended."
+msgstr "Il volume %s è già sospeso."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr ""
-"Specificata una chiave di volume non corretta per il device in chiaro.\n"
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "La sospensione non è supportata per il dispositivo %s."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
-msgstr "Specificato un hash root non corretto per il device verity.\n"
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "Errore durante la sospensione del dispositivo %s."
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Il tipo di device non è inizializzato correttamente.\n"
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "Il volume %s non è sospeso."
 
-#: lib/setup.c:2259
+#: lib/setup.c:3146
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Il device %s è ancora in uso.\n"
+msgid "Resume is not supported for device %s."
+msgstr "Il ripristino non è supportato per il dispositivo %s."
 
-#: lib/setup.c:2268
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Device %s non valido.\n"
+msgid "Error during resuming device %s."
+msgstr "Errore durante il ripristino del dispositivo %s."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Funzione non disponibile in modalità FIPS.\n"
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "La chiave di volume non corrisponde al volume."
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Buffer di chiave del volume troppo piccolo.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Impossibile aggiungere uno slot di chiave, tutti gli slot sono disabilitati e nessuna chiave di volume è stata fornita."
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "Impossibile recuperare la chiave di volume per il device in chiaro.\n"
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Sostituzione del nuovo slot di chiave non riuscita."
 
-#: lib/setup.c:2310
+#: lib/setup.c:3669
 #, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Questa operazione non è supportata per il device cifrato %s.\n"
+msgid "Key slot %d is invalid."
+msgstr "Lo slot di chiave %d non è valido."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr "L'operazione di dump non è supportata per questo tipo di device.\n"
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Lo slot di chiave %d non è attivo."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Impossibile ottenere la priorità del processo.\n"
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "L'header del dispositivo si sovrappone all'area dati."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Impossibile sbloccare la memoria.\n"
+#: lib/setup.c:3981
+#, fuzzy
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Re-cifratura in corso."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Memoria esaurita durante la lettura della passphrase.\n"
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+#, fuzzy
+msgid "Failed to get reencryption lock."
+msgstr "Impossibile acquisire blocco del dispositivo di scrittura."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Errore nel leggere la passphrase dal terminale.\n"
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+#, fuzzy
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Dimensione settore di cifratura non supportato."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Verifica passphrase: "
+#: lib/setup.c:4127 lib/setup.c:4379
+#, fuzzy
+msgid "Device type is not properly initialized."
+msgstr "Il tipo di dispositivo non è inizializzato correttamente."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Le passphrase non corrispondono.\n"
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Impossibile formattare il dispositivo %s che risulta ancora in uso."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Impossibile usare l'offset con l'input da terminale.\n"
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "Esiste già un dispositivo %s."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "Apertura del file chiave non riuscita.\n"
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Specificata una chiave di volume non corretta per il dispositivo in chiaro."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "Stat del file chiave non riuscito.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Specificato un hash root non corretto per il dispositivo verity."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr "Impossibile posizionarsi all'offset del file di chiave richiesto.\n"
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr ""
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Errore nel leggere la passphrase.\n"
+#: lib/setup.c:4421
+#, fuzzy
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Il portachiavi del kernel non è supportato dal kernel."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Dimensione massima del file chiave superata.\n"
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Caricamento chiave nel portachiavi del kernel non riuscito."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "Impossibile leggere la quantità richiesta di dati.\n"
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Il dispositivo %s è ancora in uso."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/setup.c:4516
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Il device %s non esiste oppure è negato l'accesso.\n"
+msgid "Invalid device %s."
+msgstr "Device %s non valido."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr ""
-"Impossibile usare un device di loopback, in esecuzione come utente non "
-"root.\n"
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Buffer di chiave del volume troppo piccolo."
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Impossibile trovare un device di loopback libero.\n"
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Impossibile recuperare la chiave di volume per il dispositivo in chiaro."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
-"Collegamento del device di loopback non riuscito (è richiesto un device di "
-"loop con flag autoclear).\n"
+#: lib/setup.c:4657
+#, fuzzy
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Specificato un hash root non corretto per il dispositivo verity."
 
-#: lib/utils_device.c:484
+#: lib/setup.c:4659
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
-msgstr ""
-"Impossibile disporre del device %s il quale è in uso (già mappato o "
-"montato).\n"
+msgid "This operation is not supported for %s crypt device."
+msgstr "Questa operazione non è supportata per il dispositivo cifrato %s."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "L'operazione di dump non è supportata per questo tipo di dispositivo."
 
-#: lib/utils_device.c:488
+#: lib/setup.c:5190
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Impossibile ottenere informazioni sul device %s.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr ""
 
-#: lib/utils_device.c:494
+#: lib/setup.c:5475
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr "L'offset richiesto è oltre la dimensione reale del device %s.\n"
+msgid "Cannot convert device %s which is still in use."
+msgstr "Impossibile convertire il dispositivo %s che risulta ancora in uso."
 
-#: lib/utils_device.c:502
+#: lib/setup.c:5772
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Il device %s ha dimensione zero.\n"
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Assegnamento slot di chiave %u come nuova chiave del volume non riuscito."
+
+#: lib/setup.c:5845
+#, fuzzy
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Inizializzazione parametri predefiniti per lo slot di chiave LUKS2 non riuscita."
 
-#: lib/utils_device.c:513
+#: lib/setup.c:5851
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Il device %s è troppo piccolo.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Assegnazione slot di chiave %d al digest non riuscita."
 
-#: lib/luks1/keyencryption.c:37
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Il portachiavi del kernel non è supportato dal kernel."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid ""
-"Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
-msgstr ""
-"Impostazione mappatura di chiave dm-crypt non riuscita per il device %s.\n"
-"Controllare che il kernel supporti il cifrario %s (controllare il syslog per "
-"maggiori informazioni).\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Lettura della passphrase dal portachiavi non riuscita (errore %d)."
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
 msgstr ""
-"La dimensione della chiave in modalità XTS deve essere 256 o 512 bit.\n"
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
-#, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Impossibile scrivere sul device %s, permessi non concessi.\n"
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Impossibile ottenere la priorità del processo."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Impossibile sbloccare la memoria."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Apertura del file chiave non riuscita."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Impossibile leggere il file chiave dal terminale."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Stat del file chiave non riuscito."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Impossibile posizionarsi all'offset del file di chiave richiesto."
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr "Apertura del device temporaneo di deposito chiavi non riuscita.\n"
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Memoria esaurita durante la lettura della passphrase."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr "Accesso al device temporaneo di deposito chiavi non riuscito.\n"
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Errore nel leggere la passphrase."
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Errore di IO durante la cifratura dello slot di chiave.\n"
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Nessun dato da leggere sull'input."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "Errore di IO durante la decifratura dello slot di chiave.\n"
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Dimensione massima del file chiave superata."
 
-#: lib/luks1/keymanage.c:90
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Impossibile leggere la quantità richiesta di dati."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, fuzzy, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Il dispositivo %s non esiste oppure è negato l'accesso."
+
+#: lib/utils_device.c:197
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr "Il device %s è troppo piccolo (LUKS richiede almeno %<PRIu64> byte).\n"
+msgid "Device %s is not compatible."
+msgstr "Il dispositivo %s non è compatibile."
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/utils_device.c:642
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "Il device %s non è un device LUKS valido.\n"
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Il dispositivo %s è troppo piccolo, sono necessari almeno %<PRIu64> byte."
 
-#: lib/luks1/keymanage.c:198
+#: lib/utils_device.c:723
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Il file di backup dell'header %s richiesto esiste già.\n"
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Impossibile utilizzare il dispositivo %s il quale è in uso (già mappato o montato)."
 
-#: lib/luks1/keymanage.c:200
+#: lib/utils_device.c:727
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Impossibile creare il file di backup dell'header %s.\n"
+msgid "Cannot use device %s, permission denied."
+msgstr "Impossibile usare il dispositivo %s, permessi negati."
 
-#: lib/luks1/keymanage.c:205
+#: lib/utils_device.c:730
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Impossibile scrivere il file di backup dell'header %s.\n"
+msgid "Cannot get info about device %s."
+msgstr "Impossibile ottenere informazioni sul dispositivo %s."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Il file di backup non contiene un header LUKS valido.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Impossibile usare un dispositivo di loopback, in esecuzione come utente non root."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Collegamento del dispositivo di loopback non riuscito (è richiesto un dispositivo di loop con flag autoclear)."
+
+#: lib/utils_device.c:809
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Impossibile aprire il file di backup dell'header %s.\n"
+msgid "Requested offset is beyond real size of device %s."
+msgstr "L'offset richiesto è oltre la dimensione reale del dispositivo %s."
 
-#: lib/luks1/keymanage.c:258
+#: lib/utils_device.c:817
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Impossibile leggere il file di backup dell'header %s.\n"
+msgid "Device %s has zero size."
+msgstr "Il dispositivo %s ha dimensione zero."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"L'offset di dati oppure la dimensione della chiave sono diversi tra il "
-"device e il backup, ripristino non riuscito.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Il tempo PBKDF richiesto non può essere zero."
 
-#: lib/luks1/keymanage.c:277
+#: lib/utils_pbkdf.c:106
 #, c-format
-msgid "Device %s %s%s"
-msgstr "Il device %s %s%s"
+msgid "Unknown PBKDF type %s."
+msgstr "Tipo PBKDF %s non riconosciuto."
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"non contiene un header LUKS. La sostituzione dell'header può distruggere i "
-"dati in quel device."
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "L'hash %s richiesto non è supportato."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"contiene già un header LUKS. La sostituzione dell'header distruggerà gli "
-"slot di chiave esistenti."
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Il tipo PBKDF richiesto non è supportato per LUKS1."
 
-#: lib/luks1/keymanage.c:280
-msgid ""
-"\n"
-"WARNING: real device header has different UUID than backup!"
-msgstr ""
-"\n"
-"ATTENZIONE: l'header reale del device ha un UUID diverso da quello di backup."
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Memoria massima o thread paralleli PBKDF non devono essere impostati con pbkdf2."
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Impossibile aprire il device %s.\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Il conteggio delle iterazioni forzate è troppo basso per %s (minimo è %u)."
 
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr ""
-"Dimensione non standard della chiave, è richiesta una riparazione manuale.\n"
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Il costo della memoria forzata è troppo basso per %s (minimo è %u kilobyte)."
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
-"Allineamento slot di chiave non standard, richiesta riparazione manuale.\n"
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Il costo massimo richiesto per la memoria PBKDF è troppo elevato (massimo è %d kilobyte)."
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Riparazione degli slot di chiave.\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "La memoria PBKDF massima richiesta non può essere zero."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Riparazione non riuscita."
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "I thread paralleli PBKDF richiesti non possono essere zero."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr ""
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Benchmark PBKDF disabilitato, ma iterazioni non impostate."
 
-#: lib/luks1/keymanage.c:363
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Slot di chiave %i: offset riparato (%u -> %u).\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Opzioni PBKDF2 non compatibili (usando l'algoritmo di hash %s)."
 
-#: lib/luks1/keymanage.c:371
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Opzioni PBKDF non compatibili."
+
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Slot di chiave %i: strisce riparate (%u -> %u).\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Blocco interrotto. Il percorso di blocco %s/%s è inutilizzabile (non una directory o mancante)."
 
-#: lib/luks1/keymanage.c:380
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Slot di chiave %i: firma della partizione inesistente.\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "Attenzione: la directory di blocco %s/%s non esiste.\n"
 
-#: lib/luks1/keymanage.c:385
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Slot di chiave %i: salt ripulita.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Blocco interrotto. Il percorso di blocco %s/%s è inutilizzabile (%s non è una directory)."
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "Scrittura dell'header LUKS sul disco.\n"
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Impossibile posizionarsi all'offset del dispositivo."
 
-#: lib/luks1/keymanage.c:421
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Versione %d di LUKS non supportata.\n"
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr ""
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
+#: lib/luks1/keyencryption.c:39
 #, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "L'hash %s di LUKS richiesto non è supportato.\n"
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"Impostazione mappatura di chiave dm-crypt non riuscita per il dispositivo %s.\n"
+"Controllare che il kernel supporti il cifrario %s (controllare syslog per maggiori informazioni)."
 
-#: lib/luks1/keymanage.c:442
-#, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "Lo slot di chiave LUKS %u non è valido.\n"
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "La dimensione della chiave in modalità XTS deve essere 256 o 512 bit."
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "Nessun problema conosciuto rilevato per l'header LUKS.\n"
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "La specifica del cifrario dovrebbe essere nel formato [cifrario]-[modalità]-[iv]."
 
-#: lib/luks1/keymanage.c:596
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
 #, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Errore durante l'aggiornamento dell'header LUKS sul device %s.\n"
+msgid "Cannot write to device %s, permission denied."
+msgstr "Impossibile scrivere sul dispositivo %s, permessi negati."
 
-#: lib/luks1/keymanage.c:603
-#, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Errore nel rileggere l'header LUKS dopo l'aggiornamento sul device %s.\n"
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Apertura del dispositivo temporaneo di deposito chiavi non riuscita."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Accesso al dispositivo temporaneo di deposito chiavi non riuscito."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Errore di IO durante la cifratura dello slot di chiave."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"L'offset dei dati per l'header LUKS scollegato deve essere 0 o maggiore "
-"della dimensione dell'header (%d settori).\n"
+msgid "Cannot open device %s."
+msgstr "Impossibile aprire il dispositivo %s."
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Fornito un formato UUID per LUKS errato.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Errore di IO durante la decifratura dello slot di chiave."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr "Impossibile creare l'header LUKS: lettura salt casuale non riuscita.\n"
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Il dispositivo %s è troppo piccolo (LUKS1 richiede almeno %<PRIu64> byte)."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
 #, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Opzioni PBKDF2 non compatibili (usando l'algoritmo di hash %s).\n"
+msgid "LUKS keyslot %u is invalid."
+msgstr "Lo slot di chiave LUKS %u non è valido."
 
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Impossibile creare l'header LUKS: digest dell'header non riuscito (usando "
-"l'hash %s).\n"
+msgid "Device %s is not a valid LUKS device."
+msgstr "Il dispositivo %s non è un dispositivo LUKS valido."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "Slot di chiave %d attivo, eliminarlo prima.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Il file di backup dell'header %s richiesto esiste già."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Il materiale dello slot di chiave %d contiene troppe poche strisce. "
-"Manipolazione dell'header?\n"
+msgid "Cannot create header backup file %s."
+msgstr "Impossibile creare il file di backup dell'header %s."
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Slot di chiave %d sbloccato.\n"
+msgid "Cannot write header backup file %s."
+msgstr "Impossibile scrivere il file di backup dell'header %s."
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Nessuna chiave disponibile con questa passphrase.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+#, fuzzy
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Il file di backup non contiene un header LUKS valido."
 
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr "Lo slot di chiave %d non è valido, selezionarne uno tra 0 e %d.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Impossibile aprire il file di backup dell'header %s."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Impossibile ripulire il device %s.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Impossibile leggere il file di backup dell'header %s."
 
-#: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr "Rilevato un file chiave cifrato con GPG non ancora supportato.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "L'offset di dati oppure la dimensione della chiave sono diversi tra il dispositivo e il backup, ripristino non riuscito."
 
-#: lib/loopaes/loopaes.c:147
-msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
-msgstr "Usare gpg --decrypt <FILECHIAVE> | cryptsetup --keyfile=- ...\n"
+#: lib/luks1/keymanage.c:325
+#, c-format
+msgid "Device %s %s%s"
+msgstr "Il dispositivo %s %s%s"
 
-#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Rilevato file chiave loop-AES non compatibile.\n"
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "non contiene un header LUKS. La sostituzione dell'header può distruggere i dati in quel dispositivo."
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "contiene già un header LUKS. La sostituzione dell'header distruggerà gli slot di chiave esistenti."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr "Il kernel non supporta la mappatura compatibile loop-AES.\n"
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
+msgstr ""
+"\n"
+"Attenzione: l'header reale del dispositivo ha un UUID diverso da quello di backup."
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Dimensione non standard della chiave, è richiesta una riparazione manuale."
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Allineamento slot di chiave non standard, richiesta riparazione manuale."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Riparazione degli slot di chiave."
+
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Slot di chiave %i: offset riparato (%u -> %u)."
+
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Errore nel leggere il file chiave %s.\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Slot di chiave %i: strisce riparate (%u -> %u)."
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr "Lunghezza massima (%d) della passphrase TCRYPT superata.\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Slot di chiave %i: firma della partizione non corretta."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr "L'algoritmo di hash PBKDF2 %s non è disponibile, viene saltato.\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Slot di chiave %i: salt ripulito."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr "Interfaccia kernel richiesta del cifrario non è disponibile.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Scrittura dell'header LUKS sul disco."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr "Assicurarsi di avere il modulo del kernel algif_skcipher caricato.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Riparazione non riuscita."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "L'attivazione non è supportata per la dimensione del settore di %d.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "L'hash %s di LUKS richiesto non è supportato."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr ""
-"Il kernel non supporta l'attivazione per questa modalità legacy TCRYPT.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Nessun problema conosciuto rilevato per l'header LUKS."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "Attivazione sistema di cifratura TCRYPT per la partizione %s.\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Errore durante l'aggiornamento dell'header LUKS sul dispositivo %s."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr "Il kernel non supporta la mappatura compatibile TCYPRT.\n"
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Errore nel rileggere l'header LUKS dopo l'aggiornamento sul dispositivo %s."
 
-#: lib/tcrypt/tcrypt.c:1020
-msgid "This function is not supported without TCRYPT header load."
-msgstr "Questa funzione non è supportata senza l'header TCRYPT caricato."
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "L'offset dei dati per l'header LUKS deve essere 0 o maggiore della dimensione dell'header."
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Fornito un formato UUID per LUKS errato."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Impossibile creare l'header LUKS: lettura salt casuale non riuscita."
+
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Il device verity %s non usa header on-disk.\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Impossibile creare l'header LUKS: digest dell'header non riuscito (usando l'hash %s)."
 
-#: lib/verity/verity.c:94
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Il device %s non è un device VERITY valido.\n"
+msgid "Key slot %d active, purge first."
+msgstr "Slot di chiave %d attivo, eliminarlo prima."
 
-#: lib/verity/verity.c:101
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "Versione %d di VERITY non supportata.\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Il materiale dello slot di chiave %d contiene troppe poche strisce. Manipolazione dell'header?"
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "Header VERITY danneggiato.\n"
+#: lib/luks1/keymanage.c:990
+#, fuzzy, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Errore nell'elaborazione della chiave (usando l'hash %s)."
 
-#: lib/verity/verity.c:166
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Fornito un formato UUID per VERITY errato sul device %s.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Lo slot di chiave %d non è valido, selezionarne uno tra 0 e %d."
 
-#: lib/verity/verity.c:196
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Errore durante l'aggiornamento dell'header verity sul device %s.\n"
+msgid "Cannot wipe device %s."
+msgstr "Impossibile ripulire il dispositivo %s."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "Il kernel non supporta la mappatura dm-verity.\n"
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Rilevato un file chiave cifrato con GPG non ancora supportato."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr "Il device verity ha rilevato un'anomalia dopo l'attivazione.\n"
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "Usare gpg --decrypt <FILECHIAVE> | cryptsetup --keyfile=- ...\n"
 
-#: lib/verity/verity_hash.c:59
-#, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "L'area spare non risulta essere a zero alla posizione %<PRIu64>.\n"
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Rilevato file chiave loop-AES non compatibile."
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Overflow offset del device.\n"
+#: lib/loopaes/loopaes.c:245
+#, fuzzy
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Il kernel non supporta la mappatura compatibile loop-AES."
 
-#: lib/verity/verity_hash.c:161
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "Verifica alla posizione %<PRIu64> non riuscita.\n"
+msgid "Error reading keyfile %s."
+msgstr "Errore nel leggere il file chiave %s."
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Parametri della dimensione non validi per il device verity.\n"
+#: lib/tcrypt/tcrypt.c:554
+#, fuzzy, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Lunghezza massima (%d) della passphrase TCRYPT superata."
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Troppi livelli d'albero per il volume verity.\n"
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "L'algoritmo di hash PBKDF2 %s non è disponibile, viene saltato."
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "Verifica dell'area dati non riuscita.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "L'interfaccia kernel richiesta del cifrario non è disponibile."
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "Verifica dall'hash principale non riuscita.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Assicurarsi di avere il modulo del kernel algif_skcipher caricato."
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr "Errore di input/output nel creare l'area hash.\n"
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "Attivazione non supportata per la dimensione del settore di %d."
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "Creazione dell'area hash non riuscita.\n"
+#: lib/tcrypt/tcrypt.c:759
+#, fuzzy
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Il kernel non supporta l'attivazione per questa modalità legacy TCRYPT."
 
-#: lib/verity/verity_hash.c:414
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-"Attenzione: il kernel non può attivare il device se la dimensione del blocco "
-"dati supera la dimensione di pagina (%u).\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Attivazione sistema di cifratura TCRYPT per la partizione %s."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr "Impossibile verificare la passphrase su input non tty.\n"
+#: lib/tcrypt/tcrypt.c:871
+#, fuzzy
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Il kernel non supporta la mappatura compatibile TCYPRT."
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "Questa funzione non è supportata senza l'header TCRYPT caricato."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Non è stato rilevato alcun modello noto di specifica di cifrario.\n"
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr ""
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
 msgstr ""
-"Attenzione: il parametro --hash viene ignorato in modalità normale con file "
-"di chiave specificato.\n"
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
 msgstr ""
-"Attenzione: l'opzione --keyfile-size viene ignorata, la dimensione di "
-"lettura è la stessa della dimensione della chiave di cifratura.\n"
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "È richiesta l'opzione --key-file.\n"
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr ""
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Nessun header di device rilevato con questa passphrase.\n"
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Letture dei requisiti LUKS2 non riuscita."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
 msgstr ""
-"Il dump dell'header LUKS con la chiave di volume contiene informazioni\n"
-"confidenziali che permettono di accedere alla partizione cifrata senza "
-"passphrase.\n"
-"Questo dump dovrebbe sempre essere salvato in modo cifrato in un luogo "
-"sicuro."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Il risultato del benchmark non è attendibile.\n"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr ""
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
 msgstr ""
-"# I test sono aprossimati usando solo la memoria (nessun IO dall'archivio).\n"
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "#  Algoritmo | Chiave |  Cifratura |  Decifratura\n"
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Dimensione settore di cifratura non supportato."
+
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Letture dei requisiti LUKS2 non riuscita."
+
+#: lib/bitlk/bitlk.c:543
+#, fuzzy, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Letture dei requisiti LUKS2 non riuscita."
+
+#: lib/bitlk/bitlk.c:594
+#, fuzzy
+msgid "Unknown or unsupported encryption type."
+msgstr "Dimensione settore di cifratura non supportato."
+
+#: lib/bitlk/bitlk.c:627
+#, fuzzy, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Letture dei requisiti LUKS2 non riuscita."
+
+#: lib/bitlk/bitlk.c:921
+#, fuzzy
+msgid "This operation is not supported."
+msgstr "Questa operazione non è supportata per il dispositivo cifrato %s."
+
+#: lib/bitlk/bitlk.c:929
+#, fuzzy
+msgid "Wrong key size."
+msgstr "Dimensione della chiave non valida."
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr ""
 
-#: src/cryptsetup.c:587
+#: lib/bitlk/bitlk.c:987
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Il cifrario %s non è disponibile.\n"
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr ""
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "N/D"
+#: lib/bitlk/bitlk.c:1069
+#, fuzzy
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Attivazione del dispositivo temporaneo non riuscita."
 
-#: src/cryptsetup.c:639
-#, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Impossibile leggere il file chiave %s.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr ""
 
-#: src/cryptsetup.c:643
-#, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Impossibile leggere %d byte dal file chiave %s.\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr ""
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Provare a riparare l'header del device LUKS?"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, fuzzy, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Il dispositivo verity %s non usa header su disco."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity.c:90
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Ciò sovrascriverà i dati in %s in modo irreversibile."
+msgid "Device %s is not a valid VERITY device."
+msgstr "Il dispositivo %s non è un dispositivo VERITY valido."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "errore di allocazione di memoria in action_luksFormat"
-
-#: src/cryptsetup.c:717
+#: lib/verity/verity.c:97
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Impossibile usare %s come header on-disk.\n"
+msgid "Unsupported VERITY version %d."
+msgstr "Versione %d di VERITY non supportata."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
-"L'offset di dati ridotti è ammesso solo per l'header LUKS scollegato.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Header VERITY danneggiato."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity.c:165
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Slot di chiave %d selezionato per l'eliminazione.\n"
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Fornito un formato UUID per VERITY errato sul dispositivo %s."
 
-#: src/cryptsetup.c:884
+#: lib/verity/verity.c:198
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Chiave %d non attiva. Impossibile ripulirla.\n"
+msgid "Error during update of verity header on device %s."
+msgstr "Errore durante l'aggiornamento dell'header verity sul dispositivo %s."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
-msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
-msgstr ""
-"Questo è l'ultimo slot di chiave. Il device sarà inutilizzabile dopo aver "
-"eliminato questa chiave."
-
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Inserire una delle passphrase rimanenti: "
+#: lib/verity/verity.c:256
+#, fuzzy
+msgid "Root hash signature verification is not supported."
+msgstr "L'hash %s richiesto non è supportato."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Inserire la passphrase da eliminare: "
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Impossibile risolvere gli errori con dispositivo FEC."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/verity/verity.c:269
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Inserire una delle passphrase esistenti: "
-
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Inserire la passphrase da cambiare: "
+msgid "Found %u repairable errors with FEC device."
+msgstr "Trovati %u errori risolubili con dispositivo FEC."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Inserire la nuova passphrase: "
+#: lib/verity/verity.c:308
+#, fuzzy
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Il kernel non supporta la mappatura dm-verity."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr "È supportato un solo argomento device per ogni operazione isLuks.\n"
+#: lib/verity/verity.c:312
+#, fuzzy
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Il kernel non supporta la mappatura dm-verity."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "È richiesta l'opzione --header-backup-file.\n"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Il dispositivo verity ha rilevato un'anomalia dopo l'attivazione."
 
-#: src/cryptsetup.c:1304
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Tipo di dispositivo meta-data %s non riconosciuto.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "L'area spare non risulta essere a zero alla posizione %<PRIu64>."
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
-msgstr "Il comando richiede un device e un nome di mappatura come argomenti.\n"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Overflow offset del dispositivo."
 
-#: src/cryptsetup.c:1326
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
-msgstr ""
-"Questa operazione eliminerà tutti gli slot di chiave sul device %s.\n"
-"Il device sarà inutilizzabile dopo questa operazione."
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Verifica alla posizione %<PRIu64> non riuscita."
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<device> [--type <tipo>] [<nome>]"
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Parametri della dimensione non validi per il dispositivo verity."
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "Apre il device come mappatura in <nome>"
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Overflow dell'area di hash."
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<nome>"
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Verifica dell'area dati non riuscita."
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "Chiude il device (rimuove la mappatura)"
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Verifica dall'hash root non riuscita."
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "Ridimensiona il device attivo"
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Errore di input/output nel creare l'area hash."
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "Mostra lo stato del device"
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Creazione dell'area hash non riuscita."
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "Esegue benchmark del cifrario"
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "Attenzione: il kernel non può attivare il dispositivo se la dimensione del blocco dati supera la dimensione di pagina (%u)."
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<device>"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Allocazione contesto RS non riuscita."
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr "Prova a riparare i meta-dati on-disk"
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Allocazione buffer non riuscita."
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
-msgstr "Elimina tutti gli slot di chiavi (rimuove chiave di cifratura)"
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Lettura del blocco RS %<PRIu64> byte %d non riuscita."
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<device> [<nuovo file chiave>]"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Lettura bit di parità per il blocco RS %<PRIu64> non riuscita."
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "Formatta un device LUKS"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Ripristino della parità per il blocco %<PRIu64> non riuscito."
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "Aggiunge la chiave al device LUKS"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Scrittura della parità per il blocco RS %<PRIu64> non riuscita."
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
-msgstr "<device> [<file chiave>]"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Le dimensioni del blocco devono corrispondere per FEC."
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "Rimuove la chiave fornita o il file chiave dal device LUKS"
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Numero di byte di parità non valido."
 
-#: src/cryptsetup.c:1370
-msgid "changes supplied key or key file of LUKS device"
-msgstr "Cambia la chiave fornita o il file chiave del device LUKS"
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Impossibile determinare la dimensione per il dispositivo %s."
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<device> <slot di chiave>"
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+#, fuzzy
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Il kernel non supporta la mappatura dm-integrity."
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr "Ripulisce la chiave con numero <slot di chiave> dal device LUKS"
+#: lib/integrity/integrity.c:277
+#, fuzzy
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Il kernel non supporta la mappatura dm-integrity."
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "Stampa l'UUID del device LUKS"
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Impossibile acquisire il blocco di scrittura sul dispositivo %s."
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "Verifica l'header della partizione LUKS di <device>"
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
-msgstr "Esegue il dump delle informazioni sulla partizione LUKS"
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+"Il dispositivo contiene firme ambigue, impossibile recuperare automaticamente LUKS2.\n"
+"Eseguire \"cryptsetup repair\" per il recupero."
 
-#: src/cryptsetup.c:1375
-msgid "dump TCRYPT device information"
-msgstr "Esegue il dump delle informazioni TCRYPT del device"
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "L'offset dati richiesto è troppo piccolo."
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"Sospende il device LUKS e ripulisce la chiave (tutti gli I/O sono congelati)."
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "Attenzione: l'area degli slot di chiave è molto piccola (%<PRIu64> byte), il conteggio degli slot di chiave LUKS2 disponibili è limitato.\n"
+
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Impossibile acquisire il blocco di lettura sul dispositivo %s."
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Ripristina il device LUKS sospeso."
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Rilevati requisiti LUKS2 proibiti nel backup %s."
 
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
-msgstr "Fa il backup dell'header del device e degli slot di chiave"
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "L'offset di dati è diverso tra il dispositivo e il backup, ripristino non riuscito."
 
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
-msgstr "Ripristina l'header del device LUKS e gli slot di chiave"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "L'header binario con dimensione aree dello slot di chiave è diverso tra il dispositivo e il backup, ripristino non riuscito."
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Il dispositivo %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "non contiene un header LUKS2. La sostituzione dell'header può distruggere i dati su quel dispositivo."
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "contiene già un header LUKS2. La sostituzione dell'header distruggerà gli slot di chiave esistenti."
+
+#: lib/luks2/luks2_json_metadata.c:1225
 msgid ""
 "\n"
-"<action> is one of:\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
 "\n"
-"<azione> è una tra:\n"
+"Attenzione: requisiti LUKS2 sconosciuti rilevati nell'header del dispositivo reale.\n"
+"La sostituzione dell'header con il backup può danneggiare i dati su quel dispositivo."
 
-#: src/cryptsetup.c:1402
+#: lib/luks2/luks2_json_metadata.c:1227
 msgid ""
 "\n"
-"You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"Attenzione: rilevata re-cifratura non completata sul dispositivo.\n"
+"La sostituzione dell'header con il backup potrebbe danneggiare i dati."
+
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Flag %s sconosciuto ignorato."
+
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "Interrogazione del segmento dm-%s non riuscita."
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+#, fuzzy
+msgid "Failed to set dm-linear segment."
+msgstr "Interrogazione del segmento dm-%s non riuscita."
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Letture dei requisiti LUKS2 non riuscita."
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Rilevati requisiti LUKS2 non soddisfatti."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "Slot di chiave %i: salt ripulito."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, fuzzy, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Slot di chiave LUKS2: il cifrario usato per la cifratura dello slot di chiave"
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Spazio insufficiente per il nuovo slot di chiave."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, fuzzy, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Impossibile controllare lo stato del dispositivo con UUID: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Impossibile convertire l'header con metadati LUKSMETA aggiuntivi."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Impossibile spostare l'area dello slot di chiave: spazio insufficiente."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+#, fuzzy
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Impossibile spostare l'area dello slot di chiave: spazio insufficiente."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Impossibile spostare l'area dello slot di chiave."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+#, fuzzy
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Impossibile convertire al formato LUKS1: lo slot di chiave %u non è compatibile con LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Impossibile convertire al formato LUKS1: i digest dello slot di chiave non sono compatibili con LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Impossibile convertire al formato LUKS1: il dispositivo utilizza una chiave di cifrario %s con wrapper."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Impossibile convertire al formato LUKS1: l'header LUKS2 contiene %u token."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Impossibile convertire al formato LUKS1: lo slot di chiave %u è in uno stato non valido."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Impossibile convertire al formato LUKS1: lo slot %u (oltre gli slot massimi) è ancora attivo."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Impossibile convertire al formato LUKS1: lo slot di chiave %u non è compatibile con LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, fuzzy, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "La dimensione del dispositivo %s non è allineata con la dimensione del settore richiesta (%u byte)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Parametri non supportati sul dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+#, fuzzy
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Inizializzazione sonde per la firma del dispositivo non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Inizializzazione sonde per la firma del dispositivo non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "Lettura dei requisiti dall'header di backup non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, fuzzy, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Lettura bit di parità per il blocco RS %<PRIu64> non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Stat del dispositivo %s non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Impossibile determinare la dimensione per il dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Stat del dispositivo %s non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, fuzzy, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Esame del dispositivo %s per una firma non riuscito."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Impossibile determinare la dimensione per il dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+#, fuzzy
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Impossibile acquisire il blocco di lettura sul dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "Sostituzione del nuovo slot di chiave non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, fuzzy, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "La dimensione del dispositivo %s non è allineata con la dimensione del settore richiesta (%u byte)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, fuzzy, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "La dimensione del dispositivo %s non è allineata con la dimensione del settore richiesta (%u byte)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, fuzzy, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Impossibile utilizzare il dispositivo %s il quale è in uso (già mappato o montato)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+#, fuzzy
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Allocazione contesto RS non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "Recupero del token %d per l'esportazione non riuscito."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "Il dispositivo %s non è attivo."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+#, fuzzy
+msgid "Reencryption process is already running."
+msgstr "Re-cifratura in corso."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+#, fuzzy
+msgid "Failed to acquire reencryption lock."
+msgstr "Impossibile acquisire blocco del dispositivo di scrittura."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2750
+#, fuzzy
+msgid "Active device size and requested reencryption size don't match."
+msgstr "La dimensione del dispositivo non è allineata con la dimensione del settore richiesta."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2834
+#, fuzzy
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Re-cifratura in corso."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2913
+#, fuzzy
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Inizializzazione parametri predefiniti per lo slot di chiave LUKS2 non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+#, fuzzy
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Esame del dispositivo %s per una firma non riuscito."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+#, fuzzy
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Scrittura dei flag di attivazione sul nuovo header non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+#, fuzzy
+msgid "Decryption failed."
+msgstr "Riparazione non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Scrittura della parità per il blocco RS %<PRIu64> non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+#, fuzzy
+msgid "Failed to sync data."
+msgstr "Impostazione offset dei dati non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "Letture dei requisiti LUKS2 non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+#, fuzzy
+msgid "Failed to wipe backup segment data."
+msgstr "Pulizia della firma del dispositivo non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+#, fuzzy
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Letture dei requisiti LUKS2 non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "Inizializzazione sonde per la firma del dispositivo non riuscita."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+#, fuzzy
+msgid "Failed to update reencryption context."
+msgstr "Allocazione contesto RS non riuscita."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Nessun slot token libero."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Impossibile creare token integrato %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Impossibile verificare la passphrase su input non tty."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "I parametri di cifratura dello slot di chiave possono essere impostati solo per dispositivi LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Non è stato rilevato alcun modello noto di specifica di cifrario."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "Attenzione: il parametro --hash viene ignorato in modalità normale con file di chiave specificato.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "Attenzione: l'opzione --keyfile-size viene ignorata, la dimensione di lettura è la stessa della dimensione della chiave di cifratura.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Rilevata firma dispositivo su %s. Attenzione: continuare potrebbe danneggiare i dati esistenti."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Operazione interrotta.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "È richiesta l'opzione --key-file."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Inserire PIM VeraCrypt: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Valore PIM non valido: errore di lettura."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Valore PIM non valido: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Valore PIM non valido: fuori dall'intervallo."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Nessun header di dispositivo rilevato con questa passphrase."
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Il dispositivo %s non è un dispositivo LUKS valido."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Il dump dell'header con la chiave di volume contiene informazioni\n"
+"confidenziali che permettono di accedere alla partizione cifrata senza passphrase.\n"
+"Questo dump dovrebbe sempre essere salvato in modo cifrato in un luogo sicuro."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Il dispositivo %s è ancora attivo ed è pianificato per essere rimosso.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Il ridimensionamento di un dispositivo attivo richiede la chiave del volume nel portachiavi, ma l'opzione --disable-keyring è impostata."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Benchmark interrotto."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     N/D\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u iterazioni per secondo per chiave di %zu-bit\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s N/D\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u iterazioni, %5u memoria, %1u thread paralleli (CPU) per chiave di %zu-bit (tempo richiesto %u ms)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Il risultato del benchmark non è attendibile."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# I test sono approssimati usando solo la memoria (nessun IO dall'archivio).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr ""
+"#%*s Algoritmo |    Chiave |       Cifratura |   Decrifrazione\n"
+"\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Il cifrario %s-%s (dimensione chiave di %zd byte) non è disponibile."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr ""
+"#     Algoritmo |    Chiave |       Cifratura |   Decrifrazione\n"
+"\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/D"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Inserire la passphrase per lo slot da convertire: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Provare a riparare l'header del dispositivo LUKS?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Pulizia del dispositivo per inizializzare il controllo dell'integrità.\n"
+"È possibile interrompere questa operazione premendo Ctrl+C: la parte del dispositivo non pulita\n"
+"conterrà dati di controllo non validi.\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Impossibile disattivare il dispositivo %s temporaneo."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "L'opzione di integrità può essere usata solo col formato LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Opzioni dimensione metadati LUKS2 non supportate."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Impossibile creare il file header %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Non è stato rilevato alcun modello noto di specifica di integrità."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Impossibile usare %s come header on-disk."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Ciò sovrascriverà i dati in %s in modo irreversibile."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Impostazione dei parametri pbkdf non riuscita."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "L'offset di dati ridotti è ammesso solo per l'header LUKS scollegato."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Dispositivo attivato, ma non è possibile rendere i flag permanenti."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Slot di chiave %d selezionato per l'eliminazione."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Questo è l'ultimo slot di chiave. Il dispositivo sarà inutilizzabile dopo aver eliminato questa chiave."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Inserire una delle passphrase rimanenti: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Operazione terminata, lo slot di chiave NON è stato pulito.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Inserire la passphrase da eliminare: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Inserire la nuova passphrase per lo slot di chiave: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Inserire una delle passphrase esistenti: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Inserire la passphrase da cambiare: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Inserire la nuova passphrase: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Inserire la passphrase per lo slot da convertire: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "È supportato un solo argomento dispositivo per ogni operazione isLuks."
+
+#: src/cryptsetup.c:2001
+#, fuzzy
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Il dump dell'header con la chiave di volume contiene informazioni\n"
+"confidenziali che permettono di accedere alla partizione cifrata senza passphrase.\n"
+"Questo dump dovrebbe sempre essere salvato in modo cifrato in un luogo sicuro."
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Lo slot di chiave %d non è attivo."
+
+#: src/cryptsetup.c:2072
+#, fuzzy
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Il dump dell'header con la chiave di volume contiene informazioni\n"
+"confidenziali che permettono di accedere alla partizione cifrata senza passphrase.\n"
+"Questo dump dovrebbe sempre essere salvato in modo cifrato in un luogo sicuro."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "È richiesta l'opzione --header-backup-file."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s non è un dispositivo gestito via cryptsetup."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "L'aggiornamento non è supportato per dispositivi di tipo %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Tipo di dispositivo metadati %s non riconosciuto."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Il comando richiede un dispositivo e un nome di mappatura come argomenti."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Questa operazione eliminerà tutti gli slot di chiave sul dispositivo %s.\n"
+"Il dispositivo sarà inutilizzabile dopo questa operazione."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Operazione terminata, gli slot di chiave NON sono stati puliti.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Tipo LUKS non valido, solo «luks1» o «luks2» sono supportati."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Il dispositivo è già di tipo %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr ""
+"Questa operazione converte %s nel formato %s.\n"
+"\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Operazione terminata, il dispositivo NON è stato convertito.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Manca l'opzione --priority, --label o --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Il token %d non è valido."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Il token %d è in uso."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Aggiunta del token luks2-keyring %d non riuscita."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Assegnazione del token %d allo slot di chiave %d non riuscita."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Il token %d non è in uso."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Importazione del token da file non riuscita."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Recupero del token %d per l'esportazione non riuscito."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "Il parametro --key-description è obbligatorio per l'azione di aggiunta token."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "L'azione richiede un token specifico. Utilizzare il parametro --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Operazione token %s non valida."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Il dispositivo %s non è un dispositivo LUKS valido."
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Stat del dispositivo %s non riuscita."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "Device %s non valido."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "L'opzione di integrità può essere usata solo col formato LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Il file di backup dell'header %s richiesto esiste già."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Impossibile creare il file header %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+#, fuzzy
+msgid "Not enough free keyslots for reencryption."
+msgstr "Non cambia chiave, nessuna re-cifratura dei dati"
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Il file chiave può essere usato solamente con --key-slot o con esattamente uno slot di chiave attivo."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Inserire la passphrase per lo slot di chiave %u: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Inserire la passphrase per lo slot di chiave %u: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "Il comando richiede un dispositivo e un nome di mappatura come argomenti."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "La re-cifratura del dispositivo con un profilo di integrità non è supportata."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+#, fuzzy
+msgid "LUKS2 device is not in reencryption."
+msgstr "Il file di registro %s esiste, viene ripristinata la re-cifratura.\n"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<dispositivo> [--type <tipo>] [<nome>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "Apre il dispositivo come <nome>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<nome>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "Chiude il dispositivo (rimuove la mappatura)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "Ridimensiona il dispositivo attivo"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "Mostra lo stato del dispositivo"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <cifrario>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "Esegue benchmark del cifrario"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<dispositivo>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "Prova a riparare i metadati on-disk"
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "Aggiunge chiave al dispositivo LUKS"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "Elimina tutti gli slot di chiavi (rimuove chiave di cifratura)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "Converte LUKS dal/al formato LUKS2"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "Imposta opzioni di configurazione permanenti per LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<dispositivo> [<nuovo file chiave>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "Formatta un dispositivo LUKS"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "Aggiunge chiave al dispositivo LUKS"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<dispositivo> [<file chiave>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "Rimuove la chiave fornita o il file chiave dal dispositivo LUKS"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "Cambia la chiave fornita o il file chiave del dispositivo LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "Converte una chiave nei nuovi parametri pbkdf"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<dispositivo> <slot di chiave>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "Ripulisce la chiave con numero <slot di chiave> dal dispositivo LUKS"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "Stampa l'UUID del dispositivo LUKS"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "Verifica l'header della partizione LUKS di <dispositivo>"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "Esegue il dump delle informazioni della partizione LUKS"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "Esegue il dump delle informazioni TCRYPT del dispositivo"
+
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "Esegue il dump delle informazioni TCRYPT del dispositivo"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Sospende il dispositivo LUKS e ripulisce la chiave (operazioni I/O bloccate)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Ripristina il dispositivo LUKS sospeso"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Fa il backup dell'header del dispositivo e degli slot di chiave"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Ripristina l'header del dispositivo LUKS e gli slot di chiave"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <dispositivo>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Gestisce token LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<azione> è una tra:\n"
+
+#: src/cryptsetup.c:3395
+#, fuzzy
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 msgstr ""
 "\n"
 "È possibile usare anche la vecchia sintassi <azione>:\n"
 "\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
 "\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
 
-#: src/cryptsetup.c:1406
+#: src/cryptsetup.c:3399
 #, c-format
 msgid ""
 "\n"
@@ -1134,411 +2411,807 @@ msgid ""
 "<key file> optional key file for the new key for luksAddKey action\n"
 msgstr ""
 "\n"
-"<nome> è il device da creare in %s\n"
-"<device> è il device cifrato\n"
+"<nome> è il dispositivo da creare in %s\n"
+"<dispositivo> è il dispositivo cifrato\n"
 "<slot di chiave> è il numero dello slot di chiave LUKS da modificare\n"
-"<file chiave> è il file chiave opzionale per la nuova chiave per l'azione "
-"luksAddKey\n"
+"<file chiave> è il file chiave opzionale per la nuova chiave per l'azione luksAddKey\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Formato predefinito metadati compilati: %s (per azione luksFormat).\n"
 
-#: src/cryptsetup.c:1413
+#: src/cryptsetup.c:3411
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
 msgstr ""
 "\n"
 "Parametri predefiniti compilati di chiave e passphrase:\n"
-"\tdimensione massima del file chiave: %dkB, lunghezza massima della "
-"passphrase interattiva %d (caratteri)\n"
-"Tempo d'iterazione PBKDF2 predefinito per LUKS: %d (ms)\n"
+"\tdimensione massima file chiave: %dkB, lunghezza massima della passphrase interattiva %d (caratteri)\n"
+"PBKDF predefinito per LUKS1: %s, tempo iterazione: %d (ms)\n"
+"PBKDF predefinito per LUKS2: %s\n"
+"\tTempo iterazione: %d, memoria richiesta: %dkB, thread paralleli: %d\n"
 
-#: src/cryptsetup.c:1420
+#: src/cryptsetup.c:3422
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in device cipher parameters:\n"
 "\tloop-AES: %s, Key %d bits\n"
 "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
 msgstr ""
 "\n"
-"Parametri predefiniti del cifrario del device:\n"
+"Parametri predefiniti compilati del cifrario del dispositivo:\n"
 "\tloop-AES: %s, chiave: %d bit\n"
 "\tin chiaro: %s, chiave: %d bit, hash della password: %s\n"
-"\tLUKS1: %s, chiave: %d bit, hash dell'header LUKS: %s, RNG: %s\n"
+"\tLUKS: %s, chiave: %d bit, hash dell'header LUKS: %s, RNG: %s\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: la dimensione predefinita della chiave in modalità XTS (due chiavi interne) viene raddoppiata.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
 #, c-format
 msgid "%s: requires %s as arguments"
 msgstr "%s: richiede %s come argomenti"
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
 msgid "Show this help message"
 msgstr "Mostra questo messaggio d'aiuto"
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
 msgid "Display brief usage"
 msgstr "Mostra il modo d'uso sintetico"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Opzioni di aiuto:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
 msgid "Print package version"
 msgstr "Stampa la versione del pacchetto"
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Opzioni di aiuto:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
 msgid "Shows more detailed error messages"
 msgstr "Mostra i messaggi di errore con maggior dettaglio"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
 msgid "Show debug messages"
 msgstr "Mostra i messaggi di debug"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Mostra i messaggi di debug compresi i metadati JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
 msgid "The cipher used to encrypt the disk (see /proc/crypto)"
 msgstr "Il cifrario usato per cifrare il disco (vedere /proc/crypto)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
 msgid "The hash used to create the encryption key from the passphrase"
 msgstr "L'hash usato per creare la chiave di cifratura dalla passphrase"
 
-#: src/cryptsetup.c:1481
+#: src/cryptsetup.c:3492
 msgid "Verifies the passphrase by asking for it twice"
 msgstr "Verifica la passphrase chiedendola due volte"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
-msgstr "Legge la chiave da un file."
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Legge la chiave da un file"
 
-#: src/cryptsetup.c:1483
+#: src/cryptsetup.c:3494
 msgid "Read the volume (master) key from file."
 msgstr "Legge la chiave (master) del volume dal file."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr ""
-"Esegue il dump della chiave (master) del volume invece delle informazioni "
-"sugli slot di chiave."
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Esegue il dump della chiave (master) del volume invece delle informazioni sugli slot di chiave"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
 msgid "The size of the encryption key"
 msgstr "La dimensione della chiave di cifratura"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
 msgid "BITS"
 msgstr "BIT"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
 msgid "Limits the read from keyfile"
 msgstr "Limita la lettura dal file di chiave"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
 msgid "bytes"
 msgstr "byte"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
 msgid "Number of bytes to skip in keyfile"
 msgstr "Numero di byte da saltare nel file di chiave"
 
-#: src/cryptsetup.c:1488
+#: src/cryptsetup.c:3499
 msgid "Limits the read from newly added keyfile"
 msgstr "Limita la lettura dal file di chiave appena aggiunto"
 
-#: src/cryptsetup.c:1489
+#: src/cryptsetup.c:3500
 msgid "Number of bytes to skip in newly added keyfile"
 msgstr "Numero di byte da saltare nel file di chiave appena aggiunto"
 
-#: src/cryptsetup.c:1490
+#: src/cryptsetup.c:3501
 msgid "Slot number for new key (default is first free)"
-msgstr ""
-"Numero dello slot per la nuova chiave (il primo libero è quello predefinito)"
+msgstr "Numero dello slot per la nuova chiave (il primo libero è quello predefinito)"
 
-#: src/cryptsetup.c:1491
+#: src/cryptsetup.c:3502
 msgid "The size of the device"
-msgstr "La dimensione del device"
+msgstr "La dimensione del dispositivo"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
 msgid "SECTORS"
 msgstr "SETTORI"
 
-#: src/cryptsetup.c:1492
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Usa solo la dimensione specificata del dispositivo (ignora il resto del dispositivo) PERICOLOSO"
+
+#: src/cryptsetup.c:3504
 msgid "The start offset in the backend device"
-msgstr "L'offset iniziale del device di backend"
+msgstr "L'offset iniziale del dispositivo di backend"
 
-#: src/cryptsetup.c:1493
+#: src/cryptsetup.c:3505
 msgid "How many sectors of the encrypted data to skip at the beginning"
 msgstr "Quanti settori dei dati cifrati saltare dall'inizio"
 
-#: src/cryptsetup.c:1494
+#: src/cryptsetup.c:3506
 msgid "Create a readonly mapping"
 msgstr "Crea una mappatura in sola lettura"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "Tempo di iterazione di PBKDF2 per LUKS (in ms)"
-
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "msec"
-
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
 msgid "Do not ask for confirmation"
 msgstr "Non chiede conferma"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508
 msgid "Timeout for interactive passphrase prompt (in seconds)"
 msgstr "Timeout per il prompt interattivo della passphrase (in secondi)"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
 msgid "secs"
 msgstr "sec"
 
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Aggiornamento linea di avanzamento (in secondi)"
+
 # (NDT) Descrizione dell'opzione
 # --tries, indica il numero di tentativi per richiesta
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
 msgid "How often the input of the passphrase can be retried"
 msgstr "Quante volte può essere ritentato l'inserimento della passphrase"
 
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3511
 msgid "Align payload at <n> sector boundaries - for luksFormat"
 msgstr "Allinea il payload agli estremi del settore <n> - per luksFormat"
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "File con header LUKS e backup degli slot di chiave."
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "File con header LUKS e backup degli slot di chiave"
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "Usa /dev/random per generare la chiave di volume."
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Usa /dev/random per generare la chiave di volume"
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Usa /dev/urandom per generare la chiave di volume."
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Usa /dev/urandom per generare la chiave di volume"
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr "Condivide il device con un altro segmento cifrato non sovrapposto."
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Condivide il dispositivo con un altro segmento cifrato non sovrapposto"
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID da usare per il device."
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID per il dispositivo da usare"
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Ammette le richieste di scarto (funzione TRIM) per il device."
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Ammette le richieste di scarto (funzione TRIM) per il dispositivo"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Device o file con header LUKS separato."
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Device o file con header LUKS separato"
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Non attiva il device, verifica solamente la passphrase"
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Non attiva il dispositivo, verifica solamente la passphrase"
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Usa header nascosto (device TCRYPT nascosto)"
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Usa header nascosto (dispositivo TCRYPT nascosto)"
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Il device è l'unità TCRYPT di sistema (con bootloader)"
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Il dispositivo è l'unità TCRYPT di sistema (con bootloader)"
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
 msgstr "Usa header TCRYPT di backup (secondario)"
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Ricerca anche device compatibili VeraCrypt"
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Ricerca anche dispositivo compatibile VeraCrypt"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "PIM (Personal Iteration Multiplier) per dispositivo VeraCrypt compatibile"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Meta-dati del tipo di device: luks, plain, loopaes, tcrypt"
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Interroga PIM (Personal Iteration Multiplier) per dispositivo VeraCrypt compatibile"
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
+#: src/cryptsetup.c:3526
+#, fuzzy
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Tipo di metadati del dispositivo: luks, plain, loopaes, tcrypt"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
 msgstr "Disabilita la verifica della qualità della password (se abilitata)"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
 msgstr "Usa l'opzione compatibile per prestazioni same_cpu_crypt di dm-crypt"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Usa l'opzione compatibile per prestazioni submit_from_crypt_cpus di dm-crypt"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "La rimozione del dispositivo è posticipata fino a quando l'ultimo utente lo chiude"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
 msgstr ""
-"Usa l'opzione compatibile per prestazioni submit_from_crypt_cpus di dm-crypt"
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Tempo di iterazione di PBKDF per LUKS (in ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "msec"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Algoritmo PBKDF (per LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Limite costo memoria PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilobyte"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Costo PBKDF parallelo"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "thread"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Costo iterazioni PBKDF (forzato, disabilita benchmark)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Priorità slot di chiave: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Disabilita il blocco dei metadati su disco"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Disabilita il caricamento delle chiavi di volume tramite il portachiavi del kernel"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Algoritmo integrità dei dati (solo LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Disabilita il journal per il dispositivo di integrità"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Non pulisce il dispositivo dopo la formattazione"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Non chiede la passphrase se l'attivazione con token non riesce"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Numero token (predefinito: any)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Descrizione chiave"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Dimensione settore di cifratura (predefinito: 512 byte)"
+
+#: src/cryptsetup.c:3548
+#, fuzzy
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Dimensione settore di cifratura (predefinito: 512 byte)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Imposta flag attivazione persistente per il dispositivo"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Imposta l'etichetta per il dispositivo LUKS2"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Imposta l'etichetta del sottosistema per il dispositivo LUKS2"
+
+#: src/cryptsetup.c:3552
+#, fuzzy
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Crea slot di chiave LUKS2 non vincolato (segmento dati non assegnato)"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Legge/Scrive JSON da/su file"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Dimensione area metadati header LUKS2"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Dimensione area slot di chiave header LUKS2"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Aggiorna (riattiva) il dispositivo con nuovi parametri"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Slot di chiave LUKS2: la dimensione della chiave di cifratura"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "Slot di chiave LUKS2: il cifrario usato per la cifratura dello slot di chiave"
+
+#: src/cryptsetup.c:3559
+#, fuzzy
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Decifra definitivamente il dispositivo (rimuove la cifratura)"
+
+#: src/cryptsetup.c:3560
+#, fuzzy
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Decifra definitivamente il dispositivo (rimuove la cifratura)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Riduce la dimensione dei dati del dispositivo (muove l'offset dei dati) PERICOLOSO"
+
+#: src/cryptsetup.c:3564
+#, fuzzy
+msgid "Maximal reencryption hotzone size."
+msgstr "Dimensione blocco re-cifratura"
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
+
+#: src/cryptsetup.c:3566
+#, fuzzy
+msgid "Reencryption hotzone checksums hash"
+msgstr "Dimensione blocco re-cifratura"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
 msgid "[OPTION...] <action> <action-specific>"
 msgstr "[OPZIONE...] <azione> <azione-specifica>]"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Esecuzione in modalità FIPS.\n"
-
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
 msgid "Argument <action> missing."
 msgstr "Argomento <azione> mancante."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
-msgid "Unknown action."
-msgstr "Azione sconosciuta."
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Azione sconosciuta."
+
+#: src/cryptsetup.c:3713
+#, fuzzy
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr ""
+"Solo un'opzione tra --refresh e --test-passphrase può essere usata.\n"
+"\n"
+
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr ""
+"L'opzione --deferred è consentita solo per il comando close.\n"
+"\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "L'opzione --shared è consentita solo per l'azione open di dispositivo in chiaro.\n"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "L'opzione --allow-discards è consentita solo per l'azione open.\n"
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr ""
-"L'opzione --shared è consentita solo per l'azione open di device plain.\n"
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "L'opzione --persistent è consentita solo per l'azione open.\n"
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
 msgstr "L'opzione --allow-discards è consentita solo per l'azione open.\n"
 
-#: src/cryptsetup.c:1657
+#: src/cryptsetup.c:3743
+#, fuzzy
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "L'opzione --persistent non è consentita con --test-passphrase.\n"
+
+#: src/cryptsetup.c:3753
+#, fuzzy
 msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
 msgstr ""
-"L'opzione --key-size è consentita solo per luksFormat, open e benchmark.\n"
-"Per limitare la lettura dal file chiave usare --keyfile-size=(byte)."
+"L'opzione --key-size è consentita solo per le azioni luksFormat, luksAddKey (con --unbound),\n"
+"open e benchmark. Per limitare la lettura dal file chiave usare --keyfile-size=(byte)."
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "L'opzione --integrity è consentita solo per luksFormat (LUKS2).\n"
+
+#: src/cryptsetup.c:3764
+#, fuzzy
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
 msgstr ""
-"L'opzione --test-passphrase è consentita solo per l'operazione open di "
-"device LUKS e TCRYPT.\n"
+"L'opzione --integrity-no-wipe può essere usata solo con l'azione format con estensione di integrità.\n"
+"\n"
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Le opzioni --label e --subsystem sono consentite solo per operazioni LUKS2 luksFormat e config.\n"
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "L'opzione --test-passphrase è consentita solo per l'operazione open di dispositivo LUKS e TCRYPT.\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
 msgid "Key size must be a multiple of 8 bits"
 msgstr "La dimensione della chiave deve essere un multiplo di 8 bit"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
 msgid "Key slot is invalid."
 msgstr "Lo slot di chiave non è valido."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"L'opzione --key-file ha la precedenza sull'argomento specificato per il file "
-"chiave.\n"
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "L'opzione --key-file ha la precedenza sull'argomento specificato per il file chiave."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
 msgid "Negative number for option not permitted."
 msgstr "Non è ammesso un numero negativo per l'opzione."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "È consentito solo un argomento --key-file."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
 msgid "Only one of --use-[u]random options is allowed."
 msgstr "È consentita solo una tra le opzioni --use-[u]random."
 
-#: src/cryptsetup.c:1699
+#: src/cryptsetup.c:3813
 msgid "Option --use-[u]random is allowed only for luksFormat."
 msgstr "L'opzione --use-[u]random è consentita solo per luksFormat."
 
-#: src/cryptsetup.c:1703
+#: src/cryptsetup.c:3817
 msgid "Option --uuid is allowed only for luksFormat and luksUUID."
 msgstr "L'opzione --uuid è consentita solo per luksFormat e luksUUID."
 
-#: src/cryptsetup.c:1707
+#: src/cryptsetup.c:3821
 msgid "Option --align-payload is allowed only for luksFormat."
 msgstr "L'opzione --align-payload è consentita solo per luksFormat."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Le opzioni --luks2-metadata-size e --opt-luks2-keyslots-size sono consentite solo luksFormat con LUKS2."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Specifica di dimensione dei metadati LUKS2 non valida."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Specifica di dimensione dello slot di chiave LUKS2 non valida."
+
+#: src/cryptsetup.c:3838
+#, fuzzy
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Le opzioni --align-payload --offset cannot non possono essere utilizzate assieme."
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "L'opzione --skip è supportata solo per l'azione open di dispositivi in chiaro e loopaes.\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "L'opzione --offset è supportata solo per l'azione open di dispositivi in chiaro e loopaes e per luksFormat.\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "L'opzione --tcrypt-hidden, --tcrypt-system o --tcrypt-backup è supportata solo per dispositivo TCRYPT.\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "L'opzione --tcrypt-hidden non può essere utilizzata con --allow-discards.\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "L'opzione --veracrypt è supportata solo per dispositivo TCRYPT.\n"
+
+#: src/cryptsetup.c:3873
+#, fuzzy
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Argomento fornito per il parametro --veracrypt-pim non valido.\n"
+
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
 msgstr ""
-"L'opzione --skip è supportata solo per l'azione open di device plain a "
-"loopaes.\n"
+"L'opzione --veracrypt-pim è supportata solo per dispositivi compatibili VeraCrypt.\n"
+"\n"
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "L'opzione --veracrypt-query-pim è supportata solo per dispositivi compatibili VeraCrypt.\n"
+
+#: src/cryptsetup.c:3889
+#, fuzzy
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
 msgstr ""
-"L'opzione --offset è supportata solo per l'azione open di device plain e "
-"loopaes.\n"
+"Solo un'opzione tra --veracrypt-pim e --veracrypt-query-pim può essere usata.\n"
+"\n"
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
+#: src/cryptsetup.c:3896
+#, fuzzy
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "L'opzione --priority può essere solamente ignore/normal/prefer.\n"
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+#, fuzzy
+msgid "Keyslot specification is required."
+msgstr "È richiesta la specifica dello slot di chiave.\n"
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+#, fuzzy
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "La funzione di derivazione della chiave basata su password (PBKDF) può essere solamente pbkdf2 oppure argon2i/argon2id.\n"
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+#, fuzzy
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Le iterazioni forzate PBKDF non possono essere usate assieme all'opzione del tempo delle iterazioni.\n"
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "L'opzione della dimensione del settore non è supportata con questo comando.\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
 msgstr ""
-"L'opzione --tcrypt-hidden, --tcrypt-system o --tcrypt-backup è supportata "
-"solo per device TCRYPT.\n"
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
+#: src/cryptsetup.c:3934
+#, fuzzy
+msgid "Key size is required with --unbound option."
+msgstr "La dimensione della chiave è richiesta con l'opzione --unbound.\n"
+
+#: src/cryptsetup.c:3944
+#, fuzzy
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "L'opzione --unbound può essere usata solamente con l'azione luksAddKey.\n"
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "L'opzione --refresh può essere usata solamente con l'azione open.\n"
+
+#: src/cryptsetup.c:3960
+#, fuzzy
+msgid "Cannot disable metadata locking."
+msgstr "Impossibile disabilitare il blocco dei metadati.\n"
+
+#: src/cryptsetup.c:3970
+#, fuzzy
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Specifica di dimensione del dispositivo non valida."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Specifica di dimensione del dispositivo non valida."
+
+#: src/cryptsetup.c:3981
+#, fuzzy
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "La dimensione massima di riduzione del dispositivo è 64 MiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "La dimensione di riduzione deve essere un multiplo di 512 byte."
+
+#: src/cryptsetup.c:3989
+#, fuzzy
+msgid "Invalid data size specification."
+msgstr "Specifica di dimensione del dispositivo non valida."
+
+#: src/cryptsetup.c:3994
+#, fuzzy
+msgid "Reduce size overflow."
+msgstr "Overflow offset del dispositivo."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
 msgstr ""
-"L'opzione --tcrypt-hidden non può essere utilizzata con --allow-discards.\n"
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "L'opzione --veracrypt è supportata solo per device TCRYPT.\n"
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "La dimensione di riduzione deve essere un multiplo di 512 byte."
+
+#: src/cryptsetup.c:4006
+#, fuzzy
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Le opzioni --align-payload --offset cannot non possono essere utilizzate assieme."
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "String salt specificata non valida.\n"
+#: src/cryptsetup.c:4010
+#, fuzzy
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Le opzioni --align-payload --offset cannot non possono essere utilizzate assieme."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Le opzioni --ignore-corruption e --restart-on-corruption non possono essere utilizzate assieme.\n"
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Stringa salt specificata non valida."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Impossibile creare l'immagine hash %s per la scrittura."
 
-#: src/veritysetup.c:88
+#: src/veritysetup.c:107
 #, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "Impossibile creare l'immagine hash %s per la scrittura.\n"
+msgid "Cannot create FEC image %s for writing."
+msgstr "Impossibile creare l'immagine FEC %s per la scrittura."
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "Stringa hash principale specificata non valida.\n"
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Stringa hash root specificata non valida."
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "Device %s non valido."
+
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr "Impossibile leggere il file chiave %s."
+
+#: src/veritysetup.c:392
 msgid "<data_device> <hash_device>"
-msgstr "<device_dati> <device_hash>"
+msgstr "<dispositivo_dati> <dispositivo_hash>"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392 src/integritysetup.c:479
 msgid "format device"
-msgstr "Formatta il device"
+msgstr "Formatta il dispositivo"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "<data_device> <hash_device> <root_hash>"
-msgstr "<device_dati> <device_hash> <hash_root>"
+msgstr "<dispositivo_dati> <dispositivo_hash> <hash_root>"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "verify device"
-msgstr "Verifica il device"
-
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<nome> <device_dati> <device_hash> <hash_root>"
-
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "Crea device attivo"
+msgstr "Verifica il dispositivo"
 
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "Rimuove (disattiva) device"
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<dispositivo_dati> <nome> <dispositivo_hash> <hash_root>"
 
-#: src/veritysetup.c:312
+#: src/veritysetup.c:396 src/integritysetup.c:482
 msgid "show active device status"
-msgstr "Mostra lo stato del device attivo"
+msgstr "Mostra lo stato del dispositivo attivo"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397
 msgid "<hash_device>"
-msgstr "<device_hash>"
+msgstr "<dispositivo_hash>"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397 src/integritysetup.c:483
 msgid "show on-disk information"
 msgstr "Mostra informazioni on-disk"
 
-#: src/veritysetup.c:332
+#: src/veritysetup.c:416
 #, c-format
 msgid ""
 "\n"
@@ -1548,339 +3221,871 @@ msgid ""
 "<root_hash> hash of the root node on <hash_device>\n"
 msgstr ""
 "\n"
-"<nome> è il device da creare in %s\n"
-"<device_dati> è il device dei dati\n"
-"<device_hash> è il device che contiene i dati di verifica\n"
-"<hash_root> è l'hash del nodo radice nel <device_hash>\n"
+"<nome> è il dispositivo da creare in %s\n"
+"<dispositivo_dati> è il dispositivo dei dati\n"
+"<dispositivo_hash> è il dispositivo che contiene i dati di verifica\n"
+"<hash_root> è l'hash del nodo radice nel <dispositivo_hash>\n"
 
-#: src/veritysetup.c:339
+#: src/veritysetup.c:423
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
 msgstr ""
 "\n"
 "Parametri predefiniti compilati in dm-verity:\n"
-"\tHash: %s, Blocco dati (byte): %u, Blocco hash (byte): %u, Dimensione salt: "
-"%u, Formato hash: %u\n"
+"\tHash: %s, Blocco dati (byte): %u, Blocco hash (byte): %u, Dimensione salt: %u, Formato hash: %u\n"
 
-#: src/veritysetup.c:377
+#: src/veritysetup.c:466
 msgid "Do not use verity superblock"
 msgstr "Non usa il super-blocco verity"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "Format type (1 - normal, 0 - original Chrome OS)"
 msgstr "Tipo di formato (1 - normale, 0 - ChromeOS originale)"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "number"
 msgstr "numero"
 
-#: src/veritysetup.c:379
+#: src/veritysetup.c:468
 msgid "Block size on the data device"
-msgstr "La dimensione del blocco sul device dati"
+msgstr "La dimensione del blocco sul dispositivo dati"
 
-#: src/veritysetup.c:380
+#: src/veritysetup.c:469
 msgid "Block size on the hash device"
-msgstr "La dimensione del blocco sul device hash"
+msgstr "La dimensione del blocco sul dispositivo hash"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "Byte di parità FEC"
+
+#: src/veritysetup.c:471
 msgid "The number of blocks in the data file"
 msgstr "Il numero di blocchi nel file dati"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:471
 msgid "blocks"
 msgstr "blocchi"
 
-#: src/veritysetup.c:382
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Percorso al dispositivo con i dati di correzione degli errori"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "percorso"
+
+#: src/veritysetup.c:473
 msgid "Starting offset on the hash device"
-msgstr "L'offset iniziale del device di hash"
+msgstr "L'offset iniziale del dispositivo di hash"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "L'offset iniziale del dispositivo FEC"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:475
 msgid "Hash algorithm"
 msgstr "Algoritmo di hash"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:475
 msgid "string"
 msgstr "stringa"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "Salt"
 msgstr "Salt"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "hex string"
 msgstr "stringa esadecimale"
 
-#: src/cryptsetup_reencrypt.c:147
+#: src/veritysetup.c:478
+#, fuzzy
+msgid "Path to root hash signature file"
+msgstr "Creazione dell'area hash non riuscita."
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Riavvia il kernel se sono rilevati dati rovinati"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ignora i dati rovinati, li registra solamente"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Non verifica i blocchi azzerati"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Verifica i blocchi dati solo alla prima lettura"
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "L'opzione --ignore-corruption, --restart-on-corruption o --ignore-zero-blocks è consentita solo per l'operazione di apertura.\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "L'opzione --integrity-recalculate può essere usata solo con l'azione open."
+
+#: src/veritysetup.c:592
+#, fuzzy
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Le opzioni --ignore-corruption e --restart-on-corruption non possono essere utilizzate assieme.\n"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
 #, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Impossibile aprire esclusivamente il device %s, già in uso.\n"
+msgid "Cannot read keyfile %s."
+msgstr "Impossibile leggere il file chiave %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Impossibile leggere %d byte dal file chiave %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formattato con dimensione tag di %u, integrità interna %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<dispositivo_integrità>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<dispositivo_integrità> <nome>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<nome> è il dispositivo da creare in %s\n"
+"<dispositivo_integrità> è il dispositivo che contiene dai con i tag di integrità\n"
+
+#: src/integritysetup.c:507
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Parametri predefiniti compilati in dm-integrity:\n"
+"\tDimensione tag: %u byte - Algoritmo di controllo: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Percorso al dispositivo dati (se scollegato)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Dimensione journal"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Settori di interfogliazione"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Watermark del journal"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "percento"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Tempo scrittura del journal"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Dimensione tag (per settore)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Dimensione settore"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Dimensione buffer"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Algoritmo integrità dati"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "La dimensione della chiave di integrità dei dati"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Legge la chiave di integrità da un file"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Algoritmo integrità journal"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "La dimensione della chiave di integrità del journal"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Legge la chiave di integrità del journal da un file"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Algoritmo cifratura journal"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "La dimensione della chiave di cifratura del journal"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Legge la chiave di cifratura del journal da un file"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Modalità ripristino (jorunal e verifica tag disattivai)"
+
+#: src/integritysetup.c:575
+#, fuzzy
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Disabilita il journal per il dispositivo di integrità"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Ricalcola i tag iniziali automaticamente"
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "L'opzione --integrity-recalculate può essere usata solo con l'azione open."
+
+#: src/integritysetup.c:669
+#, fuzzy
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Le opzioni --journal-size, --interleave-sectors, --sector-size, --tag-size e --no-wipe possono essere usate solamente per azioni di formattazione.\n"
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Specifica di dimensione del journal non valida."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Devono essere specificate entrambe le opzioni file della chiave e dimensione delle chiave."
 
-#: src/cryptsetup_reencrypt.c:151
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "L'algoritmo di integrità deve essere specificato se viene usata la chiave di integrità."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Devono essere specificate entrambe le opzioni file della chiave e dimensione della chiave di integrità del journal."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "L'algoritmo di integrità del journal deve essere specificato se viene usata la chiave di integrità del journal."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Devono essere specificate entrambe le opzioni file della chiave e dimensione della chiave di cifratura del journal."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "L'algoritmo di cifratura del journal deve essere specificato se viene usata la chiave di cifratura del journal."
+
+#: src/integritysetup.c:703
+#, fuzzy
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr ""
+"Solo un'opzione tra --refresh e --test-passphrase può essere usata.\n"
+"\n"
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
+
+#: src/integritysetup.c:711
+#, fuzzy
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "L'opzione di integrità può essere usata solo col formato LUKS2."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Re-cifratura in corso."
+
+#: src/cryptsetup_reencrypt.c:208
 #, c-format
-msgid "Cannot open device %s\n"
-msgstr "Impossibile aprire il device %s\n"
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Impossibile aprire esclusivamente il dispositivo %s, già in uso."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "Allocazione di memoria allineata non riuscita.\n"
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Allocazione di memoria allineata non riuscita."
 
-#: src/cryptsetup_reencrypt.c:168
+#: src/cryptsetup_reencrypt.c:229
 #, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Impossibile leggere il device %s.\n"
+msgid "Cannot read device %s."
+msgstr "Impossibile leggere il dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:179
+#: src/cryptsetup_reencrypt.c:240
 #, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "Impostazione device LUCKS %s come inutilizzabile.\n"
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Impostazione dispositivo LUKS %s come inutilizzabile."
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "Impostazione device LUCKS %s come utilizzabile.\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Impostazione flag re-cifratura offline LUKS2 sul dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:200
+#: src/cryptsetup_reencrypt.c:261
 #, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Impossibile scrivere il device %s.\n"
+msgid "Cannot write device %s."
+msgstr "Impossibile scrivere il dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "Impossibile scrivere il file di registro di re-cifratura.\n"
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Impossibile scrivere il file di registro di re-cifratura."
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "Impossibile leggere il file di registro di re-cifratura.\n"
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Impossibile leggere il file di registro di re-cifratura."
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
 msgstr "Il file di registro %s esiste, viene ripristinata la re-cifratura.\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr "Attivazione device temporaneo usando il vecchio header LUKS.\n"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Attivazione dispositivo temporaneo usando il vecchio header LUKS."
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr "Attivazione device temporaneo usando il nuovo header LUKS.\n"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Attivazione dispositivo temporaneo usando il nuovo header LUKS."
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Attivazione del device temporaneo non riuscita.\n"
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Attivazione del dispositivo temporaneo non riuscita."
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Non è stato creato alcun header LUKS per il device %s.\n"
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Impostazione offset dei dati non riuscita."
+
+#: src/cryptsetup_reencrypt.c:565
+#, fuzzy
+msgid "Failed to set metadata size."
+msgstr "Impostazione offset dei dati non riuscita."
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:573
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Slot di chiave %i attivato.\n"
+msgid "New LUKS header for device %s created."
+msgstr "Creato nuovo header LUKS per il dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "Header LUKS di backup del device %s creato.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Questa versione di cryptsetup-reencrypt non può gestire token interni di tipo %s."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "Creazione degli header di backup LUKS non riuscita.\n"
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Lettura dei flag di attivazione dall'header di backup non riuscita."
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Scrittura dei flag di attivazione sul nuovo header non riuscita."
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Lettura dei requisiti dall'header di backup non riuscita."
+
+#: src/cryptsetup_reencrypt.c:705
 #, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Impossibile ripristinare l'header LUKS sul device %s.\n"
+msgid "%s header backup of device %s created."
+msgstr "Header %s di backup del dispositivo %s creato."
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Creazione degli header di backup LUKS non riuscita."
+
+#: src/cryptsetup_reencrypt.c:901
 #, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "Ripristinato l'header LUKS sul device %s.\n"
+msgid "Cannot restore %s header on device %s."
+msgstr "Impossibile ripristinare l'header %s sul dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:669
+#: src/cryptsetup_reencrypt.c:903
 #, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Avanzamento: %5.1f%%, ETA %02llu:%02llu, %4llu MiB scritti, velocità %5.1f "
-"MiB/s%s"
+msgid "%s header on device %s restored."
+msgstr "Ripristinato l'header %s sul dispositivo %s."
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Impossibile posizionarsi all'offset del device.\n"
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Impossibile aprire il dispositivo temporaneo LUKS."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Impossibile aprire il file temporaneo dell'header LUKS.\n"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Impossibile ottenere la dimensione del dispositivo."
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "Impossibile ottenere la dimensione del device.\n"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Errore di IO durante la re-cifratura."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Interrotto dal segnale.\n"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Lo UUID fornito non è valido."
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "Errore di IO durante la re-cifratura.\n"
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Impossibile aprire il file di registro di re-cifratura."
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"Il file chiave può essere usato solamente con --key-slot o con esattamente "
-"uno slot di chiave attivo.\n"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Nessuna decifrazione in corso: lo UUID fornito può essere usato solamente per riprendere un processo di decifrazione."
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
+#: src/cryptsetup_reencrypt.c:1504
 #, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Inserire la passphrase per lo slot di chiave %u: "
-
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Impossibile aprire il file di registro di re-cifratura.\n"
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Parametri pbkdf modificati nello slot di chiave %i."
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "Reencryption block size"
 msgstr "Dimensione blocco re-cifratura"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "MiB"
 msgstr "MiB"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "Non cambia chiave, nessun re-cifratura dei dati."
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Non cambia chiave, nessuna re-cifratura dei dati"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Legge la chiave (master) del volume da file"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Tempo di iterazione di PBKDF2 per LUKS (in ms)"
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr "Usa IO diretto negli accessi ai device"
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Usa IO diretto negli accessi ai dispositivi"
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
 msgstr "Usa fsync dopo ogni blocco"
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Aggiora il registro a ogni blocco"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Aggiorna il registro a ogni blocco"
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
 msgstr "Usa solo questo slot (gli altri vengono disabilitati)"
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
-"Riduce la dimensione dei dati del device (muove l'offset dei dati) PERICOLOSO"
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Crea un nuovo header su un dispositivo non cifrato"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Usa solo la dimensione specificata del device (ignora il resto del device) "
-"PERICOLOSO"
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Decifra definitivamente il dispositivo (rimuove la cifratura)"
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Crea un nuovo header su un device non cifrato"
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "Lo UUID utilizzato per riprendere la decifrazione"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
-msgstr "Decifra definitivamente il device (rimuove la cifratura)"
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Metadati di tipo LUKS: luks1, luks2"
 
-#: src/cryptsetup_reencrypt.c:1298
+#: src/cryptsetup_reencrypt.c:1659
 msgid "[OPTION...] <device>"
-msgstr "[OPZIONI...] <device>"
-
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
-"Attenzione: questo è codice sperimentale, potrebbe danneggiare i propri "
-"dati.\n"
+msgstr "[OPZIONI...] <dispositivo>"
 
-#: src/cryptsetup_reencrypt.c:1313
+#: src/cryptsetup_reencrypt.c:1667
 #, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "La re-cifratura modificherà: chiave del volume%s%s%s%s.\n"
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "La re-cifratura modificherà: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "chiave volume"
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid "set hash to "
-msgstr "imposta l'hash a "
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "imposta l'hash a "
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ", imposta il cifrario a "
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr "Argomento richiesto."
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Solo valori tra 1 MiB e 64 MiB sono consentiti per la dimensione del blocco "
-"di re-cifratura."
-
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Specifica di dimensione del device non valida."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Solo valori tra 1 MiB e 64 MiB sono consentiti per la dimensione del blocco di re-cifratura."
 
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
-msgstr "La dimensione massima di riduzione del device è 64 MiB."
-
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "La dimensione di riduzione deve essere un multiplo di 512 byte."
+msgstr "La dimensione massima di riduzione del dispositivo è 64 MiB."
 
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr "L'opzione --new deve essere usata con --reduce-device-size."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "L'opzione --new deve essere usata con --reduce-device-size o --header."
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr "L'opzione --keep-key può essere usata solo con --hash o --iter-time."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "L'opzione --keep-key può essere usata solo con --hash, --iter-time --pbkdf-force-iterations."
 
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr "L'opzione --new non può essere usata con --decrypt."
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
 msgstr "L'opzione --decrypt non è compatibile con i parametri specificati."
 
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "L'opzione --uuid può essere usata solo con --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Tipo luks non valido. Usare uno tra: \"luks\", \"luks1\" o \"luks2\"."
+
 #: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Errore nel leggere la risposta dal terminale.\n"
+msgid "Error reading response from terminal."
+msgstr "Errore nel leggere la risposta dal terminale."
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Comando eseguito con successo.\n"
 
-#: src/utils_tools.c:191
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "parametri errati o mancanti"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "permessi mancanti o passphrase errata"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "memoria esaurita"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "dispositivo o file specificato errato"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "il dispositivo esiste già o è occupato"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "errore sconosciuto"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Comando non riuscito con codice %i (%s).\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Slot di chiave %i creato."
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Slot di chiave %i sbloccato."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Slot di chiave %i rimosso."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Token %i creato."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Token %i rimosso."
+
+#: src/utils_tools.c:464
+#, fuzzy
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Scrittura interrotta."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "Attenzione: il dispositivo %s contiene già una firma di partizione «%s».\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "Attenzione: il dispositivo %s contiene già una firma di super-blocco «%s».\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Inizializzazione sonde per la firma del dispositivo non riuscita."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Stat del dispositivo %s non riuscita."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Il dispositivo %s è in uso. Impossibile procedere con l'operazione di formattazione."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Apertura del file %s in lettura/scrittura non riuscita."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Pulizia della firma del dispositivo non riuscita."
+
+#: src/utils_tools.c:590
 #, c-format
-msgid "Command failed with code %i"
-msgstr "Comando non riuscito con codice %i"
+msgid "Failed to probe device %s for a signature."
+msgstr "Esame del dispositivo %s per una firma non riuscito."
 
-#: src/utils_password.c:42
+#: src/utils_tools.c:629
+#, fuzzy
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Lettura interrotta."
+
+#: src/utils_password.c:43 src/utils_password.c:75
 #, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Impossibile controllare la qualità della password: %s\n"
+msgid "Cannot check password quality: %s"
+msgstr "Impossibile controllare la qualità della password: %s"
 
-#: src/utils_password.c:50
+#: src/utils_password.c:51
 #, c-format
 msgid ""
 "Password quality check failed:\n"
-" %s\n"
+" %s"
 msgstr ""
 "Controllo qualità della password non riuscito:\n"
-" %s\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Controllo qualità della password non riuscito: passphrase non valida (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Errore nel leggere la passphrase dal terminale."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Verifica passphrase: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Le passphrase non corrispondono."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Impossibile usare l'offset con l'input da terminale."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Inserire la passphrase: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Inserire la passphrase per %s: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Nessuna chiave disponibile con questa passphrase."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr ""
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Impossibile aprire il file chiave %s per la scrittura."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Impossibile scrivere sul file chiave %s."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Apertura del file %s in sola lettura non riuscita."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Fornire token JSON LUKS2 valido:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Lettura file JSON non riuscita."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Lettura interrotta."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Apertura del file %s in lettura non riuscita."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Scrittura interrotta."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Scrittura file JSON non riuscita."
+
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Le opzioni di prestazioni richieste per dmcrypt non sono supportate."
+
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Impossibile formattare il dispositivo %s che risulta ancora in uso."
+
+#~ msgid "Key slot %d is not used."
+#~ msgstr "Lo slot di chiave %d non è utilizzato."
+
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Funzione non disponibile in modalità FIPS."
+
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Il cifrario %s non è disponibile."
+
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Slot di chiave %d selezionato per l'eliminazione."
+
+#~ msgid "open device as mapping <name>"
+#~ msgstr "Apre il dispositivo come mappatura in <nome>"
+
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands.\n"
+#~ msgstr ""
+#~ "Il parametro --refresh è consentito solo col comando open o refresh.\n"
+#~ "\n"
+
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Dimensione settore di cifratura non supportata.\n"
+
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "Chiude il dispositivo (disattiva e rimuove la mappatura)"
+
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Impostazione parametri PBKDF non riuscita."
+
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Impossibile posizionarsi all'offset del dispositivo.\n"
+
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Interrotto da un segnale."
+
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "Il dispositivo %s è troppo piccolo (LUKS2 richiede almeno %<PRIu64> byte)."
+
+#~ msgid "Replaced with key slot %d.\n"
+#~ msgstr "Sostituito con lo slot di chiave %d.\n"
+
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Troppi livelli d'albero per il volume verity.\n"
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "errore di allocazione di memoria in action_luksFormat"
+
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Chiave %d non attiva. Impossibile ripulirla.\n"
+
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<nome> <dispositivo_dati> <dispositivo_hash> <hash_root>"
+
+#~ msgid "create active device"
+#~ msgstr "Crea dispositivo attivo"
+
+#~ msgid "remove (deactivate) device"
+#~ msgstr "Rimuove (disattiva) dispositivo"
+
+#~ msgid "Activated keyslot %i.\n"
+#~ msgstr "Slot di chiave %i attivato.\n"
+
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Avanzamento: %5.1f%%, ETA %02llu:%02llu, %4llu MiB scritti, velocità %5.1f MiB/s%s"
+
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Impossibile trovare un dispositivo di loopback libero.\n"
+
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Impossibile aprire il dispositivo %s\n"
+
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Impossibile utilizzare lo UUID fornito se non è in corso una decifratura.\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "Impostazione device LUKS %s come utilizzabile.\n"
diff --git a/po/ja.gmo b/po/ja.gmo
new file mode 100644 (file)
index 0000000..dfb77b6
Binary files /dev/null and b/po/ja.gmo differ
diff --git a/po/ja.po b/po/ja.po
new file mode 100644 (file)
index 0000000..4a555b0
--- /dev/null
+++ b/po/ja.po
@@ -0,0 +1,3871 @@
+# Japanese messages for cryptsetup.
+# Copyright (C) 2019, 2020 Free Software Foundation, Inc.
+# This file is put in the public domain, to the extent permitted under applicable law.
+# Hiroshi Takekawa <sian@big.or.jp>, <sian.ht@gmail.com>, 2019, 2020
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
+"Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-15 21:33+0900\n"
+"Last-Translator: Hiroshi Takekawa <sian@big.or.jp>\n"
+"Language-Team: Japanese <translation-team-ja@lists.sourceforge.net>\n"
+"Language: ja\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "device-mapper を初期化できません、non-root で実行します。"
+
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "device-mapper を初期化できません。dm_mod モジュールはロードされてますか?"
+
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "指定された延期フラグはサポートされていません。"
+
+#: lib/libdevmapper.c:1198
+#, c-format
+msgid "DM-UUID for device %s was truncated."
+msgstr "デバイス %s の DM-UUID は短縮されています。"
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "不明な dm target タイプです。"
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "指定された dm-crypt パフォーマンスオプションはサポートされていません。"
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "指定された dm-verity のデータ破壊時の対応についてのオプションはサポートされていません。"
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "指定された dm-verity の誤り訂正(FEC)オプションはサポートされていません。"
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "指定されたデータの無改ざん確認のオプションはサポートされていません。"
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "指定された sector_size オプションはサポートされていません。"
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "指定された改ざん確認タグの自動再計算はサポートされていません。"
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Discard/TRIM はサポートしていません。"
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "要求された dm-integrity のビットマップモードはサポートされていません。"
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "dm-%s のクエリーに失敗しました。"
+
+#: lib/random.c:75
+msgid ""
+"System is out of entropy while generating volume key.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
+msgstr ""
+"ボリュームキーを生成するためのエントロピー(この文脈では乱数の乱れ度合)が足りません。\n"
+"マウスを動かしたり、他のウィンドウで文字を入力したりしてみてください。\n"
+
+#: lib/random.c:79
+#, c-format
+msgid "Generating key (%d%% done).\n"
+msgstr "キー生成中 (%d%% 完了)。\n"
+
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "FIPS モードで実行中。"
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "RNG(乱数生成器)初期化中に重大なエラーが発生しました。"
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "不明な RNG(乱数生成器) の質(quality)が要求されました。"
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "RNG(乱数生成器)から読み込み中にエラー。"
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "暗号向けRNG(乱数生成器)バックエンドの初期化ができません。"
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "暗号バックエンドの初期化ができません。"
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "ハッシュアルゴリズム %s がサポートされていません。"
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "鍵の処理でエラー (ハッシュ %s を使用)。"
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "デバイスタイプがわかりません。互換性のないデバイスのアクティベーションをしようとしていませんか?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "この操作は LUKS デバイスでしかサポートされていません。"
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "この操作は LUKS2 デバイスでしかサポートされていません。"
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "キースロットがいっぱいです。"
+
+#: lib/setup.c:434
+#, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "キースロット %d は不正です。0 から %d の間を選んでください。"
+
+#: lib/setup.c:440
+#, c-format
+msgid "Key slot %d is full, please select another one."
+msgstr "キースロット %d は使われています。別の番号を選んでください。"
+
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "デバイスサイズが論理ブロックサイズのアライメントに合いません。"
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "ヘッダが検出されましたがデバイス %s が小さすぎます。"
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "この操作はこのデバイスタイプではサポートされていません。"
+
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "オフラインでの再暗号化中です。中止します。"
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "LUKS バージョン %d はサポートされていません。"
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "分離したメタデータデバイスはこの暗号タイプではサポートされていません。"
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, c-format
+msgid "Device %s is not active."
+msgstr "デバイス %s はアクティブではありません。"
+
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "暗号化されたデバイス %s の元になるデバイスが消滅しました。"
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "不正な plain crypt のパラメータ。"
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "不正なキーサイズ。"
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID はこの暗号タイプではサポートされていません。"
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "サポートされていない暗号化セクタサイズです。"
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "デバイスサイズが要求されたセクタサイズのアライメントに合いません。"
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "デバイスなしには LUKS 形式にフォーマットできません。"
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "要求されたデータアライメントとデータオフセットが合いません。"
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "警告: データオフセットが現在利用可能なデータの外にあります。\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "デバイス %s のヘッダを消し去れません。"
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "警告: デバイスアクティベーションが失敗しました。dm-crypt が要求された暗号セクタサイズをサポートしていません。\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "ボリュームキーは改ざん耐性拡張のため暗号には鍵長が小さすぎます。"
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "暗号 %s-%s (キーサイズ %zd ビット) は利用できません。"
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "警告: LUKS2 メタデータサイズが %<PRIu64> バイトに変更されました。\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "警告: LUKS2 キースロット領域サイズが %<PRIu64> バイトに変更されました。\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "デバイス %s のサイズが小さすぎます。"
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "デバイス %s は使用中のためフォーマットできません。"
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "デバイス %s は権限がないためフォーマットできません。"
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "デバイス %s を改ざん耐性がつくようフォーマットできません。"
+
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "デバイス %s をフォーマットできません。"
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "LOOPAES としてフォーマットするにはデバイスが必要です。"
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "VERITY としてフォーマットするにはデバイスが必要です。"
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "VERITY ハッシュタイプ %d はサポートしていません。"
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "サポートしていない VERITY ブロックサイズです。"
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "サポートしていない VERITY ハッシュオフセットです。"
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "サポートしていない VERITY FEC オフセットです。"
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "データ領域がハッシュ領域と重なっています。"
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "ハッシュ領域が FEC 領域と重なっています。"
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "データ領域が FEC 領域と重なっています。"
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "警告: 指定されたタグのサイズ %d バイトが %s の出力サイズと異なります (%d バイト)。\n"
+
+#: lib/setup.c:2286
+#, c-format
+msgid "Unknown crypt device type %s requested."
+msgstr "不明な暗号デバイスタイプ %s が指定されました。"
+
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "デバイス %s のパラメータはサポートしていません。"
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "デバイス %s のパラメータがミスマッチしています。"
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Crypt デバイスが一致しません。"
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "デバイス %s のリロードに失敗しました。"
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, c-format
+msgid "Failed to suspend device %s."
+msgstr "デバイス %s のサスペンドに失敗しました。"
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "デバイス %s のリジュームに失敗しました。"
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "デバイス %s のリロード中に致命的なエラー(デバイス %s の上で)。"
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "デバイス %s を dm-error にスイッチできません。"
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "ループデバイスはリサイズできません。"
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "デバイスの UUID を本当に変更してもいいですか?"
+
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "ヘッダのバックアップファイルの中味が LUKS ヘッダと互換性がありません。"
+
+#: lib/setup.c:3058
+#, c-format
+msgid "Volume %s is not active."
+msgstr "ボリューム %s はアクティブではありません。"
+
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
+msgstr "ボリューム %s は既に停止されています。"
+
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "デバイス %s の停止はサポートされていません。"
+
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "デバイス %s 停止中にエラー。"
+
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "ボリューム %s は停止されていません。"
+
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
+msgstr "デバイス %s は再開をサポートしていません。"
+
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "デバイス %s の再開中にエラー。"
+
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "ボリュームキーがボリュームに合いません。"
+
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "キースロットを追加できません。全てのスロットが無効でボリュームキーが渡されませんでした。"
+
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "新しいキースロットを交換できませんでした。"
+
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "キースロット %d は不正です。"
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "キースロット %d は非アクティブです。"
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "デバイスヘッダがデータ領域に重なっています。"
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "既に再暗号化中です。デバイスをアクティベートできません。"
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "再暗号化ロックを取得できません。"
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "LUKS2 の再暗号化は既に初期化されました。"
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "デバイスタイプが正しく初期化されていません。"
+
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "デバイス %s を使えません。名前が不正か使用中です。"
+
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "デバイス %s は既に存在します。"
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "正しくないボリュームキーがプレーンデバイスに指定されました。"
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "正しくないルートハッシュが verity デバイスに指定されました。"
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "ルートハッシュ署名が必要です。"
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "署名をカーネルに渡すのに必要なカーネルキーリングをカーネルがサポートしていません。"
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "キーをカーネルキーリングにロードできません。"
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "デバイス %s は使用中です。"
+
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "デバイス %s は不正です。"
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "ボリュームキーのバッファが小さすぎます。"
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "プレーンデバイス向けのボリュームキーが取得できません。"
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "verity デバイスのルートハッシュが読み出せません。"
+
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "この操作は %s 暗号化デバイスではサポートされていません。"
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "このデバイスタイプはダンプ操作をサポートしていません。"
+
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr "データオフセットが %u バイトの倍数である必要があります。"
+
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "使用中のデバイス %s を変換できません。"
+
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "新しいボリュームキー向けのキースロット %u を確保できません。"
+
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "デフォルト LUKS2 キースロットパラメータを初期化できません。"
+
+#: lib/setup.c:5851
+#, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "ダイジェストするためのキースロット %d が確保できません。"
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "カーネルがカーネルキーリングをサポートしていません。"
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "キーリングからパスフレーズが読み出せません (エラー %d)。"
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "グローバル memory-hard アクセス直列化ロックが取れません。"
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "プロセス優先度を取得できません。"
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "メモリをアンロックできません。"
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "キーファイルがオープンできません。"
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "ターミナルからキーファイルを読みこめません。"
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "キーファイルを stat() できません。"
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "指定されたキーファイルオフセットにシークできません。"
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "パスフレーズ読み込み中にメモリが不足しました。"
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "パスフレーズの読み込みでエラー。"
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "読もうとしたら入力が空です。"
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "キーファイルが最大サイズを超えています。"
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "指定されたサイズのデータを読み込めません。"
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "デバイス %s は存在しないかアクセスが拒否されました。"
+
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "デバイス %s は互換性がありません。"
+
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "デバイス %s が小さすぎます。少なくとも %<PRIu64> バイト必要です。"
+
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "デバイス %s は使用中で使えません (既にマップされているかマウントされています)。"
+
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "デバイス %s が使えません、拒否されました。"
+
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "デバイス %s についての情報が取得できません。"
+
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "ループバックデバイスが使えません、非 root ユーザで実行していませんか。"
+
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "ループデバイスのアタッチできません (autoclear 付きのループデバイスが必要です)。"
+
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "指定されたオフセットはデバイス %s の実際のサイズを超えています。"
+
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "デバイス %s のサイズが 0 です。"
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "要求された PBKDF の目標時間は 0 ではいけません。"
+
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "%s は不明な PBKDF タイプです。"
+
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "要求されたハッシュ %s はサポートしていません。"
+
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "要求された PBKDF タイプは LUKS1 ではサポートされていません。"
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "PBKDF の max memory や parallel threads は pbkdf2 の時は設定できません。"
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "%s について強制される最小繰り返し回数が小さすぎます (最小 %u)。"
+
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "%s について強制されるメモリコストが小さすぎます (最小 %u KB)。"
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "指定された PBKDF メモリコストが大きすぎます (最大 %d KB)。"
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "PBKDF メモリは 0 ではいけません。"
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "要求された PBKDF 並列スレッド数は 0 ではいけません。"
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "FIPS モードでは PBKDF2 しかサポートしていません。"
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "PBKDF ベンチマークが無効ですが繰り返し回数が設定されていません。"
+
+#: lib/utils_benchmark.c:191
+#, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "PBKDF2 と互換性のないオプションです (ハッシュアルゴリズム %s)。"
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "互換性のない PBKDF オプションです。"
+
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "ロックを中止します。ロックに使うパス %s/%s が使用できません (ディレクトリでないか存在していません)。"
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "警告: ロックに使うディレクトリ %s/%s がありません!\n"
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "ロックを中止します。ロックに使うパス %s/%s が使用できません (%s はディレクトリではありません)。"
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "デバイスオフセットまで seek できません。"
+
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "デバイスのワイプでエラー, オフセット %<PRIu64>."
+
+#: lib/luks1/keyencryption.c:39
+#, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"デバイス %s の dm-crypt のキーマッピングの設定に失敗しました。\n"
+"カーネルが暗号 %s をサポートしているか確認してください (syslog にさらに情報があります)。"
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "XTS モードのキーサイズは 256 か 512 ビットでなければなりません。"
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "暗号の指定は [暗号]-[モード]-[初期ベクタ] という形式であるべきです。"
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "デバイス %s に書き込めません。パーミッションがありません。"
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "一時的なキーストアデバイスを開けません。"
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "一時的なキーストアデバイスにアクセスできません。"
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "キースロットを暗号化中にI/Oエラーが発生しました。"
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "デバイス %s を開けません。"
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "キースロットを復号化中にI/Oエラーが発生しました。"
+
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "デバイス %s が小さすぎます。(LUKS1 は最低でも %<PRIu64> バイト必要です。)"
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "LUKS キースロット %u は不正です。"
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "デバイス %s は有効な LUKS デバイスではありません。"
+
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, c-format
+msgid "Requested header backup file %s already exists."
+msgstr "要求されたヘッダバックアップファイル %s は既に存在しています。"
+
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
+msgstr "ヘッダバックアップファイル %s が作成できません。"
+
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
+msgstr "ヘッダバックアップファイル %s に書き込めません。"
+
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "バックアップファイルが有効な LUKS ヘッダを含んでいません。"
+
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, c-format
+msgid "Cannot open header backup file %s."
+msgstr "ヘッダバックアップファイル %s をオープンできません。"
+
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, c-format
+msgid "Cannot read header backup file %s."
+msgstr "ヘッダバックアップファイル %s を読めません。"
+
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "データオフセットかキーサイズがデバイスとバックアップで異なるのでリストアできません。"
+
+#: lib/luks1/keymanage.c:325
+#, c-format
+msgid "Device %s %s%s"
+msgstr "デバイス %s %s%s"
+
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "LUKS ヘッダが含まれていません。ヘッダを置き換えるとデバイスのデータを破壊する恐れがあります。"
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "LUKS ヘッダを既に含んでいます。ヘッダを置き換えると既にあるキースロットを破壊します。"
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
+msgstr ""
+"\n"
+"警告: 実デバイスのヘッダはバックアップとUUIDが異なります!"
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "標準的でないキーサイズなので、手動の修復が必要です。"
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "標準的でないキースロットアライメントなので、手動の修復が必要です。"
+
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "キースロットを修復中です。"
+
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "キースロット %i: オフセットを修復 (%u -> %u)."
+
+#: lib/luks1/keymanage.c:417
+#, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "キースロット %i: のストライプを修復 (%u -> %u)."
+
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
+msgstr "キースロット %i: パーティションの印(signature)がおかしいです。"
+
+#: lib/luks1/keymanage.c:431
+#, c-format
+msgid "Keyslot %i: salt wiped."
+msgstr "キースロット %i: ソルトを消しました。"
+
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "LUKS ヘッダを書きこんでいます。"
+
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "修復に失敗しました。"
+
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, c-format
+msgid "Requested LUKS hash %s is not supported."
+msgstr "要求された LUKS ハッシュ %s はサポートしていません。"
+
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "LUKS ヘッダに既知の不具合は検出されませんでした。"
+
+#: lib/luks1/keymanage.c:660
+#, c-format
+msgid "Error during update of LUKS header on device %s."
+msgstr "デバイス %s の LUKS ヘッダを更新中にエラーが発生しました。"
+
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "デバイス %s の LUKS ヘッダを更新後の再読み込み中にエラーが発生しました。"
+
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "LUKS ヘッダのデータへのオフセットは 0 かヘッダサイズより大きくなければいけません。"
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "LUKS UUID の形式が間違っています。"
+
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "LUKS ヘッダを作成できません: ランダムなソルトを読み込めません。"
+
+#: lib/luks1/keymanage.c:804
+#, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "LUKS ヘッダを作成できません: ヘッダのハッシュが求められません (ハッシュには %s を使用)。"
+
+#: lib/luks1/keymanage.c:848
+#, c-format
+msgid "Key slot %d active, purge first."
+msgstr "キースロット %d が使用中なので、パージしてください。"
+
+#: lib/luks1/keymanage.c:854
+#, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "キースロット %d のストライプが少なすぎます。ヘッダを細工でもしましたか?"
+
+#: lib/luks1/keymanage.c:990
+#, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "キースロットをオープンできません (ハッシュ %s を使用)。"
+
+#: lib/luks1/keymanage.c:1066
+#, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "キースロット %d は不正です。0 から %d の間を選んでください。"
+
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, c-format
+msgid "Cannot wipe device %s."
+msgstr "デバイス %s をワイプできません。"
+
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "GPG の暗号化されたキーファイルがまだサポートされていません。"
+
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "以下のようにしてください。 gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "互換性のない loop-AES キーファイルが検出されました。"
+
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "カーネルが loop-AES 互換マッピングをサポートしていません。"
+
+#: lib/tcrypt/tcrypt.c:504
+#, c-format
+msgid "Error reading keyfile %s."
+msgstr "キーファイル %s を読み込み中にエラー。"
+
+#: lib/tcrypt/tcrypt.c:554
+#, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "TCRYPT パスフレーズの最大長 (%zu) を超えました。"
+
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "PBKDF2 ハッシュアルゴリズム %s が利用できないのでスキップします。"
+
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "必要なカーネル crypto インターフェースが使用できません。"
+
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "algif_skcipher カーネルモジュールをロードしてください。"
+
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "アクティベーションは %d セクタサイズではサポートしていません。"
+
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "カーネルが TCRYPT レガシーモードのアクティベーションをサポートしていません。"
+
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "TCRYPT システム暗号をパーティション %s に対してアクティベーションしました。"
+
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "カーネルが TCRYPT 互換のマッピングをサポートしていません。"
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "この機能は TCRYPT ヘッダの読み込みなしではサポートしません。"
+
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "ボリュームマスターキーを解釈中に予期しないメタデータエントリタイプ '%u' が見つかりました。"
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "ボリュームマスターキーを解釈中に不正な文字列が見つかりました。"
+
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "ボリュームマスターキーを解釈中に予期しない文字列 ('%s') が見つかりました。"
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "ボリュームマスターキーを解釈中に予期しないメタデータエントリー値 '%u' が見つかりました。"
+
+#: lib/bitlk/bitlk.c:479
+#, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "%s から BITLK シグネチャを読み込めませんでした。"
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "BITLK version 1 はサポートされていません。"
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "BITLK デバイスのブートシグネチャが不正また不明です。"
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "BITLK デバイスのシグネチャが不正また不明です。"
+
+#: lib/bitlk/bitlk.c:510
+#, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "サポートされていないセクタサイズ %<PRIu16> です。"
+
+#: lib/bitlk/bitlk.c:518
+#, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "%s から BITLK ヘッダを読み出すのに失敗しました。"
+
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "%s から BITLK FVE メタデータを読み込めませんでした。"
+
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "不明かサポートされていない暗号化タイプです。"
+
+#: lib/bitlk/bitlk.c:627
+#, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "%s から BITLK メタデータエントリを読み込めませんでした。"
+
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "この操作はサポートされていません。"
+
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "不正なキーサイズ。"
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "この BITLK デバイスはサポートされてない状態にあるためアクティベートできません。"
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "タイプ '%s' の BITLK デバイスはアクティベートできません。"
+
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "部分的に復号された BITLK デバイスのアクティベーションはサポートされていません。"
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "カーネルの dm-crypt が BITLK IV をサポートしていないためデバイスをアクティベートできません。"
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "カーネルの dm-crypt が BITLK Elephant diffuser をサポートしていないためデバイスをアクティベートできません。"
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Verity デバイス %s はディスク上のヘッダを使いません。"
+
+#: lib/verity/verity.c:90
+#, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "デバイス %s が有効な VERITY デバイスではありません。"
+
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "VERITY バージョン %d はサポートされていません。"
+
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "VERITY ヘッダが壊れています。"
+
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "デバイス %s の VERITY UUID フォーマットが間違っています。"
+
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "デバイス %s の verity ヘッダを更新中にエラー。"
+
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "ルートハッシュ署名の検証はサポートしていません。"
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "FEC デバイスのエラーが修復できません。"
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "FEC デバイスに %u 個の修復可能なエラーが見つかりました。"
+
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "カーネルが dm-verity マッピングをサポートしていません。"
+
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "カーネルが dm-verity 署名オプションをサポートしていません。"
+
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "アクティベーションされた Verity デバイスが破損が見つかりました。"
+
+#: lib/verity/verity_hash.c:59
+#, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "ポジション %<PRIu64> にあるスペア領域が 0 埋めされていません。"
+
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "デバイスオフセットオーバーフロー。"
+
+#: lib/verity/verity_hash.c:203
+#, c-format
+msgid "Verification failed at position %<PRIu64>."
+msgstr "検証がポジション %<PRIu64> で失敗しました。"
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "verity デバイスのパラメータサイズが不正です。"
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "ハッシュ領域がオーバーフロー。"
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "データ領域の検証に失敗しました。"
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "ルートハッシュの検証に失敗しました。"
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "ハッシュ領域を生成中に I/O エラー。"
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "ハッシュ領域の作成に失敗しました。"
+
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "警告: カーネルはデータブロックサイズがページサイズ (%u) を超えているとアクティベートできません。"
+
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Reed-Solomon 処理のためのコンテキストが確保できません。"
+
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "バッファを確保できませんでした。"
+
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Reed-Solomon ブロック %<PRIu64> バイト %d を読み込めませんでした。"
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Reed-Solomon ブロック %<PRIu64> のパリティを読み込めませんでした。"
+
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "ブロック %<PRIu64> のパリティが修復できませんでした。"
+
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Reed-Solomon ブロック %<PRIu64> のパリティの書き込みに失敗しました。"
+
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "ブロックサイズが FEC と合っていません。"
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "パリティのバイト数が不正です。"
+
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
+msgstr "デバイス %s のサイズが不明です。"
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "カーネルが dm-integrity マッピングをサポートしていません。"
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "カーネルが dm-integrity 固定メタデータアラインメントをサポートしていません。"
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "デバイス %s の書き込みのためのロックを取得できませんでした。"
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "LUKS2 メタデータの更新の並列実行をしそうになりました。実行を中止します。"
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+"デバイスのシグネチャが曖昧なので、LUKS2 の自動修復ができません。.\n"
+"修復するには \"cryptsetup repair\" を実行してください。"
+
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "要求されたデータオフセットが小さすぎます。"
+
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "警告: キースロット領域 (%<PRIu64> バイト) がとても小さいため、利用可能な LUKS2 キースロット数が制限されます。\n"
+
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "デバイス %s の読み込みのためのロックを取得できませんでした。"
+
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "禁止された LUKS2 要求がバックアップ %s に検出されました。"
+
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "データオフセットがデバイスとバックアップと異なるため修復できません。"
+
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "キースロット領域のあるバイナリヘッダのサイズがデバイスとバックアップで異なるため修復できません。"
+
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "デバイス %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "LUKS2 ヘッダが含まれていません。ヘッダを置き換えるとデータを破壊しかねません。"
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "既に LUKS2 ヘッダがあります。ヘッダを置き換えると既にあるキースロットを破壊します。"
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
+msgstr ""
+"\n"
+"警告: 不明な LUKS2 への要求がリアルデバイスヘッダにあります!\n"
+"ヘッダをバックアップで置き換えるとデータを破壊する恐れがあります!"
+
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"警告: オフラインの再暗号化が終了していません!\n"
+"ヘッダを置き換えるとデータを破壊しかねません。"
+
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "不明なフラグ %s を無視しました。"
+
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "dm-crypt セグメント %u にキーがありません"
+
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "dm-crypt セグメントの設定に失敗しました。"
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "dm-linear セグメントの設定に失敗しました。"
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "サポートしていないデバイス整合性設定です。"
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "再暗号化が実行中なのでデバイスのデアクティベートできません。. Cannot deactivate device."
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "サスペンドされたデバイス %s を dm-error ターゲットで置き換えられません。"
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "LUKS2 の必要条件を読み込めませんでした。"
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "満たせない LUKS2 の必要条件があります。"
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "操作がレガシー再暗号化とマークされたデバイスと互換性がありません。中止します。"
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "操作が LUKS2 再暗号化とマークされたデバイスと互換性がありません。中止します。"
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "キースロットをオープンするのにメモリが足りません。"
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "キースロットのオープンに失敗しました。"
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "キースロットの暗号化に %s- %s 暗号は使えません。"
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "新しいキースロット用の領域がありません。"
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "UUID が %s のデバイスの状態が確認できません。"
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "LUKSMETA メタデータ付きのヘッダは変換できません。"
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "領域が足りないのでキースロット領域を動かせません。"
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "LUKS2 キースロット領域が足りないのでキースロット領域を動かせません。"
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "キースロット領域を動かせません。"
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "LUKS1 形式に変換できません - デフォルトの暗号セクタサイズが 512 バイトではありません。"
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "LUKS1 形式に変換できません - キースロットのハッシュ関数が LUKS1 互換ではありません。"
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "LUKS1 形式に変換できません - ラップされたキーの暗号に %s が使われています。"
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "LUKS1 形式に変換できません - LUKS2 ヘッダ %u 個のトークンを含んでいます。"
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "LUKS1 形式に変換できません - キースロット %u が不正な状態です。"
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "LUKS1 形式に変換できません - スロット %u が(最大個数を超過して)有効です。"
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "LUKS1 形式に変換できません - キースロット %u が LUKS1 と互換ではありません。"
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "ホットゾーンサイズは計算されたゾーンアライメントの倍数である必要がありす (%zu バイト)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "デバイスサイズが計算ゾーンアライメント (%zu バイト) に合っていません。"
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "弾性(resilience)モード %s はサポートしていません"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "古いセグメントのストレージラッパの初期化に失敗しました。"
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "新しいセグメントのストレージラッパの初期化に失敗しました。"
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "現在のホットゾーンのチェックサムを読み込めません。"
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "%<PRIu64> から始めるホットゾーンエリアを読み込めません。"
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "セクタ %zu を復号できません。"
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "セクタ %zu を復元できません。"
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "ソースとターゲットデバイスのサイズが一致しません。ソース %<PRIu64>, ターゲット: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "ホットゾーンデバイス %s がアクティベートできません。"
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "実際の origin table があるオーバーレイデバイス %s をアクティベートできません。"
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "デバイス %s の新しいマッピングをロードできません。"
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "再暗号化デバイススタックのリフレッシュに失敗しました。"
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "新しいキースロットエリアサイズを設定できません。"
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "データシフトが要求された暗号化セクタサイズにアラインされていません(%<PRIu32> bytes)。"
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "データデバイスが要求された暗号化セクタサイズにアラインされていません(%<PRIu32> bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "データシフト (%<PRIu64> セクタ) が今後のデータオフセットより少ないです (%<PRIu64> セクタ)。"
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "デバイス %s を排他モードでオープンでません (既にマップされているかマウントされています)。"
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "デバイスは LUKS2 再暗号化向けにマークされていません。"
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "LUKS2 再暗号化コンテキストをロードできません。"
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "再暗号化状態を取得できません。"
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "デバイス %s は再暗号化中ではありません。"
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "既に再暗号化中です。"
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "再暗号化ロックを取得できません。"
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "再暗号化を開始できません。再暗号化のリカバリを先にしてください。"
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "実際のデバイスサイズと要求された再暗号化サイズが一致しません。"
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "再暗号化のパラメータとして不正なデバイスサイズが要求されました。"
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "既に再暗号化中です。復元を実行できません。"
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "メタデータの LUKS2 の再暗号化は既に初期化されました。"
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "メタデータの LUKS2 再暗号化に失敗しました。"
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "デバイスセグメントの次の再暗号化ホットゾーンの設定に失敗しました。"
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "再暗号化した耐性用メタデータを書き込めません。"
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "復号に失敗しました。"
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "%<PRIu64> から始まるホットゾーンエリアに書き込めません。"
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "データを sync できません。"
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "現在のホットゾーンの再暗号化完了後にメタデータが更新できません。"
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "LUKS2 メタデータが書き込めません。"
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "バックアップセグメントデータを消せません。"
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "再暗号化の要求(requirement)フラグを禁止できません。"
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "%<PRIu64> から %<PRIu64> セクタのチャンクの再暗号化中に致命的なエラー。"
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "手動でエラーターゲットに置き換えた場合以外はデバイスのレジュームをしないでください。"
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "再暗号化を開始できません。予期しない再暗号化状態です。"
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "ないか不正な再暗号化コンテキストです。"
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "再暗号化デバイススタックの初期化に失敗しました。"
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "再暗号化コンテキストが更新できません。"
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "空きトークンスロットがありません。"
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "ビルトイントークン %s が作成できません。"
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "tty 入力以外ではパスフレーズ認証できません。"
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "キースロットの暗号化パラメータは LUKS2 デバイスでしか設定できません。"
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "未知の暗号スペックです。"
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "警告: --hash パラメータは plain モードでキーファイルが指定されていると無視されます。\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "警告: --keyfile-size オプションは無視されて、読み込みサイズは暗号鍵のサイズと同じになります。\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "%s にデバイス署名が検出されました。既にあるデータを破壊しかねません。"
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "中止されました。\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "オプション --key-file が必要です。"
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "VeraCrypt PIM を入力してください: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "不正な PIM: 解釈できません。"
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "不正 PIM の値で 0 です。"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "不正な PIM の値: 範囲外です。"
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "このパスフレーズではデバイスヘッダが検出されませんでした。"
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "デバイス %s は有効な BITLK デバイスではありません。"
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"ボリュームキーを有効にしたヘッダダンプは\n"
+"暗号化されたパーティションにパスフレーズなしでアクセス可能にます。\n"
+"このダンプは暗号化された安全な所に保存してください。"
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "デバイス %s はまたアクティブで後から削除される予定になっています。.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "アクティブなデバイスをリサイズするにはボリュームキーがキーリングに必要ですが、--disable-keyring が指定されています。"
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "ベンチマークが中止されました。"
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     計測値なし\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u 回/秒 (%zu ビットの鍵)\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s 計測値なし\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u 回, %5u KB使用, %1u スレッド (%zu のビットの鍵) (%u ms 計測)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "ベンチマークの結果は信頼できません。"
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# テストはストレージI/Oがなくメモリ上のもののため目安です。\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s Algorithm |      キー |          暗号化 |           復号化\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "暗号 %s (キーサイズ %i ビット) は利用できません。"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#     Algorithm |      キー |          暗号化 |           復号化\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "計測値なし"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"デバイスは再暗号化のリカバリを必要としていなそうです。\n"
+"本当にやりますか?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "本当に LUKS2 再暗号化リカバリを行いますか?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "再暗号化のリカバリのためのパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "本当に LUKS デバイスヘッダの復元を試みていいですか?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"整合性チェックサムの初期化のためにデバイスのデータを消去しています。\n"
+"CTRL+c で中止できます (初期化されなかったデバイスのチェックサムは正しくなくなります)。\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "一時的デバイス %s を非アクティブにできません。"
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "整合性オプションは LUKS2 形式でしか使えません。"
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "サポートされていない LUKS2 メタデータのサイズオプションです。"
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "ヘッダファイル %s を作成できません。"
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "サポートしている整合性確認方式が検出されませんでした。"
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "%s を on-disk ヘッダとして使えません。"
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "%s のデータを上書きします。戻せません。"
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "pbkdf パラメータを設定できません。"
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "分離された LUKS ヘッダでのみ少ないデータオフセットが使えます。"
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "キースロットのない LUKS のボリュームキーサイズが決定できないので、--key-size を使ってください。"
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "デバイスはアクティベートされましたが、フラグを恒常的なものにできません。"
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "キースロット %d は削除対象として選択されました。"
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "これは最後のキースロットです。このキーがなくなるとデバイスは使用不能になります。"
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "残っているパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "操作は中止されました。キースロットは消去されていません。\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "削除するキーのパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "キースロットの新しいパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "有効なパスフレーズをどれか入力してください: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "変更するキーのパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "新しいキーのパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "変換されるキースロットのパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "isLuks は一つのデバイス引数しかサポートしていません。"
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"ボリュームキーを使ったヘッダダンプは取り扱いに注意すべき情報で\n"
+"暗号化されたパーティションにパスフレーズなしでアクセス可能になります。\n"
+"このダンプは暗号化された安全な所に保存してください。"
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "キースロット %d は unbound キーを含んでいません。"
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"unbound キーを使ったヘッダダンプは取り扱いに注意すべき情報です。\n"
+"このダンプは暗号化された安全な所に保存してください。"
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "オプション --header-backup-file が必要です。"
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s は cryptsetup で管理されているデバイスではありません。"
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "リフレッシュはデバイスタイプ %s ではサポートされていません。"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "%s は認識できないメタデータデータタイプです。"
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "コマンドはデバイスとマップされた名前を引数として必要とします。"
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"この処理はデバイス %s の全てのキースロットを消去します。\n"
+"デバイスのデータは使用できなくなります。"
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "処理は中止されました。キースロットは消去されません。\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "不正な LUKS タイプです。luks1 と luks2 しかサポートしていません。"
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "デバイスは既にタイプ %s です。"
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "この処理は %s から %s フォーマットに変換します。\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "処理は中止されました。デバイスは変換されませんでした。\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "オプション --priority, --label か --subsystem がありません。"
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "トークン %d は不正です。"
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "トークン %d は使用中です。"
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "luks2-キーリングトークン %d を追加できませんでした。"
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "トークン %d をキースロット %d に割りあてられませんでした。"
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "トークン %d は使われていません。"
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "ファイルからトークンをインポートできません。"
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "トークン %d をエクスポートのために取得できませんでした。"
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "--key-description はトークン追加には必須です。"
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "トークンを必要としています。--token-id を使用してください。"
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "%s は不正なトークン処理です。"
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "データデバイス %2s のアクティブな dm デバイス '%1s'を自動検出しました。\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "デバイス %s は有効なブロックデバイスではありません。\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "デバイス %s のホルダ(holders)を自動検出できません。"
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"デバイス %s がアクティベートされているかどうか判断できません。\n"
+"オフラインでの再暗号化を進めていいですか?\n"
+"アクティベートされていたらデータが破壊されるかもしれません。\n"
+"再暗号化をオンラインで行う場合は --active-name を代わりに使ってください。\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "LUKS デバイスタイプが不正です。"
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "データデバイスサイズの縮小(--reduce-device-size)なしに分離ヘッダ(--header)による暗号化はできません。"
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "要求されたデータオフセットは --reduce-device-size パラメータの半分以下である必要があります。"
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "--reduce-device-size の値を --offset %<PRIu64> (セクタ) の倍にします。\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "暗号化は LUKS2 形式でしか使えません。"
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "LUKS デバイスが %s に検出されました。もう一度 LUKS デバイスを暗号化したいのですか?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "テンポラリヘッダファイル %s は既に存在しているので、中止します。"
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "テンポラリヘッダファイル %s を作成できません。"
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s がアクティブでオンライン暗号化可能です。\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "再暗号化に必要な空きキースロットがありません。"
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "キーファイルは --key-slot と使うか、1 つのキースロットだけアクティブの時にしか使えません。"
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "キースロット %d のパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "キースロット %u のパスフレーズを入力してください: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "コマンドはデバイスを引数として必要とします。"
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "現在 LUKS2 形式しかサポートされていません。LUKS1 には cryptsetup-reencrypt を使ってください。"
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "古いオフライン再暗号化が実行中です。cryptsetup-reencrypt を使ってください。"
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "整合性プロファイルつきのデバイスの再暗号化はサポートされていません。"
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "LUKS2 再暗号化が既に初期化済なので操作を中止します。"
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "LUKS2 デバイスは再暗号化中ではありません。"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<デバイス> [--type <タイプ>] [<名前>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "デバイスを <名前> としてオープン"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<名前>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "デバイスをクローズします (マッピングを削除します)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "アクティブデバイスをリサイズ"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "デバイスステータスを表示"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <暗号>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "暗号ベンチマーク"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<デバイス>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "on-disk メタデータを修復しようとしています"
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "LUKS2 デバイスを再暗号化"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "全てのキースロットを消去します (暗号鍵も削除します)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "LUKS2 から LUKS もしくは LUKS から LUKS2 形式に変換します"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "LUKS2 の permanent configuration オプションを設定します"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<デバイス> [<新しいキーファイル>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "LUKS デバイスをフォーマットします"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "LUKS デバイスにキーを追加します"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<デバイス> [<キーファイル>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "与えられたキーかキーファイルを LUKS デバイスから削除します。"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "与えられた LUKS デバイスのキーかキーファイルを変更します"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "キーを新しい pbkdf パラメータに変換します"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<デバイス> <キースロット>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "<キースロット>のキーを LUKS デバイスから削除します"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "LUKS デバイスの UUID を表示"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "<デバイス> の LUKS パーティションヘッダをテストします"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "LUKS パーティション情報をダンプします"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "TCRYPT デバイス情報をダンプします"
+
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "BITLK デバイス情報をダンプします"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "LUKS デバイスを停止してキーを削除します (全てのI/Oは停止します)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "停止していた LUKS デバイスを再開します"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "LUKS デバイスヘッダとキースロットをバックアップします"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "LUKS デバイスヘッダとキースロットをリストアします"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <デバイス>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "LUKS2 トークンを操作します"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<action> は以下のうちの一つです:\n"
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"古い <アクション> という形式も使えます:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<名前> は %s に作られるデバイス名\n"
+"<デバイス> は暗号化デバイス\n"
+"<キースロット> は変更する LUKS キースロット番号\n"
+"<キーファイル> は luskAddKey でオプションで与えられる新しいキーのキーファイル\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"デフォルトのコンパイル時に決められたメタデータ形式は %s です(luksFormat で使われます)。\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"デフォルトのコンパイル時に決められたキーとパスフレーズのパラメータ:\n"
+"\t最大キーファイルサイズ: %dkB, 最大パスフレーズ長 %d (文字数)\n"
+"デフォルト LUKS1 向け PBKDF: %s, 繰り返す時間: %d (ms)\n"
+"デフォルト LUKS2 向け PBKDF: %s\n"
+"\t繰り返す時間: %d, 使うメモリ: %dkB, 並列スレッド: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"デフォルトのコンパイル時に決められたデバイス暗号化のパラメータ:\n"
+"\tloop-AES: %s, キー %d ビット\n"
+"\tplain: %s, キー: %d ビット, パスワードハッシュ: %s\n"
+"\tLUKS: %s, キー: %d ビット, LUKS ヘッダハッシュ: %s, 乱数生成: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: XTS モードのデフォルトキーサイズは (2つの内部キーがあるため) 倍になります。\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: は %s を引数で与える必要があります"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "このヘルプを表示します"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "コンパクトな使用法表示をします"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "パッケージのバージョンを表示"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "ヘルプオプション:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "より詳細なエラーメッセージを表示"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "デバッグメッセージを表示"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "JSON メタデータを含むデバッグメッセージを表示"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "ディスクを暗号化するのに用いられる暗号 (/proc/crypto を参照のこと)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "パスフレーズから暗号鍵を作るのに使われるハッシュ"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "パスフレーズは2回入力してもらって検証します"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "ファイルからキーを読む"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "ボリューム(マスター)キーをファイルから読む。"
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "ボリューム(マスター)キーをキースロット情報の代わりにダンプします"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "暗号鍵のサイズ"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "ビット"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "キーファイルから読み込みの制限"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "バイト"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "キーファイルでスキップするバイト数"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "新しく追加するキーファイルの読み込みの制限"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "新しく追加するキーファイルでスキップするバイト数"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "新しいキーのスロット番号 (デフォルトは最初の空き)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "デバイスのサイズ"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "セクタ"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "指定されたデバイスサイズ分だけ使います (デバイスの残りは無視します). 危険!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "バックエンドデバイスの開始オフセット"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "最初の暗号化データのセクタを何セクタスキップするか"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "読み込み専用のマッピングを作成"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "確認をしません"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "パスフレーズの対話的入力のタイムアウト (秒単位)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "秒"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "進捗線の更新(秒単位)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "パスフレーズの再試行の回数"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "luksFormat 向けにペイロードを <n> セクタ境界に合わせます"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "LUKS ヘッダとキースロットバックアップのファイル"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "ボリュームキーの生成に /dev/random を使います"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "ボリュームキーの生成に /dev/urandom (擬似乱数)を使います"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "オーバーラップしない暗号セグメントのあるデバイスと共有します"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "使用するデバイスの UUID"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "デバイスに discards (TRIM) 処理を許可します"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "デバイスかファイルにある分離された LUKS ヘッダ"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "デバイスをアクティベートせず、パスフレーズだけ確認する"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "隠されたヘッダを使う (隠された TCRYPT デバイス)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "デバイスはシステム TCRYPT ドライブ (ブートローダの対応が必要)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "バックアップ (セカンダリ) TCRYPT ヘッダを使います"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "VeraCrypt 互換デバイスも探します"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "VeraCrypt 互換デバイス向けの Personal Iteration Multiplier"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "VeraCrypt互換デバイス向けの Query Personal Iteration Multiplier"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "デバイスメタデータのタイプ: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "パスワードの質の確認を無効にする (もし有効なら)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "dm-crypt の same_cpu_crypt performance compatibility オプションを使う"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "dm-crypt の submit_from_crypt_cpus performance compatibility オプションを使う"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "デバイスの削除はデバイス上のリソースを使う人がいなくなるまで遅延されます"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "OOM Killer を回避するために PBKDF メモリのシリアライズにグローバルロックを使います"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "LUKS 向けの PBKDF の繰り返し時間 (ms単位)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ミリ秒"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "LUKS2 向けの PBKDF アルゴリズム: argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "PBKDF メモリコスト制限"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "キロバイト"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "PBKDF 並列コスト"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "スレッド"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "PBKDF 繰り返しコスト (強制する, ベンチマークしない)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "キースロット優先度: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "ディスク上のメタデータのロックをしない"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "ボリュームキーの読み込みをカーネルキーリング経由で行わない"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "データ改ざん検出アルゴリズム (LUKS2 のみ)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "データ改ざん検出が有効なデバイスのジャーナリングを禁止します"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "フォーマット後にデバイスのデータを消去しない"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "非効率的なレガシーパディングを使う (古いカーネル)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "トークンによるアクティベーションが失敗したらパスフレーズを入力させません"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "トークンナンバー (デフォルト: 任意)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "キーデスクリプション"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "暗号化セクタサイズ (デフォルト: 512 バイト)"
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "セクタサイズ (512バイトとは限らない) のIVを使う"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "デバイスのアクティベーションフラグを持続的にします"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "LUKS2 デバイスのラベルを設定"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "LUKS2 デバイスにサブシステムレベルを設定します"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "unbound (データセグメントが割り当てられていない) LUKS2 キースロットを作成またはダンプ"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "json をファイルに読み書きする"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "LUKS2 ヘッダメタデータ領域サイズ"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "LUKS2 ヘッダキースロット領域サイズ"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "デバイスを新しいパラメータデリフレッシュ(再アクティベート)する"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "LUKS2 キースロット: 暗号鍵のサイズ"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "LUKS2 キースロット: キースロットの暗号化に使う暗号"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "LUKS2 デバイスを暗号化 (in-place で暗号化)"
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "LUKS2 デバイスを復号 (つまり暗号化をやめる)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "LUKS2 再暗号化をメタデータだけ初期化。"
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "初期化済 LUKS2 再暗号化だけ再開。"
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "データデバイスサイズを減らす (データオフセットを移動する). 危険!"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "最大再暗号化ホットゾーンサイズ"
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "再暗号化ホットゾーン弾性(resilience)タイプe (checksum,journal,none)"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "再暗号化ホットゾーンチェックサムハッシュ"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "再暗号化する dm デバイスの自動検出を上書きする"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[オプション...] <アクション> <アクション特有>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "<アクション> がありません。"
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "未知のアクションです。"
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "--refresh と --test-passphrase は同時には使えません。"
+
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "--deferred は close でしか使えません。"
+
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "--shared は plain デバイスの open にしか使えません。"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "--allow-discards は open でしか使えません。"
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "--persistent は open でしか使えません。"
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "--serialize-memory-hard-pbkdf は open でしか使えません。"
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "--persistent は --test-passphrase と一緒には使えません。"
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"--key-size は luksFormat か luksAddKey で --unbound をつけた場合か、\n"
+"open, benchmark の時しか使えません。キーファイルについて制限をつけたい場合は --keyfile-size=(バイト) を使ってください。"
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "--integrity は luksFormat (LUKS2) でしか使えません。"
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "--integrity-no-wipe は format で integrity extension 付きの時しか使えません。"
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "--label と --subsystem は luksFormat で config LUKS2 operations にしか使えません。"
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "--test-passphrase は LUKS か TCRYPT か BITLK デバイスの open にしか使えません。."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "キーサイズは 8bit の倍数でなければなりません"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "キースロットは不正です。"
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "--key-file は他で指定されたキーファイルを上書きします。"
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "オプションに負の数を与えられません。"
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "--key-file は一つしか使えません。"
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "--use-[u]random は一つしか使えません。"
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "--use-[u]random は luksFormat にしか使えません。"
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "--uuid は luksFormat か luksUUID でしか使えません。"
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "--align-payload は luksFormat でしか使えません。"
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "--luks2-metadata-size と --opt-luks2-keyslots-size は LUKS2 で luksFormat でしか使えません。"
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "不正なLUKS2 メタデータサイズです。"
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "不正な LUKS2 キースロットサイズです。"
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "--align-payload と --offset は一緒に使えません。"
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "--skip は plain か loopaes デバイスの open にしか使えません。"
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "--offset は plain か loopaes デバイスの open、luksFormat と再暗号化にしか使えません。"
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "--tcrypt-hidden と --tcrypt-system と --tcrypt-backup は TCRYPT デバイスしか使えません。"
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "--tcrypt-hidden は --allow-discards と一緒に使えません。"
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "--veracrypt は TCRYPT デバイスでしか使えません。"
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "--veracrypt-pim の引数が不正です。"
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "--veracrypt-pim は VeraCrypt 互換デバイスにしか使えません。"
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "--veracrypt-query-pim は VeraCrypt 互換デバイスにしか使えません。"
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "--veracrypt-pim と --veracrypt-query-pim はどちらかしか使えません。"
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "--priority の引数は ignore/normal/prefer のいずれかのみです。"
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "キースロットの指定が必要です。"
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "パスワードからキーを作る関数 (PBKDF) は pbkdf2 argon2i argon2id のいずれかのみです。"
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "PBKDF の繰り返し回数の強制と繰り返し時間指定オプションは共存できません。"
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "このコマンドでセクタサイズオプションはサポートされていません。"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "大きな IV セクタオプションは plain タイプでセクタサイズが 512 バイトより大きいものをオープンする時しかサポートしていません。"
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "--unbound にはキーサイズが必要です。"
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "--unbound は luksAddKey か luksDump でしか使えません。"
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "--refresh は open でしか使えません。"
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "メタデータロックを禁止できません。"
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "再暗号化ホットゾーン最大サイズの指定が不正です。"
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "デバイスサイズの指定が不正です。"
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "デバイスを減らせる最大値は 1 GiB です。"
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "減らすサイズは 512 バイトセクタの倍数である必要があります。"
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "データサイズの指定が不正です。"
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "減らすサイズのオーバーフロー。"
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "LUKS2 復号には --header が必要です。"
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "デバイスサイズは 512 バイトセクタの倍数である必要があります。"
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "--reduce-device-size と --data-size は一緒に使えません。"
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "--device-size と --size は一緒に使えません。"
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "--ignore-corruption と --restart-on-corruption は同時に使えません。"
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "不正なソルト文字列が指定されました。"
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "ハッシュイメージ %s を書けるように作成できませんでした。"
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "FEC イメージ %s を書けるように作成できませんでした。"
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "不正なルートハッシュ文字列が指定されました。"
+
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr "署名ファイル %s が不正です。"
+
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "署名ファイル %s を読み込めませんでした。"
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<データデバイス> <ハッシュデバイス>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "デバイスをフォーマット"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<データデバイス> <ハッシュデバイス> <ルートハッシュ>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "デバイスを検証"
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<データデバイス> <名前> <ハッシュデバイス> <ルートハッシュ>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "アクティブデバイスのステータスを表示"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<ハッシュデバイス>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "ディスク上の情報を表示"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<名前> は %s に作られるデバイス\n"
+"<データデバイス> はデータが入るデバイス\n"
+"<ハッシュデバイス> は検証用データが入るデバイス\n"
+"<ルートハッシュ> は <ハッシュデバイス> のルートノードのハッシュ\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"コンパイル時に決めた dm-verity のデフォルトパラメータ:\n"
+"\tハッシュ: %s, データブロック (バイト): %u, ハッシュブロック (バイト): %u, ソルトサイズ: %u, ハッシュフォーマット: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "verity スーパーブロックを使いません"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "フォーマットタイプ (1 - ノーマル, 0 - Chrome OS 形式)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "数字"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "データデバイスのブロックサイズ"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "ハッシュデバイスのブロックサイズ"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "FEC パリティバイト"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "データファイルのブロック数"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "ブロック"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "誤り訂正用データが格納されるデバイスのパス"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "パス"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "ハッシュデバイスの開始オフセット"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "FEC デバイスの開始オフセット"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "ハッシュアルゴリズム"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "文字列"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "ソルト"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "16進数文字列"
+
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "ルートハッシュ署名ファイルのパス"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "破損が検出されたらカーネルを再起動する"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "破損はログするだけで再起動まではしない"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "0 埋めされたブロックは検証しない"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "最初に読む時一度だけデータブロックを検証する"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "--ignore-corruption, --restart-on-corruption, --ignore-zero-blocks は open 時にか使えません。"
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "--root-hash-signature は open でしか使えません。"
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "--ignore-corruption と --restart-on-corruption は同時に使えません。"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "キーファイル %s を読みこめませんでした。"
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "%d バイトをキーファイル %s から読みこめませんでした。"
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "タグサイズ %u、内部整合性は %s でフォーマットされました。\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<整合性デバイス>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<整合性デバイス> <名前>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<名前> は %s に作られるデバイス\n"
+"<整合性デバイス> は整合性タグを格納するデバイス\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"コンパイル時に決められたデフォルトの dm-integrity のパラメータ:\n"
+"\tチェックサムアルゴリズム: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "データデバイスのパス (分離されている場合)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "ジャーナルサイズ"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "インターリーブするセクタ数"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "ジャーナルをフラッシュする閾値"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "パーセント"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "ジャーナルがコミットされるまでの時間"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ミリ秒"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "ビットあたりの 512 バイトセクタ (bitmap モード)。"
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Bitmap モードのフラッシュ時間"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "タグサイズ (セクタ毎)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "セクタサイズ"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "バッファサイズ"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "データ整合性アルゴリズム"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "データ整合性キーのサイズ"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "整合性キーをファイルから読み込む"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "ジャーナル整合性アルゴリズム"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "ジャーナル整合性キーのサイズ"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "ジャーナル整合性キーをファイルから読み込む"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "ジャーナル暗号化アルゴリズム"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "ジャーナル暗号化キーのサイズ"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "ジャーナル暗号化キーをファイルから読み込む"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "リカバリモード (ジャーナル不使用、タグ確認なし)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "変更の追跡に bitmap を使いジャーナルの整合性デバイスの無効にします"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "初期タグを自動で再計算する。"
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "--integrity-recalculate は open でしか使えません。"
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "--journal-size, --interleave-sectors, --sector-size, --tag-size, --no-wipe は format でしか使えません。"
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "不正なジャーナルサイズの指定です。"
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "キーファイルとキーサイズの両方の指定が必要です。"
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "整合性キーを使う場合はアルゴリズムの指定が必要です。"
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "ジャーナル整合性キーファイルとキーサイズの両方の指定が必要です。"
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "ジャーナル整合性キーを使う場合はアルゴリズムの指定が必要です。"
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "ジャーナル暗号キーファイルとキーサイズの両方の指定が必要です。"
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "ジャーナル暗号キーを使う場合はアルゴリズムの指定が必要です。"
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "リカバリと bitmap モードオプションは同時には使えません。"
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "ジャーナルオプションは bitmap モードでは使えません。"
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "bitmap オプションは bitmap モードでしか使えません。"
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "既に再暗号化中です。"
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "デバイスが使用中のため %s を排他的にオープンできません。"
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "アライメントつきメモリの確保ができませんでした。"
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "デバイス %s を読めません。"
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "LUKS1 デバイス %s を使用不可としてマークします。"
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "LUKS2 offline reencrypt フラグをデバイス %s に設定します。"
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "デバイス %s に書き込めません。"
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "再暗号化ログファイルに書きこめません。"
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "再暗号化ログファイルを読み込めません。"
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "ログファイル %s が既にあるので再暗号化を再開します。\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "古い LUKS ヘッダを使っているテンポラリデバイスを有効にします。"
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "新しい LUKS ヘッダを使っているテンポラリデバイスを有効にします。"
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "テンポラリデバイスの有効化に失敗しました。"
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "データオフセットの設定に失敗しました。"
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "メタデータサイズの設定に失敗しました。"
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "デバイス %s の新しい LUKS ヘッダを作成しました。"
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "このバージョンの cryptsetup-reencrypt は新しい内部トークンタイプ %s を扱えません。"
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "アクティベーションフラグをバックアップヘッダから読み込めません。"
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "アクティベーションフラグを新しいヘッダに書き込めません。"
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "バックアップヘッダから要求(requirements)を読み込めません。"
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "%s ヘッダバックアップデバイス %s が作成されました。"
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "LUKS バックアップヘッダが作成できません。"
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "デバイス %2s の %1s ヘッダが復元できません。"
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "デバイス %2s の %1s ヘッダを復元しました。"
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "テンポラリ LUKS デバイスをオープンできません。"
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "デバイスサイズを取得できません。"
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "再暗号化中に I/O エラーが発生しました。"
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "与えられた UUID が不正です。"
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "再暗号化ログファイルを開けません。"
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "復号を実行中ではありません。与えられた UUID は中止された復号を再開するためだけに使えます。"
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "キースロット %i の pbkdf パラメータを変更しました。"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "再暗号化のブロックサイズ"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "キーを変えず、データ領域の再暗号化を行わない"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "新しいボリューム(マスター)キーをファイルから読み込む"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "LUKS 向け PBKDF2 の繰り返し時間 (ミリ秒単位)"
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "デバイスアクセス時に direct-io を使う"
+
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "ブロック毎に fsync() する"
+
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "ログファイルをブロック毎に更新する"
+
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "このスロットだけ使う (残りは無効化されます)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "暗号化されていないデバイスに新しいヘッダを作成する"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "デバイスを恒久的に復号状態にする (つまり暗号化をやめる)"
+
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "復号の再開に使う UUID"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "メタデータタイプ: luks1, luks2"
+
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[オプション...] <デバイス>"
+
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "再暗号化で以下が変わります: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "ボリュームキー"
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "ハッシュ"
+
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr "暗号(cipher)"
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "引数が必要です。"
+
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "再暗号化のブロックサイズは 1 MiB から 64 MiB までの値しか使えません。"
+
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "デバイスを減らせる最大値は 64 MiB です。"
+
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "--new は --reduce-device-size か --header と一緒に使う必要があります"
+
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "--keep-key は --hash か --iter-time か --pbkdf-force-iterations と使う必要があります。"
+
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "--new は --decrypt と一緒に使えません。"
+
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "--decrypt は指定されたパラメータと互換性がありません。"
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "--uuid は --decrypt と一緒にしか使えません。"
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "不正な luks タイプです。'luks', 'luks1', 'luks2' のいずれかを使ってください。"
+
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "端末から応答を読み込み中にエラー。"
+
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "コマンド成功。\n"
+
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "パラメータが間違っているか指定されていません"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "権限がないかパスフレーズが間違っています"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "メモリ不足"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "間違ったデバイスかファイルが指定されました"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "デバイスが既にあるかビジーです"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "不明なエラー"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "コマンド失敗:コード %i (%s)\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "キースロット %i が作成されました。"
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "キースロット %i がアンロックされました。"
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "キースロット %i が削除されました。"
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "トークン %i が作成されました。"
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "トークン %i が削除されました。"
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"ワイプが中断されました。"
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "警告: デバイス %s が既に '%s' パーティションシグネチャを含んでいます。\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "警告: デバイス %s が既に '%s' のスーパーブロックシグネチャを含んでいます。\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "デバイスシグネチャ検出の初期化に失敗しました。"
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "デバイス %s の stat() に失敗しました。"
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "デバイス %s は使用中です。フォーマットを始められません。"
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "ファイル %s を読み書き可能なモードでオープンできません。"
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "今ある '%s' パーティションのシグネチャ(オフセット: %<PRIi64> バイト、デバイス %s)は消去されます。"
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "今ある '%s' スーパーブロックのシグネチャ(オフセット: %<PRIi64> バイト、デバイス %s)は消去されます。"
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "デバイスシグネチャを消せません。"
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "デバイス %s のシグネチャが検出できません。"
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"再暗号化が中断されました。"
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "パスワードの質を確認できません: %s"
+
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+"パスワードの質の確認に失敗:\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "パスワードの質が確認できません: 質の悪いパスフレーズ (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "端末からパスフレーズを読み込めません。"
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "同じパスフレーズを入力してください: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "パスフレーズが一致しません。"
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "端末からの入力でオフセットは使用できません。"
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "パスフレーズを入力してください: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "%s のパスフレーズを入力してください: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "このパスフレーズで使用可能なキーはありません。"
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "使用可能なキースロットがありません。"
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "キーファイル %s を書き込み用にオープンできません。"
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "キーファイル %s に書き込めません。"
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "ファイル %s を読み込み専用モードでオープンできません。"
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "妥当な LUKS2 トークンを JSON で与えてください:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "JSON ファイルを読み込めません。"
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"読み込みが中断されました。"
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "ファイル %s を書き込みモードでオープンできません。"
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"書き込みが中断されました。"
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "JSON ファイルに書き込めません。"
index 0c405b5..48055cb 100644 (file)
Binary files a/po/nl.gmo and b/po/nl.gmo differ
index 6d108a0..61164a8 100644 (file)
--- a/po/nl.po
+++ b/po/nl.po
-# Dutch translation of cryptsetup.
+# Dutch translations for cryptsetup.
+# Copyright (C) 2020 Free Software Foundation, Inc.
 # This file is distributed under the same license as the cryptsetup package.
-# Copyright (C) 2014 Free Software Foundation, Inc.
-# Koen Torfs <koen@drunkfelines.com>, 2014.
+#
+# Koen <koen@drunkfelines.com>, 2017.
+# Benno Schulenberg <vertaling@coevern.nl>, 2020.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup-1.6.6\n"
+"Project-Id-Version: cryptsetup-2.3.0-rc0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2014-08-13 02:34+0100\n"
-"Last-Translator: Koen Torfs <koen@drunkfelines.com>\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-01-13 20:42+0100\n"
+"Last-Translator: Benno Schulenberg <vertaling@coevern.nl>\n"
 "Language-Team: Dutch <vertaling@vrijschrift.org>\n"
 "Language: nl\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"Kan apparaatstoewijzer niet initialiseren, uitvoering als non-root "
-"gebruiker.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Kan apparaatstoewijzer niet initialiseren, uitvoering als non-root gebruiker."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"Kan apparaatstoewijzer niet initialiseren. Is kernelmodule dm_mod geladen?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Kan apparaatstoewijzer niet initialiseren. Is kernelmodule dm_mod geladen?"
+
+#: lib/libdevmapper.c:1131
+#, fuzzy
+msgid "Requested deferred flag is not supported."
+msgstr "Aangevraagde LUKS-hash %s wordt niet ondersteund.\n"
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "DM-UUID voor apparaat %s werd afgekapt.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID voor apparaat %s werd afgekapt."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr ""
 
-#: lib/libdevmapper.c:698
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Aangevraagde prestatie-opties voor dm-crypt worden niet ondersteund."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Aangevraagde opties voor behandeling van datacorruptie van dm-verity worden niet ondersteund."
+
+#: lib/libdevmapper.c:1634
 #, fuzzy
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Aangevraagde LUKS-hash %s wordt niet ondersteund.\n"
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Aangevraagde prestatie-opties voor dm-crypt worden niet ondersteund.\n"
+
+#: lib/libdevmapper.c:1638
+#, fuzzy
+msgid "Requested data integrity options are not supported."
+msgstr "Aangevraagde prestatie-opties voor dm-crypt worden niet ondersteund.\n"
+
+#: lib/libdevmapper.c:1640
+#, fuzzy
+msgid "Requested sector_size option is not supported."
+msgstr "Aangevraagde prestatie-opties voor dm-crypt worden niet ondersteund.\n"
+
+#: lib/libdevmapper.c:1645
+#, fuzzy
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Aangevraagde opties voor behandeling van datacorruptie van dm-verity worden niet ondersteund.\n"
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+#, fuzzy
+msgid "Discard/TRIM is not supported."
+msgstr "Aangevraagd hash-algoritme %s wordt niet ondersteund.\n"
+
+#: lib/libdevmapper.c:1653
+#, fuzzy
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Aangevraagde opties voor behandeling van datacorruptie van dm-verity worden niet ondersteund.\n"
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr ""
 
-#: lib/random.c:76
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
-"Systeem heeft niet genoeg willekeurige gegevens om de sleutel tot het "
-"opslagmedium verder te genereren.\n"
-"Beweeg de muis of typ wat tekst in een nieuw venster om enkele willekeurige "
-"evenementen te verzamelen.\n"
+"Systeem heeft niet genoeg willekeurige gegevens om de sleutel tot het opslagmedium verder te genereren.\n"
+"Beweeg de muis of typ wat tekst in een nieuw venster om enkele willekeurige evenementen te verzamelen.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Sleutel wordt gegenereerd (%d%% afgewerkt).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr "Fatale fout bij initialisatie van RNG.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Uitvoering in FIPS-modus."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Fatale fout bij initialisatie van RNG."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Onbekende RNG-kwaliteit aangevraagd."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Fout bij lezen uit RNG."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr "Onbekende RNG-kwaliteit aangevraagd.\n"
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Kan RNG versleutelings-backend niet initialiseren."
 
-#: lib/random.c:211
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Kan versleutelings-backend niet initialiseren."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Aangevraagd hash-algoritme %s wordt niet ondersteund."
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
 #, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Fout %d bij lezen uit RNG: %s\n"
+msgid "Key processing error (using hash %s)."
+msgstr "Sleutelbehandelingsfout (met hash %s in gebruik)."
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr "Kan RNG versleutelings-backend niet initialiseren.\n"
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Apparaatstype kan niet bepaald worden. Incompatibele apparaatsactivering?"
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Kan versleutelings-backend niet initialiseren.\n"
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Deze operatie wordt enkel ondersteund voor LUKS-apparaten."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Deze operatie wordt enkel ondersteund voor LUKS2-apparaten."
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Alle sleutelplaatsen zijn vol."
+
+#: lib/setup.c:434
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "Aangevraagd hash-algoritme %s wordt niet ondersteund.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Sleutelplaats %d is ongeldig, selecteer een plaats tussen 0 en %d."
+
+#: lib/setup.c:440
+#, c-format
+msgid "Key slot %d is full, please select another one."
+msgstr "Sleutelplaats %d is vol, selecteer een andere."
+
+#: lib/setup.c:525 lib/setup.c:2824
+#, fuzzy
+msgid "Device size is not aligned to device logical block size."
+msgstr "Apparaat %s is geen geldig LUKS-apparaat.\n"
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:624
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Sleutelbehandelingsfout (met hash %s in gebruik).\n"
+msgid "Header detected but device %s is too small."
+msgstr "Koptekst gevonden maar apparaat %s is te klein."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Deze operatie wordt niet ondersteund voor dit apparaatstype."
+
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
 msgstr ""
-"Apparaatstype kan niet bepaald worden. Incompatibele apparaatsactivering?\n"
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Deze operatie wordt enkel ondersteund voor LUKS-apparaten.\n"
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "Niet-ondersteunde LUKS-versie %d."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Alle sleutelplaatsen zijn vol.\n"
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+#, fuzzy
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "UUID wordt niet ondersteund voor dit encryptietype.\n"
 
-#: lib/setup.c:327
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr "Sleutelplaats %d is ongeldig, selecteer een plaats tussen 0 en %d.\n"
+msgid "Device %s is not active."
+msgstr "Apparaat %s is niet actief."
 
-#: lib/setup.c:333
+#: lib/setup.c:1444
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "Sleutelplaats %d is vol, selecteer een andere.\n"
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Onderliggend apparaat van versleutelingsapparaat %s is verdwenen."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Ongeldige normale versleutelingsparameters."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Ongeldige sleutelgrootte."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID wordt niet ondersteund voor dit encryptietype."
 
-#: lib/setup.c:472
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+#, fuzzy
+msgid "Unsupported encryption sector size."
+msgstr "Kan herencryptie-logbestand niet lezen.\n"
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+#, fuzzy
+msgid "Device size is not aligned to requested sector size."
+msgstr "Apparaat %s is geen geldig LUKS-apparaat.\n"
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Kan LUKS niet formatteren zonder apparaat."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr ""
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr ""
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Voer wachtwoord in voor %s: "
+msgid "Cannot wipe header on device %s."
+msgstr "Kan koptekst op apparaat %s niet wissen."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr ""
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr ""
+
+#: lib/setup.c:1821
+#, fuzzy, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Versleutelalgoritme %s is niet beschikbaar.\n"
 
-#: lib/setup.c:653
+#: lib/setup.c:1854
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "Koptekst gevonden maar apparaat %s is te klein.\n"
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr ""
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Deze operatie wordt niet ondersteund voor dit apparaatstype.\n"
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Apparaat %s is niet actief.\n"
+msgid "Device %s is too small."
+msgstr "Apparaat %s is te klein."
 
-#: lib/setup.c:925
+#: lib/setup.c:1893 lib/setup.c:1919
+#, fuzzy, c-format
+msgid "Cannot format device %s in use."
+msgstr "Kan apparaat %s niet formatteren; het is nog steeds actief.\n"
+
+#: lib/setup.c:1896 lib/setup.c:1922
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr "Onderliggend apparaat van versleutelingsapparaat %s is verdwenen.\n"
+msgid "Cannot format device %s, permission denied."
+msgstr "Kan apparaat %s niet formatteren: toestemming geweigerd."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Ongeldige normale versleutelingsparameters.\n"
+#: lib/setup.c:1908 lib/setup.c:2229
+#, fuzzy, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Kan apparaat %s niet beschrijven.\n"
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Ongeldige sleutelgrootte.\n"
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "Kan apparaat %s niet formatteren."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "UUID wordt niet ondersteund voor dit encryptietype.\n"
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Kan LOOPAES niet formatteren zonder apparaat."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Kan LUKS niet formatteren zonder apparaat.\n"
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Kan VERITY niet formatteren zonder apparaat."
 
-#: lib/setup.c:1089
+#: lib/setup.c:2000 lib/verity/verity.c:102
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Kan apparaat %s niet formatteren; het is nog steeds actief.\n"
+msgid "Unsupported VERITY hash type %d."
+msgstr "Niet-ondersteund VERITY-hashtype %d."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Niet-ondersteunde VERITY-blokgrootte."
 
-#: lib/setup.c:1092
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Niet-ondersteunde VERITY-hashgegevenspositie."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Niet-ondersteunde VERITY-FEC-gegevenspositie."
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Overlapping tussen datagedeelte en hashgedeelte."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Overlapping tussen hashgedeelte en FEC-gedeelte."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Overlapping tussen datagedeelte en FEC-gedeelte."
+
+#: lib/setup.c:2208
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Kan apparaat %s niet formatteren: toestemming geweigerd.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
 
-#: lib/setup.c:1096
+#: lib/setup.c:2286
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Onbekend versleutelingsapparaattype %s aangevraagd."
+
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, fuzzy, c-format
+msgid "Unsupported parameters on device %s."
 msgstr "Kan koptekst op apparaat %s niet wissen.\n"
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Kan LOOPAES niet formatteren zonder apparaat.\n"
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, fuzzy, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Kan koptekst op apparaat %s niet wissen.\n"
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "Kan VERITY niet formatteren zonder apparaat.\n"
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr ""
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
-#, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Niet-ondersteund VERITY-hashtype %d.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "Kan apparaat niet lezen: %s.\n"
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Niet-ondersteunde VERITY-blokgrootte.\n"
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, fuzzy, c-format
+msgid "Failed to suspend device %s."
+msgstr "Openen van sleutelbestand is mislukt.\n"
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Niet-ondersteunde VERITY-hashgegevenspositie.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "Kan apparaat niet lezen: %s.\n"
 
-#: lib/setup.c:1285
+#: lib/setup.c:2732
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Onbekend versleutelingsapparaattype %s aangevraagd.\n"
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr ""
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Kan geen map voor de apparaatstoewijzer verkrijgen."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Kan grootte van loopback-apparaat niet aanpassen."
 
-#: lib/setup.c:1435
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "Bent u zeker dat u het UUID van het apparaat wilt wijzigen?"
 
-#: lib/setup.c:1545
-#, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Opslagmedium %s is niet actief.\n"
+#: lib/setup.c:2958
+#, fuzzy
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Reservekopiebestand bevat geen geldige LUKS-koptekst.\n"
 
-#: lib/setup.c:1556
+#: lib/setup.c:3058
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Opslagmedium %s is reeds geschorst.\n"
+msgid "Volume %s is not active."
+msgstr "Opslagmedium %s is niet actief."
 
-#: lib/setup.c:1563
+#: lib/setup.c:3069
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "Opschorten wordt niet ondersteund voor apparaat %s.\n"
+msgid "Volume %s is already suspended."
+msgstr "Opslagmedium %s is reeds geschorst."
 
-#: lib/setup.c:1565
+#: lib/setup.c:3082
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Fout bij het opschorten van apparaat %s.\n"
+msgid "Suspend is not supported for device %s."
+msgstr "Opschorten wordt niet ondersteund voor apparaat %s."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:3084
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Opslagmedium %s is niet geschorst.\n"
+msgid "Error during suspending device %s."
+msgstr "Fout bij het opschorten van apparaat %s."
 
-#: lib/setup.c:1605
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Hervatting wordt niet ondersteund voor apparaat %s.\n"
+msgid "Volume %s is not suspended."
+msgstr "Opslagmedium %s is niet geschorst."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:3146
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Fout bij het hervatten van apparaat %s.\n"
+msgid "Resume is not supported for device %s."
+msgstr "Hervatting wordt niet ondersteund voor apparaat %s."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Voer wachtwoord in: "
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "Fout bij het hervatten van apparaat %s."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Kan geen sleutelplaats toevoegen, alle plaatsen zijn uitgeschakeld en geen "
-"sleutel tot het opslagmedium voorzien.\n"
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Sleutel tot opslagmedium komt niet overeen met het opslagmedium."
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Voer enig wachtwoord in: "
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Kan geen sleutelplaats toevoegen, alle plaatsen zijn uitgeschakeld en er is geen sleutel tot het opslagmedium voorzien."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Voer een nieuw wachtwoord in voor de sleutelplaats: "
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Kan nieuwe sleutelplaats niet verwisselen."
 
-#: lib/setup.c:1798
+#: lib/setup.c:3669
 #, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Sleutelplaats %d werd gewijzigd.\n"
+msgid "Key slot %d is invalid."
+msgstr "Sleutelplaats %d is ongeldig."
 
-#: lib/setup.c:1801
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Vervangen door sleutelplaats %d.\n"
+msgid "Keyslot %d is not active."
+msgstr "Sleutelplaats %d is niet in gebruik."
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Kan nieuwe sleutelplaats niet verwisselen.\n"
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Overlapping tussen apparaatskoptekst en hashgedeelte."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr ""
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+#, fuzzy
+msgid "Failed to get reencryption lock."
+msgstr "Kan herencryptie-logbestand niet lezen.\n"
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+#, fuzzy
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Kan herencryptie-logbestand niet openen.\n"
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Apparaatstype is niet behoorlijk geïnitialiseerd."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Sleutel tot opslagmedium komt niet overeen met het opslagmedium.\n"
+#: lib/setup.c:4171
+#, fuzzy, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Kan apparaat %s niet formatteren; het is nog steeds actief.\n"
 
-#: lib/setup.c:1961
+#: lib/setup.c:4174
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Sleutelplaats %d is ongeldig.\n"
+msgid "Device %s already exists."
+msgstr "Apparaat %s bestaat reeds."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Incorrecte sleutel tot het opslagmedium voor normaal apparaat verschaft."
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Incorrecte root-hash voor het VERITY-apparaat opgegeven."
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr ""
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr ""
+
+#: lib/setup.c:4438 lib/setup.c:5915
+#, fuzzy
+msgid "Failed to load key in kernel keyring."
+msgstr "Openen van sleutelbestand is mislukt.\n"
 
-#: lib/setup.c:1966
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Sleutelplaats %d is niet in gebruik.\n"
+msgid "Device %s is still in use."
+msgstr "Apparaat %s is nog in gebruik."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:4516
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Apparaat %s bestaat reeds.\n"
+msgid "Invalid device %s."
+msgstr "Ongeldig apparaat %s."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr ""
-"Incorrecte sleutel tot het opslagmedium voor normaal apparaat verschaft.\n"
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Sleutelbuffer van het opslagmedium is te klein."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Kan sleutel tot het opslagmedium voor normaal apparaat niet ophalen."
+
+#: lib/setup.c:4657
+#, fuzzy
+msgid "Cannot retrieve root hash for verity device."
 msgstr "Incorrecte root-hash voor het VERITY-apparaat opgegeven.\n"
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Apparaatstype is niet behoorlijk geïnitialiseerd.\n"
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Deze operatie wordt niet ondersteund voor versleutelapparaat %s."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Dump-operatie wordt niet ondersteund voor dit apparaatstype."
 
-#: lib/setup.c:2259
+#: lib/setup.c:5190
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Apparaat %s is nog in gebruik.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr ""
+
+#: lib/setup.c:5475
+#, fuzzy, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Kan apparaat %s niet formatteren; het is nog steeds actief.\n"
 
-#: lib/setup.c:2268
+#: lib/setup.c:5772
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Ongeldig apparaat %s.\n"
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr ""
+
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr ""
+
+#: lib/setup.c:5851
+#, fuzzy, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Kan nieuwe sleutelplaats niet verwisselen.\n"
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Functie niet beschikbaar in FIPS-modus.\n"
+#: lib/setup.c:5982
+#, fuzzy
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Deze operatie wordt niet ondersteund voor dit apparaatstype.\n"
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Sleutelbuffer van het opslagmedium is te klein.\n"
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, fuzzy, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Lezen uit sleutelopslag is mislukt.\n"
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "Kan sleutel tot het opslagmedium voor normaal apparaat niet ophalen.\n"
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr ""
 
-#: lib/setup.c:2310
-#, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Deze operatie wordt niet ondersteund voor versleutelapparaat %s.\n"
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Kan geen procesprioriteit verkrijgen."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr "Dump-operatie niet ondersteund voor dit apparaatstype.\n"
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Kan geheugen niet ontgrendelen."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Kan geen procesprioriteit verkrijgen.\n"
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Openen van sleutelbestand is mislukt."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Kan geheugen niet ontgrendelen.\n"
+#: lib/utils.c:173
+#, fuzzy
+msgid "Cannot read keyfile from a terminal."
+msgstr "Kan sleutelbestand %s niet lezen.\n"
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Geen geheugen meer beschikbaar bij lezen van wachtwoord.\n"
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Kan status van sleutelbestand niet opvragen."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Fout bij het lezen van het wachtwoord uit de terminal.\n"
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Kan niet zoeken tot aan het aangevraagde sleutelbestand."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Voer wachtwoord nogmaals in: "
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Geen geheugen meer beschikbaar bij lezen van wachtwoord."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Fout bij lezen van wachtwoord."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Wachtwoorden komen niet overeen.\n"
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr ""
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Kan de gegevenspositie niet via terminalinvoer gebruiken.\n"
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Maximum sleutelbestandsgrootte overschreden."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "Openen van sleutelbestand is mislukt.\n"
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Kan aangevraagde hoeveelheid data niet lezen."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "Kan status van sleutelbestand niet opvragen.\n"
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Apparaat %s bestaat niet of toegang is geweigerd."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr "Kan niet zoeken tot aan het aangevraagde sleutelbestand.\n"
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Apparaat %s is niet compatibel."
+
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Apparaat %s is te klein.  Minstens %<PRIu64> bytes zijn vereist."
+
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Kan apparaat %s niet gebruiken; het is nog actief (reeds toegewezen of aangekoppeld)."
+
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Kan apparaat %s niet gebruiken: toestemming geweigerd."
+
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Kan geen informatie verkrijgen over apparaat %s."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Fout bij lezen van wachtwoord.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Kan geen loopback-apparaat gebruiken, uitvoering als non-root gebruiker."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Maximum sleutelbestandsgrootte overschreden.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Vastmaken loopback-apparaat gefaald (loop-apparaat met autoclear-vlag is vereist)."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "Kan aangevraagde hoeveelheid data niet lezen.\n"
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "De aangevraagde gegevenspositie valt buiten de werkelijke grootte van apparaat %s."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/utils_device.c:817
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Apparaat %s bestaat niet of toegang is geweigerd.\n"
+msgid "Device %s has zero size."
+msgstr "Apparaat %s heeft grootte nul."
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr ""
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
 msgstr ""
-"Kan geen loopback-apparaat gebruiken, uitvoering als non-root gebruiker.\n"
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Kan geen vrij loopback-apparaat vinden.\n"
+#: lib/utils_pbkdf.c:111
+#, fuzzy, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Aangevraagde LUKS-hash %s wordt niet ondersteund.\n"
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
+#: lib/utils_pbkdf.c:122
+#, fuzzy
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Aangevraagde LUKS-hash %s wordt niet ondersteund.\n"
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
 msgstr ""
-"Vastmaken loopback-apparaat gefaald (loop-apparaat met autoclear-vlag is "
-"vereist).\n"
 
-#: lib/utils_device.c:484
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
 msgstr ""
-"Kan apparaat %s niet gebruiken; het is nog actief (reeds toegewezen of "
-"aangekoppeld).\n"
 
-#: lib/utils_device.c:488
+#: lib/utils_pbkdf.c:148
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Kan geen informatie verkrijgen over apparaat %s.\n"
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr ""
 
-#: lib/utils_device.c:494
+#: lib/utils_pbkdf.c:155
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr ""
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr ""
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr ""
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
 msgstr ""
-"De aangevraagde gegevenspositie valt buiten de werkelijke grootte van "
-"apparaat %s.\n"
 
-#: lib/utils_device.c:502
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Apparaat %s heeft grootte nul.\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Niet-compatibele PBKDF2-opties (met hash-algoritme %s in gebruik)."
+
+#: lib/utils_benchmark.c:211
+#, fuzzy
+msgid "Not compatible PBKDF options."
+msgstr "Niet-compatibele PBKDF2-opties (met hash-algoritme %s in gebruik).\n"
 
-#: lib/utils_device.c:513
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Apparaat %s is te klein.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr ""
 
-#: lib/luks1/keyencryption.c:37
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid ""
-"Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr ""
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
 msgstr ""
-"Kan dm-crypt sleuteltoewijzing niet instellen voor apparaat %s.\n"
-"Kijk na of de kernel versleutelalgoritme %s ondersteunt (bekijk syslog voor "
-"meer informatie).\n"
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "In XTS-modus moet de sleutelgrootte 256 of 512 bits zijn.\n"
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Onmogelijk te zoeken tot startplaats van apparaat."
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Kan apparaat %s niet beschrijven: toestemming geweigerd.\n"
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr ""
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr "Openen van het tijdelijke sleutelopslagapparaat is mislukt.\n"
+#: lib/luks1/keyencryption.c:39
+#, fuzzy, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"Kan dm-crypt sleuteltoewijzing niet instellen voor apparaat %s.\n"
+"Kijk na of de kernel versleutelalgoritme %s ondersteunt (bekijk syslog voor meer informatie).\n"
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr "Kan geen toegang verkrijgen tot tijdelijk sleutelopslagapparaat.\n"
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "In XTS-modus moet de sleutelgrootte 256 of 512 bits zijn."
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr ""
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Invoer/uitvoerfout tijdens het versleutelen van de sleutelplaats.\n"
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "Kan apparaat %s niet beschrijven: toestemming geweigerd."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Openen van het tijdelijke sleutelopslagapparaat is mislukt."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Kan geen toegang verkrijgen tot tijdelijk sleutelopslagapparaat."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Invoer/uitvoerfout tijdens het versleutelen van de sleutelplaats."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Kan apparaat %s niet openen."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "Invoer/uitvoerfout tijdens het ontsleutelen van de sleutelplaats.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Invoer/uitvoerfout tijdens het ontsleutelen van de sleutelplaats."
 
-#: lib/luks1/keymanage.c:90
+#: lib/luks1/keymanage.c:110
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr "Apparaat %s is te klein. (LUKS vereist minstens %<PRIu64> bytes.)\n"
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Apparaat %s is te klein.  (LUKS1 vereist minstens %<PRIu64> bytes.)"
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "Apparaat %s is geen geldig LUKS-apparaat.\n"
+msgid "LUKS keyslot %u is invalid."
+msgstr "LUKS-sleutelplaats %u is ongeldig."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "Apparaat %s is geen geldig LUKS-apparaat."
 
-#: lib/luks1/keymanage.c:198
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Aangevraagd reservekopiebestand %s van koptekst bestaat reeds.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Aangevraagd reservekopiebestand %s van koptekst bestaat reeds."
 
-#: lib/luks1/keymanage.c:200
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Kan reservekopiebestand %s van koptekst niet aanmaken.\n"
+msgid "Cannot create header backup file %s."
+msgstr "Kan reservekopiebestand %s van koptekst niet aanmaken."
 
-#: lib/luks1/keymanage.c:205
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Kan reservekopiebestand %s van koptekst niet schrijven.\n"
+msgid "Cannot write header backup file %s."
+msgstr "Kan reservekopiebestand %s van koptekst niet schrijven."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Reservekopiebestand bevat geen geldige LUKS-koptekst.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Reservekopiebestand bevat geen geldige LUKS-koptekst."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Kan reservekopiebestand %s van koptekst niet openen.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Kan reservekopiebestand %s van koptekst niet openen."
 
-#: lib/luks1/keymanage.c:258
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Kan reservekopiebestand %s van koptekst niet lezen.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Kan reservekopiebestand %s van koptekst niet lezen."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Verschillende gegevenspositie of sleutelgrootte in apparaat en reservekopie; "
-"herstelling is mislukt.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Verschillende gegevenspositie of sleutelgrootte in apparaat en reservekopie; herstelling is mislukt."
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Apparaat %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"bevat geen LUKS-koptekst. Het vervangen van de koptekst kan gegevens op het "
-"apparaat vernietigen."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "bevat geen LUKS-koptekst. Het vervangen van de koptekst kan gegevens op het apparaat vernietigen."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"bevat reeds een LUKS-koptekst. Het vervangen van de koptekst zal bestaande "
-"sleutelplaatsen vernietigen."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "bevat reeds een LUKS-koptekst. Het vervangen van de koptekst zal bestaande sleutelplaatsen vernietigen."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
 msgstr ""
 "\n"
-"WAARSCHUWING: originele apparaatkoptekst heeft een ander UUID dan de "
-"reservekopie!"
-
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Kan apparaat %s niet openen.\n"
-
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr "Niet-standaard sleutelgrootte, handmatige herstelling is vereist.\n"
+"WAARSCHUWING: originele apparaatkoptekst heeft een ander UUID dan de reservekopie!"
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
-"Niet-standaard sleutelplaatsuitlijning, handmatige herstelling is vereist.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Niet-standaard sleutelgrootte, handmatige herstelling is vereist."
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Sleutelplaatsen worden hersteld.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Niet-standaard sleutelplaatsuitlijning, handmatige herstelling is vereist."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Herstelling is mislukt."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Sleutelplaatsen worden hersteld."
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Sleutelplaats %i: gegevenspositie hersteld (%u -> %u).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Sleutelplaats %i: gegevenspositie hersteld (%u -> %u)."
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Sleutelplaats %i: fragmenten hersteld (%u -> %u).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Sleutelplaats %i: fragmenten hersteld (%u -> %u)."
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Sleutelplaats %i: valse partitiehandtekening.\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Sleutelplaats %i: valse partitiehandtekening."
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Sleutelplaats %i: salt uitgewist.\n"
-
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "LUKS-koptekst wordt naar schijf geschreven.\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Sleutelplaats %i: salt uitgewist."
 
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Niet-ondersteunde LUKS-versie %d.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "LUKS-koptekst wordt naar schijf geschreven."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "Aangevraagde LUKS-hash %s wordt niet ondersteund.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Herstelling is mislukt."
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "LUKS-sleutelplaats %u is ongeldig.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Aangevraagde LUKS-hash %s wordt niet ondersteund."
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "Geen gekende problemen gevonden bij LUKS-koptekst.\n"
-
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Fout bij het bijwerken van LUKS-koptekst op apparaat %s.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Geen gekende problemen gevonden bij LUKS-koptekst."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Fout bij het herlezen van LUKS-koptekst na bijwerken van apparaat %s.\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Fout bij het bijwerken van LUKS-koptekst op apparaat %s."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keymanage.c:668
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"De datagegevenspositie voor een aparte LUKS-koptekst moet of 0 zijn, of "
-"hoger liggen dan de koptekstgrootte (%d sectoren).\n"
-
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Verkeerd LUKS UUID-formaat verschaft.\n"
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Fout bij het herlezen van LUKS-koptekst na bijwerken van apparaat %s."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr "Kan LUKS-koptekst niet aanmaken: lezen van random salt is mislukt.\n"
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "De datagegevenspositie voor een aparte LUKS-koptekst moet of 0 zijn, of groter zijn dan de koptekstgrootte."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Niet-compatibele PBKDF2-opties (met hash-algoritme %s in gebruik).\n"
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Verkeerd LUKS UUID-formaat verschaft."
 
-#: lib/luks1/keymanage.c:717
-#, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Kan LUKS-koptekst niet aanmaken: koptekst-extract is mislukt (met %s-hash).\n"
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Kan LUKS-koptekst niet aanmaken: lezen van random salt is mislukt."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "Sleutelplaats %d is actief; ruim eerst op.\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Kan LUKS-koptekst niet aanmaken: koptekst-extract is mislukt (met %s-hash)."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Inhoud van sleutelplaats %d bevat te weinig fragmenten. "
-"Koptekstmanipulatie?\n"
+msgid "Key slot %d active, purge first."
+msgstr "Sleutelplaats %d is actief; ruim eerst op."
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Sleutelplaats %d is ontgrendeld.\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Inhoud van sleutelplaats %d bevat te weinig fragmenten. Koptekstmanipulatie?"
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Geen sleutel beschikbaar met dit wachtwoord.\n"
+#: lib/luks1/keymanage.c:990
+#, fuzzy, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Sleutelbehandelingsfout (met hash %s in gebruik)."
 
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr ""
-"Sleutelplaats %d is ongeldig, selecteer een sleutelplaats tussen 0 en %d.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Sleutelplaats %d is ongeldig, selecteer een sleutelplaats tussen 0 en %d."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Kan apparaat %s niet wissen.\n"
+msgid "Cannot wipe device %s."
+msgstr "Kan apparaat %s niet wissen."
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr "Nog niet ondersteund GPG-versleuteld sleutelbestand gevonden.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Nog niet ondersteund GPG-versleuteld sleutelbestand gevonden."
 
 #: lib/loopaes/loopaes.c:147
 msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
 msgstr "Gebruik gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Onverenigbaar loop-AES-sleutelbestand gevonden.\n"
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Onverenigbaar loop-AES-sleutelbestand gevonden."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr ""
-"Toewijzingen compatibel met loop-AES worden niet ondersteund door de "
-"kernel.\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Toewijzingen compatibel met loop-AES worden niet ondersteund door de kernel."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Fout bij het lezen van sleutelbestand %s.\n"
+msgid "Error reading keyfile %s."
+msgstr "Fout bij het lezen van sleutelbestand %s."
 
-#: lib/tcrypt/tcrypt.c:513
-#, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr "Maximum TCRYPT-wachtwoorlengte (%d) overschreden.\n"
+#: lib/tcrypt/tcrypt.c:554
+#, fuzzy, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Maximum TCRYPT-wachtwoorlengte (%d) overschreden."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr "PBKDF2 hash-algoritme %s is niet beschikbaar, wordt overgeslaan.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "PBKDF2 hash-algoritme %s is niet beschikbaar, wordt overgeslaan."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr "Benodigde kernel cryptografie-interface is niet beschikbaar.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Benodigde kernel cryptografie-interface is niet beschikbaar."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr "Kijk na of kernelmodule algif_skcipher geladen is.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Kijk na of kernelmodule algif_skcipher geladen is."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "Activatie wordt niet ondersteund voor %d sectorgrootte.\n"
+msgid "Activation is not supported for %d sector size."
+msgstr "Activatie wordt niet ondersteund voor %d sectorgrootte."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr ""
-"Activatie voor deze TCRYPT-legacymodus wordt niet ondersteund door de "
-"kernel.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Activatie voor deze TCRYPT-legacymodus wordt niet ondersteund door de kernel."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "TCRYPT-systeemversleuteling voor partitie %s wordt geactiveerd.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "TCRYPT-systeemversleuteling voor partitie %s wordt geactiveerd."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr ""
-"Toewijzingen compatibel met TCRYPT worden niet ondersteund door de kernel.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Toewijzingen compatibel met TCRYPT worden niet ondersteund door de kernel."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Deze functie wordt niet ondersteund zonder TCRYPT-koptekst."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "VERITY-apparaat %s gebruikt geen on-disk koptekst.\n"
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr ""
 
-#: lib/verity/verity.c:94
-#, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Apparaat %s is geen geldig VERITY-apparaat.\n"
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr ""
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "Niet-ondersteunde VERITY-versie %d.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr ""
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "VERITY-koptekst beschadigd.\n"
-
-#: lib/verity/verity.c:166
+#: lib/bitlk/bitlk.c:399
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Verkeerd VERITY UUID-formaat verschaft op apparaat %s.\n"
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr ""
 
-#: lib/verity/verity.c:196
-#, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Fout bij het bijwerken van VERITY-koptekst op apparaat %s.\n"
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Lezen uit sleutelopslag is mislukt.\n"
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "dm-verity toewijzingen niet ondersteund door kernel.\n"
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr ""
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr "VERITY-apparaat ontdekte beschadiging na activatie.\n"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr ""
 
-#: lib/verity/verity_hash.c:59
-#, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "Reservegebied is niet ingesteld op positie %<PRIu64>.\n"
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr ""
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Overloop van apparaatsgegevenspositie.\n"
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Kan herencryptie-logbestand niet lezen.\n"
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "Controle gefaald op positie %<PRIu64>.\n"
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Lezen uit sleutelopslag is mislukt.\n"
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Ongeldige grootteparameters voor VERITY-apparaat.\n"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr ""
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Te veel niveau's in de boomstructuur voor een VERITY-volume.\n"
+#: lib/bitlk/bitlk.c:594
+#, fuzzy
+msgid "Unknown or unsupported encryption type."
+msgstr "UUID wordt niet ondersteund voor dit encryptietype.\n"
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "Controle van gegevensgebied gefaald.\n"
+#: lib/bitlk/bitlk.c:627
+#, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr ""
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "Controle van root-hash gefaald.\n"
+#: lib/bitlk/bitlk.c:921
+#, fuzzy
+msgid "This operation is not supported."
+msgstr "Deze operatie wordt niet ondersteund voor versleutelapparaat %s.\n"
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr "Invoer/uitvoerfout bij het aanmaken van hash-gebied.\n"
+#: lib/bitlk/bitlk.c:929
+#, fuzzy
+msgid "Wrong key size."
+msgstr "Ongeldige sleutelgrootte.\n"
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "Creatie hash-gebied gefaald.\n"
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr ""
 
-#: lib/verity/verity_hash.c:414
+#: lib/bitlk/bitlk.c:987
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
+msgid "BITLK devices with type '%s' cannot be activated."
 msgstr ""
-"Waarschuwing: kernel kan apparaat niet activeren als de gegevensblokgrootte "
-"groter is dan de paginagrootte (%u).\n"
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
 msgstr ""
-"Kan geen wachtwoordverificatie uitvoeren op invoer van buiten de terminal.\n"
-
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Geen bekend specificatiepatroon voor het sleutelalgoritme gevonden.\n"
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
 msgstr ""
 
-#: src/cryptsetup.c:152
-#, fuzzy
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
 msgstr ""
-"Gegevenspositie- en grootte-opties van sleutelbestand worden genegeerd, "
-"sleutelbestandsleesgrootte is steeds dezelfde als encryptiesleutelgrootte.\n"
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "Optie --key-file is vereist.\n"
-
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Geen apparaatkoptekst beschikbaar met dit wachtwoord.\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, fuzzy, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "VERITY-apparaat %s gebruikt geen on-disk koptekst.\n"
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
-msgstr ""
-"Dump van koptekst met sleutel tot het opslagmedium bevat gevoelige "
-"informatie\n"
-"die zonder wachtwoord toegang verschaft tot versleutelde partities.\n"
-"De dump zou steeds versleuteld en op een veilige plaats bewaard moeten "
-"worden."
+#: lib/verity/verity.c:90
+#, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "Apparaat %s is geen geldig VERITY-apparaat."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Benchmarkresultaat is niet betrouwbaar.\n"
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Niet-ondersteunde VERITY-versie %d."
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr ""
-"# Tests zijn bij benadering met enkel geheugen in gebruik (geen opslag-IO).\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "VERITY-koptekst beschadigd."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "#  Algoritme | Sleutel |  Versleuteling |  Ontsleuteling\n"
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Verkeerd VERITY UUID-formaat verschaft op apparaat %s."
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity.c:198
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Versleutelalgoritme %s is niet beschikbaar.\n"
+msgid "Error during update of verity header on device %s."
+msgstr "Fout bij het bijwerken van VERITY-koptekst op apparaat %s."
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "N/A"
+#: lib/verity/verity.c:256
+#, fuzzy
+msgid "Root hash signature verification is not supported."
+msgstr "Aangevraagd hash-algoritme %s wordt niet ondersteund.\n"
 
-#: src/cryptsetup.c:639
-#, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Kan sleutelbestand %s niet lezen.\n"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr ""
 
-#: src/cryptsetup.c:643
+#: lib/verity/verity.c:269
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Kan %d bytes uit sleutelbestand %s niet lezen.\n"
+msgid "Found %u repairable errors with FEC device."
+msgstr ""
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Bent u zeker de LUKS-apparaatkoptekst te willen herstellen?"
+#: lib/verity/verity.c:308
+#, fuzzy
+msgid "Kernel does not support dm-verity mapping."
+msgstr "dm-verity toewijzingen niet ondersteund door kernel.\n"
 
-#: src/cryptsetup.c:697
-#, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Dit zal data op %s onherroepelijk overschrijven."
+#: lib/verity/verity.c:312
+#, fuzzy
+msgid "Kernel does not support dm-verity signature option."
+msgstr "dm-verity toewijzingen niet ondersteund door kernel.\n"
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "geheugentoewijzingsfout in action_luksFormat"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "VERITY-apparaat ontdekte beschadiging na activatie."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Kan %s niet als on-diskkoptekst gebruiken.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Reservegebied is niet ingesteld op positie %<PRIu64>."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
-"Een verlaagde datagegevenspositie wordt enkel toegestaan voor een "
-"vrijstaande LUKS-koptekst.\n"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Overloop van apparaatsgegevenspositie."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Sleutelplaats %d geselecteerd voor verwijdering.\n"
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Controle gefaald op positie %<PRIu64>."
 
-#: src/cryptsetup.c:884
-#, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Sleutel %d is niet actief. Kan niet wissen.\n"
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Ongeldige grootteparameters voor VERITY-apparaat."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
-msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
 msgstr ""
-"Dit is de laatste sleutelplaats. Apparaat zal onbruikbaar worden na het "
-"verwijderen van deze sleutel."
 
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Voer enig overblijvend wachtwoord in: "
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Controle van gegevensgebied gefaald."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Voer het te verwijderen wachtwoord in: "
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Controle van root-hash gefaald."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
-#, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Voer een bestaand wachtwoord in: "
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Invoer/uitvoerfout bij het aanmaken van hash-gebied."
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Voer het te wijzigen wachtwoord in: "
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Creatie hash-gebied gefaald."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Voer nieuw wachtwoord in: "
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "WAARSCHUWING: Kernel kan apparaat niet activeren als de gegevensblokgrootte groter is dan de paginagrootte (%u)."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
 msgstr ""
-"Voor de isLuks-operatie wordt slechts één apparaatsargument ondersteund.\n"
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Optie --header-backup-file is vereist.\n"
+#: lib/verity/verity_fec.c:146
+#, fuzzy
+msgid "Failed to allocate buffer."
+msgstr "Kan status van sleutelbestand niet opvragen.\n"
 
-#: src/cryptsetup.c:1304
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Niet-herkende metadata bij apparaatstype %s.\n"
-
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
-msgstr "Opdracht vereist apparaat en toewijzingsnaam als argumenten.\n"
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr ""
 
-#: src/cryptsetup.c:1326
+#: lib/verity/verity_fec.c:169
 #, c-format
-msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+msgid "Failed to read parity for RS block %<PRIu64>."
 msgstr ""
-"Deze operatie zal alle sleutelplaatsen op apparaat %s wissen.\n"
-"Na deze operatie wordt het apparaat onbruikbaar."
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<apparaat> [--type <type>] [<naam>]"
-
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "apparaat als toewijzing <naam> openen"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr ""
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<naam>"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr ""
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "apparaat sluiten (toewijzingen verwijderen)"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr ""
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "actief apparaat vergroten of verkleinen"
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr ""
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "apparaatstatus tonen"
+#: lib/verity/verity_fec.c:265
+#, fuzzy, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Openen van het tijdelijke sleutelopslagapparaat is mislukt.\n"
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "versleutelalgoritme benchmarken"
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+#, fuzzy
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "dm-verity toewijzingen niet ondersteund door kernel.\n"
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<apparaat>"
+#: lib/integrity/integrity.c:277
+#, fuzzy
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "dm-verity toewijzingen niet ondersteund door kernel.\n"
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr "on-disk metadata proberen te herstellen"
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, fuzzy, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Kan geen toegang verkrijgen tot tijdelijk sleutelopslagapparaat.\n"
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
-msgstr "alle sleutelplaatsen wissen (encryptiesleutel verwijderen)"
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<apparaat> [<nieuw sleutelbestand>]"
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "een LUKS-apparaat formatteren"
+#: lib/luks2/luks2_json_format.c:227
+#, fuzzy
+msgid "Requested data offset is too small."
+msgstr "Apparaat %s is te klein.\n"
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "sleutel aan LUKS-apparaat toevoegen"
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr ""
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
-msgstr "<apparaat> [<sleutelbestand>]"
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, fuzzy, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Kan geen toegang verkrijgen tot tijdelijk sleutelopslagapparaat.\n"
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "verschafte sleutel of sleutelbestand van LUKS-apparaat verwijderen"
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr ""
 
-#: src/cryptsetup.c:1370
-msgid "changes supplied key or key file of LUKS device"
-msgstr "wijzigt verschafte sleutel of sleutelbestand van LUKS-apparaat"
+#: lib/luks2/luks2_json_metadata.c:1208
+#, fuzzy
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Verschillende gegevenspositie of sleutelgrootte in apparaat en reservekopie; herstelling is mislukt.\n"
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<apparaat> <sleutelplaats>"
+#: lib/luks2/luks2_json_metadata.c:1214
+#, fuzzy
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Verschillende gegevenspositie of sleutelgrootte in apparaat en reservekopie; herstelling is mislukt.\n"
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr "sleutel met nummer <sleutelplaats> van LUKS-apparaat verwijderen"
+#: lib/luks2/luks2_json_metadata.c:1221
+#, fuzzy, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Apparaat %s %s%s"
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "UUID van LUKS-apparaat tonen"
+#: lib/luks2/luks2_json_metadata.c:1222
+#, fuzzy
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "bevat geen LUKS-koptekst. Het vervangen van de koptekst kan gegevens op het apparaat vernietigen."
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "<apparaat> op een LUKS-partitiekoptekst testen"
+#: lib/luks2/luks2_json_metadata.c:1223
+#, fuzzy
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "bevat reeds een LUKS-koptekst. Het vervangen van de koptekst zal bestaande sleutelplaatsen vernietigen."
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
-msgstr "LUKS-partitie-informatie dumpen"
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
+msgstr ""
 
-#: src/cryptsetup.c:1375
-msgid "dump TCRYPT device information"
-msgstr "TCRYPT-apparaatsinformatie dumpen"
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
 msgstr ""
-"LUKS-apparaat schorsen en sleutel wissen (alle in-/uitvoer wordt bevroren)."
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Geschorst LUKS-apparaat hervatten."
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr ""
 
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
-msgstr "Reservekopie van LUKS-apparaatkoptekst en -sleutelplaatsen maken"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "Kan status van sleutelbestand niet opvragen.\n"
 
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
-msgstr "LUKS-apparaatkoptekst en -sleutelplaatsen herstellen"
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr ""
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
-msgid ""
-"\n"
-"<action> is one of:\n"
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
 msgstr ""
-"\n"
-"<actie> is één van:\n"
 
-#: src/cryptsetup.c:1402
-msgid ""
-"\n"
-"You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
 msgstr ""
-"\n"
-"U kan ook oude <actie>-syntax aliasen gebruiken:\n"
-"\topen: (plainOpen), luksOpen, loopaesOpen, tcryptOpen aanmaken\n"
-"\tclose: (plainClose), luksClose, loopaesClose, tryptClose verwijderen\n"
 
-#: src/cryptsetup.c:1406
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
 #, c-format
-msgid ""
-"\n"
-"<name> is the device to create under %s\n"
-"<device> is the encrypted device\n"
-"<key slot> is the LUKS key slot number to modify\n"
-"<key file> optional key file for the new key for luksAddKey action\n"
+msgid "Failed to replace suspended device %s with dm-error target."
 msgstr ""
-"\n"
-"<naam> is het onder %s aan te maken apparaat\n"
-"<apparaat> is het versleutelde apparaat\n"
-"<sleutelplaats> is het nummer van de te wijzigen LUKS-sleutelplaats\n"
-"<sleutelbestand> optioneel sleutelbestand voor de nieuwe sleutel voor de "
-"luksAddKey-actie\n"
 
-#: src/cryptsetup.c:1413
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
 msgstr ""
-"\n"
-"Standaard meegecompileerde sleutel- en wachtwoordparameters:\n"
-"\tMaximum sleutelplaatsgrootte: %dkB, maximum lengte interactief wachtwoord "
-"%d (karakters)\n"
-"Standaard PBKDF2-herhalingstijd voor LUKS: %d (ms)\n"
 
-#: src/cryptsetup.c:1420
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in device cipher parameters:\n"
-"\tloop-AES: %s, Key %d bits\n"
-"\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
 msgstr ""
-"\n"
-"Standaard meegecompileerde parameters van het "
-"apparaatsversleutelingsalgoritme:\n"
-"\tloop-AES: %s, Sleutel: %d bits\n"
-"\tplain: %s, Sleutel: %d bits, Wachtwoordhashing: %s\n"
-"\tLUKS1: %s, Sleutel: %d bits, LUKS-kopteksthashing: %s, RNG: %s\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
-#, c-format
-msgid "%s: requires %s as arguments"
-msgstr "%s: vereist %s als argumenten"
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr ""
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
-msgid "Show this help message"
-msgstr "Deze hulptekst tonen"
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr ""
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
-msgid "Display brief usage"
-msgstr "Korte gebruikssamenvatting tonen"
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr ""
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Hulpopties:"
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "Sleutelplaats %d is geverifieerd.\n"
 
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
-msgid "Print package version"
-msgstr "Pakketversie tonen"
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr ""
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
-msgid "Shows more detailed error messages"
-msgstr "Gedetailleerdere foutboodschappen tonen"
+#: lib/luks2/luks2_keyslot_luks2.c:480
+#, fuzzy
+msgid "No space for new keyslot."
+msgstr "Kan nieuwe sleutelplaats niet verwisselen.\n"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
-msgid "Show debug messages"
-msgstr "Debug-boodschappen tonen"
+#: lib/luks2/luks2_luks1_convert.c:482
+#, fuzzy, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Kan wachtwoordkwaliteit niet nakijken: %s\n"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
-msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
 msgstr ""
-"Het gebruikte versleutelalgoritme om de schijf te versleutelen (zie /proc/"
-"crypto)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
-msgid "The hash used to create the encryption key from the passphrase"
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
 msgstr ""
-"De gebruikte hash om de encryptiesleutel uit het wachtwoord aan te maken"
 
-#: src/cryptsetup.c:1481
-msgid "Verifies the passphrase by asking for it twice"
-msgstr "Het wachtwoord controleren door het twee keer te vragen"
+#: lib/luks2/luks2_luks1_convert.c:599
+#, fuzzy
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Openen van sleutelbestand is mislukt.\n"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
-msgstr "De sleutel uit een bestand lezen."
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+#, fuzzy
+msgid "Unable to move keyslot area."
+msgstr "Openen van sleutelbestand is mislukt.\n"
 
-#: src/cryptsetup.c:1483
-msgid "Read the volume (master) key from file."
-msgstr "De (hoofd)sleutel tot het opslagmedium uit een bestand lezen."
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr ""
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
 msgstr ""
-"Dump (hoofd)sleutel tot het opslagmedium in plaats van de "
-"sleutelplaatsinformatie."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "The size of the encryption key"
-msgstr "De grootte van de encryptiesleutel"
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr ""
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "BITS"
-msgstr "BITS"
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr ""
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
-msgid "Limits the read from keyfile"
-msgstr "Beperkt de lezing uit sleutelbestand"
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr ""
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
-msgid "bytes"
-msgstr "bytes"
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr ""
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
-msgid "Number of bytes to skip in keyfile"
-msgstr "Aantal bytes over te slaan in sleutelbestand"
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr ""
 
-#: src/cryptsetup.c:1488
-msgid "Limits the read from newly added keyfile"
-msgstr "Beperkt de lezing uit een nieuw toegevoegd sleutelbestand"
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
 
-#: src/cryptsetup.c:1489
-msgid "Number of bytes to skip in newly added keyfile"
-msgstr "Aantal bytes over te slaan in nieuwste toegevoegde sleutelbestand"
+#: lib/luks2/luks2_reencrypt.c:897
+#, fuzzy, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Verkleiningsgrootte moet een meervoud zijn van de 512 bytes-grote sector."
 
-#: src/cryptsetup.c:1490
-msgid "Slot number for new key (default is first free)"
-msgstr "Plaatsnummer voor nieuwe sleutel (standaard is de eerste open plaats)"
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Niet-ondersteunde LUKS-versie %d.\n"
 
-#: src/cryptsetup.c:1491
-msgid "The size of the device"
-msgstr "De grootte van het apparaat"
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+#, fuzzy
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
-msgid "SECTORS"
-msgstr "SECTOREN"
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
 
-#: src/cryptsetup.c:1492
-msgid "The start offset in the backend device"
-msgstr "De startplaats in het backend-apparaat"
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "Lezen uit sleutelopslag is mislukt.\n"
 
-#: src/cryptsetup.c:1493
-msgid "How many sectors of the encrypted data to skip at the beginning"
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, fuzzy, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Reservegebied is niet ingesteld op positie %<PRIu64>.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Lezen uit sleutelopslag is mislukt.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
 msgstr ""
-"Hoeveel sectoren van de versleutelde gegevens aan het begin over te slaan"
 
-#: src/cryptsetup.c:1494
-msgid "Create a readonly mapping"
-msgstr "Een alleen-lezen toewijzing aanmaken"
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Kan geen toegang verkrijgen tot tijdelijk sleutelopslagapparaat.\n"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "PBKDF2 herhalingstijd voor LUKS (in ms)"
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr ""
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "milliseconden"
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Openen van het tijdelijke sleutelopslagapparaat is mislukt.\n"
 
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
-msgid "Do not ask for confirmation"
-msgstr "Niet om bevestiging vragen"
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr ""
 
-#: src/cryptsetup.c:1497
-msgid "Timeout for interactive passphrase prompt (in seconds)"
-msgstr "Timeout voor interactieve wachtwoordprompt (in seconden)"
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "Kan nieuwe sleutelplaats niet verwisselen.\n"
 
-#: src/cryptsetup.c:1497
-msgid "secs"
-msgstr "seconden"
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "Hoe vaak de invoering van het wachtwoord opnieuw geprobeerd kan worden"
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr "Payload uitlijnen op meervouden van <n> sectoren – voor luksFormat"
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Bestand met reservekopie van LUKS-koptekst en -sleutelplaatsen."
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, fuzzy, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Kan apparaat %s niet gebruiken; het is nog actief (reeds toegewezen of aangekoppeld).\n"
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "Gebruik /dev/random om de sleutel tot het opslagmedium te genereren."
+#: lib/luks2/luks2_reencrypt.c:2534
+#, fuzzy
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Sleutel niet wijzigen; gegevensgebied wordt niet opnieuw versleuteld."
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Gebruik /dev/urandom om de sleutel tot het opslagmedium te genereren."
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr ""
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr "Apparaat met een ander, niet-overlappend cryptsegment delen."
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID van het te gebruiken apparaat."
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "Apparaat %s is niet actief.\n"
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Discardaanvragen (alias TRIM) op dit apparaat toelaten."
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr ""
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Apparaat of bestand met verschillende LUKS-koptekst."
+#: lib/luks2/luks2_reencrypt.c:2632
+#, fuzzy
+msgid "Failed to acquire reencryption lock."
+msgstr "Kan herencryptie-logbestand niet lezen.\n"
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Apparaat niet activeren, enkel wachtwoord controleren."
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Verborgen koptekst gebruiken (verborgen TCRYPT-apparaat)."
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr ""
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Apparaat is TCRYPT-systeemschijf (met bootloader)."
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Reserve (secundaire) TCRYPT-koptekst gebruiken."
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr ""
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
 msgstr ""
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Soorten apparaat-metadata: luks, plain, loopaes, tcrypt."
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr ""
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Wachtwoordkwaliteitscontrole uitschakelen (indien ingeschakeld)."
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3046
+#, fuzzy
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Kan herencryptie-logbestand niet schrijven.\n"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
+#: lib/luks2/luks2_reencrypt.c:3053
+#, fuzzy
+msgid "Decryption failed."
+msgstr "Herstelling is mislukt."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3063
+#, fuzzy
+msgid "Failed to sync data."
+msgstr "Kan status van sleutelbestand niet opvragen.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
 msgstr ""
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
 msgstr ""
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
-msgid "[OPTION...] <action> <action-specific>"
-msgstr "[OPTIE…] <actie> <actie-specifiek>"
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr ""
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Uitvoering in FIPS-modus.\n"
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
 
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
-msgid "Argument <action> missing."
-msgstr "Argument <actie> ontbreekt."
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
-msgid "Unknown action."
-msgstr "Onbekende actie."
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
 msgstr ""
-"Optie --shared wordt enkel toegestaan voor open-opdracht op plain-apparaat.\n"
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "Kan versleutelings-backend niet initialiseren.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+#, fuzzy
+msgid "Failed to update reencryption context."
+msgstr "Kan herencryptie-logbestand niet openen.\n"
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr ""
+
+#: lib/luks2/luks2_token.c:269
+#, fuzzy, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Kan geen wachtwoordverificatie uitvoeren op invoer van buiten de terminal."
+
+#: src/cryptsetup.c:221
+#, fuzzy
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Deze operatie wordt enkel ondersteund voor LUKS-apparaten.\n"
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Geen bekend specificatiepatroon voor het sleutelalgoritme gevonden."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "WAARSCHUWING: In normale modus met opgegeven sleutelbestand wordt de --hash-parameter genegeerd.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "WAARSCHUWING: De optie --keyfile-size wordt genegeerd, de leesgrootte is gelijk aan de encryptiesleutelgrootte.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr ""
 
-#: src/cryptsetup.c:1657
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Optie --key-file is vereist."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr ""
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr ""
+
+#: src/cryptsetup.c:446
+#, fuzzy
+msgid "Invalid PIM value: 0."
+msgstr "Ongeldig apparaat %s.\n"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr ""
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Geen apparaatkoptekst beschikbaar met dit wachtwoord."
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Apparaat %s is geen geldig LUKS-apparaat.\n"
+
+#: src/cryptsetup.c:576
 msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
 msgstr ""
-"Optie --key-size is enkel toegestaan bij luksFormat, open en benchmark.\n"
-"Om de lezing uit een sleutelbestand te beperken, gebruik --keyfile-"
-"size=(bytes)."
+"Dump van koptekst met sleutel tot het opslagmedium bevat gevoelige informatie\n"
+"die zonder wachtwoord toegang verschaft tot versleutelde partities.\n"
+"De dump zou steeds versleuteld en op een veilige plaats bewaard moeten worden."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr ""
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr ""
+
+#: src/cryptsetup.c:838
+#, fuzzy
+msgid "Benchmark interrupted."
+msgstr "versleutelalgoritme benchmarken"
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr ""
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr ""
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Benchmarkresultaat is niet betrouwbaar."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Tests zijn bij benadering met enkel geheugen in gebruik (geen opslag-IO).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, fuzzy, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  Algoritme | Sleutel |  Versleuteling |  Ontsleuteling\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Versleutelalgoritme %s is niet beschikbaar.\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+#, fuzzy
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  Algoritme | Sleutel |  Versleuteling |  Ontsleuteling\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/A"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Voer wachtwoord voor sleutelplaats %u in: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Bent u zeker de LUKS-apparaatkoptekst te willen herstellen?"
 
-#: src/cryptsetup.c:1664
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
 msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, fuzzy, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Kan tijdelijk LUKS-apparaat niet openen.\n"
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr ""
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+#, fuzzy
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Niet-ondersteunde LUKS-versie %d.\n"
+
+#: src/cryptsetup.c:1253
+#, fuzzy, c-format
+msgid "Cannot create header file %s."
+msgstr "Kan reservekopiebestand %s van koptekst niet aanmaken.\n"
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+#, fuzzy
+msgid "No known integrity specification pattern detected."
+msgstr "Geen bekend specificatiepatroon voor het sleutelalgoritme gevonden.\n"
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Kan %s niet als on-diskkoptekst gebruiken."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Dit zal data op %s onherroepelijk overschrijven."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+#, fuzzy
+msgid "Failed to set pbkdf parameters."
+msgstr "Kan status van sleutelbestand niet opvragen.\n"
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Een verlaagde datagegevenspositie wordt enkel toegestaan voor een vrijstaande LUKS-koptekst."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr ""
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, fuzzy, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Sleutelplaats %d geselecteerd voor verwijdering.\n"
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Dit is de laatste sleutelplaats. Apparaat zal onbruikbaar worden na het verwijderen van deze sleutel."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Voer enig overblijvend wachtwoord in: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Voer het te verwijderen wachtwoord in: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Voer een nieuw wachtwoord in voor de sleutelplaats: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Voer een bestaand wachtwoord in: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Voer het te wijzigen wachtwoord in: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Voer nieuw wachtwoord in: "
+
+#: src/cryptsetup.c:1927
+#, fuzzy
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Voer wachtwoord voor sleutelplaats %u in: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Voor de isLuks-operatie wordt slechts één apparaatsargument ondersteund."
+
+#: src/cryptsetup.c:2001
+#, fuzzy
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Dump van koptekst met sleutel tot het opslagmedium bevat gevoelige informatie\n"
+"die zonder wachtwoord toegang verschaft tot versleutelde partities.\n"
+"De dump zou steeds versleuteld en op een veilige plaats bewaard moeten worden."
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Sleutelplaats %d is niet in gebruik."
+
+#: src/cryptsetup.c:2072
+#, fuzzy
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Dump van koptekst met sleutel tot het opslagmedium bevat gevoelige informatie\n"
+"die zonder wachtwoord toegang verschaft tot versleutelde partities.\n"
+"De dump zou steeds versleuteld en op een veilige plaats bewaard moeten worden."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Optie --header-backup-file is vereist."
+
+#: src/cryptsetup.c:2258
+#, fuzzy, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s is geen LUKS-apparaat."
+
+#: src/cryptsetup.c:2269
+#, fuzzy, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Hervatting wordt niet ondersteund voor apparaat %s.\n"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Niet-herkende metadata bij apparaatstype %s."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Opdracht vereist apparaat en toewijzingsnaam als argumenten."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Deze operatie zal alle sleutelplaatsen op apparaat %s wissen.\n"
+"Na deze operatie wordt het apparaat onbruikbaar."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr ""
+
+#: src/cryptsetup.c:2398
+#, fuzzy, c-format
+msgid "Device is already %s type."
+msgstr "Apparaat %s bestaat reeds.\n"
+
+#: src/cryptsetup.c:2403
+#, fuzzy, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Deze operatie wordt niet ondersteund voor versleutelapparaat %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr ""
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, fuzzy, c-format
+msgid "Token %d is invalid."
+msgstr "Sleutelplaats %d is ongeldig.\n"
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr ""
+
+#: src/cryptsetup.c:2493
+#, fuzzy, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Lezen uit sleutelopslag is mislukt.\n"
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, fuzzy, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
+
+#: src/cryptsetup.c:2519
+#, fuzzy, c-format
+msgid "Token %d is not in use."
+msgstr "Sleutelplaats %d is niet in gebruik.\n"
+
+#: src/cryptsetup.c:2554
+#, fuzzy
+msgid "Failed to import token from file."
+msgstr "Openen van sleutelbestand is mislukt.\n"
+
+#: src/cryptsetup.c:2579
+#, fuzzy, c-format
+msgid "Failed to get token %d for export."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr ""
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2613
+#, fuzzy, c-format
+msgid "Invalid token operation %s."
+msgstr "Ongeldige sleutelgrootte %d.\n"
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Apparaat %s is geen geldig LUKS-apparaat.\n"
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Kan geen map voor de apparaatstoewijzer verkrijgen."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "Ongeldig apparaat %s.\n"
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Deze operatie wordt enkel ondersteund voor LUKS-apparaten.\n"
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Aangevraagd reservekopiebestand %s van koptekst bestaat reeds.\n"
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Kan reservekopiebestand %s van koptekst niet aanmaken.\n"
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+#, fuzzy
+msgid "Not enough free keyslots for reencryption."
+msgstr "Sleutel niet wijzigen; gegevensgebied wordt niet opnieuw versleuteld."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Sleutelbestand kan enkel gebruikt worden met optie --key-slot of met enkel één actieve sleutelplaats."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Voer wachtwoord voor sleutelplaats %u in: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Voer wachtwoord voor sleutelplaats %u in: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "Opdracht vereist apparaat en toewijzingsnaam als argumenten.\n"
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr ""
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+#, fuzzy
+msgid "LUKS2 device is not in reencryption."
+msgstr "Logbestand %s bestaat reeds, herencryptie wordt herstart.\n"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<apparaat> [--type <type>] [<naam>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+#, fuzzy
+msgid "open device as <name>"
+msgstr "apparaat als toewijzing <naam> openen"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<naam>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "apparaat sluiten (toewijzingen verwijderen)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "actief apparaat vergroten of verkleinen"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "apparaatstatus tonen"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <versleutelalgoritme>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "versleutelalgoritme benchmarken"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<apparaat>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "on-disk metadata proberen te herstellen"
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "sleutel aan LUKS-apparaat toevoegen"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "alle sleutelplaatsen wissen (encryptiesleutel verwijderen)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr ""
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr ""
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<apparaat> [<nieuw sleutelbestand>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "een LUKS-apparaat formatteren"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "sleutel aan LUKS-apparaat toevoegen"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<apparaat> [<sleutelbestand>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "verschafte sleutel of sleutelbestand van LUKS-apparaat verwijderen"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "wijzigt verschafte sleutel of sleutelbestand van LUKS-apparaat"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<apparaat> <sleutelplaats>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "sleutel met nummer <sleutelplaats> van LUKS-apparaat verwijderen"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "UUID van LUKS-apparaat tonen"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "<apparaat> op een LUKS-partitiekoptekst testen"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "LUKS-partitie-informatie dumpen"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "TCRYPT-apparaatsinformatie dumpen"
+
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "TCRYPT-apparaatsinformatie dumpen"
+
+#: src/cryptsetup.c:3367
+#, fuzzy
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "LUKS-apparaat schorsen en sleutel wissen (alle in-/uitvoer wordt bevroren)."
+
+#: src/cryptsetup.c:3368
+#, fuzzy
+msgid "Resume suspended LUKS device"
+msgstr "Geschorst LUKS-apparaat hervatten."
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Reservekopie van LUKS-apparaatkoptekst en -sleutelplaatsen maken"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "LUKS-apparaatkoptekst en -sleutelplaatsen herstellen"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr ""
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr ""
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<actie> is één van:\n"
+
+#: src/cryptsetup.c:3395
+#, fuzzy
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"U kan ook oude <actie>-syntax aliasen gebruiken:\n"
+"\topen: (plainOpen), luksOpen, loopaesOpen, tcryptOpen aanmaken\n"
+"\tclose: (plainClose), luksClose, loopaesClose, tryptClose verwijderen\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<naam> is het onder %s aan te maken apparaat\n"
+"<apparaat> is het versleutelde apparaat\n"
+"<sleutelplaats> is het nummer van de te wijzigen LUKS-sleutelplaats\n"
+"<sleutelbestand> optioneel sleutelbestand voor de nieuwe sleutel voor de luksAddKey-actie\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+
+#: src/cryptsetup.c:3411
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Standaard meegecompileerde sleutel- en wachtwoordparameters:\n"
+"\tMaximum sleutelplaatsgrootte: %dkB, maximum lengte interactief wachtwoord %d (karakters)\n"
+"Standaard PBKDF2-herhalingstijd voor LUKS: %d (ms)\n"
+
+#: src/cryptsetup.c:3422
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Standaard meegecompileerde parameters van het apparaatsversleutelingsalgoritme:\n"
+"\tloop-AES: %s, Sleutel: %d bits\n"
+"\tplain: %s, Sleutel: %d bits, Wachtwoordhashing: %s\n"
+"\tLUKS1: %s, Sleutel: %d bits, LUKS-kopteksthashing: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: vereist %s als argumenten"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Deze hulptekst tonen"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Korte gebruikssamenvatting tonen"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Pakketversie tonen"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Hulpopties:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Gedetailleerdere foutboodschappen tonen"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Debug-boodschappen tonen"
+
+#: src/cryptsetup.c:3489
+#, fuzzy
+msgid "Show debug messages including JSON metadata"
+msgstr "Debug-boodschappen tonen"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "Het gebruikte versleutelalgoritme om de schijf te versleutelen (zie /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "De gebruikte hash om de encryptiesleutel uit het wachtwoord aan te maken"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Het wachtwoord controleren door het twee keer te vragen"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+#, fuzzy
+msgid "Read the key from a file"
+msgstr "De sleutel uit een bestand lezen."
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "De (hoofd)sleutel tot het opslagmedium uit een bestand lezen."
+
+#: src/cryptsetup.c:3495
+#, fuzzy
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Dump (hoofd)sleutel tot het opslagmedium in plaats van de sleutelplaatsinformatie."
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "De grootte van de encryptiesleutel"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "BITS"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Beperkt de lezing uit sleutelbestand"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "bytes"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Aantal bytes over te slaan in sleutelbestand"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Beperkt de lezing uit een nieuw toegevoegd sleutelbestand"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Aantal bytes over te slaan in nieuwste toegevoegde sleutelbestand"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Plaatsnummer voor nieuwe sleutel (standaard is de eerste open plaats)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "De grootte van het apparaat"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "SECTOREN"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Enkel ingegeven apparaatsgrootte gebruiken (rest van apparaat wordt genegeerd). GEVAARLIJK!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "De startplaats in het backend-apparaat"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Hoeveel sectoren van de versleutelde gegevens aan het begin over te slaan"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Een alleen-lezen toewijzing aanmaken"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Niet om bevestiging vragen"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Timeout voor interactieve wachtwoordprompt (in seconden)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "seconden"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr ""
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Hoe vaak de invoering van het wachtwoord opnieuw geprobeerd kan worden"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Payload uitlijnen op meervouden van <n> sectoren – voor luksFormat"
+
+#: src/cryptsetup.c:3512
+#, fuzzy
+msgid "File with LUKS header and keyslots backup"
+msgstr "Bestand met reservekopie van LUKS-koptekst en -sleutelplaatsen."
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+#, fuzzy
+msgid "Use /dev/random for generating volume key"
+msgstr "Gebruik /dev/random om de sleutel tot het opslagmedium te genereren."
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+#, fuzzy
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Gebruik /dev/urandom om de sleutel tot het opslagmedium te genereren."
+
+#: src/cryptsetup.c:3515
+#, fuzzy
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Apparaat met een ander, niet-overlappend cryptsegment delen."
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+#, fuzzy
+msgid "UUID for device to use"
+msgstr "UUID van het te gebruiken apparaat."
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+#, fuzzy
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Discardaanvragen (alias TRIM) op dit apparaat toelaten."
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+#, fuzzy
+msgid "Device or file with separated LUKS header"
+msgstr "Apparaat of bestand met verschillende LUKS-koptekst."
+
+#: src/cryptsetup.c:3519
+#, fuzzy
+msgid "Do not activate device, just check passphrase"
+msgstr "Apparaat niet activeren, enkel wachtwoord controleren."
+
+#: src/cryptsetup.c:3520
+#, fuzzy
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Verborgen koptekst gebruiken (verborgen TCRYPT-apparaat)."
+
+#: src/cryptsetup.c:3521
+#, fuzzy
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Apparaat is TCRYPT-systeemschijf (met bootloader)."
+
+#: src/cryptsetup.c:3522
+#, fuzzy
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Reserve (secundaire) TCRYPT-koptekst gebruiken."
+
+#: src/cryptsetup.c:3523
+#, fuzzy
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Eveneens naar VeraCrypt-compatibel apparaat scannen."
+
+#: src/cryptsetup.c:3524
+#, fuzzy
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Eveneens naar VeraCrypt-compatibel apparaat scannen."
+
+#: src/cryptsetup.c:3525
+#, fuzzy
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Eveneens naar VeraCrypt-compatibel apparaat scannen."
+
+#: src/cryptsetup.c:3526
+#, fuzzy
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Soorten apparaat-metadata: luks, plain, loopaes, tcrypt."
+
+#: src/cryptsetup.c:3527
+#, fuzzy
+msgid "Disable password quality check (if enabled)"
+msgstr "Wachtwoordkwaliteitscontrole uitschakelen (indien ingeschakeld)."
+
+#: src/cryptsetup.c:3528
+#, fuzzy
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "dm-crypt same_cpu_crypt prestatie-compatibiliteitsoptie gebruiken."
+
+#: src/cryptsetup.c:3529
+#, fuzzy
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "dm-crypt submit_from_crypt_cpus prestatie-compatibiliteitsoptie gebruiken."
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr ""
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr ""
+
+#: src/cryptsetup.c:3532
+#, fuzzy
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "PBKDF2 herhalingstijd voor LUKS (in ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "milliseconden"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+#, fuzzy
+msgid "kilobytes"
+msgstr "bytes"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr ""
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr ""
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr ""
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr ""
+
+#: src/cryptsetup.c:3538
+#, fuzzy
+msgid "Disable locking of on-disk metadata"
+msgstr "on-disk metadata proberen te herstellen"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr ""
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr ""
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr ""
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr ""
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr ""
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr ""
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr ""
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr ""
+
+#: src/cryptsetup.c:3550
+#, fuzzy
+msgid "Set label for the LUKS2 device"
+msgstr "een LUKS-apparaat formatteren"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr ""
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr ""
+
+#: src/cryptsetup.c:3553
+#, fuzzy
+msgid "Read or write the json from or to a file"
+msgstr "De sleutel uit een bestand lezen."
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr ""
+
+#: src/cryptsetup.c:3555
+#, fuzzy
+msgid "LUKS2 header keyslots area size"
+msgstr "Bestand met reservekopie van LUKS-koptekst en -sleutelplaatsen."
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3557
+#, fuzzy
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "De grootte van de encryptiesleutel"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr ""
+
+#: src/cryptsetup.c:3559
+#, fuzzy
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Apparaat permanent ontsleutelen (encryptie verwijderen)."
+
+#: src/cryptsetup.c:3560
+#, fuzzy
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Apparaat permanent ontsleutelen (encryptie verwijderen)."
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Grootte van gegevensapparaat wijzigen (gegevenspositie wijzigen). GEVAARLIJK!"
+
+#: src/cryptsetup.c:3564
+#, fuzzy
+msgid "Maximal reencryption hotzone size."
+msgstr "Blokgrootte herencryptie"
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
+
+#: src/cryptsetup.c:3566
+#, fuzzy
+msgid "Reencryption hotzone checksums hash"
+msgstr "Blokgrootte herencryptie"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[OPTIE…] <actie> <actie-specifiek>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Argument <actie> ontbreekt."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Onbekende actie."
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr "Optie --shared wordt enkel toegestaan voor open-opdracht op plain-apparaat.\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Optie --shared wordt enkel toegestaan voor open-opdracht op plain-apparaat.\n"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+
+#: src/cryptsetup.c:3743
+#, fuzzy
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+
+#: src/cryptsetup.c:3753
+#, fuzzy
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"Optie --key-size is enkel toegestaan bij luksFormat, open en benchmark.\n"
+"Om de lezing uit een sleutelbestand te beperken, gebruik --keyfile-size=(bytes)."
+
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Optie --align-payload is enkel toegestaan voor luksFormat."
+
+#: src/cryptsetup.c:3764
+#, fuzzy
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Optie --allow-discards wordt enkel ondersteund voor de luksOpen-, loopaesOpen- en create-opdrachten.\n"
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Optie --test-passphrase is enkel toegestaan bij open van LUKS- en TCRYPT-apparaten.\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Sleutelgrootte moet een meervoud zijn van 8 bits"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "Sleutelplaats is ongeldig."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Optie --key-file krijgt voorrang over het gespecificeerde sleutelbestandsargument."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "Een negatief getal wordt niet toegestaan voor deze optie."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Slechts een enkel gebruik van het --key-file argument is toegestaan."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Slechts een enkel gebruik van de opties --use-[u]random is toegestaan."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "OPtie --use-[u]random is enkel toegestaan bij luksFormat."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "Optie --uuid is enkel toegestaan bij luksFormat en luksUUID."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "Optie --align-payload is enkel toegestaan voor luksFormat."
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr ""
+
+#: src/cryptsetup.c:3830
+#, fuzzy
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Ongeldig apparaatsgrootte ingegeven."
+
+#: src/cryptsetup.c:3834
+#, fuzzy
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Ongeldig apparaatsgrootte ingegeven."
+
+#: src/cryptsetup.c:3838
+#, fuzzy
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Optie --align-payload is enkel toegestaan voor luksFormat."
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Optie --skip wordt enkel ondersteund voor open-opdracht op plain- en loopaes-apparaten.\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Optie --offset wordt enkel ondersteund voor open-opdracht op plain- en loopaes-apparaten.\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Optie --tcrypt-hidden, --tcrypt-system of --tcrypt-backup wordt enkel ondersteund voor TCRYPT-apparaten.\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Optie --tcrypt-hidden kan niet met --allow-discards gecombineerd worden.\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Optie --veracrypt wordt enkel ondersteund voor TCRYPT-apparaatstype.\n"
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr ""
+
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Optie --veracrypt wordt enkel ondersteund voor TCRYPT-apparaatstype.\n"
+
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Optie --veracrypt wordt enkel ondersteund voor TCRYPT-apparaatstype.\n"
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr ""
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr ""
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr ""
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr ""
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "Deze operatie wordt niet ondersteund voor dit apparaatstype.\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr ""
+
+#: src/cryptsetup.c:3944
+#, fuzzy
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Optie --new kan niet samen met --decrypt gebruikt worden."
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "Optie -- keep-key kan enkel samen met --hash of --iter-time gebruikt worden."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr ""
+
+#: src/cryptsetup.c:3970
+#, fuzzy
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Ongeldig apparaatsgrootte ingegeven."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Ongeldig apparaatsgrootte ingegeven."
+
+#: src/cryptsetup.c:3981
+#, fuzzy
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Maximum apparaatsverkleiningsgrootte is 64 MB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Verkleiningsgrootte moet een meervoud zijn van de 512 bytes-grote sector."
+
+#: src/cryptsetup.c:3989
+#, fuzzy
+msgid "Invalid data size specification."
+msgstr "Ongeldig apparaatsgrootte ingegeven."
+
+#: src/cryptsetup.c:3994
+#, fuzzy
+msgid "Reduce size overflow."
+msgstr "Overloop van apparaatsgegevenspositie.\n"
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
+
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Verkleiningsgrootte moet een meervoud zijn van de 512 bytes-grote sector."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Opties --ignore-corruption en --restart-on-corruption kunnen niet samen gebruikt worden.\n"
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Ongeldige salt-tekenreeks opgegeven."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Kan hashafbeeling %s niet aanmaken voor beschrijving."
+
+#: src/veritysetup.c:107
+#, fuzzy, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Kan hashafbeeling %s niet aanmaken voor beschrijving.\n"
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Ongeldige root-hash tekenreeks opgegeven."
+
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "Ongeldig apparaat %s.\n"
+
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr "Kan sleutelbestand %s niet lezen.\n"
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<gegevensapparaat> <hash-apparaat>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "apparaat formateren"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<gegevensapparaat> <hash-apparaat> <root-hash>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "apparaat controleren"
+
+#: src/veritysetup.c:394
+#, fuzzy
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<gegevensapparaat> <hash-apparaat> <root-hash>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "status van actief apparaat tonen"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<hash-apparaat>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "on-disk informatie tonen"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<naam> is de naam van het onder %s te creëren apparaat\n"
+"<gegevensapparaat> is het de naam van het gegevensapparaat\n"
+"<hash-apparaat> is de naam van het apparaat dat de verificatiegegevens bevat\n"
+"<root-hash> is de hash van de rootnode op <hash-apparaat>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Standaard meegecompileerde dm-verity parameters:\n"
+"\tHash: %s, Datablok (bytes): %u, Hashblock (bytes): %u, Saltgrootte: %u, Hashformaat: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "VERITY-superblok niet gebruiken"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Formaatstype (1 - normaal, 0 - origineel Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "nummer"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Blokgrootte op het gegevensapparaat"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Blokgrootte op het hash-apparaat"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr ""
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Aantal blokken in het gegevensbestand"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "blokken"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr ""
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr ""
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "De startplaats op het hash-apparaat"
+
+#: src/veritysetup.c:474
+#, fuzzy
+msgid "Starting offset on the FEC device"
+msgstr "De startplaats op het hash-apparaat"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Hash-algoritme"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "tekenreeks"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Salt"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "hex-tekenreeks"
+
+#: src/veritysetup.c:478
+#, fuzzy
+msgid "Path to root hash signature file"
+msgstr "Creatie hash-gebied gefaald.\n"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Kernel herstarten bij ontdekking van corruptie"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Datacorruptie negeren, enkel loggen"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Op nul ingestelde blokken niet controleren"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr ""
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Opties --ignore-corruption, --restart-on-corruption of --ignore-zero-blocks kunnen enkel bij een create-operatie gebruikt worden.\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+
+#: src/veritysetup.c:592
+#, fuzzy
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Opties --ignore-corruption en --restart-on-corruption kunnen niet samen gebruikt worden.\n"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Kan sleutelbestand %s niet lezen."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Kan %d bytes uit sleutelbestand %s niet lezen."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr ""
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+#, fuzzy
+msgid "<integrity_device>"
+msgstr "apparaat controleren"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr ""
+
+#: src/integritysetup.c:502
+#, fuzzy, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<naam> is de naam van het onder %s te creëren apparaat\n"
+"<gegevensapparaat> is het de naam van het gegevensapparaat\n"
+"<hash-apparaat> is de naam van het apparaat dat de verificatiegegevens bevat\n"
+"<root-hash> is de hash van de rootnode op <hash-apparaat>\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr ""
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr ""
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr ""
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr ""
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr ""
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr ""
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr ""
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr ""
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:562
+#, fuzzy
+msgid "The size of the data integrity key"
+msgstr "De grootte van de encryptiesleutel"
+
+#: src/integritysetup.c:563
+#, fuzzy
+msgid "Read the integrity key from a file"
+msgstr "De sleutel uit een bestand lezen."
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:566
+#, fuzzy
+msgid "The size of the journal integrity key"
+msgstr "De grootte van de encryptiesleutel"
+
+#: src/integritysetup.c:567
+#, fuzzy
+msgid "Read the journal integrity key from a file"
+msgstr "De sleutel uit een bestand lezen."
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr ""
+
+#: src/integritysetup.c:570
+#, fuzzy
+msgid "The size of the journal encryption key"
+msgstr "De grootte van de encryptiesleutel"
+
+#: src/integritysetup.c:571
+#, fuzzy
+msgid "Read the journal encryption key from a file"
+msgstr "De sleutel uit een bestand lezen."
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr ""
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr ""
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr ""
+
+#: src/integritysetup.c:649
+#, fuzzy
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Optie --allow-discards wordt enkel toegestaan voor de open-operatie.\n"
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr ""
+
+#: src/integritysetup.c:675
+#, fuzzy
+msgid "Invalid journal size specification."
+msgstr "Ongeldig apparaatsgrootte ingegeven."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr ""
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr ""
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr ""
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr ""
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr ""
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr ""
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr ""
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Herencryptie is al bezig"
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Kan %s niet exclusief openen, apparaat wordt gebruikt."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Reservering van uitgelijnd geheugen gefaald."
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "Kan apparaat niet lezen: %s."
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "LUKS1-apparaat %s wordt als onbruikbaar gemarkeerd."
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Kan apparaat %s niet beschrijven."
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Kan herencryptie-logbestand niet schrijven."
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Kan herencryptie-logbestand niet lezen."
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Logbestand %s bestaat reeds, herencryptie wordt herstart.\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Activatie van tijdelijke apparaat met oude LUKS-koptekst."
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Activatie van tijdelijke apparaat met nieuwe LUKS-koptekst."
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Activatie van tijdelijke apparaten gefaald."
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Nieuwe LUKS-koptekst voor apparaat %s aangemaakt."
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
 msgstr ""
-"Optie --test-passphrase is enkel toegestaan bij open van LUKS- en TCRYPT-"
-"apparaten.\n"
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
-msgid "Key size must be a multiple of 8 bits"
-msgstr "Sleutelgrootte moet een meervoud zijn van 8 bits"
+#: src/cryptsetup_reencrypt.c:659
+#, fuzzy
+msgid "Failed to write activation flags to new header."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
-msgid "Key slot is invalid."
-msgstr "Sleutelplaats is ongeldig."
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+#, fuzzy
+msgid "Failed to read requirements from backup header."
+msgstr "Lezen uit sleutelopslag is mislukt."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"Optie --key-file krijgt voorrang over het gespecificeerde "
-"sleutelbestandsargument.\n"
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "Reservekopie van %s-koptekst op apparaat %s is aangemaakt."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
-msgid "Negative number for option not permitted."
-msgstr "Een negatief getal wordt niet toegestaan voor deze optie."
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Creatie van LUKS-reservekopteksten gefaald."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
-msgid "Only one of --use-[u]random options is allowed."
-msgstr "Slechts een enkel gebruik van de opties --use-[u]random is toegestaan."
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Kan %s-koptekst op apparaat %s niet herstellen."
 
-#: src/cryptsetup.c:1699
-msgid "Option --use-[u]random is allowed only for luksFormat."
-msgstr "OPtie --use-[u]random is enkel toegestaan bij luksFormat."
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "%s-koptekst op apparaat %s is hersteld."
 
-#: src/cryptsetup.c:1703
-msgid "Option --uuid is allowed only for luksFormat and luksUUID."
-msgstr "Optie --uuid is enkel toegestaan bij luksFormat en luksUUID."
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Kan tijdelijk LUKS-apparaat niet openen."
 
-#: src/cryptsetup.c:1707
-msgid "Option --align-payload is allowed only for luksFormat."
-msgstr "Optie --align-payload is enkel toegestaan voor luksFormat."
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Kan apparaatgrootte niet lezen."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Optie --skip wordt enkel ondersteund voor open-opdracht op plain- en loopaes-"
-"apparaten.\n"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Invoer/uitvoerfout tijdens herencryptie."
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Optie --offset wordt enkel ondersteund voor open-opdracht op plain- en "
-"loopaes-apparaten.\n"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Opgegeven UUID is ongeldig."
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
-msgstr ""
-"Optie --tcrypt-hidden, --tcrypt-system of --tcrypt-backup wordt enkel "
-"ondersteund voor TCRYPT-apparaten.\n"
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Kan herencryptie-logbestand niet openen."
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
-msgstr ""
-"Optie --tcrypt-hidden kan niet met --allow-discards gecombineerd worden.\n"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Er is geen ontsleutelingsproces aan de gang. Het opgegeven UUID kan enkel gebruikt worden om een geschorst ontsleutelingsproces opnieuw te starten."
 
-#: src/cryptsetup.c:1735
-#, fuzzy
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
 msgstr ""
-"Optie --tcrypt-hidden, --tcrypt-system of --tcrypt-backup wordt enkel "
-"ondersteund voor TCRYPT-apparaten.\n"
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "Ongeldige salt-tekenreeks opgegeven.\n"
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Blokgrootte voor herencryptie"
 
-#: src/veritysetup.c:88
-#, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "Kan hashafbeeling %s niet aanmaken voor beschrijving.\n"
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "Ongeldige root-hash tekenreeks opgegeven.\n"
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Sleutel niet wijzigen; gegevensgebied wordt niet opnieuw versleuteld"
 
-#: src/veritysetup.c:308
-msgid "<data_device> <hash_device>"
-msgstr "<gegevensapparaat> <hash-apparaat>"
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "De (hoofd)sleutel tot het opslagmedium uit een bestand lezen"
 
-#: src/veritysetup.c:308
-msgid "format device"
-msgstr "apparaat formateren"
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "PBKDF2 herhalingstijd voor LUKS (in ms)"
 
-#: src/veritysetup.c:309
-msgid "<data_device> <hash_device> <root_hash>"
-msgstr "<gegevensapparaat> <hash-apparaat> <root-hash>"
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "'direct-io' gebruiken bij het lezen van apparaten"
 
-#: src/veritysetup.c:309
-msgid "verify device"
-msgstr "apparaat controleren"
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Na elk blok 'fsync' gebruiken"
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<naam> <gegevensapparaat> <hash-apparaat> <root-hash>"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Na elk blok het logbestand bijwerken"
 
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "actief apparaat aanmaken"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Enkel deze plaats gebruiken (anderen worden uitgeschakeld)"
 
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "apparaat verwijderen (deactiveren)"
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Nieuwe koptekst op niet-versleuteld apparaat invoeren"
 
-#: src/veritysetup.c:312
-msgid "show active device status"
-msgstr "status van actief apparaat tonen"
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Apparaat permanent ontsleutelen (encryptie verwijderen)"
 
-#: src/veritysetup.c:313
-msgid "<hash_device>"
-msgstr "<hash-apparaat>"
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "Het UUID om de ontsleuteling te hervatten"
 
-#: src/veritysetup.c:313
-msgid "show on-disk information"
-msgstr "on-disk informatie tonen"
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Soorten apparaat-metadata: luks, plain, loopaes, tcrypt"
 
-#: src/veritysetup.c:332
-#, c-format
-msgid ""
-"\n"
-"<name> is the device to create under %s\n"
-"<data_device> is the data device\n"
-"<hash_device> is the device containing verification data\n"
-"<root_hash> hash of the root node on <hash_device>\n"
-msgstr ""
-"\n"
-"<naam> is de naam van het onder %s te creëren apparaat<gegevensapparaat> is "
-"het de naam van het gegevensapparaat<hash-apparaat> is de naam van het "
-"apparaat dat de verificatiegegevens bevat<root-hash> is de hash van de "
-"rootnode op <hash-apparaat>\n"
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[OPTIE...] <apparaat>"
 
-#: src/veritysetup.c:339
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
-msgstr ""
-"\n"
-"Standaard meegecompileerde dm-verity parameters:\n"
-"\tHash: %s, Datablok (bytes): %u, Hashblock (bytes): %u, Saltgrootte: %u, "
-"Hashformaat: %u\n"
+#: src/cryptsetup_reencrypt.c:1667
+#, fuzzy, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Herencryptie zal sleutel tot het opslagmedium %s%s%s%s wijzigen.\n"
 
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
-msgstr "VERITY-superblok niet gebruiken"
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr ""
 
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
-msgstr "Formaatstype (1 - normaal, 0 - origineel Chrome OS)"
+#: src/cryptsetup_reencrypt.c:1670
+#, fuzzy
+msgid "set hash to "
+msgstr ", stel hash in op "
 
-#: src/veritysetup.c:378
-msgid "number"
-msgstr "nummer"
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", stel sleutelalgoritme in op "
 
-#: src/veritysetup.c:379
-msgid "Block size on the data device"
-msgstr "Blokgrootte op het gegevensapparaat"
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Argument is vereist."
 
-#: src/veritysetup.c:380
-msgid "Block size on the hash device"
-msgstr "Blokgrootte op het hash-apparaat"
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Enkel waarden tussen 1 MB en 64 MB zijn toegestaan als herencryptieblokgrootte."
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
-msgstr "Aantal blokken in het gegevensbestand"
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "Maximum apparaatsverkleiningsgrootte is 64 MB."
 
-#: src/veritysetup.c:381
-msgid "blocks"
-msgstr "blokken"
+#: src/cryptsetup_reencrypt.c:1737
+#, fuzzy
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Optie --new moet samen met --reduce-device-size gebruikt worden."
 
-#: src/veritysetup.c:382
-msgid "Starting offset on the hash device"
-msgstr "De startplaats op het hash-apparaat"
+#: src/cryptsetup_reencrypt.c:1741
+#, fuzzy
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Optie -- keep-key kan enkel samen met --hash of --iter-time gebruikt worden."
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
-msgstr "Hash-algoritme"
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "Optie --new kan niet samen met --decrypt gebruikt worden."
 
-#: src/veritysetup.c:383
-msgid "string"
-msgstr "tekenreeks"
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "Optie --decrypt is niet verenigbaar met de verschafte parameters."
 
-#: src/veritysetup.c:384
-msgid "Salt"
-msgstr "Salt"
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Optie --uuid kan enkel samen met --decrypt gebruikt worden."
 
-#: src/veritysetup.c:384
-msgid "hex string"
-msgstr "hex-tekenreeks"
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:147
-#, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Kan %s niet exclusief openen, apparaat wordt gebruikt.\n"
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Fout bij het lezen van antwoord uit de terminal."
 
-#: src/cryptsetup_reencrypt.c:151
-#, c-format
-msgid "Cannot open device %s\n"
-msgstr "Kan apparaat %s niet openen.\n"
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Opdracht succesvol.\n"
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "Reservering van uitgelijnd geheugen gefaald.\n"
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:168
-#, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Kan apparaat niet lezen: %s.\n"
+#: src/utils_tools.c:196
+#, fuzzy
+msgid "no permission or bad passphrase"
+msgstr "Voer enig wachtwoord in: "
 
-#: src/cryptsetup_reencrypt.c:179
-#, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "LUKS-apparaat %s wordt als onbruikbaar gemarkeerd.\n"
+#: src/utils_tools.c:198
+#, fuzzy
+msgid "out of memory"
+msgstr "Kan geheugen niet ontgrendelen.\n"
 
-#: src/cryptsetup_reencrypt.c:184
-#, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "LUKS-apparaat %s wordt als bruikbaar gemarkeerd.\n"
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:200
-#, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Kan apparaat %s niet beschrijven.\n"
+#: src/utils_tools.c:202
+#, fuzzy
+msgid "device already exists or device is busy"
+msgstr "Apparaat %s bestaat reeds.\n"
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "Kan herencryptie-logbestand niet schrijven.\n"
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "Kan herencryptie-logbestand niet lezen.\n"
+#: src/utils_tools.c:206
+#, fuzzy, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Opdracht is mislukt met code %i"
 
-#: src/cryptsetup_reencrypt.c:374
-#, c-format
-msgid "Log file %s exists, resuming reencryption.\n"
-msgstr "Logbestand %s bestaat reeds, herencryptie wordt herstart.\n"
+#: src/utils_tools.c:283
+#, fuzzy, c-format
+msgid "Key slot %i created."
+msgstr "Sleutelplaats %d werd gewijzigd.\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr "Activatie van tijdelijke apparaat met oude LUKS-koptekst.\n"
+#: src/utils_tools.c:285
+#, fuzzy, c-format
+msgid "Key slot %i unlocked."
+msgstr "Sleutelplaats %d is ontgrendeld.\n"
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr "Activatie van tijdelijke apparaat met nieuwe LUKS-koptekst.\n"
+#: src/utils_tools.c:287
+#, fuzzy, c-format
+msgid "Key slot %i removed."
+msgstr "Sleutelplaats %d is ontgrendeld.\n"
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Activatie van tijdelijke apparaten gefaald.\n"
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:450
+#: src/utils_tools.c:298
 #, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Nieuwe LUKS-koptekst voor apparaat %s aangemaakt.\n"
+msgid "Token %i removed."
+msgstr ""
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/utils_tools.c:475
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Sleutelplaats %d geactiveerd.\n"
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/utils_tools.c:483
 #, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "Reservekopie van LUKS-koptekst op apparaat %s aangemaakt .\n"
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+#, fuzzy
+msgid "Failed to initialize device signature probes."
+msgstr "Kan geen map voor de apparaatstoewijzer verkrijgen."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "Creatie van LUKS-reservekopteksten gefaald.\n"
+#: src/utils_tools.c:548
+#, fuzzy, c-format
+msgid "Failed to stat device %s."
+msgstr "Kan status van sleutelbestand niet opvragen.\n"
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/utils_tools.c:561
 #, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Kan koptekst op apparaat %s niet herstellen.\n"
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/utils_tools.c:563
 #, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "LUKS-koptekst op apparaat %s hersteld.\n"
+msgid "Failed to open file %s in read/write mode."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:669
+#: src/utils_tools.c:577
 #, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
 msgstr ""
-"Vooruitgang: %5.1f%%, geschatte voltooiïngstijd %02llu:%02llu, %4llu MB "
-"geschreven, snelheid %5.1f MiB/s%s"
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Onmogelijk te zoeken tot startplaats van apparaat.\n"
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Kan tijdelijk LUKS-koptekstbestand niet openen.\n"
+#: src/utils_tools.c:583
+#, fuzzy
+msgid "Failed to wipe device signature."
+msgstr "Schrijven naar sleutelopslag is mislukt.\n"
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "Kan apparaatgrootte niet lezen.\n"
+#: src/utils_tools.c:590
+#, fuzzy, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Kan geen map voor de apparaatstoewijzer verkrijgen."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Onderbroken door een signaal.\n"
+#: src/utils_tools.c:629
+#, fuzzy
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr "Blokgrootte herencryptie"
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "Invoer/uitvoerfout tijdens herencryptie.\n"
+#: src/utils_password.c:43 src/utils_password.c:75
+#, fuzzy, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Kan wachtwoordkwaliteit niet nakijken: %s\n"
 
-#: src/cryptsetup_reencrypt.c:1028
+#: src/utils_password.c:51
+#, fuzzy, c-format
 msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
+"Password quality check failed:\n"
+" %s"
 msgstr ""
-"Sleutelbestand kan enkel gebruikt worden met optie --key-slot of met enkel "
-"één actieve sleutelplaats.\n"
+"Wachtwoordkwaliteitscontrole gefaald:\n"
+"%s\n"
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
+#: src/utils_password.c:83
 #, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Voer wachtwoord voor sleutelplaats %u in: "
-
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Kan herencryptie-logbestand niet openen.\n"
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Wachtwoordkwaliteitscontrole gefaald: wachtwoord is van slechte kwaliteit (%s)"
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "Reencryption block size"
-msgstr "Blokgrootte herencryptie"
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Fout bij het lezen van het wachtwoord uit de terminal."
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "MiB"
-msgstr "MB"
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Voer wachtwoord nogmaals in: "
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "Sleutel niet wijzigen; gegevensgebied wordt niet opnieuw versleuteld."
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Wachtwoorden komen niet overeen."
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr "direct-io gebruiken bij het lezen van apparaten."
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Kan de gegevenspositie niet via terminalinvoer gebruiken."
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr "fsync na elk blok gebruiken."
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Voer wachtwoord in: "
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Na elk blok het logbestand bijwerken."
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Voer wachtwoord in voor %s: "
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr "Enkel deze plaats gebruiken (anderen worden uitgeschakeld)."
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Geen sleutel beschikbaar met dit wachtwoord."
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
 msgstr ""
-"Grootte van gegevensapparaat wijzigen (gegevenspositie wijzigen). GEVAARLIJK!"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+#: src/utils_password.c:328
+#, fuzzy, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Kan bestand %s niet openen.\n"
+
+#: src/utils_password.c:335
+#, fuzzy, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Kan sleutelbestand %s niet lezen.\n"
+
+#: src/utils_luks2.c:47
+#, fuzzy, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Openen van sleutelbestand is mislukt.\n"
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
 msgstr ""
-"Enkel ingegeven apparaatsgrootte gebruiken (rest van apparaat wordt "
-"genegeerd). GEVAARLIJK!"
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Nieuwe koptekst op niet-versleuteld apparaat invoeren."
+#: src/utils_luks2.c:67
+#, fuzzy
+msgid "Failed to read JSON file."
+msgstr "Openen van sleutelbestand is mislukt.\n"
 
-#: src/cryptsetup_reencrypt.c:1282
+#: src/utils_luks2.c:72
 #, fuzzy
-msgid "Permanently decrypt device (remove encryption)."
-msgstr "alle sleutelplaatsen wissen (encryptiesleutel verwijderen)"
+msgid ""
+"\n"
+"Read interrupted."
+msgstr "VERITY-koptekst beschadigd.\n"
 
-#: src/cryptsetup_reencrypt.c:1298
-msgid "[OPTION...] <device>"
-msgstr "[OPTIE...] <apparaat>"
+#: src/utils_luks2.c:113
+#, fuzzy, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Openen van sleutelbestand is mislukt.\n"
 
-#: src/cryptsetup_reencrypt.c:1312
+#: src/utils_luks2.c:122
 msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
+"\n"
+"Write interrupted."
 msgstr ""
-"Waarschuwing: deze code is nog experimenteel, het kan al uw data volledig "
-"vernielen.\n"
 
-#: src/cryptsetup_reencrypt.c:1313
-#, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "Herencryptie zal sleutel tot het opslagmedium %s%s%s%s wijzigen.\n"
+#: src/utils_luks2.c:126
+#, fuzzy
+msgid "Failed to write JSON file."
+msgstr "Openen van sleutelbestand is mislukt.\n"
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
-msgstr ", stel hash in op "
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Versleutelalgoritme %s is niet beschikbaar."
 
-#: src/cryptsetup_reencrypt.c:1315
-msgid ", set cipher to "
-msgstr ", stel sleutelalgoritme in op "
+#, fuzzy
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Kan herencryptie-logbestand niet lezen.\n"
 
-#: src/cryptsetup_reencrypt.c:1320
-msgid "Argument required."
-msgstr "Argument is vereist."
+#~ msgid "Replaced with key slot %d.\n"
+#~ msgstr "Vervangen door sleutelplaats %d.\n"
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Enkel waarden tussen 1 MB en 64 MB zijn toegestaan als "
-"herencryptieblokgrootte."
+#~ msgid "Function not available in FIPS mode.\n"
+#~ msgstr "Functie niet beschikbaar in FIPS-modus.\n"
 
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Ongeldig apparaatsgrootte ingegeven."
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Te veel niveau's in de boomstructuur voor een VERITY-volume.\n"
 
-#: src/cryptsetup_reencrypt.c:1363
-msgid "Maximum device reduce size is 64 MiB."
-msgstr "Maximum apparaatsverkleiningsgrootte is 64 MB."
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "geheugentoewijzingsfout in action_luksFormat"
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr ""
-"Verkleiningsgrootte moet een meervoud zijn van de 512 bytes-grote sector."
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Sleutel %d is niet actief. Kan niet wissen.\n"
 
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr "Optie --new moet samen met --reduce-device-size gebruikt worden."
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<naam> <gegevensapparaat> <hash-apparaat> <root-hash>"
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
-"Optie -- keep-key kan enkel samen met --hash of --iter-time gebruikt worden."
+#~ msgid "create active device"
+#~ msgstr "actief apparaat aanmaken"
 
-#: src/cryptsetup_reencrypt.c:1378
-#, fuzzy
-msgid "Option --new cannot be used together with --decrypt."
-msgstr "Optie --new moet samen met --reduce-device-size gebruikt worden."
+#~ msgid "remove (deactivate) device"
+#~ msgstr "apparaat verwijderen (deactiveren)"
 
-#: src/cryptsetup_reencrypt.c:1382
-msgid "Option --decrypt is incompatible with specified parameters."
-msgstr ""
+#~ msgid "Activated keyslot %i.\n"
+#~ msgstr "Sleutelplaats %d geactiveerd.\n"
 
-#: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Fout bij het lezen van antwoord uit de terminal.\n"
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Vooruitgang: %5.1f%%, geschatte voltooiïngstijd %02llu:%02llu, %4llu MB geschreven, snelheid %5.1f MiB/s%s"
 
-#: src/utils_tools.c:173
-msgid "Command successful.\n"
-msgstr "Opdracht succesvol.\n"
+#~ msgid "Interrupted by a signal.\n"
+#~ msgstr "Onderbroken door een signaal.\n"
 
-#: src/utils_tools.c:191
-#, c-format
-msgid "Command failed with code %i"
-msgstr "Opdracht is mislukt met code %i"
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Kan geen vrij loopback-apparaat vinden.\n"
 
-#: src/utils_password.c:42
-#, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Kan wachtwoordkwaliteit niet nakijken: %s\n"
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Kan apparaat %s niet openen.\n"
 
-#: src/utils_password.c:50
-#, c-format
-msgid ""
-"Password quality check failed:\n"
-" %s\n"
-msgstr ""
-"Wachtwoordkwaliteitscontrole gefaald:\n"
-"%s\n"
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Kan doorgegeven UUID niet gebruiken tenzij ontsleuteling al bezig is.\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "LUKS-apparaat %s wordt als bruikbaar gemarkeerd.\n"
+
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "Waarschuwing: deze code is nog experimenteel, het kan al uw data volledig vernielen.\n"
 
 #~ msgid "FIPS checksum verification failed.\n"
 #~ msgstr "Verificatie van FIPS-controlesom gefaald.\n"
 
-#~ msgid ""
-#~ "WARNING: device %s is a partition, for TCRYPT system encryption you "
-#~ "usually need to use whole block device path.\n"
-#~ msgstr ""
-#~ "WAARSCHUWING: apparaat %s is een partitie; bij TCRYPT-"
-#~ "systeemversleuteling moet u doorgaans het volledige pad naar het blok-"
-#~ "apparaat gebruiken.\n"
+#~ msgid "WARNING: device %s is a partition, for TCRYPT system encryption you usually need to use whole block device path.\n"
+#~ msgstr "WAARSCHUWING: apparaat %s is een partitie; bij TCRYPT-systeemversleuteling moet u doorgaans het volledige pad naar het blok-apparaat gebruiken.\n"
 
 #~ msgid "Kernel doesn't support plain64 IV.\n"
 #~ msgstr "Kernel ondersteunt plain64 IV niet.\n"
@@ -1923,12 +4087,6 @@ msgstr ""
 #~ msgid "Cannot open device %s for %s%s access.\n"
 #~ msgstr "Kan apparaat %s niet openen voor %s%s-toegang.\n"
 
-#~ msgid "exclusive "
-#~ msgstr "exclusieve "
-
-#~ msgid "writable"
-#~ msgstr "schrijf"
-
 #~ msgid "read-only"
 #~ msgstr "alleen-lezen"
 
@@ -1938,21 +4096,9 @@ msgstr ""
 #~ msgid "Unable to obtain sector size for %s"
 #~ msgstr "Kan sectorgrootte van %s niet verkrijgen"
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr "Kan geen map voor de apparaatstoewijzer verkrijgen."
-
 #~ msgid "Backup file %s doesn't exist.\n"
 #~ msgstr "Reservekopiebestand %s bestaat niet.\n"
 
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Kan bestand %s niet openen.\n"
-
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Schrijven naar sleutelopslag is mislukt.\n"
-
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr "Lezen uit sleutelopslag is mislukt.\n"
-
 #~ msgid "<name> <device>"
 #~ msgstr "<naam> <apparaat>"
 
@@ -1971,25 +4117,8 @@ msgstr ""
 #~ msgid "remove loop-AES mapping"
 #~ msgstr "loop-AES-toewijzing verwijderen"
 
-#~ msgid ""
-#~ "Option --allow-discards is allowed only for luksOpen, loopaesOpen and "
-#~ "create operation.\n"
-#~ msgstr ""
-#~ "Optie --allow-discards wordt enkel ondersteund voor de luksOpen-, "
-#~ "loopaesOpen- en create-opdrachten.\n"
-
-#~ msgid ""
-#~ "Cannot use device %s (crypt segments overlaps or in use by another "
-#~ "device).\n"
-#~ msgstr ""
-#~ "Kan apparaat %s niet gebruiken (cryptsegmenten overlappen of worden door "
-#~ "een ander apparaat gebruikt).\n"
-
-#~ msgid "Key slot %d verified.\n"
-#~ msgstr "Sleutelplaats %d is geverifieerd.\n"
-
-#~ msgid "Invalid key size %d.\n"
-#~ msgstr "Ongeldige sleutelgrootte %d.\n"
+#~ msgid "Cannot use device %s (crypt segments overlaps or in use by another device).\n"
+#~ msgstr "Kan apparaat %s niet gebruiken (cryptsegmenten overlappen of worden door een ander apparaat gebruikt).\n"
 
 #~ msgid "Block mode XTS is available since kernel 2.6.24.\n"
 #~ msgstr "Blokmodus XTS is beschikbaar vanaf kernelversie 2.6.24.\n"
@@ -2003,23 +4132,15 @@ msgstr ""
 #~ msgid "Negative keyfile size not permitted.\n"
 #~ msgstr "Een negatieve sleutelbestandsgrootte is niet toegestaan.\n"
 
-#~ msgid ""
-#~ "Warning: exhausting read requested, but key file is not a regular file, "
-#~ "function might never return.\n"
-#~ msgstr ""
-#~ "Waarschuwing: volledige lezing aangevraagd, maar sleutelbestand is geen "
-#~ "regulier bestand, functie zal misschien nooit terugkeren.\n"
+#~ msgid "Warning: exhausting read requested, but key file is not a regular file, function might never return.\n"
+#~ msgstr "Waarschuwing: volledige lezing aangevraagd, maar sleutelbestand is geen regulier bestand, functie zal misschien nooit terugkeren.\n"
 
 #~ msgid "Cannot find compatible device-mapper kernel modules.\n"
-#~ msgstr ""
-#~ "Kan geen compatibele kernelmodules voor apparaatstoewijzer vinden.\n"
+#~ msgstr "Kan geen compatibele kernelmodules voor apparaatstoewijzer vinden.\n"
 
 #~ msgid "Cannot open device: %s\n"
 #~ msgstr "Kan apparaat niet openen: %s\n"
 
-#~ msgid "BLKROGET failed on device %s.\n"
-#~ msgstr "BLKROGET() is mislukt op apparaat %s.\n"
-
 #~ msgid "BLKGETSIZE failed on device %s.\n"
 #~ msgstr "BLKGETSIZE() is mislukt op apparaat %s.\n"
 
@@ -2030,15 +4151,11 @@ msgstr ""
 #~ msgstr "actief apparaat wijzigen - VEROUDERD - zie man-pagina"
 
 #~ msgid ""
-#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case "
-#~ "you really need this functionality.\n"
-#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, "
-#~ "hit Ctrl-C now.\n"
+#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case you really need this functionality.\n"
+#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, hit Ctrl-C now.\n"
 #~ msgstr ""
-#~ "De herlaadactie is verouderd. Gebruik “dmsetup reload” indien u deze "
-#~ "functionaliteit echt nodig hebt.\n"
-#~ "WAARSCHUWING: gebruik de herlaadactie niet om LUKS-apparaten te "
-#~ "“touchen”. Indien u dat wilt doen, typ nu Ctrl-C.\n"
+#~ "De herlaadactie is verouderd. Gebruik “dmsetup reload” indien u deze functionaliteit echt nodig hebt.\n"
+#~ "WAARSCHUWING: gebruik de herlaadactie niet om LUKS-apparaten te “touchen”. Indien u dat wilt doen, typ nu Ctrl-C.\n"
 
 #~ msgid "Obsolete option --non-exclusive is ignored.\n"
 #~ msgstr "Verouderde optie --non-exclusive wordt genegeerd.\n"
@@ -2051,6 +4168,3 @@ msgstr ""
 
 #~ msgid "%s is not LUKS device.\n"
 #~ msgstr "%s is geen LUKS-apparaat.\n"
-
-#~ msgid "%s is not LUKS device."
-#~ msgstr "%s is geen LUKS-apparaat."
index 4ed282e..2f12a75 100644 (file)
Binary files a/po/pl.gmo and b/po/pl.gmo differ
index ba2b504..fd39611 100644 (file)
--- a/po/pl.po
+++ b/po/pl.po
 # Polish translation for cryptsetup.
 # Copyright (C) 2010 Free Software Foundation, Inc.
 # This file is put in the public domain.
-# Jakub Bogusz <qboosh@pld-linux.org>, 2010-2015.
+# Jakub Bogusz <qboosh@pld-linux.org>, 2010-2020.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-19 20:10+0100\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-15 19:02+0200\n"
 "Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n"
 "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
 "Language: pl\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
-"|| n%100>=20) ? 1 : 2;\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"Nie można zainicjować device-mappera w czasie działania jako nie-root.\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Nie można zainicjować device-mappera w czasie działania jako nie-root."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"Nie można zainicjować device-mappera. Czy moduł jądra dm_mod jest wczytany?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Nie można zainicjować device-mappera. Czy moduł jądra dm_mod jest wczytany?"
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Żądana flaga odroczona nie jest obsługiwana."
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "DM-UUID dla urządzenia %s został skrócony.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID dla urządzenia %s został skrócony."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Nieznany typ celu dm."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Żądane opcje dm-crypta dotyczące wydajności nie są obsługiwane."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Żądane opcje dm-verity dotyczące obsługi uszkodzenia danych nie są obsługiwane."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Żądane opcje FEC dm-verity nie są obsługiwane."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Żądane opcje integralności danych nie są obsługiwane."
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Żądane opcje wydajności dmcrypta nie są obsługiwane.\n"
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Żądana opcja sector_size nie jest obsługiwana."
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Żądane automatyczne przeliczenie znaczników integralności nie jest obsługiwane."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Porzucenie/TRIM nie jest obsługiwane."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Żądany tryb bitmapy dm-integrity nie jest obsługiwany."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Nie udało się odpytać segmentu dm-%s."
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
 "Entropia w systemie wyczerpała się w trakcie generowania klucza wolumenu.\n"
-"Proszę poruszać myszą albo wpisać trochę tekstu w innym oknie w celu "
-"zebrania zdarzeń losowych.\n"
+"Proszę poruszać myszą albo wpisać trochę tekstu w innym oknie w celu zebrania zdarzeń losowych.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Generowanie klucza (gotowe %d%%).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr "Błąd krytyczny w trakcie inicjalizacji RNG.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Działanie w trybie FIPS."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Błąd krytyczny w trakcie inicjalizacji RNG."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Nieznane żądanie jakości RNG."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Błąd odczytu z RNG."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr "Nieznane żądanie jakości RNG.\n"
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Nie można zainicjować backendu kryptograficznego RNG."
 
-#: lib/random.c:211
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Nie można zainicjować backendu kryptograficznego."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Algorytm skrótu %s nie jest obsługiwany."
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
 #, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Błąd %d podczas odczytu z RNG: %s\n"
+msgid "Key processing error (using hash %s)."
+msgstr "Błąd przetwarzania klucza (użyto algorytmu skrótu %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Nie można określić rodzaju urządzenia. Niezgodny sposób uaktywniania urządzenia?"
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr "Nie można zainicjować backendu kryptograficznego RNG.\n"
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Ta operacja jest obsługiwana tylko dla urządzeń LUKS."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Nie można zainicjować backendu kryptograficznego.\n"
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Ta operacja jest obsługiwana tylko dla urządzeń LUKS2."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Wszyskie miejsca na klucze są pełne."
+
+#: lib/setup.c:434
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "Algorytm skrótu %s nie jest obsługiwany.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Numer klucza %d jest błędny, proszę wybrać wartość między 0 a %d."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:440
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Błąd przetwarzania klucza (użyto algorytmu skrótu %s).\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "Miejsce na klucz %d jest pełne, proszę wybrać inne."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"Nie można określić rodzaju urządzenia. Niezgodny sposób aktywacji "
-"urządzenia?\n"
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "Rozmiar urządzenia nie jest wyrównany do rozmiaru bloku logicznego urządzenia."
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Wykryto nagłówek, ale urządzenie %s jest zbyt małe."
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Ta operacja jest obsługiwana tylko na urządzeniach LUKS.\n"
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Ta operacja nie jest obsługiwana dla tego rodzaju urządzenia."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Wszyskie miejsca na klucze są pełne.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Niedozwolona operacja w trakcie ponownego szyfrowania."
 
-#: lib/setup.c:327
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr "Numer klucza %d jest błędny, proszę wybrać wartość między 0 a %d.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "Nieobsługiwana wersja LUKS %d."
 
-#: lib/setup.c:333
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Osobne urządzenie metadanych nie jest obsługiwane dla tego rodzaju szyfrowania."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "Miejsce na klucz %d jest pełne, proszę wybrać inne.\n"
+msgid "Device %s is not active."
+msgstr "Urządzenie %s nie jest aktywne."
 
-#: lib/setup.c:472
+#: lib/setup.c:1444
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Hasło dla %s: "
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Urządzenie stojące za urządzeniem szyfrowanym %s zniknęło."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Błędne parametry szyfru plain."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Błędny rozmiar klucza."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID nie jest obsługiwany dla tego rodzaju szyfrowania."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Nieobsługiwany rozmiar sektora szyfrowania."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Rozmiar urządzenia nie jest wyrównany do żądanego rozmiaru sektura."
 
-#: lib/setup.c:653
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Nie można sformatować LUKS-a bez urządzenia."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Żądane wyrównanie metadanych nie jest zgodne z offsetem danych."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "UWAGA: offset danych leży poza obecnie dostępnym urządzeniem danych.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Nie można wymazać nagłówka na urządzeniu %s."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "UWAGA: uaktywnienie urządzenia się nie powiedzie, dm-crypt nie ma obsługi żądanego rozmiaru sektora szyfrowania.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Klucz wolumenu jest zbyt mały do szyfrowania z rozszerzeniami integralności."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Szyfr %s-%s (rozmiar klucza w bitach: %zd) nie jest dostępny."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "UWAGA: rozmiar metadanych LUKS2 zmienił się na %<PRIu64> (w bajtach).\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "UWAGA: rozmiar obszaru kluczy LUKS2 zmienił się na %<PRIu64> (w bajtach).\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "Urządzenie %s jest zbyt małe."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Nie można sformatować urządzenia %s, które jest w użyciu."
+
+#: lib/setup.c:1896 lib/setup.c:1922
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "Wykryto nagłówek, ale urządzenie %s jest zbyt małe.\n"
+msgid "Cannot format device %s, permission denied."
+msgstr "Nie można sformatować urządzenia %s, brak uprawnień."
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Ta operacja nie jest obsługiwana dla tego rodzaju urządzenia.\n"
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Nie można sformatować integralności dla urządzenia %s."
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1926
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Urządzenie %s nie jest aktywne.\n"
+msgid "Cannot format device %s."
+msgstr "Nie można sformatować urządzenia %s."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Nie można sformatować urządzenia LUKSAES bez urządzenia."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Nie można sformatować VERITY bez urządzenia."
 
-#: lib/setup.c:925
+#: lib/setup.c:2000 lib/verity/verity.c:102
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr "Urzędzenie stojące za urządzeniem szyfrowanym %s znikło.\n"
+msgid "Unsupported VERITY hash type %d."
+msgstr "Nieobsługiwany typ hasza VERITY %d."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Błędne parametry szyfru plain.\n"
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Nieobsługiwany rozmiar bloku VERITY."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Błędny rozmiar klucza.\n"
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Nieobsługiwany offset hasza VERITY."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "UUID nie jest obsługiwany dla tego rodzaju szyfrowania.\n"
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Nieobsługiwany offset FEC VERITY."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Nie można sformatować LUKS-a bez urządzenia.\n"
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Obszar danych zachodzi na obszar skrótów."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Obszar skrótu zachodzi na obszar FEC."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Obszar danych zachodzi na obszar FEC."
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "UWAGA: żądany rozmiar znacznika %d B różni się od rozmiaru wyjścia %s (%d B).\n"
 
-#: lib/setup.c:1089
+#: lib/setup.c:2286
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Nie można sformatować urządzenia %s, które jest nadal w użyciu.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Nieznany typ żądanego urządzenia szyfrującego %s."
 
-#: lib/setup.c:1092
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Nie można sformatować urządzenia %s, brak uprawnień.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Nieobsługiwane parametry urządzenia %s."
 
-#: lib/setup.c:1096
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Nie można wyczyścić nagłówka na urządzeniu %s.\n"
+msgid "Mismatching parameters on device %s."
+msgstr "Niezgodne parametry dla urządzenia %s."
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Nie można sformatować urządzenia LUKSAES bez urządzenia.\n"
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Urządzenia szyfrowane nie zgadzają się."
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "Nie można sformatować VERITY bez urządzenia.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "Nie udało się przeładować urządzenia %s."
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Nieobsługiwany typ hasza VERITY %d.\n"
+msgid "Failed to suspend device %s."
+msgstr "Nie udało się wstrzymać urządzenia %s."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Nieobsługiwany rozmiar bloku VERITY.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Nie udało wznowić urządzenia %s."
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Nieobsługiwany offset hasza VERITY.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Błąd krytyczny przy przeładowywaniu urządzenia %s (w oparciu o urządzenie %s)."
 
-#: lib/setup.c:1285
+#: lib/setup.c:2735 lib/setup.c:2737
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Nieznany typ żądanego urządzenia szyfrującego %s.\n"
+msgid "Failed to switch device %s to dm-error."
+msgstr "Nie udało się przełączyć urządzenia %s na dm-error."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Nie można zmienić rozmiaru urządzenia loopback."
 
-#: lib/setup.c:1435
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "Czy na pewno zmienić UUID urządzenia?"
 
-#: lib/setup.c:1545
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Plik nagłówka kopii zapasowej nie zawiera zgodnego nagłówka LUKS."
+
+#: lib/setup.c:3058
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Wolumen %s nie jest aktywny.\n"
+msgid "Volume %s is not active."
+msgstr "Wolumen %s nie jest aktywny."
 
-#: lib/setup.c:1556
+#: lib/setup.c:3069
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Wolumen %s już został wstrzymany.\n"
+msgid "Volume %s is already suspended."
+msgstr "Wolumen %s już został wstrzymany."
 
-#: lib/setup.c:1563
+#: lib/setup.c:3082
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "Wstrzymywanie nie jest obsługiwane dla urządzenia %s.\n"
+msgid "Suspend is not supported for device %s."
+msgstr "Wstrzymywanie nie jest obsługiwane dla urządzenia %s."
 
-#: lib/setup.c:1565
+#: lib/setup.c:3084
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Błąd podczas wstrzymywania urządzenia %s.\n"
+msgid "Error during suspending device %s."
+msgstr "Błąd podczas wstrzymywania urządzenia %s."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Wolumen %s nie jest wstrzymany.\n"
+msgid "Volume %s is not suspended."
+msgstr "Wolumen %s nie jest wstrzymany."
 
-#: lib/setup.c:1605
+#: lib/setup.c:3146
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Wznawianie nie jest obsługiwane dla urządzenia %s.\n"
+msgid "Resume is not supported for device %s."
+msgstr "Wznawianie nie jest obsługiwane dla urządzenia %s."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Błąd podczas wznawiania urządzenia %s.\n"
+msgid "Error during resuming device %s."
+msgstr "Błąd podczas wznawiania urządzenia %s."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Hasło: "
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Klucz wolumenu nie pasuje do wolumenu."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Nie można dodać klucza, wszystkie miejsca na klucze wyłączone i nie podano "
-"klucza wolumenu.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Nie można dodać klucza, wszystkie miejsca na klucze wyłączone i nie podano klucza wolumenu."
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Dowolne hasło: "
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Nie udało się podstawić nowego klucza."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Nowe hasło dla klucza: "
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Numer klucza %d jest nieprawidłowy."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Klucz %d nie jest aktywny."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Nagłówek urządzenia zachodzi na obszar danych."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Ponowne szyfrowanie trwa. Nie można uaktywnić urządzenia."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Nie udało się uzyskać blokady ponownego szyfrowania."
 
-#: lib/setup.c:1798
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Odtwarzanie ponownego szyfrowania LUKS2 nie powiodło się."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Typ urządzenia nie został właściwie zainicjalizowany."
+
+#: lib/setup.c:4171
 #, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Klucz numer %d zmieniony.\n"
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Nie można użyć urządzenia %s, nazwa jest nieprawidłowa lub nadal w użyciu."
 
-#: lib/setup.c:1801
+#: lib/setup.c:4174
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Zastąpiono kluczem numer %d.\n"
+msgid "Device %s already exists."
+msgstr "Urządzenie %s już istnieje."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Podano niewłaściwy klucz wolumenu dla zwykłego urządzenia."
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Podano niewłaściwy hasz główny dla urządzenia VERITY."
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Nie udało się podstawić nowego klucza.\n"
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Wymagany podpis hasza głównego."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Klucz wolumenu nie pasuje do wolumenu.\n"
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Brak pęku kluczy w jądrze: wymagany do przekazania podpisu do jądra."
 
-#: lib/setup.c:1961
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Nie udało się załadować klucza do pęku kluczy w jądrze."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Urządzenie %s jest nadal w użyciu."
+
+#: lib/setup.c:4516
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Numer klucza %d jest nieprawidłowy.\n"
+msgid "Invalid device %s."
+msgstr "Błędne urządzenie %s."
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Bufor klucza wolumenu zbyt mały."
 
-#: lib/setup.c:1966
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Nie można odtworzyć klucza wolumenu dla zwykłego urządzenia."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Nie można odtworzyć hasza głównego dla urządzenia VERITY."
+
+#: lib/setup.c:4659
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Klucz %d nie jest używany.\n"
+msgid "This operation is not supported for %s crypt device."
+msgstr "Ta operacja nie jest obsługiwana dla urządzenia szyfrującego %s."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Operacja zrzutu nie jest obsługiwana dla tego rodzaju urządzenia."
+
+#: lib/setup.c:5190
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Urządzenie %s już istnieje.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Offset danych nie jest wielokrotnością liczby bajtów %u."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr "Podano niewłaściwy klucz wolumenu dla zwykłego urządzenia.\n"
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Nie można przekonwertować urządzenia %s, które jest nadal w użyciu."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
-msgstr "Podano niewłaściwy hasz główny dla urządzenia VERITY.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Nie udało się przypisać klucza %u jako nowego klucza wolumenu."
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Typ urządzenia nie został właściwie zainicjalizowany.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Nie udało się zainicjować domyślnych parametrów klucza LUKS2."
 
-#: lib/setup.c:2259
+#: lib/setup.c:5851
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Urządzenie %s jest nadal w użyciu.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Nie udało się przypisać klucza %d do skrótu."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Pęk kluczy w jądrze nie jest obsługiwany przez jądro."
 
-#: lib/setup.c:2268
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Błędne urządzenie %s.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Nie udało się odczytać hasła z pęku kluczy (błąd %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Nie udało się uzyskać globalnej blokady serializacji dostępu ciężkiego pamięciowo."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Nie można odczytać priorytetu procesu."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Nie można odblokować pamięci."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Nie udało się otworzyć pliku klucza."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Nie można odczytać pliku klucza z terminala."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Nie udało się wykonać stat na pliku klucza."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Nie można przemieścić się do żądanego położenia pliku klucza."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Brak pamięci podczas odczytu hasła."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Błąd podczas odczytu hasła."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Na wejściu nie ma nic do odczytu."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Funkcja nie jest dostępna w trybie FIPS.\n"
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Przekroczono maksymalny rozmiar pliku klucza."
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Bufor klucza wolumenu zbyt mały.\n"
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Nie można odczytać żądanej ilości danych."
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "Nie można odtworzyć klucza wolumenu dla zwykłego urządzenia.\n"
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Urządzenie %s nie istnieje lub dostęp jest zabroniony."
+
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Urządzenie %s nie jest zgodne."
 
-#: lib/setup.c:2310
+#: lib/utils_device.c:642
 #, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Ta operacja nie jest obsługiwana dla urządzenia szyfrującego %s.\n"
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Urządzenie %s jest zbyt małe. Wymagane przynajmniej %<PRIu64> bajtów."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr "Operacja zrzutu nie jest obsługiwana dla tego rodzaju urządzenia.\n"
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Nie można użyć urządzenia %s, które jest w użyciu (już podmapowane lub zamontowane)."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Nie można odczytać priorytetu procesu.\n"
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Nie można użyć urządzenia %s, brak uprawnień."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Nie można odblokować pamięci.\n"
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Nie można uzyskać informacji o urządzeniu %s."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Brak pamięci podczas odczytu hasła.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Nie można użyć urządzenia loopback w czasie działania jako nie-root."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Błąd podczas odczytu hasła z terminala.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Nie udało się podłączyć urządzenia loopback (wymagane urządzenie loop z flagą autoclear)."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Weryfikacja hasła: "
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Żądany offset jest poza rzeczywistym rozmiarem urządzenia %s."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Hasła nie zgadzają się.\n"
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Urządzenie %s ma zerowy rozmiar."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Nie można użyć offsetu, jeśli wejściem jest terminal.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Żądany czas docelowy PBKDF nie może być zerowy."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "Nie udało się otworzyć pliku klucza.\n"
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Nieznany typ PBKDF %s."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "Nie udało się wykonać stat na pliku klucza.\n"
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Żądany skrót %s nie jest obsługiwany."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr "Nie można przemieścić się do żądanego położenia pliku klucza.\n"
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Żądany typ PBKDF nie jest obsługiwany dla LUKS1."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Błąd podczas odczytu hasła.\n"
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Wartości maksymalnej pamięci lub liczby wątków PBKDF nie mogą być ustawione dla PBKDF2."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Przekroczono maksymalny rozmiar pliku klucza.\n"
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Wymuszona liczba iteracji jest zbyt mała dla %s (minimum to %u)."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "Nie można odczytać żądanej ilości danych.\n"
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Wymuszony koszt pamięciowy jest zbyt mały dla %s (minimum to %u kB)."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/utils_pbkdf.c:155
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Urządzenie %s nie istnieje lub dostęp jest zabroniony.\n"
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Żądany maksymalny koszt pamięciowy PBKDF jest zbyt duży (maksimum to %d kB)."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr "Nie można użyć urządzenia loopback w czasie działania jako nie-root.\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Żądana maksymalna pamięć PBKDF nie może być zerowa."
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Nie znaleziono wolnego urządzenia loopback.\n"
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Żądana liczba wątków PBKDF nie może być zerowa."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
-"Nie udało się podłączyć urządzenia loopback (wymagane urządzenie loop z "
-"flagą autoclear).\n"
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "W trybie FIPS obsługiwana jest tylko PBKDF2."
 
-#: lib/utils_device.c:484
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Test wydajności PBKDF jest wyłączony, ale nie ustawiono liczby iteracji."
+
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
-msgstr ""
-"Nie można użyć urządzenia %s, które jest w użyciu (już podmapowane lub "
-"zamontowane).\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Niekompatybilne opcje PBKDF2 (przy użyciu algorytmu skrótu %s)."
 
-#: lib/utils_device.c:488
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Niekompatybilne opcje PBKDF."
+
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Nie można uzyskać informacji o urządzeniu %s.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Blokowanie nie powiodło się. Ścieżka blokady %s/%s jest nieużywalna (brak lub nie jest katalogiem)."
 
-#: lib/utils_device.c:494
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr "Żądany offset jest poza rzeczywistym rozmiarem urządzenia %s.\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "UWAGA: brak katalogu blokad %s/%s!\n"
 
-#: lib/utils_device.c:502
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Urządzenie %s ma zerowy rozmiar.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Blokowanie przerwane. Ścieżka blokady %s/%s jest nieużywalna (%s nie jest katalogiem)."
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Nie można przemieścić się we właściwe położenie urządzenia."
 
-#: lib/utils_device.c:513
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Urządzenie %s jest zbyt małe.\n"
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Błąd wymazywania urządzenia, offset %<PRIu64>."
 
-#: lib/luks1/keyencryption.c:37
+#: lib/luks1/keyencryption.c:39
 #, c-format
 msgid ""
 "Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 "Nie udało się ustawić odwzorowania klucza dm-crypt dla urządzenia %s.\n"
-"Proszę sprawdzić, czy jądro obsługuje szyfr %s (więcej informacji w "
-"syslogu).\n"
+"Proszę sprawdzić, czy jądro obsługuje szyfr %s (więcej informacji w syslogu)."
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "Rozmiar klucza w trybie XTS musi wynosić 256 lub 512 bitów.\n"
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Rozmiar klucza w trybie XTS musi wynosić 256 lub 512 bitów."
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "Określenie szyfru powinno być w formacie [szyfr]-[tryb]-[iv]."
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
 #, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Nie można zapisać na urządzenie %s, brak uprawnień.\n"
+msgid "Cannot write to device %s, permission denied."
+msgstr "Nie można zapisać na urządzenie %s, brak uprawnień."
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr ""
-"Nie udało się otworzyć urządzenia do tymczasowego przechowywania kluczy.\n"
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Nie udało się otworzyć urządzenia do tymczasowego przechowywania kluczy."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr ""
-"Nie udało się uzyskać dostępu do urządzenia do tymczasowego przechowywania "
-"kluczy.\n"
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Nie udało się uzyskać dostępu do urządzenia do tymczasowego przechowywania kluczy."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Błąd we/wy podczas szyfrowania klucza."
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Błąd we/wy podczas szyfrowania klucza.\n"
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Nie można otworzyć urządzenia %s."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "Błąd we/wy podczas odszyfrowywania klucza.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Błąd we/wy podczas odszyfrowywania klucza."
 
-#: lib/luks1/keymanage.c:90
+#: lib/luks1/keymanage.c:110
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr ""
-"Urządzenie %s jest zbyt małe (LUKS wymaga przynajmniej %<PRIu64> bajtów).\n"
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Urządzenie %s jest zbyt małe (LUKS1 wymaga przynajmniej %<PRIu64> bajtów)."
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "Numer klucza LUKS %u jest nieprawidłowy."
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "Urządzenie %s nie jest prawidłowym urządzeniem LUKS.\n"
+msgid "Device %s is not a valid LUKS device."
+msgstr "Urządzenie %s nie jest prawidłowym urządzeniem LUKS."
 
-#: lib/luks1/keymanage.c:198
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Żądany plik kopii zapasowej nagłówka %s już istnieje.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Żądany plik kopii zapasowej nagłówka %s już istnieje."
 
-#: lib/luks1/keymanage.c:200
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Nie można utworzyć pliku kopii zapasowej nagłówka %s.\n"
+msgid "Cannot create header backup file %s."
+msgstr "Nie można utworzyć pliku kopii zapasowej nagłówka %s."
 
-#: lib/luks1/keymanage.c:205
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Nie można zapisać pliku kopii zapasowej nagłówka %s.\n"
+msgid "Cannot write header backup file %s."
+msgstr "Nie można zapisać pliku kopii zapasowej nagłówka %s."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Plik kopii zapasowej nie zawiera prawidłowego nagłówka LUKS.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Plik kopii zapasowej nie zawiera prawidłowego nagłówka LUKS."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Nie można otworzyć pliku kopii zapasowej nagłówka %s.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Nie można otworzyć pliku kopii zapasowej nagłówka %s."
 
-#: lib/luks1/keymanage.c:258
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Nie można odczytać pliku kopii zapasowej nagłówka %s.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Nie można odczytać pliku kopii zapasowej nagłówka %s."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Offset danych lub rozmiar klucza różnią się między urządzeniem a kopią "
-"zapasową; przywrócenie nie powiodło się.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Offset danych lub rozmiar klucza różnią się między urządzeniem a kopią zapasową; przywrócenie nie powiodło się."
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Urządzenie %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"nie zawiera nagłówka LUKS. Nadpisanie nagłówka może zniszczyć dane na tym "
-"urządzeniu."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "nie zawiera nagłówka LUKS. Nadpisanie nagłówka może zniszczyć dane na tym urządzeniu."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"już zawiera nagłówek LUKS. Nadpisanie nagłówka zniszczy istniejące klucze."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "już zawiera nagłówek LUKS. Nadpisanie nagłówka zniszczy istniejące klucze."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
@@ -538,568 +865,1461 @@ msgstr ""
 "\n"
 "UWAGA: nagłówek prawdziwego urządzenia ma inny UUID niż kopia zapasowa!"
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Nie można otworzyć urządzenia %s.\n"
-
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr "Niestandardowy rozmiar klucza, wymagana ręczna naprawa.\n"
-
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr "Niestandardowe wyrównanie kluczy, wymagana ręczna naprawa.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Niestandardowy rozmiar klucza, wymagana ręczna naprawa."
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Naprawianie kluczy.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Niestandardowe wyrównanie kluczy, wymagana ręczna naprawa."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Naprawa nie powiodła się."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Naprawianie kluczy."
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Klucz %i: naprawiono offset (%u -> %u).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Klucz %i: naprawiono offset (%u -> %u)."
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Klucz %i: naprawiono pasy (%u -> %u).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Klucz %i: naprawiono pasy (%u -> %u)."
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Klucz %i: błędna sygnatura partycji.\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Klucz %i: błędna sygnatura partycji."
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Klucz %i: zarodek wyczyszczony.\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Klucz %i: zarodek wymazany."
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "Zapis nagłówka LUKS na dysk.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Zapis nagłówka LUKS na dysk."
 
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Nieobsługiwana wersja LUKS %d.\n"
-
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "Żądany skrót LUKS %s nie jest obsługiwany.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Naprawa nie powiodła się."
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "Numer klucza LUKS %u jest nieprawidłowy.\n"
-
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "W nagłówku LUKS nie wykryto żadnych znanych problemów.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Żądany skrót LUKS %s nie jest obsługiwany."
 
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Błąd podczas uaktualniania nagłówka LUKS na urządzeniu %s.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "W nagłówku LUKS nie wykryto żadnych znanych problemów."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Błęd podczas ponownego odczytu nagłówka LUKS po uaktualnieniu na urządzeniu "
-"%s.\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Błąd podczas uaktualniania nagłówka LUKS na urządzeniu %s."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keymanage.c:668
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"Offset danych dla osobnego nagłówka LUKS musi wynosić 0 lub więcej niż "
-"rozmiar nagłówka (sektorów: %d).\n"
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Błęd podczas ponownego odczytu nagłówka LUKS po uaktualnieniu na urządzeniu %s."
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Podano zły format LUKS UUID.\n"
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Offset danych dla nagłówka LUKS musi wynosić 0 lub więcej niż rozmiar nagłówka."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-"Nie można utworzyć nagłówka LUKS: odczyt losowego zarodka nie powiódł się.\n"
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Podano zły format LUKS UUID."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Niekompatybilne opcje PBKDF2 (przy użyciu algorytmu skrótu %s).\n"
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Nie można utworzyć nagłówka LUKS: odczyt losowego zarodka nie powiódł się."
 
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Nie można utworzyć nagłówka LUKS: uzyskanie skrótu nagłówka nie powiodło się "
-"(przy użyciu algorytmu %s).\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Nie można utworzyć nagłówka LUKS: uzyskanie skrótu nagłówka nie powiodło się (przy użyciu algorytmu %s)."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "Klucz numer %d jest aktywny, należy go najpierw wyczyścić.\n"
+msgid "Key slot %d active, purge first."
+msgstr "Klucz numer %d jest aktywny, należy go najpierw wyczyścić."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr "Klucz %d zawiera zbyt mało pasów. Zmieniony nagłówek?\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Klucz %d zawiera zbyt mało pasów. Zmieniony nagłówek?"
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:990
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Klucz numer %d odblokowany.\n"
-
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Dla tego hasła nie ma dostępnego klucza.\n"
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Nie można otworzyć klucza (przy użyciu skrótu %s)."
 
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr "Numer klucza %d jest błędny, proszę wybrać numer od 0 do %d.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Numer klucza %d jest błędny, proszę wybrać numer od 0 do %d."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Nie można wyczyścić urządzenia %s.\n"
+msgid "Cannot wipe device %s."
+msgstr "Nie można wymazać urządzenia %s."
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr "Wykryto jeszcze nie obsługiwany plik klucza szyfrowany GPG.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Wykryto jeszcze nie obsługiwany plik klucza szyfrowany GPG."
 
 #: lib/loopaes/loopaes.c:147
 msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
 msgstr "Proszę użyć gpg --decrypt <PLIK-KLUCZA> | cryptsetup --keyfile=- ...\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Wykryto niekompatybilny plik klucza loop-AES.\n"
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Wykryto niekompatybilny plik klucza loop-AES."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr "Jądro nie obsługuje odwzorowań zgodnych z loop-AES.\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Jądro nie obsługuje odwzorowań zgodnych z loop-AES."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Błąd odczytu pliku klucza %s.\n"
+msgid "Error reading keyfile %s."
+msgstr "Błąd odczytu pliku klucza %s."
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/tcrypt/tcrypt.c:554
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr "Przekroczono maksymalną długość hasła TCRYPT (%d).\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Przekroczono maksymalną długość hasła TCRYPT (%zu)."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr "Algorytm skrótu PBKDF2 %s nie jest dostępny, pominięto.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "Algorytm skrótu PBKDF2 %s nie jest dostępny, pominięto."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr "Wymagany interfejs kryptograficzny jądra nie jest dostępny.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Wymagany interfejs kryptograficzny jądra nie jest dostępny."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr "Proszę upewnić się, że moduł jądra algif_skcipher został załadowany.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Proszę upewnić się, że moduł jądra algif_skcipher został załadowany."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "Aktywacja nie jest obsługiwana dla rozmiaru sektora %d.\n"
+msgid "Activation is not supported for %d sector size."
+msgstr "Uaktywnianie nie jest obsługiwane dla rozmiaru sektora %d."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr "Jądro nie obsługuje aktywacji dla tego starego trybu TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Jądro nie obsługuje uaktywniania dla tego starego trybu TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "Włączanie szyfrowania systemu TCRYPT dla partycji %s.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Włączanie szyfrowania systemu TCRYPT dla partycji %s."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr "Jądro nie obsługuje odwzorowań zgodnych z TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Jądro nie obsługuje odwzorowań zgodnych z TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Ta funkcja nie jest obsługiwana bez załadowanego nagłówka TCRYPT."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "Przy analizie obsługiwanego Głównego Klucza Wolumenu napotkano nieoczekiwany wpis metadanych typu '%u'."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Przy analizie Głównego Klucza Wolumenu napotkano błędny ciąg znaków."
+
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Urządzenie Verity %s nie używa nagłówka na dysku.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Przy analizie obsługiwanego Głównego Klucza Wolumenu napotkano nieoczekiwany ciąg znaków ('%s')."
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:399
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Urządzenie %s nie jest prawidłowym urządzeniem VERITY.\n"
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "Przy analizie obsługiwanego Głównego Klucza Wolumenu napotkano nieoczekiwaną wartość wpisu metadanych '%u'."
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:479
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "Nieobsługiwana wersja VERITY %d.\n"
+msgid "Failed to read BITLK signature from %s."
+msgstr "Nie udało się odczytać sygnatury BITLK z %s."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "BITLK w wersji 1 nie jest obecnie obsługiwany."
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "Uszkodzony nagłówek VERITY.\n"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Błędna lub nieznana sygnatura rozruchowa urządzenia BITLK."
 
-#: lib/verity/verity.c:166
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Błędna lub nieznana sygnatura urządzenia BITLK."
+
+#: lib/bitlk/bitlk.c:510
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Podano zły format UUID-a VERITY na urządzeniu %s.\n"
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Nieobsługiwany rozmiar sektora %<PRIu16>."
 
-#: lib/verity/verity.c:196
+#: lib/bitlk/bitlk.c:518
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Błąd podczas uaktualniania nagłówka VERITY na urządzeniu %s.\n"
+msgid "Failed to read BITLK header from %s."
+msgstr "Nie udało się odczytać nagłówka BITLK z %s."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "Jądro nie obsługuje odwzorowań dm-verity.\n"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Nie udało się odczytać metadanych BITLK FVE z %s."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr "Urządzenie VERITY wykryło uszkodzenie po uaktywnieniu.\n"
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Nieznany lub nieobsługiwany rodzaj szyfrowania."
 
-#: lib/verity/verity_hash.c:59
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "Nie wyzerowane miejsce zapasowe na pozycji %<PRIu64>.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Nie udało się odczytać wpisów metadanych BITLK z %s."
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Przepełnienie offsetu urządzenia.\n"
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Ta operacja nie jest obsługiwana."
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "Weryfikacja nie powiodła się na pozycji %<PRIu64>.\n"
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Błędny rozmiar klucza."
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Błędne parametry rozmiaru dla urządzenia VERITY.\n"
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "To urządzenie BITLK jest w nieobsługiwanym stanie i może być uaktywnione."
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Za dużo poziomów drzewa dla wolumenu VERITY.\n"
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "Urządzenia BITLK o typie '%s' nie mogą być uaktywnione."
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "Weryfikacja obszaru danych nie powiodła się.\n"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Uaktywnianie częściowo odszyfrowanych urządzeń BITLK nie jest obsługiwane."
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "Weryfikacja głównego hasza nie powiodła się.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Nie można uaktywnić urządzenia, brak obsługi BITLK IV w module dm-crypt jądra."
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr "Błąd wejścia/wyjścia podczas tworzenia obszaru haszy.\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Nie można uaktywnić urządzenia, brak obsługi dyfuzora BITLK Elephant w module dm-crypt jądra."
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "Tworzenie obszaru haszy nie powiodło się.\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Urządzenie Verity %s nie używa nagłówka na dysku."
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity.c:90
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-"UWAGA: Jądro nie może uaktywnić urządzenia, jeśli rozmiar bloku danych "
-"przekracza rozmiar strony (%u).\n"
+msgid "Device %s is not a valid VERITY device."
+msgstr "Urządzenie %s nie jest prawidłowym urządzeniem VERITY."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr ""
-"Nie można wykonać weryfikacji hasła, jeśli wejściem nie jest terminal.\n"
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Nieobsługiwana wersja VERITY %d."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Nie wykryto znanego wzorca określającego szyfr.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Uszkodzony nagłówek VERITY."
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
-msgstr ""
-"UWAGA: Parametr --hash jest ignorowany w trybie zwykłym z podanym plikiem "
-"klucza.\n"
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Podano zły format UUID-a VERITY na urządzeniu %s."
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
-msgstr ""
-"UWAGA: Opcja --keyfile-size jest ignorowana, rozmiar odczytu jest taki sam, "
-"jak rozmiar klucza szyfrującego.\n"
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Błąd podczas uaktualniania nagłówka VERITY na urządzeniu %s."
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "Wymagana jest opcja --key-file.\n"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "Weryfikacja podpisu hasza głównego nie jest obsługiwana."
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Nie wykryto nagłówka urządzenia z tym hasłem.\n"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Błędów nie można naprawić z urządzeniem FEC."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
-msgstr ""
-"Zrzut nagłówka z kluczem wolumenu jest informacją wrażliwą,\n"
-"pozwalającą na dostęp do zaszyfrowanej partycji bez hasła.\n"
-"Zrzut ten powinien być zawsze zapisywany w postaci zaszyfrowanej\n"
-"w bezpiecznym miejscu."
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Znaleziono %u błędów możliwych do naprawienia z urządzeniem FEC."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Wynik testu wydajności nie jest wiarygodny.\n"
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Jądro nie obsługuje odwzorowań dm-verity."
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr "# Testy są przybliżone tylko z użyciem pamięci (bez we/wy na dysk).\n"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Jądro nie obsługuje opcji podpisu dm-verity."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "#  Algorytm | Klucz | Szyfrowanie | Odszyfrowywanie\n"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Urządzenie VERITY wykryło uszkodzenie po uaktywnieniu."
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Szyfr %s nie jest dostępny.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Nie wyzerowane miejsce zapasowe na pozycji %<PRIu64>."
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "N/D"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Przepełnienie offsetu urządzenia."
 
-#: src/cryptsetup.c:639
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Nie można odczytać pliku klucza %s.\n"
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Weryfikacja nie powiodła się na pozycji %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Błędne parametry rozmiaru dla urządzenia VERITY."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Przepełnienie obszaru skrótu."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Weryfikacja obszaru danych nie powiodła się."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Weryfikacja głównego hasza nie powiodła się."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Błąd wejścia/wyjścia podczas tworzenia obszaru haszy."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Tworzenie obszaru haszy nie powiodło się."
 
-#: src/cryptsetup.c:643
+#: lib/verity/verity_hash.c:433
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Nie można odczytać %d bajtów z pliku klucza %s.\n"
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "UWAGA: Jądro nie może uaktywnić urządzenia, jeśli rozmiar bloku danych przekracza rozmiar strony (%u)."
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Naprawdę próbować naprawić nagłówek urządzenia LUKS?"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Nie udało się przydzielić kontekstu RS."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Nie udało się przydzielić bufora."
+
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "To nieodwołalnie nadpisze dane na %s."
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Nie udało się odczytać bloku RS %<PRIu64> bajt %d."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "błąd przydzielania pamięci w action_luksFormat"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Nie udało się odczytać parzystości dla bloku RS %<PRIu64>."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity_fec.c:177
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Nie można użyć %s jako nagłówka na dysku.\n"
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Nie udało się naprawić parzystości dla bloku %<PRIu64>."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
-"Offset zmniejszonych danych jest dozwolony tylko dla osobnego nagłówka "
-"LUKS.\n"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Nie udało się zapisać parzystości dla bloku RS %<PRIu64>."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Dla FEC rozmiary bloków muszą się zgadzać."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Błędna liczba bajtów parzystości."
+
+#: lib/verity/verity_fec.c:265
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "klucz %d wybrany do usunięcia.\n"
+msgid "Failed to determine size for device %s."
+msgstr "Nie udało się określić rozmiaru urządzenia %s."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Jądro nie obsługuje odwzorowań dm-integrity."
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Jądro nie obsługuje stałego wyrównania metadanych dm-integrity."
 
-#: src/cryptsetup.c:884
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Klucz %d nie jest aktywny. Nie można wyczyścić.\n"
+msgid "Failed to acquire write lock on device %s."
+msgstr "Nie udało się uzyskać blokady dla zapisu na urządzeniu %s."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Wykryto próbę jednoczesnego uaktualnienia metadanych LUKS2. Przerywanie operacji."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
 msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
-"To jest ostatni klucz. Urządzenie stanie się bezużyteczne po usunięciu tego "
-"klucza."
-
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Dowolne pozostałe hasło: "
+"Urządzenie zawiera niejednoznaczne sygnatury, nie można automatycznie odtworzyć LUKS2.\n"
+"W celu odtworzenia należy uruchomić \"cryptsetup repair\"."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Hasło do usunięcia: "
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Żądany offset danych jest zbyt mały."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Dowolne istniejące hasło: "
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "UWAGA: obszar kluczy (%<PRIu64> bajtów) bardzo mały, dostępna liczba kluczy LUKS2 jest bardzo ograniczona.\n"
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Hasło, które ma być zmienione: "
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Nie udało się uzyskać blokady do odczytu na urządzeniu %s."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Nowe hasło: "
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Wykryto zabronione wymagania LUKS2 w kopii zapasowej %s."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr ""
-"Dla operacji isLuks obsługiwany jest tylko jeden argument będący "
-"urządzeniem.\n"
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Offset danych różni się między urządzeniem a kopią zapasową; przywrócenie nie powiodło się."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Wymagana jest opcja --header-backup-file.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Nagłówek binarny z rozmiarem obszarów kluczy różni się między urządzeniem a kopią zapasową; przywrócenie nie powiodło się."
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:1221
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Nie rozpoznany typ urządzenia metadanych %s.\n"
+msgid "Device %s %s%s%s%s"
+msgstr "Urządzenie %s %s%s%s%s"
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
-msgstr "Polecenie wymaga urządzenia i nazwy odwzorowywanej jako argumentów.\n"
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "nie zawiera nagłówka LUKS2. Nadpisanie nagłówka może zniszczyć dane na tym urządzeniu."
 
-#: src/cryptsetup.c:1326
-#, c-format
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "już zawiera nagłówek LUKS2. Nadpisanie nagłówka zniszczy istniejące klucze."
+
+#: lib/luks2/luks2_json_metadata.c:1225
 msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"Ta operacja usunię wszystkie klucze na urządzeniu %s.\n"
-"Urządzenie po tej operacji stanie się bezużyteczne."
+"\n"
+"UWAGA: wykryto nieznane wymagania LUKS2 w nagłówku prawdziwego urządzenia!\n"
+"Nadpisanie nagłówka kopią zapasową może uszkodzić dane na tym urządzeniu!"
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<uządzenie> [--type <typ>] [<nazwa>]"
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"UWAGA: wykryto nie zakończone ponowne szyfrowanie offline na urządzeniu!\n"
+"Nadpisanie nagłówka kopią zapasową może uszkodzić dane."
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "otwarcie urządzenia jako odwzorowania <nazwa>"
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Zignorowano nieznaną flagę %s."
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<nazwa>"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Brak klucza dla segmentu dm-crypt %u"
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "zamknięcie urządzenia (usunięcie odwzorowania)"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Nie udało się ustawić segmentu dm-crypt."
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "zmiana rozmiaru aktywnego urządzenia"
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Nie udało się ustawić segmentu dm-linear."
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "pokazanie stanu urządzenia"
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Nieobsługiwana konfiguracja integralności urządzenia."
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "test szybkości szyfru"
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Podobne szyfrowanie trwa. Nie można dezaktywować urządzenia."
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<urządzenie>"
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Nie udało się zastąpić wstrzymanego urządzenia %s celem dm-error."
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr "próba naprawy metadanych na dysku"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Nie udało się odczytać wymagań LUKS2."
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
-msgstr "usunięcie wszystkich kluczy (usunięcie klucza szyfrującego)"
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Wykryto nie spełnione wymagania LUKS2."
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<urządzenie> [<nowy plik klucza>]"
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Operacja niezgodna z urządzeniem oznaczonym do ponownego szyfrowania starym szyfrem. Przerwano."
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "sformatowanie urządzenia LUKS"
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Operacja niezgodna z urządzeniem oznaczonym do ponownego szyfrowania LUKS2. Przerwano."
 
-#: src/cryptsetup.c:1368
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Za mało dostępnej pamięci, aby otworzyć klucz."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Nie udało się otworzyć klucza."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Nie można użyć szyfru %s-%s do szyfrowania kluczy."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Brak miejsca na nowy klucz."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Nie można sprawdzić stanu urządzenia mającego UUID: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Nie można przekonwertować nagłówka z dodatkowymi metadanymi LUKSMETA."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Nie można przenieść obszaru kluczy. Brak miejsca."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Nie można przenieść obszaru kluczy. Obszar kluczy LUKS2 zbyt mały."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Nie można przenieść obszaru kluczy."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Nie można przekonwertować do formatu LUKS1 - domyślny rozmiar sektora szyfrowania segmentu nie wynosi 512 bajtów."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Nie można przekonwertować formatu LUKS1 - skróty kluczy nie są zgodne z LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Nie można przekonwertować formatu LUKS1 - urządzenie używa szyfru %s z obudowanym kluczem."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Nie można przekonwertować do formatu LUKS1 - nagłówek LUKS2 zawiera %u token(ów)."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Nie można przekonwertować do formatu LUKS1 - klucz %u jest w błędnym stanie."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Nie można przekonwertować do formatu LUKS1 - klucz %u (powyzej maksimum) jest nadal aktywny."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Nie można przekonwertować do formatu LUKS1 - klucz %u nie jest zgodny z LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Rozmiar strefy hotzone musi być wielokrotnością wyliczonego wyrównania strefy (bajtów: %zu)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Rozmiar urządzenia musi być wielokrotnością wyliczonego wyrównania strefy (bajtów: %zu)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Nieobsługiwany tryb odporności %s"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Nie udało się zainicjować obudowania przestrzeni starego segmentu."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Nie udało się zainicjować obudowania przestrzeni nowego segmentu."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Nie udało się odczytać sum kontrolnych dla aktualnej strefy hotzone."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Nie udało się odczytać obszaru hotzone zaczynającego się od %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Nie udało się odszyfrować sektora %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Nie udało się odtworzyć sektora %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Rozmiary urządzenia źródłowego i docelowego różnią się. Źródłowe %<PRIu64>, docelowe: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Nie udało się uaktywnić urządzenia hotzone %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Nie udało się uaktywnić urządzenia nakładkowego %s z aktualną tablicą źródła."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Nie udało się załadować nowego odwzorowania dla urządzenia %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Nie udało się odświeżyć stosu urządzenia ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Nie udało się ustawić nowego rozmiaru obszaru kluczy."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Przesunięcie danych nie jest wyrównane do żądanego rozmiaru sektora szyfrowania (bajtów: %<PRIu32>)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Urzędzenie danych nie jest wyrównane do żądanego rozmiaru sektora szyfrowania (bajtów: %<PRIu32>)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Przesunięcie danych (sektorów: %<PRIu64>) jest mniejsze niż przyszły offset danych (sektorów: %<PRIu64>)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Nie udało się otworzyć %s w trybie wyłączności (już odwzorowano lub zamontowano)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Urządzenie nie jest oznaczone do ponownego szyfrowania LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Nie udało się załadować kontekstu ponownego szyfrowania LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Nie udało się pobrać stanu ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Urządzenie nie jest w trakcie ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Proces ponownego szyfrowania już trwa."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Nie udało się uzyskać blokady dla ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "Nie można kontynuować ponownego szyfrowania. Należy najpierw uruchomić odtworzenie ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Rozmiar urządzenia aktywnego oraz żądany rozmiar ponownego szyfrowania różnią się."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "W parametrach ponownego szyfrowania zażądano niedozwolonego rozmiaru urządzenia."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Ponowne szyfrowanie trwa. Nie można wykonać odzyskiwania."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "Ponowne szyfrowanie LUKS2 jest już zainicjowane w metadanych."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Nie udało się zainicjować ponownego szyfrowania LUKS2 w metadanych."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Nie udało się ustawić segmentów urządzeń dla następnej strefy hotzone ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Nie udało się zapisać metadanych odporności ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Odszyfrowanie nie powiodło się."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Nie udało się zapisać obszaru hotzone zaczynającego się od %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Nie udało się zsynchronizować danych."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Nie udało się uaktualnić metadanych po zakończeniu aktualnej strefy hotzone ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Nie udało się zapisać metadanych LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Nie udało wymazać danych segmentu zapasowego."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Nie udało się wyłączyć flagi wymagania ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Błąd krytyczny podczas ponownego szyfrowania fragmentu zaczynającego się od %<PRIu64> o długości w sektorach %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Proszę nie wznawiać urządzenia dopóki nie zostanie zastąpione celem błędnym ręcznie."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "Nie można kontynuować ponownego szyfrowania. Nieoczekiwany stan ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Brak lub błędny kontekst ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Nie udało się zainicjować stosu urządzenia ponownego szyfrowania."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Nie udało się uaktualnić kontekstu ponownego szyfrowania."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Brak wolnego miejsca na token."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Nie udało się utworzyć wbudowanego tokenu %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Nie można wykonać weryfikacji hasła, jeśli wejściem nie jest terminal."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Parametry szyfrowania kluczy mogą być ustawione tylko dla urządzeń LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Nie wykryto znanego wzorca określającego szyfr."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "UWAGA: Parametr --hash jest ignorowany w trybie zwykłym z podanym plikiem klucza.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "UWAGA: Opcja --keyfile-size jest ignorowana, rozmiar odczytu jest taki sam, jak rozmiar klucza szyfrującego.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Wykryto sygnatury urządzeń na %s. Dalsze operacje mogą uszkodzić istniejące dane."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Operacja przerwana.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Wymagana jest opcja --key-file."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Proszę wprowadzić PIM VeraCrypt: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Błędna wartość PIM: błąd składni."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Błędna wartość PIM: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Błędna wartość PIM: poza zakresem."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Nie wykryto nagłówka urządzenia z tym hasłem."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Urządzenie %s nie jest prawidłowym urządzeniem BITLK."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Zrzut nagłówka z kluczem wolumenu jest informacją wrażliwą,\n"
+"pozwalającą na dostęp do zaszyfrowanej partycji bez hasła.\n"
+"Zrzut ten powinien być zawsze zapisywany w postaci zaszyfrowanej\n"
+"w bezpiecznym miejscu."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Urządzenie %s jest nadal aktywne i zaplanowane do odroczonego usunięcia.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Zmiana rozmiaru aktywnego urządzenia wymaga klucza wolumenu w pęku, ale ustawiono opcję --disable-keyring."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Test szybkości przerwany."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     N/D\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u iteracji/sekundę dla klucza %zu-bitowego\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s N/D\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u iteracji, pamięć: %5u, równoległe wątki (CPU): %1u dla klucza %zu-bitowego (żądany czas %u ms)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Wynik testu wydajności nie jest wiarygodny."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Testy są przybliżone tylko z użyciem pamięci (bez we/wy na dysk).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s  Algorytm |     Klucz |     Szyfrowanie | Odszyfrowywanie\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Szyfr %s (rozmiar klucza w bitach: %i) nie jest dostępny."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#      Algorytm |     Klucz |     Szyfrowanie | Odszyfrowywanie\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/D"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Wygląda na to, że urządzenie nie wymaga odtwarzania ponownego szyfrowania.\n"
+"Czy mimo to kontynuować?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Naprawdę kontynuować odtwarzanie ponownego szyfrowania LUKS2?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Hasło do odtwarzania ponownego szyfrowania: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Naprawdę próbować naprawić nagłówek urządzenia LUKS?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Czyszczenie urządzenia w celu zainicjowania sumy kontrolnej integralności.\n"
+"Można przerwać ten proces wciskając Ctrl+C (reszta nie wymazanego urządzenia będzie zawierać błędną sumę kontrolną).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Nie można dezaktywować urządzenia tymczasowego %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Opcja integralności może być używana tylko dla formatu LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Nieobsługiwane opcje rozmiaru metadanych LUKS2."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Nie można utworzyć pliku nagłówka %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Nie wykryto znanego wzorca określającego integralność."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Nie można użyć %s jako nagłówka na dysku."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "To nieodwołalnie nadpisze dane na %s."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Nie udało się ustawić parametrów PBKDF."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Offset zmniejszonych danych jest dozwolony tylko dla osobnego nagłówka LUKS."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Nie można określić rozmiaru klucza wolumenu dla LUKS bez kluczy, proszę użyć opcji --key-size."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Urządzenie uaktywnione, ale nie można uczynić flag trwałymi."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Klucz %d jest wybrany do usunięcia."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "To jest ostatni klucz. Urządzenie stanie się bezużyteczne po usunięciu tego klucza."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Dowolne pozostałe hasło: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Operacja przerwana, klucz NIE został wymazany.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Hasło do usunięcia: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Nowe hasło dla klucza: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Dowolne istniejące hasło: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Hasło, które ma być zmienione: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Nowe hasło: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Hasło dla klucza do konwersji: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Dla operacji isLuks obsługiwany jest tylko jeden argument będący urządzeniem."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Zrzut nagłówka z kluczem wolumenu jest informacją wrażliwą,\n"
+"pozwalającą na dostęp do zaszyfrowanej partycji bez hasła.\n"
+"Zrzut ten powinien być zawsze zapisywany w postaci zaszyfrowanej\n"
+"w bezpiecznym miejscu."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Miejsce %d nie zawiera niepowiązanego klucza."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Zrzut nagłówka z niepowiązanym kluczem jest informacją wrażliwą.\n"
+"Zrzut ten powinien być zawsze zapisywany w postaci zaszyfrowanej\n"
+"w bezpiecznym miejscu."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Wymagana jest opcja --header-backup-file."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s nie jest urządzeniem zarządzanym przez cryptsetup."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Odświeżanie nie jest obsługiwane dla typu urządzenia %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Nie rozpoznany typ urządzenia metadanych %s."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Polecenie wymaga urządzenia i nazwy odwzorowywanej jako argumentów."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Ta operacja usunię wszystkie klucze na urządzeniu %s.\n"
+"Urządzenie po tej operacji stanie się bezużyteczne."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Operacja przerwana, klucze NIE zostały wymazane.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Błędny typ LUKS, obsługiwane są tylko luks1 i luks2."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Urządzenie już ma typ %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Ta operacja przekonwertuje %s do formatu %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Operacja przerwana, urządzenie NIE zostało skonwertowane.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Brak opcji --priority, --label lub --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Token %d jest błędny."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Token %d jest w użyciu."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Nie udało się dodać tokenu %d do pęku kluczy luks2."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Nie udało się przypisać tokenu %d do klucza %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Token %d nie jest w użyciu."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Nie udało się zaimportować tokenu z pliku."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Nie udało się pobrać tokenu %d do eksportu."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "Parametr --key-description jest wymagany do akcji dodania tokenu."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Akcja wymaga określonego tokenu. Należy użyć parametru --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Błędna operacja na tokenie %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Wykryto aktywne urządzenie dm '%s' dla urządzenia danych %s.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Urządzenie %s nie jest urządzeniem blokowym.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Nie udało się wykryć właścicieli urządzenia %s."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Nie udało się zdecydować, czy urządzenie %s jest uaktywnione, czy nie.\n"
+"Czy na pewno kontynuować ponowne szyfrowanie w trybie offline?\n"
+"Może to prowadzić do uszkodzenia danych, jeśli urządzenie jest aktywne.\n"
+"Aby uruchomić ponowne szyfrowanie w trybie online, należy użyć parametru\n"
+"--active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Błędny typ urządzenia LUKS."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Szyfrowanie bez odłączonego nagłówka (--header) jest niemożliwe bez ograniczenia rozmiaru urządzenia danych (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Żądany offset danych musi być mniejszy lub równy połowie parametru --reduce-device-size."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Modyfikowanie wartości --reduce-device-size do dwukrotności parametru --offset %<PRIu64> (w sektorach).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Szyfrowanie jest obsługiwane tylko w formacie LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "Wykrytu urządzenie LUKS na %s. Czy zaszyfrować to urządzenie LUKS jeszcze raz?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Plik nagłówka %s już istnieje. Przerwano."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Nie można utworzyć pliku tymczasowego nagłówka %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s jest teraz aktywne i gotowe do szyfrowania w locie.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Za mało wolnych kluczy do ponownego szyfrowania."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Rozmiaru klucza można użyć tylko z --key-slot albo przy dokładnie jednym aktywnym kluczu."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Hasło dla klucza %d: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Hasło dla klucza %u: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Polecenie wymaga urządzenia jako argumentu."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "Obecnie obsługiwany jest tylko format LUKS2. Dla LUKS1 proszę użyć narzędzia cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Tradycyjne ponowne szyfrowanie offline juz trwa. Proszę użyć narzędzia cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Ponowne szyfrowanie urządzenia z profilem integralności nie jest obsługiwane."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "Ponowne szyfrowanie LUKS2 jest już zainicjowane. Przerywanie operacji."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "Urządzenie LUKS2 nie jest w trakcie ponownego szyfrowania."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<uządzenie> [--type <typ>] [<nazwa>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "otwarcie urządzenia jako <nazwa>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<nazwa>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "zamknięcie urządzenia (usunięcie odwzorowania)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "zmiana rozmiaru aktywnego urządzenia"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "pokazanie stanu urządzenia"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <szyfr>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "test szybkości szyfru"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<urządzenie>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "próba naprawy metadanych na dysku"
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "ponowne szyfrowanie urządzenia LUKS2"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "usunięcie wszystkich kluczy (usunięcie klucza szyfrującego)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "przekonwertowanie formatu LUKS z/do LUKS2"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "ustawienie opcji trwałej konfiguracji dla LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<urządzenie> [<nowy plik klucza>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "sformatowanie urządzenia LUKS"
+
+#: src/cryptsetup.c:3357
 msgid "add key to LUKS device"
 msgstr "dodanie klucza do urządzenia LUKS"
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
 msgid "<device> [<key file>]"
 msgstr "<urządzenie> [<plik klucza>]"
 
-#: src/cryptsetup.c:1369
+#: src/cryptsetup.c:3358
 msgid "removes supplied key or key file from LUKS device"
 msgstr "usunięcie podanego klucza lub pliku klucza z urządzenia LUKS"
 
-#: src/cryptsetup.c:1370
+#: src/cryptsetup.c:3359
 msgid "changes supplied key or key file of LUKS device"
 msgstr "zmiana podanego klucza lub pliku klucza urządzenia LUKS"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "konwersja klucza na nowe parametry pbkdf"
+
+#: src/cryptsetup.c:3361
 msgid "<device> <key slot>"
 msgstr "<urządzenie> <numer klucza>"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3361
 msgid "wipes key with number <key slot> from LUKS device"
-msgstr "wyczyszczenie klucza o numerze <numer klucza> z urządzenia LUKS"
+msgstr "wymazanie klucza o numerze <numer klucza> z urządzenia LUKS"
 
-#: src/cryptsetup.c:1372
+#: src/cryptsetup.c:3362
 msgid "print UUID of LUKS device"
 msgstr "wypisanie UUID-a urządzenia LUKS"
 
-#: src/cryptsetup.c:1373
+#: src/cryptsetup.c:3363
 msgid "tests <device> for LUKS partition header"
 msgstr "sprawdzenie <urządzenia> pod kątem nagłówka partycji LUKS"
 
-#: src/cryptsetup.c:1374
+#: src/cryptsetup.c:3364
 msgid "dump LUKS partition information"
 msgstr "zrzut informacji o partycji LUKS"
 
-#: src/cryptsetup.c:1375
+#: src/cryptsetup.c:3365
 msgid "dump TCRYPT device information"
 msgstr "zrzut informacji o urządzeniu TCRYPT"
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"Wstrzymanie urządzenia LUKS i wyczyszczenie klucza (zamraża wszystkie "
-"operacje we/wy)."
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "zrzut informacji o urządzeniu BITLK"
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Wznowienie zatrzymanego urządzenia LUKS."
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Wstrzymanie urządzenia LUKS i wymazanie klucza (zamraża wszystkie operacje we/wy)"
 
-#: src/cryptsetup.c:1378
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Wznowienie zatrzymanego urządzenia LUKS"
+
+#: src/cryptsetup.c:3369
 msgid "Backup LUKS device header and keyslots"
 msgstr "Kopia zapasowa nagłówka i kluczy urządzenia LUKS"
 
-#: src/cryptsetup.c:1379
+#: src/cryptsetup.c:3370
 msgid "Restore LUKS device header and keyslots"
 msgstr "Odtworzenie nagłówka i kluczy urządzenia LUKS z kopii zapasowej"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <urządzenie>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Operacja na tokenach LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
 msgid ""
 "\n"
 "<action> is one of:\n"
@@ -1107,19 +2327,19 @@ msgstr ""
 "\n"
 "<akcja> to jedno z:\n"
 
-#: src/cryptsetup.c:1402
+#: src/cryptsetup.c:3395
 msgid ""
 "\n"
 "You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 msgstr ""
 "\n"
 "Można także używać starych aliasów składni <akcja>:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 
-#: src/cryptsetup.c:1406
+#: src/cryptsetup.c:3399
 #, c-format
 msgid ""
 "\n"
@@ -1134,399 +2354,746 @@ msgstr ""
 "<numer klucza> to numer klucza LUKS do zmiany\n"
 "<plik klucza> to opcjonalny plik nowego klucza dla akcji luksAddKey\n"
 
-#: src/cryptsetup.c:1413
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Domyślny wkompilowany format metadanych to %s (dla akcji luksFormat).\n"
+
+#: src/cryptsetup.c:3411
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
 msgstr ""
 "\n"
 "Domyślne wkompilowane parametry kluczy i haseł:\n"
-"\tMaksymalny rozmiar pliku klucza: %dkB, maksymalna długość hasła "
-"interaktywnego %d (znaków)\n"
-"Domyślny czas iteracji PBKDF2 dla LUKS: %d (ms)\n"
+"\tMaksymalny rozmiar pliku klucza: %dkB, maksymalna długość hasła interaktywnego %d (znaków)\n"
+"Domyślny PBKDF dla LUKS1: %s, czas iteracji %d (ms)\n"
+"Domyślny PBKDF dla LUKS2: %s\n"
+"\tCzas iteracji: %d, wymagana pamięć: %dkB, liczba wątków: %d\n"
 
-#: src/cryptsetup.c:1420
+#: src/cryptsetup.c:3422
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in device cipher parameters:\n"
 "\tloop-AES: %s, Key %d bits\n"
 "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
 msgstr ""
 "\n"
 "Domyślne wkompilowane parametry szyfrowania urządzeń:\n"
 "\tloop-AES: %s, bitów klucza: %d\n"
 "\tplain: %s, bitów klucza: %d, skrót hasła: %s\n"
-"\tLUKS1: %s, bitów klucza: %d, skrót nagłówka LUKS: %s, RNG: %s\n"
+"\tLUKS: %s, bitów klucza: %d, skrót nagłówka LUKS: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: Domyślny rozmiar klucza z trybem XTS (dwa klucze wewnętrzne) będzie podwojony.\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
 #, c-format
 msgid "%s: requires %s as arguments"
 msgstr "%s: wymaga %s jako argumentów"
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
 msgid "Show this help message"
 msgstr "Wyświetlenie tego opisu"
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
 msgid "Display brief usage"
 msgstr "Wyświetlenie krótkiej informacji o składni"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Opcje pomocnicze:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
 msgid "Print package version"
 msgstr "Wypisanie wersji pakietu"
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Opcje pomocnicze:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
 msgid "Shows more detailed error messages"
 msgstr "Wyświetlanie bardziej szczegółowych komunikatów błędów"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
 msgid "Show debug messages"
 msgstr "Wyświetlanie informacji diagnostycznych"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Wyświetlanie informacji diagnostycznych wraz z metadanymi JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
 msgid "The cipher used to encrypt the disk (see /proc/crypto)"
 msgstr "Szyfr używany do zaszyfrowania dysku (p. /proc/crypto)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
 msgid "The hash used to create the encryption key from the passphrase"
 msgstr "Skrót używany do utworzenia klucza szyfrującego z hasła"
 
-#: src/cryptsetup.c:1481
+#: src/cryptsetup.c:3492
 msgid "Verifies the passphrase by asking for it twice"
 msgstr "Sprawdzenie poprawności hasła poprzez dwukrotne pytanie"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
-msgstr "Odczyt klucza z pliku."
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Odczyt klucza z pliku"
 
-#: src/cryptsetup.c:1483
+#: src/cryptsetup.c:3494
 msgid "Read the volume (master) key from file."
 msgstr "Odczyt klucza wolumenu (klucza głównego) z pliku."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr "Zrzut (głównego) klucza wolumenu zamiast informacji o kluczach."
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Zrzut (głównego) klucza wolumenu zamiast informacji o kluczach"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
 msgid "The size of the encryption key"
 msgstr "Rozmiar klucza szyfrującego"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
 msgid "BITS"
 msgstr "BITÓW"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
 msgid "Limits the read from keyfile"
 msgstr "Ograniczenie odczytu z pliku klucza"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
 msgid "bytes"
 msgstr "bajty"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
 msgid "Number of bytes to skip in keyfile"
 msgstr "Liczba bajtów do pominięcia w pliku klucza"
 
-#: src/cryptsetup.c:1488
+#: src/cryptsetup.c:3499
 msgid "Limits the read from newly added keyfile"
 msgstr "Ograniczenie odczytu z nowo dodanego pliku klucza"
 
-#: src/cryptsetup.c:1489
+#: src/cryptsetup.c:3500
 msgid "Number of bytes to skip in newly added keyfile"
 msgstr "Liczba bajtów do pominięcia w nowo dodanym kluczu"
 
-#: src/cryptsetup.c:1490
+#: src/cryptsetup.c:3501
 msgid "Slot number for new key (default is first free)"
 msgstr "Numer dla nowego klucza (domyślny: pierwszy wolny)"
 
-#: src/cryptsetup.c:1491
+#: src/cryptsetup.c:3502
 msgid "The size of the device"
 msgstr "Rozmiar urządzenia"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
 msgid "SECTORS"
 msgstr "SEKTORÓW"
 
-#: src/cryptsetup.c:1492
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Użycie tylko określonego rozmiaru urządzenia (zignorowanie pozostałej części). NIEBEZPIECZNE!"
+
+#: src/cryptsetup.c:3504
 msgid "The start offset in the backend device"
 msgstr "Offset początku na urządzeniu przechowującym"
 
-#: src/cryptsetup.c:1493
+#: src/cryptsetup.c:3505
 msgid "How many sectors of the encrypted data to skip at the beginning"
 msgstr "Liczba sektorów zaszyfrowanych danych do pominięcia"
 
-#: src/cryptsetup.c:1494
+#: src/cryptsetup.c:3506
 msgid "Create a readonly mapping"
 msgstr "Utworzenie odwzorowania tylko do odczytu"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "Czas iteracji PBKDF2 dla LUKS (w milisekundach)"
-
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "ms"
-
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
 msgid "Do not ask for confirmation"
 msgstr "Bez pytań o potwierdzenie"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508
 msgid "Timeout for interactive passphrase prompt (in seconds)"
 msgstr "Limit czasu przy interaktywnym pytaniu o hasło (w sekundach)"
 
-#: src/cryptsetup.c:1497
-msgid "secs"
-msgstr "s"
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "s"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Uaktualnianie wiersza postępu (w sekundach)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Jak często można powtarzać próby wprowadzenia hasła"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Wyrównanie danych do granicy <n> sektorów - dla luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Plik z kopią zapasową nagłówka LUKS i kluczy"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Użycie /dev/random do wygenerowania klucza wolumenu"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Użycie /dev/urandom do wygenerowania klucza wolumenu"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Współdzielenie urządzenia z innym, nie zachodzącym segmentem szyfrowanym"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID dla urządzenia, które ma być użyte"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Zezwolenie na żądania porzucenia (TRIM) dla urządzenia"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Urządzenie lub plik z osobnym nagłówkiem LUKS"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Sprawdzenie hasła bez uaktywniania urządzenia"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Użycie nagłówka ukrytego (ukrytego urządzenia TCRYPT)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Urządzenie jest napędem systemowym TCRYPT (z bootloaderem)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Użycie zapasowego (drugiego) nagłówka TCRYPT"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Wyszukiwanie także urządzeń zgodnych z VeraCryptem"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "PIM (osobisty mnożnik iteracji) dla urządzenia zgodnego z VeraCryptem"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Odpytanie PIM (osobistego mnożnika iteracji) pod kątem urządzenia zgodnego z VeraCryptem"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Typ metadanych urządzenia: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Wyłączenie sprawdzania jakości hasła (jeśli włączone)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Użycie opcji zgodności wydajności dm-crypta same_cpu_crypt"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Użycie opcji zgodności wydajności dm-crypta submit_from_crypt_cpus"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Usunięcie urządzenia jest odroczone do czasu zamknięcia przez ostatniego użytkownika"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Użycie globalnej blokady do serializacji ciężkich pamięciowo PBKDF (obejście OOM)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Czas iteracji PBKDF dla LUKS (w milisekundach)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ms"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Algorytm PBKDF (dla LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Limit kosztu pamięciowego PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilobajty"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Koszt zrównoleglenia PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "wątki"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Koszt iteracji PBKDF (wymuszony, wyłącza test wydajności)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Priorytet klucza: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Wyłączenie blokowania metadanych na dysku"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Wyłączenie ładowania kluczy wolumenu przez pęk kluczy w jądrze"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Algorytm integralności danych (tylko LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Wyłączenie kroniki dla urządzenia integralności"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Bez wymazania urządzenia po formatowaniu"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Użycie niewydajnego starego wyrównania (stare jądra)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Bez pytania o hasło, jeśli uaktywnienie przy użyciu tokenu się nie powiedzie"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Numer tokenu (domyślnie: dowolny)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Opis klucza"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Rozmiar sektora szyfrowania (domyślnie: 512 bajtów)"
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Użycie IV liczonego w rozmiarze sektora (nie w 512 bajtach)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Trwałe ustawienie flag uaktywniania dla urządzenia"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "Jak często można powtarzać próby wprowadzenia hasła"
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Ustawienie etykiety dla urządzenia LUKS2"
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr "Wyrównanie danych do granicy <n> sektorów - dla luksFormat"
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Ustawienie etykiety podsystemu dla urządzenia LUKS2"
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Plik z kopią zapasową nagłówka LUKS i kluczy."
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Utworzenie niepowiązanego (bez przypisanego segmentu danych) klucza LUKS2"
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "Użycie /dev/random do wygenerowania klucza wolumenu."
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Odczyt lub zapis danych JSON z/do pliku"
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Użycie /dev/urandom do wygenerowania klucza wolumenu."
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Rozmiar obszaru metadanych nagłówka LUKS2"
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr ""
-"Współdzielenie urządzenia z innym, nie zachodzącym segmentem szyfrowanym."
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Rozmiar obszaru kluczy nagłówka LUKS2"
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID dla urządzenia, które ma być użyte."
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Odświeżenie (ponowne uaktywnienie) urządzenia z nowymi parametrami"
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Zezwolenie na żądania porzucenia (TRIM) dla urządzenia."
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Klucz LUKS2: rozmiar klucza szyfrującego"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Urządzenie lub plik z osobnym nagłówkiem LUKS."
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "Klucz LUKS2: szyfr używany do szyfrowania kluczy"
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Sprawdzenie hasła bez uaktywniania urządzenia."
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Szyfrowanie urządzenia LUKS2 (w miejscu)."
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Użycie nagłówka ukrytego (ukrytego urządzenia TCRYPT)."
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Odszyfrowanie urządzenia LUKS2 (usunięcie szyfrowania)."
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Urządzenie jest napędem systemowym TCRYPT (z bootloaderem)."
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Zainicjowanie ponownego szyfrowania LUKS2 wyłącznie w metadanych."
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Użycie zapasowego (drugiego) nagłówka TCRYPT."
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Wyłącznie wznowienie zainicjowanego ponownego szyfrowania LUKS2."
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Wyszukiwanie także urządzeń zgodnych z VeraCryptem."
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Ograniczenie rozmiaru urządzenia danych (przesunięcie położenia danych). NIEBEZPIECZNE!"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Typ metadanych urządzenia: luks, plain, loopaes, tcrypt."
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Maksymalny rozmiar strefy hotzone ponownego szyfrowania."
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Wyłączenie sprawdzania jakości hasła (jeśli włączone)."
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Typ odporności strefy hotzone ponownego szyfrowania (checksum, journal, none)"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr "Użycie opcji zgodności wydajności dm-crypta same_cpu_crypt."
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "Skrót sum kontrolknych strefy hotzone ponownego szyfrowania"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr "Użycie opcji zgodności wydajności dm-crypta submit_from_crypt_cpus."
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Nadpisanie wykrytego urządzenia dla urządzenia dm do ponownego szyfrowania"
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
 msgid "[OPTION...] <action> <action-specific>"
 msgstr "[OPCJA...] <akcja> <parametry-akcji>"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Działanie w trybie FIPS.\n"
-
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
 msgid "Argument <action> missing."
 msgstr "Brak argumentu <akcja>."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
 msgid "Unknown action."
 msgstr "Nieznana akcja."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr ""
-"Opcja --shared jest dozwolona tylko dla operacji otwarcia zwykłego "
-"urządzenia.\n"
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Opcje --refresh i --test-passphrase wykluczają się wzajemnie."
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr "Opcja --allow-discards jest dozwolona tylko dla operacji otwarcia.\n"
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "Opcja --deferred jest dozwolona tylko dla operacji zamknięcia."
 
-#: src/cryptsetup.c:1657
-msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
-msgstr ""
-"Opcja --key-size jest dopuszczalna tylko dla operacji luksFormat, open\n"
-"i benchmark.\n"
-"Aby ograniczyć odczyt z pliku klucza, należy użyć --keyfile-size=(bajty)."
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Opcja --shared jest dozwolona tylko dla operacji otwarcia zwykłego urządzenia."
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Opcja --allow-discards jest dozwolona tylko dla operacji otwarcia."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Opcja --persistent jest dozwolona tylko dla operacji otwarcia."
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Opcja --serialize-memory-hard-pbkdf jest dozwolona tylko dla operacji otwarcia."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Opcja --persistent nie jest dozwolona z --test-passphrase."
 
-#: src/cryptsetup.c:1664
+#: src/cryptsetup.c:3753
 msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
 msgstr ""
-"Opcja --test-passphrase jest dozwolona tylko przy otwieraniu urządzeń LUKS i "
-"TRCYPT.\n"
+"Opcja --key-size jest dozwolona tylko dla operacji luksFormat, luksAddKey,\n"
+"open i benchmark. Aby ograniczyć odczyt z pliku klucza, należy użyć\n"
+"--keyfile-size=(bajty)."
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Opcja --integrity jest dozwolona tylko dla operacji luksFormat (LUKS2)."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Opcja --integrity-no-wipe może być użyta tylko do akcji formatowania z rozszerzeniem integralności."
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Opcje --label i --subsystem są dozwolone tylko dla operacji LUKS2 luksFormat i config."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Opcja --test-passphrase jest dozwolona tylko przy otwieraniu urządzeń LUKS, TRCYPT i BITLK."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
 msgid "Key size must be a multiple of 8 bits"
 msgstr "Rozmiar klucza musi być wielokrotnością 8 bitów"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
 msgid "Key slot is invalid."
 msgstr "Numer klucza jest nieprawidłowy."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr "Opcja --key-file ma priorytet nad podanym argumentem pliku klucza.\n"
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Opcja --key-file ma priorytet nad podanym argumentem pliku klucza."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
 msgid "Negative number for option not permitted."
 msgstr "Liczba ujemna nie jest dozwolona dla tej opcji."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Dozwolony jest tylko jeden argument --key-file."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
 msgid "Only one of --use-[u]random options is allowed."
 msgstr "Dozwolona jest tylko jedna z opcji --use-[u]random."
 
-#: src/cryptsetup.c:1699
+#: src/cryptsetup.c:3813
 msgid "Option --use-[u]random is allowed only for luksFormat."
 msgstr "Opcja --use-[u]random jest dozwolona tylko dla operacji luksFormat."
 
-#: src/cryptsetup.c:1703
+#: src/cryptsetup.c:3817
 msgid "Option --uuid is allowed only for luksFormat and luksUUID."
 msgstr "Opcja --uuid jest dozwolona tylko dla operacji luksFormat i luksUUID."
 
-#: src/cryptsetup.c:1707
+#: src/cryptsetup.c:3821
 msgid "Option --align-payload is allowed only for luksFormat."
 msgstr "Opcja --align-payload jest dozwolona tylko dla operacji luksFormat."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Opcja --skip jest obsługiwana tylko przy otwieraniu urządzeń plain i "
-"loopaes.\n"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Opcje --luks2-metadata-size i --opt-luks2-keyslots-size są dozwolone tylko dla operacji luksFormat z LUKS2."
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Opcja --offset jest obsługiwana tylko przy otwieraniu urządzeń plain i "
-"loopaes.\n"
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Błędne określenie rozmiaru metadanych LUKS2."
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
-msgstr ""
-"Opcje --tcrypt-hidden, --tcrypt-system i --tcrypt-backup są obsługiwane "
-"tylko dla urządzeń TCRYPT.\n"
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Błędne określenie rozmiaru kluczy LUKS2."
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Opcji --align-payload i --offset nie można łączyć."
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Opcja --skip jest obsługiwana tylko przy otwieraniu urządzeń plain i loopaes."
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Opcja --offset jest obsługiwana tylko przy otwieraniu urządzeń plain i loopaes oraz dla operacji luksFormat i ponownego szyfrowania."
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Opcje --tcrypt-hidden, --tcrypt-system i --tcrypt-backup są obsługiwane tylko dla urządzeń TCRYPT."
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Opcji --tcrypt-hidden nie można łączyć z --allow-discards."
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
-msgstr "Opcji --tcrypt-hidden nie można łączyć z --allow-discards.\n"
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Opcja --veracrypt jest obsługiwana tylko dla typu urządzeń TCRYPT."
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Podano błędny argument dla parametru --veracrypt-pim."
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Opcja --veracrypt-pim jest obsługiwana tylko dla urządzeń zgodnych z VeraCryptem."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Opcja --veracrypt-query-pim jest obsługiwana tylko dla urządzeń zgodnych z VeraCryptem."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Opcje --veracrypt-pim i --veracrypt-query-pim wykluczają się wzajemnie."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Opcja --priority może mieć wartości tylko ignore/normal/prefer."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Wymagane jest określenie klucza."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Funkcja pochodna klucza oparta na haśle (PBKDF) może być tylko pbkdf2 lub argon2i/argon2id."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Wymuszonych iteracji PBKDF nie można łączyć z opcją czasu iteracji."
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "Opcja rozmiaru sektora nie jest obsługiwana dla tego polecenia."
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "Opcja dużych rozmiarów sektorów IV jest obsługiwana tylko przy otwieraniu urządzeń typu plain z sektorem większym niż 512 bajtów."
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "Przy opcji --unbound wymagany jest rozmiar klucza."
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Opcja --unbound może być użyta tylko z akcjami luksAddKey i luksDump."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "Opcja --refresh może być użyta tylko dla akcji otwierania."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "Nie można wyłączyć blokowania metadanych."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Błędne określenie maksymalnego rozmiaru strefy hotzone ponownego szyfrowania."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Błędne określenie rozmiaru urządzenia."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Maksymalna wartość ograniczenia rozmiaru urządzenia to 1GiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Rozmiar ograniczenia musi być wielokrotnością 512-bajtowego sektora."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "Błędne określenie rozmiaru danych."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Zmniejszenie przepełnienia rozmiaru."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "Odszyfrowanie LUKS2 wymaga opcji --header."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Rozmiar urządzenia musi być wielokrotnością 512-bajtowego sektora."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Opcji --reduce-device-size i --data-size nie można łączyć."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Opcji --device-size i --size nie można łączyć."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Opcji --ignore-corruption oraz --restart-on-corruption nie można użyć naraz."
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Podano błędny łańcuch zarodka."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Nie można utworzyć obrazu hasza %s do zapisu."
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "Opcja --veracrypt jest obsługiwana tylko dla typu urządzeń TCRYPT.\n"
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Nie można utworzyć obrazu FEC %s do zapisu."
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "Podano błędny łańcuch zarodka.\n"
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Podano błędny łańcuch głównego hasza."
 
-#: src/veritysetup.c:88
+#: src/veritysetup.c:187
 #, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "Nie można utworzyć obrazu hasza %s do zapisu.\n"
+msgid "Invalid signature file %s."
+msgstr "Błędny plik podpisu %s."
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "Podano błędny łańcuch głównego hasza.\n"
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Nie można odczytać pliku klucza %s."
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392
 msgid "<data_device> <hash_device>"
 msgstr "<urządzenie_danych> <urządzenie_haszy>"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392 src/integritysetup.c:479
 msgid "format device"
 msgstr "sformatowanie urządzenia"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "<data_device> <hash_device> <root_hash>"
 msgstr "<urządzenie_danych> <urządzenie_haszy> <główny_hasz>"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "verify device"
 msgstr "weryfikacja urządzenia"
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<nazwa> <urządzenie_danych> <urządzenie_haszy> <główny_hasz>"
-
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "utworzenie aktywnego urządzenia"
-
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "usunięcie (deaktywacja) urządzenia"
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<urządzenie_danych> <nazwa> <urządzenie_haszy> <główny_hasz>"
 
-#: src/veritysetup.c:312
+#: src/veritysetup.c:396 src/integritysetup.c:482
 msgid "show active device status"
 msgstr "pokazanie stanu aktywnego urządzenia"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397
 msgid "<hash_device>"
 msgstr "<urządzenie_haszy>"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397 src/integritysetup.c:483
 msgid "show on-disk information"
 msgstr "wyświetlenie informacji z dysku"
 
-#: src/veritysetup.c:332
+#: src/veritysetup.c:416
 #, c-format
 msgid ""
 "\n"
@@ -1541,333 +3108,770 @@ msgstr ""
 "<urządzenie_haszy> to urządzenie zawierające dane weryfikacyjne\n"
 "<główny_hasz> to hasz głównego węzła na <urządzeniu_haszy>\n"
 
-#: src/veritysetup.c:339
+#: src/veritysetup.c:423
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
 msgstr ""
 "\n"
 "Domyślnie wkompilowane parametry dm-verity:\n"
-"\tHasz: %s, blok danych (bajtów): %u, blok haszy (bajtów): %u, rozmiar "
-"zarodka: %u, format haszy: %u\n"
+"\tHasz: %s, blok danych (bajtów): %u, blok haszy (bajtów): %u, rozmiar zarodka: %u, format haszy: %u\n"
 
-#: src/veritysetup.c:377
+#: src/veritysetup.c:466
 msgid "Do not use verity superblock"
 msgstr "Nieużywanie superbloku VERITY"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "Format type (1 - normal, 0 - original Chrome OS)"
 msgstr "Typ formatu (1 - normalny, 0 - oryginalny Chrome OS)"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "number"
 msgstr "liczba"
 
-#: src/veritysetup.c:379
+#: src/veritysetup.c:468
 msgid "Block size on the data device"
 msgstr "Rozmiar bloku na urządzeniu z danymi"
 
-#: src/veritysetup.c:380
+#: src/veritysetup.c:469
 msgid "Block size on the hash device"
 msgstr "Rozmiar bloku na urządzeniu z haszami"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "bajty parzystości FEC"
+
+#: src/veritysetup.c:471
 msgid "The number of blocks in the data file"
 msgstr "Liczba bloków w pliku danych"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:471
 msgid "blocks"
 msgstr "bloki"
 
-#: src/veritysetup.c:382
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Ścieżka do urządzenia z danymi korekcji błędów"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "ścieżka"
+
+#: src/veritysetup.c:473
 msgid "Starting offset on the hash device"
 msgstr "Offset początku na urządzeniu z haszami"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Offset początku na urządzeniu FEC"
+
+#: src/veritysetup.c:475
 msgid "Hash algorithm"
 msgstr "Algorytm skrótu"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:475
 msgid "string"
 msgstr "łańcuch"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "Salt"
 msgstr "Zarodek"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "hex string"
 msgstr "Łańcuch szesnastkowy"
 
-#: src/cryptsetup_reencrypt.c:147
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Ścieżka pliku podpisu hasza głównego"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Restart jądra po wykryciu uszkodzenia"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Zignotowanie uszkodzenia, jedynie logowanie"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Bez weryfikacji wyzerowanych bloków"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Sprawdzenie bloku danych tylko przy pierwszym odczycie"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Opcje --ignore-corruption, --restart-on-corruption oraz --ignore-zero-blocks są dozwolone tylko przy operacji otwierania."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Opcja --root-hash-signature może być użyta tylko dla akcji otwierania."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Opcji --ignore-corruption oraz --restart-on-corruption nie można użyć naraz."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Nie można odczytać pliku klucza %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Nie można odczytać %d bajtów z pliku klucza %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Sformatowano z rozmiarem znacznika %u, wewnętrzna integralność %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<urządzenie_integralności>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<urządzenie_integralności> <nazwa>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<nazwa> to urządzenie do utworzenia pod %s\n"
+"<urządzenie_integralności> to urządzenie zawierające dane ze znacznikami integralności\n"
+
+#: src/integritysetup.c:507
 #, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Nie można otworzyć %s w trybie wyłącznym, urządzenie jest w użyciu.\n"
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Domyślnie wkompilowane parametry dm-integrity:\n"
+"\tAlgorytm sumy kontrolnej: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Ścieżka do urządzenia danych (jeśli osobne)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Rozmiar kroniki"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Sektory przeplotu"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Znak wodny kroniki"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "procent"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Czas zatwierdzania kroniki"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Liczba 512-bajtowych sektorów na bit (tryb bitmapy)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Czas zrzutu trybu bitmapy"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Rozmiar znacznika (na sektor)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Rozmiar sektora"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Rozmiar buforów"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Algorytm integralności danych"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Rozmiar klucza integralności danych"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Odczyt klucza integralności z pliku"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Algorytm integralności kroniki"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Rozmiar klucza integralności kroniki"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Odczyt klucza integralności z pliku"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Algorytm szyfrowania kroniki"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Rozmiar klucza szyfrowania kroniki"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Odczyt klucza szyfrującego kroniki z pliku"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Tryb odtwarzania (bez kroniki, bez sprawdzania znaczników)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Użycie bitmapy do śledzenia zmian i wyłączenie kroniki dla urządzenia integralności"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Automatyczne przeliczenie znaczników początkowych."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Opcja --integrity-recalculate może być użyta tylko dla akcji otwierania."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Opcje --journal-size, --interleave-sectors, --sector-size, --tag-size oraz --no-wipe mogą być użyte tylko dla akcji formatowania."
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Błędne określenie rozmiaru kroniki."
 
-#: src/cryptsetup_reencrypt.c:151
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Muszą być podane obie opcje: pliku klucza i rozmiaru klucza."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Algorytm integralności musi być podany, jeśli używany jest klucz integralności."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Muszą być podane obie opcje: pliku klucza integralności i rozmiaru klucza."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Algorytm integralności kroniki musi być podany, jeśli używany jest klucz integralności kroniki."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Muszą być podane obie opcje: pliku szyfrowania kroniki i rozmiaru klucza."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Algorytm szyfrowania kroniki musi być podany, jeśli używany jest klucz szyfrowania kroniki."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Opcje trybu odtwarzania i bitmapy wykluczają się wzajemnie."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Opcji kroniki nie można używać w trybie bitmapy."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Opcje bitmapy mogą być używane tylko w trybie bitmapy."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Ponowne szyfrowanie już trwa."
+
+#: src/cryptsetup_reencrypt.c:208
 #, c-format
-msgid "Cannot open device %s\n"
-msgstr "Nie można otworzyć urządzenia %s\n"
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Nie można otworzyć %s w trybie wyłącznym, urządzenie jest w użyciu."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "Przydzielenie wyrównanego obszaru pamięci nie powiodło się.\n"
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Przydzielenie wyrównanego obszaru pamięci nie powiodło się."
 
-#: src/cryptsetup_reencrypt.c:168
+#: src/cryptsetup_reencrypt.c:229
 #, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Nie można odczytać urządzenia %s.\n"
+msgid "Cannot read device %s."
+msgstr "Nie można odczytać urządzenia %s."
 
-#: src/cryptsetup_reencrypt.c:179
+#: src/cryptsetup_reencrypt.c:240
 #, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "Oznaczanie urządzenia LUKS %s jako bezużytecznego.\n"
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Oznaczanie urządzenia LUKS1 %s jako bezużytecznego."
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "Oznaczenie urządzenia LUKS %s jako użytecznego.\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Ustawianie flagi ponownego szyfrowania offline LUKS2 na urządzeniu %s."
 
-#: src/cryptsetup_reencrypt.c:200
+#: src/cryptsetup_reencrypt.c:261
 #, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Nie można zapisać na urządzenie %s.\n"
+msgid "Cannot write device %s."
+msgstr "Nie można zapisać na urządzenie %s."
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "Nie można zapisać pliku logu ponownego szyfrowania.\n"
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Nie można zapisać pliku logu ponownego szyfrowania."
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "Nie można odczytać pliku logu ponownego szyfrowania.\n"
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Nie można odczytać pliku logu ponownego szyfrowania."
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
 msgstr "Plik logu %s istnieje, wznowienie ponownego szyfrowania.\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr "Aktywacja urządzenia tymczasowego przy użyciu starego nagłówka LUKS.\n"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Uaktywnianie urządzenia tymczasowego przy użyciu starego nagłówka LUKS."
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr "Aktywacja urządzenia tymczasowego przy użyciu nowego nagłówka LUKS.\n"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Uaktywnianie urządzenia tymczasowego przy użyciu nowego nagłówka LUKS."
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Aktywacja urządzeń tymczasowych nie powiodła się.\n"
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Uaktywnianie urządzeń tymczasowych nie powiodła się."
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Utworzono nowy nagłówek LUKS dla urządzenia %s.\n"
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Nie udało się ustawić offsetu danych."
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Nie udało się ustawić rozmiaru metadanych."
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:573
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Uaktywniono klucz %i.\n"
+msgid "New LUKS header for device %s created."
+msgstr "Utworzono nowy nagłówek LUKS dla urządzenia %s."
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "Utworzono kopię zapasową nagłówka LUKS urządzenia %s.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Ta wersja cryptsetup-reencrypt nie obsługuje nowego typu tokenu wewnętrznego %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Nie udało się odczytać flag uaktywniania z nagłówka zapasowego."
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Nie udało się zapisać flag uaktywniania w nowym nagłówku."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "Tworzenie kopii zapasowych nagłówków LUKS nie powiodło się.\n"
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Nie udało się odczytać wymagań z nagłówka zapasowego."
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/cryptsetup_reencrypt.c:705
 #, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Nie można odtworzyć nagłówka LUKS na urządzeniu %s.\n"
+msgid "%s header backup of device %s created."
+msgstr "Utworzono kopię zapasową nagłówka %s urządzenia %s."
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Tworzenie kopii zapasowych nagłówków LUKS nie powiodło się."
+
+#: src/cryptsetup_reencrypt.c:901
 #, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "Odtworzono nagłówek LUKS na urządzeniu %s.\n"
+msgid "Cannot restore %s header on device %s."
+msgstr "Nie można odtworzyć nagłówka %s na urządzeniu %s."
 
-#: src/cryptsetup_reencrypt.c:669
+#: src/cryptsetup_reencrypt.c:903
 #, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Postęp: %5.1f%%, ETA %02llu:%02llu, zapisano %4llu MiB, szybkość %5.1f MiB/s"
-"%s"
+msgid "%s header on device %s restored."
+msgstr "Odtworzono nagłówek %s na urządzeniu %s."
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Nie można przemieścić się we właściwe położenie urządzenia.\n"
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Nie można otworzyć tymczasowego urządzenia LUKS."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Nie można otworzyć pliku tymczasowego nagłówka LUKS.\n"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Nie można pobrać rozmiaru urządzenia."
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "Nie można pobrać rozmiaru urządzenia.\n"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Błąd we/wy podczas ponownego szyfrowania."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Przerwano sygnałem.\n"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Dostarczony UUID jest nieprawidłowy."
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "Błąd we/wy podczas ponownego szyfrowania.\n"
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Nie można otworzyć pliku logu ponownego szyfrowania."
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"Rozmiaru klucza można użyć tylko z --key-slot albo przy dokładnie jednym "
-"aktywnym kluczu.\n"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Nie w trakcie odszyfrowywania; dostarczony UUID może być użyty tylko do wznowienia wstrzymanego procesu odszyfrowywania."
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
+#: src/cryptsetup_reencrypt.c:1504
 #, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Hasło dla klucza %u: "
-
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Nie można otworzyć pliku logu ponownego szyfrowania.\n"
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Zmieniono parametry PBKDF dla klucza %i."
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "Reencryption block size"
 msgstr "Rozmiar bloku ponownego szyfrowania"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "MiB"
 msgstr "MiB"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "Bez zmiany klucza i ponownego szyfrowania obszaru danych."
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Bez zmiany klucza i ponownego szyfrowania obszaru danych"
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr "Użycie bezpośredniego we/wy przy dostępie do urządzeń."
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Odczyt nowego klucza wolumenu (klucza głównego) z pliku"
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr "Użycie fsync po każdym bloku."
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Czas iteracji PBKDF2 dla LUKS (w milisekundach)"
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Uaktualnianie pliku logu po każdym bloku."
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Użycie bezpośredniego we/wy przy dostępie do urządzeń"
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr "Użycie tylko tego slotu (wyłączenie pozostałych)."
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Użycie fsync po każdym bloku"
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
-"Ograniczenie rozmiaru urządzenia danych (przesunięcie położenia danych). "
-"NIEBEZPIECZNE!"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Uaktualnianie pliku logu po każdym bloku"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Użycie tylko określonego rozmiaru urządzenia (zignorowanie pozostałej "
-"części). NIEBEZPIECZNE!"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Użycie tylko tego slotu (wyłączenie pozostałych)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Utworzenie nowego nagłówka na nieszyfrowanym urządzeniu"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Trwałe odszyfrowanie urządzenia (usunięcie szyfrowania)"
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Utworzenie nowego nagłówka na nieszyfrowanym urządzeniu."
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "UUID używany do wznowienia odszyfrowywania"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
-msgstr "Trwałe odszyfrowanie urządzenia (usunięcie szyfrowania)."
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Typ metadanych LUKS: luks1, luks2"
 
-#: src/cryptsetup_reencrypt.c:1298
+#: src/cryptsetup_reencrypt.c:1659
 msgid "[OPTION...] <device>"
 msgstr "[OPCJA...] <urządzenie>"
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr "UWAGA: ten kod jest eksperymentalny, może całkowicie uszkodzić dane.\n"
-
-#: src/cryptsetup_reencrypt.c:1313
+#: src/cryptsetup_reencrypt.c:1667
 #, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "Ponowne szyfrowanie zmieni: klucz wolumenu%s%s%s%s.\n"
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Ponowne szyfrowanie zmieni: %s%s%s%s%s%s."
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
-msgstr ", hasz na "
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "klucz wolumenu"
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "hasz na "
+
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ", szyfr na"
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr "Wymagany argument."
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Jako rozmiar bloku ponownego szyfrowania dozwolone są jedynie wartości od 1 "
-"MiB do 64 MiB."
-
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Błędne określenie rozmiaru urządzenia."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Jako rozmiar bloku ponownego szyfrowania dozwolone są jedynie wartości od 1 MiB do 64 MiB."
 
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
 msgstr "Maksymalna wartość ograniczenia rozmiaru urządzenia to 64MiB."
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Rozmiar ograniczenia musi być wielokrotnością 512-bajtowego sektora."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Opcja --new musi być użyta wraz z --reduce_device_size lub --header."
 
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr "Opcja --new musi być użyta wraz z --reduce_device_size."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Opcja --keep-key może być użyta tylko z --hash, --iter-time lub --pbkdf-force-iterations.."
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr "Opcja --keep-key może być użyta tylko z --hash lub --iter-time."
-
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr "Opcja --new nie może być użyta wraz z --decrypt."
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
 msgstr "Opcja --decrypt jest niezgodna z podanymi parametrami."
 
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Opcja --uuid jest dozwolona tylko wraz z --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Błędny typ LUKS - musi być jednym z 'luks', 'luks1' lub 'luks2'."
+
 #: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Błąd podczas odczytu odpowiedzi z terminala.\n"
+msgid "Error reading response from terminal."
+msgstr "Błąd podczas odczytu odpowiedzi z terminala."
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Polecenie się powiodło.\n"
 
-#: src/utils_tools.c:191
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "niewłaściwe lub brakujące parametry"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "brak uprawnień lub błędne hasło"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "brak pamięci"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "podano niewłaściwe urządzenie lub plik"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "urządzenie już istnieje lub jest zajęte"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "nieznany błąd"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Polecenie nie powiodło się z kodem %i (%s).\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Klucz numer %i utworzony."
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Klucz numer %i odblokowany."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Klucz numer %i usunięty."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Token %i utworzony."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Token %i usunięty."
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Wymazywanie przerwane."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "UWAGA: urządzenie %s już zawiera sygnaturę partycji '%s'.\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "UWAGA: urządzenie %s już zawiera sygnaturę superbloku '%s'.\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Nie udało się zainicjować sond sygnatur urządzeń."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Nie udało się wykonać stat na urządzeniu %s."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Urządzenie %s jest w użyciu. Nie można kontynuować operacji formatowania."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Nie udało się otworzyć pliku %s do odczytu i zapisu."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Istniejąca sygnatura partycji '%s' (offset w bajtach: %<PRIi64>) na urządzeniu %s zostanie wymazana."
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Istniejąca sygnatura superbloku '%s' (offset w bajtach: %<PRIi64>) na urządzeniu %s zostanie wymazana."
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Nie udało się wymazać sygnatury urządzenia."
+
+#: src/utils_tools.c:590
 #, c-format
-msgid "Command failed with code %i"
-msgstr "Polecenie nie powiodło się z kodem %i"
+msgid "Failed to probe device %s for a signature."
+msgstr "Nie udało się sprawdzić sygnatury urządzenia %s."
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Ponowne szyfrowanie przerwane."
 
-#: src/utils_password.c:42
+#: src/utils_password.c:43 src/utils_password.c:75
 #, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Nie można sprawdzić jakości hasła: %s\n"
+msgid "Cannot check password quality: %s"
+msgstr "Nie można sprawdzić jakości hasła: %s"
 
-#: src/utils_password.c:50
+#: src/utils_password.c:51
 #, c-format
 msgid ""
 "Password quality check failed:\n"
-" %s\n"
+" %s"
 msgstr ""
 "Sprawdzenie jakości hasła nie powiodło się:\n"
-" %s\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Sprawdzenie jakości hasła nie powiodło się: błędne hasło (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Błąd podczas odczytu hasła z terminala."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Weryfikacja hasła: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Hasła nie zgadzają się."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Nie można użyć offsetu, jeśli wejściem jest terminal."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Hasło: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Hasło dla %s: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Dla tego hasła nie ma dostępnego klucza."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Brak dostępnego miejsca na klucz."
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Nie można otworzyć pliku klucza %s do zapisu."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Nie można zapisać pliku klucza %s."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Nie udało się otworzyć pliku %s tylko do odczytu."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Poprawny token JSON dla LUKS2:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Nie udało się odczytać pliku JSON."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Odczyt przerwany."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Nie udało się otworzyć pliku %s do zapisu."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Zapis przerwany."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Nie udało się zapisać pliku JSON."
diff --git a/po/pt_BR.gmo b/po/pt_BR.gmo
new file mode 100644 (file)
index 0000000..d2fc1c5
Binary files /dev/null and b/po/pt_BR.gmo differ
diff --git a/po/pt_BR.po b/po/pt_BR.po
new file mode 100644 (file)
index 0000000..49739c7
--- /dev/null
@@ -0,0 +1,4108 @@
+# Brazilian Portuguese translation for cryptsetup
+# Copyright (C) 2019 Free Software Foundation, Inc.
+# This file is put in the public domain.
+# Rafael Fontenelle <rafaelff@gnome.org>, 2016-2019.
+# ,
+# ##### Terminologia usada #####
+# ,
+# device mapper = mapeador de dispositivo
+# digest = resumo
+# key slots = slots de chave
+# plain = claro (pois "mensagem plana" é tradução incorreta)
+# passphrase = senha
+# salt = sal    # https://pt.wikipedia.org/wiki/Sal_(criptografia)
+# ,
+# ##############################
+# ,
+msgid ""
+msgstr ""
+"Project-Id-Version: cryptsetup 2.1.0\n"
+"Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2019-01-28 07:58-0200\n"
+"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n"
+"Language-Team: Brazilian Portuguese <ldpbr-translation@lists.sourceforge.net>\n"
+"Language: pt_BR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Generator: Virtaal 1.0.0-beta1\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Não foi possível inicializar o mapeador de dispositivo, executando como usuário não-root."
+
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Não foi possível inicializar o mapeador de dispositivo. O módulo de kernel dm_mod está carregado?"
+
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Não há suporte ao sinalizador atrasado requisitado."
+
+#: lib/libdevmapper.c:1198
+#, c-format
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID para o dispositivo \"%s\" estava truncada."
+
+#: lib/libdevmapper.c:1520
+#, fuzzy
+msgid "Unknown dm target type."
+msgstr "Tipo %s de PBKDF desconhecido."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Não há suporte às opções de desempenho de dm-crypt requisitadas."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Não há suporte à tratamento de corrompimento de dados de dm-verify requisitada."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Não há suporte às opções FEC dm-verity requisitadas."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Não há suporte às opções de integridade de dados requisitadas."
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Não há suporte à opção sector_size requisitada."
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Não há suporte à recalculação automática de tags de integridade requisitada."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Não há suporte a descarte/TRIM."
+
+#: lib/libdevmapper.c:1653
+#, fuzzy
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Não há suporte às opções de integridade de dados requisitadas."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Falha ao consultar o segmento dm-%s."
+
+#: lib/random.c:75
+msgid ""
+"System is out of entropy while generating volume key.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
+msgstr ""
+"O sistema sem entropia suficiente enquanto gera chave de volume.\n"
+"Por favor mova o mouse ou digite algum texto em outra janela para obter alguns eventos aleatórios.\n"
+
+#: lib/random.c:79
+#, c-format
+msgid "Generating key (%d%% done).\n"
+msgstr "Gerando chave (%d%% concluído).\n"
+
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Executando no modo FIPS."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Erro fatal durante inicialização de RNG."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Qualidade RNG requisitada desconhecida."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Erro na leitura de RNG."
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Não foi possível inicializar o backend RNG de criptografia."
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Não foi possível inicializar o backend de criptografia."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Não há suporte ao algoritmo hash %s."
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Erro de processamento de chave (usando hash %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Não foi possível determinar o tipo do dispositivo. Ativação de dispositivo incompatível?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Há suporte a esta operação apenas para dispositivo LUKS."
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Há suporte a esta operação apenas para dispositivo LUKS2."
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Todos os slots de chave estão cheios."
+
+#: lib/setup.c:434
+#, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Slot de chave %d é inválido, por favor selecione entre 0 e %d."
+
+#: lib/setup.c:440
+#, c-format
+msgid "Key slot %d is full, please select another one."
+msgstr "Slot de chave %d está cheio, por favor selecione outro."
+
+#: lib/setup.c:525 lib/setup.c:2824
+#, fuzzy
+msgid "Device size is not aligned to device logical block size."
+msgstr "Tamanho do dispositivo não está alinhado com o tamanho de setor requisitado."
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Cabeçalho detectado, mas o dispositivo %s é muito pequeno."
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Não há suporte a esta operação para este tipo de dispositivo."
+
+#: lib/setup.c:666
+#, fuzzy
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Recriptografia offline em progresso. Abortando."
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "Não há suporte ao LUKS versão %d."
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Não há suporte ao dispositivo de metadados desanexado para este tipo de criptografia."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, c-format
+msgid "Device %s is not active."
+msgstr "O dispositivo \"%s\" não está ativado."
+
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "O dispositivo subjacente para o dispositivo de criptografia %s desapareceu."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Parâmetros de criptografia clara inválidos."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Tamanho de chave inválida."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "Não há suporte ao UUID para este tipo de criptografia."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Não há suporte ao tamanho de setor de criptografia."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Tamanho do dispositivo não está alinhado com o tamanho de setor requisitado."
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Não é possível formatar LUKS sem dispositivo."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Alinhamento de dados requisitado não é compatível com a posição dos dados."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "AVISO: A posição dos dados está fora do dispositivo de dados atualmente disponível.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Não foi possível apagar o cabeçalho no dispositivo %s."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "AVISO: A ativação do dispositivo vai falhar, dm-crypt carece de suporte para o tamanho de setor de criptografia requisitado.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "A chave de volume é pequena demais para criptografia com extensões de integridade."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "A cifra %s-%s (tamanho de chave %zd bits) não está disponível."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr ""
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "O dispositivo %s é muito pequeno."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Não é possível formatar dispositivo %s em uso."
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Não é possível formatar o dispositivo %s, permissão negada."
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Não foi possível formatar integridade para o dispositivo %s."
+
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "Não foi possível formatar o dispositivo %s."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Não foi possível formatar LOOPAES sem dispositivo."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Não foi possível formatar VERITY sem dispositivo."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "Não há suporte ao tipo de hash VERITY %d."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Não há suporte ao tamanho de bloco VERITY."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Não há suporte à posição de hash VERITY."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Não há suporte à posição de FEC VERITY."
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "A área de dados se sobrepõe à área hash."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Área de hash sobreposta com área de FEC."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Área de dados sobreposta com área de FEC."
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
+
+#: lib/setup.c:2286
+#, c-format
+msgid "Unknown crypt device type %s requested."
+msgstr "Tipo de dispositivo de criptografia requisitado %s desconhecido."
+
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "Não há suporte aos parâmetros no dispositivo %s."
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Parâmetros incompatíveis no dispositivo %s."
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr ""
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, fuzzy, c-format
+msgid "Failed to suspend device %s."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr ""
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Não foi possível redimensionar o dispositivo de loop."
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "Você realmente deseja alterar o UUID do dispositivo?"
+
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Arquivo de cópia de segurança de cabeçalho não contém um cabeçalho LUKS compatível."
+
+#: lib/setup.c:3058
+#, c-format
+msgid "Volume %s is not active."
+msgstr "O volume %s não está ativado."
+
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
+msgstr "O volume %s já está suspenso."
+
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "A suspensão não oferece suporte ao dispositivo %s."
+
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "Ocorreu um erro ao suspender o dispositivo %s."
+
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "O volume %s não estava suspenso."
+
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
+msgstr "O resumo não oferece suporte a este dispositivo %s."
+
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "Ocorreu um erro ao resumir o dispositivo %s."
+
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "A chave de volume não corresponde ao volume."
+
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Não foi possível adicionar slot de chave, todos slots desabilitados ou nenhuma chave de volume fornecida."
+
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Falha ao trocar novo slot de chave."
+
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "O slot de chave %d é inválido."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "O slot de chave %d não está ativo."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "O cabeçalho do dispositivo se sobrepõe à área de dados."
+
+#: lib/setup.c:3981
+#, fuzzy
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Recriptografia já está em progresso."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+#, fuzzy
+msgid "Failed to get reencryption lock."
+msgstr "Falha ao obter trava de dispositivo de escrita."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+#, fuzzy
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Não há suporte ao tamanho de setor de criptografia."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+#, fuzzy
+msgid "Device type is not properly initialized."
+msgstr "O tipo de dispositivo não foi inicializado corretamente."
+
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Não foi possível usar o dispositivo %s, o nome é inválido ou ainda está em uso."
+
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "O dispositivo %s já existe."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Chave de volume incorreta especificada para dispositivo claro."
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Hash raiz incorreta especificada para o dispositivo verity."
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr ""
+
+#: lib/setup.c:4421
+#, fuzzy
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Não há suporte a chaveiro de kernel neste kernel."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Falha ao carregar chave no chaveiro de kernel."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "O dispositivo %s ainda está em uso."
+
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "Dispositivo inválido %s."
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Buffer de chave de volume muito pequena."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Não foi possível obter chave de volume para dispositivo claro."
+
+#: lib/setup.c:4657
+#, fuzzy
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Hash raiz incorreta especificada para o dispositivo verity."
+
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Não há suporte a esta operação para o dispositivo de criptografia %s."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Não há suporte à operação de despejo para este tipo de dispositivo."
+
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr ""
+
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Não foi possível converter o dispositivo %s, o qual ainda está em uso."
+
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Falha ao atribuir o slot de chave %u como a nova chave de volume."
+
+#: lib/setup.c:5845
+#, fuzzy
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Falha ao inicializar os parâmetros padrão de slot de chave LUKS2."
+
+#: lib/setup.c:5851
+#, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Falha ao atribuir o slot de chave %d ao resumo."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Não há suporte a chaveiro de kernel neste kernel."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Falha ao ler senha do chaveiro (erro %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr ""
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Não foi possível obter prioridade de processo."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Não foi possível desbloquear memória."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Falha ao abrir arquivo de chave."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Não foi possível ler o arquivo de chave de um terminal."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Falha ao obter estado do arquivo."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Não foi possível buscar a posição do arquivo de chave requisitado."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Memória insuficiente para leitura da senha."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Erro ao ler a senha."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Nada para ler na entrada."
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Tamanho máximo de arquivo de chave excedido."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Não foi possível ler a quantidade requisitada de dados."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, fuzzy, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "O dispositivo %s não existe ou acesso negado."
+
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "O dispositivo %s não é compatível."
+
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Dispositivo %s é muito pequeno. Necessita de pelo menos %<PRIu64> bytes."
+
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Não foi possível usar o dispositivo %s, o qual está em uso (já mapeado ou montado)."
+
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Não foi possível usar o dispositivo %s, permissão negada."
+
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Não foi possível obter informação sobre o dispositivo %s."
+
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Não foi possível usar um dispositivo de loopback, executando como usuário não-root."
+
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Anexação de dispositivo loopback falhou (dispositivo de loop com sinalizador autoclear é necessário)."
+
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "A posição requisitada está além do tamanho real do dispositivo %s."
+
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "O dispositivo %s possui tamanho zero."
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Tempo alvo PBKDF requisitado não pode ser zero."
+
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Tipo %s de PBKDF desconhecido."
+
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Não há suporte ao hash requisitado %s."
+
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Não há suporte ao tipo de PBKDF requisitado para LUKS1."
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Fluxos paralelos ou memória máxima de PBKDF não pode estar definida com pbkdf2."
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Contagem de iterações forçadas é pequena demais para %s (mínimo é %u)."
+
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Custo de memória forçada é pequeno demais para %s (mínimo é %u kilobytes)."
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Custo de memória PBKDF máximo requisitado é alto demais (o máximo é %d kilobytes)."
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Memória PBKDF máxima requisitada não pode ser zero."
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Fluxos paralelos PBKDF requisitados não podem ser zero."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr ""
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Teste de PBKDF desabilitado, mas iterações não definidas."
+
+#: lib/utils_benchmark.c:191
+#, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Opções PBKDF2 não compatíveis (sando algoritmo hash %s)."
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Opções PBKDF2 não compatíveis."
+
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Trava abortada. O caminho de trava %s/%s não é usável (faltando ou não é um diretório)."
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "AVISO: Diretório de trava %s/%s está faltando!\n"
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Trava abortada. O caminho de trava %s/%s não é usável (%s não é um diretório)."
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Não foi possível ir à posição do dispositivo."
+
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:39
+#, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"Falha ao configurar mapeamento de chave dm-crypt para o dispositivo %s.\n"
+"Certifique-se de que o kernel oferece suporte cifra de %s (verifique o syslog para mais informação)."
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Tamanho de chave no modo XTS deve ser 256 ou 512 bits."
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "A especificação de cifra deve estar no formato [cifra]-[modo]-[iv]."
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "Não foi possível escrever para o dispositivo %s, permissão negada."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Falha ao abrir o dispositivo temporário de armazenamento de chave."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Falha ao acessar o dispositivo temporário de armazenamento de chave."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Erro de E/S ao criptografar slot de chave."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Não foi possível abrir o dispositivo %s."
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Erro de E/S ao descriptografar slot de chave."
+
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Dispositivo %s é muito pequeno. (LUKS1 precisa de pelo menos %<PRIu64> bytes.)"
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "O slot de chave LUKS %u é inválido."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "O dispositivo %s não é um dispositivo LUKS válido."
+
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, c-format
+msgid "Requested header backup file %s already exists."
+msgstr "O arquivo de cópia de segurança de cabeçalho requisitado %s já existe."
+
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
+msgstr "Não foi possível criar o arquivo de cópia de segurança de cabeçalho %s."
+
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
+msgstr "Não foi possível escrever o arquivo de cópia de segurança de cabeçalho %s."
+
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+#, fuzzy
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Arquivo de cópia de segurança não contém cabeçalho LUKS válido."
+
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, c-format
+msgid "Cannot open header backup file %s."
+msgstr "Não foi possível abrir o arquivo de cópia de segurança de cabeçalho %s."
+
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, c-format
+msgid "Cannot read header backup file %s."
+msgstr "Não foi possível ler o arquivo de cópia de segurança de cabeçalho %s."
+
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Posição de dados ou tamanho de chave divergem entre dispositivo e cópia de segurança, restauração falhou."
+
+#: lib/luks1/keymanage.c:325
+#, c-format
+msgid "Device %s %s%s"
+msgstr "Dispositivo %s %s%s"
+
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "não contém cabeçalho LUKS. A substituição do cabeçalho pode destruir dados naquele dispositivo."
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "já contém cabeçalho LUKS. A substituição do cabeçalho vai destruir slots de chave existentes."
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
+msgstr ""
+"\n"
+"AVISO: o cabeçalho do dispositivo real possui um UUID diferente da cópia de segurança!"
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Tamanho de chave fora do padrão, correção manual necessária."
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Alinhamento de slots de chave fora do padrão, correção manual necessária."
+
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Corrigindo slots de chave."
+
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Slot de chave %i: posição corrigida (%u -> %u)."
+
+#: lib/luks1/keymanage.c:417
+#, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Slot de chave %i: barras corrigidas (%u -> %u)."
+
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Slot de chave %i: assinatura de partição é falsa."
+
+#: lib/luks1/keymanage.c:431
+#, c-format
+msgid "Keyslot %i: salt wiped."
+msgstr "Slot de chave %i: sal apagado."
+
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Escrevendo cabeçalho LUKS para disco."
+
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Correção falhou."
+
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, c-format
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Não há suporte ao hash LUKS requisitado %s."
+
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Nenhum problema conhecido foi detectado no cabeçalho LUKS."
+
+#: lib/luks1/keymanage.c:660
+#, c-format
+msgid "Error during update of LUKS header on device %s."
+msgstr "Erro durante atualização de cabeçalho LUKS no dispositivo %s."
+
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Erro ao reler cabeçalho LUKS após atualização no dispositivo %s."
+
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "A posição de dados para cabeçalho LUKS deve ser 0 ou maior do que o tamanho do cabeçalho."
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Formato de UUID LUKS incorreto foi fornecido."
+
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Não foi possível criar cabeçalho LUKS: leitura de sal aleatório falhou."
+
+#: lib/luks1/keymanage.c:804
+#, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Não foi possível criar cabeçalho LUKS: resumo de cabeçalho falhou (usando hash %s)."
+
+#: lib/luks1/keymanage.c:848
+#, c-format
+msgid "Key slot %d active, purge first."
+msgstr "Slot de chave %d ativado, apagar primeiro."
+
+#: lib/luks1/keymanage.c:854
+#, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "O material do slot de chave %d inclui muito poucas barras. Manipulação do cabeçalho?"
+
+#: lib/luks1/keymanage.c:990
+#, fuzzy, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Erro de processamento de chave (usando hash %s)."
+
+#: lib/luks1/keymanage.c:1066
+#, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Slot de chave %d é inválido, por favor selecione um slot de chave entre 0 e %d."
+
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, c-format
+msgid "Cannot wipe device %s."
+msgstr "Não foi possível apagar o dispositivo %s."
+
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Detectado arquivo de chave criptografado com GPG ainda sem suporte."
+
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "Por favor use gpg --decrypt <ARQUIVO-CHAVE> | cryptsetup --keyfile=- ...\n"
+
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Arquivo de chave loop-AES incompatível detectado."
+
+#: lib/loopaes/loopaes.c:245
+#, fuzzy
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "O kernel não oferece suporte a mapeamento compatível com loop-AES."
+
+#: lib/tcrypt/tcrypt.c:504
+#, c-format
+msgid "Error reading keyfile %s."
+msgstr "Erro ao ler arquivo de chave %s."
+
+#: lib/tcrypt/tcrypt.c:554
+#, fuzzy, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Tamanho máximo de senha TCRYPT (%d) excedido."
+
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "Algoritmo hash PBKDF2 %s não disponível, ignorando."
+
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Interface necessário de criptografia do kernel não disponível."
+
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Certifique-se de que você tenha o módulo de kernel algif_skcipher carregado."
+
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "Não há suporte a ativação para o tamanho de setor %d."
+
+#: lib/tcrypt/tcrypt.c:759
+#, fuzzy
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "O kernel não oferece suporte a ativação para este modo legado TCRYPT."
+
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Ativando criptografia de sistema TCRYPT para partição %s."
+
+#: lib/tcrypt/tcrypt.c:871
+#, fuzzy
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "O kernel não oferece suporte a mapeamento compatível com TCRYPT."
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "Não há suporte a esta função sem carga de cabeçalho TCRYPT."
+
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Falha ao ler requisitos LUKS2."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Não há suporte ao tamanho de setor de criptografia."
+
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Falha ao ler requisitos LUKS2."
+
+#: lib/bitlk/bitlk.c:543
+#, fuzzy, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Falha ao ler requisitos LUKS2."
+
+#: lib/bitlk/bitlk.c:594
+#, fuzzy
+msgid "Unknown or unsupported encryption type."
+msgstr "Não há suporte ao tamanho de setor de criptografia."
+
+#: lib/bitlk/bitlk.c:627
+#, fuzzy, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Falha ao ler requisitos LUKS2."
+
+#: lib/bitlk/bitlk.c:921
+#, fuzzy
+msgid "This operation is not supported."
+msgstr "Não há suporte a esta operação para o dispositivo de criptografia %s."
+
+#: lib/bitlk/bitlk.c:929
+#, fuzzy
+msgid "Wrong key size."
+msgstr "Tamanho de chave inválida."
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1069
+#, fuzzy
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "A ativação de dispositivos temporários falhou."
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr ""
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, fuzzy, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Dispositivo verity %s não usa cabeçalho em disco."
+
+#: lib/verity/verity.c:90
+#, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "O dispositivo %s não é um dispositivo VERITY válido."
+
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Não há suporte ao VERITY versão %d."
+
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Cabeçalho VERITY corrompido."
+
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Formato de UUID VERITY inválido fornecido no dispositivo %s."
+
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Erro durante a atualização do cabeçalho verity no dispositivo %s."
+
+#: lib/verity/verity.c:256
+#, fuzzy
+msgid "Root hash signature verification is not supported."
+msgstr "Não há suporte ao hash requisitado %s."
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Os erros não puderam ser consertados com dispositivo FEC."
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Localizados %u erros corrigíveis com dispositivo FEC."
+
+#: lib/verity/verity.c:308
+#, fuzzy
+msgid "Kernel does not support dm-verity mapping."
+msgstr "O kernel não oferece suporte a mapeamento dm-verity."
+
+#: lib/verity/verity.c:312
+#, fuzzy
+msgid "Kernel does not support dm-verity signature option."
+msgstr "O kernel não oferece suporte a mapeamento dm-verity."
+
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "O dispositivo verity detectou corrompimento após ativação."
+
+#: lib/verity/verity_hash.c:59
+#, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Área disponível não está zerada na posição %<PRIu64>."
+
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Excesso na posição do dispositivo."
+
+#: lib/verity/verity_hash.c:203
+#, c-format
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Verificação falhou na posição %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Parâmetros de tamanho inválido para dispositivo verity."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Estouro de área de hash."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Verificação da área de dados falhou."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Verificação do hash raiz falhou."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Erro de entrada/saída enquanto criava área de hash."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Criação da área de hash falhou."
+
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "AVISO: O kernel não pode ativar um dispositivo se o tamanho do bloco de dados exceder o tamanho da página (%u)."
+
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Falha ao alocar contexto de RS."
+
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Falha ao alocar buffer."
+
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Falha ao ler byte %2$d de bloco RS %1$<PRIu64>."
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Falha ao ler paridade para o bloco RS %<PRIu64>."
+
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Falha ao corrigir paridade para o bloco %<PRIu64>."
+
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Falha ao escrever paridade para o bloco RS %<PRIu64>."
+
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Tamanhos de bolcos devem corresponder para FEC."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Número inválido de paridade de bytes."
+
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Falha ao determinar o tamanho para dispositivo %s."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+#, fuzzy
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "O kernel não oferece suporte a mapeamento dm-integrity."
+
+#: lib/integrity/integrity.c:277
+#, fuzzy
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "O kernel não oferece suporte a mapeamento dm-integrity."
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Falha ao obter trava de escrita no dispositivo %s."
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+"O dispositivo contém assinaturas ambíguas, falha ao autorrecuperar LUKS2.\n"
+"Por favor, execute \"cryptsetup repair\" para recuperação."
+
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "A posição dos dados requisitados é muito pequena."
+
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "AVISO: área de slot de chaves  (%<PRIu64> bytes) é muito pequena, a contagem de slot de chaves LUKS2 disponível é muito limitada.\n"
+
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Falha ao obter trava de leitura no dispositivo %s."
+
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Requisitos LUKS2 proibidos detectados na cópia de segurança %s."
+
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Posição de dados diverge entre dispositivo e cópia de segurança, restauração falhou."
+
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Cabeçalho binário com áreas de slot de chave diverge entre dispositivo e cópia de segurança, restauração falhou."
+
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Dispositivo %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "não contém cabeçalho LUKS2. A substituição do cabeçalho pode destruir dados naquele dispositivo."
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "já contém cabeçalho LUKS2. A substituição do cabeçalho vai destruir slots de chave existentes."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
+msgstr ""
+"\n"
+"AVISO: requisitos LUKS2 desconhecidos detectados em cabeçalho de\n"
+"dispositivo real! Substituir cabeçalho com cópia de segurança pode\n"
+"corromper os dados naquele dispositivo!"
+
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"AVISO: recriptografia offline não finalizada detectada no dispositivo!\n"
+"Substituir cabeçalho com cópia de segurança pode corromper os dados."
+
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Sinalizador desconhecido %s ignorado."
+
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "Falha ao consultar o segmento dm-%s."
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+#, fuzzy
+msgid "Failed to set dm-linear segment."
+msgstr "Falha ao consultar o segmento dm-%s."
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Falha ao ler requisitos LUKS2."
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Requisitos LUKS2 não atendidos detectados."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "Slot de chave %i: sal apagado."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, fuzzy, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Slot de chave LUKS2: A cifra usada para criptografia de slot de chave"
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Sem espaço para um novo slot de chave."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, fuzzy, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Não foi possível verificar status do dispositivo com uuid: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Não foi possível converter cabeçalho com metadados adicionais LUKSMETA."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Não foi possível mover área de slot de chave. Espaço insuficiente."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+#, fuzzy
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Não foi possível mover área de slot de chave. Espaço insuficiente."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Não foi possível mover área de slot de chave."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+#, fuzzy
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Não foi possível converter ao formato LUKS1 - o slot de chave %u não é compatível com LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Não foi possível converter ao formato LUKS1 - resumos de slot de chave não são compatíveis com LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Não foi possível converter para o formato LUKS1 - o dispositivo usa cifra de chave envolta %s."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Não foi possível converter para o formato LUKS1 - o cabeçalho LUKS2 contém %u token(s)."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Não foi possível converter para o formato LUKS1 - o slot de chave %u está em um estado inválido."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Não foi possível converter para o formato LUKS1 - o slot %u (acima do máximo de slots) ainda está ativo."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Não foi possível converter ao formato LUKS1 - o slot de chave %u não é compatível com LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, fuzzy, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Tamanho do dispositivo %s não está alinhado com o tamanho de setor requisitado (%u bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Não há suporte aos parâmetros no dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+#, fuzzy
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Falha ao inicializar as sondas de assinatura de dispositivo."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Falha ao inicializar as sondas de assinatura de dispositivo."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "Falha ao ler requisitos do cabeçalho de cópia de segurança."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, fuzzy, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Falha ao ler paridade para o bloco RS %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Falha ao remover o token %d.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, fuzzy, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Falha ao sondar o dispositivo %s por uma assinatura."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Falha ao determinar o tamanho para dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+#, fuzzy
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Falha ao obter trava de leitura no dispositivo %s."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "Falha ao trocar novo slot de chave."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, fuzzy, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Tamanho do dispositivo %s não está alinhado com o tamanho de setor requisitado (%u bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, fuzzy, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Tamanho do dispositivo %s não está alinhado com o tamanho de setor requisitado (%u bytes)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, fuzzy, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Não foi possível usar o dispositivo %s, o qual está em uso (já mapeado ou montado)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+#, fuzzy
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Falha ao alocar contexto de RS."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "Falha ao obter o token %d para exportação."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "O dispositivo \"%s\" não está ativado."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+#, fuzzy
+msgid "Reencryption process is already running."
+msgstr "Recriptografia já está em progresso."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+#, fuzzy
+msgid "Failed to acquire reencryption lock."
+msgstr "Falha ao obter trava de dispositivo de escrita."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2750
+#, fuzzy
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Tamanho do dispositivo não está alinhado com o tamanho de setor requisitado."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2834
+#, fuzzy
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Recriptografia já está em progresso."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2913
+#, fuzzy
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Falha ao inicializar os parâmetros padrão de slot de chave LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+#, fuzzy
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Falha ao sondar o dispositivo %s por uma assinatura."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+#, fuzzy
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Falha ao escrever sinalizadores de ativação para novo cabeçalho."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+#, fuzzy
+msgid "Decryption failed."
+msgstr "Correção falhou."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Falha ao escrever paridade para o bloco RS %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+#, fuzzy
+msgid "Failed to sync data."
+msgstr "Falha ao definir a posição de dados."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "Falha ao ler requisitos LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+#, fuzzy
+msgid "Failed to wipe backup segment data."
+msgstr "Falha ao apagar assinatura do dispositivo."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+#, fuzzy
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Falha ao ler requisitos LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "Falha ao inicializar as sondas de assinatura de dispositivo."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+#, fuzzy
+msgid "Failed to update reencryption context."
+msgstr "Falha ao alocar contexto de RS."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Nenhum slot de token livre."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Falha ao criar um token incorporado %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Não é possível fazer verificação de senha em entradas diferente de tty."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Parâmetros de criptografia de slot de chaves só pode ser definido para dispositivo LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Nenhum padrão de especificação de cifra conhecida foi detectada."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "AVISO: O parâmetro de --hash está sendo ignorado claro com o arquivo de chave especificado.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "AVISO: A opção --keyfile-size está sendo ignorada, o tamanho lido é o mesmo que o tamanho da chave de criptografia.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Detectada assinatura(s) de dispositivo em %s. Prosseguir pode danificar dados existentes."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Operação abortada.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "A opção --key-file é necessária."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Insira o PIM VeraCrypt: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Valor de PIM inválido: erro de análise."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Valor de PIM inválido: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Valor de PIM inválido: fora do intervalo."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Nenhum cabeçalho de dispositivo detectado com esta senha."
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "O dispositivo %s não é um dispositivo LUKS válido."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"O despejo de cabeçalho com chave de volume é uma informação sensível\n"
+"que permite acesso a uma partição criptografada sem senha.\n"
+"Este despejo deve sempre ser armazenado criptografado em um local seguro."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "O dispositivo %s ainda está ativo e agendado para a remoção atrasada.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Redimensionamento de dispositivo ativo requer chave de volume no chaveiro, mas a opção --disable-keyring está definida."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Teste interrompido."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     N/A\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u iterações por segundo para chave de %zu bits\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s N/D\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u iterações, %5u memória, %1u threads paralelas (CPUs) para chave de %zu bits (requisitado tempo de %u ms)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "O resultado do teste não é confiável."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Testes são aproximados usando apenas memória (sem E/S de armazenamento).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s Algoritmo |     Chave |    Criptografia | Descriptografia\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "A cifra %s-%s (tamanho de chave %zd bits) não está disponível."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#     Algoritmo |     Chave |    Criptografia | Descriptografia\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/D"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Digite uma senha para slot de chave a ser convertido: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Realmente tentar corrigir o cabeçalho do dispositivo LUKS?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Apando dispositivo para inicializar a verificação de soma de integridade.\n"
+"Você pode interromper isso pressionando CTRL+C (o resto dos dispositivo não apagado conterão verificação de soma inválida).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Não foi possível desativar o dispositivo temporário %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "A opção de integridade pode ser usada apenas para o formato LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Não há suporte às opções de tamanho de metadados LUKS."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Não foi possível criar o arquivo de cabeçalho %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Nenhum padrão de especificação de integridade conhecida foi detectado."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Não foi possível usar %s como um cabeçalho em disco."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Isto vai sobrescrever dados em %s permanentemente."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Falha ao definir os parâmetros de pbkdf."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Posição de dados reduzida é permitido apenas cabeçalho LUKS desanexado."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Dispositivo ativado, mas não foi possível tornar os sinalizadores persistentes."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Slot de chave %d selecionado para exclusão."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Este é o último slot de chave. O dispositivo se tornará não usável após apagar esta chave."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Digite qualquer senha remanescente: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Operação abortada, o slot de chave NÃO foi apagado.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Digite a senha para ser excluída: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Digite uma senha para o slot de chave: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Digite qualquer senha existente: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Digite a senha para ser alterada: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Digite uma nova senha: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Digite uma senha para slot de chave a ser convertido: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Há suporte apenas a um argumento de dispositivo para a operação isLuks."
+
+#: src/cryptsetup.c:2001
+#, fuzzy
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"O despejo de cabeçalho com chave de volume é uma informação sensível\n"
+"que permite acesso a uma partição criptografada sem senha.\n"
+"Este despejo deve sempre ser armazenado criptografado em um local seguro."
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "O slot de chave %d não está ativo."
+
+#: src/cryptsetup.c:2072
+#, fuzzy
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"O despejo de cabeçalho com chave de volume é uma informação sensível\n"
+"que permite acesso a uma partição criptografada sem senha.\n"
+"Este despejo deve sempre ser armazenado criptografado em um local seguro."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "A opção --header-backup-file é necessária."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s não é um dispositivo cryptsetup gerenciado."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "A renovação não oferece suporte a este tipo de dispositivo %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Tipo de dispositivo de metadados %s não reconhecido."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "O comando requer um dispositivo e nome mapeado como argumentos."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Esta operação vai apagar todos os slots de chave no dispositivo %s.\n"
+"O dispositivo se tornará não usável após esta operação."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Operação abortada, os slots de chave NÃO foram apagados.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Tipo de LUKS inválido, há suporte apenas a luks1 e luks2."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "O dispositivo já é do tipo %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Essa operação vai converter %s para o formato %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Operação abortada, o dispositivo NÃO foi convertido.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Está faltando a opção --priority, --label ou --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "O token %d é inválido."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "O token %d em uso."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Falha ao adicionar o token de chaveiro luks2 %d."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Falha ao atribuir o token %d ao slot de chave %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "O token %d não está em uso."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Falha ao abrir arquivo de chave."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Falha ao obter o token %d para exportação."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "O parâmetro --key-description é obrigatório para ação de adicionar token."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "A ação requer um token específico. Use o parâmetro --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Operação de token inválida %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "O dispositivo %s não é um dispositivo LUKS válido."
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "Dispositivo inválido %s."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "A opção de integridade pode ser usada apenas para o formato LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "O arquivo de cópia de segurança de cabeçalho requisitado %s já existe."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Não foi possível criar o arquivo de cabeçalho %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+#, fuzzy
+msgid "Not enough free keyslots for reencryption."
+msgstr "Não altera chave, nenhuma área de dados de recriptografia"
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "O arquivo de chave pode ser usado apenas com --key-slot ou com exatamente um slot de chave ativado."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Digite uma senha para o slot de chave %u: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Digite uma senha para o slot de chave %u: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "O comando requer um dispositivo e nome mapeado como argumentos."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Não há suporte a recriptografia de dispositivo com perfil de integridade."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+#, fuzzy
+msgid "LUKS2 device is not in reencryption."
+msgstr "Arquivo log %s existe, resumindo recriptografia.\n"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<dispositivo> [--type <tipo>] [<nome>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "abre dispositivo como <nome>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<nome>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "fecha dispositivo (remove mapeamento)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "redimensiona dispositivo ativado"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "mostra o estado do dispositivo"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <cifra>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "testa a cifra"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<dispositivo>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "tente corrigir os metadados em disco"
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "adiciona uma chave ao dispositivo LUKS"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "apaga todos os slots de chave (remove a chave de criptografia)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "converte formato LUKS de/para LUKS2"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "define opções de configuração permanentes para LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<dispositivo> [<novo arquivo de chave>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "formata um dispositivo LUKS"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "adiciona uma chave ao dispositivo LUKS"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<dispositivo> [<arquivo de chave >]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "remove a chave ou arquivo chave fornecidos do dispositivo LUKS"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "altera a chave ou arquivo chave fornecidos do dispositivo LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "converte uma chave aos novos parâmetros de pbkdf"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<dispositivo> <slot de chave>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "apaga chave com número <slot de chave> do dispositivo LUKS"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "emite UUID do dispositivo LUKS"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "testa <dispositivo> por cabeçalho de partição LUKS"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "despeja informação da partição LUKS"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "despeja informação do dispositivo TCRYPT"
+
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "despeja informação do dispositivo TCRYPT"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Suspende dispositivo LUKS e apaga chave (todas E/S ficam congeladas)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Resume dispositivo LUKS suspenso"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Faz uma cópia de segurança de slots de chave e cabeçalho de dispositivo LUKS"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Restaura slots de chave e cabeçalho de dispositivo LUKS"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <dispositivo>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Manipula tokens LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<ação> é um entre:\n"
+
+#: src/cryptsetup.c:3395
+#, fuzzy
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"Você também pode usar apelidos de sintaxe <ação> antigos:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<nome> é o dispositivo a ser criado sob %s\n"
+"<dispositivo> é o dispositivo criptografado\n"
+"<slot de chave> é o número do slot de chave LUKS a ser modificado\n"
+"<arquivo de chave> arquivo de chave opcional para a nova chave para a ação luksAddKey\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"O formato padrão de metadados compilados é %s (para a ação luksFormat).\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Parâmetros padrões de senha e chave compilados internamente:\n"
+"\tTamanho do arquivo chave máximo: %dkB, Tamanho máximo de senha interativa %d (caracteres)\n"
+"PBKDF padrão para LUKS1: %s, tempo de iteração: %d (ms)\n"
+"PBKDF padrão para LUKS2: %s\n"
+"\tTempo de iteração: %d: memória exigida: %dkB, Threads paralelas: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Parâmetros de cifra de dispositivo pré-compilados por padrão:\n"
+"\tloop-AES: %s, Chave %d bits\n"
+"\tplain: %s, Chave: %d bits, Hash de senha: %s\n"
+"\tLUKS: %s, Chave: %d bits, Hash de cabeçalho LUKS: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: keysize padrão com modo XTS (duas chaves internas) será duplicado.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: necessita %s como argumentos"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Mostra essa mensagem de ajuda"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Exibe instrução de uso"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Emite a versão do pacote"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Opções de ajuda:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Mostra mensagens de erro mais detalhadas"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Mostra mensagens de depuração"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Mostra mensagens de depuração incluindo metadados JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "A cifra usada para criptografar o disco (veja /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "A hash usada para criar a chave de criptografia a partir da senha"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Verifica a senha perguntando-a duas vezes"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Lê a chave de um arquivo"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "Lê a chave do volume (mestre) a partir do arquivo."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Despeja a chave de volume (mestre) ao invés da informação de slots de chave"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "O tamanho da chave de criptografia"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "BITS"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Limita a leitura do arquivo de chave"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "bytes"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Número de bytes a ignorar no arquivo de chave"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Limita a leitura do arquivo de chave recém-adicionado"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Número de bytes a ignorar em arquivo de chave recém-adicionado"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Número de slot para a nova chave (padrão é a primeira livre)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "O tamanho do dispositivo"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "SETORES"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Usa apenas o tamanho de dispositivo especificado (ignora o resto do dispositivo). PERIGOSO!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "A posição inicial do dispositivo de backend"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Quantos setores dos dados criptografados ignorar no começo"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Cria um mapeamento somente leitura"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Não solicitar confirmação"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Tempo limite para a solicitação interativa de senha (em segundos)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "s"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Atualização de linha de progresso (em segundos)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Com qual frequência a entrada da senha pode ser tentada novamente"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Alinha a carga em <n> limites de setores - para luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Arquivo cópia de segurança de slots de chave e cabeçalho LUKS"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Usa /dev/random para gerar chave de volume"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Usa /dev/urandom para gerar chave de volume"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Compartilha o dispositivo com um outro segmento de criptografia sem sobreposição"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID para dispositivo a ser usado"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Permite requisições de descartes (i.e. TRIM) para dispositivo"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Dispositivo ou arquivo com cabeçalho LUKS separado"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Não ativa o dispositivo, apenas verifica a senha"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Usa cabeçalho oculto (dispositivo TCRYPT oculto)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "O dispositivo é uma unidade TCRYPT de sistema (com carregador de inicialização)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Usa o cabeçalho TRCYPT secundário (cópia de segurança)"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Verifica também por dispositivo compatível com VeraCrypt"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Multiplicador de Iteração Pessoal (PIM) por dispositivo compatível com VeraCrypt"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Consulta Multiplicador de Iteração Pessoal (PIM) por dispositivo compatível com VeraCrypt"
+
+#: src/cryptsetup.c:3526
+#, fuzzy
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Tipo de metadados de dispositivo: luks, plain, loopaes, tcrypt"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Desabilita a verificação de qualidade da senha (se habilitada)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Usa a opção de compatibilidade de desempenho same_cpu_crypt do dm-crypt"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Usa a opção de compatibilidade de desempenho submit_from_crypt_cpus do dm-crypt"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "A remoção de dispositivo está adiada até o último usuário fechá-lo"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr ""
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Tempo de iteração PBKDF para LUKS (em ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ms"
+
+# argon2i, argon2id, pbkdf2 são opções, não traduzir.
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Algoritmo PBKDF (para LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "limite de custo de memória de PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilobytes"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Custo paralelo de PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "threads"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Custo de iterações de PBKDF (forçado, desabilita teste)"
+
+# ignore, normal e prefer são opções, não traduzir.
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Prioridade de slot de chave: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Desabilita travamento de metadados em disco"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Desabilita carregamento de chaves de volume via chaveiro do kernel"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Algoritmo de integridade de dados (LUKS2 apenas)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Desabilita jornal para dispositivo de integridade"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Não apaga o dispositivo após formatar"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Não pede por senha se ativação por token falhar"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Número de token (padrão: qualquer)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Descrição da chave"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Tamanho do setor de criptografia (padrão: 512 bytes)"
+
+#: src/cryptsetup.c:3548
+#, fuzzy
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Tamanho do setor de criptografia (padrão: 512 bytes)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Define sinalizadores de ativação persistentes para o dispositivo"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Define o rótulo para o dispositivo LUKS2"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Define o rótulo de subsistema para o dispositivo LUKS2"
+
+#: src/cryptsetup.c:3552
+#, fuzzy
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Cria slot de chave LUKS2 não associado (nenhum segmento de dados atribuído)"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Lê ou escreve o json de ou para um arquivo"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Tamanho de área de metadados de cabeçalho LUKS2"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Tamanho de área de slots de chave de cabeçalho LUKS2"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Renova (reativa) dispositivo com novos parâmetros"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Slot de chave LUKS2: O tamanho da chave de criptografia"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "Slot de chave LUKS2: A cifra usada para criptografia de slot de chave"
+
+#: src/cryptsetup.c:3559
+#, fuzzy
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Descriptografa permanentemente o dispositivo (remove criptografia)"
+
+#: src/cryptsetup.c:3560
+#, fuzzy
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Descriptografa permanentemente o dispositivo (remove criptografia)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Reduz tamanho do dispositivo de dados (move opção dos dados). PERIGOSO!"
+
+#: src/cryptsetup.c:3564
+#, fuzzy
+msgid "Maximal reencryption hotzone size."
+msgstr "Tamanho do bloco de recriptografia"
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
+
+#: src/cryptsetup.c:3566
+#, fuzzy
+msgid "Reencryption hotzone checksums hash"
+msgstr "Tamanho do bloco de recriptografia"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[OPÇÃO...] <ação> <ação-específica>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Faltando o argumento de <ação>."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Ação desconhecida."
+
+#: src/cryptsetup.c:3713
+#, fuzzy
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "As opções --refresh e --test-passphrase são mutuamente exclusivas.\n"
+
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr "A opção --deferred é apenas permitida para o comando de fechamento.\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "A opção --shared é permitida apenas para abertura de dispositivo claro.\n"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "A opção --allow-discards é permitida apenas para a operação de abertura.\n"
+
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "A opção --persistent é permitida apenas para a operação de abertura.\n"
+
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "A opção --allow-discards é permitida apenas para a operação de abertura.\n"
+
+#: src/cryptsetup.c:3743
+#, fuzzy
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "A opção --persistent não é permitida com --test-passphrase.\n"
+
+#: src/cryptsetup.c:3753
+#, fuzzy
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"A opção --key-size só é permitida para luksFormat, luksAddKey (com --unbound),\n"
+"ações de abertura e teste. Para limitar a leitura do arquivo de chave,\n"
+"use --keyfile-size=(bytes)."
+
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "A opção --integrity é permitida apenas para luksFormat (LUKS2).\n"
+
+#: src/cryptsetup.c:3764
+#, fuzzy
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "A opção --integrity-no-wipe só pode ser usada para ação de formato com extensão de integridade.\n"
+
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "As opções --label e --subsystem são permitidas apenas para luksFormat e operações de configuração de LUKS2.\n"
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "A opção --test-passphrase é permitida apenas para abertura de dispositivos LUKS e TCRYPT.\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Tamanho de chave deve ser um múltiplo de 8 bits"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "O slot de chave é inválido."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "A opção --key-file tem precedência sobre um argumento de arquivo de chave especificado."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "Número negativo para opção não permitido."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Apenas um argumento de --key-file é permitido."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Apenas uma das opções --use-[u]random são permitidas."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "A opção --use-[u]random é permitida apenas para luksFormat."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "A opção --uuid é permitida apenas para luksFormat e luksUUID."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "A opção --align-payload é permitida apenas para luksFormat."
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "As opçãos --luks2-metadata-size e --opt-luks2-keyslots-size são permitidas apenas para luksFormat com LUKS2."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Especificação inválida de tamanho de metadados LUKS2."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Especificação inválida de tamanho de slots de chave LUKS2."
+
+#: src/cryptsetup.c:3838
+#, fuzzy
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "As opções --align-payload e --offset não podem ser combinadas."
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Há suporte a --skip apenas para abertura de dispositivos claro e loopaes.\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Há suporte a --offset apenas para abertura de dispositivos claro e loopaes. e para luksFormat.\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Há suporte à opção --tcrypt-hidden, --tcrypt-system ou --tcrypt-backup apenas para dispositivo TCRYPT.\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "A opção --tcrypt-hidden não pode ser combinada com --allow-discards.\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Há suporte à opção --veracrypt apenas para o tipo de dispositivo TCRYPT.\n"
+
+#: src/cryptsetup.c:3873
+#, fuzzy
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Argumento inválido para o parâmetro --veracrypt-pim fornecido.\n"
+
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Há suporte à opção --veracrypt-pim apenas para dispositivos compatíveis com VeraCrypt.\n"
+
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Há suporte à opção --veracrypt-query-pim apenas para dispositivos compatíveis com VeraCrypt.\n"
+
+#: src/cryptsetup.c:3889
+#, fuzzy
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "As opções --veracrypt-pim e --veracrypt-query-pim são mutuamente exclusivas.\n"
+
+# ignore, normal, prefer são opções, não traduzir.
+#: src/cryptsetup.c:3896
+#, fuzzy
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "A opção --priority só pode ser ignore/normal/prefer.\n"
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+#, fuzzy
+msgid "Keyslot specification is required."
+msgstr "A especificação de slot de chave é exigido.\n"
+
+# argon2i, argon2id, pbkdf2 são opções, não traduzir.
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+#, fuzzy
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "A função de derivação de chave baseada em senha (PBKDF) só pode ser pbkdf2 ou argon2i/argon2id.\n"
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+#, fuzzy
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Iterações forçadas de PBKDF não podem ser compiladas com opção de tempo de iteração.\n"
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "Não há suporte a opção de tamanho de setor para este comando.\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+#, fuzzy
+msgid "Key size is required with --unbound option."
+msgstr "Tamanho de chave é necessário com a opção --unbound.\n"
+
+#: src/cryptsetup.c:3944
+#, fuzzy
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "A opção --unbound só pode ser usada com a ação luksAddKey.\n"
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "A opção --refresh só pode ser usada com a ação de abrir.\n"
+
+#: src/cryptsetup.c:3960
+#, fuzzy
+msgid "Cannot disable metadata locking."
+msgstr "Não foi possível desabilitar trava de metadados.\n"
+
+#: src/cryptsetup.c:3970
+#, fuzzy
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Especificação inválida de tamanho de dispositivo."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Especificação inválida de tamanho de dispositivo."
+
+#: src/cryptsetup.c:3981
+#, fuzzy
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Tamanho máximo de redução do dispositivo é 64 MB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Tamanho da redução deve ser múltiplo de 512 bytes (setores)."
+
+#: src/cryptsetup.c:3989
+#, fuzzy
+msgid "Invalid data size specification."
+msgstr "Especificação inválida de tamanho de dispositivo."
+
+#: src/cryptsetup.c:3994
+#, fuzzy
+msgid "Reduce size overflow."
+msgstr "Excesso na posição do dispositivo."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
+
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Tamanho da redução deve ser múltiplo de 512 bytes (setores)."
+
+#: src/cryptsetup.c:4006
+#, fuzzy
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "As opções --align-payload e --offset não podem ser combinadas."
+
+#: src/cryptsetup.c:4010
+#, fuzzy
+msgid "Options --device-size and --size cannot be combined."
+msgstr "As opções --align-payload e --offset não podem ser combinadas."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "As opções --ignore-corruption e --restart-on-corruption não podem ser usadas em conjunto.\n"
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Uma string salgada inválida foi especificada."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Não foi possível criar imagem hash %s para escrita."
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Não foi possível criar imagem FEC %s para escrita."
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Uma string hash raiz inválida foi especificada."
+
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "Dispositivo inválido %s."
+
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr "Não foi possível ler o arquivo de chave %s."
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<dispositivo-dados> <dispositivo-hash>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "formata o dispositivo"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<dispositivo-dados> <dispositivo-hash> <hash-raiz>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "verifica o dispositivo"
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<dispositivo-dados> <nome> <dispositivo-hash> <hash-raiz>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "mostra o estado do dispositivo ativado"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<dispositivo-hash>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "mostra informação em disco"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<nome> é o dispositivo a ser criado sob %s\n"
+"<dispositivo-dados> é o dispositivo de dados\n"
+"<dispositivo-hash> é o dispositivo contendo dados de verificação\n"
+"<hash-raiz> hash do nó raiz no <dispositivo-hash>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Parâmetros dm-verity pré-compilados por padrão:\n"
+"\tHash: %s, Bloco de dados (bytes): %u, Bloco de hash (bytes): %u, Tamanho salgado: %u, Formato hash: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Não usa superbloco verity"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Tipo de formato (1 - normal, 0 - Chrome OS original)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "número"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Tamanho de bloco no dispositivo de dados"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Tamanho de bloco no dispositivo de hash"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "Bytes de paridade FEC"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "O número de blocos no arquivo de dados"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "blocos"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Caminho para dispositivo com dados de correção de erro"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "caminho"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Posição inicial no dispositivo de hash"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Posição inicial no dispositivo FEC"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Algoritmo hash"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "string"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Sal"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "string hexa"
+
+#: src/veritysetup.c:478
+#, fuzzy
+msgid "Path to root hash signature file"
+msgstr "Criação da área de hash falhou."
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Reinicia o kernel, se um corrompimento for detectado"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ignora corrompimento, apenas registra no log"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Não verifica por blocos zerados"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Verifica bloco de dados apenas na primeira vez que é lido"
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "O uso da opção --ignore-corruption, --restart-on-corruption ou --ignore-zero-blocks é permitido apenas para operação de abertura.\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "A opção --integrity-recalculate só pode ser usada para ação de abrir."
+
+#: src/veritysetup.c:592
+#, fuzzy
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "As opções --ignore-corruption e --restart-on-corruption não podem ser usadas em conjunto.\n"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Não foi possível ler o arquivo de chave %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Não foi possível ler %d bytes do arquivo de chave %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formatado com tamanho de tag %u, integridade interna %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<dispositivo_integridade>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<dispositivo_integridade> <nome>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<nome> é o dispositivo a ser criado sob %s\n"
+"<dispositivo_integridade> é o dispositivo com dados com tags de integridade\n"
+
+#: src/integritysetup.c:507
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Parâmetros dm-integrity compilados por padrão:\n"
+"\tTamanho Tag: %u bytes, Algoritmo de soma de verificação: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Caminho para dispositivo de dados (se separado)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Tamanho do journal"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Intercalar setores"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Marca d'água do jornal"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "porcentagem"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Tempo de commit do journal"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Tamanho de tag (por setor)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Tamanho do setor"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Tamanho de buffers"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Algoritmo de integridade de dados"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "O tamanho da chave de integridade de dados"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Lê a chave de integridade de um arquivo"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Algoritmo de integridade de journal"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "O tamanho da chave de integridade de journal"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Lê a chave de integridade de journal de um arquivo"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Algoritmo de criptografia de journal"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "O tamanho da chave de criptografia de journal"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Lê a chave de criptografia de journal de um arquivo"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Modo de recuperação (sem journal, sem verificação de tag)"
+
+#: src/integritysetup.c:575
+#, fuzzy
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Desabilita jornal para dispositivo de integridade"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Recalcula tags iniciais automaticamente."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "A opção --integrity-recalculate só pode ser usada para ação de abrir."
+
+#: src/integritysetup.c:669
+#, fuzzy
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "As opções --journal-size, --interleave-sectors, --sector-size, --tag-size e --no-wipe só podem ser usadas para ação de formatação.\n"
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Especificação inválida de tamanho de journal."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "As opções de arquivo de chave e tamanho de chave devem ser especificadas."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Um algoritmo de integridade deve ser especificado se uma chave de integridade é usada."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "As opções de arquivo de chave de integridade de journal e tamanho de chave devem ser especificadas."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Um algoritmo de integridade de journal deve ser especificado se uma chave de integridade de journal é usada."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "As opções de arquivo de chave de criptografia de journal e tamanho de chave devem ser especificadas."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Um algoritmo de criptografia de journal deve ser especificado se uma chave de criptografia de journal é usada."
+
+#: src/integritysetup.c:703
+#, fuzzy
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "As opções --refresh e --test-passphrase são mutuamente exclusivas.\n"
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
+
+#: src/integritysetup.c:711
+#, fuzzy
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "A opção de integridade pode ser usada apenas para o formato LUKS2."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Recriptografia já está em progresso."
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Não foi possível abrir exclusivamente %s, dispositivo em uso."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "A alocação de memória alinhada falhou."
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "Não foi possível ler o dispositivo %s."
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Marcando o dispositivo LUKS1 %s como não usável."
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Definindo o sinalizador de recriptografia offline do LUKS2 no dispositivo %s."
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Não foi possível escrever o dispositivo %s."
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Não foi possível escrever o arquivo log de recriptografia."
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Não foi possível abrir o arquivo log de recriptografia."
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Arquivo log %s existe, resumindo recriptografia.\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Ativando dispositivo temporário usando antigo cabeçalho LUKS."
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Ativando dispositivo temporário usando novo cabeçalho LUKS."
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "A ativação de dispositivos temporários falhou."
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Falha ao definir a posição de dados."
+
+#: src/cryptsetup_reencrypt.c:565
+#, fuzzy
+msgid "Failed to set metadata size."
+msgstr "Falha ao definir a posição de dados."
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Novo cabeçalho LUKS para dispositivo %s criado."
+
+# "cryptsetup-reencrypt" é o nome do programa, não traduzir.
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Essa versão de cryptsetup-reencrypt não sabe lidar com o novo tipo de token interno %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Falha ao ler sinalizadores de ativação do cabeçalho de cópia de segurança."
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Falha ao escrever sinalizadores de ativação para novo cabeçalho."
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Falha ao ler requisitos do cabeçalho de cópia de segurança."
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "Cópia de segurança de cabeçalho %s para dispositivo %s criado."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "A criação de cópia de segurança de cabeçalhos LUKS falhou."
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Não foi possível restaurar o cabeçalho %s no dispositivo %s."
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "Cabeçalho %s no dispositivo %s restaurado."
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Não foi possível abrir o dispositivo LUKS temporário."
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Não foi possível obter o tamanho do dispositivo."
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Erro de E/S durante a recriptografia."
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "O UUID fornecido é inválido."
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Não foi possível abrir o arquivo log de recriptografia."
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Nenhuma descriptografia em progresso, UUID fornecido pode ser usado apenas para resumir um processo de descriptografia suspendido."
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Alterados os parâmetros de pbkdf no slot de chave %i."
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Tamanho do bloco de recriptografia"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MB"
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Não altera chave, nenhuma área de dados de recriptografia"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Lê nova chave do volume (mestre) a partir do arquivo"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Tempo de iteração PBKDF2 para LUKS (em ms)"
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Usa direct-io ao acessar dispositivos"
+
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Usa fsync após cada bloco"
+
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Atualiza o arquivo log após todo bloco"
+
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Usa apenas este slot (outros serão desabilitados)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Cria um novo cabeçalho em dispositivo não criptografado"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Descriptografa permanentemente o dispositivo (remove criptografia)"
+
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "A UUID usada para resumir a descriptografia"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Tipo de metadados LUKS: luks1, luks2"
+
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[OPÇÃO...] <dispositivo>"
+
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Recriptografia vai alterar: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "chave de volume"
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "definir hash para "
+
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", definir cifra para "
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Argumento necessário."
+
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Apenas valores entre 1 MB e 64 MB são permitidos para tamanho de bloco de recriptografia."
+
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "Tamanho máximo de redução do dispositivo é 64 MB."
+
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "A opção --new deve ser usada junto de --reduce-device-size ou --header."
+
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "A opção --keep-key pode ser usada apenas com --hash, --iter-time ou --pbkdf-force-iterations."
+
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "A opção --new não pode ser usada junto de --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "A opção --decrypt é incompatível com os parâmetros especificados."
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "A opção --uuid é permitida apenas junto de --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Tipo de luks inválido. Use um desses: \"luks\", \"luks1\" ou \"luks2\"."
+
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Erro ao ler resposta do terminal."
+
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Comando executado com sucesso.\n"
+
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "parâmetros errados ou faltando"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "sem permissão ou senha incorreta"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "memória insuficiente"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "dispositivo ou arquivo errado especificado"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "o dispositivo já existe ou está ocupado"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "erro desconhecido"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "O comando falhou com código %i (%s).\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Slot de chave %i criado."
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Slot de chave %i desbloqueado."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Slot de chave %i removido."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Token %i criado."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Token %i removido."
+
+#: src/utils_tools.c:464
+#, fuzzy
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Escrita interrompida."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "AVISO: O dispositivo %s já contém uma assinatura de partição \"%s\".\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "AVISO: O dispositivo %s já contém uma assinatura de superbloco \"%s\".\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Falha ao inicializar as sondas de assinatura de dispositivo."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Falha ao obter estado do dispositivo %s."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "O dispositivo %s está em uso. Não é possível proceder com a operação de formatação."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Falha ao abrir o arquivo %s no modo leitura/escrita."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Falha ao apagar assinatura do dispositivo."
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Falha ao sondar o dispositivo %s por uma assinatura."
+
+#: src/utils_tools.c:629
+#, fuzzy
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Leitura interrompida."
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Não foi possível verificar qualidade da senha: %s"
+
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+"Verificação de qualidade da senha falhou:\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Verificação de qualidade da senha falhou: Senha incorreta (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Erro ao ler senha do terminal."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Verificar senha: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "As senhas não conferem."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Não foi possível usar posição com a entrada do terminal."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Digite a senha: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Digite a senha para %s: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Nenhuma chave disponível com esta senha."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr ""
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Não foi possível abrir o arquivo de chave %s para escrita."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Não foi possível escrever no arquivo de chave %s."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Falha ao abrir o arquivo %s no modo somente leitura."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Forneça um JSON de token LUKS2 válido:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Falha ao ler o arquivo JSON."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Leitura interrompida."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Falha ao abrir o arquivo %s no modo escrita."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Escrita interrompida."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Falha ao escrever arquivo JSON."
+
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Não há suporte às opções de desempenho de dmcrypt requisitadas."
+
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Não foi possível formatar o dispositivo %s, o qual ainda está em uso."
+
+#~ msgid "Key slot %d is not used."
+#~ msgstr "O slot de chave %d não está sendo usado."
+
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Função não disponível no modo FIPS."
+
+#~ msgid "Cipher %s is not available."
+#~ msgstr "A cifra %s não está disponível."
+
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Slot de chave %d selecionado para exclusão."
+
+#~ msgid "open device as mapping <name>"
+#~ msgstr "abre dispositivo como mapeamento <nome>"
+
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands.\n"
+#~ msgstr "O parâmetro --refresh é apenas permitida com comandos de abrir ou renovar.\n"
+
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Não há suporte ao tamanho de setor de criptografia.\n"
+
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "fecha dispositivo (desativa e remove mapeamento)"
+
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Falha ao definir os parâmetros de sessão PBKDF."
+
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Não foi possível ir à posição do dispositivo.\n"
+
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Interrompido por um sinal."
+
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "Dispositivo %s é muito pequeno. (LUKS2 precisa de pelo menos %<PRIu64> bytes.)"
+
+#, fuzzy
+#~| msgid "Replaced with key slot %d.\n"
+#~ msgid "Replaced with key slot %d."
+#~ msgstr "Substituído com o slot de chave %d.\n"
+
+#, fuzzy
+#~| msgid "Missing LUKS target type, option --type is required.\n"
+#~ msgid "Missing LUKS target type, option --type is required."
+#~ msgstr "Faltando o tipo de alvo LUKS, a opção --type é necessária.\n"
+
+#, fuzzy
+#~| msgid "Missing --token option specifying token for removal.\n"
+#~ msgid "Missing --token option specifying token for removal."
+#~ msgstr "Faltando a opção --token especificando token para remoção.\n"
+
+#~ msgid "Add or remove keyring token"
+#~ msgstr "Adiciona ou remove o token de chaveiro"
+
+#, fuzzy
+#~| msgid "Activated keyslot %i.\n"
+#~ msgid "Activated keyslot %i."
+#~ msgstr "Slot de chave %i ativado.\n"
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "erro de alocação de memória em action_luksFormat"
+
+#, fuzzy
+#~| msgid "Key slot is invalid."
+#~ msgid "Key slot is invalid.\n"
+#~ msgstr "O slot de chave é inválido."
+
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Número excessivo de níveis de árvore para volume verity.\n"
+
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Chave %d não ativada. Não é possível apagar.\n"
+
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<nome> <dispositivo-dados> <dispositivo-hash> <hash-raiz>"
+
+#~ msgid "create active device"
+#~ msgstr "cria um dispositivo ativado"
+
+#~ msgid "remove (deactivate) device"
+#~ msgstr "remove (desativa) o dispositivo"
+
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Progresso: %5.1f%%, ETA %02llu:%02llu, %4llu MB escrito, vel. %5.1f MB/s%s"
+
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Não foi possível localizar um dispositivo de loop livre.\n"
+
+# Ponto final acrescentado, pois as mensagens em volta possível, sugerindo ser necessário aqui também.
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Não foi possível abrir o dispositivo %s.\n"
+
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Não é possível usar o UUID passado a menos que descriptografia estiver em progresso.\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "Marcando o dispositivo LUKS %s como usável.\n"
diff --git a/po/ru.gmo b/po/ru.gmo
new file mode 100644 (file)
index 0000000..44a34d6
Binary files /dev/null and b/po/ru.gmo differ
diff --git a/po/ru.po b/po/ru.po
new file mode 100644 (file)
index 0000000..8b6a4b6
--- /dev/null
+++ b/po/ru.po
@@ -0,0 +1,4364 @@
+# Russian translation for cryptsetup
+# Copyright (C) 2018 Free Software Foundation, Inc.
+# This file is distributed under the same license as the cryptsetup package.
+#
+# Rosetta Contributors and Canonical Ltd <EMAIL@ADDRESS>, 2007.
+# Eugene Roskin <Unknown>, 2016.
+# Yuri Kozlov <yuray@komyakino.ru>, 2018, 2019, 2020.
+msgid ""
+msgstr ""
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
+"Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-21 07:25+0300\n"
+"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
+"Language-Team: Russian <gnu@d07.ru>\n"
+"Language: ru\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+"X-Launchpad-Export-Date: 2018-12-03 15:52+0000\n"
+"X-Generator: Lokalize 2.0\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Не удалось инициализировать device-mapper, выполняется без прав суперпользователя."
+
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Не удалось инициализировать device-mapper. Загружен ли модуль ядра dm_mod?"
+
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Запрошенный флаг отсрочки не поддерживается."
+
+#: lib/libdevmapper.c:1198
+#, c-format
+msgid "DM-UUID for device %s was truncated."
+msgstr "У устройства %s был обрезан DM-UUID."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Неизвестный тип цели dm."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Запрошенные параметры производительности dm-crypt не поддерживаются."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Запрошенные параметры обработки повреждённых данных dm-verify не поддерживаются."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Запрошенные параметры FEC dm-verify не поддерживаются."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Запрошенные параметры целостности данных не поддерживаются."
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Запрошенный параметр sector_size не поддерживается."
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Запрошенный автоматический пересчёт тегов целостности не поддерживается."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Discard/TRIM не поддерживается."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Запрошенный режим битовой карты dm-integrity не поддерживается."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Ошибка при запросе сегмента dm-%s."
+
+#: lib/random.c:75
+msgid ""
+"System is out of entropy while generating volume key.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
+msgstr ""
+"При генерации ключа тома в системе закончились данные энтропии.\n"
+"Подвигайте мышь или наберите любой текст в другом окне, чтобы возникли случайные события.\n"
+
+#: lib/random.c:79
+#, c-format
+msgid "Generating key (%d%% done).\n"
+msgstr "Генерация ключа (выполнена на %d%%).\n"
+
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Выполнение в режиме FIPS."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "При инициализации RNG возникла критическая ошибка."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Запрошено неизвестное качество RNG."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Ошибка чтения из RNG."
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Невозможно инициализировать внутренний интерфейс crypto RNG."
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Невозможно инициализировать внутренний интерфейс crypto."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Алгоритм хэширования %s не поддерживается."
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Ошибка обработки ключа (используется хэш %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Невозможно определить тип устройства. Несовместимая активация устройства?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Эта операция поддерживается только для устройства LUKS."
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Эта операция поддерживается только для устройства LUKS2."
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Заполнены все слоты ключей."
+
+#: lib/setup.c:434
+#, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Некорректный слот ключа %d, укажите значение между 0 и %d."
+
+#: lib/setup.c:440
+#, c-format
+msgid "Key slot %d is full, please select another one."
+msgstr "Слот ключа %d заполнен, выберите другой."
+
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "Размер устройства не выровнен к размеру логического блока устройства."
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Обнаружен заголовок, но устройство %s слишком маленькое."
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Эта операция не поддерживается для этого типа устройств."
+
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Недопустимая операция во время работы перешифрования."
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "Неподдерживаемая версия LUKS %d."
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Отсоединение устройства метаданных не поддерживается для этого типа crypt."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, c-format
+msgid "Device %s is not active."
+msgstr "Устройство %s не активно."
+
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Исчезло нижележащее устройство у устройства crypt %s."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Неверные параметры plain crypt."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Неверный размер ключа."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "Для данного типа crypt UUID не поддерживается."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Неподдерживаемый размер сектора шифрования."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Размер устройства не выровнен к запрошенному размеру сектора."
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Невозможно отформатировать LUKS без устройства."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Запрошенный тип выравнивания данных не совместим со смещением данных."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: смещение данных находится за пределами доступного в данный момент устройства данных.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "невозможно затереть заголовок на устройстве %s."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: Активация устройства завершится ошибкой, так как отсутствует поддержка dm-crypt для запрошенного размера сектора шифрования.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Ключ тома слишком мал для шифрования с целостными расширениями."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Шифр %s-%s (размер ключа %zd бит) недоступен."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: размер метаданных LUKS2 изменился и стал %<PRIu64> байт.\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: размер слотов ключа LUKS2 изменился и стал %<PRIu64> байт.\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "Устройство %s слишком маленькое."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Невозможно отформатировать устройство %s, которое используется."
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Невозможно отформатировать устройство %s, недостаточно прав."
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Невозможно отформатировать целостность для устройства %s."
+
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "Невозможно отформатировать устройство %s."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Невозможно отформатировать LOOPAES без устройства."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Невозможно отформатировать VERITY без устройства."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "Неподдерживаемый тип хэша %d для VERITY."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Неподдерживаемый размер блока для VERITY."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Неподдерживаемое смещение хэша для VERITY."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Неподдерживаемое смещение FEC для VERITY."
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Область данных перекрывает области хэша."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Область хэша перекрывает область FEC."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Область данных перекрывает область FEC."
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: запрошенный размер тега в %d байт отличается от выходного размера %s (%d байт).\n"
+
+#: lib/setup.c:2286
+#, c-format
+msgid "Unknown crypt device type %s requested."
+msgstr "Запрошен неизвестный тип устройства crypt %s."
+
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "Неподдерживаемые параметры для устройства %s."
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Несовпадение параметров для устройства %s."
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Несоответствие устройств crypt."
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "Ошибка при перезагрузке устройства %s."
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, c-format
+msgid "Failed to suspend device %s."
+msgstr "Ошибка при приостановке устройства %s."
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Ошибка при возобновлении работы устройства %s."
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Критическая ошибка при перезагрузке устройства %s (поверх устройства %s)."
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Ошибка при переключении устройства %s на dm-error."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Невозможно изменить размер закольцованного (loop) устройства."
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "Вы действительно хотите изменить UUID устройства?"
+
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Файл резервного заголовка не содержит заголовка совместимого с LUKS."
+
+#: lib/setup.c:3058
+#, c-format
+msgid "Volume %s is not active."
+msgstr "Том %s не активен."
+
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
+msgstr "Том %s уже приостановлен."
+
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "Приостановка не поддерживается устройством %s."
+
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "Ошибка во время приостановки устройства %s."
+
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "Том %s не приостановлен."
+
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
+msgstr "Возобновление не поддерживается устройством %s."
+
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "Ошибка во время возобновления устройства %s."
+
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Ключ тома не подходит к тому."
+
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Невозможно добавить слот ключа, все слоты отключены и не предоставлен ключ тома."
+
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Ошибка при переключении на новый слот ключа."
+
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Некорректный слот ключа %d."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Слот ключа %d не активен."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Заголовок устройства перекрывает область данных."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Выполняется перешифрование. Невозможно активировать устройство."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Ошибка при получении блокировки перешифрования."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Ошибка восстановления перешифрования LUKS2."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Тип устройства инициализирован неправильно."
+
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Невозможно использовать устройство %s, некорректное имя или оно всё ещё используется."
+
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "Устройство %s уже существует."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Для устройства plain указан некорректный ключ тома."
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Некорректный корневой хэш для указанного устройства verity."
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Требуется подпись корневого хэша."
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Отсутствует связка ключей ядра: требуется для передачи подписи в ядро."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Ошибка при загрузке ключа в связку ключей ядра."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Устройство %s всё ещё используется."
+
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "Неверное устройство %s."
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Буфер ключа тома слишком мал."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Невозможно получить ключ тома для устройства plain."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Невозможно получить корневой хэш для устройства verity."
+
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Эта операция не поддерживается для устройства crypt %s."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Операция дампа не поддерживается для устройства этого типа."
+
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Смещение данных не кратно %u байтам."
+
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Невозможно преобразовать устройство %s, которое всё ещё используется."
+
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Ошибка при назначении слота ключа %u в качестве нового ключа тома."
+
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Ошибка при инициализации параметров слота ключа по умолчанию LUKS2."
+
+#: lib/setup.c:5851
+#, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Ошибка при назначении слота ключа %d дайджесту."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Связка ключей ядра не поддерживается ядром."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Не удалось прочитать парольную фразу из связки ключей (ошибка %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Не удалось захватить глобальную блокировку сериализации доступа на скорости памяти (memory-hard)."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Невозможно получить приоритет процесса."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Невозможно разблокировать память."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Не удалось открыть файл ключа."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Невозможно прочитать файл ключа с терминала."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Не удалось выполнить stat для файла ключа."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Невозможно переместиться по запрошенному смещению в файле ключа."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Не хватило памяти при чтении парольной фразы."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Ошибка чтения парольной фразы."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Нет ничего для чтения со стандартного ввода."
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Превышен максимальный размер файла ключа."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "невозможно прочитать запрошенное количество данных."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Устройство %s не существует или отказано в доступе."
+
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Устройство %s несовместимо."
+
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Устройство %s слишком маленькое. Требуется не менее %<PRIu64> байт."
+
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Невозможно использовать устройство %s, которое используется (отображено или примонтировано)."
+
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Невозможно использовать устройство %s, недостаточно прав."
+
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Невозможно получить информацию об устройстве %s."
+
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Невозможно использовать закольцованное устройство, выполняется без прав суперпользователя."
+
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Ошибка при присоединении закольцованного устройства (требуется закольцованное устройство с флагом autoclear)."
+
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Запрошенный размер вне реального размера устройства %s."
+
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Устройство %s имеет нулевой размер."
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Запрошенное время цели PBKDF не может быть нулевым."
+
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Неизвестный тип PBKDF %s."
+
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Запрошенный хэш %s не поддерживается."
+
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Запрошенный тип PBKDF %s не поддерживается в LUKS1."
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Максимальный размер памяти PBKDF и количество параллельных нитей нельзя задавать вместе с pbkdf2."
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Навязанный счётчик итераций слишком мал для %s (минимальное значение равно %u)."
+
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Навязанная стоимость памяти слишком мала для %s (минимальное значение равно %u килобайт)."
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Запрошенная максимальная стоимость памяти PBKDF слишком высока (максимальное значение равно %d килобайт)."
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Запрошенная максимальная стоимость памяти PBKDF не может быть равна нулю."
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Запрошенное количество параллельных нитей PBKDF не может быть нулевым."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "В режиме FIPS поддерживается только PBKDF2."
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Оценка производительности PBKDF выключена, но не задано количество итераций."
+
+#: lib/utils_benchmark.c:191
+#, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Несовместимые параметры PBKDF2 (используется алгоритм хэширования %s)."
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Несовместимые параметры PBKDF."
+
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Блокировка прервана. Путь блокировки %s/%s использовать невозможно (не является каталогом или отсутствует)."
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: Каталог блокировки %s/%s отсутствует!\n"
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Блокировка прервана. Путь блокировки %s/%s использовать невозможно (%s не является каталогом)."
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Невозможно перемещаться по устройству."
+
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Ошибка затирания устройства, смещение %<PRIu64>."
+
+#: lib/luks1/keyencryption.c:39
+#, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"Ошибка при настройке отображения ключей dm-crypt для устройства %s.\n"
+"Убедитесь, что ядро поддерживает шифр %s (подробности смотрите в syslog)."
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Размер ключа в режиме XTS должен быть 256 или 512 бит."
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "Шифр должен указываться в формате [шифр]-[режим]-[iv]."
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "Невозможно записать на устройство %s, недостаточно прав."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Не удалось открыть временное устройство keystore."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Не удалось получить доступ к временному устройству keystore."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Ошибка ввода-вывода при шифровании слота ключа."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Невозможно открыть устройство %s."
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Ошибка ввода-вывода при расшифровке слота ключа."
+
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Устройство %s слишком маленькое (для LUKS1 требуется не менее %<PRIu64> байт)."
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "Некорректный слот ключа LUKS %u."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "Устройство %s не является корректным устройством LUKS."
+
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, c-format
+msgid "Requested header backup file %s already exists."
+msgstr "Запрошенный файл резервного заголовка %s уже существует."
+
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
+msgstr "Невозможно создать файл резервного заголовка %s."
+
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
+msgstr "Невозможно записать файл резервного заголовка %s."
+
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Резервный файл не содержит корректный заголовок LUKS."
+
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, c-format
+msgid "Cannot open header backup file %s."
+msgstr "Невозможно открыть файл резервного заголовка %s."
+
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, c-format
+msgid "Cannot read header backup file %s."
+msgstr "Невозможно прочитать файл резервного заголовка %s."
+
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Смещение данных или размер ключа различаются на устройстве и в резервной копии, восстановление невозможно."
+
+#: lib/luks1/keymanage.c:325
+#, c-format
+msgid "Device %s %s%s"
+msgstr "Устройство %s %s%s"
+
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "не содержит заголовка LUKS. Замена заголовка может уничтожить данные на этом устройстве."
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "уже содержит заголовок LUKS. Замена заголовка уничтожит существующие слоты ключей."
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
+msgstr ""
+"\n"
+"ПРЕДУПРЕЖДЕНИЕ: заголовок устройства и резервная копия содержат разные UUID!"
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Нестандартный размер ключа, требуется исправление вручную."
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Нестандартное выравнивание слотов ключей, требуется исправление вручную."
+
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Исправление слотов ключей."
+
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Слот ключа %i: исправлено смещение (%u -> %u)."
+
+#: lib/luks1/keymanage.c:417
+#, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Слот ключа %i: исправлены полосы (%u -> %u)."
+
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Слот ключа %i: фиктивная подпись раздела."
+
+#: lib/luks1/keymanage.c:431
+#, c-format
+msgid "Keyslot %i: salt wiped."
+msgstr "Слот ключа %i: соль затёрта."
+
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Запись заголовка LUKS на диск."
+
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Ошибка при исправлении."
+
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, c-format
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Запрошенный хэш LUKS %s не поддерживается."
+
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Известных неполадок в заголовке LUKS не обнаружено."
+
+#: lib/luks1/keymanage.c:660
+#, c-format
+msgid "Error during update of LUKS header on device %s."
+msgstr "Ошибка при обновлении заголовка LUKS на устройстве %s."
+
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Ошибка при повторном считывании заголовка LUKS после обновления на устройстве %s."
+
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Смещение данных заголовка LUKS должно быть равно 0 или быть больше размера заголовка."
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Указан неправильный формат LUKS UUID."
+
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Невозможно создать заголовок LUKS: ошибка при чтении случайной соли."
+
+#: lib/luks1/keymanage.c:804
+#, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Невозможно создать заголовок LUKS: ошибка подсчёта дайджеста заголовка (используйте хэш %s)."
+
+#: lib/luks1/keymanage.c:848
+#, c-format
+msgid "Key slot %d active, purge first."
+msgstr "Активен слот ключа %d, сначала нужна вычистка."
+
+#: lib/luks1/keymanage.c:854
+#, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Данный слота ключа %d содержат несколько полос. Подделка заголовка?"
+
+#: lib/luks1/keymanage.c:990
+#, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Невозможно открыть слот ключа (используется хэш %s)."
+
+#: lib/luks1/keymanage.c:1066
+#, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Некорректный слот ключа %d, значение слота ключа должно быть между 0 и %d."
+
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, c-format
+msgid "Cannot wipe device %s."
+msgstr "Невозможно затереть устройство %s."
+
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Обнаружен пока не поддерживаемый зашифрованный файл ключа GPG."
+
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "Используйте gpg --decrypt <ФАЙЛ_КЛЮЧА> | cryptsetup --keyfile=- …\n"
+
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Обнаружен несовместимый файл ключа loop-AES."
+
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Ядро не поддерживает совместимое отображение loop-AES."
+
+#: lib/tcrypt/tcrypt.c:504
+#, c-format
+msgid "Error reading keyfile %s."
+msgstr "Ошибка при чтении файла ключа %s."
+
+#: lib/tcrypt/tcrypt.c:554
+#, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Превышена максимальная длина парольной фразы TCRYPT (%zu)."
+
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "Алгоритм хэширования PBKDF2 %s недоступен, пропускается."
+
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Требуемый интерфейс ядра crypto недоступен."
+
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Убедитесь, что загружен ядерный модуль algif_skcipher."
+
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "Активация не поддерживается при размере сектора %d."
+
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Ядро не поддерживает активацию для данного устаревшего режима TCRYPT."
+
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Активируется система шифрования TCRYPT для раздела %s."
+
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Ядро не поддерживает совместимое отображение TCRYPT."
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "эта функция не поддерживается без загрузки заголовка TCRYPT."
+
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "При анализе поддерживаемого главного ключа тома обнаружен неожиданный тип элемента метаданных «%u»."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "При анализе поддерживаемого главного ключа тома обнаружена некорректная строка."
+
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "При анализе поддерживаемого главного ключа тома обнаружена неожиданная строка («%s»)."
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "При анализе поддерживаемого главного ключа тома обнаружено неожиданное значение элемента метаданных «%u»."
+
+#: lib/bitlk/bitlk.c:479
+#, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Ошибка чтения подписи BITLK из %s."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "BITLK версии 1 пока не поддерживается."
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Некорректная или неизвестная подпись загрузчика устройства BITLK."
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Некорректная или неизвестная подпись устройства BITLK."
+
+#: lib/bitlk/bitlk.c:510
+#, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Неподдерживаемый размер сектора %<PRIu16>."
+
+#: lib/bitlk/bitlk.c:518
+#, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Ошибка чтения заголовка BITLK из %s."
+
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Ошибка чтения метаданных BITLK FVE из %s."
+
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Неизвестный или неподдерживаемый тип шифрования."
+
+#: lib/bitlk/bitlk.c:627
+#, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Ошибка чтения элементов метаданных BITLK из %s."
+
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Эта операция не поддерживается."
+
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Неверный размер ключа."
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Данное устройство BITLK находится в неподдерживаемом состоянии и не может быть включено."
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "Устройства BITLK с типом «%s» не могут быть включены."
+
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Активация частично расширенного устройства BITLK не поддерживается."
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Невозможно активировать устройство, в ядерном dm-crypt отсутствует поддержка BITLK IV."
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Невозможно активировать устройство, в ядерном dm-crypt отсутствует поддержка BITLK Elephant diffuser."
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Устройство verity %s не использует заголовок на диске."
+
+#: lib/verity/verity.c:90
+#, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "Устройство %s не является корректным устройством VERITY."
+
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Неподдерживаемая версия VERITY %d."
+
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Повреждён заголовок VERITY."
+
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Указан неправильный формат VERITY UUID на устройстве %s."
+
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Ошибка при обновлении заголовка verity на устройстве %s."
+
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "Проверка подписи корневого хэша не поддерживается."
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Невозможно исправить ошибки с устройством FEC."
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Найдено %u исправимых ошибок с устройством FEC."
+
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Ядро не поддерживает отображение dm-verity."
+
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Ядро не поддерживает параметр подписи dm-verity."
+
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "После активации обнаружено повреждение устройства verity."
+
+#: lib/verity/verity_hash.c:59
+#, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Резервная область не заполнена нулями по адресу %<PRIu64>."
+
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Переполнение смещения устройства."
+
+#: lib/verity/verity_hash.c:203
+#, c-format
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Ошибка при проверке по адресу %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Неправильный размер параметров для устройства verity."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Переполнение области хэша."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Ошибка при сверке области данных."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Ошибка при сверке корневого хэша."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Ошибка ввода-вывода при создании области хэша."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Ошибка при создании области хэша."
+
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "ПРЕДУПРЕЖДЕНИЕ: ядро не сможет активировать устройство, если размер блока данных превышает размер страницы (%u)."
+
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Ошибка при выделении контекста RS."
+
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Ошибка при выделении буфера."
+
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Не удалось прочитать блок RS %<PRIu64>, байт %d."
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Не удалось прочитать чётность для блока RS %<PRIu64>."
+
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Не удалось исправить чётность для блока %<PRIu64>."
+
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Не удалось записать чётность для блока RS %<PRIu64>."
+
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Для FEC размеры блока должны совпадать."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Неверное количество байт чётности."
+
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Не удалось определить размер устройства %s."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Ядро не поддерживает отображение dm-integrity."
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Ядро не поддерживает выравнивание фиксированных метаданных dm-integrity."
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Не удалось захватить блокировку на запись на устройстве %s."
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Обнаружена попытка одновременного обновления метаданных LUKS2. Отмена операции."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+"Устройство содержит двусмысленные подписи, невозможно провести автоматическое\n"
+"восстановление LUKS2. Для восстановления запустите «cryptsetup repair»."
+
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Запрошенное смещение данных слишком мало."
+
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: очень маленькая область слотов ключа (%<PRIu64> байт), количество доступных слотов ключа LUKS2 очень ограничено.\n"
+
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Не удалось захватить блокировку устройства %s на чтение."
+
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "В резервной копии %s обнаружены запрещённые требования LUKS2."
+
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Смещение данных различается на устройстве и в резервной копии, восстановление невозможно."
+
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Двоичный заголовок с областями слота ключа различается на устройстве и в резервной копии, восстановление невозможно."
+
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Устройство %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "не содержит заголовка LUKS2. Замена заголовка может уничтожить данные на этом устройстве."
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "уже содержит заголовок LUKS2. Замена заголовка уничтожит существующие слоты ключей."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
+msgstr ""
+"\n"
+"ПРЕДУПРЕЖДЕНИЕ: обнаружены неизвестные требования LUKS2 в заголовке\n"
+"действующего устройства! Замена заголовка из резервной копии может повредить\n"
+"данные на этом устройстве!"
+
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"ПРЕДУПРЕЖДЕНИЕ: на устройстве обнаружено незаконченное внесистемное (offline)\n"
+"перешифрование! Замена заголовка из резервной копии может повредить данные."
+
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Неизвестный флаг %s игнорируется."
+
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Отсутствует ключ для сегмента dm-crypt %u"
+
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Ошибка при задании сегмента dm-crypt."
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Ошибка при задании сегмента dm-linear."
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Неподдерживаемые настройки целостности устройства."
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Выполняется перешифрование. Невозможно деактивировать устройство."
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Не удалось заменить приостановленное устройство %s на цель dm-error."
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Ошибка при чтении требований LUKS2."
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Обнаружены неудовлетворяемые требования LUKS2."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Операция не совместима с устройством, отмеченным для устаревшего перешифрования. Прерываемся."
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Операция не совместима с устройством, отмеченным для перешифрования LUKS2. Прерываемся."
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Недостаточно памяти для открытия слота ключа."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Ошибка открытия слота ключа."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Невозможно использовать шифр %s-%s для шифрования слота ключа."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Нет места для нового слота ключа."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Невозможно определить состояние устройства с uuid: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Невозможно преобразовать заголовок с дополнительными метаданными LUKSMETA."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Невозможно переместить область слота ключа. Недостаточно места."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Невозможно переместить область слота ключа. Слишком маленькие слоты ключа LUKS2."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Невозможно переместить область слота ключа."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Невозможно преобразовать в формат LUKS1 — размер сектора шифрования сегмента по умолчанию не равно 512 байтам."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Невозможно преобразовать в формат LUKS1 — дайджесты слота ключа несовместимы с LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Невозможно преобразовать в формат LUKS1 — устройство использует шифр %s с обёрточным ключом."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Невозможно преобразовать в формат LUKS1 — заголовок LUKS2 содержит %u токенов."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Невозможно преобразовать в формат LUKS1 — слот ключа %u находится в некорректном состоянии."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Невозможно преобразовать в формат LUKS1 — слот %u (больше максимального количества слотов) всё ещё активен."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Невозможно преобразовать в формат LUKS1 — слот ключа %u несовместим с LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Размер hotzone должен быть кратен вычисленному выравниванию зоны (%zu байт)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Размер устройства должен быть кратен вычисленному выравниванию зоны (%zu байт)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Неподдерживаемый режим устойчивости %s."
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Ошибка при инициализации старой сегментной обёртки хранилища."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Ошибка при инициализации новой сегментной обёртки хранилища."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Ошибка чтения контрольных сумм текущей hotzone."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Не удалось прочитать область hotzone начиная с %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Не удалось расшифровать сектор %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Не удалось восстановить сектор %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Размеры устройств источника и назначения не совпадают. Источник %<PRIu64>, назначение: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Ошибка при активации устройства hotzone %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Ошибка при активации оверлейного устройства %s с действительной исходной таблицей."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Ошибка при загрузке нового отображения устройства %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Ошибка при обновлении стека устройств перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Ошибка при задании нового размера области слотов ключей."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Сдвиг данные не выровнен к запрошенному размеру сектора шифрования (%<PRIu32> байт)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Устройство данных не выровнено к запрошенному размеру сектора шифрования (%<PRIu32> байт)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Сдвиг данных (%<PRIu64> секторов) меньше чем будущее смещение данных (%<PRIu64> секторов)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Ошибка при открытии %s в монопольном режиме (уже отображено или примонтировано)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Устройство не отмечено для перешифрования LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Ошибка при загрузке контекста перешифрования LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Ошибка при получении состояния перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Устройство не перешифровывается."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Процесс перешифрования уже запущен."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Ошибка при захвате блокировки перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "Невозможно продолжить с перешифрованием. Сначала запустите восстановление перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Активный размер устройства и запрошенный размер перешифрования не совпадают."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "В параметрах перешифрования запрошен некорректный размер устройства."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Выполняется перешифрование. Восстановление выполнить невозможно."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "Перешифрование LUKS2 уже инициализировано в метаданных."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Не удалось инициализировать перешифрование LUKS2 в метаданных."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Ошибка при назначении сегментов устройства для следующей hotzone перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Ошибка при записи метаданных устойчивости перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Не удалось расшифровать."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Не удалось записать область hotzone начиная с %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Ошибка синхронизации данных."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Ошибка при обновлении метаданных после завершения текущей hotzone перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Ошибка при записи метаданных LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Ошибка при затирании резервной копии сегмента данных."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Не удалось выключить флаг требования перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Критическая ошибка при перешифровании куска начиная с %<PRIu64>, длиной в %<PRIu64> секторов."
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Устройство не возобновит работу пока не будет заменено вручную с целью error."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "Невозможно продолжить с перешифрованием. Неожиданное состояние перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Контекст перешифрования отсутствует или неверен."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Ошибка при инициализации стека устройства перешифрования."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Ошибка при обновлении контекста перешифрования."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Нет свободного слота под токен."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Ошибка при создании встроенного токена %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Невозможно проверить парольную фразу не с входных tty."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Параметры шифрования слота ключа могут задаваться только для устройства LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Обнаружено указание неизвестного шаблона шифра."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: параметр --hash игнорируется в режиме plain с указанным файлом ключа.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: параметр --keyfile-size игнорируется, размер для чтения приравнивается размеру ключа шифрования.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Обнаружены подпись(и) устройства на %s. Продолжение работы может повредить существующие данные."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Операция прервана.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Параметр --key-file является обязательным."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Введите VeraCrypt PIM: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Недопустимое значение PIM: ошибка при разборе."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Недопустимое значение PIM: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Недопустимое значение PIM: вышло за границы диапазона."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "С этой парольной фразой заголовка устройства не обнаружено."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Устройство %s не является корректным устройством BITLK."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Дамп заголовка с ключом тома является секретной информацией,\n"
+"обеспечивающей доступ к зашифрованному разделу без парольной фразы.\n"
+"Этот дамп следует всегда хранить зашифрованным в надёжном месте."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Устройство %s всё ещё активно и запланировано к отложенному удалению.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Для изменения размера активного устройства требуется ключ тома в связке ключей, но указан параметр --disable-keyring."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Оценка производительности прервана."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     Н/Д\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u итераций в секунду для %zu-битного ключа\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s Н/Д\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u итераций, %5u памяти, %1u параллельных нитей (ЦП) для %zu-битного ключа (запрашивался %u мс)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Результат оценки производительности ненадёжен."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Тесты, использующие практически только память (без ввода-вывода на хранилище).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s  Алгоритм |      Ключ |      Шифрование |     Расшифровка\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Шифр %s (%i-битный ключ) недоступен."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr ""
+"#     Algorithm |       Key |      Encryption |      Decryption\n"
+"#      Алгоритм |      Ключ |      Шифрование |     Расшифровка\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "Н/Д"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Кажется, что устройству не требуется восстановление перешифрования.\n"
+"Продолжить?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Действительно продолжить восстановление перешифрования LUKS2?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Введите пароль для восстановления перешифрования: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Действительно попробовать восстановить заголовок устройства LUKS?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Затирается устройство для инициализации целостности контрольной суммы.\n"
+"Вы можете прервать процесс нажав CTRL+c (остаток незатёртого устройства будет содержать некорректную контрольную сумму).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Невозможно деактивировать временное устройство %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Параметр целостности можно использовать только в формате LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Неподдерживаемый размер параметров метаданных LUKS2."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Невозможно создать файл заголовка %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Обнаружено указание неизвестного шаблона целостности."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Невозможно использовать %s в качестве заголовка для диска."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Данные на %s будут перезаписаны без возможности восстановления."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Ошибка при задании параметров pbkdf."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Сокращение смещения данных допускается только для отсоединённого заголовка LUKS."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Невозможно определить размер ключа тома LUKS без слотов ключа, укажите параметр --key-size."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Устройство активировано, но нельзя сделать флаги постоянными."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Для удаления выбран слот ключа %d."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Это последний слот ключа. Устройство станет неработоспособным после вычистки этого ключа."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Введите любую оставшуюся парольную фразу: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Операция прервана, слот ключа НЕ затёрт.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Введите удаляемую парольную фразу: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Введите новую парольную фразу для слота ключа: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Введите любую существующую парольную фразу: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Введите изменяемую парольную фразу: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Введите новую парольную фразу: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Введите парольную фразу для преобразуемого слота ключа: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Только одно устройство можно указать для операции isLuks."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Дамп заголовка с ключом тома является секретной информацией,\n"
+"обеспечивающей доступ к зашифрованному разделу без парольной фразы.\n"
+"Этот дамп нужно хранить зашифрованным в надёжном месте."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Слот ключа %d не содержит непривязанного ключа."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Дамп заголовка с непривязанным ключом является секретной информацией,\n"
+"обеспечивающей доступ к зашифрованному разделу без парольной фразы.\n"
+"Этот дамп нужно хранить зашифрованным в надёжном месте."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Параметр --header-backup-file является обязательным."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s не является управляемым устройством cryptsetup."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Обновление не поддерживается для устройств типа %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Нераспознанный тип метаданных устройства %s."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Для команды требуется задать устройство и имя отображения."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Эта операция сотрёт все слоты ключей на устройстве %s.\n"
+"Устройство станет неработоспособным после этой операции."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Операция прервана, слоты ключа НЕ затёрты.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Некорректный тип LUKS, поддерживаются только luks1 и luks2."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Устройство уже имеет тип %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Данная операция преобразует формат %s в %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Операция прервана, устройство НЕ преобразовано.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Отсутствует параметр --priority, --label или --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Некорректный токен %d."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Используется токен %d."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Ошибка при добавлении токена luks2-keyring %d."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Ошибка при назначении токена %d слоту ключа %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Токен %d не используется."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Ошибка при импорте токена из файла."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Ошибка при получении токена %d для экспорта."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "Для добавления токена требуется параметр --key-description."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Для действия требуется указать токен. Используйте параметр --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Некорректная операция с токеном %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Автоматически обнаруженное активное устройство dm «%s» для устройства данных %s.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Устройство %s не является блочным.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Не удалось автоматически обнаружить держателей устройства %s."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Невозможно понять, активно устройство %s или нет.\n"
+"Вы действительно хотите продолжить перешифрование в отложенном режиме?\n"
+"Это может привести к потере данных, если устройство всё же активно.\n"
+"Для запуска перешифрования в оперативном режиме укажите параметр --active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Неверный тип устройства LUKS."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Шифрование без отсоединённого заголовка (--header) невозможно без сокращения размера устройства данных (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Запрошенное смещение данных должно быть меньше или равно половине значения параметра --reduce-device-size."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Подгоняется значение --reduce-device-size под двукратный размер --offset %<PRIu64> (секторов).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Шифрование поддерживается только для формата LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "На %s обнаружено устройство LUKS. Хотите снова зашифровать это устройство LUKS?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Временный файл заголовка %s уже существует. Прекращение работы."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Невозможно создать временный файл заголовка %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s теперь активен и готов для оперативного шифрования.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Для шифрования недостаточно свободных слотов ключей."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Файл ключа можно использовать только с --key-slot или только при одном активном слоте."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Введите парольную фразу для слота ключа %d: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Введите парольную фразу для слота ключа %u: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Для команды требуется в аргументе указать устройство."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "В настоящий момент поддерживается только формат LUKS2. Для LUKS1 используйте программу cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Уже выполняется устаревшее внесистемное (offline) перешифрование. Используйте программу cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Перешифрование устройства с профилем целостности не поддерживается."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "Перешифрование LUKS2 уже инициализировано. Прекращение работы."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "Устройство LUKS2 не перешифровывается."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<устройство> [--type <тип>] [<имя>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "открыть устройство как <имя>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<имя>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "закрыть устройство (удалить отображение)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "изменить размер активного устройства"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "показать состояние устройства"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <шифр>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "оценка производительности шифра"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<устройство>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "попытаться исправить метаданные на диске"
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "перешифровать устройство LUKS2"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "стереть все слоты ключей (удалить ключ шифрования)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "преобразовать LUKS из/в формат LUKS2"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "задать постоянные параметры настройки LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<устройство> [<новый файл ключа>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "форматировать устройство LUKS"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "добавить ключ к устройству LUKS"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<устройство> [<файл ключа>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "удалить заданный ключ или файл ключа с устройства LUKS"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "изменить заданный ключ или файл ключа устройства LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "преобразовать ключ в новые параметры pbkdf"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<устройство> <слот ключа>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "затереть ключ с номером <слот ключа> с устройства LUKS"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "напечатать UUID устройства LUKS"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "проверить <устройство> на наличие заголовка раздела LUKS"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "выгрузить в дамп информацию о разделе LUKS"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "выгрузить в дамп информацию об устройстве TCRYPT"
+
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "выгрузить в дамп информацию об устройстве BITLK"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Приостановить устройство LUKS и затереть ключ (заморозка операций ввода-вывода)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Возобновить работу приостановленного устройства LUKS"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Сделать резервную копию заголовка и слотов ключей устройства LUKS"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Восстановить заголовок и слоты ключей устройства LUKS"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <устройство>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Управление токенами LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<действие> может быть:\n"
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"Также можно использовать псевдонимы старого синтаксиса <действия>:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<имя> - имя устройства для создания под %s\n"
+"<устройство> - зашифрованное устройство\n"
+"<слот ключа> - номер слота ключа LUKS для изменения\n"
+"<файл ключа> - необязательный файл ключа для нового ключа для действия luksAddKey\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Встроенным форматом по умолчанию для метаданных является %s (для действия luksFormat).\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Встроенные параметры ключа и парольной фразы по умолчанию:\n"
+"\tМаксимальный размер файла ключа: %dКБ, Максимальная длина парольной фразы при вводе вручную: %d (символов)\n"
+"PBKDF по умолчанию для LUKS1: %s, Время итерации: %d (мс)\n"
+"PBKDF по умолчанию для LUKS2: %s\n"
+"\tВремя итерации: %d, Требуемая память: %dКБ, Кол-во параллельных нитей: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Встроенные параметры шифра по умолчанию:\n"
+"\tloop-AES: %s, Ключ: %d бит\n"
+"\tplain: %s, Ключ: %d бит, хэширование пароля: %s\n"
+"\tLUKS: %s, Ключ: %d бит, хэширование заголовка LUKS: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: Размер ключа по умолчанию в режиме XTS (два внутренних ключа) будет удвоен.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: требуется %s в качестве аргументов"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Показать это сообщение"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Показать краткие инструкции"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Показать версию пакета"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Параметры справки:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Показывать подробные сообщения об ошибках"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Показывать отладочные сообщения"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Показывать отладочные сообщения включая метаданные JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "Шифр, используемый для шифрования диска (смотрите /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "Хэш, используемый для создания ключа шифрования из парольной фразы"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Проверить правильность парольной фразы, запрашивая её дважды"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Прочитать ключ из файла"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "Прочитать (главный) ключ тома из файла."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Создать дамп (главного) ключа, а не информации слотов ключей"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "Размер ключа шифрования"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "БИТ"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Ограничить чтение из файла ключа"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "байт"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Количество пропускаемых байтов в файле ключа"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Ограничить чтение из только что добавленного файла ключа"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Количество пропускаемых байтов в только что добавленном файле ключа"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Номер слота для нового ключа (по умолчанию первый свободный)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "Размер устройства"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "СЕКТОРОВ"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Использовать только заданный размер устройства (игнорировать остаток устройства). ОПАСНО!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "Начальное смещение в нижележащем (backend) устройстве"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Сколько секторов зашифрованных данных пропускать от начала"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Создать отображение в режиме только для чтения"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Не запрашивать подтверждение"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Время ожидания при ручном вводе парольной фразы (в секундах)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "сек"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Обновление строки хода выполнения (в секундах)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Как часто можно повторять попытку ввода парольной фразы"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Выравнивать полезные данные по границам <n> секторов — для luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Файл резервной копии заголовка и слотов ключей LUKS"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Использовать /dev/random для генерации ключа тома"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Использовать /dev/urandom для генерации ключа тома"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Совместно использовать устройство с другим неперекрывающимся шифрованным сегментом"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "Используемый для устройства UUID"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Разрешить отбрасывать запросы (так называемые TRIM) к устройству"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Устройство или файл с отдельным заголовком LUKS"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Не активировать устройство, только проверить парольную фразу"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Использовать скрытый заголовок (спрятанное устройство TCRYPT)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Устройство является системным диском TCRYPT (с загрузчиком)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Использовать резервный (вторичный) заголовок TCRYPT"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Также искать устройство совместимое с VeraCrypt"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Персональный умножитель итерации для устройства, совместимого с VeraCrypt"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Запрос персонального умножителя итерации для устройства, совместимого с VeraCrypt"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Тип метаданных устройства: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Выключить проверку качество пароля (если включена)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Использовать параметр производительности same_cpu_crypt для dm-crypt"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Использовать параметр производительности submit_from_crypt_cpus для dm-crypt"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Удаление устройства отложено, пока его не закроет последний пользователь"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Использовать глобальную блокировку для сериализации доступа на скорости памяти (memory-hard) PBKDF (для обхода OOM)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Время итерации PBKDF для LUKS (в мс)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "мс"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Алгоритм PBKDF (для LUKS2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Ограничение стоимости памяти PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "килобайт"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Стоимость параллельности PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "нити"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Стоимость итераций PBKDF (принудительная, оценка производительности отключена)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Приоритет слота ключа: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Выключить блокировку метаданных на диске"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Выключить загрузку ключей томов через связку ключей ядра"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Алгоритм целостности данных (только для LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Выключить журналирование для устройства целостности"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Не затирать устройство после форматирования"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Использовать неэффективное устаревшее дополнение (старые ядра)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Не запрашивать парольную фразу, если активация токеном завершилась ошибкой"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Номер токена (по умолчанию: любой)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Описание ключа"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Размер сектора шифрования (по умолчанию: 512 байт)"
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Использовать вычисленное IV как размер сектора (не 512 байт)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Задать набор постоянных флагов активации устройства"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Задать метку устройства LUKS2"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Задать метку подсистемы устройства LUKS2"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Создать или сделать дапм непривязанного (без назначенного сегмента данных) слота ключа LUKS2"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Прочитать или записать json в файл"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Размер области метаданных заголовка LUKS2"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Размер области слотов ключей заголовка LUKS2"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Обновить (реактивировать) устройство с новыми параметрами"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Слот ключа LUKS2: Размер ключа шифрования"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "Слот ключа LUKS2: Шифр, используемый для шифрования слота ключа"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Зашифровать устройство LUKS2 (шифрование по месту (in-place))"
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Расшифровать устройство LUKS2 (удалить шифрование)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Инициализировать перешифрование LUKS2 только метаданных."
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Возобновить только инициализированное перешифрование LUKS2."
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Сократить размер данных устройства (переместить смещение данных). ОПАСНО!"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Максимальный размер hotzone перешифрования."
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Тип устойчивости перешифрования hotzone (checksum,journal,none)"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "Контрольные хэш-суммы hotzone перешифрования"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Заменить автоопределение устройства dm для перешифруемого устройства"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[ПАРАМЕТР…] <действие> <данные для действия>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Не задан параметр <действие>."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Неизвестное действие."
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Параметры --refresh и --test-passphrase взаимно исключают друг друга."
+
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "Параметр --deferred допускается только для команды close."
+
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Параметр --shared допускается только для открытия устройства plain."
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Параметр --allow-discards допускается только для операции open."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Параметр --persistent допускается только для операции open."
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Параметр --serialize-memory-hard-pbkdf допускается только для операции open."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Параметр --persistent не допускается одновременно указывать с --test-passphrase."
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"Параметр --key-size допускается только для  luksFormat, luksAddKey,\n"
+"действий open и benchmark. Для ограничения чтения из файла ключа используйте --keyfile-size=(байт)."
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Параметр --integrity допускается только для luksFormat (LUKS2)."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Параметр --integrity-no-wipe можно использовать только для действия format с расширением целостности."
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Параметры --label и --subsystem допускаются только для операций LUKS2 luksFormat и config."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Параметр --test-passphrase допускается только для открытия устройств LUKS, TCRYPT и BITLK."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Размер ключа должен быть кратен 8-ми битам"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "Некорректный слот ключа."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Параметр --key-file имеет приоритет над указанным значением файла ключа."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "В параметре нельзя использовать отрицательные числа."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Разрешено указывать только один параметр --key-file."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Разрешено использовать только один параметр --use-[u]random."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "Параметр --use-[u]random допускается только для luksFormat."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "Параметр --uuid допускается только для luksFormat и luksUUID."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "Параметр --align-payload допускается только для luksFormat."
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Параметры --luks2-metadata-size и --opt-luks2-keyslots-size допускаются только для операции luksFormat с LUKS2."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Неправильно указан размер метаданных LUKS2."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Неправильно указан размер слота ключа LUKS2."
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Параметры --align-payload и --offset не допускается указывать вместе."
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Параметр --skip поддерживается только для открытия устройств plain и loopaes."
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Параметр --offset поддерживается только для открытия устройств plain и loopaes, luksFormat и перешифрования устройства."
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Параметр --tcrypt-hidden, --tcrypt-system или --tcrypt-backup поддерживается только для устройства TCRYPT."
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Параметр --tcrypt-hidden нельзя указывать вместе с --allow-discards."
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Параметр --veracrypt поддерживается только для устройств TCRYPT."
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Указано некорректное значение параметра --veracrypt-pim."
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Параметр --veracrypt-pim поддерживается только для устройств, совместимых с VeraCrypt."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Параметр --veracrypt-query-pim поддерживается только для устройств, совместимых с VeraCrypt."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Параметры --veracrypt-pim и --veracrypt-query-pim взаимно исключают друг друга."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Значением параметра --priority может быть только ignore/normal/prefer."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Требуется указать слот ключа."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Производной функцией на основе пароля для ключа (PBKDF) может быть только pbkdf2 или argon2i/argon2id."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Принудительные итерации PBKDF нельзя объединять вместе с параметром времени итерации."
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "Параметр размера сектора не поддерживается этой командой."
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "Параметр больших секторов IV поддерживается только для открытия устройств типа plain с размером сектора более 512 байт."
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "С параметром --unbound требуется задать размер ключа."
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Параметр --unbound можно использовать только в действиях luksAddKey и luksDump."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "Параметр --refresh можно использовать только при действии open."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "Невозможно выключить блокировку метаданных."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Неправильный максимальный размер перешифрования hotzone."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Неправильно указан размер устройства."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Максимальный размер сокращения устройства равен 1 ГиБ."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Размер сокращения должен быть кратен 512 байтовому сектору."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "Неправильный размер устройства данных."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Переполнение размера сокращения."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "Для расшифровки LUKS2 требуется параметр --header."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Размер устройства должен быть кратен 512 байтовому сектору."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Параметры ---reduce-device-size и --data-size не допускается указывать вместе."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Параметры --device-size и --size не допускается указывать вместе."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Параметры --ignore-corruption и --restart-on-corruption нельзя использовать вместе."
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Указана недопустимая строка соли."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Невозможно создать образ хэша %s для записи."
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Невозможно создать образ FEC %s для записи."
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Указана недопустимая строка корневого хэша."
+
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr "Неверный файл подписи %s."
+
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Невозможно прочитать файл подписи %s."
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<устройство_данных> <устройство_хэша>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "отформатировать устройство"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<устройство_данных> <устройство_хэша> <корневой_хэш>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "проверить устройство"
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<устройство_данных> <имя> <устройство_хэша> <корневой_хэш>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "показать состояние активного устройства"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<устройство_хэша>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "показать информацию на диске"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<имя> — устройство, создаваемое на %s\n"
+"<устройство_данных> — устройство данных\n"
+"<устройство_хэша> — устройство, содержащее проверочные данные\n"
+"<корневой_хэш> — хэш корневого узла на <устройстве_хэша>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Встроенные параметры dm-verity по умолчанию:\n"
+"\tХэш: %s, Блок данных (байт): %u, Блок хэша (байт): %u, Размер соли: %u, Формат хэша: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Не использовать проверочный суперблок"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Тип форматирования (1 - обычное, 0 - как в Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "число"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Размер блока устройства данных"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Размер блока устройства хэша"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "байты чётности FEC"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Количество блоков в файле данных"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "блоков"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Путь к устройству с данными коррекции ошибок"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "путь"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Начальное смещение на устройстве хэша"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Начальное смещение на устройстве FEC"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Алгоритм хэширования"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "строка"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Соль"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "шестн. строка"
+
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Путь к файлу с подписью корневого хэша"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Перезапустить ядро, если обнаружится ошибка"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Игнорировать повреждение, только запротоколировать"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Не проверять обнулённые блоки"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Проверять блок данных только при первом чтении"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Параметр --ignore-corruption, --restart-on-corruption или --ignore-zero-blocks допускается только для операции open."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Параметр --root-hash-signature можно использовать только для действия open."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Параметры --ignore-corruption и --restart-on-corruption нельзя использовать вместе."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Невозможно прочитать файл ключа %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Невозможно прочитать %d байт из файл ключа %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Отформатирован с размером тега %u, внутренняя целостность %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<устройство_целостности>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<устройство_целостности> <имя>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<имя> — устройство, создаваемое на %s\n"
+"<устройство_целостности> — устройство, содержащее данные с тегами целостности\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Встроенные параметры dm-integrity:\n"
+"\tАлгоритм контрольной суммы: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Путь к устройству данных (при разделении устройств)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Размер журнала"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Чередующиеся секторы"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Отметка журнала"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "процент"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Время фиксации журнала"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "мс"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Количество 512-байтовых секторов на бит (режим битовой карты)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Время стирания в режиме битовой карты"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Размер тега (на сектор)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Размер сектора"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Размер буфера"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Алгоритм целостности данных"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Размер ключа целостности данных"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Прочитать ключ целостности из файла"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Алгоритм целостности журнала"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Размер ключа целостности журнала"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Прочитать ключ целостности журнала из файла"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Алгоритм шифрования журнала"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Размер ключа шифрования журнала"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Прочитать ключ шифрования журнала из файла"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Режим восстановления (без проверки журнала и тегов)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Использовать битовую карту для отслеживания изменений и выключить журналирование для устройства целостности"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Автоматически вычислять начальные теги повторно."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Параметр --integrity-recalculate можно использовать только для действия open."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Параметры --journal-size, --interleave-sectors, --sector-size, --tag-size и --no-wipe можно использовать только для действия format."
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Неправильное задание размера журнала."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Должны быть указаны параметры файла ключа и размер ключа одновременно."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Если используется ключ целостности, то должен быть указан алгоритм целостности."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Должны быть указаны параметры файла ключа целостности и размер ключа одновременно."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Если используется ключ целостности журнала, то должен быть указан алгоритм целостности журнала."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Должны быть указаны параметры файла ключа шифрования и размер ключа одновременно."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Если используется ключ шифрования журнала, то должен быть указан алгоритм шифрования журнала."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Параметры восстановления и режима битовой карты взаимно исключают друг друга."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Параметры журнала нельзя использовать в режиме битовой карты."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Параметр битовой карты можно использовать только в режиме битовой карты."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Уже выполняется перешифрование."
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Невозможно монопольно открыть устройство %s, оно уже используется."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Не удалось выделить выровненную память."
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "Невозможно прочитать с устройства %s."
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Отметка устройства LUKS1 %s бесполезна."
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Установка внесистемного (offline) флага перешифрования LUKS2 на устройстве %s."
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Невозможно записать на устройство %s."
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Невозможно записать в файл протокола перешифрования."
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Невозможно прочитать файл протокола перешифрования."
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Файл протокола %s существует, подразумевается перешифрование.\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Активируется временное устройство, задействуется старый заголовок LUKS."
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Активируется временное устройство, задействуется новый заголовок LUKS."
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Ошибка при активации временного устройства."
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Не удалось задать смещение данных."
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Не удалось задать размер метаданных."
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Создан новый заголовок LUKS для устройства %s."
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Эта версия cryptsetup-reencrypt не работает с новым типом внутреннего токена %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Ошибка чтения флагов активации из резервной копии заголовка."
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Ошибка записи флагов активации в новый заголовок."
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Ошибка чтения требований из резервной копии заголовка."
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "Создана резервная копия заголовка %s для устройства %s."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Ошибка при создании резервных копий заголовка LUKS."
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Невозможно восстановить заголовок %s устройства %s."
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "Заголовок %s устройства %s восстановлен."
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Невозможно открыть временное устройство LUKS."
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Невозможно получить размер устройства."
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Ошибка ввода-вывода при перешифровании."
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Указан некорректный UUID."
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Невозможно открыть файл протокола перешифрования."
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Расшифровка не выполняется, указанный UUID можно использовать только для возобновления приостановленного процесса расшифровки."
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Изменённые параметры pbkdf в слоте ключа %i."
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Размер блока перешифрования"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "МиБ"
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Не изменять ключ, нет области перешифрования данных"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Прочитать новый (главный) ключ тома из файла"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Время итерации PBKDF2 для LUKS (мс)"
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Использовать direct-io для доступа к устройствам"
+
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Вызывать fsync после каждого блока"
+
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Обновлять файл протокола после каждого блока"
+
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Использовать только этот слот (остальные будут выключены)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Создать новый заголовок на не шифрованном устройстве"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Окончательно расшифровать устройство (удалить шифрование)"
+
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "Используемый для возобновления шифрования UUID"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Тип метаданных LUKS: luks1, luks2"
+
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[ПАРАМЕТР…] <устройство>"
+
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Перешифрование изменит: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "ключ тома"
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "установить хэш равным"
+
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", установить шифр равным"
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Требуется аргумент."
+
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Значение размера блока перешифрования должно быть в диапазоне от 1 МиБ до 64 МиБ."
+
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "Максимальный размер сокращения устройства равен 64 МиБ."
+
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Параметр --new должен использоваться вместе с --reduce-device-size или --header."
+
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Параметр --keep-key можно использовать только с --hash, --iter-time или --pbkdf-force-iterations."
+
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "Параметр --new нельзя использовать вместе с --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "Параметр --decrypt несовместим с указанными параметрами."
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Параметр --uuid можно использовать только вместе с --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Некорректный тип luks. Возможные значения: «luks», «luks1» или «luks2»."
+
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Ошибка чтения ответа с терминала."
+
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Команда выполнена успешно.\n"
+
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "некорректные или отсутствующие параметры"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "нет прав или некорректная парольная фраза"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "недостаточно памяти"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "указано некорректное устройство или файл"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "устройство уже существует или занято"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "неизвестная ошибка"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Сбой команды, код %i (%s).\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Создан слот ключа %i."
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Слот ключа %i разблокирован."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Слот ключа %i удалён."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Создан токен %i."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Токен %i удалён."
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Затирание прервано."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: Устройство %s уже содержит подпись раздела «%s».\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "ПРЕДУПРЕЖДЕНИЕ: Устройство %s уже содержит подпись суперблока «%s».\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Ошибка при инициализации определения подписей устройства."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Ошибка выполнения stat для устройства %s."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Устройство %s уже используется. Нельзя продолжать выполнение операции форматирования."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Ошибка при открытии файла %s в режиме чтения-записи."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Существующая подпись раздела «%s» (смещение: %<PRIi64> байт) на устройстве %s будет затёрта."
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Существующая подпись суперблока «%s» (смещение: %<PRIi64> байт) на устройстве %s будет затёрта."
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Ошибка при затирании подписи устройства."
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Ошибка при определении подписи устройства %s."
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Перешифрование прервано."
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Невозможно проверить стойкость пароля: %s"
+
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+"Ошибка при проверке стойкости пароля:\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Ошибка при проверке стойкости пароля: некорректная парольная фраза (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Ошибка чтения парольной фразы с терминала."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Парольная фраза повторно: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Парольные фразы не совпадают."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Невозможно использовать смещение при вводе с терминала."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Введите парольную фразу: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Введите парольную фразу для %s: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Ключ недоступен с этой парольной фразой."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Не найдено подходящего слота ключа."
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Невозможно открыть файл ключа %s для записи."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Невозможно записать в файл ключа %s."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Ошибка при открытии файла %s в режиме только для чтения."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Укажите корректный токен LUKS2 в формате JSON:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Ошибка чтения файла JSON."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Чтение прервано."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Ошибка при открытии файла %s в режиме записи."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Запись прервана."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Ошибка записи в файл JSON."
+
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands."
+#~ msgstr "Параметр --refresh допускается только с командами open и refresh."
+
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Шифр %s недоступен."
+
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Неподдерживаемый размер сектора шифрования.\n"
+
+#~ msgid "Offline reencryption in progress. Aborting."
+#~ msgstr "Ведётся внесистемное (offline) перешифрование. Прерываемся."
+
+#~ msgid "Online reencryption in progress. Aborting."
+#~ msgstr "Ведётся оперативное (online) перешифрование. Прерываемся."
+
+#~ msgid "No LUKS2 reencryption in progress."
+#~ msgstr "Перешифрование LUKS2 в данный момент не выполняется."
+
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Прервано сигналом."
+
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Функция не доступна в режиме FIPS."
+
+#~ msgid "Failed to write hash."
+#~ msgstr "Ошибка записи хэша."
+
+#~ msgid "Failed to finalize hash."
+#~ msgstr "Ошибка завершения хэша."
+
+#~ msgid "Invalid resilience parameters (internal error)."
+#~ msgstr "Неправильные параметры устойчивости (внутренняя ошибка)."
+
+#~ msgid "Failed to assign new enc segments."
+#~ msgstr "Ошибка при назначении новых сегментов enc."
+
+#~ msgid "Failed to assign digest %u to segment %u."
+#~ msgstr "Ошибка при назначении дайджеста %u в сегмент %u."
+
+#~ msgid "Failed to set segments."
+#~ msgstr "Ошибка при задании сегментов."
+
+#~ msgid "Failed to assign reencrypt previous backup segment."
+#~ msgstr "Ошибка при назначении предыдущей резервной копии сегмента reencrypt."
+
+#~ msgid "Failed to assign reencrypt final backup segment."
+#~ msgstr "Ошибка при назначении конечной резервной копии сегмента reencrypt."
+
+#~ msgid "Failed generate 2nd segment."
+#~ msgstr "Ошибка при генерации 2-го сегмента."
+
+#~ msgid "Failed generate 1st segment."
+#~ msgstr "Ошибка при генерации 1-го сегмента."
+
+#~ msgid "Failed to allocate device %s."
+#~ msgstr "Ошибка при выделении устройства %s."
+
+#~ msgid "Failed to allocate dm segments."
+#~ msgstr "Ошибка при выделении сегментов dm."
+
+#~ msgid "Failed to create dm segments."
+#~ msgstr "Ошибка при создании сегментов dm."
+
+#~ msgid "Failed to allocate device for new backing device."
+#~ msgstr "Ошибка при выделении устройства для нового опорного устройства."
+
+#~ msgid "Failed to reload overlay device %s."
+#~ msgstr "Ошибка при перезагрузке оверлейного устройства %s."
+
+#~ msgid "Failed to refresh helper devices."
+#~ msgstr "Не удалось обновить вспомогательное устройство %s."
+
+#~ msgid "Failed to create reencryption backup segments."
+#~ msgstr "Ошибка при создании резервных сегментов перешифрования."
+
+#~ msgid "Failed to set online-reencryption requirement."
+#~ msgstr "Ошибка при задании требований оперативного перешифрования."
+
+#~ msgid "Failed to hash sector at offset %zu."
+#~ msgstr "Ошибка хэширования сектора по смещению %zu."
+
+#~ msgid "Failed to read sector hash."
+#~ msgstr "Ошибка чтения хэша сектора."
+
+#~ msgid "Error: Calculated reencryption offset %<PRIu64> is beyond device size %<PRIu64>."
+#~ msgstr "Ошибка: вычисленное смещение перешифрования %<PRIu64> находится за границей размера устройства %<PRIu64>."
+
+#~ msgid "Device is not in clean reencryption state."
+#~ msgstr "Устройство не в начальном (clean) состояния перешифрования."
+
+#~ msgid "Failed to calculate new segments."
+#~ msgstr "Ошибка при вычислении новых сегментов."
+
+#~ msgid "Failed to assign pre reenc segments."
+#~ msgstr "Ошибка при назначении сегментов pre reenc."
+
+#~ msgid "Failed finalize hotzone resilience, retval = %d"
+#~ msgstr "Ошибка завершения устойчивости hotzone, retval = %d"
+
+#~ msgid "Failed to write data."
+#~ msgstr "Ошибка записи данных."
+
+#~ msgid "Failed to update metadata or reassign device segments."
+#~ msgstr "Не удалось обновить метаданные или переназначить сегменты устройства."
+
+#~ msgid "Failed to reload %s device."
+#~ msgstr "Ошибка при перезагрузке устройства %s."
+
+#~ msgid "Failed to erase backup segments"
+#~ msgstr "Ошибка при стирании резервных копий сегментов."
+
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Запрошенные параметры производительности dmcrypt не поддерживаются."
+
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Невозможно отформатировать устройство %s, которое всё ещё используется."
+
+#~ msgid "Key slot %d is not used."
+#~ msgstr "Слот ключа %d не используется."
+
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Для удаления выбрал слот ключа %d."
+
+#~ msgid "open device as mapping <name>"
+#~ msgstr "открыть устройство как отображение с <именем>"
+
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "закрыть устройство (деактивировать и удалить отображение)"
+
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Ошибка при задании параметров PBKDF."
+
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Невозможно перемещаться по устройству.\n"
+
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "Устройство %s слишком маленькое (для LUKS2 требуется не менее %<PRIu64> байт)."
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "Ошибка 'memory allocation error' при выполнении action_luksFormat"
+
+#~ msgid "Cannot get info about device %s.\n"
+#~ msgstr "Невозможно получить информацию об устройстве %s.\n"
+
+#~ msgid "Device %s has zero size.\n"
+#~ msgstr "Устройство %s имеет нулевой размер.\n"
+
+#~ msgid "Device %s is too small.\n"
+#~ msgstr "Устройство %s слишком маленькое.\n"
+
+#~ msgid "Device %s already exists.\n"
+#~ msgstr "Устройство %s уже существует.\n"
+
+#~ msgid "Volume %s is not active.\n"
+#~ msgstr "Раздел %s не активен.\n"
+
+#~ msgid "Invalid key size.\n"
+#~ msgstr "Неверный размер ключа.\n"
+
+#~ msgid "Key slot %d is not used.\n"
+#~ msgstr "Ключевой слот %d не используется.\n"
+
+#~ msgid "Key slot %d is invalid.\n"
+#~ msgstr "Неправильный ключевой слот %d.\n"
+
+#~ msgid "Invalid device %s.\n"
+#~ msgstr "Неверное устройство %s.\n"
+
+#~ msgid "Volume key buffer too small.\n"
+#~ msgstr "Буфер ключей раздела слишком мал.\n"
+
+#~ msgid "Cannot read device %s.\n"
+#~ msgstr "Невозможно прочитать устройство %s.\n"
+
+#~ msgid "This operation is not supported for %s crypt device.\n"
+#~ msgstr "Данная операция не поддерживается для устройства шифрования %s.\n"
+
+#~ msgid "Device %s doesn't exist or access denied.\n"
+#~ msgstr "Устройство %s не существует или доступ к нему запрещён.\n"
+
+#~ msgid "Failed to open temporary keystore device.\n"
+#~ msgstr "Не удалось открыть устройство временного хранения ключей.\n"
+
+#~ msgid "Failed to access temporary keystore device.\n"
+#~ msgstr "Не удалось получить доступ к устройству временного хранения ключей.\n"
+
+#~ msgid "Cannot get process priority.\n"
+#~ msgstr "Невозможно получить приоритет процесса.\n"
+
+#~ msgid "Data offset or key size differs on device and backup, restore failed.\n"
+#~ msgstr "Смещение данных или размер ключа не совпадают на устройстве и в резервной копии, восстановление не удалось.\n"
+
+#~ msgid "Cannot open device %s.\n"
+#~ msgstr "Невозможно открыть устройство %s.\n"
+
+#~ msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
+#~ msgstr "Неверный ключевой слот %d, пожалуйста, выберите ключевой слот между 0 и %d.\n"
+
+#~ msgid "No key available with this passphrase.\n"
+#~ msgstr "Нет доступных ключей для данного пароля.\n"
+
+#~ msgid "Key slot %d unlocked.\n"
+#~ msgstr "Ключевой слот %d разблокирован.\n"
+
+#~ msgid "Key slot %d is full, please select another one.\n"
+#~ msgstr "Ключевой слот %d полон, пожалуйста, выберите другой.\n"
+
+#~ msgid "All key slots full.\n"
+#~ msgstr "Все ключевые слоты полны.\n"
+
+#~ msgid "Key slot %d is invalid, please select between 0 and %d.\n"
+#~ msgstr "Неправильный ключевой слот %d, пожалуйста, выберите между 0 и %d.\n"
+
+#~ msgid "This operation is supported only for LUKS device.\n"
+#~ msgstr "Данная операция поддерживается только для устройств LUKS.\n"
+
+#~ msgid "Cannot write header backup file %s.\n"
+#~ msgstr "Невозможно записать файл резервной копии заголовка %s.\n"
+
+#~ msgid "Cannot read header backup file %s.\n"
+#~ msgstr "Невозможно прочитать файл резервной копии заголовка %s.\n"
+
+#~ msgid "Cannot open header backup file %s.\n"
+#~ msgstr "Невозможно открыть файл резервной копии заголовка %s.\n"
+
+#~ msgid "Unsupported LUKS version %d.\n"
+#~ msgstr "Неподдерживаемая версия LUKS %d.\n"
+
+#~ msgid "Error during update of LUKS header on device %s.\n"
+#~ msgstr "Ошибка обновления заголовка LUKS на устройстве %s.\n"
+
+#~ msgid "Error re-reading LUKS header after update on device %s.\n"
+#~ msgstr "Ошибка перечитывания заголовка LUKS после обновления на устройстве %s.\n"
+
+#~ msgid "Cannot wipe device %s.\n"
+#~ msgstr "Невозможно очистить устройство %s.\n"
+
+#~ msgid "Option --header-backup-file is required.\n"
+#~ msgstr "Необходима опция --header-backup-file.\n"
+
+#~ msgid "File with LUKS header and keyslots backup."
+#~ msgstr "Файл с резервной копией заголовка и ключевых слотов LUKS."
+
+#~ msgid "DM-UUID for device %s was truncated.\n"
+#~ msgstr "DM-UUID для устройства %s был усечён.\n"
+
+#~ msgid "Key slot %d active, purge first.\n"
+#~ msgstr "Ключевой слот %d активен, сначала очистите.\n"
+
+#~ msgid "Volume key does not match the volume.\n"
+#~ msgstr "Ключ раздела не совпадает с разделом.\n"
+
+#~ msgid "Cannot initialize crypto backend.\n"
+#~ msgstr "Невозможно инициализировать внутренний интерфейс crypto.\n"
+
+#~ msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
+#~ msgstr "Невозможно инициализировать device-mapper. Загружен ли модуль ядра dm_mod?\n"
+
+#~ msgid "Volume %s is not suspended.\n"
+#~ msgstr "Том %s не в режим приостановки.\n"
+
+#~ msgid "Volume %s is already suspended.\n"
+#~ msgstr "Том %s уже в режим приостановки.\n"
+
+#~ msgid "Error reading passphrase from terminal.\n"
+#~ msgstr "Ошибка чтения кодовой фразы из терминала.\n"
+
+#~ msgid "Passphrases do not match.\n"
+#~ msgstr "Кодовые фразы не совпадают.\n"
+
+#~ msgid "Key size in XTS mode must be 256 or 512 bits.\n"
+#~ msgstr "Размер ключа в режиме XTS должен быть 256 или 512-разрядный.\n"
+
+#~ msgid "Error reading passphrase.\n"
+#~ msgstr "Ошибка чтения кодовой фразы.\n"
+
+#~ msgid "Out of memory while reading passphrase.\n"
+#~ msgstr "Недостаточно памяти для считывания кодовой фразы.\n"
+
+#~ msgid "Cannot format device %s which is still in use.\n"
+#~ msgstr "Нельзя отформатировать устройство %s, которое ещё используется.\n"
+
+#~ msgid "This operation is not supported for this device type.\n"
+#~ msgstr "Это действие не поддерживается для данного типа устройств.\n"
+
+#~ msgid "Fatal error during RNG initialisation.\n"
+#~ msgstr "Критическая ошибка во время инициализации RNG.\n"
+
+#~ msgid "Option --key-file is required.\n"
+#~ msgstr "Требуется параметр --key-file.\n"
+
+#~ msgid "Hash algorithm %s not supported.\n"
+#~ msgstr "Алгоритм хэширования %s не поддерживается.\n"
+
+#~ msgid "Key processing error (using hash %s).\n"
+#~ msgstr "Ошибка обработки ключа (используется хэш %s).\n"
+
+#~ msgid "Failed to open key file.\n"
+#~ msgstr "Не удалось открыть ключевой файл.\n"
+
+#~ msgid "Cannot read requested amount of data.\n"
+#~ msgstr "Не удалось считать запрошенное количество данных.\n"
+
+#~ msgid "Writing LUKS header to disk.\n"
+#~ msgstr "Запись заголовка LUKS на диск.\n"
+
+#~ msgid "Key slot %d selected for deletion.\n"
+#~ msgstr "Слот ключа %d выбран для удаления.\n"
+
+#~ msgid "Key slot %d changed.\n"
+#~ msgstr "Слот ключа %d изменён.\n"
+
+#~ msgid "Read the key from a file."
+#~ msgstr "Читать ключ из файла."
+
+#~ msgid "Use /dev/random for generating volume key."
+#~ msgstr "Использовать /dev/random для генерации ключа тома."
+
+#~ msgid "Use /dev/urandom for generating volume key."
+#~ msgstr "Использовать /dev/urandom для генерации ключа тома."
+
+#~ msgid "Device type is not properly initialised.\n"
+#~ msgstr "Тип устройства некорректно инициализирован.\n"
+
+#~ msgid "Error during resuming device %s.\n"
+#~ msgstr "Ошибка при возобновлении работы устройства %s.\n"
+
+#~ msgid "Device %s is still in use.\n"
+#~ msgstr "Устройство %s всё ещё используется.\n"
+
+#~ msgid "Cannot unlock memory.\n"
+#~ msgstr "Не удалось разблокировать память.\n"
+
+#~ msgid "Maximum keyfile size exceeded.\n"
+#~ msgstr "Максимальный размер ключевого файла превышен.\n"
+
+#~ msgid "Running in FIPS mode.\n"
+#~ msgstr "Выполняется в режиме FIPS.\n"
+
+#~ msgid "Error reading keyfile %s.\n"
+#~ msgstr "Ошибка при чтении файла ключа %s.\n"
+
+#~ msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
+#~ msgstr "Максимальная длина кодовой фразы TCRYPT (%d) превышена.\n"
+
+#~ msgid "Unsupported VERITY version %d.\n"
+#~ msgstr "Неподдерживаемая версия VERITY %d.\n"
+
+#~ msgid "VERITY header corrupted.\n"
+#~ msgstr "Заголовок VERITY повреждён.\n"
+
+#~ msgid "Cannot format device %s, permission denied.\n"
+#~ msgstr "Невозможно отформатировать устройство %s, отказано в доступе.\n"
+
+#~ msgid "Resume is not supported for device %s.\n"
+#~ msgstr "Возобновление не поддерживается для устройства %s.\n"
+
+#~ msgid "Unsupported VERITY block size.\n"
+#~ msgstr "Неподдерживаемый размер блока VERITY.\n"
+
+#~ msgid "Function not available in FIPS mode.\n"
+#~ msgstr "Функция недоступна в режиме FIPS.\n"
+
+#~ msgid "Requested offset is beyond real size of device %s.\n"
+#~ msgstr "Запрошенное смещение за пределами реального размера устройства %s.\n"
+
+#~ msgid "Cannot write to device %s, permission denied.\n"
+#~ msgstr "Запись на устройство %s невозможна, отказано в доступе.\n"
+
+#~ msgid "Cannot seek to requested keyfile offset.\n"
+#~ msgstr "Не удалось перейти к запрошенному смещению в ключевом файле.\n"
+
+#~ msgid "Non standard key size, manual repair required.\n"
+#~ msgstr "Нестандартный размер ключа, требуется исправление вручную.\n"
+
+#~ msgid "Required kernel crypto interface not available.\n"
+#~ msgstr "Запрошенный криптоинтерфейс ядра недоступен.\n"
+
+#~ msgid "Ensure you have algif_skcipher kernel module loaded.\n"
+#~ msgstr "Убедитесь, что загружен модуль ядра algif_skcipher.\n"
+
+#~ msgid "Activation is not supported for %d sector size.\n"
+#~ msgstr "Активация не поддерживается для размера сектора %d.\n"
+
+#~ msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u).\n"
+#~ msgstr "ПРЕДУПРЕЖДЕНИЕ: Ядро не может активировать устройство, если размер блока данных превышает размер страницы (%u).\n"
+
+#~ msgid "Cannot read keyfile %s.\n"
+#~ msgstr "Не удалось прочитать ключевой файл %s.\n"
+
+#~ msgid "Cannot read %d bytes from keyfile %s.\n"
+#~ msgstr "Не удалось прочитать %d байт из ключевого файла %s.\n"
+
+#~ msgid "UUID for device to use."
+#~ msgstr "UUID используемого устройства."
+
+#~ msgid "Do not activate device, just check passphrase."
+#~ msgstr "Не активировать устройство, просто проверить парольную фразу."
+
+#~ msgid "Cannot wipe header on device %s.\n"
+#~ msgstr "Не удалось стереть заголовок на устройстве %s.\n"
+
+#~ msgid "Dump operation is not supported for this device type.\n"
+#~ msgstr "Создание дампа не поддерживается для этого типа устройств.\n"
+
+#~ msgid "Cannot create header backup file %s.\n"
+#~ msgstr "Не удалось создать файл резервной копии заголовка %s.\n"
+
+#~ msgid "Requested header backup file %s already exists.\n"
+#~ msgstr "Запрошенный файл резервной копии заголовка %s уже существует.\n"
+
+#~ msgid "Disable password quality check (if enabled)."
+#~ msgstr "Отключить проверку качества пароля (если включена)."
+
+#~ msgid ""
+#~ "Option --key-size is allowed only for luksFormat, open and benchmark.\n"
+#~ "To limit read from keyfile use --keyfile-size=(bytes)."
+#~ msgstr ""
+#~ "Опция --key-size разрешена только для luksFormat, open и benchmark.\n"
+#~ "Чтобы ограничить чтение из ключевого файла, используйте --keyfile-size=(количество байтов)."
+
+#~ msgid "Cannot write device %s.\n"
+#~ msgstr "Не удалось выполнить запись на устройство %s.\n"
+
+#~ msgid "New LUKS header for device %s created.\n"
+#~ msgstr "Создан новый заголовок LUKS для устройства %s.\n"
+
+#~ msgid "Activated keyslot %i.\n"
+#~ msgstr "Активирован слот ключей %i.\n"
+
+#~ msgid "Cannot get device size.\n"
+#~ msgstr "Не удалось получить размер устройства.\n"
+
+#~ msgid "Option --new must be used together with --reduce-device-size."
+#~ msgstr "Опция --new должна использоваться совместно с --reduce-device-size."
+
+#~ msgid "Cannot check password quality: %s\n"
+#~ msgstr "Не удалось проверить качество пароля: %s\n"
+
+#~ msgid "Interrupted by a signal.\n"
+#~ msgstr "Прервано по сигналу.\n"
+
+#~ msgid "Cannot determine device type. Incompatible activation of device?\n"
+#~ msgstr "Невозможно определить тип устройства. Несовместимая активация устройства?\n"
+
+#~ msgid "Requested dm-crypt performance options are not supported.\n"
+#~ msgstr "Запрошенные параметры производительности dm-crypt не поддерживаются.\n"
+
+#~ msgid "Requested dm-verity data corruption handling options are not supported.\n"
+#~ msgstr "Запрошенные параметры обработки повреждённых данных dm-verity не поддерживаются.\n"
+
+#~ msgid "Cannot initialize crypto RNG backend.\n"
+#~ msgstr "Невозможно инициализировать выходной буфер crypto RNG.\n"
+
+#~ msgid "Cannot initialize device-mapper, running as non-root user.\n"
+#~ msgstr "Невозможно инициализировать device-mapper, выполнение не от имени администратора.\n"
+
+#~ msgid "Can't format LUKS without device.\n"
+#~ msgstr "Невозможно отформатировать LUKS без устройства.\n"
+
+#~ msgid "Unsupported VERITY hash offset.\n"
+#~ msgstr "Неподдерживаемое смещение хэша VERITY.\n"
+
+#~ msgid "Suspend is not supported for device %s.\n"
+#~ msgstr "Приостановка не поддерживается для устройства %s.\n"
+
+#~ msgid "Error during suspending device %s.\n"
+#~ msgstr "Ошибка во время приостановки устройства %s.\n"
+
+#~ msgid "Can't format LOOPAES without device.\n"
+#~ msgstr "Невозможно отформатировать LOOPAES без устройства.\n"
+
+#~ msgid "Unsupported VERITY hash type %d.\n"
+#~ msgstr "Неподдерживаемый тип хэша VERITY %d.\n"
+
+#~ msgid "Can't format VERITY without device.\n"
+#~ msgstr "Невозможно отформатировать VERITY без устройства.\n"
+
+#~ msgid "UUID is not supported for this crypt type.\n"
+#~ msgstr "UUID не поддерживается для этого типа шифрования.\n"
+
+#~ msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
+#~ msgstr "Невозможно использовать устройство %s, которое уже используется (уже внесено в схему или подключено).\n"
diff --git a/po/sr.gmo b/po/sr.gmo
new file mode 100644 (file)
index 0000000..df14b95
Binary files /dev/null and b/po/sr.gmo differ
diff --git a/po/sr.po b/po/sr.po
new file mode 100644 (file)
index 0000000..7562471
--- /dev/null
+++ b/po/sr.po
@@ -0,0 +1,3927 @@
+# Serbian translation for cryptsetup.
+# Copyright © 2014 Free Software Foundation, Inc.
+# This file is distributed under the same license as the cryptsetup package.
+# Мирослав Николић <miroslavnikolic@rocketmail.com>, 2014–2020.
+msgid ""
+msgstr ""
+"Project-Id-Version: cryptsetup-2.3.2-rc0\n"
+"Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-02 22:38+0200\n"
+"Last-Translator: Мирослав Николић <miroslavnikolic@rocketmail.com>\n"
+"Language-Team: Serbian <(nothing)>\n"
+"Language: sr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"X-Generator: Virtaal 0.7.1\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Не могу да покренем мапера уређаја, радим као обичан корисник."
+
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Не могу да покренем мапера уређаја. Да ли је учитан модул кернела „dm_mod“?"
+
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Затражена одложена заставица није подржана."
+
+#: lib/libdevmapper.c:1198
+#, c-format
+msgid "DM-UUID for device %s was truncated."
+msgstr "ДМ-УЈИБ за уређај „%s“ је скраћен."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Непозната врста „dm“ мете."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Затражене опције перформанси дм-шифровања нису подржане."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Затражене опције рада оштећених података дм-веритија нису подржане."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Затражене „dm-verity FEC“ опције нису подржане."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Затражене опције целовитости података нису подржане."
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Затражене опције величине одељка нису подржане."
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Затражене опције самосталног прерачунавања ознака целовитости нису подржане."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Одбацивање/ОДСЕЦАЊЕ није подржано."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Затражени режим битмапе дм-целовитости није подржан."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Нисам успео да пропитам „dm-%s“ подеок."
+
+#: lib/random.c:75
+msgid ""
+"System is out of entropy while generating volume key.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
+msgstr ""
+"Систем је ван ентропије приликом стварања кључа волумена.\n"
+"Померите миша или откуцајте неки текст у другом прозору да прикупите неке насумичне догађаје.\n"
+
+#: lib/random.c:79
+#, c-format
+msgid "Generating key (%d%% done).\n"
+msgstr "Стварам кључ (%d %% је урађено).\n"
+
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Ради у „FIPS“ режиму."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Кобна грешка за време покретања „RNG“-а."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Затражен је непознат квалитет „RNG“-а."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Грешка читања из „RNG“-а."
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Не могу да покренем „RNG“ позадинца криптографије."
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Не могу да покренем позадинца криптографије."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Хеш алгоритам „%s“ није подржан."
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Грешка обраде кључа (користим хеш %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Не могу да одредим врсту уређаја. Несагласно покретање уређаја?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Ова радња је подржана само за ЛУКС уређај."
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Ова радња је подржана само за ЛУКС2 уређај."
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Сви утори кључева су пуни."
+
+#: lib/setup.c:434
+#, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Утор кључа %d није исправан, изаберите између 0 и %d."
+
+#: lib/setup.c:440
+#, c-format
+msgid "Key slot %d is full, please select another one."
+msgstr "Утор кључа %d је пун, изаберите неки други."
+
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "Величина уређаја није поравната на величину логичког блока уређаја."
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Заглавље је откривено али уређај „%s“ је премали."
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Ова радња није подржана за ову врсту уређаја."
+
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Неисправна радња са поновним шифровањем је у току."
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "Неподржано ЛУКС издање %d."
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Откачени уређај метаподатака није подржан за ову врсту криптографије."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, c-format
+msgid "Device %s is not active."
+msgstr "Уређај „%s“ није радан."
+
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Основни уређај за криптографски уређај „%s“ је нестао."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Неисправни параметри обичне криптографије."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Неисправна величина кључа."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "УЈИБ није подржан за ову врсту криптографије."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Неподржана величина одељка шифровања."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Величина уређаја није поравната на затражену величину одељка."
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Не могу да обликујем ЛУКС без уређаја."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Затражено поравнање података није сагласно са померајем података."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "УПОЗОРЕЊЕ: Померај података је ван тренутно доступног уређаја података.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Не могу да обришем заглавље на уређају „%s“."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "УПОЗОРЕЊЕ: Покретање уређаја неће успети, „dm-crypt“-у недостаје подршка за затражену величину одељка шифровања.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Кључ волумена је премали за шифровање са проширењима целовитости."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Шифрер %s-%s (величина кључа %zd бита) није доступан."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "УПОЗОРЕЊЕ: Величина ЛУКС2 метаподатака је промењена на %<PRIu64> бајта.\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "УПОЗОРЕЊЕ: Величина области ЛУКС2 утора кључева је промењена на %<PRIu64> бајта.\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "Уређај „%s“ је премали."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Не могу да обликујем уређај „%s“ у употреби."
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Не могу да обликујем уређај „%s“, овлашћење је одбијено."
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Не могу да обликујем целовитост за уређај „%s“."
+
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "Не могу да обликујем уређај „%s“."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Не могу да обликујем „LOOPAES“ без уређаја."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Не могу да обликујем „VERITY“ без уређаја."
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "Неподржана врста „VERITY“ хеша %d."
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Неподржана величина блока „VERITY“."
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Неподржан померај хеша „VERITY“."
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Неподржан „VERITY FEC“ померај."
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Област података се преклапа са облашћу хеша."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Област хеша се преклапа са „FEC“ облашћу."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Област података се преклапа са „FEC“ облашћу."
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "УПОЗОРЕЊЕ: Затражена величина ознаке %d бајта се разликује од излаза величине „%s“ (%d бајта).\n"
+
+#: lib/setup.c:2286
+#, c-format
+msgid "Unknown crypt device type %s requested."
+msgstr "Затражена је непозната врста „%s“ криптографског уређаја."
+
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "Неподржани параметри на уређају „%s“."
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Неодговарајући параметри на уређају „%s“."
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Криптографски уређаји се не поклапају."
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "Нисам успео поново да учитам уређај „%s“."
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, c-format
+msgid "Failed to suspend device %s."
+msgstr "Нисам успео да обуставим уређај „%s“."
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Нисам успео да наставим са уређајем „%s“."
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Кобна грешка приликом поновног учитавања уређаја „%s“ (на врху уређаја „%s“)."
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Нисам успео да променим уређај „%s“ на дм-грешку."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Не могу да променим величину уређаја петље."
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "Да ли стварно желите да измените УЈИБ уређаја?"
+
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Датотека резерве заглавља не садржи сагласно ЛУКС заглавље."
+
+#: lib/setup.c:3058
+#, c-format
+msgid "Volume %s is not active."
+msgstr "Волумен „%s“ није радан."
+
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
+msgstr "Волумен „%s“ је већ обустављен."
+
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "Обустављање није подржано за уређај „%s“."
+
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "Грешка за време обустављања уређаја „%s“."
+
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "Волумен „%s“ није обустављен."
+
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
+msgstr "Настављање није подржано за уређај „%s“."
+
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "Грешка за време настављања уређаја „%s“."
+
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Кључ волумена не одговара волумену."
+
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Не могу да додам утор кључа, сви утори су искључени а није обезбеђен ниједан кључ волумена."
+
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Нисам успео да разменим нови утор кључа."
+
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Утор кључа „%d“ није исправан."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Утор кључа „%d“ није радан."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Заглавље уређаја се преклапа са облашћу података."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Поновно шифровање је у току. Не могу да активирам уређај."
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Нисам успео да добавим закључавање поновног шифровања."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Опоравак ЛУКС2 поновног шифровања није успело."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Врста уређаја није исправно покренута."
+
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Не могу да користим уређај „%s“, назив није исправан или је још у употреби."
+
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "Већ постоји уређај „%s“."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Наведен је неисправан кључ волумена за обичан уређај."
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Наведен је неисправан хеш корена за уређај тачности."
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Потпис хеша корена је потребан."
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Привезак кључева кернела недостаје: потребан је за прослеђивање потписа кернелу."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Нисам успео да учитам кључ у привеску кључева кернела."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Уређај „%s“ је још увеку употреби."
+
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "Неисправан уређај „%s“."
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Међумеморија кључа волумена је премала."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Не могу да довучем кључ волумена за обичан уређај."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Не могу да довучем хеш корена за уређај тачности."
+
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Ова радња није подржана за криптографски уређај „%s“."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Радња исписа није подржана за ову врсту уређаја."
+
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Померај података није умножак %u бајта."
+
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Не могу да преобратим уређај „%s“ који је још увек у употреби."
+
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Нисам успео да доделим утор кључа „%u“ као нови кључ волумена."
+
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Нисам успео да покренем основне параметре ЛУКС2 утора кључа."
+
+#: lib/setup.c:5851
+#, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Нисам успео да доделим утор кључа „%d“ за преглед."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Привезак кључева кернела није подржан кернелом."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Нисам успео да прочитам пропусну реч из привеска кључа (грешка %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Нисам успео да остварим опште закључавање серијализације приступа чврстој меморији."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Не могу да добавим хитност процеса."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Не могу да откључам меморију."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Нисам успео да отворим датотеку кључа."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Не могу да прочитам датотеку кључа из терминала."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Нисам успео да добавим податке датотеке кључа."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Не могу да премотам на затражени померај датотеке кључа."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Нестало је меморије приликом читања пропусне речи."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Грешка читања пропусне речи."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Нема ничега за читање на улазу."
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Премашена је највећа величина датотеке кључа."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Не могу да прочитам затражену количину података."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "Уређај „%s“ не постоји или је приступ одбијен."
+
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Уређај „%s“ није сагласан."
+
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Уређај „%s“ је премали. Захтева барем %<PRIu64> бајта."
+
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Не могу да користим уређај „%s“ који је у употреби (већ мапиран или прикачен)."
+
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Не могу да користим уређај „%s“, овлашћење је одбијено."
+
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Не могу да добавим податке о уређају „%s“."
+
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Не могу да користим уређај повратне петље, радим као обичан корисник."
+
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Прикачињање уређаја повратне петље није успело (потребан је уређај петље са опцијом самочишћења)."
+
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Захтевани померај је изван стварне величине уређаја „%s“."
+
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Уређај „%s“ има нулту величину."
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Затражено време „PBKDF“ мете не може бити нула."
+
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Непозната „PBKDF“ врста „%s“."
+
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Затражени хеш „%s“ није подржан."
+
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Затражена „PBKDF“ врста није подржана за ЛУКС1."
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Највећа „PBKDF“ меморија или паралелне нити не смеју бити подешене са „pbkdf2“."
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Присиљени број понављања је премали за „%s“ (минимум је %u)."
+
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Присиљени трошак меморије је премали за „%s“ (минимум је %u килобајта)."
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Затражени највећи трошак „PBKDF“ меморије је превисок (максимум је %d килобајта)."
+
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Затражени максимум „PBKDF“ меморије не може бити нула."
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Затражене „PBKDF“ паралелне нити не могу бити нула."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "Само „PBKDF2“ је подржано у „FIPS“ режиму."
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "„PBKDF“ оцењивање је искључено али понављања нису постављена."
+
+#: lib/utils_benchmark.c:191
+#, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Нису сагласне „PBKDF2“ опције (користим хеш алгоритам %s)."
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Несагласне „PBKDF“ опције."
+
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Закључавање је прекинуто. Путања закључавања „%s/%s“ је неискористива (није директоријум или недостаје)."
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "УПОЗОРЕЊЕ: Директоријум закључавања „%s/%s“ недостаје!\n"
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Закључавање је прекинуто. Путања закључавања „%s/%s“ је неискористива („%s“ није директоријум)."
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Не могу да премотам на померај уређаја."
+
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Грешка брисања уређаја, померај %<PRIu64>."
+
+#: lib/luks1/keyencryption.c:39
+#, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"Нисам успео да подесим мапирање кључа „dm-crypt“ за уређај %s.\n"
+"Проверите да ли кернел подржава „%s“ шифрера (проверите дневник система за више података)."
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Величина кључа у „XTS“ режиму мора да буде 256 или 512 бита."
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "Спецификација шифрера треба бити у запису „[шифрер]-[режим]-[ив]“."
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "Не могу да пишем на уређај „%s“, овлашћење је одбијено."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Нисам успео да отворим привремени уређај смештаја кључа."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Нисам успео да приступм привременом уређају смештаја кључа."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Грешка УИ приликом шифровања утора кључа."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Не могу да отворим уређај „%s“."
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Грешка УИ приликом дешифровања утора кључа."
+
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Уређај „%s“ је премали. (ЛУКС1 захтева барем %<PRIu64> бајта.)"
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "ЛУКС утор кључа „%u“ није исправан."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "Уређај „%s“ није исправан ЛУКС уређај."
+
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, c-format
+msgid "Requested header backup file %s already exists."
+msgstr "Затражена датотека резерве заглавља „%s“ већ постоји."
+
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
+msgstr "Не могу да направим резервну датотеку заглавља „%s“."
+
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
+msgstr "Не могу да запишем резервну датотеку заглавља „%s“."
+
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Датотека резерве не садржи исправно ЛУКС заглавље."
+
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, c-format
+msgid "Cannot open header backup file %s."
+msgstr "Не могу да отворим резервну датотеку заглавља „%s“."
+
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, c-format
+msgid "Cannot read header backup file %s."
+msgstr "Не могу да прочитам резервну датотеку заглавља „%s“."
+
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Померај датума или величина кључа се разликују на уређају и резерви, враћање није успело."
+
+#: lib/luks1/keymanage.c:325
+#, c-format
+msgid "Device %s %s%s"
+msgstr "Уређај %s %s%s"
+
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "не садржи ЛУКС заглавље. Замена заглавља може да уништи податке на том уређају."
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "већ садржи ЛУКС заглавље. Замена заглавља ће уништити постојеће уторе кључева."
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
+msgstr ""
+"\n"
+"УПОЗОРЕЊЕ: право заглавље уређаја има другачији УЈИБ од резерве!"
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Неуобичајена величина кључа, потребна је ручна поправка."
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Неуобичајено поравнање утора кључева, потребна је ручна поправка."
+
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Поправљам уторе кључева."
+
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Утор кључа %i: померај је оправљен (%u —> %u)."
+
+#: lib/luks1/keymanage.c:417
+#, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Утор кључа %i: траке су оправљене (%u —> %u)."
+
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Утор кључа %i: лажан потпис партиције."
+
+#: lib/luks1/keymanage.c:431
+#, c-format
+msgid "Keyslot %i: salt wiped."
+msgstr "Утор кључа %i: присолак је обрисан."
+
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Записујем ЛУКС заглавље на диск."
+
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Поправка није успела."
+
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, c-format
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Затражени ЛУКС хеш „%s“ није подржан."
+
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Нису откривени познати проблеми за ЛУКС заглавље."
+
+#: lib/luks1/keymanage.c:660
+#, c-format
+msgid "Error during update of LUKS header on device %s."
+msgstr "Грешка приликом освежавања ЛУКС заглавља на уређају „%s“."
+
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Грешка поновног читања ЛУКС заглавља након освежења на уређају „%s“."
+
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Померај података за ЛУКС заглавље мора бити или 0 или већи од величине заглавља."
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Достављен је погрешан запис ЛУКС УЈИБ-а."
+
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Не могу да направим ЛУКС заглавље: није успело читање насумичног присолка."
+
+#: lib/luks1/keymanage.c:804
+#, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Не могу да направим ЛУКС заглавље: није успео преглед заглавља (користим хеш „%s“)."
+
+#: lib/luks1/keymanage.c:848
+#, c-format
+msgid "Key slot %d active, purge first."
+msgstr "Утор кључа „%d“ је радан, прво прочистите."
+
+#: lib/luks1/keymanage.c:854
+#, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Материјал утора кључа „%d“ обухвата премало трака. Да управљам заглављем?"
+
+#: lib/luks1/keymanage.c:990
+#, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Не могу да отворим утор кључа (користим хеш %s)."
+
+#: lib/luks1/keymanage.c:1066
+#, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Утор кључа %d није исправан, изаберите га између 0 и %d."
+
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, c-format
+msgid "Cannot wipe device %s."
+msgstr "Не могу да обришем уређај „%s“."
+
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Откривена је још увек неподржана ГПГ-ом шифрована датотека кључа."
+
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "Користите „gpg --decrypt <ДАТОТЕКА_КЉУЧА> | cryptsetup --keyfile=- ...“\n"
+
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Откривена је несагласна датотека кључа „AES“ петље."
+
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Језгро не подржава мапирање сагласно са „AES“ петљом."
+
+#: lib/tcrypt/tcrypt.c:504
+#, c-format
+msgid "Error reading keyfile %s."
+msgstr "Грешка читања датотеке кључа „%s“."
+
+#: lib/tcrypt/tcrypt.c:554
+#, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Премашена је највећа дужина „TCRYPT“ пропусне речи (%zu)."
+
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "„PBKDF2“ алгоритам хеша „%s“ није доступан, прескачем."
+
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Није доступно затражено сучеље криптографије језгра."
+
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Уверите се да је учитан модул кернела „algif_skcipher“."
+
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "Покретање није подржано за величину %d области."
+
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Језгро не подржава покретање за овај стари „TCRYPT“ режим."
+
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Покрећем „TCRYPT“ систем шифровања за партицију „%s“."
+
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Кернел не подржава мапирање сагласно са „TCRYPT“-ом."
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "Ова функција није подржана без учитавања „TCRYPT“ заглавља."
+
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "Нађох неочекивану врсту уноса метаподатака „%u“ приликом обраде подржаног главног кључа волумена."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Нађох неисправну ниску приликом обраде главног кључа волумена."
+
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Нађох неочекивану ниску („%s“) приликом обраде подржаног главног кључа волумена."
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "Нађох неочекивану вредност уноса метаподатака „%u“ приликом обраде подржаног главног кључа волумена."
+
+#: lib/bitlk/bitlk.c:479
+#, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Нисам успео да прочитам „BITLK“ потпис из „%s“."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "„BITLK“ издање 1 тренутно није подржано."
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Неисправан или непознат потпис учитавања за „BITLK“ уређај."
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Неисправан или непознат потпис за „BITLK“ уређај."
+
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Неподржана величина одељка шифровања."
+
+#: lib/bitlk/bitlk.c:518
+#, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Нисам успео да прочитам „BITLK“ заглавље из „%s“."
+
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Нисам успео да прочитам „BITLK FVE“ метаподатаке из „%s“."
+
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Непозната или неподржана врста криптографије."
+
+#: lib/bitlk/bitlk.c:627
+#, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Нисам успео да прочитам уносе „BITLK“ метаподатака из „%s“."
+
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Радња није подржана."
+
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Погрешна величина кључа."
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Овај „BITLK“ уређај је у неподржаном стању и не може бити активиран."
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "„BITLK“ уређај са врстом „%s“ се не може активирати."
+
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Активирање делимично дешифрованог „BITLK“ уређаја није подржано."
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Не могу да активирам уређај, „dm-crypt“-у кернела недостаје подршка за „BITLK IV“."
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Не могу да активирам уређај, „dm-crypt“-у кернела недостаје подршка за „BITLK Elephant“ дифузера."
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Уређај тачности %s не користи заглавље на-диску."
+
+#: lib/verity/verity.c:90
+#, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "Уређај „%s“ није исправан „VERITY“ уређај."
+
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Неподржано издање „VERITY“ %d."
+
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Заглавље „VERITY“ је оштећено."
+
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Достављен је погрешан УЈИБ „VERITY“ запис на уређају „%s“."
+
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Грешка приликом освежавања заглавља тачности на уређају „%s“."
+
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "Провера хеш потписа корена није подржана."
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Грешке се не могу поправити са „FEC“ уређајем."
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Нађох поправљиве грешке (%u) са „FEC“ уређајем."
+
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Кернел не подржава мапирање дм-тачности."
+
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Кернел не подржава опцију потписа дм-тачности."
+
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Уређај тачности је открио оштећење након покретања."
+
+#: lib/verity/verity_hash.c:59
+#, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Сувишна област није нулирана на положају %<PRIu64>."
+
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Прекорачење помераја уређаја."
+
+#: lib/verity/verity_hash.c:203
+#, c-format
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Провера није успела на положају %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Неисправни параметри величине за уређај тачности."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Прекорачење области хеша."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Провера области података није успела."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Провера хеша корена није успела."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Улазно/излазна грешка приликом стварања области хеша."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Стварање области хеша није успело."
+
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "УПОЗОРЕЊЕ: Језгро не може да покрене уређајако величина блока података премашује величину странице (%u)."
+
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Нисам успео да доделим „RS“ контекст."
+
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Нисам успео да доделим међумеморију."
+
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Нисам успео да прочитам „RS“ блок %<PRIu64> бајта %d."
+
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Нисам успео да прочитам паритет „RS“ блока %<PRIu64>."
+
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Нисам успео да поправим паритет за блок %<PRIu64>."
+
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Нисам успео да запишем паритет „RS“ блока %<PRIu64>."
+
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Величине блокова морају одговарати за „FEC“."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Неисправан број бајтова паритета."
+
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Нисам успео да одредим величину за уређај „%s“."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Кернел не подржава мапирање дм-целовитости."
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Кернел не подржава поравнање фиксних метаподатака дм-целовитости."
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Нисам успео да остварим закључавање писања на уређају „%s“."
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Открих покушај истовременог ажурирања ЛУКС2 метаподатака. Прекидам."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+"Уређај садржи нејасне потписе, не могу сам да поправим ЛУКС2.\n"
+"Покрените „cryptsetup repair“ за опорављање."
+
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Затражени померај података је премали."
+
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "УПОЗОРЕЊЕ: област утора кључа (%<PRIu64> бајта) је врло мала, доступан број ЛУКС2 утора кључа врло ограничен.\n"
+
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Нисам успео да остварим закључавање читања на уређају „%s“."
+
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Забрањени ЛУКС2 захтеви су откривени у резерви „%s“."
+
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Померај података се разликује на уређају и резерви, враћање није успело."
+
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Бинарно заглавље са областима утора кључа се разликује на уређају и резерви, враћање није успело."
+
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Уређај %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "не садржи ЛУКС2 заглавље. Замена заглавља може да уништи податке на том уређају."
+
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "већ садржи „LUKS2“ заглавље. Замена заглавља ће уништити постојеће уторе кључева."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
+msgstr ""
+"\n"
+"УПОЗОРЕЊЕ: непознати ЛУКС2 захтеви су откривени у стварном заглављу уређаја!\n"
+"Замена заглавља резервом може оштетити податке на том уређају!"
+
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+"\n"
+"УПОЗОРЕЊЕ: Недовршено ван мрежно поновно шифровање је откривено на уређају!\n"
+"Замена заглавља резервом може оштетити податке."
+
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Занемарена непозната заставица „%s“."
+
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Недостаје кључ за „dm-crypt“ подеок %u"
+
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Нисам успео да подесим „dm-crypt“ подеок."
+
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Нисам успео да подесим „dm-linear“ подеок."
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Неподржано подешавање целовитости уређаја."
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Поновно шифровање је у току. Не могу да деактивирам уређај."
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Нисам успео да заменим обустављени уређај „%s“ са метом „dm-error“."
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Нисам успео да прочитам ЛУКС2 захтеве."
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Неоствариви ЛУКС2 захтеви су откривени."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Радња је несагласна са уређајем означеним за старо поновно шифровање. Прекидам."
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Радња је несагласна са уређајем означеним за ЛУКС2 поновно шифровање. Прекидам."
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Нема довољно доступне меморије за отварање утора кључа."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Отварање утора кључа није успело."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Не могу користити шифрер „%s-%s“ за шифровање утора кључа."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Нема простора за нови утор кључа."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Не могу да проверим стање уређаја са ујиб-ом: %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Не могу да претворим заглавље са „LUKSMETA“ додатним метаподацима."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Не могу да преместим област утора кључа. Нема довољно простора."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Не могу да преместим област утора кључа. Област ЛУКС2 утора кључа је премала."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Не могу да преместим област утора кључа."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Не могу да претворим у ЛУКС1 запис – основна величина подеока 512 bytes."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Не могу да претворим у ЛУКС1 запис – прегледи утора кључа нису ЛУКС1 сагласни."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Не могу да претворим у ЛУКС1 запис – уређај користи умотаног шифрера кључа „%s“."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Не могу да претворим у ЛУКС1 запис – ЛУКС2 заглавље садржи %u скупину(е)."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Не могу да претворим у ЛУКС1 запис – утор кључа %u је у неисправном стању."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Не могу да претворим у ЛУКС1 запис – утор %u (преко максимума утора) је још активан."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Не могу да претворим у ЛУКС1 запис – утор кључа %u није ЛУКС1 сагласан."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Величина вруће зоне мора бити умножак прорачунатог поравнања зоне (%zu бајта)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Величина уређаја мора бити производ прорачунатог поравнања зоне (%zu бајта)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Неподржан режим гипкости „%s“"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Нисам успео да покренем старог увијача смештаја подеока."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Нисам успео да покренем новог увијача смештаја подеока."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Нисам успео да прочитам суму провере за текућу врућу зону."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Нисам успео да прочитам област вруће зоне са почетком на %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Нисам успео да дешифрујем област %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Нисам успео да опоравим област %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Величине изворног и циљног уређаја не одговарају. Извор %<PRIu64>, мета: %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Нисам успео да активирам уређај вруће зоне „%s“."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Нисам успео да активирам уређај преклапања „%s“ са стварном табелом порекла."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Нисам успео да учитам ново мапирање за уређај „%s“."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Нисам успео да освежим спремник уређаја поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Нисам успео да подесим нову величину области утора кључа."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Помак података није поравнат на захтевану величину одељка шифровања (%<PRIu32> бајта)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Уређај података није поравнат на захтевану величину одељка шифровања (%<PRIu32> бајта)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Помак података (%<PRIu64> одељка) је мањи од будућег помераја података (%<PRIu64> одељка)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Нисам успео да отворим „%s“ у искључивом режиму (већ мапиран или прикачен)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Уређај није означен за ЛУКС2 поновно шифровање."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Нисам успео да учитам контекст ЛУКС2 поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Нисам успео да добавим стање поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Уређај није у поновном шифровању."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Процес поновног шифровања је већ покренут."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Нисам успео да остварим закључавање поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "Не могу да наставим са поновним шифровањем. Прво покрените опоравак поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Активна величина уређаја и величина затраженог поновног шифровања не одговарају."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "Неисправна величина уређаја је затражена у параметрима поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Поновно шифровање је у току. Не могу да обавим опоравак."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "ЛУКС2 поновно шифровање је већ покренуто у метаподацима."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Нисам успео да покренем ЛУКС2 поновно шифровање у метаподацима."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Нисам успео да поставим подеоке уређаја за следећу врућу зону поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Нисам успео да запишем метаподатаке гипкости поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Дешифровање није успело."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Нисам успео да запишем област вруће зоне са почетком на %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Нисам успео да усагласим податке."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Нисам успео да освежим метаподатке након тренутно завршеног поновног шифровања вруће зоне."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Нисам успео да запишем ЛУКС2 метаподатке."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Нисам успео да очистим податке подеока резерве."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Нисам успео да искључим заставицу захтева поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Кобна грешка приликом поновног шифровања комада који почиње на %<PRIu64>, %<PRIu64> подеока дуг."
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Не наставља са уређајем осим ако није ручно замењен метом грешке."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "Не могу да наставим са поновним шифровањем. Неочекивано стање поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Недостаје или неисправан контекст поновног шифровања."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Нисам успео да покренем поновно шифровање спремника уређаја."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Нисам успео да освежим контекст поновног шифровања."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Нема слободног утора скупине."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Нисам успео да направим уграђену скупину „%s“."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Не могу да одрадим проверу пропусне речи на не-конзолним улазима."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Параметри шифровања утора кључа се могу поставити само за ЛУКС2 уређај."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Није откривен познат образац одреднице шифрера."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "УПОЗОРЕЊЕ: Параметар „--hash“ је занемарен у обичном режиму са наведеном кључном датотеком.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "УПОЗОРЕЊЕ: Опција „--keyfile-size“ је занемарена, величина читања је иста као величина кључа шифровања.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Открих потпис(е) уређаја на „%s“. Даље настављање може оштетити постојеће податке."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Радња је обустављена.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Захтевана је опција „--key-file“."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Унесите „VeraCrypt PIM“: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Неисправна „PIM“ вредност: грешка обраде."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Неисправна „PIM“ вредност: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Неисправна „PIM“ вредност: изван опсега."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Није откривено заглавље уређаја са овом пропусном речи."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Уређај „%s“ није исправан „BITLK“ уређај."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Избачај заглавља са кључем волумена је осетљив податак\n"
+"који омогућава приступ шифрованој партицији без лозинке.\n"
+"Овај избачај треба увек бити смештен шифрован на безбедном месту."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Уређај „%s“ је још увек активан и заказан за одложено уклањање.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Сразмеравање активног уређаја захтева кључ волумена у привеску кључева али је постављена „--disable-keyring“ опција."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Оцењивање је прекинуто."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "„PBKDF2-%-9s“     Н/Д\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "„PBKDF2-%-9s“ %7u понављања у секунди за %zu-битни кључ\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s Н/Д\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u понављања, %5u меморије, %1u паралелних нити (процесора) за %zu-битни кључ (захтева се %u ms време)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Резултат оцењивања није поуздан."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Пробе су приближне користећи само меморију (без УИ смештаја).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s  Алгоритам |     Кључ |      Шифровање |      Дешифровање\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Шифрер „%s“ (са %i битним кључем) није доступан."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#      Алгоритам |      Кључ |      Шифровање |      Дешифровање\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "Недоступно"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Изгледа да уређај не захтева опоравак поновног шифровања.\n"
+"Да ли желите да наставите?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Да наставим са опоравком ЛУКС2 поновног шифровања?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Унесите пропусну реч за опоравак поновног шифровања: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Стварно да покушам да поправим заглавље ЛУКС уређаја?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Бришем уређај да бих започео суму провере целовитости.\n"
+"Можете прекинути ово притиском на „CTRL+c“ (остатак необрисаног уређаја садржаће неисправну суму провере).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Не могу да деактивирам привремени уређај „%s“."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Опција целовитости се може користити само за ЛУКС2 запис."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Неподржана опција величине ЛУКС2 метаподатака."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Не могу да направим датотеку заглавља „%s“."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Није откривен познат образац одреднице целовитости."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Не могу да користим „%s“ као заглавље на-диску."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Ово ће неповратно да препише податке на „%s“."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Нисам успео да подесим „pbkdf“ параметре."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Смањени померај података је допуштен само за откачена ЛУКС заглавља."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Не могу да одредим величину кључа за ЛУКС без утора кључа, користите „--key-size“ опцију."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Уређај је активиран али не могу да учиним заставице трајним."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Утор кључа „%d“ је изабран за брисање."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Ово је последњи утор кључа. Уређај ће постати неупотребљив након чишћења овог кључа."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Унесите неку преосталу пропусну реч: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Радња је прекинута, утор кључа НИЈЕ обрисан.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Унесите пропусну реч за брисање: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Унесите нову пропусну реч за утор кључа: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Унесите неку постојећу пропусну реч: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Унесите пропусну реч за мењање: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Унесите нову пропусну реч: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Унесите пропусну реч за утор кључа за претварање: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Подржан је само један аргумент уређаја за радњу „isLuks“."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Избачај заглавља са кључем волумена је осетљив податак\n"
+"који омогућава приступ шифрованој партицији без лозинке.\n"
+"Овај избачај треба бити смештен шифрован на безбедном месту."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Утор кључа %d не садржи несвезани кључ."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Избачај заглавља са кључем волумена је осетљив податак\n"
+"Овај избачај треба увек бити смештен шифрован на безбедном месту."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Захтевана је опција „--header-backup-file“."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "„%s“ није уређај управљан криптоподешавањем."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Освежавање није подржано за врсту уређаја „%s“"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Непозната врста уређаја метаподатака „%s“."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Наредба захтева уређај и мапирани назив као аргумент."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Ова радња ће обрисати све уторе кључева на уређају „%s“.\n"
+"Уређај ће постати неупотребљив након ове радње."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Радња је прекинута, утори кључева НИСУ обрисани.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Неисправна ЛУКС врста, само „luks1“ и „luks2“ су подржане."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Уређај је већ „%s“ врсте."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Ова радња ће претворити „%s“ у „%s“ запис.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Радња је прекинута, уређај НИЈЕ претворен.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Недостаје опција „--priority“, „--label“ или „--subsystem“."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Скупина „%d“ није исправна."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Скупина „%d“ је у употреби."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Нисам успео да додам „luks2-keyring“ скупину „%d“."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Нисам успео да доделим скупину „%d“ утору кључа %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Скупина „%d“ није у употреби."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Нисам успео да увезем скупину из датотеке."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Нисам успео да добавим скупину „%d“ за извоз."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "„--key-description“ параметар је обавезан за радњу додавања скупине."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Радња захтева нарочиту скупину. Користите параметар „--token-id“."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Неисправна радња скупине „%s“."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Самооткривени активан дм уређај „%sд за уређај података „%s“.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Уређај „%s“ није блок уређај.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Нисам успео да самооткријем држаче „%s“ уређаја."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Не могу да одлучим да ли је уређај „%s“ активиран или није.\n"
+"Да ли сигурно желите да наставите са поновним шифровањем у режиму ван мреже?\n"
+"То може довести до оштећења података ако је уређај заправо активиран.\n"
+"Да покренете поновно шифровање у режиму на мрежи, користите параметар „--active-name“.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Неисправна врста ЛУКС уређаја."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Шифровање без откаченог заглавља (--header) није могуће без смањења величине уређаја података (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Затражени померај података мора бити мањи или једнак половини параметра „--reduce-device-size“."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Подешавам „--reduce-device-size“ вредност на двоструко од „--offset“ %<PRIu64> (подеока).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Шифровање је подржано само за ЛУКС2 запис."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "Откривен је ЛУКС уређај на „%s“. Да ли желите опет да шифрујете тај ЛУКС уређај?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Привремена датотека заглавља „%s“ већ постоји. Прекидам."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Не могу да направим привремену датотеку заглавља „%s“."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "„%s/%s“ је сада активно и спремно за шифровање на мрежи.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Нема довољно слободних утора кључева за поновно шифровање."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Датотека кључа може бити коришћена само са „--key-slot“ или са тачно једним активним утором кључа."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Унесите пропусну реч за утор кључа %d: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Унесите пропусну реч за утор кључа %u: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Наредба захтева уређај као аргумент."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "Само је ЛУКС2 запис тренутно подржан. Користите алат „cryptsetup-reencrypt“ за ЛУКС1."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Старо ванмрежно поновно шифровање је већ у току. Користите помагало „cryptsetup-reencrypt“."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Поновно шифровање уређаја са профилом целовитости није подржано."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "ЛУКС2 поновно шифровање је већ покренуто. Прекидам радњу."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "ЛУКС2 уређај није у поновном шифровању."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<уређај> [--type <врста>] [<назив>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "отвара уређај као <назив>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<назив>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "затвара уређај (уклања мапирање)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "мења величину радног уређаја"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "показује стање уређаја"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <шифрер>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "шифрер оцењивања"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<уређај>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "покушава да поправи метаподатке на-диску"
+
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "ЛУКС2 уређај поновног шифровања"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "брише све уторе кључева (уклања кључ шифровања)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "претвара ЛУКС из/у ЛУКС2 запис"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "поставља трајне опције подешавања за ЛУКС2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<уређај> [<нова датотека кључа>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "форматира ЛУКС уређај"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "додаје кључ у ЛУКС уређај"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<уређај> [<датотека кључа>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "уклања достављени кључ или датотеку кључа из ЛУКС уређаја"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "мења достављени кључ или датотеку кључа ЛУКС уређаја"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "претвара кључ у нове „pbkdf“ параметре"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<уређај> <утор кључа>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "брише кључ са бројем <утор кључа> са ЛУКС уређаја"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "исписује УЈИБ ЛУКС уређаја"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "испробава <уређај> за заглављем ЛУКС партиције"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "исписује податке ЛУКС партиције"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "исписује податке ТКРИПТ уређаја"
+
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "исписује податке „BITLK“ уређаја"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Обуставља ЛУКС уређај и брише кључ (сви УИ су замрзнути)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Наставља са обустављеним ЛУКС уређајем"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Прави резерву заглавља „LUKS“ уређаја и утора кључева"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Враћа заглавље „LUKS“ уређаја и уторе кључева"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<додај|уклони|увези|извези> <уређај>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Управља ЛУКС2 скупинама"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<радња> је једна од следећих:\n"
+
+#: src/cryptsetup.c:3395
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"Можете такође да користите старе надимке синтаксе <радње>:\n"
+"\tотварање: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tзатвори: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<назив> је уређај за стварање под „%s“\n"
+"<уређај> је шифровани уређај\n"
+"<утор кључа> је број ЛУКС утора кључа за мењање\n"
+"<датотека кључа> изборна датотека кључа за нови кључ за радњу „luksAddKey“\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Основни уграђени запис метаподатака је „%s“ (за „luksFormat“ радњу).\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Основни параметри уграђеног кључа и пропусне речи:\n"
+"\tНајвећа величина датотеке кључа: %dkB, Највећа дужина међудејствене пропусне речи %d (знака)\n"
+"Основни „PBKDF“ за ЛУКС1: %s, време понављања: %d (ms)\n"
+"Основни „PBKDF“ за ЛУКС2: %s\n"
+"\tВреме понављања: %d, Захтевана меморија: %dkB, Паралелне нити: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Основни преведени параметри шифрера уређаја:\n"
+"\tпетља-АЕС: %s, Кључ %d бита\n"
+"\tобично: %s, Кључ: %d бита, Хеширање лозинке: %s\n"
+"\tЛУКС: %s, Кључ: %d бита, Хеширање ЛУКС заглавља: %s, РНГ: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tЛУКС: Основна величина кључа са „XTS“ режимом (два унутрашња кључа) биће удвостручена.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: захтева „%s“ као аргумент"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Приказује ову поруку помоћи"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Прикажите кратку поруку о коришћењу"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Исписује издање пакета"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Опције помоћи:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Приказује опширније поруке о грешкама"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Приказује поруке прочишћавања"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Приказује поруке прочишћавања укључујући „JSON“ метаподатке"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "Шифрер коришћен за шифровање диска (видите „/proc/crypto“)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "Хеш коришћен за стварање кључа шифровања из лозинке"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Проверава лозинку тражећи је два пута"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Чита кључ из датотеке"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "Чита (главни) кључ вочумена из датотеке."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Даје (главни) кључ волумена уместо података утора кључева"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "Величина кључа шифровања"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "БИТА"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Ограничава читање из датотеке кључа"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "бајта"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Број бајтова за прескакање у датотеци кључа"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Ограничава читање из новододате датотеке кључа"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Број бајтова за прескакање у новододатој датотеци кључа"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Број утора за нови кључ (основно је први слободан)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "Величина уређаја"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "ОДЕЉЦИ"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Користи само наведену величину уређаја (занемарује остатак уређаја). ОВО ЈЕ ОПСАНО!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "Почетни померај у позадинском уређају"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Број одељака шифрованих података за прескакање на почетку"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Прави мапирање само за читање"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Не тражи потврђивање"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Време за упит међудејствене лозинке (у секундама)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "секунде"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Напредак освежења реда (у секундама)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Колико често унос лозинке може бити покушан"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Поравнава утовар на границе <n> одељка — за „luksFormat“"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Датотека са резервом „LUKS“ заглавља и уторима кључева"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Користи „/dev/random“ за стварање кључа волумена"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Користи „/dev/urandom“ за стварање кључа волумена"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Дели уређај са другим не-преклапајућим подеоком шифрера"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "УЈИБ уређаја за коришћење"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Допушта одбацивања (тј. СКРАЋЕЊЕ) захтева за уређај"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Уређај или датотека са одвојеним ЛУКС заглављем"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Не покреће уређај, само проверава лозинку"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Користи скривено заглавље (скривени ТКРИПТ уређај)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Уређај је ТКРИПТ диск система (са подизачем система)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Користи резервно (другоразредно) ТКРИПТ заглавље"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Такође обавља преглед за уређајима сагласним са Веракриптом"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Лични умножавач понављања за „VeraCrypt“ сагласан уређај"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Пропитује лични умножавач понављања за „VeraCrypt“ сагласан уређај"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Врста метаподатака уређаја: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Искључује проверу квалитета лозинке (ако је укључена)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Користи опцију сагласности перформансе „same_cpu_crypt“ дм-крипта"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Користи опцију сагласности перформансе „submit_from_crypt_cpus“ дм-крипта"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Уклањање уређаја је одложено све док га последњи корисник не затвори"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Користи опште закључавање за серијализацију меморије чврстог „PBKDF“ („OOM“ заобилазница)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Време „PBKDF“ понављања за ЛУКС (у милисекундама)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "милисекунде"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "„PBKDF“ алгоритам (за ЛУКС2): argon2i, argon2id, pbkdf2"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Ограничење трошка „PBKDF“ меморије"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "килобајта"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Трошак „PBKDF“ паралеле"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "нити"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Трошак „PBKDF“ понављања (присилно, искључује оцењивање)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Првенство утора кључа: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Искључује закључавање метаподатака на-диску"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Искључује учитавање кључева волумена путем привеска кернела"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Алгоритам целовитости података (само ЛУКС2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Искључује журнал за уређај целовитости"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Не брише уређај након форматирања"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Користи неделотворно застарело допуњавање (стари кернели)"
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Не тражи пропусну реч ако активација скупином не успе"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Број скупине (основно: било који)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Опис кључа"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Величина одељка шифровања (основно: 512 бајта)"
+
+#: src/cryptsetup.c:3548
+#, fuzzy
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Величина одељка шифровања (основно: 512 бајта)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Поставља трајним заставице активирања за уређај"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Поставља натпис за ЛУКС2 уређај"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Поставља натпис подсистема за ЛУКС2 уређај"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Ствара или избацује неувезане (не додељене подеоке података) ЛУКС2 уторе кључа"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Чита или записује „json“ из или у датотеку"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Величина области метаподатака ЛУКС2 заглавља"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Величина области утора кључева ЛУКС2 заглавља"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Освежава (поново активира) уређај са новим параметрима"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "ЛУКС2 утор кључа: Величина кључа шифровања"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "ЛУКС2 утор кључа: Шифрер коришћен за шифровање исека кључа"
+
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Шифрује ЛУКС2 уређај (у месту шифровање)."
+
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Дешифрује ЛУКС2 уређај (уклања шифровање)."
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Покреће ЛУКС2 поновно шифровање само у метаподацима."
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Наставља само са започетим ЛУКС2 поновним шифровањем."
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Смањује величину уређаја података (премешта померај података). ОВО ЈЕ ОПАСНО!"
+
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Највећа величина вруће зоне поновног шифровања."
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Врста гипкости вруће зоне поновног шифровања (checksum,journal,none)"
+
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "Хеш суме првере вруће зоне поновног шифровања"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Заобилази самооткривање уређаја дм уређаја за поновно шифровање"
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[ОПЦИЈА...] <радња> <посебност-радње>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Недостаје аргумент <радња>."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Непозната радња."
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Опције „--refresh“ и „--test-passphrase“ се узајамно искључују."
+
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "Опција „--deferred“ је допуштена само за наредбу затварања."
+
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Опција „--shared“ је допуштена само за отварање обичног уређаја."
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Опција „--allow-discards“ је допуштена само за радњу отварања."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Опција „--persistent“ је допуштена само за радњу отварања."
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Опција „--serialize-memory-hard-pbkdf“ је допуштена само за радњу отварања."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Опција „--persistent“ није допуштена са опцијом „--test-passphrase“."
+
+#: src/cryptsetup.c:3753
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"Опција „--key-size“ је допуштена само за „luksFormat“, „luksAddKey“, отварање\n"
+"и оцењивање. Да ограничите читање из датотеке кључа користите „--keyfile-size=(бајтова)."
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Опција „--integrity“ је допуштена само за „luksFormat“ (ЛУКС2)."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Опција „--integrity-no-wipe“ се може користити само за радњу форматирања са проширењем целовитости."
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Опције „--label“ и „--subsystem“ су допуштене само за „luksFormat“ и „config LUKS2“."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Опција „--test-passphrase“ је допуштена само за отварање ЛУКС, „TCRYPT“ и „BITLK“ уређаја."
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Величина кључа мора бити умножак од 8 бита"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "Утор кључа није исправан."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Опција „--key-file“ има првенство над наведеним аргументом датотеке кључа."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "Негативан број за опцију није допуштен."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Дозвољен је само један аргумент „--key-file“."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Дозвољена је само једна опција „--use-[u]random“."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "Опција „--use-[u]random“ је допуштена само за „luksFormat“."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "Опција „--uuid“ је допуштена само за „luksFormat“ и „luksUUID“."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "Опција „--align-payload“ је допуштена само за „luksFormat“."
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Опције „--luks2-metadata-size“ и „--opt-luks2-keyslots-size“ су допуштене само за „luksFormat“ са ЛУКС-ом2."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Неисправна одредба величине ЛУКС2 метаподатака."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Неисправна одредба величине ЛУКС2 утора кључева."
+
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Опције „--align-payload“ и „--offset“ се не могу комбиновати."
+
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Опција „--skip“ је подржана само за отварање обичних и упетљаних уређаја."
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Опција „--offset“ је подржана само за отварање обичних и упетљаних уређаја, „luksFormat“ и поновно шифровање уређаја."
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Опција „--tcrypt-hidden“, „--tcrypt-system“ или „--tcrypt-backup“ је подржана само за ТКРИПТ уређај."
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Опција „--tcrypt-hidden“ не може бити обједињена са „--allow-discards“."
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Опција „--veracrypt“ је подржана само за ТКРИПТ уређај."
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Достављен је неисправан аргумент за параметар „--veracrypt-pim“."
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Опција „--veracrypt-pim“ је подржана само за „VeraCrypt“ сагласне уређаје."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Опција „--veracrypt-query-pim“ је подржана само за „VeraCrypt“ сагласне уређаје."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Опције „--veracrypt-pim“ и „--veracrypt-query-pim“ се узајамно искључују."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Опција „--priority“ може бити само „ignore/normal/prefer“."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Одредба утора кључа је потребна."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Функција произилажења кључа заснованог на пропусној речи (PBKDF) може бити само „pbkdf2“ или „argon2i/argon2id“."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "„PBKDF“ присиљена понављања се не могу комбиновати са опцијом времена понављања."
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "Опција величине сектора није подржана за ову наредбу."
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "Величина кључа је потребна са опцијом „--unbound“."
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Опција „--unbound“ се може користити само са радњама „luksAddKey“ и „luksDump“."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "Опција „--refresh“ се може користити само са радњом отварања."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "Не могу да искључим закључавање метаподатака."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Неисправна одредба највеће величине вруће зоне поновног шифровања."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Неисправна одредба величине уређаја."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Највећа величина смањења уређаја је 1 GiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Величина смањивања мора бити умножак одељка од 512 бајта."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "Неисправна одредба величине података."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Прекорачење величине смањења."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "ЛУКС2 дешифровање захтева опцију „--header“."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Величина уређаја мора бити умножак одељка од 512 бајта."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Опције „--reduce-device-size“ и „--data-size“ се не могу комбиновати."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Опције „--device-size“ и „--size“ се не могу комбиновати."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Опције „--ignore-corruption“ и „--restart-on-corruption“ се не могу користити заједно."
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Наведена је неисправна ниска присолка."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Не могу да направим хеш слику „%s“ ради уписа."
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Не могу да направим „FEC“ слику „%s“ ради уписа."
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Наведена је неисправна ниска хеша корена."
+
+#: src/veritysetup.c:187
+#, c-format
+msgid "Invalid signature file %s."
+msgstr "Неисправна датотека потписа „%s“."
+
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Не могу да прочитам датотеку потписа „%s“."
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<уређај_података> <уређај_хеша>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "форматира уређај"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<уређај_података> <уређај_хеша> <хеш_корена>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "проверава уређај"
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<уређај_података> <назив> <уређај_хеша> <хеш_корена>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "показује стање радног уређаја"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<уређај_хеша>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "приказује податке на-диску"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<назив> јесте уређај за стварање под „%s“\n"
+"<уређај_података> јесте уређај података\n"
+"<уређај_хеша> јесте уређај који садржи податке проверавања\n"
+"<хеш_корена> хеш кореног чвора на <уређају_хеша>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Основни преведени параметри дм-тачности:\n"
+"\tХеш: %s, Блок података (бајта): %u, Блок хеша (бајта): %u, Величина присолка: %u, Запис хеша: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Не користи суперблок тачности"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Врста записа (1 — обично, 0 — изворни Хром ОС)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "број"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Величина блока на уређају података"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Величина блока на уређају хеша"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "Бајтови „FEC“ парности"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Број блокова у датотеци података"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "блокови"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Путања до уређаја са подацима исправке грешке"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "путања"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Почетни померај на уређају хеша"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Почетни померај на „FEC“ уређају"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Алгоритам хеша"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "ниска"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Присолак"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "ниска хеша"
+
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Путања до датотеке потписа хеша корена"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Поново покреће језгро ако је откривено оштећење"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Занемарује оштећење, само га бележи у дневник"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Не проверава нулиране блокове"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Проверава блок података само приликом првог читања"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Опције „--ignore-corruption“, „--restart-on-corruption“ или „--ignore-zero-blocks“ су дозвољене само за радње отварања."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Опција „--root-hash-signature“ се може користити само за радњу отварања."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Опције „--ignore-corruption“ и „--restart-on-corruption“ се не могу користити заједно."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Не могу да прочитам датотеку кључа „%s“."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Не могу да прочитам %d бајта из датотеке кључа „%s“."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Форматирано ознаком величине %u, унутрашња целовитост „%s“.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<уређај_целовитости>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<уређај_целовитости> <назив>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<назив> јесте уређај за стварање под „%s“\n"
+"<уређај_целовитости> јесте уређај који садржи податке са ознакама целовитости\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Основни уграђени параметри дм-целовитости:\n"
+"\tАлгоритам провере суме: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Путања до уређаја података (ако је одвојен)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Величина журнала"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Подеоци преплетања"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Жиг журнала"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "проценат"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Време предаје журнала"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Број 512-битних подеока по биту (режим битмапе)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Време испирања режима битмапе"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Величина ознаке (по подеоку)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Величина сектора"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Величина међумеморија"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Алгоритам целовитости података"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Величина кључа целовитости података"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Чита кључ целовитости из датотеке"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Алгоритам целовитости журнала"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Величина кључа целовитости журнала"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Чита кључ целовитости журнала из датотеке"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Алгоритам шифровања журнала"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Величина кључа шифровања журнала"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Чита кључ шифровања журнала из датотеке"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Режим опоравка (без журнала, без провере ознаке)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Користи битмапу да прати измене и да искључи журнал за уређај целовитости"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Аутоматски поново израчунава почетне ознаке."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Опција „--integrity-recalculate“ се може користити само за радњу отварања."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Опције „--journal-size“, „--interleave-sectors“, „--sector-size“, „--tag-size“ и „--no-wipe“ се могу користити само за радњу форматирања."
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Неисправна одредба величине журнала."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Мора бити наведена и опција датотеке кључа и опција величине кључа."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Алгоритам целовитости мора бити наведен ако се користи кључ целовитости."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Мора бити наведена и опција датотеке кључа целовитости журнала и опција величине кључа."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Алгоритам целовитости журнала мора бити наведен ако се користи кључ целовитости журнала."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Мора бити наведена и опција датотеке кључа шифровања журнала и опција величине кључа."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Алгоритам шифровања журнала мора бити наведен ако се користи кључ шифровања журнала."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Опције режима опоравка и битмапе се узајамно искључују."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Опције журнала се не могу користити у режиму битмапе."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Опције битмапе се могу користити само у режиму битмапе."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Поновно шифровање је већ у току."
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Не могу изричито да отворим „%s“, уређај је у употреби."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Додела поређане меморије није успела."
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "Не могу да читам уређај „%s“."
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Означавам ЛУКС1 уређај „%s“ неупотребљивим."
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Постављам заставицу ЛУКС2 ванмрежног поновног шифровања на уређају „%s“."
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Не могу да пишем на уређају „%s“."
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Не могу да запишем датотеку дневника поновног шифровања."
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Не могу да прочитам датотеку дневника поновног шифровања."
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Датотека дневника „%s“ постоји, настављам поновно шифровање.\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Покрећем привремени уређај користећи старо ЛУКС заглавље."
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Покрећем привремени уређај користећи ново ЛУКС заглавље."
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Покретање привременог уређаја није успело."
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Нисам успео да поставим померај података."
+
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Нисам успео да поставим величину метаподатака."
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Направљено је ново ЛУКС заглавље за уређај „%s“."
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Ово издање „cryptsetup-reencrypt“ не може да ради са новом унутрашњом врстом скупине „%s“."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Нисам успео да прочитам заставице активирања из заглавља резерве."
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Нисам успео да упишем заставице активирања у ново заглавље."
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Нисам успео да прочитам потрепштине из заглавља резерве."
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "Направљена је резерва „%s“ заглавља за уређај „%s“."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Није успело прављење резерве ЛУКС заглавља."
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Не могу да повратим „%s“ заглавље на уређају „%s“."
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "Повраћено је „%s“ заглавље на уређају „%s“."
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Не могу да отворим привремени ЛУКС уређај."
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Не могу да добавим величину уређаја."
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "УИ грешка за време поновног шифровања."
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Достављени УУИД није исправан."
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Не могу да отворим датотеку дневника поновног шифровања."
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Нема описа у напретку, достављени УУИД се може користити само за настављање заустављеног процеса дешифровања."
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Измењени су „pbkdf“ параметри у утору кључа %i."
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Величина блока поновног шифровања"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Не мења кључ, нема поновног шифровања области података"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Чита (главни) кључ волумена из датотеке"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Време ПБКДФ2 понављања за ЛУКС (у милисекундама)"
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Користи непосредни-уи приликом приступа уређајима"
+
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Користи ф-усаглашавање након сваког блока"
+
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Освежава датотеку дневника након сваког блока"
+
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Користи само овај утор (остали ће бити искључени)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Прави ново заглавље на нешифрованом уређају"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Трајно дешифрује уређај (уклања шифровање)"
+
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "УЈИБ коришћен за настављање дешифровања"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Врста ЛУКС метаподатака: luks1, luks2"
+
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[ОПЦИЈА...] <уређај>"
+
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Поновно шифровање ће изменити: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "кључ волумена"
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "поставља хеш на "
+
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", поставља шифрера на "
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Потребан је аргумент."
+
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Само вредности између 1 MiB и 64 MiB су допуштене завеличину блока поновног шифровања."
+
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "Највећа величина смањења уређаја је 64 MiB."
+
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Опција „--new“ се мора користити са „--reduce-device-size“ или „--header“."
+
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Опција „--keep-key“ може да се користи само са „--hash“, „--iter-time“ или „--pbkdf-force-iterations“."
+
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "Опција „--new“ не може да се користи са „--decrypt“."
+
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "Опција „--decrypt“ није сагласна са наведеним параметрима."
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Опција „--uuid“ је дозвољена само заједно са „--decrypt“."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Неисправна лукс врста. Користите: „luks“, „luks1“ или „luks2“."
+
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Грешка читања одговора из терминала."
+
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Наредба је успела.\n"
+
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "погрешни или недостајући параметри"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "нема овлашћења или је лоша пропусна реч"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "нема више меморије"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "наведен је погрешан уређај или датотека"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "уређај већ постоји или је заузет"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "непозната грешка"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Наредба није успела са кодом %i (%s).\n"
+
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Утор кључа „%i“ је направљен."
+
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Утор кључа „%i“ је откључан."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Утор кључа „%i“ је уклоњен."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Скупина „%i“ је направљена."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Скупина „%i“ је уклоњена."
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+"\n"
+"Брисање је прекинуто."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "УПОЗОРЕЊЕ: Уређај „%s“ већ садржи „%s“ потпис партиције.\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "УПОЗОРЕЊЕ: Уређај „%s“ већ садржи „%s“ потпис суперблока.\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Нисам успео да покренем пробе потписа уређаја."
+
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Нисам успео да добавим податке уређаја „%s“."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Уређај „%s“ је у употреби. Не могу да наставим са радњом форматирања."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Нисам успео да отворим датотеку „%s“ у режиму читања/писања."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Постојећи „%s“ потпис партиције (померај: %<PRIi64> бајта) на уређају „%s“ биће обрисан."
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Постојећи „%s“ потпис суперблока (померај: %<PRIi64> бајта) на уређају „%s“ биће обрисан."
+
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Нисам успео да обришем потпис уређаја."
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Нисам успео да испробам уређај „%s“ за потписом."
+
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Поновно шифровање је прекинуто."
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Не могу да проверим квалитет лозинке: %s"
+
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+"Провера квалитета лозинке није успела:\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Провера квалитета лозинке није успела: Лоша шифра (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Грешка читања пропусне речи из терминала."
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Провери пропусну реч: "
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Пропусне речи се не подударају."
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Не могу да користим померај са улазом терминала."
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Унесите пропусну реч: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Унесите пропусну реч за „%s“: "
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Нема доступног кључа са овом пропусном речју."
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Нема доступног употребљивог утора кључа."
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Не могу да отворим датотеку кључа „%s“ за упис."
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Не могу да пишем у датотеку кључа „%s“."
+
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Нисам успео да отворим датотеку „%s“ у режиму само за читање."
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Обезбеђује исправан „JSON“ ЛУКС2 скупине:\n"
+
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Нисам успео да прочитам „JSON“ датотеку."
+
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Читање је прекинуто."
+
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Нисам успео да отворим датотеку „%s“ у режиму писања."
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Писање је прекинуто."
+
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Нисам успео да упишем „JSON“ датотеку."
+
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands."
+#~ msgstr "Параметар „--refresh“ је дозвољен само са наредбама „open“ или „refresh“."
+
+#~ msgid "Replaced with key slot %d.\n"
+#~ msgstr "Замењен је исеком кључа „%d“.\n"
+
+#~ msgid "Function not available in FIPS mode.\n"
+#~ msgstr "Функција није доступна у ФИПС режиму.\n"
+
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Превише нивоа стабла за волумен тачности.\n"
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "грешка доделе меморије у „action_luksFormat“"
+
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Кључ „%d“ није радан. Не могу да очистим.\n"
+
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<назив> <уређај_података> <уређај_хеша> <хеш_корена>"
+
+#~ msgid "create active device"
+#~ msgstr "прави радни уређај"
+
+#~ msgid "remove (deactivate) device"
+#~ msgstr "уклања (искључује) уређај"
+
+#~ msgid "Activated keyslot %i.\n"
+#~ msgstr "Покренути исек кључа %i.\n"
+
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Напредовање: %5.1f%%, ЕТА %02llu:%02llu, %4llu MiB је записано, брзина %5.1f MiB/s%s"
+
+#~ msgid "Interrupted by a signal.\n"
+#~ msgstr "Прекинуто сигналом.\n"
+
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Не могу да пронађем слободан уређај повратне петље.\n"
+
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Не могу да отворим уређај „%s“\n"
+
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Не могу да користим прослеђени УУИД док је дешифровање у току.\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "Означавам ЛУКС уређај „%s“ употребљивим.\n"
+
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "УПОЗОРЕЊЕ: ово је пробни код, може потпуно да оштети ваше податке.\n"
+
+#~ msgid "FIPS checksum verification failed.\n"
+#~ msgstr "Није успела провера ФИПС провере суме.\n"
index 5a0383b..9622337 100644 (file)
Binary files a/po/sv.gmo and b/po/sv.gmo differ
index 47d01cd..38a3e4e 100644 (file)
--- a/po/sv.po
+++ b/po/sv.po
 # Swedish translation for cryptsetup.
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright © 2009 - 2017 Free Software Foundation, Inc.
 # This file is distributed under the same license as the cryptsetup package.
 # Daniel Nylander <po@danielnylander.se>, 2009.
+# Josef Andersson <l10nl18nsweja@gmail.com>, 2016, 2017, 2019.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.1.0-rc4\n"
+"Project-Id-Version: cryptsetup 2.1.0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2010-01-08 11:37+0100\n"
-"Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2019-05-17 16:51+0200\n"
+"Last-Translator: Josef Andersson <l10nl18nsweja@gmail.com>\n"
 "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
 "Language: sv\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+"X-Generator: Poedit 2.2.1\n"
 
-#: lib/libdevmapper.c:252
-#, fuzzy
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr "Kan inte initiera device-mapper. Är kärnmodulen dm_mod inläst?\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Det går inte att initiera device-mapper, kör som icke-root-användare."
+
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Det går inte att initiera device-mapper. Är kärnmodulen dm_mod inläst?"
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr "Kan inte initiera device-mapper. Är kärnmodulen dm_mod inläst?\n"
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Begärd flagga deferred stöds inte."
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "DM-UUID för enheten %s förkortades.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID för enheten %s förkortades."
+
+#: lib/libdevmapper.c:1520
+#, fuzzy
+msgid "Unknown dm target type."
+msgstr "Okänd PBKDF-typ %s."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Begärd flagga för dm-crypt-prestanda stöds inte."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Begärd flagga för dm-verity-dataintegritet stöds inte."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Begärd flagga dm-verity FEC stöds inte."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Begärd flagga för dataintegritet stöds inte."
 
-#: lib/libdevmapper.c:698
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Begärd flagga sector_size stöds inte."
+
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Begärd automatisk beräkning av integritetstaggar stöds inte."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Discard/TRIM stöds inte."
+
+#: lib/libdevmapper.c:1653
 #, fuzzy
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Begärd LUKS-hash %s stöds inte.\n"
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Begärd flagga för dataintegritet stöds inte."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Misslyckades med att läsa dm-%s-segment."
 
-#: lib/random.c:76
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
+"Systemet fick slut på entropi under generering av volymnyckeln.\n"
+"Flytta musen eller skriv in text i ett annat fönster för att samla några slumpmässiga händelser.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
-msgstr ""
+msgstr "Genererar nyckel (%d%% done).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr ""
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Kör i FIPS-läge."
 
-#: lib/random.c:206
-#, fuzzy
-msgid "Unknown RNG quality requested.\n"
-msgstr "Okänd typ av krypteringsenhet %s begärd.\n"
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Ödesdigert fel under RNG-initiering."
 
-#: lib/random.c:211
-#, fuzzy, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Fel vid läsning av lösenfras.\n"
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Okänd RNG-kvalitet begärd."
 
-#: lib/setup.c:200
-#, fuzzy
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr "Kan inte initiera krypteringsbakände.\n"
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Fel vid läsning från RNG."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Kan inte initiera krypteringsbakände.\n"
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Det går inte att initiera RNG-krypteringsbakände."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
-#, fuzzy, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "Begärd LUKS-hash %s stöds inte.\n"
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Det går inte att initiera krypteringsbakände."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
-#, fuzzy, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Fel vid nyckelbehandling.\n"
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Hashalgoritmen %s stöds inte."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "Fel vid nyckelbearbetning (använder hash %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Det går inte att avgöra enhetstyp. Inkompatibel aktivering av enhet?"
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Denna åtgärd stöds endast för LUKS-enheter.\n"
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Denna åtgärd stöds endast av LUKS-enheter."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Alla nyckelplatser är upptagna.\n"
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Denna åtgärd stöds endast av LUKS2-enheter."
 
-#: lib/setup.c:327
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Alla nyckelplatser är upptagna."
+
+#: lib/setup.c:434
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr "Nyckelplats %d är ogiltig. Välj mellan 0 och %d.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Nyckelplats %d är ogiltig. Välj mellan 0 och %d."
 
-#: lib/setup.c:333
+#: lib/setup.c:440
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "Nyckelplats %d är full. Välj en annan.\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "Nyckelplats %d är full. Välj en annan."
+
+#: lib/setup.c:525 lib/setup.c:2824
+#, fuzzy
+msgid "Device size is not aligned to device logical block size."
+msgstr "Storlek på enhet är inte justerad till begärd sektorstorlek."
 
-#: lib/setup.c:472
+#: lib/setup.c:624
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Ange lösenfras för %s: "
+msgid "Header detected but device %s is too small."
+msgstr "Huvud identifierat men enheten %s är för liten."
 
-#: lib/setup.c:653
-#, fuzzy, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "LUKS-huvud identifierat men enheten %s är för liten.\n"
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Denna åtgärd stöds inte för denna enhetstyp."
 
-#: lib/setup.c:669 lib/setup.c:1420
+#: lib/setup.c:666
 #, fuzzy
-msgid "This operation is not supported for this device type.\n"
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Frånkopplad kryptering pågår. Avbryter."
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Enheten %s är inte aktiv.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "LUKS-versionen %d stöds inte."
 
-#: lib/setup.c:925
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Frånkopplad metadataenhet stöds ej av denna crypt-typ."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr ""
+msgid "Device %s is not active."
+msgstr "Enheten %s är inte aktiv."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Ogiltiga parametrar för vanlig kryptering.\n"
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Underliggande enhet för krypteringsenhet %s försvann."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Ogiltig nyckelstorlek.\n"
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Ogiltiga parametrar för vanlig kryptering."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-#, fuzzy
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Ogiltig nyckelstorlek."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Kan inte formatera LUKS utan enhet.\n"
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "UUID stöds inte för denna krypteringstyp."
 
-#: lib/setup.c:1089
-#, fuzzy, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Kan inte öppna enheten %s för %s%s åtkomst.\n"
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Stöder inte sektorstorleken för kryptering."
 
-#: lib/setup.c:1092
-#, fuzzy, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Kan inte läsa enheten %s.\n"
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Storlek på enhet är inte justerad till begärd sektorstorlek."
 
-#: lib/setup.c:1096
-#, fuzzy, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Kan inte rensa huvudet på enheten %s.\n"
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Det går inte att formatera LUKS utan enhet."
 
-#: lib/setup.c:1114
-#, fuzzy
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Kan inte formatera LUKS utan enhet.\n"
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Begärd datajustering är inte kompatibel med dataoffset."
 
-#: lib/setup.c:1152
-#, fuzzy
-msgid "Can't format VERITY without device.\n"
-msgstr "Kan inte formatera LUKS utan enhet.\n"
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "VARNING: Dataoffset ligger utanför aktuell dataenhet.\n"
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
-#, fuzzy, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "LUKS-versionen %d stöds inte.\n"
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Det går inte att rensa huvudet på enheten %s."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr ""
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "VARNING: Enhetsaktiveringen kommer att misslyckas, dm-crypt saknar stöd för begärd krypteringsektorstorlek.\n"
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr ""
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Volymnyckeln är för liten för kryptering med integritetstillägg."
 
-#: lib/setup.c:1285
+#: lib/setup.c:1821
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Okänd typ av krypteringsenhet %s begärd.\n"
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Chiffret %s-%s (nyckelstorlek %zd bitar) är inte tillgängligt."
 
-#: lib/setup.c:1435
-msgid "Do you really want to change UUID of device?"
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
 msgstr ""
 
-#: lib/setup.c:1545
+#: lib/setup.c:1858
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Volymen %s är inte aktiv.\n"
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
 
-#: lib/setup.c:1556
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Volymen %s är redan i vänteläge.\n"
+msgid "Device %s is too small."
+msgstr "Enheten %s är för liten."
 
-#: lib/setup.c:1563
-#, fuzzy, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Det går inte att formatera enheten %s då den används."
 
-#: lib/setup.c:1565
-#, fuzzy, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Fel vid uppdatering av LUKS-huvud på enheten %s.\n"
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "Det går inte att formatera enheten %s, behörighet nekad."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:1908 lib/setup.c:2229
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Volymen %s är inte i vänteläge.\n"
+msgid "Cannot format integrity for device %s."
+msgstr "Det går inte att formatera integritet för enheten %s."
 
-#: lib/setup.c:1605
-#, fuzzy, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "Det går inte att formatera enheten %s."
 
-#: lib/setup.c:1607 lib/setup.c:1659
-#, fuzzy, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Fel vid uppdatering av LUKS-huvud på enheten %s.\n"
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Kan inte formatera LOOPAES utan enhet."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Ange lösenfras: "
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Det går inte att formatera VERITY utan enhet."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Kan inte lägga till nyckelplats. Alla platser är inaktiverade och ingen "
-"volymnyckel har angivits.\n"
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "VERITY-hashtyp %d stöds inte."
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Ange valfri lösenfras: "
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "VERITY-blockstorlek som inte stöds."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Ange ny lösenfras för nyckelplats: "
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "VERITY-hashoffset som inte stöds."
 
-#: lib/setup.c:1798
-#, fuzzy, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Nyckelplats %d är upplåst.\n"
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "VERITY-FEC-offset som inte stöds."
 
-#: lib/setup.c:1801
-#, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr ""
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Dataområde spiller över på hashområdet."
 
-#: lib/setup.c:1806
-#, fuzzy
-msgid "Failed to swap new key slot.\n"
-msgstr "Misslyckades med att ta status på nyckelfilen %s.\n"
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Hashområde spiller över på FEC-mrådet."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Volymnyckeln stämmer inte överens med volymen.\n"
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Dataområde spiller över på FEC-mrådet."
 
-#: lib/setup.c:1961
+#: lib/setup.c:2208
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Nyckelplats %d är ogiltig.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
 
-#: lib/setup.c:1966
+#: lib/setup.c:2286
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Nyckelplats %d används inte.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Okänd typ av krypteringsenhet %s begärd."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Enheten %s finns redan.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Parametrar som inte stöds på enheten %s."
 
-#: lib/setup.c:2171
-#, fuzzy
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr "Kan inte hämta volymnyckel för vanlig enhet.\n"
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Kan inte rensa huvudet på enheten %s."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
 msgstr ""
 
-#: lib/setup.c:2227
-#, fuzzy
-msgid "Device type is not properly initialised.\n"
-msgstr "Enheten %s är inte aktiv.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "Misslyckades med att ta status på enhet %s."
 
-#: lib/setup.c:2259
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, fuzzy, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Enheten %s är upptagen.\n"
+msgid "Failed to suspend device %s."
+msgstr "Misslyckades med att ta status på enhet %s."
 
-#: lib/setup.c:2268
-#, c-format
-msgid "Invalid device %s.\n"
-msgstr "Ogiltig enhet %s.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "Misslyckades med att ta status på enhet %s."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
 msgstr ""
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Buffert för volymnyckel är för liten.\n"
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Misslyckades med att ta status på enhet %s."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Det går inte att ändra storlek på loop-enhet."
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "Vill du verkligen ändra UUID för en enhet?"
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "Kan inte hämta volymnyckel för vanlig enhet.\n"
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Säkerhetskopian för huvud innehåller inte något giltigt LUKS-huvud."
 
-#: lib/setup.c:2310
+#: lib/setup.c:3058
 #, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+msgid "Volume %s is not active."
+msgstr "Volymen %s är inte aktiv."
 
-#: lib/setup.c:2506
-#, fuzzy
-msgid "Dump operation is not supported for this device type.\n"
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
+msgstr "Volymen %s är redan i vänteläge."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Kan inte få processprioritet.\n"
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "Vänteläge stöds inte för enhet %s."
 
-#: lib/utils.c:258
-#, fuzzy
-msgid "Cannot unlock memory.\n"
-msgstr "Kan inte låsa upp minne."
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "Fel då enheten %s försattes i vänteläge."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Slut på minne vid läsning av lösenfras.\n"
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "Volymen %s är inte i vänteläge."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Fel vid läsning av lösenfras från terminal.\n"
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
+msgstr "Att återuppta stöds inte för enhet %s."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Verifiera lösenfras: "
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "Fel då enheten %s återupptogs."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Lösenfraserna stämmer inte överens.\n"
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Volymnyckeln stämmer inte överens med volymen."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr ""
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Det går inte att lägga till nyckelplats. Alla platser är inaktiverade och ingen volymnyckel har angivits."
+
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Misslyckades med att byta ny nyckelplats."
+
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Nyckelplats %d är ogiltig."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Nyckelplats %d är inte aktiv."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Dataområde spiller över på hashområdet."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
+#: lib/setup.c:3981
 #, fuzzy
-msgid "Failed to open key file.\n"
-msgstr "Misslyckades med att öppna nyckelfilen %s.\n"
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Omkryptering pågår redan."
 
-#: lib/utils_crypt.c:378
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
 #, fuzzy
-msgid "Failed to stat key file.\n"
-msgstr "Misslyckades med att ta status på nyckelfilen %s.\n"
+msgid "Failed to get reencryption lock."
+msgstr "Misslyckades med att erhålla skrivlås för enhet."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr ""
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+#, fuzzy
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Stöder inte sektorstorleken för kryptering."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+#, fuzzy
+msgid "Device type is not properly initialized."
+msgstr "Enhetstypen är inte korrekt initierad."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Fel vid läsning av lösenfras.\n"
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Det går inte att använda enheten %s som fortfarande används eller har ett ogiltigt namn."
+
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "Enheten %s finns redan."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Felaktig volymnyckel för vanlig enhet."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Felaktig rothash angiven för verity-enhet."
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
 msgstr ""
 
-#: lib/utils_crypt.c:447
+#: lib/setup.c:4421
 #, fuzzy
-msgid "Cannot read requested amount of data.\n"
-msgstr "Kan inte läsa säkerhetskopia för huvud %s.\n"
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Kärnans nyckelring stöds inte av kärnan."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Misslyckades med att öppna nyckelringen för kärnan."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Enheten %s finns inte eller åtkomst nekas.\n"
+msgid "Device %s is still in use."
+msgstr "Enheten %s används fortfarande."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr ""
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "Ogiltig enhet %s."
 
-#: lib/utils_device.c:433
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Buffert för volymnyckelen är för liten."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Kan inte hämta volymnyckel för vanlig enhet."
+
+#: lib/setup.c:4657
 #, fuzzy
-msgid "Cannot find a free loopback device.\n"
-msgstr "Kan inte läsa enheten %s.\n"
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Felaktig rothash angiven för verity-enhet."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Utskriftsåtgärden stöds inte för denna enhetstyp."
 
-#: lib/utils_device.c:484
+#: lib/setup.c:5190
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
+msgid "Data offset is not multiple of %u bytes."
 msgstr ""
 
-#: lib/utils_device.c:488
+#: lib/setup.c:5475
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Kan inte hämta information om enheten %s.\n"
+msgid "Cannot convert device %s which is still in use."
+msgstr "Det går inte konvertera enheten %s som fortfarande används."
 
-#: lib/utils_device.c:494
+#: lib/setup.c:5772
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr ""
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Misslyckades med att tilldela nyckelplats %u som ny volymnyckel."
+
+#: lib/setup.c:5845
+#, fuzzy
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Misslyckades med att sätta standardnyckelplats för LUKS2-parametrar."
 
-#: lib/utils_device.c:502
+#: lib/setup.c:5851
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Enheten %s har noll storlek.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Misslyckades med att tilldela nyckelplats %d till kontrollsummor."
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Kärnans nyckelring stöds inte av kärnan."
 
-#: lib/utils_device.c:513
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Enheten %s är för liten.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Misslyckades med att läsa lösenfras från nyckelringsnyckel (fel %d)."
 
-#: lib/luks1/keyencryption.c:37
-#, fuzzy, c-format
-msgid ""
-"Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
 msgstr ""
-"Misslyckades med att konfigurera nyckelmappning för dm-crypt för\n"
-"enheten %s. Kontrollera att kärnan har stöd för chiffret %s\n"
-"(kontrollera syslog för mer information).\n"
-"%s"
 
-#: lib/luks1/keyencryption.c:42
-#, fuzzy
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "Nyckelstorlek måste vara en multipel av 8 bitar"
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Det går inte att få processprioritet."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Det går inte att låsa upp minne."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Misslyckades med att öppna nyckelfilen."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Det går inte läsa nyckelfilen från en terminal."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Misslyckades med att ta stat på nyckelfilen."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Det går inte att söka till begärd nyckelfilsoffset."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Slut på minne vid läsning av lösenfras."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Fel vid läsning av lösenfras."
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Ingenting att läsa vid inmating."
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Högsta nyckelfilsstorlek överskriden."
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Det går inte läsa begärd mängd data."
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
 #, fuzzy, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Kan inte rensa enheten %s.\n"
+msgid "Device %s does not exist or access denied."
+msgstr "Enheten %s finns inte eller åtkomst nekas."
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr "Misslyckades med att öppna temporär nyckellagringsenhet.\n"
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Enheten %s är inte aktiv."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr "Misslyckades med att komma åt temporär nyckellagringsenhet.\n"
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Enhet %s är för liten. Behöver minst %<PRIu64> byte."
 
-#: lib/luks1/keyencryption.c:191
-#, fuzzy
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Storleken för krypteringsnyckeln"
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Det går inte att använda enheten %s som redan används (redan mappad eller monterad)."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr ""
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Det går inte att använda enhet %s, behörighet nekad."
 
-#: lib/luks1/keymanage.c:90
+#: lib/utils_device.c:730
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr ""
+msgid "Cannot get info about device %s."
+msgstr "Kan inte hämta information om enheten %s."
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
-#, fuzzy, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "Enheten %s är inte en LUKS-enhet.\n"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Kan inte använda en loopback-enhet, kör som icke-root-användare."
 
-#: lib/luks1/keymanage.c:198
-#, fuzzy, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Begärda filen %s finns redan.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Misslyckades med att fästa loopback-enhet (kräver loop-enhet med flaggan autoclear)."
 
-#: lib/luks1/keymanage.c:200
-#, fuzzy, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Kan inte läsa säkerhetskopia för huvud %s.\n"
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Begärd offset är bortom faktiska enhetsstorleken för %s."
 
-#: lib/luks1/keymanage.c:205
+#: lib/utils_device.c:817
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Kan inte skriva säkerhetskopia för huvud %s.\n"
+msgid "Device %s has zero size."
+msgstr "Enheten %s har noll storlek."
 
-#: lib/luks1/keymanage.c:239
-#, fuzzy
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Säkerhetskopian innehåller inte något giltigt LUKS-huvud.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Begärd måltid för PBKDF kan inte vara noll."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/utils_pbkdf.c:106
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Kan inte öppna säkerhetskopia för huvud %s.\n"
+msgid "Unknown PBKDF type %s."
+msgstr "Okänd PBKDF-typ %s."
 
-#: lib/luks1/keymanage.c:258
+#: lib/utils_pbkdf.c:111
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Kan inte läsa säkerhetskopia för huvud %s.\n"
+msgid "Requested hash %s is not supported."
+msgstr "Begärd hash %s stöds inte."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Dataoffset eller nyckelstorlek skiljer sig på enhet och säkerhetskopia. "
-"Återställningen misslyckades.\n"
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Begärd PBKDF-typ stöds inte för LUKS1."
 
-#: lib/luks1/keymanage.c:277
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Högsta minne för PBKDF eller parallella trådar får inte sättas med pbkdf2."
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Device %s %s%s"
-msgstr "Enhet %s %s%s"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Tvingad iterationsuppräkning är för liten för %s (minsta är %u)."
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"innehåller inget LUKS-huvud. Ersättning av huvud kan förstöra data på "
-"enheten."
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Tvingad minneskostnad är för låg för %s (minimum är %u kilobyte)."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"innehåller redan LUKS-huvud. Ersättningen av huvud kommer att förstöra "
-"befintliga nyckelplatser."
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Kostnaden för det begärda högsta minnet för PBKDF är för högt (maximum är %d kilobyte)."
 
-#: lib/luks1/keymanage.c:280
-msgid ""
-"\n"
-"WARNING: real device header has different UUID than backup!"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Högst begärt minne för PBKDF kan inte vara noll."
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Begärda parallella trådar för PBKDF kan inte vara noll."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
 msgstr ""
-"\n"
-"VARNING: verkligt enhetshuvud har annat UUID än säkerhetskopian!"
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Prestandamätning för PBKDF är inaktiverad men iterationer är inte satt."
+
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Kan inte öppna enheten %s.\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Ej kompatibla PBKDF2-flaggor (använder hash-algoritmen %s)."
 
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr ""
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Ej kompatibla PBKDF2-flaggor."
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Låsningen avbruten. Låsningsökvägen %s/%s oanvändbar (inte en katalog eller saknas)."
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr ""
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "VARNING:Låskatalog %s/%s saknas!\n"
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr ""
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Låsningen avbruten. Låsningsökvägen %s/%s oanvändbar (%s är inte en katalog)."
 
-#: lib/luks1/keymanage.c:363
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Det går inte att söka till enhetsoffset."
+
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
+msgid "Device wipe error, offset %<PRIu64>."
 msgstr ""
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keyencryption.c:39
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
+"Misslyckades med att konfigurera nyckelmappning för dm-crypt för enheten %s. \n"
+"Kontrollera att kärnan har stöd för chiffret %s (kontrollera syslog för mer information)."
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Nyckelstorlek i XTS-läge måste vara en multipel av 256 eller 512 bitar."
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "Chifferspecifikation ska vara i formatet [chiffer] - [läge] - [iv]."
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr ""
+msgid "Cannot write to device %s, permission denied."
+msgstr "Kan inte skriva till enhet %s, behörighet nekad."
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Misslyckades med att öppna temporär nyckellagringsenhet."
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Misslyckades med att komma åt temporär nyckellagringsenhet."
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "In-/utfel vid kryptering av nyckelplats."
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Det går inte att öppna enheten %s."
 
-#: lib/luks1/keymanage.c:385
-#, fuzzy, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Nyckelplats %d är ogiltig.\n"
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "In-/utfel vid dekryptering av nyckelplats."
 
-#: lib/luks1/keymanage.c:396
-#, fuzzy
-msgid "Writing LUKS header to disk.\n"
-msgstr "Fel vid uppdatering av LUKS-huvud på enheten %s.\n"
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Enhet %s är för liten. (LUKS1 kräver minst %<PRIu64> byte.)"
 
-#: lib/luks1/keymanage.c:421
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "LUKS-nyckelplats %u är ogiltig."
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "LUKS-versionen %d stöds inte.\n"
+msgid "Device %s is not a valid LUKS device."
+msgstr "Enheten %s är inte en giltig LUKS-enhet."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "Begärd LUKS-hash %s stöds inte.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Begärd säkerhetskopia %s av huvud finns redan."
 
-#: lib/luks1/keymanage.c:442
-#, fuzzy, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "Nyckelplats %d är ogiltig.\n"
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
+msgstr "Det går inte att skapa säkerhetskopia för huvud %s."
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
+msgstr "Det går inte skriva säkerhetskopia för huvud %s."
+
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+#, fuzzy
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Säkerhetskopian innehåller inte något giltigt LUKS-huvud."
 
-#: lib/luks1/keymanage.c:596
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Fel vid uppdatering av LUKS-huvud på enheten %s.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Det går inte att öppna säkerhetskopia för huvud %s."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr "Fel vid omläsning av LUKS-huvud efter uppdatering på enheten %s.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Det går inte att läsa säkerhetskopia för huvud %s."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Dataoffset eller nyckelstorlek skiljer sig åt på enhet och säkerhetskopia. Återställningen misslyckades."
+
+#: lib/luks1/keymanage.c:325
 #, c-format
+msgid "Device %s %s%s"
+msgstr "Enhet %s %s%s"
+
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "innehåller inget LUKS-huvud. Ersättning av huvud kan förstöra data på enheten."
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "innehåller redan LUKS-huvud. Ersättningen av huvud kommer att förstöra befintliga nyckelplatser."
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
+"\n"
+"WARNING: real device header has different UUID than backup!"
 msgstr ""
+"\n"
+"VARNING: verkligt enhetshuvud har annat UUID än säkerhetskopian!"
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-#, fuzzy
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Felaktigt UUID-format angavs, genererar ny.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Ej standardstorlek på nyckel, manuell reparation krävs."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-"Kan inte skapa LUKS-huvud: läsning av slumpmässigt salt misslyckades.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Ej standardjustering på nyckelplatser, manuell reparation krävs."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, fuzzy, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Ej kompatibla PBKDF2-flaggor (använder hash-algoritmen %s)."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Reparerar nyckelplatser."
 
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Kan inte skapa LUKS-huvud: huvudsammanfattning misslyckades (använder hashen "
-"%s).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Nyckelplats %i: reparerad offset (%u -> %u)."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "Nyckelplats %d är aktiv, rensa först.\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Nyckelplats %i: reparerade remsor (%u -> %u)."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Nyckelplats %d material inkluderar för få stripes. Har huvudet "
-"manipulerats?\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Nyckelplats %i: fejkpartitionssignatur."
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Nyckelplats %d är upplåst.\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Nyckelplats %i: salt borttaget."
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Ingen nyckel finns tillgänglig med denna lösenfras.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Skriver LUKS-huvud till disk."
 
-#: lib/luks1/keymanage.c:1003
-#, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr "Nyckelplats %d är ogiltig. Välj en nyckelplats mellan 0 och %d.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Reparation misslyckades."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Kan inte rensa enheten %s.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Begärd LUKS-hash %s stöds inte."
 
-#: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "Inga kända problem identifierade för LUKS-huvud."
 
-#: lib/loopaes/loopaes.c:147
-msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
-msgstr ""
+#: lib/luks1/keymanage.c:660
+#, c-format
+msgid "Error during update of LUKS header on device %s."
+msgstr "Fel vid uppdatering av LUKS-huvud på enheten %s."
 
-#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Fel vid omläsning av LUKS-huvud efter uppdatering på enheten %s."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Data-offset för fristående LUKS-huvud måste vara antingen 0 eller större än huvudstorleken."
 
-#: lib/tcrypt/tcrypt.c:475
-#, fuzzy, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Fel vid läsning av lösenfras.\n"
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Felaktigt LUKS-UUID-format angavs."
 
-#: lib/tcrypt/tcrypt.c:513
-#, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Kan inte skapa LUKS-huvud: läsning av slumpmässigt salt misslyckades."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr ""
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Kan inte skapa LUKS-huvud: kontrollsumma för huvud misslyckades (använder hashen %s)."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:848
+#, c-format
+msgid "Key slot %d active, purge first."
+msgstr "Nyckelplats %d är aktiv, rensa först."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:854
+#, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Nyckelplats %d material inkluderar för få remsor. Har huvudet manipulerats?"
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/luks1/keymanage.c:990
 #, fuzzy, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Fel vid nyckelbearbetning (använder hash %s)."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr ""
+#: lib/luks1/keymanage.c:1066
+#, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Nyckelplats %d är ogiltig. Välj en nyckelplats mellan 0 och %d."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr ""
+msgid "Cannot wipe device %s."
+msgstr "Kan inte rensa enheten %s."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr ""
+#: lib/loopaes/loopaes.c:146
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Identifierade en GPG-krypterad nyckelfil som ännu inte stöds."
+
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "Använd gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- …\n"
+
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Identifierade inkompatibel loop-AES-nyckelfil."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/loopaes/loopaes.c:245
 #, fuzzy
-msgid "This function is not supported without TCRYPT header load."
-msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s.\n"
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "Kärnan stöder inte loop-AES-kompatibel mappning."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr ""
+msgid "Error reading keyfile %s."
+msgstr "Fel vid läsning av nyckelfil %s."
 
-#: lib/verity/verity.c:94
+#: lib/tcrypt/tcrypt.c:554
 #, fuzzy, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Enheten %s är inte en LUKS-enhet.\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Högsta TCRYPT-lösenfraslängd (%d) överskriden."
 
-#: lib/verity/verity.c:101
-#, fuzzy, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "LUKS-versionen %d stöds inte.\n"
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "PBKDF2-hashalgoritm %s ej tillgänglig, hoppar över."
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr ""
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Begärt kryptogränssnitt för kärnan inte tillgängligt."
 
-#: lib/verity/verity.c:166
-#, fuzzy, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Felaktigt UUID-format angavs, genererar ny.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Försäkra dig om att kärnmodulen algif_skcipher är inläst."
 
-#: lib/verity/verity.c:196
-#, fuzzy, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Fel vid uppdatering av LUKS-huvud på enheten %s.\n"
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "Aktivering stöds inte för sektorstorlek %d."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr ""
+#: lib/tcrypt/tcrypt.c:759
+#, fuzzy
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "Kärnan stöder inte aktivering för detta föråldrade TCRYPT-läge."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr ""
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Aktiverar TCRYPT-systemkryptering för partition %s."
 
-#: lib/verity/verity_hash.c:59
+#: lib/tcrypt/tcrypt.c:871
+#, fuzzy
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "Kärnan stöder inte TCRYPT-kompatibel mappning."
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "Denna funktion stöds inte utan inläsning av TCRYPT-huvud."
+
+#: lib/bitlk/bitlk.c:333
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
 msgstr ""
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
 msgstr ""
 
-#: lib/verity/verity_hash.c:161
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
 msgstr ""
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
 msgstr ""
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Misslyckades med att läsa LUKS2-krav."
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
 msgstr ""
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
 msgstr ""
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
 msgstr ""
 
-#: lib/verity/verity_hash.c:365
-#, fuzzy
-msgid "Input/output error while creating hash area.\n"
-msgstr "Slut på minne vid läsning av lösenfras.\n"
-
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr ""
-
-#: lib/verity/verity_hash.c:414
-#, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Stöder inte sektorstorleken för kryptering."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr "Kan inte verifiera lösenfras på icke-tty-ingångar.\n"
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Misslyckades med att läsa LUKS2-krav."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Inget känt chifferspecifikationsmönster kunde identifieras.\n"
+#: lib/bitlk/bitlk.c:543
+#, fuzzy, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Misslyckades med att läsa LUKS2-krav."
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
-msgstr ""
+#: lib/bitlk/bitlk.c:594
+#, fuzzy
+msgid "Unknown or unsupported encryption type."
+msgstr "Stöder inte sektorstorleken för kryptering."
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
-msgstr ""
+#: lib/bitlk/bitlk.c:627
+#, fuzzy, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Misslyckades med att läsa LUKS2-krav."
 
-#: src/cryptsetup.c:218
+#: lib/bitlk/bitlk.c:921
 #, fuzzy
-msgid "Option --key-file is required.\n"
-msgstr "Flaggan --header-backup-file krävs.\n"
+msgid "This operation is not supported."
+msgstr "Denna åtgärd stöds inte för krypteringsenheter av typen %s."
 
-#: src/cryptsetup.c:267
+#: lib/bitlk/bitlk.c:929
 #, fuzzy
-msgid "No device header detected with this passphrase.\n"
-msgstr "Ingen nyckel finns tillgänglig med denna lösenfras.\n"
+msgid "Wrong key size."
+msgstr "Ogiltig nyckelstorlek."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
 msgstr ""
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
 msgstr ""
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr ""
+#: lib/bitlk/bitlk.c:1069
+#, fuzzy
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Aktivering av temporära enheter misslyckades."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
 msgstr ""
 
-#: src/cryptsetup.c:587
-#, fuzzy, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Enheten %s är inte aktiv.\n"
-
-#: src/cryptsetup.c:614
-msgid "N/A"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
 msgstr ""
 
-#: src/cryptsetup.c:639
-#, fuzzy, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Kan inte läsa enheten %s.\n"
-
-#: src/cryptsetup.c:643
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
 #, fuzzy, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Kan inte läsa %d byte från nyckelfilen %s.\n"
-
-#: src/cryptsetup.c:672
-#, fuzzy
-msgid "Really try to repair LUKS device header?"
-msgstr "Återställ huvud och nyckelplatser för LUKS-enhet"
+msgid "Verity device %s does not use on-disk header."
+msgstr "Verity-enhet %s använder inte huvud på disk."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity.c:90
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Detta kommer att skriva över data på %s och går inte att ångra."
-
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "minnesallokeringsfel i action_luksFormat"
+msgid "Device %s is not a valid VERITY device."
+msgstr "Enheten %s är inte en giltig VERITY-enhet."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity.c:97
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr ""
-
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
+msgid "Unsupported VERITY version %d."
+msgstr "VERITY-versionen %d stöds inte."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
-#, fuzzy, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "nyckeplats %d markerad för borttagning.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "VERITY-huvud är skadat."
 
-#: src/cryptsetup.c:884
+#: lib/verity/verity.c:165
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Nyckel %d är inte aktiv. Kan inte rensa.\n"
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "Felaktigt VERITY-UUID-format angivet på enhet %s."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
-msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
-msgstr ""
-"Detta är sista nyckelplatsen. Enheten kommer att bli oanvändbar efter att "
-"denna nyckel tagits bort."
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Fel vid uppdatering av verity-huvud på enheten %s."
 
-#: src/cryptsetup.c:893
+#: lib/verity/verity.c:256
 #, fuzzy
-msgid "Enter any remaining passphrase: "
-msgstr "Ange eventuell återstående LUKS-lösenfras: "
+msgid "Root hash signature verification is not supported."
+msgstr "Begärd hash %s stöds inte."
 
-#: src/cryptsetup.c:921
-#, fuzzy
-msgid "Enter passphrase to be deleted: "
-msgstr "Ange LUKS-lösenfras att ta bort: "
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Det går inte reparera fel med FEC-enhet."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
-#, fuzzy, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Ange valfri lösenfras: "
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "Fann %u reparerbara fel med FEC-enhet."
 
-#: src/cryptsetup.c:1052
+#: lib/verity/verity.c:308
 #, fuzzy
-msgid "Enter passphrase to be changed: "
-msgstr "Ange LUKS-lösenfras att ta bort: "
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Kärnan stöder inte dm-verity-mappning."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
+#: lib/verity/verity.c:312
 #, fuzzy
-msgid "Enter new passphrase: "
-msgstr "Ange valfri lösenfras: "
+msgid "Kernel does not support dm-verity signature option."
+msgstr "Kärnan stöder inte dm-verity-mappning."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr ""
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Verity-enhet identifierades som skadad efter aktivering."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Flaggan --header-backup-file krävs.\n"
+#: lib/verity/verity_hash.c:59
+#, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "Ledigt utrymme är inte nollställt vid position %<PRIu64>."
 
-#: src/cryptsetup.c:1304
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Enhets-offset spillde över."
+
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr ""
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Verifiering misslyckades vid %<PRIu64>."
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
-msgstr ""
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Ogiltig storlek på parametrar för verity-enhet."
 
-#: src/cryptsetup.c:1326
-#, fuzzy, c-format
-msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
-msgstr ""
-"Detta är sista nyckelplatsen. Enheten kommer att bli oanvändbar efter att "
-"denna nyckel tagits bort."
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Hash-området spillde över."
 
-#: src/cryptsetup.c:1360
-#, fuzzy
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<enhet> <namn> "
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Misslyckades med verifiering av dataområde."
 
-#: src/cryptsetup.c:1360
-#, fuzzy
-msgid "open device as mapping <name>"
-msgstr "öppna LUKS-enhet som mappning <namn>"
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Misslyckades med verifiering av rot-hash."
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<namn>"
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "In-/utdatafel vid skapandet av hashområde."
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr ""
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Misslyckades med skapandet av hashområde."
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "ändra storlek på aktiv enhet"
+#: lib/verity/verity_hash.c:433
+#, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "VARNING: Kärnan kan inte aktivera enhet om datablockstorleken överskrider sidstorlek (%u)."
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "visa enhetsstatus"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Misslyckades med att öppna RS-kontext."
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr ""
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Misslyckades med att allokera buffert."
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<enhet>"
+#: lib/verity/verity_fec.c:156
+#, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Misslyckades med att läsa RS block %<PRIu64> byte %d."
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr ""
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Misslyckades med att skriva paritet för RS block %<PRIu64>."
 
-#: src/cryptsetup.c:1366
-#, fuzzy
-msgid "erase all keyslots (remove encryption key)"
-msgstr "Storleken för krypteringsnyckeln"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Misslyckades med att skriva paritet för RS block %<PRIu64>."
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<enhet> [<ny nyckelfil>]"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Misslyckades med att skriva paritet för RS block %<PRIu64>."
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "formaterar en LUKS-enhet"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Blockstorlekar måste matcha för FEC."
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "lägg till nyckel till LUKS-enhet"
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Ogiltigt antal paritet-byte."
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
-msgstr "<enhet> [<nyckelfil>]"
+#: lib/verity/verity_fec.c:265
+#, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Misslyckades med att bestämma storlek för enhet %s."
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "tar bort angiven nyckel eller nyckelfil från LUKS-enhet"
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+#, fuzzy
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Kärnan stöder inte dm-integrity-mappning."
 
-#: src/cryptsetup.c:1370
+#: lib/integrity/integrity.c:277
 #, fuzzy
-msgid "changes supplied key or key file of LUKS device"
-msgstr "tar bort angiven nyckel eller nyckelfil från LUKS-enhet"
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Kärnan stöder inte dm-integrity-mappning."
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<enhet> <nyckelplats>"
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Misslyckades med att få skrivlås på enheten %s."
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr "rensar nyckeln med nummer <nyckelplats> från LUKS-enhet"
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "skriv ut UUID för LUKS-enhet"
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+"Enheten innehåller tvetydiga signaturer, det går inte automatiskt återhämta LUKS2.\n"
+"Kör ”cryptsetup repair” för återhämtning."
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "testar <enhet> för LUKS-partitionshuvud"
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Begärd dataoff för liten."
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
-msgstr "skriver ut information om LUKS-partition"
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "VARNING: nyckelplatsområdet (%<PRIu64> byte) är väldigt liten, tillgängligt LUKS2-nyckelplatsantal är väldigt begränsat.\n"
 
-#: src/cryptsetup.c:1375
-#, fuzzy
-msgid "dump TCRYPT device information"
-msgstr "skriver ut information om LUKS-partition"
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Misslyckades med att erhålla läslås på enheten %s."
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"Försätt LUKS-enhet i vänteläge och rensa nyckel (alla in-/ut-åtgärder är "
-"frusna)."
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "Förbjudna LUKS2-krav identifierade i säkerhetskopian %s."
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Återuppta LUKS-enhet i vänteläge."
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Dataoffset skiljer sig på enhet och säkerhetskopia. Återställningen misslyckades."
 
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
-msgstr "Säkerhetskopiera huvud och nyckelplatser från LUKS-enhet"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Binärhuvud med nyckelstorlek skiljer sig på enhet och säkerhetskopia. Återställningen misslyckades."
 
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
-msgstr "Återställ huvud och nyckelplatser för LUKS-enhet"
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Enhet %s %s%s%s%s"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
-msgid ""
-"\n"
-"<action> is one of:\n"
-msgstr ""
-"\n"
-"<åtgärd> är en av:\n"
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "innehåller inget LUKS2-huvud. Ersättning av huvud kan förstöra data på enheten."
 
-#: src/cryptsetup.c:1402
-msgid ""
-"\n"
-"You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
-msgstr ""
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "innehåller redan LUKS2-huvud. Ersättningen av huvud kommer att förstöra befintliga nyckelplatser."
 
-#: src/cryptsetup.c:1406
-#, c-format
+#: lib/luks2/luks2_json_metadata.c:1225
 msgid ""
 "\n"
-"<name> is the device to create under %s\n"
-"<device> is the encrypted device\n"
-"<key slot> is the LUKS key slot number to modify\n"
-"<key file> optional key file for the new key for luksAddKey action\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
 "\n"
-"<namn> är enheten att skapa under %s\n"
-"<enhet> är den krypterade enheten\n"
-"<nyckelplats> är numret för LUKS-nyckelplatsen att ändra\n"
-"<nyckelfil> valfri nyckelfil för den nya nyckeln för luksAddKey-åtgärden\n"
-
-#: src/cryptsetup.c:1413
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
-msgstr ""
+"VARNING:okända LUKS2-krav identifierade i huvudet för riktig enhet!\n"
+"Att ersätta huvudet med en säkerhetskopia kan göra data korrupt på enheten!"
 
-#: src/cryptsetup.c:1420
-#, fuzzy, c-format
+#: lib/luks2/luks2_json_metadata.c:1227
 msgid ""
 "\n"
-"Default compiled-in device cipher parameters:\n"
-"\tloop-AES: %s, Key %d bits\n"
-"\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
 msgstr ""
 "\n"
-"Inkompilerade standardchifferparametrar för enheter:\n"
-"\tplain: %s, Nyckel: %d bitar, Lösenordshashning: %s\n"
-"\tLUKS1: %s, Nyckel: %d bitar, LUKS header-hashning: %s\n"
+"VARNING:Oavslutad frånkopplade kryptering identifierad på enheten!\n"
+"Att ersätta huvudet med en säkerhetskopia kan orsaka korrupt data."
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: lib/luks2/luks2_json_metadata.c:1323
 #, c-format
-msgid "%s: requires %s as arguments"
-msgstr "%s: kräver %s som argument"
-
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
-msgid "Show this help message"
-msgstr "Visa detta hjälpmeddelande"
-
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
-msgid "Display brief usage"
-msgstr "Visa kort information om användning"
-
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Hjälpflaggor:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
-msgid "Print package version"
-msgstr "Skriv ut paketversion"
-
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
-msgid "Shows more detailed error messages"
-msgstr "Visar mer detaljerade felmeddelanden"
-
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
-msgid "Show debug messages"
-msgstr "Visa felsökningsmeddelanden"
+msgid "Ignored unknown flag %s."
+msgstr "Ignorerade okänd flagga %s."
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
-msgid "The cipher used to encrypt the disk (see /proc/crypto)"
-msgstr "Chiffret som används för att kryptera disken (se /proc/crypto)"
-
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
-msgid "The hash used to create the encryption key from the passphrase"
-msgstr "Hashen som används för att skapa krypteringsnyckel från lösenfras"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr ""
 
-#: src/cryptsetup.c:1481
-msgid "Verifies the passphrase by asking for it twice"
-msgstr "Verifierar lösenfrasen genom att fråga efter den två gånger"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "Misslyckades med att läsa dm-%s-segment."
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
 #, fuzzy
-msgid "Read the key from a file."
-msgstr "Läs volymnyckeln (master) från fil."
+msgid "Failed to set dm-linear segment."
+msgstr "Misslyckades med att läsa dm-%s-segment."
 
-#: src/cryptsetup.c:1483
-msgid "Read the volume (master) key from file."
-msgstr "Läs volymnyckeln (master) från fil."
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr ""
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
 msgstr ""
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "The size of the encryption key"
-msgstr "Storleken för krypteringsnyckeln"
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr ""
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
-msgid "BITS"
-msgstr "BITAR"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Misslyckades med att läsa LUKS2-krav."
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
-msgid "Limits the read from keyfile"
-msgstr ""
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Ej uppfyllt LUKS2-krav identifierat."
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
-msgid "bytes"
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
 msgstr ""
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
-msgid "Number of bytes to skip in keyfile"
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
 msgstr ""
 
-#: src/cryptsetup.c:1488
-msgid "Limits the read from newly added keyfile"
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
 msgstr ""
 
-#: src/cryptsetup.c:1489
-msgid "Number of bytes to skip in newly added keyfile"
-msgstr ""
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "Nyckelplats %d har verifierats.\n"
 
-#: src/cryptsetup.c:1490
-msgid "Slot number for new key (default is first free)"
-msgstr "Platsnummer för ny nyckel (standard är första lediga)"
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, fuzzy, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "LUKS2-nyckelplats: Chiffret används krypering av nyckelplats"
 
-#: src/cryptsetup.c:1491
-msgid "The size of the device"
-msgstr "Storleken för enheten"
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Inget utrymme för ny nyckelplats."
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
-msgid "SECTORS"
-msgstr "SEKTORER"
+#: lib/luks2/luks2_luks1_convert.c:482
+#, fuzzy, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Det går inte kontrollera status för enheten med uuid: %s."
 
-#: src/cryptsetup.c:1492
-msgid "The start offset in the backend device"
-msgstr "Startoffset i bakändesenheten"
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Det går inte att konvertera huvud med ytterligare metadata för LUKSMETA."
 
-#: src/cryptsetup.c:1493
-msgid "How many sectors of the encrypted data to skip at the beginning"
-msgstr "Hur många sektorer av krypterat data som ska hoppas över i början"
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Kunde inte flytta nyckelplatsområde. Inte nog med utrymme."
 
-#: src/cryptsetup.c:1494
-msgid "Create a readonly mapping"
-msgstr "Skapa en skrivskyddad mappning"
+#: lib/luks2/luks2_luks1_convert.c:599
+#, fuzzy
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Kunde inte flytta nyckelplatsområde. Inte nog med utrymme."
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "PBKDF2-iterationstid för LUKS (i ms)"
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Kunde inte flytta nyckelplatsområde."
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "ms"
+#: lib/luks2/luks2_luks1_convert.c:697
+#, fuzzy
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Det går inte att konvertera till LUKS1-format - nyckelplats %u är inte LUKS1-kompatibel."
 
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
-msgid "Do not ask for confirmation"
-msgstr "Fråga inte efter bekräftelse"
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Det går inte att konvertera till LUKS1-format - kontrollsummor för nyckelplatser är inte LUKS1-kompatibla."
 
-#: src/cryptsetup.c:1497
-msgid "Timeout for interactive passphrase prompt (in seconds)"
-msgstr "Tidsgräns för interaktiv lösenfrasprompt (i sekunder)"
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Det går inte att konvertera till LUKS1-format - enheterna använder inbäddad nyckelchiffer %s."
 
-#: src/cryptsetup.c:1497
-msgid "secs"
-msgstr "s"
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Det går inte att konvertera till LUKS1-format - LUKS2-huvud innehåller %u token."
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "Hur många inmatningsförsök av lösenfrasen som kan göras"
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Det går inte att konvertera till LUKS1-format - nyckelplats %u är i ogiltigt tillstånd."
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr "Justera nyttolast i <n> sektorgränser - för luksFormat"
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Det går inte att konvertera till LUKS1-format - plats %u (av maximalt antal platser) är fortfarande aktiv."
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Fil med säkerhetskopior av LUKS-huvud och nyckelplatser."
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "Det går inte att konvertera till LUKS1-format - nyckelplats %u är inte LUKS1-kompatibel."
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
 msgstr ""
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr ""
+#: lib/luks2/luks2_reencrypt.c:897
+#, fuzzy, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Storlek på enhet %s är inte justerad till begärd sektorstorlek (%u byte)."
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr ""
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Parametrar som inte stöds på enheten %s."
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
 #, fuzzy
-msgid "UUID for device to use."
-msgstr "DM-UUID för enheten %s förkortades.\n"
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Misslyckades med att initiera identifiering av enhetssignatur."
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr ""
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Misslyckades med att initiera identifiering av enhetssignatur."
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr ""
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "Misslyckades med att läsa krav från säkerhetskopiehuvud."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, fuzzy, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Misslyckades med att skriva paritet för RS block %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Misslyckades med att ta status på enhet %s."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Misslyckades med att ta bort token %d.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Misslyckades med att ta status på enhet %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, fuzzy, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Misslyckades med söka av enheten %s efter en signatur."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Misslyckades med att bestämma storlek för enhet %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+#, fuzzy
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Misslyckades med att erhålla läslås på enheten %s."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "Misslyckades med att byta ny nyckelplats."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, fuzzy, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Storlek på enhet %s är inte justerad till begärd sektorstorlek (%u byte)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, fuzzy, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Storlek på enhet %s är inte justerad till begärd sektorstorlek (%u byte)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, fuzzy, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Det går inte att använda enheten %s som redan används (redan mappad eller monterad)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+#, fuzzy
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Misslyckades med att öppna RS-kontext."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "Misslyckades med att hämta token %d för export."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "Enheten %s är inte aktiv."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+#, fuzzy
+msgid "Reencryption process is already running."
+msgstr "Omkryptering pågår redan."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+#, fuzzy
+msgid "Failed to acquire reencryption lock."
+msgstr "Misslyckades med att erhålla skrivlås för enhet."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2750
+#, fuzzy
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Storlek på enhet är inte justerad till begärd sektorstorlek."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2834
+#, fuzzy
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Omkryptering pågår redan."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2913
+#, fuzzy
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Misslyckades med att sätta standardnyckelplats för LUKS2-parametrar."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+#, fuzzy
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Misslyckades med söka av enheten %s efter en signatur."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+#, fuzzy
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Misslyckades med att skriva aktiveringsflaggor till nya huvuden.:"
+
+#: lib/luks2/luks2_reencrypt.c:3053
+#, fuzzy
+msgid "Decryption failed."
+msgstr "Reparation misslyckades."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Misslyckades med att skriva paritet för RS block %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+#, fuzzy
+msgid "Failed to sync data."
+msgstr "Misslyckades med att sätta dataoffset."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "Misslyckades med att läsa LUKS2-krav."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+#, fuzzy
+msgid "Failed to wipe backup segment data."
+msgstr "Misslyckades med att radera enhetssignatur."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+#, fuzzy
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Misslyckades med att läsa LUKS2-krav."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "Misslyckades med att initiera identifiering av enhetssignatur."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+#, fuzzy
+msgid "Failed to update reencryption context."
+msgstr "Misslyckades med att öppna RS-kontext."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Ingen fri plats för token."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Misslyckades med att skapa inbyggd token %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Kan inte verifiera lösenfras på icke-tty-ingångar."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Krypteringsparametrar för nyckelplatser stöds endast av LUKS2-enheter."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Inget känt chifferspecifikationsmönster kunde identifieras."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "VARNING: parametern --hash ignoreras i enkelt läge med specificerad nyckelfil.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "VARNING: flaggan --keyfile-size ignoreras, lässtorleken är densamma som storleken för krypteringsnyckeln.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "Identfierar enhetssignatur(er) på %s. Att fortsätta kan skada befintlig data."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Åtgärd avbruten.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Flaggan --key-file krävs."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Ange VeraCrypt PIM: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Ogiltigt PIM-värde:tolkningsfel."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Ogiltigt PIM-värde: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Ogiltigt PIM-värde:utanför intervallet."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Inget enhetshuvud finns tillgängligt med denna lösenfras."
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Enheten %s är inte en giltig LUKS-enhet."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Utskrift av huvudet med volymnyckel är känslig information\n"
+"som tillåter åtkomst till krypterad partition utan lösenfras.\n"
+"Denna utskrift bör alltid lagras krypterad på ett säkert ställe."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Enheten %s är fortfarande aktiv och schemalagd för uppskjuten borttagning.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Att ändra storlek på aktiv enhet kräver volymnyckel i nyckelringen, men -flaggan --disable-keyring är angiven."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Prestandamätning avbruten."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     N/A\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u iterationer per sekund för %zu-bitnyckel\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s N/A\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u iterationer, %5u minne, %1u parallella trådar (CPU:er) för %zu-bitnyckelplats (begärde %u ms)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Resultat från prestandamätningen är inte pålitligt."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Tester är ungefärliga och använder endast minne (ingen lagrings-IO).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#%*s Algoritm |       Nyckel |      Kryptering |      Avkryptering\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Chiffret %s-%s (nyckelstorlek %zd bitar) är inte tillgängligt."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#     Algoritm |       Nyckel |      Kryptering |      AVkryptering\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/A"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Ange lösenfras för nyckelplats att konvertera: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Vill du verkligen försöka att reparera LUKS-enhetshuvud?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Rensar enheten för att initialisera kontrollsumma för integritet.\n"
+"Du kan avbryta detta genom att trycka ned CTRL+c (resten av den ej rensade enheten kommer att innehålla en ogiltigt kontrollsumma).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Det går inte att inaktivera temporär enhet %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Flaggan för integritet kan endast användas för formatet LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Flaggorna för storlekar på LUKS2-metadata stöds inte."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Det går inte att skapa huvudfil %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Inga kända integritetspecifikationsmönster identifierat."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Det går inte att använda %s som diskhuvud."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Detta kommer att skriva över data på %s och går inte att ångra."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Misslyckades med att sätta pbkdf-parametrar."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Förminskad dataoffset endast tillåtet för fristående LUKS-huvuden."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Enheten aktiverad men kan inte spara undan flaggorna."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Nyckelplats %d markerad för borttagning."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Detta är sista nyckelplatsen. Enheten kommer att bli oanvändbar efter att denna nyckel tagits bort."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Ange eventuell återstående lösenfras: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Åtgärden avbröts, nyckelplatsen raderades INTE.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Ange lösenfras att ta bort: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Ange ny lösenfras för nyckelplats: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Ange valfri existerande lösenfras: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Ange lösenfras att ändra: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Ange ny lösenfras: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Ange lösenfras för nyckelplats att konvertera: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Endast ett enhetsargument för operationen isLuks stöds."
+
+#: src/cryptsetup.c:2001
+#, fuzzy
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Utskrift av huvudet med volymnyckel är känslig information\n"
+"som tillåter åtkomst till krypterad partition utan lösenfras.\n"
+"Denna utskrift bör alltid lagras krypterad på ett säkert ställe."
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Nyckelplats %d är inte aktiv."
+
+#: src/cryptsetup.c:2072
+#, fuzzy
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Utskrift av huvudet med volymnyckel är känslig information\n"
+"som tillåter åtkomst till krypterad partition utan lösenfras.\n"
+"Denna utskrift bör alltid lagras krypterad på ett säkert ställe."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Flaggan --header-backup-file krävs."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s är inte en cryptsetup-hanterad enhet."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Att uppdatera stöds inte för enhetstypen %s"
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Okänd metadata för enhetstypen %s."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Kommandot kräver enhet och mappat namn som argument."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Denna åtgärd kommer att ta bort alla nyckelplatser på enhet %s.\n"
+"Enheten kommer att bli oanvändbar efter denna åtgärd."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Åtgärden avbryten, nyckelplatser raderades EJ.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Ogiltig LUKS-typ, endast luks1 och luks2 stöds."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Enheten är redan av %s-typ."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Denna åtgärd kommer att konvertera %s till %s-format.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Åtgärden avbröts, enheten konverterades INTE.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Saknar flaggan --priority, --label eller --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Token %d är ogiltig."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Token %d används."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Misslyckades med att lägga till luks2-nyckelringsstoken %d."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Misslyckades med att tilldela token %d till nyckelplats %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Token %d används ej."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Misslyckades med att importera token från fil."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Misslyckades med att hämta token %d för export."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "parametern --key-description krävs för åtgärden lägg till token."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Åtgärden kräver specifik token. Använd parametern --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Ogiltig tokenåtgärd %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Enheten %s är inte en giltig LUKS-enhet."
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Misslyckades med att ta status på enhet %s."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "Ogiltig enhet %s."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Flaggan för integritet kan endast användas för formatet LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Begärd säkerhetskopia %s av huvud finns redan."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Det går inte att skapa huvudfil %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+#, fuzzy
+msgid "Not enough free keyslots for reencryption."
+msgstr "Ändra inte nyckel, ingen omkryptering av dataområde"
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Nyckelfil kan endast användas med --key-slot eller exakt en aktiv nyckelplats."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Ange lösenfras för nyckelplats %u: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Ange lösenfras för nyckelplats %u: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "Kommandot kräver enhet och mappat namn som argument."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Kryptering för enhet med integritetsprofil stöds ej."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+#, fuzzy
+msgid "LUKS2 device is not in reencryption."
+msgstr "Loggfilen %s existerar, återupptar kryptering.\n"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<enhet> [--type <typ>] [<namn>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "öppna enhet som <namn>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<namn>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "stäng enhet (ta bort mappning)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "ändra storlek på aktiv enhet"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "visa enhetsstatus"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <chiffer>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "prestandamät chiffer"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<enhet>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "försök att reparera metadata på disken"
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "lägg till nyckel till LUKS-enhet"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "ta bort alla nyckelplatser (ta bort krypteringsnyckeln)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "konvertera LUKS från/till LUKS2-format"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "ange permanenta konfigurationsflaggor för LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<enhet> [<ny nyckelfil>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "formaterar en LUKS-enhet"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "lägg till nyckel till LUKS-enhet"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<enhet> [<nyckelfil>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "tar bort angiven nyckel eller nyckelfil från LUKS-enhet"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "ändrar angiven nyckel eller nyckelfil för LUKS-enhet"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "konverterar en nyckel till nya pbkdf-parametrar"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<enhet> <nyckelplats>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "rensar nyckeln med nummer <nyckelplats> från LUKS-enhet"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "skriv ut UUID för LUKS-enhet"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "testar <enhet> för LUKS-partitionshuvud"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "skriver ut information om LUKS-partition"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "skriver ut information om TCRYPT-partition"
+
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "skriver ut information om TCRYPT-partition"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Försätt LUKS-enhet i vänteläge och rensa nyckel (alla in-/ut-åtgärder är frusna)"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Återuppta LUKS-enhet i vänteläge"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Säkerhetskopiera huvud och nyckelplatser från LUKS-enhet"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "Återställ huvud och nyckelplatser för LUKS-enhet"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<läggtill|tabort|importera|exportera> <enhet>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Manipulera LUKS2-token"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<åtgärd> är en av:\n"
+
+#: src/cryptsetup.c:3395
+#, fuzzy
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"Du kan också använda gamla <åtgärd> syntaxalias:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<namn> är enheten att skapa under %s\n"
+"<enhet> är den krypterade enheten\n"
+"<nyckelplats> är numret för LUKS-nyckelplatsen att ändra\n"
+"<nyckelfil> valfri nyckelfil för den nya nyckeln för luksAddKey-åtgärden\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Inkompilerat standardmetadataformat är %s (för luksFormat-åtgärd).\n"
+
+#: src/cryptsetup.c:3411
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"Inkompilerade standardnyckel- och standardlösenfrasparametrar:\n"
+"\tStörsta nyckelfilstorlek: %dkB, Största interaktiv lösenfraslängd %d (tecken)\n"
+"Standard-PBKDF för LUKS1: %s, iterationstid: %d (ms)\n"
+"Standard-PBKDF för LUKS2: %s\n"
+"\tIterationstid: %d, Minne: %dkB, Parallella trådar: %d\n"
+
+#: src/cryptsetup.c:3422
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"Inkompilerade standardchifferparametrar för enheter:\n"
+"\tloop-AES: %s, Nyckel %d bitar\n"
+"\tplain: %s, Nyckel: %d bitar, Lösenordshashning: %s\n"
+"\tLUKS1: %s, Nyckel: %d bitar, LUKS-huvudhashning %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: Standardnyckelstorlek med XTS-läge (två interna nycklar) kommer att dubbleras.\n"
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: kräver %s som argument"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "Visa detta hjälpmeddelande"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "Visa kort information om användning"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "Skriv ut paketversion"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Hjälpflaggor:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "Visar mer detaljerade felmeddelanden"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "Visa felsökningsmeddelanden"
+
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Visa felsökningsmeddelanden inklusive JSON-metadata"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "Chiffret som används för att kryptera disken (se /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "Hashen som används för att skapa krypteringsnyckel från lösenfras"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "Verifierar lösenfrasen genom att fråga efter den två gånger"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Läs nyckeln från en fil"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "Läs volymnyckeln (master) från fil."
+
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Skriv ut volymnyckel (master) istället för nyckelplatsinfo"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "Storleken för krypteringsnyckeln"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "BITAR"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "Begränsa läsningen från nyckelfil"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "byte"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "Antal byte att hoppa över i nyckelfil"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "Begränsa läsningen från nyligen tillagd nyckelfil"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "Antal byte att hoppa över i nyligen tillagd nyckelfil"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "Platsnummer för ny nyckel (standard är första lediga)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "Storleken för enheten"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "SEKTORER"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Använd endast specificerad enhetsstorlek (ignorera resten av enheten). FARLIGT!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "Startoffset i bakändesenheten"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "Hur många sektorer av krypterat data som ska hoppas över i början"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Skapa en skrivskyddad mappning"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Fråga inte efter bekräftelse"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Tidsgräns för interaktiv lösenfrasprompt (i sekunder)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "sek"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Uppdatering av förloppslinje (i sekunder)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Hur många inmatningsförsök av lösenfrasen som kan göras"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Justera nyttolast i <n> sektorgränser - för luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Fil med säkerhetskopior av LUKS-huvud och nyckelplatser"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Använd /dev/random för att generera volymnyckel"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Använd /dev/urandom för att generera volymnyckel"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Dela enhet med ett annat ej överlappande krypteringssegment"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID för enheten att använda"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Tillåt avvisningsbegäran (TRIM) för enhet"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Enhet eller fil med separerat LUKS-huvud"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Aktivera inte enhet, kontrollera endast lösenfrasen"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Använd dolt huvud (gömd TCRYPT-enhet)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Enheten är system-TCRYPT-disk (med starthanterare)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Använd säkerhetskopia (sekundär) för TCRYPT-huvud"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Sök också efter VeraCrypt-kompatibel enhet"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Personlig iteration för VeraCrypt-kompatibel enhet"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Query Personal Iteration Multiplier för VeraCrypt-kompatibel enhet"
+
+#: src/cryptsetup.c:3526
+#, fuzzy
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Typer av enhetsmetadata: luks, plain, loopaes, tcrypt"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Inaktivera kvalitetskontroll av lösenord (om aktiverat)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Använd flaggan dm-crypt same_cpu_crypt för prestandakompatibilitet"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Använd flaggan dm-crypt submit_from_crypt_cpus för prestandakompatibilitet"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Enhetsborttagning är förskjuten tills den sista användaren stänger den"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr ""
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "PBKDF-iterationstid för LUKS (i ms)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "ms"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "PBKDF-algoritm (för LUKS2) (argon2i/argon2id/pbkdf2)"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Minneskostnadsgräns för PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "kilobyte"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Parallellkostnad för PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "trådar"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Iterationskostnad för PBKDF (tvingad, inaktiverar prestandamätning)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Nyckelplats-prioritet: ignore,normal,prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Inaktivera låsning av metadata på disk"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Inaktivera att läsa in volymnycklar via kärnans nyckelring"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Algoritm för dataintegritet (endast LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Inaktivera journal för integritetsenhet"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Rensa inte enhet efter formatering"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Fråga inte efter lösenfras om aktivering med token misslyckas"
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Tokenantal (standardvärde: any)"
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Nyckelbeskrivning"
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "Sektorstorlek för kryptering (standardvärde 512 byte)"
+
+#: src/cryptsetup.c:3548
+#, fuzzy
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Sektorstorlek för kryptering (standardvärde 512 byte)"
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Sätt och spara undan aktiveringsflaggorna för enheten"
+
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Ange etikett för LUKS2-enhet"
+
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Ange undersystemsetikett för LUKS2-enheten"
+
+#: src/cryptsetup.c:3552
+#, fuzzy
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "Skapa obunden (inget tilldelat datasegment) LUKS2-nyckelplats"
+
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Läs eller skriv json från eller till en fil"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Områdesstorlek för metadata på LUKS2-huvudet"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Storlek på nyckelplatsområdet för LUKS2-huvud"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Uppdatera (återaktivera) enhet med nya parametrar"
+
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "LUKS2-nyckelplats: Storleken för krypteringsnyckeln"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "LUKS2-nyckelplats: Chiffret används krypering av nyckelplats"
+
+#: src/cryptsetup.c:3559
+#, fuzzy
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Dekryptera enheten permanent (ta bort kryptering)"
+
+#: src/cryptsetup.c:3560
+#, fuzzy
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Dekryptera enheten permanent (ta bort kryptering)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Förminska dataenhetsstorleken (flytta dataoffset). FARLIGT!"
+
+#: src/cryptsetup.c:3564
+#, fuzzy
+msgid "Maximal reencryption hotzone size."
+msgstr "Blockstorlek för omkryptering"
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
+
+#: src/cryptsetup.c:3566
+#, fuzzy
+msgid "Reencryption hotzone checksums hash"
+msgstr "Blockstorlek för omkryptering"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[FLAGGA…] <åtgärd> <åtgärdsspecifik>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "Argumentet <åtgärd> saknas."
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "Okänd åtgärd."
+
+#: src/cryptsetup.c:3713
+#, fuzzy
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Flaggorna --refresh och --test-passphrase är ömsesidigt uteslutande.\n"
+
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr "Flaggan --deferred är endast tillåten för kommandot close.\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Flaggan --shared är endast tillåten för öppning för enkel enhet.\n"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Flaggan --allow-discards är endast tillåten för operationen open.\n"
+
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Flaggan --persistent är endast tillåten för operationen open.\n"
+
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Flaggan --allow-discards är endast tillåten för operationen open.\n"
+
+#: src/cryptsetup.c:3743
+#, fuzzy
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Flaggan --persistent är ej tillåtet med --test-passphrase.\n"
+
+#: src/cryptsetup.c:3753
+#, fuzzy
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"Flaggan --key-size är endast tillåten för luksFormat, luksAddKey (with --unbound),\n"
+"open och benchmark. För att begränsa läsning från nyckelfil, använd --keyfile-size=(byte)."
+
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Flaggan --integrity är endast tillåten för luksFormat (LUKS2).\n"
+
+#: src/cryptsetup.c:3764
+#, fuzzy
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Flaggan --integrity-no-wipe kan användas endast för åtgärden formatera med integritetsutökningar.\n"
+
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Flaggorna --label och --subsystem tillåts endast för luksFormat och konfiguration av LUKS2-åtgärder.\n"
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Flaggan --test-passphrase är endast tillåten för open för LUKS- och TCRYPT-enheter.\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "Nyckelstorlek måste vara en multipel av 8 bitar"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "Nyckelplatsen är ogiltig."
+
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Flaggan --key-file åsidosätter specificerade nyckelfilsargument."
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "Negativt tal för flagga ej tillåtet."
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Endast ett argument för --key-file är tillåtet."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "Endast en av flaggorna --use-[u]random är tillåten."
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "Flaggan --use-[u]random är endast tillåten för luksFormat."
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "Flaggan --uuid är endast tillåten för luksFormat och luksUUID."
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "Flaggan --align-payload är endast tillåten för luksFormat."
+
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Flaggorna --luks2-metadata-size och --opt-luks2-keyslots-size tillåts endast för luksFormat med LUKS2."
+
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Ogiltig storlekspecifikation för LUKS2-metadata på enhet."
+
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Ogiltig storlekspecifikation för LUKS2-nyckelplats på enhet."
+
+#: src/cryptsetup.c:3838
+#, fuzzy
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Flaggan --align-payload och --offset kan inte kombineras."
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Flaggan --skip stöds endast för öppning av vanliga enheter och loopaes-enheter.\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Flaggan --offset stöds endast för öppning av vanliga och loopaes-enheter och för luksFormat.\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Flaggorna --tcrypt-hidden, --tcrypt-system eller --tcrypt-backup stöds endast på TCRYPT-enhet.\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Flaggan --tcrypt-hidden kan inte kombineras med --allow-discards.\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Flaggan --veracrypt stöds endast för TCRYPT-enhetstyper.\n"
+
+#: src/cryptsetup.c:3873
+#, fuzzy
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Angav ett ogiltigt argument för parametern --veracrypt-pim.\n"
+
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Flaggan --veracrypt-pim stöds endast för VeraCrypt-kompatibla enheter.\n"
+
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Flaggan --veracrypt-query-pim stöds endast för VeraCrypt-kompatibla enheter.\n"
+
+#: src/cryptsetup.c:3889
+#, fuzzy
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Flaggorna --veracrypt-pim och --veracrypt-query-pim är ömsesidigt uteslutande.\n"
+
+#: src/cryptsetup.c:3896
+#, fuzzy
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Flaggan --priority kan endast vara ignore/normal/prefer.\n"
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+#, fuzzy
+msgid "Keyslot specification is required."
+msgstr "Specifikation för nyckelplats krävs.\n"
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+#, fuzzy
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Password-based key derivation function (PBKDF) kan endast vara pbkdf2 eller argon2i/argon2id.\n"
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+#, fuzzy
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Tvingade PBKDF-iterationer går inte att kombinera med flaggan iteration time.\n"
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "Flaggan för sektorstorlek stöds inte för detta kommando.\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+#, fuzzy
+msgid "Key size is required with --unbound option."
+msgstr "Nyckelstorlek krävs med flaggan --unbound.\n"
+
+#: src/cryptsetup.c:3944
+#, fuzzy
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Flaggan --unbound kan inte användas tillsammans med luksAddKey action.\n"
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "Flaggan --refresh är endast tillåten för operationen open.\n"
+
+#: src/cryptsetup.c:3960
+#, fuzzy
+msgid "Cannot disable metadata locking."
+msgstr "Det går inte att inaktivera metadatalås.\n"
+
+#: src/cryptsetup.c:3970
+#, fuzzy
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Ogiltig storlekspecifikation på enhet."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Ogiltig storlekspecifikation på enhet."
+
+#: src/cryptsetup.c:3981
+#, fuzzy
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Högsta förminskningsstorlek för enhet är 64 MiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Minskningsstorlek måste vara en multipel av 512-bytesektor."
+
+#: src/cryptsetup.c:3989
+#, fuzzy
+msgid "Invalid data size specification."
+msgstr "Ogiltig storlekspecifikation på enhet."
+
+#: src/cryptsetup.c:3994
+#, fuzzy
+msgid "Reduce size overflow."
+msgstr "Enhets-offset spillde över."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
+
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Minskningsstorlek måste vara en multipel av 512-bytesektor."
+
+#: src/cryptsetup.c:4006
+#, fuzzy
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Flaggan --align-payload och --offset kan inte kombineras."
+
+#: src/cryptsetup.c:4010
+#, fuzzy
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Flaggan --align-payload och --offset kan inte kombineras."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Flaggorna --ignore-corruption och --restart-on-corruption kan inte användas tillsammans.\n"
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Angav ogiltig saltsträng."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Kan inte skapa hashavbild %s för skrivning."
+
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Det går inte att skapa FEC-avbild %s för skrivning."
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Angav ogiltig rothashsträng."
+
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "Ogiltig enhet %s."
+
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr "Det går inte att läsa nyckelfilen %s."
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<dataenhet> <hashenhet>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "formatera enhet"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<dataenhet> <hashenhet> <rothash>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "verifiera enhet"
+
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<dataenhet> <namn> <hashenhet> <rothash>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "visa statistik för aktiv enhet"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<hash_enhet>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "visa information från disk"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<namn> är enheten att skapa under %s\n"
+"<dataenhet> är dataenheten\n"
+"<hashenhet> är enheten som innehåller verifieringsdata\n"
+"<rothash> hash för rotnoden på <hashenhet>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Inkompilerade standardparametrar för dm-verity:\n"
+"\tHash: %s, Datablock (byte): %u, Hashblock (byte): %u, Saltstorlek: %u, Hashformat: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Använd inte verity superblock"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Formattyp (1 - normal, 0 - ursprungliga Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "antal"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Blockstorlek på dataenheten"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Blockstorlek på hashenheten"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "FEC paritetsbyte"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Antalet block i datafilen"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "block"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Sökväg till enhet med felkorrigeringsdata"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "sökväg"
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Startoffset på hashenheten"
+
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Startoffset på FEC-enheten"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Hashalgoritm"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "sträng"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Salt"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "hexsträng"
+
+#: src/veritysetup.c:478
+#, fuzzy
+msgid "Path to root hash signature file"
+msgstr "Misslyckades med skapandet av hashområde."
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Starta om kärna om något skadat identifieras"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ignorera om något är skadat, logga endast"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Verifiera inte nollställda block"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Verifiera datablock endast första gången det läses in"
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Flaggorna --ignore-corruption, --restart-on-corruption eller --ignore-zero-blocks är endast tillåtna för operationen open.\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Flaggan --integrity-recalculate kan användas endast för öppen åtgärd."
+
+#: src/veritysetup.c:592
+#, fuzzy
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Flaggorna --ignore-corruption och --restart-on-corruption kan inte användas tillsammans.\n"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Det går inte att läsa nyckelfilen %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Det går inte att läsa %d byte från nyckelfilen %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Formaterad med taggstorlek %u, intern integritet %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<integrity_enhet>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<integritet_enhet> <namn>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<namn> är enheten att skapa under %s\n"
+"<integritetsenhet> är enheten som innehåller data med integritetstaggar\n"
+
+#: src/integritysetup.c:507
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"Inkompilerade standardparametrar för dm-integrity:\n"
+"\tTaggstorlek: %u byte, Kontrollsummealgoritm: %s\n"
+"\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Sökvägen till dataenhet (om separat)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Journalstorlek"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Infoga sektorer"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "Journalvattenmärke"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "procent"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Journalincheckningstid"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "ms"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Taggstorlek (per sektor)"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Sektorstorlek"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Bufferstorlek"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Dataintegritetsalgoritm"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Storleken för dataintegritetsnyckeln"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Läs integritetsnyckeln från en fil"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Integritetsalgoritm för journal"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Storleken för journalens integritetssnyckel"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Läs journalens integritetsnyckel från en fil"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Krypteringsalgoritm för journal"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Storleken för journalens krypteringsnyckel"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Läs journalens krypteringsnyckel från en fil"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Återhämtningsläge (ingen journal, ingen taggkontroll)"
+
+#: src/integritysetup.c:575
+#, fuzzy
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Inaktivera journal för integritetsenhet"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Räkna automatiskt initiala taggar."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Flaggan --integrity-recalculate kan användas endast för öppen åtgärd."
+
+#: src/integritysetup.c:669
+#, fuzzy
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Flaggorna --journal-size, --interleave-sectors, --sector-size, --tag-size och --no-wipe kan endast användas för åtgärden formatera.\n"
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Ogiltig storlekspecifikation på journal."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Både flaggor för nyckelfil och nyckelstorlek måste specifiiceras."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Integritetsalgoritm måste specificieras om integritetsnyckel används."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Både flaggor för nyckelfil för journalintegritet och nyckelstorlek måste specificeras."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Integritetsalgoritm för journal måste anges om integritetsnyckel för journal används."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Både flaggor för nyckelfil för journalkryptering och nyckelstorlek måste specificeras."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Krypteringsalgoritm för journal måste anges om integritetsnyckel för journal används."
+
+#: src/integritysetup.c:703
+#, fuzzy
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Flaggorna --refresh och --test-passphrase är ömsesidigt uteslutande.\n"
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
+
+#: src/integritysetup.c:711
+#, fuzzy
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Flaggan för integritet kan endast användas för formatet LUKS2."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Omkryptering pågår redan."
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Kan inte öppna %s exklusivt, enheten används."
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Misslyckades med allokering av justerat minne."
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "Det går inte att läsa enheten %s."
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Markerar LUKS1-enhet %s som oanvändbar."
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Sätter LUKS2-flaggan för att kryptera om på enheten %s."
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "Det går inte att skriva till enheten %s."
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Det går inte att skriva loggfil för omkryptering."
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Det går inte att läsa loggfil för omkryptering."
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "Loggfilen %s existerar, återupptar kryptering.\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Aktiverar temporär enhet användandes gammalt LUKS-huvud."
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Aktiverar temporär enhet användandes nytt LUKS-huvud."
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Aktivering av temporära enheter misslyckades."
+
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Misslyckades med att sätta dataoffset."
+
+#: src/cryptsetup_reencrypt.c:565
+#, fuzzy
+msgid "Failed to set metadata size."
+msgstr "Misslyckades med att sätta dataoffset."
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "Skapade nytt LUKS-huvud för enhet %s."
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Denna version av cryptsetup-reencrypt kan inte hantera ny interna tokentypen %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Misslyckades med att läsa aktiveringsflaggor från säkerhetskopia av huvud."
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Misslyckades med att skriva aktiveringsflaggor till nya huvuden.:"
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Misslyckades med att läsa krav från säkerhetskopiehuvud."
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "Skapade säkerhetskopia av %s-huvud på enhet %s."
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Misslyckades med att skapa en säkerhetskopia av LUKS-huvuden."
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "Det går inte återställa %s-huvudet på enheten %s."
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "Återställde %s-huvudet på enheten %s."
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Misslyckades med att öppna temporär LUKS-enhet."
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Det går inte att hämta enhetsstorlek."
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "In-/utfel under återkryptering."
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
-#, fuzzy
-msgid "[OPTION...] <action> <action-specific>"
-msgstr "[FLAGGA...] <åtgärd> <åtgärdsspecifik>]"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Angivet UUID är ogiltigt."
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Det går inte att öppna loggfilen för omkryptering."
 
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
-msgid "Argument <action> missing."
-msgstr "Argumentet <åtgärd> saknas."
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Ingen dekryptering pågår, givet UUID kan endast användas för att återuppta vilande dekrypteringsprocess."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
-msgid "Unknown action."
-msgstr "Okänd åtgärd."
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Ändrade pbkdf-parametrarna i nyckelplatsen %i.:1"
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "Blockstorlek för omkryptering"
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
 
-#: src/cryptsetup.c:1657
-msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Ändra inte nyckel, ingen omkryptering av dataområde"
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Läs volymnyckeln (master) från fil"
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
-msgid "Key size must be a multiple of 8 bits"
-msgstr "Nyckelstorlek måste vara en multipel av 8 bitar"
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "PBKDF2-iterationstid för LUKS (i ms)"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
-#, fuzzy
-msgid "Key slot is invalid."
-msgstr "Nyckelplats %d är ogiltig.\n"
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Använd direct-io vid enhetsåtkomst"
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Använd fsync efter varje block"
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
-msgid "Negative number for option not permitted."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Uppdatera loggfilen efter varje block"
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
-msgid "Only one of --use-[u]random options is allowed."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Använd endast denna plats (andra kommer att inaktiveras)"
 
-#: src/cryptsetup.c:1699
-msgid "Option --use-[u]random is allowed only for luksFormat."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Skapa nytt huvud på icke-krypterad enhet"
 
-#: src/cryptsetup.c:1703
-msgid "Option --uuid is allowed only for luksFormat and luksUUID."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "Dekryptera enheten permanent (ta bort kryptering)"
 
-#: src/cryptsetup.c:1707
-msgid "Option --align-payload is allowed only for luksFormat."
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "Det UUID som används för att återuppta kryptering"
 
-#: src/cryptsetup.c:1713
-#, fuzzy
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr "Denna åtgärd stöds endast för LUKS-enheter.\n"
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Typ av LUKS-metadata: luks1, luks2"
 
-#: src/cryptsetup.c:1719
-#, fuzzy
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
-msgstr "Denna åtgärd stöds endast för LUKS-enheter.\n"
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[FLAGGA…] <enhet>"
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Omkryptering kommer att ändra: %s%s%s%s%s%s."
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "volymnyckeln"
 
-#: src/cryptsetup.c:1735
-#, fuzzy
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "Denna åtgärd stöds endast för LUKS-enheter.\n"
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "sätt hash till "
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ", sätt chiffer till "
 
-#: src/veritysetup.c:88
-#, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "Kräver argument."
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Endast värden mellan 1 MiB och 64 MiB är tillåtna som blockstorlek för omkryptering."
 
-#: src/veritysetup.c:308
-#, fuzzy
-msgid "<data_device> <hash_device>"
-msgstr "<namn> <enhet>"
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "Högsta förminskningsstorlek för enhet är 64 MiB."
 
-#: src/veritysetup.c:308
-#, fuzzy
-msgid "format device"
-msgstr "skapa enhet"
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Flaggan --new måste användas tillsammans med --reduce-device-size eller --header."
 
-#: src/veritysetup.c:309
-msgid "<data_device> <hash_device> <root_hash>"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Flaggan --keep-key kan endast användas med --hash, --iter-time eller --pbkdf-force-iterations."
 
-#: src/veritysetup.c:309
-#, fuzzy
-msgid "verify device"
-msgstr "ta bort enhet"
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "Flaggan --new kan inte användas tillsammans med --decrypt."
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr ""
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "Flaggan --decrypt är inkompatibel med specificerade parametrar."
 
-#: src/veritysetup.c:310
-#, fuzzy
-msgid "create active device"
-msgstr "ändra storlek på aktiv enhet"
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Flaggan --uuid är endast tillåten tillsammans med --decrypt."
 
-#: src/veritysetup.c:311
-#, fuzzy
-msgid "remove (deactivate) device"
-msgstr "ändra storlek på aktiv enhet"
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Ogiltig luks-typ. Använd en av dessa: 'luks', 'luks1' or 'luks2'."
 
-#: src/veritysetup.c:312
-#, fuzzy
-msgid "show active device status"
-msgstr "visa enhetsstatus"
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "Fel vid läsning av svar från terminal."
 
-#: src/veritysetup.c:313
-#, fuzzy
-msgid "<hash_device>"
-msgstr "<enhet>"
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "Kommandot lyckades.\n"
 
-#: src/veritysetup.c:313
-msgid "show on-disk information"
-msgstr ""
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "fel eller saknar parametrar"
 
-#: src/veritysetup.c:332
-#, c-format
-msgid ""
-"\n"
-"<name> is the device to create under %s\n"
-"<data_device> is the data device\n"
-"<hash_device> is the device containing verification data\n"
-"<root_hash> hash of the root node on <hash_device>\n"
-msgstr ""
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "ingen behörighet eller dålig lösenfras"
 
-#: src/veritysetup.c:339
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
-msgstr ""
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "slut på minne"
 
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
-msgstr ""
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "angav fel enhet eller fil"
 
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
-msgstr ""
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "enheten existerar redan eller så är enheten upptagen"
 
-#: src/veritysetup.c:378
-msgid "number"
-msgstr ""
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "okänt fel"
 
-#: src/veritysetup.c:379
-#, fuzzy
-msgid "Block size on the data device"
-msgstr "Storleken för enheten"
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "Kommandot misslyckades med kod %i (%s).\n"
 
-#: src/veritysetup.c:380
-#, fuzzy
-msgid "Block size on the hash device"
-msgstr "Storleken för enheten"
+#: src/utils_tools.c:283
+#, c-format
+msgid "Key slot %i created."
+msgstr "Nyckelplats %i är ändrad."
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
-msgstr ""
+#: src/utils_tools.c:285
+#, c-format
+msgid "Key slot %i unlocked."
+msgstr "Nyckelplats %i är upplåst."
 
-#: src/veritysetup.c:381
-msgid "blocks"
-msgstr ""
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Nyckelplats %i är upplåst."
 
-#: src/veritysetup.c:382
-#, fuzzy
-msgid "Starting offset on the hash device"
-msgstr "Startoffset i bakändesenheten"
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Token %i används."
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
-msgstr ""
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Token %i används."
 
-#: src/veritysetup.c:383
-msgid "string"
+#: src/utils_tools.c:464
+#, fuzzy
+msgid ""
+"\n"
+"Wipe interrupted."
 msgstr ""
+"\n"
+"Skrivning avbruten."
 
-#: src/veritysetup.c:384
-msgid "Salt"
-msgstr ""
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "VARNING: Enheten %s innehåller redan en ”%s”-partitionssignatur.\n"
 
-#: src/veritysetup.c:384
-msgid "hex string"
-msgstr ""
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "VARNING: Enheten %s innehåller redan en ”%s”-superblocksignatur.\n"
 
-#: src/cryptsetup_reencrypt.c:147
-#, fuzzy, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Kan inte öppna enheten %s.\n"
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Misslyckades med att initiera identifiering av enhetssignatur."
 
-#: src/cryptsetup_reencrypt.c:151
-#, fuzzy, c-format
-msgid "Cannot open device %s\n"
-msgstr "Kan inte öppna enheten %s.\n"
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Misslyckades med att ta status på enhet %s."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr ""
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Enheten %s används. Det går inte att fortsätta med formateringsåtgärden."
 
-#: src/cryptsetup_reencrypt.c:168
+#: src/utils_tools.c:563
 #, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Kan inte läsa enheten %s.\n"
+msgid "Failed to open file %s in read/write mode."
+msgstr "Misslyckades med att öppna filen %s i läs-/skrivläge."
 
-#: src/cryptsetup_reencrypt.c:179
+#: src/utils_tools.c:577
 #, c-format
-msgid "Marking LUKS device %s unusable.\n"
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/utils_tools.c:580
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:200
-#, fuzzy, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Kan inte rensa enheten %s.\n"
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Misslyckades med att radera enhetssignatur."
 
-#: src/cryptsetup_reencrypt.c:281
-#, fuzzy
-msgid "Cannot write reencryption log file.\n"
-msgstr "Kan inte skriva säkerhetskopia för huvud %s.\n"
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Misslyckades med söka av enheten %s efter en signatur."
 
-#: src/cryptsetup_reencrypt.c:337
+#: src/utils_tools.c:629
 #, fuzzy
-msgid "Cannot read reencryption log file.\n"
-msgstr "Kan inte läsa säkerhetskopia för huvud %s.\n"
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Läsning avbryten."
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/utils_password.c:43 src/utils_password.c:75
 #, c-format
-msgid "Log file %s exists, resuming reencryption.\n"
-msgstr ""
+msgid "Cannot check password quality: %s"
+msgstr "Det går inte att kontrollera lösenordskvalitet: %s"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
 msgstr ""
+"Misslyckades med kvalitetskontroll av lösenord:\n"
+"%s"
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr ""
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Misslyckades med kvalitetskontroll av lösenord: Dålig lösenfras (%s)"
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr ""
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Fel vid läsning av lösenfras från terminal."
 
-#: src/cryptsetup_reencrypt.c:450
-#, fuzzy, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Kan inte rensa huvudet på enheten %s.\n"
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Verifiera lösenfras: "
 
-#: src/cryptsetup_reencrypt.c:458
-#, c-format
-msgid "Activated keyslot %i.\n"
-msgstr ""
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Lösenfraserna stämmer inte överens."
 
-#: src/cryptsetup_reencrypt.c:484
-#, fuzzy, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "LUKS-huvud identifierat men enheten %s är för liten.\n"
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Det går inte att använda offset med terminalinmatning."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr ""
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Ange lösenfras: "
 
-#: src/cryptsetup_reencrypt.c:634
-#, fuzzy, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Kan inte rensa huvudet på enheten %s.\n"
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Ange lösenfras för %s: "
 
-#: src/cryptsetup_reencrypt.c:636
-#, fuzzy, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "LUKS-huvud identifierat men enheten %s är för liten.\n"
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Ingen nyckel finns tillgänglig med denna lösenfras."
 
-#: src/cryptsetup_reencrypt.c:669
-#, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
 msgstr ""
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-#, fuzzy
-msgid "Cannot seek to device offset.\n"
-msgstr "Kan inte läsa enheten %s.\n"
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Det går inte att öppna nyckelfilen %s för skrivning."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-#, fuzzy
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Kan inte öppna säkerhetskopia för huvud %s.\n"
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Det går inte att skriva till nyckelfilen %s."
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-#, fuzzy
-msgid "Cannot get device size.\n"
-msgstr "Kan inte läsa enheten %s.\n"
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Misslyckades med att öppna filen %s i skrivskyddat läge."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr ""
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Tillhandahåll giltig JSON för LUKS2-token:\n"
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr ""
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Misslyckades med att läsa in JSON-filen."
 
-#: src/cryptsetup_reencrypt.c:1028
+#: src/utils_luks2.c:72
 msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
+"\n"
+"Read interrupted."
 msgstr ""
+"\n"
+"Läsning avbryten."
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
-#, fuzzy, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Ange ny lösenfras för nyckelplats: "
-
-#: src/cryptsetup_reencrypt.c:1136
-#, fuzzy
-msgid "Cannot open reencryption log file.\n"
-msgstr "Kan inte öppna säkerhetskopia för huvud %s.\n"
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Misslyckades med att öppna filen %s in skrivläge."
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "Reencryption block size"
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
 msgstr ""
+"\n"
+"Skrivning avbruten."
 
-#: src/cryptsetup_reencrypt.c:1262
-msgid "MiB"
-msgstr ""
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Misslyckades med att skriva JSON-fil."
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr ""
+#~ msgid "Requested dmcrypt performance options are not supported."
+#~ msgstr "Begärda flaggor för dmcrypt-prestanda stöds inte."
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr ""
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "Det går inte att formatera enheten %s då den används."
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr ""
+#~ msgid "Key slot %d is not used."
+#~ msgstr "Nyckelplats %d används inte."
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr ""
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "Funktionen är inte tillgänglig i FIPS-läge."
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr ""
+#~ msgid "Cipher %s is not available."
+#~ msgstr "Chiffret %s är inte tillgängligt."
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "Nyckelplats %d markerad för borttagning."
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
+#~ msgid "open device as mapping <name>"
+#~ msgstr "öppna enhet som mappning <namn>"
 
-#: src/cryptsetup_reencrypt.c:1281
-#, fuzzy
-msgid "Create new header on not encrypted device."
-msgstr "Kan inte rensa huvudet på enheten %s.\n"
+#~ msgid "Parameter --refresh is only allowed with open or refresh commands.\n"
+#~ msgstr "Flaggan --refresh är endast tillåten för kommandot open eller refresh.\n"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
-msgstr ""
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "Stöder inte sektorstorlek för kryptering.\n"
 
-#: src/cryptsetup_reencrypt.c:1298
-msgid "[OPTION...] <device>"
-msgstr ""
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "stäng enhet (inaktivera och ta bort mappning)"
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "Misslyckades med att sätta PBKDF-parametrar."
 
-#: src/cryptsetup_reencrypt.c:1313
-#, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr ""
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "Kan inte söka till enhetsoffset.\n"
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
-msgstr ""
+#~ msgid "Interrupted by a signal."
+#~ msgstr "Avbruten av en signal."
 
-#: src/cryptsetup_reencrypt.c:1315
-msgid ", set cipher to "
-msgstr ""
+#~ msgid "Replaced with key slot %d.\n"
+#~ msgstr "Ersätt med nyckelplats %d.\n"
 
-#: src/cryptsetup_reencrypt.c:1320
-msgid "Argument required."
-msgstr ""
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)\n"
+#~ msgstr "Enhet %s är för liten. (LUKS2 kräver minst  %<PRIu64> bytes.)\n"
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "minnesallokeringsfel i action_luksFormat"
 
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-#, fuzzy
-msgid "Invalid device size specification."
-msgstr "Ogiltig enhet %s.\n"
+#~ msgid "Missing LUKS target type, option --type is required.\n"
+#~ msgstr "Saknar måltyp för LUKS, flaggan -type krävs.\n"
 
-#: src/cryptsetup_reencrypt.c:1363
-msgid "Maximum device reduce size is 64 MiB."
-msgstr ""
+#~ msgid "Missing --token option specifying token for removal.\n"
+#~ msgstr ""
+#~ "Saknad flagga --token för att ange token att ta bort.\n"
+#~ " \n"
 
-#: src/cryptsetup_reencrypt.c:1366
-#, fuzzy
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Nyckelstorlek måste vara en multipel av 8 bitar"
+#~ msgid "Add or remove keyring token"
+#~ msgstr "Lägg till eller ta bort token för nyckelring"
 
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr ""
+#~ msgid "Activated keyslot %i.\n"
+#~ msgstr "Aktiverade nyckelplats %i.\n"
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
+#~ msgid "Using default pbkdf parameters for new LUKS2 header.\n"
+#~ msgstr "Använder pbkdf-standardparametrar för nya LUKS2-huvuden.\n"
 
-#: src/cryptsetup_reencrypt.c:1378
-msgid "Option --new cannot be used together with --decrypt."
-msgstr ""
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "För många trädnivåer för verity-volym.\n"
 
-#: src/cryptsetup_reencrypt.c:1382
-msgid "Option --decrypt is incompatible with specified parameters."
-msgstr ""
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Nyckel %d är inte aktiv. Kan inte rensa.\n"
 
-#: src/utils_tools.c:151
-#, fuzzy
-msgid "Error reading response from terminal.\n"
-msgstr "Fel vid läsning av lösenfras från terminal.\n"
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<namn> <dataenhet> <hashenhet> <rothash>"
 
-#: src/utils_tools.c:173
-msgid "Command successful.\n"
-msgstr "Kommandot lyckades.\n"
+#~ msgid "create active device"
+#~ msgstr "skapa aktiv enhet"
 
-#: src/utils_tools.c:191
-#, c-format
-msgid "Command failed with code %i"
-msgstr "Kommandot misslyckades med kod %i"
+#~ msgid "remove (deactivate) device"
+#~ msgstr "ta bort (inaktivera) enhet"
 
-#: src/utils_password.c:42
-#, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr ""
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Förlopp: %5.1f%%, ETA %02llu:%02llu, %4llu MiB skrivna, hastighet %5.1f MiB/s%s"
 
-#: src/utils_password.c:50
-#, fuzzy, c-format
-msgid ""
-"Password quality check failed:\n"
-" %s\n"
-msgstr "setpriority %u misslyckades: %s"
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Kan inte hitta en ledig loopback-enhet.\n"
 
-#~ msgid "Key slot %d verified.\n"
-#~ msgstr "Nyckelplats %d har verifierats.\n"
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Kan inte öppna enheten %s\n"
 
-#~ msgid "Invalid key size %d.\n"
-#~ msgstr "Ogiltig nyckelstorlek %d.\n"
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Kan inte använda insänt UUID om inte dekryptering pågår.\n"
 
 #~ msgid "Enter LUKS passphrase: "
 #~ msgstr "Ange LUKS-lösenfras: "
 
-#~ msgid ""
-#~ "Warning: exhausting read requested, but key file %s is not a regular "
-#~ "file, function might never return.\n"
-#~ msgstr ""
-#~ "Varning: utförlig läsning begärd men nyckelfilen %s är inte en vanlig "
-#~ "fil, funktionen kanske aldrig avslutas.\n"
+#~ msgid "Warning: exhausting read requested, but key file %s is not a regular file, function might never return.\n"
+#~ msgstr "Varning: utförlig läsning begärd men nyckelfilen %s är inte en vanlig fil, funktionen kanske aldrig avslutas.\n"
 
 #~ msgid "exclusive "
 #~ msgstr "exklusiv"
@@ -1898,27 +4108,9 @@ msgstr "setpriority %u misslyckades: %s"
 #~ msgid "Unable to obtain sector size for %s"
 #~ msgstr "Kunde inte läsa av sektorstorlek för %s"
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr "Misslyckades med att läsa av katalog för enhetsmappning."
-
 #~ msgid "Backup file %s doesn't exist.\n"
 #~ msgstr "Säkerhetskopian %s finns inte.\n"
 
-#~ msgid "%s is not LUKS device.\n"
-#~ msgstr "%s är inte en LUKS-enhet.\n"
-
-#~ msgid "%s is not LUKS device."
-#~ msgstr "%s är inte en LUKS-enhet."
-
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Kan inte öppna filen %s.\n"
-
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Misslyckades med att skriva till nyckellagring.\n"
-
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr "Misslyckades med att läsa från nyckellagring.\n"
-
 #~ msgid "remove LUKS mapping"
 #~ msgstr "ta bort LUKS-mappning"
 
@@ -1929,15 +4121,11 @@ msgstr "setpriority %u misslyckades: %s"
 #~ msgstr "ändra aktiv enhet - FÖRÅLDRAD - se manualsida"
 
 #~ msgid ""
-#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case "
-#~ "you really need this functionality.\n"
-#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, "
-#~ "hit Ctrl-C now.\n"
+#~ "The reload action is deprecated. Please use \"dmsetup reload\" in case you really need this functionality.\n"
+#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, hit Ctrl-C now.\n"
 #~ msgstr ""
-#~ "Omläsningsåtgärden är föråldrad. Använd \"dmsetup reload\" om du "
-#~ "verkligen behöver denna funktion.\n"
-#~ "VARNING: använd inte omläsning för \"touch\" på LUKS-enheter. Om så är "
-#~ "fallet, tryck Ctrl-C nu.\n"
+#~ "Omläsningsåtgärden är föråldrad. Använd ”dmsetup reload” om du verkligen behöver denna funktion.\n"
+#~ "VARNING: använd inte omläsning för ”touch” på LUKS-enheter. Om så är fallet, tryck Ctrl-C nu.\n"
 
 #~ msgid "Obsolete option --non-exclusive is ignored.\n"
 #~ msgstr "Föråldrad flagga --non-exclusive ignoreras.\n"
index ea0d465..8543bd3 100644 (file)
Binary files a/po/uk.gmo and b/po/uk.gmo differ
index bd0c8e2..bfa8f2c 100644 (file)
--- a/po/uk.po
+++ b/po/uk.po
 # Copyright (C) 2012 Free Software Foundation, Inc.
 # This file is put in the public domain.
 #
-# Yuri Chornoivan <yurchor@ukr.net>, 2012, 2013, 2014, 2015.
+# Yuri Chornoivan <yurchor@ukr.net>, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020.
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 2.3.3-rc0\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-19 12:33+0200\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2020-05-15 15:17+0300\n"
 "Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
-"Language-Team: Ukrainian <translation-team-uk@lists.sourceforge.net>\n"
+"Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\n"
 "Language: uk\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Lokalize 1.5\n"
+"X-Generator: Lokalize 20.07.70\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"Не можна ініціалізувати device-mapper, якщо програму запущено не від імені "
-"адміністратора (root).\n"
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Не можна ініціалізувати device-mapper, якщо програму запущено не від імені адміністратора (root)."
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
-msgstr ""
-"Не вдалося ініціалізувати device-mapper. Чи завантажено модуль ядра dm_mod?\n"
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "Не вдалося ініціалізувати device-mapper. Чи завантажено модуль ядра dm_mod?"
 
-#: lib/libdevmapper.c:550
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "Підтримки бажаного прапорця відкладення, %s, не передбачено."
+
+#: lib/libdevmapper.c:1198
 #, c-format
-msgid "DM-UUID for device %s was truncated.\n"
-msgstr "DM-UUID для пристрою %s було обрізано.\n"
+msgid "DM-UUID for device %s was truncated."
+msgstr "DM-UUID для пристрою %s було обрізано."
+
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr "Невідомий тип призначення dm."
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Підтримки вказаних параметрів швидкодії dm-crypt не передбачено."
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Підтримки вказаних параметрів обробки пошкоджених даних за допомогою dm-verity не передбачено."
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Підтримки вказаних параметрів FEC за допомогою dm-verity не передбачено."
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "Підтримки вказаних параметрів цілісності даних не передбачено."
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Ð\9fÑ\96дÑ\82Ñ\80имки Ð²ÐºÐ°Ð·Ð°Ð½Ð¸Ñ\85 Ð¿Ð°Ñ\80амеÑ\82Ñ\80Ñ\96в Ñ\88видкодÑ\96Ñ\97 dmcrypt Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено.\n"
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "Ð\9fÑ\96дÑ\82Ñ\80имки Ð²ÐºÐ°Ð·Ð°Ð½Ð¾Ð³Ð¾ Ð¿Ð°Ñ\80амеÑ\82Ñ\80а sector_size Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено."
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:1645
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Підтримки потрібного вам автоматичного повторного обчислення міток цілісності не передбачено."
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+msgid "Discard/TRIM is not supported."
+msgstr "Підтримки відкидання або обрізання не передбачено."
+
+#: lib/libdevmapper.c:1653
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Підтримки вказаного режиму бітової карти цілісності dm не передбачено."
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr "Не вдалося опитати сегмент dm-%s."
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
 "Під час створення ключа тому було вичерпано буфер ентропії системи.\n"
-"Будь ласка, пересуньте вказівник миші або наберіть якийсь текст у іншому "
-"вікні, щоб зібрати додаткові дані на основі випадкових подій.\n"
+"Будь ласка, пересуньте вказівник миші або наберіть якийсь текст у іншому вікні, щоб зібрати додаткові дані на основі випадкових подій.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Створення ключа (виконано %d%%).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
-msgstr "Критична помилка під час ініціалізації RNG.\n"
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "Працюємо у режимі FIPS."
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "Критична помилка під час ініціалізації генератора псевдовипадкових чисел."
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "Надійшов запит щодо невідомої якості псевдовипадкових чисел."
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "Помилка читання з генератора псевдовипадкових чисел."
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
-msgstr "Ð\9dадÑ\96йÑ\88ов Ð·Ð°Ð¿Ð¸Ñ\82 Ñ\89одо Ð½ÐµÐ²Ñ\96домого RNG Ñ\8fкоÑ\81Ñ\82Ñ\96.\n"
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\96нÑ\96Ñ\86Ñ\96алÑ\96зÑ\83ваÑ\82и Ð´Ð¾Ð¿Ð¾Ð¼Ñ\96жнÑ\83 Ð¿Ñ\80огÑ\80амÑ\83 Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f Ð³ÐµÐ½ÐµÑ\80аÑ\82оÑ\80а Ð¿Ñ\81евдовипадковиÑ\85 Ñ\87иÑ\81ел."
 
-#: lib/random.c:211
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "Не вдалося ініціалізувати допоміжну програму шифрування."
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "Підтримки алгоритму хешування %s не передбачено."
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
 #, c-format
-msgid "Error %d reading from RNG: %s\n"
-msgstr "Помилка %d під час читання з RNG: %s\n"
+msgid "Key processing error (using hash %s)."
+msgstr "Помилка під час обробки ключа (на основі хешу %s)."
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Не вдалося визначити тип пристрою. Несумісна дія з активації пристрою?"
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\96нÑ\96Ñ\86Ñ\96алÑ\96зÑ\83ваÑ\82и Ð´Ð¾Ð¿Ð¾Ð¼Ñ\96жнÑ\83 Ð¿Ñ\80огÑ\80амÑ\83 Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f RNG.\n"
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "Ð\9fÑ\96дÑ\82Ñ\80имкÑ\83 Ñ\86Ñ\96Ñ\94Ñ\97 Ð´Ñ\96Ñ\97 Ð¿ÐµÑ\80едбаÑ\87ено Ð»Ð¸Ñ\88е Ð´Ð»Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97в LUKS."
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\96нÑ\96Ñ\86Ñ\96алÑ\96зÑ\83ваÑ\82и Ð´Ð¾Ð¿Ð¾Ð¼Ñ\96жнÑ\83 Ð¿Ñ\80огÑ\80амÑ\83 Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f.\n"
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "Ð\9fÑ\96дÑ\82Ñ\80имкÑ\83 Ñ\86Ñ\96Ñ\94Ñ\97 Ð´Ñ\96Ñ\97 Ð¿ÐµÑ\80едбаÑ\87ено Ð»Ð¸Ñ\88е Ð´Ð»Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97в LUKS2."
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "Заповнено всі слоти ключів."
+
+#: lib/setup.c:434
 #, c-format
-msgid "Hash algorithm %s not supported.\n"
-msgstr "Ð\9fÑ\96дÑ\82Ñ\80имки Ð°Ð»Ð³Ð¾Ñ\80иÑ\82мÑ\83 Ñ\85еÑ\88Ñ\83ваннÑ\8f %s Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено.\n"
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а %d Ñ\94 Ð½ÐµÐºÐ¾Ñ\80екÑ\82ним, Ð±Ñ\83дÑ\8c Ð»Ð°Ñ\81ка, Ð²Ð¸Ð±ÐµÑ\80Ñ\96Ñ\82Ñ\8c Ñ\87иÑ\81ло Ð²Ñ\96д 0 Ð´Ð¾ %d."
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
+#: lib/setup.c:440
 #, c-format
-msgid "Key processing error (using hash %s).\n"
-msgstr "Ð\9fомилка Ð¿Ñ\96д Ñ\87аÑ\81 Ð¾Ð±Ñ\80обки ÐºÐ»Ñ\8eÑ\87а (на Ð¾Ñ\81новÑ\96 Ñ\85еÑ\88Ñ\83 %s).\n"
+msgid "Key slot %d is full, please select another one."
+msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а %d Ð·Ð°Ð¿Ð¾Ð²Ð½ÐµÐ½Ð¾, Ð±Ñ\83дÑ\8c Ð»Ð°Ñ\81ка, Ð²Ð¸Ð±ÐµÑ\80Ñ\96Ñ\82Ñ\8c Ñ\96нÑ\88ий."
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"Не вдалося визначити тип пристрою. Несумісна дія з активації пристрою?\n"
+#: lib/setup.c:525 lib/setup.c:2824
+msgid "Device size is not aligned to device logical block size."
+msgstr "Розмір пристрою не вирівняно за розміром логічного блоку пристрою."
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "Виявлено заголовок, але об’єм пристрою %s є надто малим."
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
-msgstr "Підтримку цієї дії передбачено лише для пристроїв LUKS.\n"
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "Підтримки цієї дії для цього типу пристроїв не передбачено."
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
-msgstr "Ð\97аповнено Ð²Ñ\81Ñ\96 Ñ\81лоÑ\82и ÐºÐ»Ñ\8eÑ\87Ñ\96в.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr "Ð\92иконÑ\83Ñ\94мо Ð·Ð°Ð±Ð¾Ñ\80оненÑ\83 Ð´Ñ\96Ñ\8e Ñ\96з Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f."
 
-#: lib/setup.c:327
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
 #, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а %d Ñ\94 Ð½ÐµÐºÐ¾Ñ\80екÑ\82ним, Ð±Ñ\83дÑ\8c Ð»Ð°Ñ\81ка, Ð²Ð¸Ð±ÐµÑ\80Ñ\96Ñ\82Ñ\8c Ñ\87иÑ\81ло Ð²Ñ\96д 0 Ð´Ð¾ %d.\n"
+msgid "Unsupported LUKS version %d."
+msgstr "Ð\9dепÑ\96дÑ\82Ñ\80имÑ\83вана Ð²ÐµÑ\80Ñ\81Ñ\96Ñ\8f LUKS, %d."
 
-#: lib/setup.c:333
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "Підтримки пристрою від'єднаних метаданих для цього типу шифрування не передбачено."
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
 #, c-format
-msgid "Key slot %d is full, please select another one.\n"
-msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а %d Ð·Ð°Ð¿Ð¾Ð²Ð½ÐµÐ½Ð¾, Ð±Ñ\83дÑ\8c Ð»Ð°Ñ\81ка, Ð²Ð¸Ð±ÐµÑ\80Ñ\96Ñ\82Ñ\8c Ñ\96нÑ\88ий.\n"
+msgid "Device %s is not active."
+msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s Ñ\94 Ð½ÐµÐ°ÐºÑ\82ивним."
 
-#: lib/setup.c:472
+#: lib/setup.c:1444
 #, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Введіть пароль до %s: "
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "Зник основний пристрій для пристрою для шифрування %s."
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "Некоректні параметри звичайного шифрування."
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "Некоректний розмір ключа."
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "Підтримки UUID для цього типу шифрування не передбачено."
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "Непідтримуваний розмір сектора шифрування."
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+msgid "Device size is not aligned to requested sector size."
+msgstr "Розмір пристрою не вирівняно за вказаним розміром сектора."
 
-#: lib/setup.c:653
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "Форматування LUKS без пристрою неможливе."
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr "Потрібне вам вирівнювання даних є несумісним із відступом у даних."
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr "Увага: відступ у даних виходить за межі поточного доступного пристрою для зберігання даних.\n"
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Не можна витирати заголовок на пристрої %s."
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr "Увага: спроба активувати пристрій завершиться невдало, у dm-crypt не передбачено підтримки для вказаного розміру сектора шифрування.\n"
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "Ключ тому є надто малим для шифрування із розширеннями цілісності."
+
+#: lib/setup.c:1821
+#, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Шифрування  %s-%s (розмір ключа — %zd бітів) є недоступним."
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr "Увага: розмір метаданих LUKS2 змінено до %<PRIu64> байтів.\n"
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr "Увага: розмір області слотів ключів LUKS2 змінено до %<PRIu64> байтів.\n"
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "Об’єм пристрою %s є надто малим."
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "Не можна форматувати пристрій %s, який перебуває у користуванні."
+
+#: lib/setup.c:1896 lib/setup.c:1922
 #, c-format
-msgid "Header detected but device %s is too small.\n"
-msgstr "Ð\92иÑ\8fвлено Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº, Ð°Ð»Ðµ Ð¾Ð±â\80\99Ñ\94м Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s Ñ\94 Ð½Ð°Ð´Ñ\82о Ð¼Ð°Ð»Ð¸Ð¼.\n"
+msgid "Cannot format device %s, permission denied."
+msgstr "Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ñ\84оÑ\80маÑ\82Ñ\83ваÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s, Ð½ÐµÐ´Ð¾Ñ\81Ñ\82аÑ\82нÑ\96 Ð¿Ñ\80ава Ð´Ð¾Ñ\81Ñ\82Ñ\83пÑ\83."
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
-msgstr "Підтримки цієї дії для цього типу пристроїв не передбачено.\n"
+#: lib/setup.c:1908 lib/setup.c:2229
+#, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Не вдалося форматувати цілісність для пристрою %s."
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
+#: lib/setup.c:1926
 #, c-format
-msgid "Device %s is not active.\n"
-msgstr "Пристрій %s є неактивним.\n"
+msgid "Cannot format device %s."
+msgstr "Не вдалося форматувати пристрій %s."
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "Не можна форматувати LOOPAES без пристрою."
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "Форматування VERITY без пристрою неможливе."
 
-#: lib/setup.c:925
+#: lib/setup.c:2000 lib/verity/verity.c:102
 #, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
-msgstr "Ð\97ник Ð¾Ñ\81новний Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й Ð´Ð»Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð´Ð»Ñ\8f Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f %s.\n"
+msgid "Unsupported VERITY hash type %d."
+msgstr "Ð\9dепÑ\96дÑ\82Ñ\80имÑ\83ваний Ñ\82ип Ñ\85еÑ\88Ñ\83ваннÑ\8f VERITY, %d."
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
-msgstr "Ð\9dекоÑ\80екÑ\82нÑ\96 Ð¿Ð°Ñ\80амеÑ\82Ñ\80и Ð·Ð²Ð¸Ñ\87айного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f.\n"
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "Ð\9dепÑ\96дÑ\82Ñ\80имÑ\83ваний Ñ\80озмÑ\96Ñ\80 Ð±Ð»Ð¾ÐºÑ\83 VERITY."
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
-msgstr "Ð\9dекоÑ\80екÑ\82ний Ñ\80озмÑ\96Ñ\80 ÐºÐ»Ñ\8eÑ\87а.\n"
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "Ð\9dепÑ\96дÑ\82Ñ\80имÑ\83ваний Ð²Ñ\96дÑ\81Ñ\82Ñ\83п Ñ\85еÑ\88Ñ\83 VERITY."
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
-msgstr "Ð\9fÑ\96дÑ\82Ñ\80имки UUID Ð´Ð»Ñ\8f Ñ\86Ñ\8cого Ñ\82ипÑ\83 Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено.\n"
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "Ð\9dепÑ\96дÑ\82Ñ\80имÑ\83ваний Ð·Ñ\81Ñ\83в FEC VERITY."
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
-msgstr "Форматування LUKS без пристрою неможливе.\n"
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "Область даних перекривається із областю хешу."
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "Область хешування перекриваються з областю FEC."
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "Область даних перекривається із областю FEC."
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr "Увага: бажаний розмір мітки у %d байтів відрізняється від розміру у результаті %s (%d байтів).\n"
 
-#: lib/setup.c:1089
+#: lib/setup.c:2286
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ñ\84оÑ\80маÑ\82Ñ\83ваÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s, Ñ\8fкий Ð¿ÐµÑ\80ебÑ\83ваÑ\94 Ñ\83 ÐºÐ¾Ñ\80иÑ\81Ñ\82Ñ\83ваннÑ\96.\n"
+msgid "Unknown crypt device type %s requested."
+msgstr "Ð\9dадÑ\96Ñ\81лано Ð·Ð°Ð¿Ð¸Ñ\82 Ñ\89одо Ð½ÐµÐ²Ñ\96домого Ñ\82ипÑ\83 Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f, %s."
 
-#: lib/setup.c:1092
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
-msgstr "Не можна форматувати пристрій %s, недостатні права доступу.\n"
+msgid "Unsupported parameters on device %s."
+msgstr "Непідтримувані параметри на пристрої %s."
 
-#: lib/setup.c:1096
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
 #, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Не можна витирати заголовок на пристрої %s.\n"
+msgid "Mismatching parameters on device %s."
+msgstr "Невідповідність параметрів на пристрої %s."
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
-msgstr "Не можна форматувати LOOPAES без пристрою.\n"
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr "Невідповідність пристроїв шифрування."
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
-msgstr "Форматування VERITY без пристрою неможливе.\n"
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, c-format
+msgid "Failed to reload device %s."
+msgstr "Не вдалося перезавантажити пристрій %s."
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
 #, c-format
-msgid "Unsupported VERITY hash type %d.\n"
-msgstr "Непідтримуваний тип хешування VERITY, %d.\n"
+msgid "Failed to suspend device %s."
+msgstr "Не вдалося приспати пристрій %s."
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
-msgstr "Непідтримуваний розмір блоку VERITY.\n"
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, c-format
+msgid "Failed to resume device %s."
+msgstr "Не вдалося відновити роботу пристрою %s."
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
-msgstr "Непідтримуваний відступ хешу VERITY.\n"
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr "Критична помилка під час перезавантаження пристрої %s (над пристроєм %s)."
 
-#: lib/setup.c:1285
+#: lib/setup.c:2735 lib/setup.c:2737
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
-msgstr "Надіслано запит щодо невідомого типу пристрою шифрування, %s.\n"
+msgid "Failed to switch device %s to dm-error."
+msgstr "Не вдалося перемкнути пристрій %s у режим dm-error."
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "Неможливо змінити розмір петльового пристрою."
 
-#: lib/setup.c:1435
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "Ви справді хочете змінити UUID пристрою?"
 
-#: lib/setup.c:1545
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Файл резервної копії заголовка не містить сумісного із LUKS заголовка."
+
+#: lib/setup.c:3058
 #, c-format
-msgid "Volume %s is not active.\n"
-msgstr "Том %s не є активним.\n"
+msgid "Volume %s is not active."
+msgstr "Том %s не є активним."
 
-#: lib/setup.c:1556
+#: lib/setup.c:3069
 #, c-format
-msgid "Volume %s is already suspended.\n"
-msgstr "Том %s вже приспано.\n"
+msgid "Volume %s is already suspended."
+msgstr "Том %s вже приспано."
 
-#: lib/setup.c:1563
+#: lib/setup.c:3082
 #, c-format
-msgid "Suspend is not supported for device %s.\n"
-msgstr "Підтримки присипляння для пристрою %s не передбачено.\n"
+msgid "Suspend is not supported for device %s."
+msgstr "Підтримки присипляння для пристрою %s не передбачено."
 
-#: lib/setup.c:1565
+#: lib/setup.c:3084
 #, c-format
-msgid "Error during suspending device %s.\n"
-msgstr "Помилка під час спроби приспати пристрій %s.\n"
+msgid "Error during suspending device %s."
+msgstr "Помилка під час спроби приспати пристрій %s."
 
-#: lib/setup.c:1591 lib/setup.c:1638
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
 #, c-format
-msgid "Volume %s is not suspended.\n"
-msgstr "Том %s не приспано.\n"
+msgid "Volume %s is not suspended."
+msgstr "Том %s не приспано."
 
-#: lib/setup.c:1605
+#: lib/setup.c:3146
 #, c-format
-msgid "Resume is not supported for device %s.\n"
-msgstr "Підтримки дії з пробудження для пристрою %s не передбачено.\n"
+msgid "Resume is not supported for device %s."
+msgstr "Підтримки дії з пробудження для пристрою %s не передбачено."
 
-#: lib/setup.c:1607 lib/setup.c:1659
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
 #, c-format
-msgid "Error during resuming device %s.\n"
-msgstr "Помилка під час спроби пробудити пристрій %s.\n"
+msgid "Error during resuming device %s."
+msgstr "Помилка під час спроби пробудити пристрій %s."
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Ð\92ведÑ\96Ñ\82Ñ\8c Ð¿Ð°Ñ\80олÑ\8c"
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "Ð\9aлÑ\8eÑ\87 Ñ\82омÑ\83 Ð½Ðµ Ð²Ñ\96дповÑ\96даÑ\94 Ñ\82омÑ\83."
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Не вдалося додати слот ключа, всі слоти вимкнено і не вказано ключа тому.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Не вдалося додати слот ключа, всі слоти вимкнено і не вказано ключа тому."
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Ð\92ведÑ\96Ñ\82Ñ\8c Ð±Ñ\83дÑ\8c\8fкий Ð¿Ð°Ñ\80олÑ\8c"
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð·Ð°Ñ\80езеÑ\80вÑ\83ваÑ\82и Ð½Ð¾Ð²Ð¸Ð¹ Ñ\81лоÑ\82 ÐºÐ»Ñ\8eÑ\87а."
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Введіть новий пароль для слота ключа: "
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "Слот ключа %d є некоректним."
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, c-format
+msgid "Keyslot %d is not active."
+msgstr "Слот ключа %d не є активним."
+
+#: lib/setup.c:3694
+msgid "Device header overlaps with data area."
+msgstr "Заголовок пристрою перекривається із областю даних."
+
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "Виконуємо повторне шифрування. Не можна активувати пристрій."
 
-#: lib/setup.c:1798
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+msgid "Failed to get reencryption lock."
+msgstr "Не вдалося отримати стан блокування для повторного шифрування."
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Не вдалося виконати відновлення даних повторного шифрування LUKS2."
+
+#: lib/setup.c:4127 lib/setup.c:4379
+msgid "Device type is not properly initialized."
+msgstr "Тип пристрою не ініціалізовано належним чином."
+
+#: lib/setup.c:4171
 #, c-format
-msgid "Key slot %d changed.\n"
-msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а %d Ð·Ð¼Ñ\96нено.\n"
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Ð\9dеможливо Ñ\81коÑ\80иÑ\81Ñ\82аÑ\82иÑ\81Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\94м %s, Ð½ÐµÐºÐ¾Ñ\80екÑ\82на Ð½Ð°Ð·Ð²Ð° Ð°Ð±Ð¾ Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й Ñ\83Ñ\81е Ñ\89е Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82овÑ\83Ñ\94Ñ\82Ñ\8cÑ\81Ñ\8f."
 
-#: lib/setup.c:1801
+#: lib/setup.c:4174
 #, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Замінено слотом ключа %d.\n"
+msgid "Device %s already exists."
+msgstr "Пристрій %s вже існує."
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "Для пристрою зі звичайним шифруванням вказано помилковий ключ тому."
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð·Ð°Ñ\80езеÑ\80вÑ\83ваÑ\82и Ð½Ð¾Ð²Ð¸Ð¹ Ñ\81лоÑ\82 ÐºÐ»Ñ\8eÑ\87а.\n"
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "Ð\94лÑ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð¿ÐµÑ\80евÑ\96Ñ\80ки Ð²ÐºÐ°Ð·Ð°Ð½Ð¾ Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ¾Ð²Ð¸Ð¹ ÐºÐ¾Ñ\80еневий Ñ\85еÑ\88."
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Ключ тому не відповідає тому.\n"
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr "Потрібен хеш-підпис кореневої теки."
+
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "Немає сховища ключів ядра: це сховище потрібне для передавання підпису ядру."
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "Не вдалося завантажити ключ до сховища ключів ядра."
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "Пристрій %s все ще використовується."
 
-#: lib/setup.c:1961
+#: lib/setup.c:4516
 #, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а %d Ñ\94 Ð½ÐµÐºÐ¾Ñ\80екÑ\82ним.\n"
+msgid "Invalid device %s."
+msgstr "Ð\9dекоÑ\80екÑ\82ний Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s."
 
-#: lib/setup.c:1966
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "Буфер ключів тому є занадто малим."
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "Неможливо отримати ключ тому для пристрою зі звичайним шифруванням."
+
+#: lib/setup.c:4657
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Не вдалося отримати кореневий хеш для пристрою VERITY."
+
+#: lib/setup.c:4659
 #, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Слот ключа %d не використовується.\n"
+msgid "This operation is not supported for %s crypt device."
+msgstr "Підтримки цієї дії для шифрованого пристрою %s не передбачено."
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "Підтримки дії зі створення дампу для цього типу пристроїв не передбачено."
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
+#: lib/setup.c:5190
 #, c-format
-msgid "Device %s already exists.\n"
-msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s Ð²Ð¶Ðµ Ñ\96Ñ\81нÑ\83Ñ\94.\n"
+msgid "Data offset is not multiple of %u bytes."
+msgstr "Ð\97Ñ\81Ñ\83в Ñ\83 Ð´Ð°Ð½Ð¸Ñ\85 Ð½Ðµ Ñ\94 ÐºÑ\80аÑ\82ним Ð´Ð¾ %u Ð±Ð°Ð¹Ñ\82Ñ\96в."
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
-msgstr "Для пристрою зі звичайним шифруванням вказано помилковий ключ тому.\n"
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Не можна перетворити пристрій %s, який перебуває у користуванні."
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
-msgstr "Для пристрою перевірки вказано помилковий кореневий хеш.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "Не вдалося прив'язати слот ключа %u як новий ключ тому."
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Тип Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð½Ðµ Ñ\96нÑ\96Ñ\86Ñ\96алÑ\96зовано Ð½Ð°Ð»ÐµÐ¶Ð½Ð¸Ð¼ Ñ\87ином.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\96нÑ\96Ñ\86Ñ\96алÑ\96зÑ\83ваÑ\82и Ñ\82иповÑ\96 Ð¿Ð°Ñ\80амеÑ\82Ñ\80и Ñ\81лоÑ\82Ñ\83 ÐºÐ»Ñ\8eÑ\87Ñ\96в LUKS2."
 
-#: lib/setup.c:2259
+#: lib/setup.c:5851
 #, c-format
-msgid "Device %s is still in use.\n"
-msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s Ð²Ñ\81е Ñ\89е Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82овÑ\83Ñ\94Ñ\82Ñ\8cÑ\81Ñ\8f.\n"
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿Ñ\80ив'Ñ\8fзаÑ\82и Ñ\81лоÑ\82 ÐºÐ»Ñ\8eÑ\87а %d Ð´Ð¾ ÐºÐ¾Ð½Ñ\82Ñ\80олÑ\8cноÑ\97 Ñ\81Ñ\83ми."
 
-#: lib/setup.c:2268
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "У ядрі не передбачено підтримки сховища ключів ядра."
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
 #, c-format
-msgid "Invalid device %s.\n"
-msgstr "Некоректний пристрій %s.\n"
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Не вдалося прочитати пароль із ключа зі сховища ключів (помилка %d)."
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr "Не вдалося створити загальне блокування серіалізації доступу до пам'яті."
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "Не вдалося отримати значення пріоритетності процесу."
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "Не вдалося розблокувати пам’ять."
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "Не вдалося відкрити файл ключа."
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "Не вдалося прочитати файл ключа з термінала."
+
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "Не вдалося отримати статистичні дані щодо файла ключа."
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Не вдалося встановити потрібну позицію у файлі ключа."
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "Під час читання пароля вичерпано пам’ять."
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "Помилка під час читання пароля."
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "ЦÑ\8f Ñ\84Ñ\83нкÑ\86Ñ\96Ñ\8f Ð½ÐµÐ´Ð¾Ñ\81Ñ\82Ñ\83пна Ñ\83 Ñ\80ежимÑ\96 FIPS.\n"
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr "Ð\9dÑ\96Ñ\87ого Ñ\87иÑ\82аÑ\82и Ð· Ð²Ñ\85Ñ\96дниÑ\85 Ð´Ð°Ð½Ð¸Ñ\85."
 
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
-msgstr "Ð\91Ñ\83Ñ\84еÑ\80 ÐºÐ»Ñ\8eÑ\87Ñ\96в Ñ\82омÑ\83 Ñ\94 Ð·Ð°Ð½Ð°Ð´Ñ\82о Ð¼Ð°Ð»Ð¸Ð¼.\n"
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "Ð\9fеÑ\80евиÑ\89ено Ð¼Ð°ÐºÑ\81ималÑ\8cний Ñ\80озмÑ\96Ñ\80 Ñ\84айла ÐºÐ»Ñ\8eÑ\87а."
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
-msgstr "Неможливо отримати ключ тому для пристрою зі звичайним шифруванням.\n"
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "Не вдалося прочитати бажаний об’єм даних."
 
-#: lib/setup.c:2310
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
 #, c-format
-msgid "This operation is not supported for %s crypt device.\n"
-msgstr "Ð\9fÑ\96дÑ\82Ñ\80имки Ñ\86Ñ\96Ñ\94Ñ\97 Ð´Ñ\96Ñ\97 Ð´Ð»Ñ\8f Ñ\88иÑ\84Ñ\80ованого Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено.\n"
+msgid "Device %s does not exist or access denied."
+msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s Ð½Ðµ Ñ\96Ñ\81нÑ\83Ñ\94 Ð°Ð±Ð¾ Ð´Ð¾Ñ\81Ñ\82Ñ\83п Ð´Ð¾ Ñ\86Ñ\8cого Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð·Ð°Ð±Ð¾Ñ\80онено."
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
-msgstr ""
-"Підтримки дії зі створення дампу для цього типу пристроїв не передбачено.\n"
+#: lib/utils_device.c:197
+#, c-format
+msgid "Device %s is not compatible."
+msgstr "Пристрій %s є сумісним."
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Не вдалося отримати значення пріоритетності процесу.\n"
+#: lib/utils_device.c:642
+#, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Обсяг пристрою %s є надто малим. Потрібно принаймні %<PRIu64> байтів."
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Не вдалося розблокувати пам’ять.\n"
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Не можна використовувати пристрій %s, оскільки його вже використано (призначено або змонтовано)."
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Ð\9fÑ\96д Ñ\87аÑ\81 Ñ\87иÑ\82аннÑ\8f Ð¿Ð°Ñ\80олÑ\8f Ð²Ð¸Ñ\87еÑ\80пано Ð¿Ð°Ð¼â\80\99Ñ\8fÑ\82Ñ\8c.\n"
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ñ\81коÑ\80иÑ\81Ñ\82аÑ\82иÑ\81Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\94м %s, Ð½ÐµÐ´Ð¾Ñ\81Ñ\82аÑ\82нÑ\96 Ð¿Ñ\80ава Ð´Ð¾Ñ\81Ñ\82Ñ\83пÑ\83."
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Помилка під час читання пароля з термінала.\n"
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "Не вдалося отримати дані щодо пристрою %s."
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Ð\9fеÑ\80евÑ\96Ñ\80ка Ð¿Ð°Ñ\80олÑ\8f"
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82овÑ\83ваÑ\82и Ð¿ÐµÑ\82лÑ\8cовий Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й, Ð¿Ñ\80огÑ\80амÑ\83 Ð·Ð°Ð¿Ñ\83Ñ\89ено Ð½Ðµ Ð²Ñ\96д Ñ\96менÑ\96 Ð°Ð´Ð¼Ñ\96нÑ\96Ñ\81Ñ\82Ñ\80аÑ\82ивного ÐºÐ¾Ñ\80иÑ\81Ñ\82Ñ\83ваÑ\87а (root)."
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Ð\9fаÑ\80олÑ\96 Ð½Ðµ Ð·Ð±Ñ\96гаÑ\8eÑ\82Ñ\8cÑ\81Ñ\8f.\n"
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "СпÑ\80оба Ð´Ð¾Ð»Ñ\83Ñ\87еннÑ\8f Ð¿ÐµÑ\82лÑ\8cового Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð·Ð°Ð·Ð½Ð°Ð»Ð° Ð½ÐµÐ²Ð´Ð°Ñ\87Ñ\96 (поÑ\82Ñ\80Ñ\96бен Ð¿ÐµÑ\82лÑ\8cовий Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й Ð· Ð²Ñ\81Ñ\82ановленим Ð¿Ñ\80апоÑ\80Ñ\86ем Ð°Ð²Ñ\82омаÑ\82иÑ\87ного Ñ\81поÑ\80ожненнÑ\8f)."
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Не можна використовувати відступ у даних, що надходять з термінала.\n"
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Бажана точка відступу перебуває за межами об’єму пристрою %s."
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
-msgstr "Не вдалося відкрити файл ключа.\n"
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "Об’єм пристрою %s є нульовим."
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¾Ñ\82Ñ\80имаÑ\82и Ñ\81Ñ\82аÑ\82иÑ\81Ñ\82иÑ\87нÑ\96 Ð´Ð°Ð½Ñ\96 Ñ\89одо Ñ\84айла ÐºÐ»Ñ\8eÑ\87а.\n"
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "Ð\92казаний Ñ\87аÑ\81 PBKDF Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð±Ñ\83Ñ\82и Ð½Ñ\83лÑ\8cовим."
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr "Не вдалося встановити потрібну позицію у файлі ключа.\n"
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "Невідомий тип PBKDF, %s."
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
-msgstr "Помилка під час читання пароля.\n"
+#: lib/utils_pbkdf.c:111
+#, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Підтримки бажаного хешування, %s, не передбачено."
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
-msgstr "Перевищено максимальний розмір файла ключа.\n"
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Підтримки бажаного типу PBKDF для LUKS1 не передбачено."
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿Ñ\80оÑ\87иÑ\82аÑ\82и Ð±Ð°Ð¶Ð°Ð½Ð¸Ð¹ Ð¾Ð±â\80\99Ñ\94м Ð´Ð°Ð½Ð¸Ñ\85.\n"
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr "Ð\9cакÑ\81ималÑ\8cний Ð¾Ð±'Ñ\94м Ð¿Ð°Ð¼'Ñ\8fÑ\82Ñ\96 PBKDF Ð°Ð±Ð¾ ÐºÑ\96лÑ\8cкÑ\96Ñ\81Ñ\82Ñ\8c Ð¿Ð°Ñ\80алелÑ\8cниÑ\85 Ð¿Ð¾Ñ\82окÑ\96в Ð¾Ð±Ñ\80обки Ð½Ðµ Ð¼Ð¾Ð¶Ð½Ð° Ð²Ñ\81Ñ\82ановлÑ\8eваÑ\82и Ñ\80азом Ñ\96з pbkdf2."
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Device %s doesn't exist or access denied.\n"
-msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s Ð½Ðµ Ñ\96Ñ\81нÑ\83Ñ\94 Ð°Ð±Ð¾ Ð´Ð¾Ñ\81Ñ\82Ñ\83п Ð´Ð¾ Ñ\86Ñ\8cого Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð·Ð°Ð±Ð¾Ñ\80онено.\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr "Ð\97адане Ð·Ð½Ð°Ñ\87еннÑ\8f ÐºÑ\96лÑ\8cкоÑ\81Ñ\82Ñ\96 Ñ\96Ñ\82еÑ\80аÑ\86Ñ\96й Ð´Ð»Ñ\8f %s Ñ\94 Ð½Ð°Ð´Ñ\82о Ð½Ð¸Ð·Ñ\8cким (мÑ\96нÑ\96малÑ\8cним Ñ\94 %u)."
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
-msgstr ""
-"Не можна використовувати петльовий пристрій, програму запущено не від імені "
-"адміністративного користувача (root).\n"
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr "Задане значення об'єму пам'яті для %s є надто низьким (мінімальним є %u кілобайтів)."
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Не вдалося знайти вільний петльовий пристрій.\n"
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "Бажана максимальна вартість пам'яті PBKDF є надто високою (максимальною є %d кілобайтів)."
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
-msgstr ""
-"Спроба долучення петльового пристрою зазнала невдачі (потрібен петльовий "
-"пристрій з встановленим прапорцем автоматичного спорожнення).\n"
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "Бажаний максимальний обсяг пам'яті PBKDF не може бути нульовим."
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "Вказана кількість паралельних потоків обробки PBKDF не може бути нульовою."
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr "У режимі FIPS передбачено підтримку лише PBKDF2."
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr "Тестування PBKDF вимкнено, але кількість ітерацій не встановлено."
 
-#: lib/utils_device.c:484
+#: lib/utils_benchmark.c:191
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
-msgstr ""
-"Не можна використовувати пристрій %s, оскільки його вже використано "
-"(призначено або змонтовано).\n"
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Несумісні параметри PBKDF2 (з використанням алгоритму хешування %s)."
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "Несумісні параметри PBKDF."
 
-#: lib/utils_device.c:488
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¾Ñ\82Ñ\80имаÑ\82и Ð´Ð°Ð½Ñ\96 Ñ\89одо Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "Ð\91локÑ\83ваннÑ\8f Ð¿ÐµÑ\80еÑ\80вано. Ð¨Ð»Ñ\8fÑ\85 Ð±Ð»Ð¾ÐºÑ\83ваннÑ\8f %s/%s Ñ\94 Ð½ÐµÐ¿Ñ\80идаÑ\82ним Ð´Ð»Ñ\8f ÐºÐ¾Ñ\80иÑ\81Ñ\82Ñ\83ваннÑ\8f (не Ñ\94 ÐºÐ°Ñ\82алогом Ð°Ð±Ð¾ Ð¹Ð¾Ð³Ð¾ Ð½Ðµ Ð²ÐºÐ°Ð·Ð°Ð½Ð¾)."
 
-#: lib/utils_device.c:494
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
-msgstr "Ð\91ажана Ñ\82оÑ\87ка Ð²Ñ\96дÑ\81Ñ\82Ñ\83пÑ\83 Ð¿ÐµÑ\80ебÑ\83ваÑ\94 Ð·Ð° Ð¼ÐµÐ¶Ð°Ð¼Ð¸ Ð¾Ð±â\80\99Ñ\94мÑ\83 Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s.\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "Ð\9fÐ\9eÐ\9fÐ\95РÐ\95Ð\94Ð\96Ð\95Ð\9dÐ\9dЯ: Ð½Ðµ Ð²Ð¸Ñ\81Ñ\82аÑ\87аÑ\94 Ð±Ð»Ð¾ÐºÑ\83ваннÑ\8f ÐºÐ°Ñ\82алогÑ\83 %s/%s!\n"
 
-#: lib/utils_device.c:502
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Ð\9eбâ\80\99Ñ\94м Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s Ñ\94 Ð½Ñ\83лÑ\8cовим.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "Ð\91локÑ\83ваннÑ\8f Ð¿ÐµÑ\80еÑ\80вано Ð¨Ð»Ñ\8fÑ\85 Ð±Ð»Ð¾ÐºÑ\83ваннÑ\8f %s/%s Ñ\94 Ð½ÐµÐ¿Ñ\80идаÑ\82ним Ð´Ð»Ñ\8f ÐºÐ¾Ñ\80иÑ\81Ñ\82Ñ\83ваннÑ\8f (%s Ð½Ðµ Ñ\94 ÐºÐ°Ñ\82алогом)."
 
-#: lib/utils_device.c:513
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "Не вдалося встановити вказану позицію на пристрої."
+
+#: lib/utils_wipe.c:208
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Ð\9eбâ\80\99Ñ\94м Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s Ñ\94 Ð½Ð°Ð´Ñ\82о Ð¼Ð°Ð»Ð¸Ð¼.\n"
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr "Ð\9fомилка Ð²Ð¸Ñ\82иÑ\80аннÑ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e, Ð·Ñ\81Ñ\83в %<PRIu64>."
 
-#: lib/luks1/keyencryption.c:37
+#: lib/luks1/keyencryption.c:39
 #, c-format
 msgid ""
 "Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 "Не вдалося визначити призначення ключа dm-crypt для пристрою %s.\n"
-"Перевірте, чи передбачено у ядрі підтримку шифрування %s (докладніші дані "
-"можна знайти у журналі системи (syslog)).\n"
+"Перевірте, чи передбачено у ядрі підтримку шифрування %s (докладніші дані можна знайти у журналі системи (syslog))."
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "Розмір ключа у режимі XTS має бути рівним 256 або 512 бітів."
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
-msgstr "РозмÑ\96Ñ\80 ÐºÐ»Ñ\8eÑ\87а Ñ\83 Ñ\80ежимÑ\96 XTS Ð¼Ð°Ñ\94 Ð±Ñ\83Ñ\82и Ñ\80Ñ\96вним 256 Ð°Ð±Ð¾ 512 Ð±Ñ\96Ñ\82Ñ\96в.\n"
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr "СпеÑ\86иÑ\84Ñ\96каÑ\86Ñ\96Ñ\8e Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f Ñ\81лÑ\96д Ð²ÐºÐ°Ð·Ñ\83ваÑ\82и Ñ\82ак: [алгоÑ\80иÑ\82м]-[Ñ\80ежим]-[iv]."
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
 #, c-format
-msgid "Cannot write to device %s, permission denied.\n"
-msgstr "Не вдалося виконати запис на пристрій %s, недостатні права доступу.\n"
+msgid "Cannot write to device %s, permission denied."
+msgstr "Не вдалося виконати запис на пристрій %s, недостатні права доступу."
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
-msgstr "Не вдалося відкрити пристрій тимчасового сховища ключів.\n"
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "Не вдалося відкрити пристрій тимчасового сховища ключів."
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
-msgstr "Не вдалося отримати доступ до пристрою тимчасового сховища ключів.\n"
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "Не вдалося отримати доступ до пристрою тимчасового сховища ключів."
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
-msgstr "Помилка введення-виведення під час шифрування слоту ключів.\n"
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "Помилка введення-виведення під час шифрування слоту ключів."
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
-msgstr "Помилка введення-виведення під час розшифрування слоту ключів.\n"
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "Не вдалося відкрити пристрій %s."
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "Помилка введення-виведення під час розшифрування слоту ключів."
 
-#: lib/luks1/keymanage.c:90
+#: lib/luks1/keymanage.c:110
 #, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
-msgstr ""
-"Обсяг пристрою %s є надто малим. (LUKS потрібно принаймні %<PRIu64> "
-"байтів.)\n"
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "Обсяг пристрою %s є надто малим. (LUKS1 потрібно принаймні %<PRIu64> байтів.)"
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "Слот ключа LUKS %u є некоректним."
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
 #, c-format
-msgid "Device %s is not a valid LUKS device.\n"
-msgstr "Пристрій %s не є коректним пристроєм LUKS.\n"
+msgid "Device %s is not a valid LUKS device."
+msgstr "Пристрій %s не є коректним пристроєм LUKS."
 
-#: lib/luks1/keymanage.c:198
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
 #, c-format
-msgid "Requested header backup file %s already exists.\n"
-msgstr "Потрібний вам файл резервної копії заголовка, %s, вже існує.\n"
+msgid "Requested header backup file %s already exists."
+msgstr "Потрібний вам файл резервної копії заголовка, %s, вже існує."
 
-#: lib/luks1/keymanage.c:200
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
 #, c-format
-msgid "Cannot create header backup file %s.\n"
-msgstr "Не вдалося створити файл резервної копії заголовка, %s.\n"
+msgid "Cannot create header backup file %s."
+msgstr "Не вдалося створити файл резервної копії заголовка, %s."
 
-#: lib/luks1/keymanage.c:205
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
 #, c-format
-msgid "Cannot write header backup file %s.\n"
-msgstr "Не вдалося записати файл резервної копії заголовка, %s.\n"
+msgid "Cannot write header backup file %s."
+msgstr "Не вдалося записати файл резервної копії заголовка, %s."
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
-msgstr "Файл резервної копії не містить коректного заголовка LUKS.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+msgid "Backup file does not contain valid LUKS header."
+msgstr "Файл резервної копії не містить коректного заголовка LUKS."
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
 #, c-format
-msgid "Cannot open header backup file %s.\n"
-msgstr "Не вдалося відкрити файл резервної копії заголовка, %s.\n"
+msgid "Cannot open header backup file %s."
+msgstr "Не вдалося відкрити файл резервної копії заголовка, %s."
 
-#: lib/luks1/keymanage.c:258
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
 #, c-format
-msgid "Cannot read header backup file %s.\n"
-msgstr "Не вдалося прочитати дані з файла резервної копії заголовка, %s.\n"
+msgid "Cannot read header backup file %s."
+msgstr "Не вдалося прочитати дані з файла резервної копії заголовка, %s."
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Відступ у даних або розмір ключа на пристрої і у резервній копії є різними. "
-"Відновлення неможливе.\n"
+#: lib/luks1/keymanage.c:317
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Відступ у даних або розмір ключа на пристрої і у резервній копії є різними. Відновлення неможливе."
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Пристрій %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"не містить заголовка LUKS. Заміна заголовка може зруйнувати дані, що "
-"зберігаються на пристрої."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "не містить заголовка LUKS. Заміна заголовка може зруйнувати дані, що зберігаються на пристрої."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"вже містить заголовок LUKS. Заміна заголовка призведе до руйнування вже "
-"створених слотів ключів."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "вже містить заголовок LUKS. Заміна заголовка призведе до руйнування вже створених слотів ключів."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
 msgstr ""
 "\n"
-"ПОПЕРЕДЖЕННЯ: заголовок, що зберігається на пристрої, має інший UUID, ніж "
-"заголовок у резервній копії!"
-
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Не вдалося відкрити пристрій %s.\n"
+"ПОПЕРЕДЖЕННЯ: заголовок, що зберігається на пристрої, має інший UUID, ніж заголовок у резервній копії!"
 
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
-msgstr "Нестандартний розмір ключа, слід виправити дані вручну.\n"
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "Нестандартний розмір ключа, слід виправити дані вручну."
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr "Нестандартне вирівнювання слотів ключів, слід виправити дані вручну.\n"
-
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
-msgstr "Виправлення слотів ключів.\n"
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Нестандартне вирівнювання слотів ключів, слід виправити дані вручну."
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "СпÑ\80оба Ð²Ð¸Ð¿Ñ\80авленнÑ\8f Ð·Ð°Ð·Ð½Ð°Ð»Ð° Ð½ÐµÐ²Ð´Ð°Ñ\87Ñ\96."
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "Ð\92ипÑ\80авленнÑ\8f Ñ\81лоÑ\82Ñ\96в ÐºÐ»Ñ\8eÑ\87Ñ\96в."
 
-#: lib/luks1/keymanage.c:363
+#: lib/luks1/keymanage.c:409
 #, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
-msgstr "Слот ключа %i: виправлено відступ (%u -> %u).\n"
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "Слот ключа %i: виправлено відступ (%u -> %u)."
 
-#: lib/luks1/keymanage.c:371
+#: lib/luks1/keymanage.c:417
 #, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
-msgstr "Слот ключа %i: виправлено смужки (%u -> %u).\n"
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "Слот ключа %i: виправлено смужки (%u -> %u)."
 
-#: lib/luks1/keymanage.c:380
+#: lib/luks1/keymanage.c:426
 #, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
-msgstr "Слот ключа %i: зайвий підпис розділу.\n"
+msgid "Keyslot %i: bogus partition signature."
+msgstr "Слот ключа %i: зайвий підпис розділу."
 
-#: lib/luks1/keymanage.c:385
+#: lib/luks1/keymanage.c:431
 #, c-format
-msgid "Keyslot %i: salt wiped.\n"
-msgstr "Слот ключа %i: дані ініціалізації (сіль) витерто.\n"
-
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
-msgstr "Запис заголовка LUKS на диск.\n"
+msgid "Keyslot %i: salt wiped."
+msgstr "Слот ключа %i: дані ініціалізації (сіль) витерто."
 
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Непідтримувана версія LUKS, %d.\n"
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "Запис заголовка LUKS на диск."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
-msgstr "Підтримки бажаного хешування LUKS, %s, не передбачено.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Спроба виправлення зазнала невдачі."
 
-#: lib/luks1/keymanage.c:442
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
 #, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а LUKS %u Ñ\94 Ð½ÐµÐºÐ¾Ñ\80екÑ\82ним.\n"
+msgid "Requested LUKS hash %s is not supported."
+msgstr "Ð\9fÑ\96дÑ\82Ñ\80имки Ð±Ð°Ð¶Ð°Ð½Ð¾Ð³Ð¾ Ñ\85еÑ\88Ñ\83ваннÑ\8f LUKS, %s, Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено."
 
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
-msgstr "У заголовку LUKS не виявлено жодних проблем.\n"
-
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
-msgstr "Помилка під час оновлення заголовка LUKS на пристрої %s.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "У заголовку LUKS не виявлено жодних проблем."
 
-#: lib/luks1/keymanage.c:603
+#: lib/luks1/keymanage.c:660
 #, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Помилка під час спроби повторного читання заголовка LUKS після оновлення на "
-"пристрої %s.\n"
+msgid "Error during update of LUKS header on device %s."
+msgstr "Помилка під час оновлення заголовка LUKS на пристрої %s."
 
-#: lib/luks1/keymanage.c:654
+#: lib/luks1/keymanage.c:668
 #, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"Відступ даних для від’єднаного заголовка LUKS має бути або рівним нулеві, "
-"або перевищувати розмір заголовка (%d секторів).\n"
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Помилка під час спроби повторного читання заголовка LUKS після оновлення на пристрої %s."
 
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Вказано UUID LUKS у помилковому форматі.\n"
+#: lib/luks1/keymanage.c:744
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Відступ даних для заголовка LUKS має бути або рівним нулеві, або перевищувати розмір заголовка."
 
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
-msgstr ""
-"Не вдалося створити заголовок LUKS: помилка читання випадкових даних для "
-"ініціалізації.\n"
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "Вказано UUID LUKS у помилковому форматі."
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr "Несумісні параметри PBKDF2 (з використанням алгоритму хешування %s).\n"
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "Не вдалося створити заголовок LUKS: помилка читання випадкових даних для ініціалізації."
 
-#: lib/luks1/keymanage.c:717
+#: lib/luks1/keymanage.c:804
 #, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Не вдалося створити заголовок LUKS: помилка під час обчислення контрольної "
-"суми заголовка (з використанням хешу %s).\n"
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Не вдалося створити заголовок LUKS: помилка під час обчислення контрольної суми заголовка (з використанням хешу %s)."
 
-#: lib/luks1/keymanage.c:782
+#: lib/luks1/keymanage.c:848
 #, c-format
-msgid "Key slot %d active, purge first.\n"
-msgstr "Слот ключа %d є активним. Його слід спочатку спорожнити.\n"
+msgid "Key slot %d active, purge first."
+msgstr "Слот ключа %d є активним. Його слід спочатку спорожнити."
 
-#: lib/luks1/keymanage.c:788
+#: lib/luks1/keymanage.c:854
 #, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Ентропія даних слота ключа %d є надто низькою. Маніпуляції з заголовком?\n"
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Ентропія даних слота ключа %d є надто низькою. Маніпуляції з заголовком?"
 
-#: lib/luks1/keymanage.c:950
+#: lib/luks1/keymanage.c:990
 #, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Слот ключа %d розблоковано.\n"
-
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Для цього пароля немає відповідного ключа.\n"
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Не вдалося відкрити слот ключа (за допомогою хешу %s)."
 
-#: lib/luks1/keymanage.c:1003
+#: lib/luks1/keymanage.c:1066
 #, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
-msgstr ""
-"Слот ключа %d є некоректним, будь ласка, виберіть слот ключа з номером від 0 "
-"до %d.\n"
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "Слот ключа %d є некоректним, будь ласка, виберіть слот ключа з номером від 0 до %d."
 
-#: lib/luks1/keymanage.c:1021
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
 #, c-format
-msgid "Cannot wipe device %s.\n"
-msgstr "Не вдалося витерти пристрій %s.\n"
+msgid "Cannot wipe device %s."
+msgstr "Не вдалося витерти пристрій %s."
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
-msgstr ""
-"Виявлено файл ключа, підтримки шифрування GPG у якому ще не передбачено.\n"
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "Виявлено файл ключа, підтримки шифрування GPG у якому ще не передбачено."
 
 #: lib/loopaes/loopaes.c:147
 msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
-msgstr ""
-"Будь ласка, скористайтеся командою gpg --decrypt <ФАЙЛ_КЛЮЧА> | cryptsetup --"
-"keyfile=- ...\n"
+msgstr "Будь ласка, скористайтеся командою gpg --decrypt <ФАЙЛ_КЛЮЧА> | cryptsetup --keyfile=- ...\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
-msgstr "Виявлено несумісний з loop-AES файл ключа.\n"
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "Виявлено несумісний з loop-AES файл ключа."
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
-msgstr "У ядрі не передбачено підтримки призначення, сумісного з loop-AES.\n"
+#: lib/loopaes/loopaes.c:245
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "У ядрі не передбачено підтримки призначення, сумісного з loop-AES."
 
-#: lib/tcrypt/tcrypt.c:475
+#: lib/tcrypt/tcrypt.c:504
 #, c-format
-msgid "Error reading keyfile %s.\n"
-msgstr "Помилка під час спроби читання файла ключа %s.\n"
+msgid "Error reading keyfile %s."
+msgstr "Помилка під час спроби читання файла ключа %s."
 
-#: lib/tcrypt/tcrypt.c:513
+#: lib/tcrypt/tcrypt.c:554
 #, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
-msgstr "Перевищено максимальну можливу довжину пароля TCRYPT (%d).\n"
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "Перевищено максимальну можливу довжину пароля TCRYPT (%zu)."
 
-#: lib/tcrypt/tcrypt.c:543
+#: lib/tcrypt/tcrypt.c:595
 #, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
-msgstr ""
-"Засіб створення хешів PBKDF2 за алгоритмом %s недоступний, пропускаємо.\n"
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "Засіб створення хешів PBKDF2 за алгоритмом %s недоступний, пропускаємо."
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
-msgstr "Потрібний для роботи інтерфейс ядра для шифрування недоступний.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "Потрібний для роботи інтерфейс ядра для шифрування недоступний."
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
-msgstr "Переконайтеся, що завантажено модуль ядра algif_skcipher.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "Переконайтеся, що завантажено модуль ядра algif_skcipher."
 
-#: lib/tcrypt/tcrypt.c:707
+#: lib/tcrypt/tcrypt.c:753
 #, c-format
-msgid "Activation is not supported for %d sector size.\n"
-msgstr "Підтримки активації для розміру сектора %d не передбачено.\n"
+msgid "Activation is not supported for %d sector size."
+msgstr "Підтримки активації для розміру сектора %d не передбачено."
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
-msgstr ""
-"У ядрі не передбачено підтримки вмикання цього застарілого режиму TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:759
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "У ядрі не передбачено підтримки вмикання цього застарілого режиму TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:744
+#: lib/tcrypt/tcrypt.c:793
 #, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
-msgstr "Активуємо шифрування системи за допомогою TCRYPT для розділу %s.\n"
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "Активуємо шифрування системи за допомогою TCRYPT для розділу %s."
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
-msgstr "У ядрі не передбачено підтримки призначення, сумісного з TCRYPT.\n"
+#: lib/tcrypt/tcrypt.c:871
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "У ядрі не передбачено підтримки призначення, сумісного з TCRYPT."
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Підтримки цієї дії без завантаження заголовка TCRYPT."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr "Під час обробки підтримуваного основного ключа тому виявлено неочікуваний тип запису метаданих «%u»."
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr "Під час обробки основного ключа тому виявлено некоректний рядок."
+
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Ð\9dа Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 VERITY %s Ð½Ðµ Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82овÑ\83Ñ\94Ñ\82Ñ\8cÑ\81Ñ\8f Ð²Ð±Ñ\83дований Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr "Ð\9fÑ\96д Ñ\87аÑ\81 Ð¾Ð±Ñ\80обки Ð¿Ñ\96дÑ\82Ñ\80имÑ\83ваного Ð¾Ñ\81новного ÐºÐ»Ñ\8eÑ\87а Ñ\82омÑ\83 Ð²Ð¸Ñ\8fвлено Ð½ÐµÐ¾Ñ\87Ñ\96кÑ\83ваний Ñ\80Ñ\8fдок («%s»)."
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:399
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s Ð½Ðµ Ñ\94 ÐºÐ¾Ñ\80екÑ\82ним Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\94м VERITY.\n"
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr "Ð\9fÑ\96д Ñ\87аÑ\81 Ð¾Ð±Ñ\80обки Ð¿Ñ\96дÑ\82Ñ\80имÑ\83ваного Ð¾Ñ\81новного ÐºÐ»Ñ\8eÑ\87а Ñ\82омÑ\83 Ð²Ð¸Ñ\8fвлено Ð½ÐµÐ¾Ñ\87Ñ\96кÑ\83ване Ð·Ð½Ð°Ñ\87еннÑ\8f Ð·Ð°Ð¿Ð¸Ñ\81Ñ\83 Ð¼ÐµÑ\82аданиÑ\85 Â«%u»."
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:479
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
-msgstr "Непідтримувана версія VERITY, %d.\n"
+msgid "Failed to read BITLK signature from %s."
+msgstr "Не вдалося прочитати підпис BITLK з %s."
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
-msgstr "Пошкоджено заголовок VERITY.\n"
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr "Підтримки BITLK версії 1 у поточній версії не передбачено."
 
-#: lib/verity/verity.c:166
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr "Некоректний або невідомий підпис завантаження для пристрою BITLK."
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr "Некоректний або невідомий підпис для пристрою BITLK."
+
+#: lib/bitlk/bitlk.c:510
 #, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
-msgstr "Ð\9dа Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 %s Ð²ÐºÐ°Ð·Ð°Ð½Ð¾ UUID VERITY Ñ\83 Ð¿Ð¾Ð¼Ð¸Ð»ÐºÐ¾Ð²Ð¾Ð¼Ñ\83 Ñ\84оÑ\80маÑ\82Ñ\96.\n"
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Ð\9dепÑ\96дÑ\82Ñ\80имÑ\83ваний Ñ\80озмÑ\96Ñ\80 Ñ\81екÑ\82оÑ\80а %<PRIu16>."
 
-#: lib/verity/verity.c:196
+#: lib/bitlk/bitlk.c:518
 #, c-format
-msgid "Error during update of verity header on device %s.\n"
-msgstr "Ð\9fомилка Ð¿Ñ\96д Ñ\87аÑ\81 Ð¾Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ\8f Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ° verity Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 %s.\n"
+msgid "Failed to read BITLK header from %s."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿Ñ\80оÑ\87иÑ\82аÑ\82и Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº BITLK Ð· %s."
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
-msgstr "У ядрі не передбачено підтримки призначення за dm-verity.\n"
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "Не вдалося прочитати метадані FVE BITLK з %s."
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
-msgstr "Ð\92иÑ\8fвлено Ð¿Ð¾Ñ\88кодженнÑ\8f Ð´Ð°Ð½Ð¸Ñ\85 Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 Ð¿ÐµÑ\80евÑ\96Ñ\80ки Ð¿Ñ\96Ñ\81лÑ\8f Ð°ÐºÑ\82иваÑ\86Ñ\96Ñ\97.\n"
+#: lib/bitlk/bitlk.c:594
+msgid "Unknown or unsupported encryption type."
+msgstr "Ð\9dевÑ\96домий Ð°Ð±Ð¾ Ð½ÐµÐ¿Ñ\96дÑ\82Ñ\80имÑ\83ваний Ñ\82ип Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f."
 
-#: lib/verity/verity_hash.c:59
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
-msgstr "РезеÑ\80внÑ\83 Ð¾Ð±Ð»Ð°Ñ\81Ñ\82Ñ\8c Ð½Ðµ Ð·Ð°Ð½Ñ\83лено Ñ\83 Ð¿Ð¾Ð·Ð¸Ñ\86Ñ\96Ñ\97 %<PRIu64>.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿Ñ\80оÑ\87иÑ\82аÑ\82и Ð·Ð°Ð¿Ð¸Ñ\81и Ð¼ÐµÑ\82аданиÑ\85 BITLK Ð· %s."
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
-msgstr "Переповнення відступу на пристрої.\n"
+#: lib/bitlk/bitlk.c:921
+msgid "This operation is not supported."
+msgstr "Підтримки цієї дії не передбачено."
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
-msgstr "Помилка під час перевірки за позицією %<PRIu64>.\n"
+#: lib/bitlk/bitlk.c:929
+msgid "Wrong key size."
+msgstr "Помилковий розмір ключа."
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
-msgstr "Ð\9dекоÑ\80екÑ\82нÑ\96 Ð¿Ð°Ñ\80амеÑ\82Ñ\80и Ñ\80озмÑ\96Ñ\80Ñ\83 Ð´Ð»Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð¿ÐµÑ\80евÑ\96Ñ\80ки.\n"
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr "Цей Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й BITLK Ð¿ÐµÑ\80ебÑ\83ваÑ\94 Ñ\83 Ð½ÐµÐ¿Ñ\96дÑ\82Ñ\80имÑ\83ваномÑ\83 Ñ\81Ñ\82анÑ\96 â\80\94 Ð¹Ð¾Ð³Ð¾ Ð½ÐµÐ¼Ð¾Ð¶Ð»Ð¸Ð²Ð¾ Ð°ÐºÑ\82ивÑ\83ваÑ\82и."
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Занадто високий рівень вкладеності для тому перевірки.\n"
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr "Пристрої BITLK типу «%s» неможливо активувати."
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿ÐµÑ\80евÑ\96Ñ\80иÑ\82и Ð¾Ð±Ð»Ð°Ñ\81Ñ\82Ñ\8c Ð´Ð°Ð½Ð¸Ñ\85.\n"
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "Ð\90кÑ\82иваÑ\86Ñ\96Ñ\97 Ñ\87аÑ\81Ñ\82ково Ñ\80озÑ\88иÑ\84Ñ\80ованого Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e BITLK Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено."
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿ÐµÑ\80евÑ\96Ñ\80иÑ\82и ÐºÐ¾Ñ\80еневий Ñ\85еÑ\88.\n"
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð°ÐºÑ\82ивÑ\83ваÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й â\80\94 Ñ\83 dm-crypt Ñ\8fдÑ\80а Ð½ÐµÐ¼Ð°Ñ\94 Ð¿Ñ\96дÑ\82Ñ\80имки BITLK IV."
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
-msgstr ""
-"Під час створення області хешу сталася помилка введення або виведення "
-"даних.\n"
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr "Не вдалося активувати пристрій — у dm-crypt ядра немає підтримки дифузера Elephant BITLK."
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
-msgstr "Не вдалося створити область хешу.\n"
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "На пристрої VERITY %s не використовується вбудований заголовок."
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity.c:90
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
-msgstr ""
-"Попередження: ядро не зможе задіяти пристрій, якщо розмір блоку "
-"перевищуватиме розмір сторінки (%u).\n"
+msgid "Device %s is not a valid VERITY device."
+msgstr "Пристрій %s не є коректним пристроєм VERITY."
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr ""
-"Перевірку паролів не можна виконувати на основі вхідних даних, які надходять "
-"не з tty.\n"
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "Непідтримувана версія VERITY, %d."
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Не виявлено жодного відомого зразка специфікації шифрування.\n"
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "Пошкоджено заголовок VERITY."
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
-msgstr ""
-"Попередження: параметр --hash у простому режимі із вказаним файлом ключа "
-"ігнорується.\n"
+#: lib/verity/verity.c:165
+#, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "На пристрої %s вказано UUID VERITY у помилковому форматі."
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
-msgstr ""
-"Попередження: параметр --keyfile-size проігноровано, розмір прочитаних даних "
-"збігається із розміром ключа шифрування.\n"
+#: lib/verity/verity.c:198
+#, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "Помилка під час оновлення заголовка verity на пристрої %s."
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "СлÑ\96д Ð²ÐºÐ°Ð·Ð°Ñ\82и Ð¿Ð°Ñ\80амеÑ\82Ñ\80 --key-file.\n"
+#: lib/verity/verity.c:256
+msgid "Root hash signature verification is not supported."
+msgstr "Ð\9fÑ\96дÑ\82Ñ\80имки Ð¿ÐµÑ\80евÑ\96Ñ\80ки Ð¿Ñ\96дпиÑ\81Ñ\83 ÐºÐ¾Ñ\80еневого Ñ\85еÑ\88Ñ\83 Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено."
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Ð\94лÑ\8f Ñ\86Ñ\8cого Ð¿Ð°Ñ\80олÑ\8f Ð½Ðµ Ð²Ð¸Ñ\8fвлено Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e.\n"
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr "Ð\9fомилки Ð½Ðµ Ð¼Ð¾Ð¶Ðµ Ð±Ñ\83Ñ\82и Ð²Ð¸Ð¿Ñ\80авлено Ð·Ð° Ð´Ð¾Ð¿Ð¾Ð¼Ð¾Ð³Ð¾Ñ\8e Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e FEC."
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
-msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
-msgstr ""
-"Дамп заголовка з ключем тому є конфіденційними даними,\n"
-"за допомогою яких можна отримати доступ до шифрованого розділу\n"
-"без пароля. Цей дамп слід зберігати у зашифрованому форматі\n"
-"у безпечному місці."
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr "За допомогою пристрою FEC виявлено %u придатних до виправлення помилок."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "РезÑ\83лÑ\8cÑ\82аÑ\82 Ñ\82еÑ\81Ñ\82Ñ\83ваннÑ\8f Ñ\94 Ð½ÐµÐ½Ð°Ð´Ñ\96йним.\n"
+#: lib/verity/verity.c:308
+msgid "Kernel does not support dm-verity mapping."
+msgstr "У Ñ\8fдÑ\80Ñ\96 Ð½Ðµ Ð¿ÐµÑ\80едбаÑ\87ено Ð¿Ñ\96дÑ\82Ñ\80имки Ð¿Ñ\80ив'Ñ\8fзки dm-verity."
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
-msgstr ""
-"# Наближені значення під час перевірки визначаються лише за допомогою "
-"оперативної пам’яті (без запису на диск).\n"
+#: lib/verity/verity.c:312
+msgid "Kernel does not support dm-verity signature option."
+msgstr "У ядрі не передбачено підтримки параметра підпису dm-verity."
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "№   Алгоритм | Ключ | Шифрування | Розшифрування\n"
+#: lib/verity/verity.c:323
+msgid "Verity device detected corruption after activation."
+msgstr "Виявлено пошкодження даних на пристрої перевірки після активації."
 
-#: src/cryptsetup.c:587
+#: lib/verity/verity_hash.c:59
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "ШиÑ\84Ñ\80Ñ\83ваннÑ\8f %s Ñ\94 Ð½ÐµÐ´Ð¾Ñ\81Ñ\82Ñ\83пним.\n"
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "РезеÑ\80внÑ\83 Ð¾Ð±Ð»Ð°Ñ\81Ñ\82Ñ\8c Ð½Ðµ Ð·Ð°Ð½Ñ\83лено Ñ\83 Ð¿Ð¾Ð·Ð¸Ñ\86Ñ\96Ñ\97 %<PRIu64>."
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "н/д"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "Переповнення відступу на пристрої."
 
-#: src/cryptsetup.c:639
+#: lib/verity/verity_hash.c:203
 #, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Не вдалося прочитати файл ключа %s.\n"
+msgid "Verification failed at position %<PRIu64>."
+msgstr "Помилка під час перевірки за позицією %<PRIu64>."
+
+#: lib/verity/verity_hash.c:276
+msgid "Invalid size parameters for verity device."
+msgstr "Некоректні параметри розміру для пристрою перевірки."
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "Переповнення області хешу."
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "Не вдалося перевірити область даних."
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "Не вдалося перевірити кореневий хеш."
+
+#: lib/verity/verity_hash.c:384
+msgid "Input/output error while creating hash area."
+msgstr "Під час створення області хешу сталася помилка введення або виведення даних."
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "Не вдалося створити область хешу."
 
-#: src/cryptsetup.c:643
+#: lib/verity/verity_hash.c:433
 #, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿Ñ\80оÑ\87иÑ\82аÑ\82и %d Ð±Ð°Ð¹Ñ\82Ñ\96в Ð· Ñ\84айла ÐºÐ»Ñ\8eÑ\87а %s.\n"
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "Ð\9fопеÑ\80едженнÑ\8f: Ñ\8fдÑ\80о Ð½Ðµ Ð·Ð¼Ð¾Ð¶Ðµ Ð·Ð°Ð´Ñ\96Ñ\8fÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й, Ñ\8fкÑ\89о Ñ\80озмÑ\96Ñ\80 Ð±Ð»Ð¾ÐºÑ\83 Ð¿ÐµÑ\80евиÑ\89Ñ\83ваÑ\82име Ñ\80озмÑ\96Ñ\80 Ñ\81Ñ\82оÑ\80Ñ\96нки (%u)."
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "СпÑ\80обÑ\83ваÑ\82и Ð²Ñ\96дновиÑ\82и Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e LUKS?"
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ñ\80озмÑ\96Ñ\81Ñ\82иÑ\82и ÐºÐ¾Ð½Ñ\82екÑ\81Ñ\82 RS."
 
-#: src/cryptsetup.c:697
+#: lib/verity/verity_fec.c:146
+msgid "Failed to allocate buffer."
+msgstr "Не вдалося розмістити у пам'яті буфер."
+
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid "This will overwrite data on %s irrevocably."
-msgstr "Ð\94анÑ\96 Ð½Ð° %s Ð±Ñ\83де Ð¿ÐµÑ\80езапиÑ\81ано Ð±ÐµÐ· Ð¼Ð¾Ð¶Ð»Ð¸Ð²Ð¾Ñ\81Ñ\82Ñ\96 Ð²Ñ\96дновленнÑ\8f."
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿Ñ\80оÑ\87иÑ\82аÑ\82и Ð±Ð»Ð¾Ðº RS %<PRIu64>, Ð±Ð°Ð¹Ñ\82 %d."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "помилка під час отримання області пам’яті у action_luksFormat"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "Не вдалося прочитати парність для блоку RS %<PRIu64>."
 
-#: src/cryptsetup.c:717
+#: lib/verity/verity_fec.c:177
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82овÑ\83ваÑ\82и %s Ñ\8fк Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº Ð½Ð° Ð´Ð¸Ñ\81кÑ\83.\n"
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð²Ñ\96дновиÑ\82и Ð¿Ð°Ñ\80нÑ\96Ñ\81Ñ\82Ñ\8c Ð´Ð»Ñ\8f Ð±Ð»Ð¾ÐºÑ\83 %<PRIu64>."
 
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
-msgstr ""
-"Зменшений відступ даних можна використовувати лише для від’єднаних "
-"заголовків LUKS.\n"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "Не вдалося прочитати парність для блоку RS %<PRIu64>."
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr "Розміри блоків для FEC мають бути однаковими."
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr "Некоректна кількість байтів парності."
+
+#: lib/verity/verity_fec.c:265
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Слот ключа %d позначено для вилучення.\n"
+msgid "Failed to determine size for device %s."
+msgstr "Не вдалося визначити розмір для пристрою %s."
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "У ядрі не передбачено підтримки прив'язки dm-integrity."
+
+#: lib/integrity/integrity.c:277
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "У ядрі не передбачено підтримки вирівнювання фіксованих метаданих dm-integrity."
 
-#: src/cryptsetup.c:884
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
 #, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Ð\9aлÑ\8eÑ\87 %d Ð½Ðµ Ñ\94 Ð°ÐºÑ\82ивним. Ð\99ого Ð½Ðµ Ð¼Ð¾Ð¶Ð½Ð° Ð²Ð¸Ñ\82еÑ\80Ñ\82и.\n"
+msgid "Failed to acquire write lock on device %s."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¾Ñ\82Ñ\80имаÑ\82и Ð±Ð»Ð¾ÐºÑ\83ваннÑ\8f Ð·Ð°Ð¿Ð¸Ñ\81Ñ\83 Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 %s."
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr "Виявлено спробу конкурентного оновлення метаданих LUKS2. Перериваємо виконання дії."
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
 msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
-"Це останній слот ключа. Пристрій стане непридатним для використання після "
-"спорожнення цього ключа."
-
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Введіть будь-який інший пароль: "
+"Пристрій містить неоднозначні підписи. Автоматичне відновлення LUKS2 неможливе.\n"
+"Будь ласка, запустіть «cryptsetup repair» для відновлення."
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Ð\92ведÑ\96Ñ\82Ñ\8c Ð¿Ð°Ñ\80олÑ\8c, Ñ\8fкий Ñ\81лÑ\96д Ð²Ð¸Ð»Ñ\83Ñ\87иÑ\82и: "
+#: lib/luks2/luks2_json_format.c:227
+msgid "Requested data offset is too small."
+msgstr "Ð\92казаний Ð²Ñ\96дÑ\81Ñ\82Ñ\83п Ñ\83 Ð´Ð°Ð½Ð¸Ñ\85 Ñ\94 Ð½Ð°Ð´Ñ\82о Ð¼Ð°Ð»Ð¸Ð¼."
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_format.c:271
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Ð\92ведÑ\96Ñ\82Ñ\8c Ð±Ñ\83дÑ\8c\8fкий Ð¿Ð°Ñ\80олÑ\8c"
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr "Увага: Ð¾Ð±Ð»Ð°Ñ\81Ñ\82Ñ\8c Ñ\81лоÑ\82Ñ\83 ÐºÐ»Ñ\8eÑ\87Ñ\96в Ñ\94 Ð½Ð°Ð´Ñ\82о Ð¼Ð°Ð»Ð¾Ñ\8e (%<PRIu64> Ð±Ð°Ð¹Ñ\82Ñ\96в), Ð´Ð¾Ñ\81Ñ\82Ñ\83пна ÐºÑ\96лÑ\8cкÑ\96Ñ\81Ñ\82Ñ\8c Ñ\81лоÑ\82Ñ\96в ÐºÐ»Ñ\8eÑ\87Ñ\96в LUKS2 Ð±Ñ\83де Ð´Ñ\83же Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð¾Ñ\8e.\n"
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Введіть пароль, який слід змінити: "
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Не вдалося отримати блокування читання на пристрої %s."
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Введіть новий пароль: "
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr "У резервній копії %s виявлено заборонені вимоги щодо LUKS2."
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr ""
-"У команді isLuks можна використовувати лише один аргумент назви пристрою.\n"
+#: lib/luks2/luks2_json_metadata.c:1208
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Зсуви даних на пристрої і на резервній копії різняться, не вдалося відновити."
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "СлÑ\96д Ð²ÐºÐ°Ð·Ð°Ñ\82и Ð¿Ð°Ñ\80амеÑ\82Ñ\80 --header-backup-file.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Ð\94вÑ\96йковÑ\96 Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ¸ Ñ\96з Ñ\80озмÑ\96Ñ\80ами Ð¾Ð±Ð»Ð°Ñ\81Ñ\82ей Ñ\81лоÑ\82Ñ\96в ÐºÐ»Ñ\8eÑ\87Ñ\96в Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 Ñ\96 Ñ\83 Ñ\80езеÑ\80внÑ\96й ÐºÐ¾Ð¿Ñ\96Ñ\97 Ñ\80Ñ\96знÑ\8fÑ\82Ñ\8cÑ\81Ñ\8f, Ð½Ðµ Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð²Ñ\96дновиÑ\82и ÐºÐ¾Ð¿Ñ\96Ñ\8e."
 
-#: src/cryptsetup.c:1304
+#: lib/luks2/luks2_json_metadata.c:1221
 #, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Нерозпізнаний тип пристрою метаданих, %s.\n"
+msgid "Device %s %s%s%s%s"
+msgstr "Пристрій %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "не містить заголовка LUKS2. Заміна заголовка може зруйнувати дані, що зберігаються на пристрої."
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
+#: lib/luks2/luks2_json_metadata.c:1223
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "вже містить заголовок LUKS2. Заміна заголовка призведе до руйнування вже створених слотів ключів."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"Аргументами команди мають бути назва пристрою та призначена до нього назва.\n"
+"\n"
+"ПОПЕРЕДЖЕННЯ: виявлено невідомі вимоги LUKS2 у справжньому заголовку пристрою!\n"
+"Заміна заголовка резервною копією може пошкодити дані на пристрої!"
 
-#: src/cryptsetup.c:1326
-#, c-format
+#: lib/luks2/luks2_json_metadata.c:1227
 msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
 msgstr ""
-"У результаті виконання цієї операції буде витерто усі слоти ключів на "
-"пÑ\80иÑ\81Ñ\82Ñ\80оÑ\97 %s.\n"
-"Ð\9fÑ\96Ñ\81лÑ\8f Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ\8f Ñ\86Ñ\96Ñ\94Ñ\97 Ð´Ñ\96Ñ\97 Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\94м Ð½Ðµ Ð¼Ð¾Ð¶Ð½Ð° Ð±Ñ\83де Ñ\81коÑ\80иÑ\81Ñ\82аÑ\82иÑ\81Ñ\8f."
+"\n"
+"Ð\9fÐ\9eÐ\9fÐ\95РÐ\95Ð\94Ð\96Ð\95Ð\9dÐ\9dЯ: Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 Ð²Ð¸Ñ\8fвлено Ð´Ð°Ð½Ñ\96 Ð½ÐµÐ·Ð°Ð²ÐµÑ\80Ñ\88еного Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f!\n"
+"Ð\97амÑ\96на Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ° Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ¾Ð¼ Ñ\96з Ñ\80езеÑ\80вноÑ\97 ÐºÐ¾Ð¿Ñ\96Ñ\97 Ð¼Ð¾Ð¶Ðµ Ð¿Ð¾Ñ\88кодиÑ\82и Ð´Ð°Ð½Ñ\96."
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<пристрій> [--type <тип>] [<назва>]"
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "Проігноровано невідомий прапорець %s."
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "відкрити пристрій як призначення <назва>"
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr "Не вистачає ключа для сегмента dm-crypt %u"
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<назва>"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+msgid "Failed to set dm-crypt segment."
+msgstr "Не вдалося встановити сегмент dm-crypt."
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "закÑ\80иÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й (вилÑ\83Ñ\87иÑ\82и Ð¿Ñ\80изнаÑ\87еннÑ\8f)"
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð²Ñ\81Ñ\82ановиÑ\82и Ñ\81егменÑ\82 dm-linear."
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "змÑ\96ниÑ\82и Ñ\80озмÑ\96Ñ\80 Ð°ÐºÑ\82ивного Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e"
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr "Ð\9dепÑ\96дÑ\82Ñ\80имÑ\83ванÑ\96 Ð½Ð°Ð»Ð°Ñ\88Ñ\82Ñ\83ваннÑ\8f Ñ\86Ñ\96лÑ\96Ñ\81ноÑ\81Ñ\82Ñ\96 Ð´Ð°Ð½Ð¸Ñ\85 Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97."
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "показаÑ\82и Ñ\81Ñ\82ан Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e"
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr "Ð\92иконÑ\83Ñ\94мо Ð¿Ð¾Ð²Ñ\82оÑ\80не Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f. Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ð´ÐµÐ°ÐºÑ\82ивÑ\83ваÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й."
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "перевірити швидкодію шифрування"
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr "Не вдалося замінити пристрій %s, роботу якого призупинено, ціллю dm-error."
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<пристрій>"
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "Не вдалося прочитати вимоги LUKS2."
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "Виявлено невідповідність вимог LUKS2."
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr "Дія є несумісною із пристроєм, який позначено для перешифрування застарілого варіанта. Перериваємо дію."
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr "Дія є несумісною із пристроєм, який позначено для перешифрування LUKS2. Перериваємо дію."
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr "Недостатньо пам'яті для відкриття слоту ключів."
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+msgid "Keyslot open failed."
+msgstr "Не вдалося відкрити слот ключів."
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr "Не можна використовувати шифрування %s-%s для слотів ключів."
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+msgid "No space for new keyslot."
+msgstr "Немає простору для нового слоту ключа."
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Не вдалося перевірити стан пристрою з uuid %s."
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr "Не вдалося перетворити заголовок з додатковими метаданими LUKSMETA."
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "Не вдалося пересунути область слотів ключів. Недостатньо місця."
+
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "Не вдалося пересунути область слотів ключів. Область слотів ключів LUKS2 є надто малою."
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "Не вдалося пересунути область слотів ключів."
+
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "Не вдалося перетворити на формат LUKS1 — типовий розмір сектору шифрування сегмента не дорівнює 512 байтам."
+
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "Не вдалося перетворити до формату LUKS1 — контрольні суми слотів ключів не сумісні з LUKS1."
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "Не вдалося перетворити до формату LUKS1 — на пристрої використовується загорнуте шифрування ключів %s."
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "Не вдалося перетворити до формату LUKS1 - заголовок LUKS2 містить %u ключів."
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "Не вдалося перетворити до формату LUKS1 - слот ключа %u перебуває у некоректному стані."
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "Не вдалося перетворити до формату LUKS1 — слот %u (перевищує максимальну кількість слотів) усе ще є активним."
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "не вдалося перетворити до формату LUKS1 — слот ключів %u є несумісним з LUKS1."
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Розмір «гарячої» ділянки має бути кратним до обчисленого вирівнювання ділянки (%zu байтів)."
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Розмір пристрою має бути кратним до обчисленого вирівнювання ділянки (%zu байтів)."
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Непідтримуваний режим стійкості %s"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Не вдалося ініціалізувати обгортку старого сховища сегментів."
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Не вдалося ініціалізувати обгортку нового сховища сегментів."
+
+#: lib/luks2/luks2_reencrypt.c:1340
+msgid "Failed to read checksums for current hotzone."
+msgstr "Не вдалося прочитати контрольні суми для поточної «гарячої» ділянки."
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Не вдалося прочитати «гарячу» ділянку, починаючи з %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1366
+#, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Не вдалося розшифрувати сектор %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Не вдалося відновити сектор %zu."
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr "Розміри пристроїв джерела та призначення не збігаються. Розмір джерела — %<PRIu64>, розмір призначення — %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Не вдалося задіяти пристрій «гарячої» ділянки %s."
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr "Не вдалося задіяти пристрій-накладку %s зі справжньою таблицею походження."
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Не вдалося завантажити нову прив'язку для пристрою %s."
+
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr "Не вдалося освіжити тек пристрої для повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:2216
+msgid "Failed to set new keyslots area size."
+msgstr "Не вдалося встановити розмір області нових слотів ключів."
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Зміщення даних не вирівняно до запитаного розміру сектора для шифрування (%<PRIu32> байтів)."
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "Пристрій зберігання даних не вирівняно до запитаного розміру сектора для шифрування (%<PRIu32> байтів)."
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr "Зміщення даних (%<PRIu64> секторів) є меншим за майбутній зсув даних (%<PRIu64> секторів)."
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Не вдалося відкрити %s в ексклюзивному режимі (вже пов'язано або змонтовано)."
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Пристрій не позначено для повторного шифрування LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "Не вдалося завантажити контекст повторного шифрування LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:2619
+msgid "Failed to get reencryption state."
+msgstr "Не вдалося отримати стан повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:2623
+msgid "Device is not in reencryption."
+msgstr "Пристрій не перебуває у повторному шифруванні."
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr "Процес повторного шифрування вже виконується."
+
+#: lib/luks2/luks2_reencrypt.c:2632
+msgid "Failed to acquire reencryption lock."
+msgstr "Не вдалося створити блокування для повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr "Продовження повторного шифрування неможливе. Спочатку слід виконати відновлення повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr "Не збігаються розмір активного пристрою і запитаний розмір повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr "У параметрах повторного шифрування вказано некоректний розмір пристрою."
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "Виконується повторне шифрування. Неможливо виконати відновлення."
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr "Повторне шифрування LUKS2 вже ініційовано у метаданих."
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "Не вдалося ініціалізувати повторне шифрування LUKS2 лише у метаданих."
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr "Не вдалося встановити сегменти пристрою для наступної «гарячої» ділянки повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:3046
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Не вдалося записати метадані стійкості для повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:3053
+msgid "Decryption failed."
+msgstr "Помилка розшифрування."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Не вдалося записати «гарячу» ділянку, починаючи з %<PRIu64>."
+
+#: lib/luks2/luks2_reencrypt.c:3063
+msgid "Failed to sync data."
+msgstr "Не вдалося синхронізувати дані."
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr "Не вдалося оновити метадані після завершення обробки поточної «гарячої» зони повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:3138
+msgid "Failed to write LUKS2 metadata."
+msgstr "Не вдалося записати метадані LUKS2."
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr "Не вдалося витерти дані резервного сегмента."
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr "Не вдалося вимкнути прапорець вимоги повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr "Критична помилка під час повторного шифрування фрагмента, починаючи з %<PRIu64>, довжиною у %<PRIu64> секторів."
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr "Не відновлюйте пристрій, якщо не заміните вручну пристрій призначення для помилок."
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr "Не вдалося виконати повторне шифрування. Неочікуваний стан засобу повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr "Не вказано контекст повторного шифрування або вказано некоректний контекст."
+
+#: lib/luks2/luks2_reencrypt.c:3253
+msgid "Failed to initialize reencryption device stack."
+msgstr "Не вдалося ініціалізувати стос пристроїв повторного шифрування."
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+msgid "Failed to update reencryption context."
+msgstr "Не вдалося оновити контекст повторного шифрування."
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr "Немає вільного слоту ключів."
+
+#: lib/luks2/luks2_token.c:269
+#, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Не вдалося створити вбудований ключ %s."
+
+#: src/cryptsetup.c:164
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Перевірку паролів не можна виконувати на основі вхідних даних, які надходять не з tty."
+
+#: src/cryptsetup.c:221
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Параметри шифрування слоту ключів можна встановлювати лише для пристроїв LUKS2."
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+msgid "No known cipher specification pattern detected."
+msgstr "Не виявлено жодного відомого зразка специфікації шифрування."
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "Попередження: параметр --hash у простому режимі із вказаним файлом ключа ігнорується.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "Попередження: параметр --keyfile-size проігноровано, розмір прочитаних даних збігається із розміром ключа шифрування.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr "На %s виявлено підписи пристроїв. Подальша обробка може пошкодити наявні дані."
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "Дію перервано.\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "Слід вказати параметр --key-file."
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "Введіть PIM VeraCrypt: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "Некоректне значення PIM: помилка обробки."
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "Некоректне значення PIM: 0."
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "Некоректне значення PIM: поза межами діапазону."
+
+#: src/cryptsetup.c:472
+msgid "No device header detected with this passphrase."
+msgstr "Для цього пароля не виявлено заголовка пристрою."
+
+#: src/cryptsetup.c:541
+#, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Пристрій %s не є коректним пристроєм BITLK."
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Дамп заголовка з ключем тому є конфіденційними даними,\n"
+"за допомогою яких можна отримати доступ до шифрованого розділу\n"
+"без пароля. Цей дамп слід зберігати у зашифрованому форматі\n"
+"у безпечному місці."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr "Пристрій %s усе ще є активним, його заплановано для відкладеного вилучення.\n"
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr "Зміна розмірів активного пристрою потребує наявності ключа тому у сховищі ключів, але вказано параметр --disable-keyring."
+
+#: src/cryptsetup.c:838
+msgid "Benchmark interrupted."
+msgstr "Тестування перервано."
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr "PBKDF2-%-9s     н/д\n"
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr "PBKDF2-%-9s %7u ітерацій за секунду для %zu-бітового ключа\n"
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr "%-10s н/д\n"
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr "%-10s %4u ітерацій, пам'ять: %5u, %1u паралельних потоків (процесорів) для %zu-бітового ключа (запит на %u мс часу)\n"
+
+#: src/cryptsetup.c:901
+msgid "Result of benchmark is not reliable."
+msgstr "Результат тестування є ненадійним."
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Наближені значення під час перевірки визначаються лише за допомогою оперативної пам’яті (без запису на диск).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "№%*s Алгоритм |      Ключ |      Шифрування |   Розшифрування\n"
+
+#: src/cryptsetup.c:975
+#, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Шифрування  %s (розмір ключа — %i бітів) є недоступним."
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "№      Алгоритм |      Ключ |      Шифрування |   Розшифрування\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "н/д"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+"Здається, пристрій не потребує відновлення повторного шифрування.\n"
+"Хочете виконати цю дію попри це?"
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr "Ви справді хочете продовжити процедуру відновлення повторного шифрування LUKS2?"
+
+#: src/cryptsetup.c:1098
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Вкажіть пароль для відновлення повторного шифрування: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Спробувати відновити заголовок пристрою LUKS?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+"Витираємо пристрій для ініціалізації контрольних сум для цілісності.\n"
+"Ви можете перервати цей процес натисканням комбінації клавіш CTRL+C (решта невитертого пристрою міститиме некоректну контрольну суму).\n"
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Не можна скасувати активацію тимчасового пристрою %s."
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr "Параметр цілісності може бути використано лише для формату LUKS2."
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Непідтримувані параметри розміру метаданих LUKS2."
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "Не вдалося створити файл заголовка %s."
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+msgid "No known integrity specification pattern detected."
+msgstr "Не виявлено жодного відомого зразка специфікації цілісності."
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Не можна використовувати %s як заголовок на диску."
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Дані на %s буде перезаписано без можливості відновлення."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "Не вдалося встановити параметри pbkdf."
+
+#: src/cryptsetup.c:1439
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Зменшений відступ даних можна використовувати лише для від’єднаних заголовків LUKS."
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr "Неможливо визначити розмір ключа тому для LUKS без слотів ключів. Будь ласка, скористайтеся параметром --key-size."
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr "Пристрій задіяно, але не вдалося зробити прапорці сталими."
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Слот ключа %d позначено для вилучення."
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Це останній слот ключа. Пристрій стане непридатним для використання після спорожнення цього ключа."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Введіть будь-який інший пароль: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr "Дію перервано, слот ключів НЕ витерто.\n"
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Введіть пароль, який слід вилучити: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Введіть новий пароль для слота ключа: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Введіть будь-який пароль: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Введіть пароль, який слід змінити: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Введіть новий пароль: "
+
+#: src/cryptsetup.c:1927
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Вкажіть пароль для слоту ключа, який буде перетворено: "
+
+#: src/cryptsetup.c:1951
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "У команді isLuks можна використовувати лише один аргумент назви пристрою."
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Дамп заголовка з ключем тому є конфіденційними даними,\n"
+"за допомогою яких можна отримати доступ до шифрованого розділу\n"
+"без пароля. Цей дамп слід зберігати у зашифрованому форматі\n"
+"у безпечному місці."
+
+#: src/cryptsetup.c:2066
+#, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Слот ключа %d не містить непов'язаного ключа."
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Дамп заголовка з непов'язаним ключем є конфіденційними даними.\n"
+"Цей дамп слід зберігати у зашифрованому форматі у безпечному місці."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+msgid "Option --header-backup-file is required."
+msgstr "Слід вказати параметр --header-backup-file."
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr "%s не є керованим cryptsetup пристроєм."
+
+#: src/cryptsetup.c:2269
+#, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Підтримки дії з оновлення для пристрою типу %s не передбачено."
+
+#: src/cryptsetup.c:2311
+#, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Нерозпізнаний тип пристрою метаданих, %s."
+
+#: src/cryptsetup.c:2314
+msgid "Command requires device and mapped name as arguments."
+msgstr "Аргументами команди мають бути назва пристрою та призначена до нього назва."
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"У результаті виконання цієї операції буде витерто усі слоти ключів на пристрої %s.\n"
+"Після виконання цієї дії пристроєм не можна буде скористатися."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "Дію перервано, слоти ключів НЕ витерто.\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr "Некоректний тип LUKS. Передбачено підтримку лише luks1 і luks2."
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "Пристрій вже належить до типу %s."
+
+#: src/cryptsetup.c:2403
+#, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Ця дія перетворить %s до формату %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr "Дію перервано, дані пристрою НЕ перетворено.\n"
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "Пропущено параметр --priority, --label або --subsystem."
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, c-format
+msgid "Token %d is invalid."
+msgstr "Ключ %d є некоректним."
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr "Ключ %d використовується."
+
+#: src/cryptsetup.c:2493
+#, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Не вдалося додати ключ %d зі сховища ключів luks2."
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Не вдалося прив'язати ключ %d до слоту ключа %d."
+
+#: src/cryptsetup.c:2519
+#, c-format
+msgid "Token %d is not in use."
+msgstr "Ключ %d не використовується."
+
+#: src/cryptsetup.c:2554
+msgid "Failed to import token from file."
+msgstr "Не вдалося імпортувати ключ з файла."
+
+#: src/cryptsetup.c:2579
+#, c-format
+msgid "Failed to get token %d for export."
+msgstr "Не вдалося отримати ключ %d для експортування."
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr "Параметр --key-description є обов'язковим для дій із додавання ключів."
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr "Для виконання дії потрібен специфічний ключ. Скористайтеся параметром --token-id."
+
+#: src/cryptsetup.c:2613
+#, c-format
+msgid "Invalid token operation %s."
+msgstr "Некоректна дія з ключем %s."
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr "Автоматично виявлено активний пристрій dm «%s» для пристрою даних %s.\n"
+
+#: src/cryptsetup.c:2672
+#, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Пристрій %s не є блоковим пристроєм.\n"
+
+#: src/cryptsetup.c:2674
+#, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Не вдалося автоматично визначити утримувачів пристрою %s."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+"Не вдалося визначити, чи задіяно пристрій %s.\n"
+"Ви справді хочете продовжити повторне шифрування у режимі з від'єднанням?\n"
+"Таке шифрування може призвести до пошкодження даних, якщо пристрій задіяно.\n"
+"Щоб запустити повторне шифрування у режимі без від'єднання, скористайтеся параметром --active-name.\n"
+
+#: src/cryptsetup.c:2756
+msgid "Invalid LUKS device type."
+msgstr "Некоректний тип пристрою LUKS."
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr "Шифрування без від'єднаного заголовка (--header) є неможливим без зменшення розміру пристрою зберігання даних (--reduce-device-size)."
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr "Вказаний зсув даних має бути меншим або рівним половині значення параметра --reduce-device-size."
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr "Коригуємо значення --reduce-device-size до подвійного значення --offset %<PRIu64> (у секторах).\n"
+
+#: src/cryptsetup.c:2779
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Підтримку шифрування передбачено лише для формату LUKS2."
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr "Виявлено пристрій LUKS на %s. Хочете зашифрувати цей пристрій LUKS знову?"
+
+#: src/cryptsetup.c:2816
+#, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Файл тимчасового заголовка %s вже існує. Перериваємо обробку."
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Не вдалося створити файл тимчасового заголовка %s."
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr "%s/%s задіяно, система готова до інтерактивного шифрування.\n"
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+msgid "Not enough free keyslots for reencryption."
+msgstr "Недостатньо вільних слотів ключів для повторного шифрування."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Файлом ключа можна користуватися лише з --key-slot, або якщо активним є лише один слот ключа."
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Вкажіть пароль для слоту ключа %d: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Вкажіть пароль для слоту ключа %u: "
+
+#: src/cryptsetup.c:3263
+msgid "Command requires device as argument."
+msgstr "Комарні слід передати аргумент пристрою."
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr "У поточній версії передбачено підтримку лише формату LUKS2. Для роботи з LUKS1, будь ласка, скористайтеся програмою cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr "Вже виконується повторне шифрування з від'єднанням у застарілому режимі. Скористайтеся програмою cryptsetup-reencrypt."
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "Підтримки повторного шифрування пристрою із профілем цілісності не передбачено."
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr "Вже ініційовано повторне шифрування LUKS2. Перериваємо виконання дії."
+
+#: src/cryptsetup.c:3319
+msgid "LUKS2 device is not in reencryption."
+msgstr "Пристрій LUKS2 не перебуває у стані повторного шифрування."
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<пристрій> [--type <тип>] [<назва>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "відкрити пристрій як <назва>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<назва>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "закрити пристрій (вилучити призначення)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "змінити розмір активного пристрою"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "показати стан пристрою"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <шифр>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "перевірити швидкодію шифрування"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<пристрій>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
 msgstr "спробувати виправити метадані на диску"
 
-#: src/cryptsetup.c:1366
+#: src/cryptsetup.c:3352
+msgid "reencrypt LUKS2 device"
+msgstr "повторно зашифрувати пристрій LUKS2"
+
+#: src/cryptsetup.c:3353
 msgid "erase all keyslots (remove encryption key)"
 msgstr "витерти усі слоти ключів (вилучити ключ шифрування)"
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "перетворити LUKS із формату LUKS2 або навпаки"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr "встановити сталі параметри налаштування для LUKS2"
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
 msgid "<device> [<new key file>]"
 msgstr "<пристрій> [<новий файл ключа>]"
 
-#: src/cryptsetup.c:1367
+#: src/cryptsetup.c:3356
 msgid "formats a LUKS device"
 msgstr "форматує пристрій LUKS"
 
-#: src/cryptsetup.c:1368
+#: src/cryptsetup.c:3357
 msgid "add key to LUKS device"
 msgstr "додати ключ до пристрою LUKS"
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
 msgid "<device> [<key file>]"
 msgstr "<пристрій> [<файл ключа>]"
 
-#: src/cryptsetup.c:1369
+#: src/cryptsetup.c:3358
 msgid "removes supplied key or key file from LUKS device"
 msgstr "вилучає наданий ключ або файл ключа з пристрою LUKS"
 
-#: src/cryptsetup.c:1370
+#: src/cryptsetup.c:3359
 msgid "changes supplied key or key file of LUKS device"
 msgstr "змінює наданий ключ або файл ключа пристрою LUKS"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr "перетворює ключ до нових параметрів pbkdf"
+
+#: src/cryptsetup.c:3361
 msgid "<device> <key slot>"
 msgstr "<пристрій> <слот ключа>"
 
-#: src/cryptsetup.c:1371
+#: src/cryptsetup.c:3361
 msgid "wipes key with number <key slot> from LUKS device"
 msgstr "вилучає ключ з номером <слот ключа> з пристрою LUKS"
 
-#: src/cryptsetup.c:1372
+#: src/cryptsetup.c:3362
 msgid "print UUID of LUKS device"
 msgstr "вивести UUID пристрою LUKS"
 
-#: src/cryptsetup.c:1373
+#: src/cryptsetup.c:3363
 msgid "tests <device> for LUKS partition header"
-msgstr ""
-"виконати спробу виявлення заголовка розділу LUKS на пристрої <пристрій>"
+msgstr "виконати спробу виявлення заголовка розділу LUKS на пристрої <пристрій>"
 
-#: src/cryptsetup.c:1374
+#: src/cryptsetup.c:3364
 msgid "dump LUKS partition information"
 msgstr "створити дамп даних щодо розділу LUKS"
 
-#: src/cryptsetup.c:1375
+#: src/cryptsetup.c:3365
 msgid "dump TCRYPT device information"
 msgstr "створити дамп даних пристрою TCRYPT"
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr ""
-"Приспати пристрій LUKS і витерти ключ (роботу всіх каналів введення-"
-"виведення буде заморожено)."
+#: src/cryptsetup.c:3366
+msgid "dump BITLK device information"
+msgstr "створити дамп даних пристрою BITLK"
+
+#: src/cryptsetup.c:3367
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Приспати пристрій LUKS і витерти ключ (роботу всіх каналів введення-виведення буде заморожено)"
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Відновити роботу приспаного пристрою LUKS."
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "Відновити роботу приспаного пристрою LUKS"
 
-#: src/cryptsetup.c:1378
+#: src/cryptsetup.c:3369
 msgid "Backup LUKS device header and keyslots"
 msgstr "Створити резервну копію заголовка пристрою LUKS і слотів ключів"
 
-#: src/cryptsetup.c:1379
+#: src/cryptsetup.c:3370
 msgid "Restore LUKS device header and keyslots"
 msgstr "Відновити заголовок пристрою LUKS і слоти ключів"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr "<add|remove|import|export> <пристрій>"
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr "Керування ключами LUKS2"
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
 msgid ""
 "\n"
 "<action> is one of:\n"
@@ -1125,20 +2326,20 @@ msgstr ""
 "\n"
 "<дія> є однією з таких:\n"
 
-#: src/cryptsetup.c:1402
+#: src/cryptsetup.c:3395
 msgid ""
 "\n"
 "You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 msgstr ""
 "\n"
 "Ви також можете скористатися застарілими альтернативними\n"
 "синтаксичними конструкціями для запису <дія>:\n"
-"\tвідкрити: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tзакрити: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\tвідкрити: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tзакрити: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 
-#: src/cryptsetup.c:1406
+#: src/cryptsetup.c:3399
 #, c-format
 msgid ""
 "\n"
@@ -1151,412 +2352,747 @@ msgstr ""
 "<назва> — пристрій для створення у %s\n"
 "<пристрій> — зашифрований пристрій\n"
 "<слот ключа> — номер слота ключа LUKS, який слід змінити\n"
-"<файл ключа> — необов’язковий файл ключа для нового ключа для дії "
-"luksAddKey\n"
+"<файл ключа> — необов’язковий файл ключа для нового ключа для дії luksAddKey\n"
 
-#: src/cryptsetup.c:1413
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+"\n"
+"Типовий укомпільований формат метаданих — %s (для дії luksFormat).\n"
+
+#: src/cryptsetup.c:3411
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
 msgstr ""
 "\n"
 "Типові вбудовані параметри ключа і пароля:\n"
-"\tМаксимальний розмір файла ключа: %d кБ, максимальна довжина інтерактивного "
-"пароля: %d (символів)\n"
-"Типовий час ітерації PBKDF2 для LUKS: %d мс\n"
+"\tМаксимальний розмір файла ключа: %d кБ, максимальна довжина інтерактивного пароля: %d (символів)\n"
+"Типовий час ітерації PBKDF для LUKS1: %s, час ітерації: %d мс\n"
+"Типовий PBKDF для LUKS2: %s\n"
+"\tЧас ітерації: %d, потрібний обсяг пам'яті: %d кБ, паралельних потоків: %d\n"
 
-#: src/cryptsetup.c:1420
+#: src/cryptsetup.c:3422
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in device cipher parameters:\n"
 "\tloop-AES: %s, Key %d bits\n"
 "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
 msgstr ""
 "\n"
 "Типові вбудовані параметри шифрування на пристрої:\n"
 "\tloop-AES: %s, %d-бітовий ключ\n"
 "\tзвичайне: %s, ключ: %d-бітовий, хешування пароля: %s\n"
-"\tLUKS1: %s, ключ: %d-бітовий, хешування заголовка LUKS: %s, RNG: %s\n"
+"\tLUKS: %s, ключ: %d-бітовий, хешування заголовка LUKS: %s, RNG: %s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr "\tLUKS: типовий розмір ключа у режимі XTS (два вбудованих ключа) буде подвоєно.\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
 #, c-format
 msgid "%s: requires %s as arguments"
 msgstr "%s: слід вказати у параметрах %s"
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
 msgid "Show this help message"
 msgstr "Показати цю довідку"
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
 msgid "Display brief usage"
 msgstr "Показати короткі настанови щодо користування"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Пункти довідки:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
 msgid "Print package version"
 msgstr "Вивести дані щодо версії пакунка"
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Пункти довідки:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
 msgid "Shows more detailed error messages"
 msgstr "Показувати докладні повідомлення про помилки"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
 msgid "Show debug messages"
-msgstr "Ð\9fоказÑ\83ваÑ\82и Ð¿Ð¾Ð²Ñ\96домленнÑ\8f Ð·Ð½ÐµÐ²Ð°Ð´Ð¶ення"
+msgstr "Ð\9fоказÑ\83ваÑ\82и Ð´Ñ\96агноÑ\81Ñ\82иÑ\87нÑ\96 Ð¿Ð¾Ð²Ñ\96домлення"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
+#: src/cryptsetup.c:3489
+msgid "Show debug messages including JSON metadata"
+msgstr "Показувати діагностичні повідомлення, зокрема метадані JSON"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
 msgid "The cipher used to encrypt the disk (see /proc/crypto)"
 msgstr "Шифр, який використано для шифрування даних диска (див. /proc/crypto)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
 msgid "The hash used to create the encryption key from the passphrase"
 msgstr "Хеш, використаний для створення ключа шифрування на основі пароля"
 
-#: src/cryptsetup.c:1481
+#: src/cryptsetup.c:3492
 msgid "Verifies the passphrase by asking for it twice"
 msgstr "Перевіряє пароль повторним запитом щодо нього"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
-msgstr "Прочитати ключ з файла."
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "Прочитати ключ з файла"
 
-#: src/cryptsetup.c:1483
+#: src/cryptsetup.c:3494
 msgid "Read the volume (master) key from file."
 msgstr "Прочитати ключ тому (основний ключ) з файла."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr ""
-"Створити дамп ключа тому (основного ключа) замість показу даних щодо слотів "
-"ключів."
+#: src/cryptsetup.c:3495
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Створити дамп ключа тому (основного ключа) замість показу даних щодо слотів ключів"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
 msgid "The size of the encryption key"
 msgstr "Розмір ключа шифрування"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
 msgid "BITS"
 msgstr "БІТИ"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
 msgid "Limits the read from keyfile"
 msgstr "Обмежує читання з файла ключа"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
 msgid "bytes"
 msgstr "байти"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
 msgid "Number of bytes to skip in keyfile"
 msgstr "Кількість байтів, які слід пропустити у файлі ключа"
 
-#: src/cryptsetup.c:1488
+#: src/cryptsetup.c:3499
 msgid "Limits the read from newly added keyfile"
 msgstr "Обмежує читання з щойно доданого файла ключа"
 
-#: src/cryptsetup.c:1489
+#: src/cryptsetup.c:3500
 msgid "Number of bytes to skip in newly added keyfile"
 msgstr "Кількість байтів, які слід пропустити у щойно доданому файлі ключа"
 
-#: src/cryptsetup.c:1490
+#: src/cryptsetup.c:3501
 msgid "Slot number for new key (default is first free)"
 msgstr "Номер слоту для нового ключа (типовим слотом є перший вільний слот)"
 
-#: src/cryptsetup.c:1491
+#: src/cryptsetup.c:3502
 msgid "The size of the device"
 msgstr "Розмір пристрою"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
 msgid "SECTORS"
 msgstr "СЕКТОРИ"
 
-#: src/cryptsetup.c:1492
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Використовувати лише вказаний розмір пристрою (ігнорувати решту об’єму). НЕБЕЗПЕЧНО!"
+
+#: src/cryptsetup.c:3504
 msgid "The start offset in the backend device"
 msgstr "Початковий відступ на допоміжному пристрої"
 
-#: src/cryptsetup.c:1493
+#: src/cryptsetup.c:3505
 msgid "How many sectors of the encrypted data to skip at the beginning"
 msgstr "Кількість секторів зашифрованих даних, які слід пропустити на початку"
 
-#: src/cryptsetup.c:1494
-msgid "Create a readonly mapping"
-msgstr "Створити призначення у режимі лише читання"
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "Створити призначення у режимі лише читання"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "Не питати про підтвердження"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "Час очікування у інтерактивному запиті щодо пароля (у секундах)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "секунди"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr "Оновлення лінії поступу (у секундах)"
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Частота повторень спроб отримання вхідних даних пароля"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Вирівняти дані за областями у <n> секторів, для luksFormat"
+
+#: src/cryptsetup.c:3512
+msgid "File with LUKS header and keyslots backup"
+msgstr "Файл з заголовком LUKS та резервною копію слотів ключів"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "Використовувати для створення ключа тому /dev/random"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Використовувати для створення ключа тому /dev/urandom"
+
+#: src/cryptsetup.c:3515
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Використовувати пристрій спільно з іншим сегментом шифрування, без перекриття"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+msgid "UUID for device to use"
+msgstr "UUID пристрою, який слід використати"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Дозволити запити відкидання (або TRIM) до пристрою"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+msgid "Device or file with separated LUKS header"
+msgstr "Пристрій або файл з окремим заголовком LUKS"
+
+#: src/cryptsetup.c:3519
+msgid "Do not activate device, just check passphrase"
+msgstr "Не задіювати пристрій, просто перевірити пароль"
+
+#: src/cryptsetup.c:3520
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Використовувати прихований заголовок (прихований пристрій TCRYPT)"
+
+#: src/cryptsetup.c:3521
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Пристрій є системним диском TCRYPT (диском з завантажувачем)"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Використовувати резервний (вторинний) заголовок TCRYPT"
+
+#: src/cryptsetup.c:3523
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Виконати також пошук сумісних із VeraCrypt пристроїв"
+
+#: src/cryptsetup.c:3524
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Особистий множник ітерації (Personal Iteration Multiplier або PIM) для сумісного з VeraCrypt пристрою"
+
+#: src/cryptsetup.c:3525
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Особистий множник ітерації (Personal Iteration Multiplier або PIM) запису для сумісного з VeraCrypt пристрою"
+
+#: src/cryptsetup.c:3526
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Типи метаданих пристрою: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+
+#: src/cryptsetup.c:3527
+msgid "Disable password quality check (if enabled)"
+msgstr "Вимкнути перевірку якості пароля (якщо її увімкнено)"
+
+#: src/cryptsetup.c:3528
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Скористатися параметром сумісності швидкодії dm-crypt same_cpu_crypt"
+
+#: src/cryptsetup.c:3529
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Скористатися параметром сумісності швидкодії dm-crypt submit_from_crypt_cpus"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr "Вилучення пристрою відкладено до часу, коли останній користувач закриє його"
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr "Скористатися загальним блокуванням для перетворення у послідовну форму «жорсткого» PBKDF у пам'яті (обхід OOM)"
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Тривалість ітерації PBKDF для LUKS (у мс)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "мс"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr "Алгоритм PBKDF (для LUKS2) (argon2i/argon2id/pbkdf2)"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "Обмеження вартості пам'яті PBKDF"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "кілобайти"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "Вартість розпаралелювання PBKDF"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "threads"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr "Вартість ітерацій PBKDF (примусово, вимикає тестування)"
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr "Пріоритетність слотів ключів: ignore, normal, prefer"
+
+#: src/cryptsetup.c:3538
+msgid "Disable locking of on-disk metadata"
+msgstr "Вимкнути блокування метаданих на диску"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr "Вимкнути завантаження ключів тому за допомогою сховища ключів ядра"
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr "Алгоритм перевірки цілісності даних (лише LUKS2)"
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr "Вимкнути журнал для пристрою забезпечення цілісності"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr "Не витирати пристрій після форматування"
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr "Скористатися неефективним застарілим відступом (застарілі ядра)"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "ТÑ\80ивалÑ\96Ñ\81Ñ\82Ñ\8c Ñ\96Ñ\82еÑ\80аÑ\86Ñ\96Ñ\97 PBKDF2 Ð´Ð»Ñ\8f LUKS (Ñ\83 Ð¼Ñ\81)"
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr "Ð\9dе Ð¿Ñ\80оÑ\81иÑ\82и Ð²Ð²ÐµÑ\81Ñ\82и Ð¿Ð°Ñ\80олÑ\8c, Ñ\8fкÑ\89о Ð½Ðµ Ð²Ð´Ð°Ñ\81Ñ\82Ñ\8cÑ\81Ñ\8f Ñ\81коÑ\80иÑ\81Ñ\82аÑ\82иÑ\81Ñ\8f Ð°ÐºÑ\82иваÑ\86Ñ\96Ñ\94Ñ\8e Ð·Ð° ÐºÐ»Ñ\8eÑ\87ем"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "мÑ\81"
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr "Ð\9dомеÑ\80 ÐºÐ»Ñ\8eÑ\87а (Ñ\82ипове Ð·Ð½Ð°Ñ\87еннÑ\8f: Ð±Ñ\83дÑ\8c\8fкий)"
 
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
-msgid "Do not ask for confirmation"
-msgstr "Ð\9dе Ð¿Ð¸Ñ\82аÑ\82и Ð¿Ñ\80о Ð¿Ñ\96дÑ\82веÑ\80дженнÑ\8f"
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr "Ð\9eпиÑ\81 ÐºÐ»Ñ\8eÑ\87а"
 
-#: src/cryptsetup.c:1497
-msgid "Timeout for interactive passphrase prompt (in seconds)"
-msgstr "ЧаÑ\81 Ð¾Ñ\87Ñ\96кÑ\83ваннÑ\8f Ñ\83 Ñ\96нÑ\82еÑ\80акÑ\82ивномÑ\83 Ð·Ð°Ð¿Ð¸Ñ\82Ñ\96 Ñ\89одо Ð¿Ð°Ñ\80олÑ\8f (Ñ\83 Ñ\81екÑ\83ндаÑ\85)"
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr "РозмÑ\96Ñ\80 Ñ\81екÑ\82оÑ\80а Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f (Ñ\82ипове Ð·Ð½Ð°Ñ\87еннÑ\8f: 512 Ð±Ð°Ð¹Ñ\82Ñ\96в)"
 
-#: src/cryptsetup.c:1497
-msgid "secs"
-msgstr "секунди"
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr "Використовувати обчислення за IV у розмірі сектора (не за блоками у 512 байтів)"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "ЧаÑ\81Ñ\82оÑ\82а Ð¿Ð¾Ð²Ñ\82оÑ\80енÑ\8c Ñ\81пÑ\80об Ð¾Ñ\82Ñ\80иманнÑ\8f Ð²Ñ\85Ñ\96дниÑ\85 Ð´Ð°Ð½Ð¸Ñ\85 Ð¿Ð°Ñ\80олÑ\8f"
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr "Ð\92Ñ\81Ñ\82ановиÑ\82и Ñ\81Ñ\82алÑ\96 Ð¿Ñ\80апоÑ\80Ñ\86Ñ\96 Ð°ÐºÑ\82иваÑ\86Ñ\96Ñ\97 Ð´Ð»Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e"
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
-msgstr "Вирівняти дані за областями у <n> секторів, для luksFormat"
+#: src/cryptsetup.c:3550
+msgid "Set label for the LUKS2 device"
+msgstr "Встановити мітку для пристрою LUKS2"
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Файл Ð· Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ¾Ð¼ LUKS Ñ\82а Ñ\80езеÑ\80вноÑ\8e ÐºÐ¾Ð¿Ñ\96Ñ\8e Ñ\81лоÑ\82Ñ\96в ÐºÐ»Ñ\8eÑ\87Ñ\96в."
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "Ð\92Ñ\81Ñ\82ановиÑ\82и Ð¼Ñ\96Ñ\82кÑ\83 Ð¿Ñ\96дÑ\82омÑ\83 Ð´Ð»Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e LUKS2"
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "Ð\92икоÑ\80иÑ\81Ñ\82овÑ\83ваÑ\82и Ð´Ð»Ñ\8f Ñ\81Ñ\82воÑ\80еннÑ\8f ÐºÐ»Ñ\8eÑ\87а Ñ\82омÑ\83 /dev/random."
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr "СÑ\82воÑ\80иÑ\82и Ð½ÐµÐ¿Ð¾Ð²'Ñ\8fзаний (без Ð¿Ð¾Ð²'Ñ\8fзаного Ñ\81егменÑ\82а Ð´Ð°Ð½Ð¸Ñ\85) Ñ\81лоÑ\82 ÐºÐ»Ñ\8eÑ\87Ñ\96в LUKS2 Ð°Ð±Ð¾ Ð¹Ð¾Ð³Ð¾ Ð´Ð°Ð¼Ð¿"
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Ð\92икоÑ\80иÑ\81Ñ\82овÑ\83ваÑ\82и Ð´Ð»Ñ\8f Ñ\81Ñ\82воÑ\80еннÑ\8f ÐºÐ»Ñ\8eÑ\87а Ñ\82омÑ\83 /dev/urandom."
+#: src/cryptsetup.c:3553
+msgid "Read or write the json from or to a file"
+msgstr "Ð\9fÑ\80оÑ\87иÑ\82аÑ\82и json Ð· Ñ\84айла Ð°Ð±Ð¾ Ð·Ð°Ð¿Ð¸Ñ\81аÑ\82и json Ð´Ð¾ Ñ\84айла"
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr ""
-"Використовувати пристрій спільно з іншим сегментом шифрування, без "
-"перекриття."
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr "Розмір області метаданих у заголовку LUKS2"
+
+#: src/cryptsetup.c:3555
+msgid "LUKS2 header keyslots area size"
+msgstr "Розмір області слотів ключів у заголовку LUKS2"
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID пристрою, який слід використати."
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr "Оновити (повторно активувати) пристрій згідно з новими параметрами"
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Ð\94озволиÑ\82и Ð·Ð°Ð¿Ð¸Ñ\82и Ð²Ñ\96дкиданнÑ\8f (або TRIM) Ð´Ð¾ Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e."
+#: src/cryptsetup.c:3557
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87Ñ\96в LUKS2: Ñ\80озмÑ\96Ñ\80 ÐºÐ»Ñ\8eÑ\87а Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80Ñ\96й Ð°Ð±Ð¾ Ñ\84айл Ð· Ð¾ÐºÑ\80емим Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ¾Ð¼ LUKS."
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr "СлоÑ\82 ÐºÐ»Ñ\8eÑ\87а LUKS2: Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f, Ñ\8fке Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82ано Ð´Ð»Ñ\8f Ñ\81лоÑ\82Ñ\83 ÐºÐ»Ñ\8eÑ\87Ñ\96в"
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Ð\9dе Ð·Ð°Ð´Ñ\96Ñ\8eваÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й, Ð¿Ñ\80оÑ\81Ñ\82о Ð¿ÐµÑ\80евÑ\96Ñ\80иÑ\82и Ð¿Ð°Ñ\80олÑ\8c."
+#: src/cryptsetup.c:3559
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Ð\97аÑ\88иÑ\84Ñ\80Ñ\83ваÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й LUKS2 (Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f Ð½Ð° Ð¼Ñ\96Ñ\81Ñ\86Ñ\96)."
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Ð\92икоÑ\80иÑ\81Ñ\82овÑ\83ваÑ\82и Ð¿Ñ\80иÑ\85ований Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº (пÑ\80иÑ\85ований Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й TCRYPT)."
+#: src/cryptsetup.c:3560
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "РозÑ\88иÑ\84Ñ\80Ñ\83ваÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й LUKS2 (Ñ\83Ñ\81Ñ\83нÑ\83Ñ\82и Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f)."
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Ð\9fÑ\80иÑ\81Ñ\82Ñ\80Ñ\96й Ñ\94 Ñ\81иÑ\81Ñ\82емним Ð´Ð¸Ñ\81ком TCRYPT (диÑ\81ком Ð· Ð·Ð°Ð²Ð°Ð½Ñ\82ажÑ\83ваÑ\87ем)."
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr "Ð\86нÑ\96Ñ\86Ñ\96алÑ\96зÑ\83ваÑ\82и Ð¿Ð¾Ð²Ñ\82оÑ\80не Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f LUKS2 Ð»Ð¸Ñ\88е Ñ\83 Ð¼ÐµÑ\82аданиÑ\85."
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Використовувати резервний (вторинний) заголовок TCRYPT."
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr "Відновлювати лише ініціалізоване повторне шифрування LUKS2."
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Ð\92иконаÑ\82и Ñ\82акож Ð¿Ð¾Ñ\88Ñ\83к Ñ\81Ñ\83мÑ\96Ñ\81ниÑ\85 Ñ\96з VeraCrypt Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97в."
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Ð\97менÑ\88иÑ\82и Ñ\80озмÑ\96Ñ\80 Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e Ð·Ð±ÐµÑ\80Ñ\96ганнÑ\8f Ð´Ð°Ð½Ð¸Ñ\85 (змÑ\96Ñ\81Ñ\82иÑ\82и Ð²Ñ\96дÑ\81Ñ\82Ñ\83п Ð´Ð°Ð½Ð¸Ñ\85). Ð\9dÐ\95Ð\91Ð\95Ð\97Ð\9fÐ\95ЧÐ\9dÐ\9e!"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Типи Ð¼ÐµÑ\82аданиÑ\85 Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e: luks, plain, loopaes, tcrypt."
+#: src/cryptsetup.c:3564
+msgid "Maximal reencryption hotzone size."
+msgstr "Ð\9cакÑ\81ималÑ\8cний Ñ\80озмÑ\96Ñ\80 Â«Ð³Ð°Ñ\80Ñ\8fÑ\87оÑ\97» Ð´Ñ\96лÑ\8fнки Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f."
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Ð\92имкнÑ\83Ñ\82и Ð¿ÐµÑ\80евÑ\96Ñ\80кÑ\83 Ñ\8fкоÑ\81Ñ\82Ñ\96 Ð¿Ð°Ñ\80олÑ\8f (Ñ\8fкÑ\89о Ñ\97Ñ\97 Ñ\83вÑ\96мкнено)."
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr "Тип Ñ\81Ñ\82Ñ\96йкоÑ\81Ñ\82Ñ\96 Â«Ð³Ð°Ñ\80Ñ\8fÑ\87оÑ\97» Ð´Ñ\96лÑ\8fнки Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f (checksum (конÑ\82Ñ\80олÑ\8cна Ñ\81Ñ\83ма), journal (жÑ\83Ñ\80нал), none (немаÑ\94))"
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr "СкоÑ\80иÑ\81Ñ\82аÑ\82иÑ\81Ñ\8f Ð¿Ð°Ñ\80амеÑ\82Ñ\80ом Ñ\81Ñ\83мÑ\96Ñ\81ноÑ\81Ñ\82Ñ\96 Ñ\88видкодÑ\96Ñ\97 dm-crypt same_cpu_crypt."
+#: src/cryptsetup.c:3566
+msgid "Reencryption hotzone checksums hash"
+msgstr "ХеÑ\88 ÐºÐ¾Ð½Ñ\82Ñ\80олÑ\8cниÑ\85 Ñ\81Ñ\83м Â«Ð³Ð°Ñ\80Ñ\8fÑ\87оÑ\97» Ð´Ñ\96лÑ\8fнки Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr ""
-"Скористатися параметром сумісності швидкодії dm-crypt submit_from_crypt_cpus."
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr "Перевизначити автоматично визначені параметри пристрою dm, який буде повторно зашифровано"
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
 msgid "[OPTION...] <action> <action-specific>"
 msgstr "[ПАРАМЕТР...] <дія> <параметри_дії>"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Працюємо у режимі FIPS.\n"
-
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
 msgid "Argument <action> missing."
 msgstr "Не вказано аргумент <дія>."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
 msgid "Unknown action."
 msgstr "Невідома дія."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
-msgstr ""
-"Параметр --shared можна використовувати лише для відкриття незашифрованого "
-"пристрою.\n"
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr "Не можна поєднувати параметри --refresh і --test-passphrase."
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
-msgstr "Параметр --shared можна використовувати лише для дії з відкриття.\n"
+#: src/cryptsetup.c:3718
+msgid "Option --deferred is allowed only for close command."
+msgstr "Параметр --deferred можна використовувати лише для команди закриття (close)."
 
-#: src/cryptsetup.c:1657
-msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
-msgstr ""
-"Параметр --key-size можна використовувати лише для дій luksFormat, open і "
-"benchmark.\n"
-"Щоб обмежити читання з файла ключа, скористайтеся параметром --keyfile-"
-"size=(об’єм у байтах)."
+#: src/cryptsetup.c:3723
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Параметр --shared можна використовувати лише для відкриття незашифрованого пристрою."
 
-#: src/cryptsetup.c:1664
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Параметр --shared можна використовувати лише для дії з відкриття."
+
+#: src/cryptsetup.c:3733
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Параметр --persistent можна використовувати лише для дії з відкриття."
+
+#: src/cryptsetup.c:3738
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "Параметр --serialize-memory-hard-pbkdf можна використовувати лише для дії з відкриття."
+
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "Параметр --persistent не можна використовувати разом із --test-passphrase."
+
+#: src/cryptsetup.c:3753
 msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
 msgstr ""
-"Параметр --test-passphrase можна використовувати лише для відкриття "
-"пристроїв LUKS та TCRYPT.\n"
+"Параметр --key-size можна використовувати лише для luksFormat, luksAddKey,\n"
+"дій open і benchmark. Щоб обмежити читання з файла ключа, скористайтеся параметром --keyfile-size=(об’єм у байтах)."
+
+#: src/cryptsetup.c:3759
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Параметр --integrity можна використовувати лише для luksFormat (LUKS2)."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr "Параметром --integrity-no-wipe можна користуватися лише для дії з форматування із розширенням забезпечення цілісності."
+
+#: src/cryptsetup.c:3770
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Параметри --label і --subsystem можна використовувати лише для дій luksFormat та config для LUKS2."
+
+#: src/cryptsetup.c:3776
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Параметр --test-passphrase можна використовувати лише для відкриття пристроїв LUKS, TCRYPT та BITLK."
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
 msgid "Key size must be a multiple of 8 bits"
 msgstr "Розмір ключа має бути кратним 8 бітам"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
 msgid "Key slot is invalid."
 msgstr "Некоректний слот ключа."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"Параметр --key-file має пріоритет над вказаним параметром файла ключа.\n"
+#: src/cryptsetup.c:3794
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Параметр --key-file має пріоритет над вказаним параметром файла ключа."
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
 msgid "Negative number for option not permitted."
 msgstr "Не можна використовувати від’ємні значення для параметра."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Можна використовувати лише один аргумент --key-file."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
 msgid "Only one of --use-[u]random options is allowed."
 msgstr "Можна використовувати лише один з параметрів --use-[u]random."
 
-#: src/cryptsetup.c:1699
+#: src/cryptsetup.c:3813
 msgid "Option --use-[u]random is allowed only for luksFormat."
-msgstr ""
-"Параметр --use-[u]random можна використовувати лише для дії luksFormat."
+msgstr "Параметр --use-[u]random можна використовувати лише для дії luksFormat."
 
-#: src/cryptsetup.c:1703
+#: src/cryptsetup.c:3817
 msgid "Option --uuid is allowed only for luksFormat and luksUUID."
-msgstr ""
-"Параметр --uuid можна використовувати лише для дій luksFormat і luksUUID."
+msgstr "Параметр --uuid можна використовувати лише для дій luksFormat і luksUUID."
 
-#: src/cryptsetup.c:1707
+#: src/cryptsetup.c:3821
 msgid "Option --align-payload is allowed only for luksFormat."
-msgstr ""
-"Параметр --align-payload можна використовувати лише для дії luksFormat."
+msgstr "Параметр --align-payload можна використовувати лише для дії luksFormat."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Підтримку параметра --skip передбачено лише для відкриття незашифрованих "
-"пристроїв та пристроїв loopaes.\n"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "Параметрами --luks2-metadata-size і --opt-luks2-keyslots-size можна користуватися лише для luksFormat з LUKS2."
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
-msgstr ""
-"Підтримку параметра --offset передбачено лише для відкриття незашифрованих "
-"пристроїв та пристроїв loopaes.\n"
+#: src/cryptsetup.c:3830
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Некоректна специфікація розміру метаданих LUKS2."
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
-msgstr ""
-"Підтримку параметрів --tcrypt-hidden, --tcrypt-system і --tcrypt-backup "
-"передбачено лише для пристроїв TCRYPT.\n"
+#: src/cryptsetup.c:3834
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Некоректна специфікація розміру слоту ключів LUKS2."
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
-msgstr "Ð\9fаÑ\80амеÑ\82Ñ\80 --tcrypt-hidden Ð½Ðµ Ð¼Ð¾Ð¶Ð½Ð° Ð¿Ð¾Ñ\94днÑ\83ваÑ\82и Ð· --allow-discards.\n"
+#: src/cryptsetup.c:3838
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ð¾Ð´Ð½Ð¾Ñ\87аÑ\81но Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82овÑ\83ваÑ\82и Ð¿Ð°Ñ\80амеÑ\82Ñ\80и --align-payload Ñ\96 --offset."
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr ""
-"Підтримку параметра --veracrypt передбачено лише для пристроїв TCRYPT.\n"
+#: src/cryptsetup.c:3844
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Підтримку параметра --skip передбачено лише для відкриття незашифрованих пристроїв та пристроїв loopaes."
+
+#: src/cryptsetup.c:3851
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Підтримку параметра --offset передбачено лише для відкриття незашифрованих пристроїв та пристроїв loopaes, luksFormat та повторного шифрування."
+
+#: src/cryptsetup.c:3857
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Підтримку параметрів --tcrypt-hidden, --tcrypt-system і --tcrypt-backup передбачено лише для пристроїв TCRYPT."
+
+#: src/cryptsetup.c:3862
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Параметр --tcrypt-hidden не можна поєднувати з --allow-discards."
+
+#: src/cryptsetup.c:3867
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Підтримку параметра --veracrypt передбачено лише для пристроїв TCRYPT."
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr "Надано некоректний аргумент для параметра --veracrypt-pim."
+
+#: src/cryptsetup.c:3877
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Параметр --veracrypt-pim можна використовувати лише для сумісних із VeraCrypt пристроїв."
+
+#: src/cryptsetup.c:3885
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Параметр --veracrypt-query-pim можна використовувати лише для сумісних із VeraCrypt пристроїв."
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr "Не можна поєднувати параметри --veracrypt-pim і --veracrypt-query-pim."
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr "Значенням для параметра --priority може бути лише один з таких рядків: ignore, normal або prefer."
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr "Слід вказати специфікація слотів ключів."
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr "Функцією отримання ключа на основі пароля (PBKDF) може бути лише pbkdf2 або argon2i/argon2id."
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr "Примусові ітерації PBKDF не можна поєднувати із параметром тривалості ітерацій."
+
+#: src/cryptsetup.c:3917
+msgid "Sector size option is not supported for this command."
+msgstr "У цій команді не передбачено підтримки параметра розміру сектора."
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr "Підтримку можливості використання великих секторів IV передбачено лише для відкриття пристроїв простого типу з розміром сектора, який перевищує 512 байтів."
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr "Разом із параметром --unbound слід вказувати розмір ключа."
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "Параметр --unbound можна використовувати лише з діями luksAddKey і luksDump."
+
+#: src/cryptsetup.c:3949
+msgid "Option --refresh may be used only with open action."
+msgstr "Параметр --refresh можна використовувати лише під час дії з відкриття (open)."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr "Не вдалося вимкнути блокування метаданих."
+
+#: src/cryptsetup.c:3970
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Некоректна специфікація розміру «гарячої» ділянки повторного шифрування."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Некоректна специфікація розміру пристрою."
+
+#: src/cryptsetup.c:3981
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Максимальний розмір зменшення розміру пристрою дорівнює 1 ГіБ."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Розмір зменшення має бути кратним до 512-байтового сектора."
+
+#: src/cryptsetup.c:3989
+msgid "Invalid data size specification."
+msgstr "Некоректна специфікація розміру даних."
+
+#: src/cryptsetup.c:3994
+msgid "Reduce size overflow."
+msgstr "Переповнення розміру зменшення."
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr "Розшифрування LUKS2 потребує параметра --header."
+
+#: src/cryptsetup.c:4002
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Розмір пристрою має бути кратним до 512-байтового сектора."
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr "Не можна одночасно використовувати параметри --reduce-device-size і --data-size."
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr "Не можна одночасно використовувати параметри --device-size і --size."
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Параметри --ignore-corruption і --restart-on-corruption не можна використовувати одночасно."
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "Вказано некоректний рядок солі."
+
+#: src/veritysetup.c:97
+#, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "Не вдалося створити образ хешу %s для запису."
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
-msgstr "Вказано некоректний рядок солі.\n"
+#: src/veritysetup.c:107
+#, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Не вдалося створити образ FEC %s для запису."
+
+#: src/veritysetup.c:179
+msgid "Invalid root hash string specified."
+msgstr "Вказано некоректний рядок кореневого хешу."
 
-#: src/veritysetup.c:88
+#: src/veritysetup.c:187
 #, c-format
-msgid "Cannot create hash image %s for writing.\n"
-msgstr "Не вдалося створити образ хешу %s для запису.\n"
+msgid "Invalid signature file %s."
+msgstr "Некоректний файл підпису %s."
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
-msgstr "Вказано некоректний рядок кореневого хешу.\n"
+#: src/veritysetup.c:194
+#, c-format
+msgid "Cannot read signature file %s."
+msgstr "Не вдалося прочитати файл підпису %s."
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392
 msgid "<data_device> <hash_device>"
 msgstr "<пристрій_даних> <пристрій_хешу>"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392 src/integritysetup.c:479
 msgid "format device"
 msgstr "форматувати пристрій"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "<data_device> <hash_device> <root_hash>"
 msgstr "<пристрій_даних> <пристрій_хешу> <кореневий_хеш>"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "verify device"
 msgstr "перевірити пристрій"
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<назва> <пристрій_даних> <пристрій_хешу> <кореневий_хеш>"
-
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "створити активний пристрій"
+#: src/veritysetup.c:394
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<пристрій_даних> <назва> <пристрій_хешу> <кореневий_хеш>"
 
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "вилучити пристрій (скасувати активацію)"
-
-#: src/veritysetup.c:312
+#: src/veritysetup.c:396 src/integritysetup.c:482
 msgid "show active device status"
 msgstr "показати стан активного пристрою"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397
 msgid "<hash_device>"
 msgstr "<пристрій_хешу>"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397 src/integritysetup.c:483
 msgid "show on-disk information"
 msgstr "показати вбудовані дані"
 
-#: src/veritysetup.c:332
+#: src/veritysetup.c:416
 #, c-format
 msgid ""
 "\n"
@@ -1571,432 +3107,770 @@ msgstr ""
 "<пристрій_хешу> — пристрій, на якому зберігаються дані для перевірки\n"
 "<кореневий_хеш> — хеш кореневого вузла на пристрої <пристрій_хешу>\n"
 
-#: src/veritysetup.c:339
+#: src/veritysetup.c:423
 #, c-format
 msgid ""
 "\n"
 "Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
 msgstr ""
 "\n"
 "Типові вбудовані параметри dm-verity:\n"
-"\tхеш: %s, блок даних (у байтах): %u, блок хешу (у байтах): %u, розмір солі: "
-"%u, формат хешування: %u\n"
+"\tхеш: %s, блок даних (у байтах): %u, блок хешу (у байтах): %u, розмір солі: %u, формат хешування: %u\n"
 
-#: src/veritysetup.c:377
+#: src/veritysetup.c:466
 msgid "Do not use verity superblock"
 msgstr "Не використовувати суперблок verity"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "Format type (1 - normal, 0 - original Chrome OS)"
 msgstr "Тип форматування (1 — звичайне, 0 — початкове Chrome OS)"
 
-#: src/veritysetup.c:378
+#: src/veritysetup.c:467
 msgid "number"
 msgstr "номер"
 
-#: src/veritysetup.c:379
+#: src/veritysetup.c:468
 msgid "Block size on the data device"
 msgstr "Розмір блоку на пристрої даних"
 
-#: src/veritysetup.c:380
+#: src/veritysetup.c:469
 msgid "Block size on the hash device"
 msgstr "Розмір блоку на пристрої хешу"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "Байти парності FEC"
+
+#: src/veritysetup.c:471
 msgid "The number of blocks in the data file"
 msgstr "Кількість блоків у файлі даних"
 
-#: src/veritysetup.c:381
+#: src/veritysetup.c:471
 msgid "blocks"
 msgstr "блоки"
 
-#: src/veritysetup.c:382
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr "Шлях до пристрою із даними для виправлення помилок"
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr "шлях"
+
+#: src/veritysetup.c:473
 msgid "Starting offset on the hash device"
 msgstr "Початковий відступ на пристрої хешу"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:474
+msgid "Starting offset on the FEC device"
+msgstr "Початковий відступ на пристрої FEC"
+
+#: src/veritysetup.c:475
 msgid "Hash algorithm"
 msgstr "Алгоритм хешування"
 
-#: src/veritysetup.c:383
+#: src/veritysetup.c:475
 msgid "string"
 msgstr "рядок"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "Salt"
 msgstr "Сіль"
 
-#: src/veritysetup.c:384
+#: src/veritysetup.c:476
 msgid "hex string"
 msgstr "шістнадцятковий рядок"
 
-#: src/cryptsetup_reencrypt.c:147
+#: src/veritysetup.c:478
+msgid "Path to root hash signature file"
+msgstr "Шлях до файла підпису кореневого хешу"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Перезапустити ядро, якщо виявлено пошкодження"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Ігнорувати пошкодження, лише записати повідомлення до журналу"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Не перевіряти занулені блоки"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr "Перевіряти блок даних лише під час його першого читання"
+
+#: src/veritysetup.c:582
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Параметри --ignore-corruption, --restart-on-corruption та --ignore-zero-blocks можна використовувати лише для дії з відкриття (open)."
+
+#: src/veritysetup.c:587
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Параметром --root-hash-signature можна користуватися лише для дії з відкриття."
+
+#: src/veritysetup.c:592
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Параметри --ignore-corruption і --restart-on-corruption не можна використовувати одночасно."
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Не вдалося прочитати файл ключа %s."
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Не вдалося прочитати %d байтів з файла ключа %s."
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr "Форматовано із розміром мітки %u, внутрішня цілісність %s.\n"
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+msgid "<integrity_device>"
+msgstr "<пристрій_цілісності>"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr "<пристрій_цілісності> <назва>"
+
+#: src/integritysetup.c:502
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<назва> є пристроєм, який слід створити у %s\n"
+"<пристрій_цілісності> є пристроєм, на якому зберігаються дані із мітками цілісності\n"
+
+#: src/integritysetup.c:507
 #, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
 msgstr ""
-"Не можна відкрити %s у виключному режимі, пристрій вже використовується.\n"
+"\n"
+"Типові компільовані параметри dm-integrity:\n"
+"\tАлгоритм обчислення контрольної суми: %s\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr "Шлях до пристрою даних (якщо відокремлено)"
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "Розмір журналу"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr "Перемежовування секторів"
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr "«Водяний знак» журналу"
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr "відсоток"
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "Час внесення до журналу"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr "мс"
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr "Кількість 512-байтових секторів на біт (режим бітової карти)."
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr "Час спорожнення режиму бітової карти"
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr "Розмір мітки на сектор"
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "Розмір сектора"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "Розмір буферів"
 
-#: src/cryptsetup_reencrypt.c:151
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "Алгоритм забезпечення цілісності даних"
+
+#: src/integritysetup.c:562
+msgid "The size of the data integrity key"
+msgstr "Розмір ключа цілісності даних"
+
+#: src/integritysetup.c:563
+msgid "Read the integrity key from a file"
+msgstr "Прочитати ключ цілісності з файла"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr "Алгоритм забезпечення цілісності журналу"
+
+#: src/integritysetup.c:566
+msgid "The size of the journal integrity key"
+msgstr "Розмір ключа цілісності журналу"
+
+#: src/integritysetup.c:567
+msgid "Read the journal integrity key from a file"
+msgstr "Прочитати ключ цілісності журналу з файла"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "Алгоритм шифрування журналу"
+
+#: src/integritysetup.c:570
+msgid "The size of the journal encryption key"
+msgstr "Розмір ключа шифрування журналу"
+
+#: src/integritysetup.c:571
+msgid "Read the journal encryption key from a file"
+msgstr "Читати ключ шифрування журналу з файла"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr "Режим відновлення (без журналу, без перевірки міток)"
+
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "Використовувати для стеження за змінами бітову карту і вимкнути журнал для пристрою забезпечення цілісності"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr "Обчислювати початкові мітки автоматично."
+
+#: src/integritysetup.c:649
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Параметр --integrity-recalculate можна використовувати лише під час дії з відкриття (open)."
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr "Параметри --journal-size, --interleave-sectors, --sector-size, --tag-size та --no-wipe можна використовувати лише для дії з форматування."
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "Некоректна специфікація розміру журналу."
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "Не можна одночасно вказувати параметри файла ключа і розміру ключа."
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr "Якщо використано ключ цілісності, має бути вказано алгоритм забезпечення цілісності."
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr "Не можна одночасно вказувати параметри файла ключа цілісності журналу і розміру ключа."
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "Якщо використано ключ цілісності журналу, має бути вказано алгоритм забезпечення цілісності журналу."
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "Не можна одночасно вказувати параметри файла ключа шифрування журналу і розміру ключа."
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "Якщо використано ключ шифрування журналу, має бути вказано алгоритм забезпечення шифрування журналу."
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr "Не можна поєднувати параметри відновлення і бітової карти."
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr "Параметри журналу у режимі бітової карти використовувати не можна."
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr "Параметри бітової карти можна використовувати лише у режимі бітового карти."
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "Вже виконується повторне шифрування."
+
+#: src/cryptsetup_reencrypt.c:208
 #, c-format
-msgid "Cannot open device %s\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð²Ñ\96дкÑ\80иÑ\82и Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s\n"
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Ð\9dе Ð¼Ð¾Ð¶Ð½Ð° Ð²Ñ\96дкÑ\80иÑ\82и %s Ñ\83 Ð²Ð¸ÐºÐ»Ñ\8eÑ\87номÑ\83 Ñ\80ежимÑ\96, Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й Ð²Ð¶Ðµ Ð²Ð¸ÐºÐ¾Ñ\80иÑ\81Ñ\82овÑ\83Ñ\94Ñ\82Ñ\8cÑ\81Ñ\8f."
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
-msgstr "Спроба розподілу вирівняних ділянок пам’яті зазнала невдачі.\n"
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "Спроба розподілу вирівняних ділянок пам’яті зазнала невдачі."
 
-#: src/cryptsetup_reencrypt.c:168
+#: src/cryptsetup_reencrypt.c:229
 #, c-format
-msgid "Cannot read device %s.\n"
-msgstr "Не вдалося виконати читання з пристрою %s.\n"
+msgid "Cannot read device %s."
+msgstr "Не вдалося виконати читання з пристрою %s."
 
-#: src/cryptsetup_reencrypt.c:179
+#: src/cryptsetup_reencrypt.c:240
 #, c-format
-msgid "Marking LUKS device %s unusable.\n"
-msgstr "Позначаємо пристрій LUKS %s як непридатний.\n"
+msgid "Marking LUKS1 device %s unusable."
+msgstr "Позначаємо пристрій LUKS1 %s як непридатний."
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "Ð\9fознаÑ\87аÑ\94мо Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й LUKS %s Ñ\8fк Ð¿Ñ\80идаÑ\82ний\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "Ð\92Ñ\81Ñ\82ановлÑ\8eÑ\94мо Ð¿Ñ\80апоÑ\80еÑ\86Ñ\8c Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f LUKS2 Ð· Ð²Ñ\96д'Ñ\94днаннÑ\8fм Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80Ñ\96й %s."
 
-#: src/cryptsetup_reencrypt.c:200
+#: src/cryptsetup_reencrypt.c:261
 #, c-format
-msgid "Cannot write device %s.\n"
-msgstr "Не вдалося виконати запис на пристрій %s.\n"
+msgid "Cannot write device %s."
+msgstr "Не вдалося виконати запис на пристрій %s."
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
-msgstr "Не вдалося записати файл журналу повторного шифрування.\n"
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "Не вдалося записати файл журналу повторного шифрування."
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
-msgstr "Не вдалося прочитати файл журналу повторного шифрування.\n"
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "Не вдалося прочитати файл журналу повторного шифрування."
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
 msgstr "Файл журналу %s вже існує, поновлюємо повторне шифрування.\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
-msgstr ""
-"Спроба задіяти тимчасовий пристрій за допомогою старого заголовка LUKS.\n"
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "Спроба задіяти тимчасовий пристрій за допомогою старого заголовка LUKS."
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
-msgstr ""
-"Спроба задіяти тимчасовий пристрій за допомогою нового заголовка LUKS.\n"
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "Спроба задіяти тимчасовий пристрій за допомогою нового заголовка LUKS."
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
-msgstr "Спроба задіяти тимчасові пристрої зазнала невдачі.\n"
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "Спроба задіяти тимчасові пристрої зазнала невдачі."
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
-msgstr "Створено новий заголовок LUKS для пристрою %s.\n"
+#: src/cryptsetup_reencrypt.c:559
+msgid "Failed to set data offset."
+msgstr "Не вдалося встановити відступ у даних."
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:565
+msgid "Failed to set metadata size."
+msgstr "Не вдалося встановити розмір метаданих."
+
+#: src/cryptsetup_reencrypt.c:573
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Ð\97адÑ\96Ñ\8fний Ñ\81лоÑ\82 ÐºÐ»Ñ\8eÑ\87а %i.\n"
+msgid "New LUKS header for device %s created."
+msgstr "СÑ\82воÑ\80ено Ð½Ð¾Ð²Ð¸Ð¹ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº LUKS Ð´Ð»Ñ\8f Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e %s."
 
-#: src/cryptsetup_reencrypt.c:484
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "LUKS header backup of device %s created.\n"
-msgstr "Створено резервну копію заголовка LUKS пристрою %s.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "Ця версія cryptsetup-reencrypt не може обробляти новий тип вбудованих ключів %s."
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "Не вдалося прочитати прапорці активації з резервного заголовка."
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
-msgstr "СпÑ\80оба Ñ\81Ñ\82воÑ\80еннÑ\8f Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÑ\96в Ñ\80езеÑ\80вниÑ\85 ÐºÐ¾Ð¿Ñ\96й LUKS Ð·Ð°Ð·Ð½Ð°Ð»Ð° Ð½ÐµÐ²Ð´Ð°Ñ\87Ñ\96.\n"
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð·Ð°Ð¿Ð¸Ñ\81аÑ\82и Ð¿Ñ\80апоÑ\80Ñ\86Ñ\96 Ð°ÐºÑ\82иваÑ\86Ñ\96Ñ\97 Ð´Ð¾ Ð½Ð¾Ð²Ð¾Ð³Ð¾ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ°."
 
-#: src/cryptsetup_reencrypt.c:634
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "Не вдалося прочитати вимоги із резервного заголовка."
+
+#: src/cryptsetup_reencrypt.c:705
 #, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
-msgstr "Не вдалося відновити заголовок LUKS на пристрої %s.\n"
+msgid "%s header backup of device %s created."
+msgstr "Створено резервну копію заголовка %s пристрою %s."
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "Спроба створення заголовків резервних копій LUKS зазнала невдачі."
 
-#: src/cryptsetup_reencrypt.c:636
+#: src/cryptsetup_reencrypt.c:901
 #, c-format
-msgid "LUKS header on device %s restored.\n"
-msgstr "Ð\92Ñ\96дновлено Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº LUKS Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 %s.\n"
+msgid "Cannot restore %s header on device %s."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð²Ñ\96дновиÑ\82и Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²Ð¾Ðº %s Ð½Ð° Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97 %s."
 
-#: src/cryptsetup_reencrypt.c:669
+#: src/cryptsetup_reencrypt.c:903
 #, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Поступ: %5.1f%%, час до завершення: %02llu:%02llu, записано %4llu МіБ, "
-"швидкість %5.1f МіБ/с%s"
+msgid "%s header on device %s restored."
+msgstr "Відновлено заголовок %s на пристрої %s."
 
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Не вдалося встановити вказану позицію на пристрої.\n"
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "Неможливо відкрити тимчасовий пристрій LUKS."
 
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð²Ñ\96дкÑ\80иÑ\82и Ñ\84айл Ñ\82имÑ\87аÑ\81ового Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ° LUKS.\n"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¾Ñ\82Ñ\80имаÑ\82и Ð´Ð°Ð½Ñ\96 Ñ\89одо Ñ\80озмÑ\96Ñ\80Ñ\83 Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e."
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¾Ñ\82Ñ\80имаÑ\82и Ð´Ð°Ð½Ñ\96 Ñ\89одо Ñ\80озмÑ\96Ñ\80Ñ\83 Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\8e.\n"
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "Ð\9fомилка Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ñ\8f-виведеннÑ\8f Ð¿Ñ\96д Ñ\87аÑ\81 Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f."
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Ð\9fеÑ\80еÑ\80вано Ð·Ð° Ñ\81игналом.\n"
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "Ð\9dаданий UUID Ñ\94 Ð½ÐµÐºÐ¾Ñ\80екÑ\82ним."
 
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
-msgstr "Ð\9fомилка Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ñ\8f-виведеннÑ\8f Ð¿Ñ\96д Ñ\87аÑ\81 Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f.\n"
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð²Ñ\96дкÑ\80иÑ\82и Ñ\84айл Ð¶Ñ\83Ñ\80налÑ\83 Ð¿Ð¾Ð²Ñ\82оÑ\80ного Ñ\88иÑ\84Ñ\80Ñ\83ваннÑ\8f."
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"Файлом ключа можна користуватися лише з --key-slot, або якщо активним є лише "
-"один слот ключа.\n"
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Розшифровування не виконується. Наданий UUID можна використовувати лише для відновлення призупиненого процесу розшифровування."
 
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
+#: src/cryptsetup_reencrypt.c:1504
 #, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Ð\92кажÑ\96Ñ\82Ñ\8c Ð¿Ð°Ñ\80олÑ\8c Ð´Ð»Ñ\8f Ñ\81лоÑ\82Ñ\83 ÐºÐ»Ñ\8eÑ\87а %u: "
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "Ð\97мÑ\96нено Ð¿Ð°Ñ\80амеÑ\82Ñ\80и pbkdf Ñ\83 Ñ\81лоÑ\82Ñ\96 ÐºÐ»Ñ\8eÑ\87а %i."
 
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
-msgstr "Не вдалося відкрити файл журналу повторного шифрування.\n"
-
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "Reencryption block size"
 msgstr "Розмір блоку повторного шифрування"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "MiB"
 msgstr "МіБ"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
-msgstr "Не змінювати ключ, не виконувати повторного шифрування області даних."
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "Не змінювати ключ, не виконувати повторного шифрування області даних"
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
-msgstr ""
-"Використовувати безпосереднє введення-виведення під час доступу до пристроїв."
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "Прочитати новий ключ тому (основний ключ) з файла"
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
-msgstr "Ð\92икоÑ\80иÑ\81Ñ\82овÑ\83ваÑ\82и fsync Ð¿Ñ\96Ñ\81лÑ\8f ÐºÐ¾Ð¶Ð½Ð¾Ð³Ð¾ Ð±Ð»Ð¾ÐºÑ\83."
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "ТÑ\80ивалÑ\96Ñ\81Ñ\82Ñ\8c Ñ\96Ñ\82еÑ\80аÑ\86Ñ\96Ñ\97 PBKDF2 Ð´Ð»Ñ\8f LUKS (Ñ\83 Ð¼Ñ\81)"
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
-msgstr "Ð\9eновлÑ\8eваÑ\82и Ñ\84айл Ð¶Ñ\83Ñ\80налÑ\83 Ð¿Ñ\96Ñ\81лÑ\8f ÐºÐ¾Ð¶Ð½Ð¾Ð³Ð¾ Ð±Ð»Ð¾ÐºÑ\83."
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "Ð\92икоÑ\80иÑ\81Ñ\82овÑ\83ваÑ\82и Ð±ÐµÐ·Ð¿Ð¾Ñ\81еÑ\80еднÑ\94 Ð²Ð²ÐµÐ´ÐµÐ½Ð½Ñ\8f-виведеннÑ\8f Ð¿Ñ\96д Ñ\87аÑ\81 Ð´Ð¾Ñ\81Ñ\82Ñ\83пÑ\83 Ð´Ð¾ Ð¿Ñ\80иÑ\81Ñ\82Ñ\80оÑ\97в"
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
-msgstr "Використовувати лише цей слот (інші буде вимкнено)."
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "Використовувати fsync після кожного блоку"
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
-"Зменшити розмір пристрою зберігання даних (змістити відступ даних). "
-"НЕБЕЗПЕЧНО!"
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "Оновлювати файл журналу після кожного блоку"
 
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Використовувати лише вказаний розмір пристрою (ігнорувати решту об’єму). "
-"НЕБЕЗПЕЧНО!"
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "Використовувати лише цей слот (інші буде вимкнено)"
 
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
-msgstr "Створити новий заголовок на незашифрованому пристрої."
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "Створити новий заголовок на незашифрованому пристрої"
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
 msgstr "Остаточно розшифрувати пристрій (скасувати шифрування)"
 
-#: src/cryptsetup_reencrypt.c:1298
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "UUID, що використовується для відновлення розшифровування"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Тип метаданих LUKS (luks1 або luks2)"
+
+#: src/cryptsetup_reencrypt.c:1659
 msgid "[OPTION...] <device>"
 msgstr "[ПАРАМЕТР...] <пристрій>"
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
-"ПОПЕРЕДЖЕННЯ: цей код не перевірено достатнім чином, його використання може "
-"призвести до незворотного пошкодження даних.\n"
-
-#: src/cryptsetup_reencrypt.c:1313
+#: src/cryptsetup_reencrypt.c:1667
 #, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
-msgstr "Повторне шифрування призведе до зміни: ключа тому%s%s%s%s.\n"
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "Повторне шифрування призведе до зміни: %s%s%s%s%s%s."
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "ключ тому"
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid "set hash to "
-msgstr "встановити хеш у значення "
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "встановити хеш у значення "
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ", встановити шифрування "
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr "Слід вказати аргумент."
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Розмір блоку повторного шифрування повинен належати діапазону від 1 МіБ до "
-"64 МІБ."
-
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Некоректна специфікація розміру пристрою."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Розмір блоку повторного шифрування повинен належати діапазону від 1 МіБ до 64 МІБ."
 
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
 msgstr "Максимальний розмір зменшення розміру пристрою дорівнює 64 МіБ."
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Розмір зменшення має бути кратним до 512-байтового сектора."
-
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
-msgstr "Параметр --new слід використовувати разом з --reduce-device-size."
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "Параметр --new слід використовувати разом з --reduce-device-size або --header."
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
-msgstr ""
-"Параметр --keep-key можна використовувати лише разом з параметром --hash або "
-"--iter-time."
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "Параметр --keep-key можна використовувати лише разом з параметром --hash --iter-time або --pbkdf-force-iterations."
 
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr "Параметр --new не можна використовувати разом з --decrypt."
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
 msgstr "Параметр --decrypt є несумісним із вказаними параметрами."
 
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Параметр --uuid можна використовувати лише разом із --decrypt."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "Некоректний тип luks. Скористайтеся одним з таких типів: luks, luks1 або luks2."
+
 #: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
-msgstr "Помилка під час спроби читання відповіді з термінала.\n"
+msgid "Error reading response from terminal."
+msgstr "Помилка під час спроби читання відповіді з термінала."
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Команду виконано успішно.\n"
 
-#: src/utils_tools.c:191
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "помилкові параметри або параметри не вказано"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "немає права доступу або помилковий пароль"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "недостатньо пам'яті"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "вказано помилковий пристрій або файл"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "пристрій вже існує або пристрій зайнято"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "невідома помилка"
+
+#: src/utils_tools.c:206
 #, c-format
-msgid "Command failed with code %i"
-msgstr ""
-"Спроба виконання команди завершилася повідомленням про помилку з кодом %i"
+msgid "Command failed with code %i (%s).\n"
+msgstr "Спроба виконання команди завершилася повідомленням про помилку з кодом %i (%s).\n"
 
-#: src/utils_password.c:42
+#: src/utils_tools.c:283
 #, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Ð\9dе Ð²Ð´Ð°Ð»Ð¾Ñ\81Ñ\8f Ð¿ÐµÑ\80евÑ\96Ñ\80иÑ\82и Ñ\8fкÑ\96Ñ\81Ñ\82Ñ\8c Ð¿Ð°Ñ\80олÑ\8f: %s\n"
+msgid "Key slot %i created."
+msgstr "СÑ\82воÑ\80ено Ñ\81лоÑ\82 ÐºÐ»Ñ\8eÑ\87а %i."
 
-#: src/utils_password.c:50
+#: src/utils_tools.c:285
 #, c-format
+msgid "Key slot %i unlocked."
+msgstr "Слот ключа %i розблоковано."
+
+#: src/utils_tools.c:287
+#, c-format
+msgid "Key slot %i removed."
+msgstr "Слот ключа %i вилучено."
+
+#: src/utils_tools.c:296
+#, c-format
+msgid "Token %i created."
+msgstr "Створено ключ %i."
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr "Ключ %i вилучено."
+
+#: src/utils_tools.c:464
 msgid ""
-"Password quality check failed:\n"
-" %s\n"
+"\n"
+"Wipe interrupted."
 msgstr ""
-"Помилка під час спроби оцінити якість пароля:\n"
-" %s\n"
+"\n"
+"Витирання перервано."
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr "Попередження: пристрій %s вже містить підпис розділу «%s».\n"
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr "Попередження: пристрій %s вже містить підпис суперблоку «%s».\n"
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+msgid "Failed to initialize device signature probes."
+msgstr "Не вдалося ініціалізувати зондування підписів пристроїв."
 
-#~ msgid "FIPS checksum verification failed.\n"
-#~ msgstr "Контрольні суми FIPS не збігаються.\n"
+#: src/utils_tools.c:548
+#, c-format
+msgid "Failed to stat device %s."
+msgstr "Не вдалося зібрати статистичні дані щодо пристрою %s."
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr "Пристрій %s використовується сторонньою програмою. Продовження дій з форматування неможливе."
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "Не вдалося відкрити файл %s у режимі читання-запису."
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Наявний підпис розділу «%s» (зміщення: %<PRIi64> байтів) на пристрої %s буде витерто."
 
-#~ msgid ""
-#~ "WARNING: device %s is a partition, for TCRYPT system encryption you "
-#~ "usually need to use whole block device path.\n"
-#~ msgstr ""
-#~ "Попередження: пристрій %s є розділом; для шифрування системи за допомогою "
-#~ "TCRYPT, зазвичай, вам слід використовувати шлях до цілого блокового "
-#~ "пристрою.\n"
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr "Наявний підпис суперблоку «%s» (зміщення: %<PRIi64> байтів) на пристрої %s буде витерто."
 
-#~ msgid "Kernel doesn't support plain64 IV.\n"
-#~ msgstr "У ядрі не передбачено підтримки plain64 IV.\n"
+#: src/utils_tools.c:583
+msgid "Failed to wipe device signature."
+msgstr "Не вдалося витерти підпис пристрою."
 
-#~ msgid "Enter LUKS passphrase: "
-#~ msgstr "Введіть пароль LUKS: "
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Не вдалося виконати зондування пристрою %s з метою виявлення підпису."
 
-#~ msgid "Enter new LUKS passphrase: "
-#~ msgstr "Введіть новий пароль LUKS: "
+#: src/utils_tools.c:629
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr ""
+"\n"
+"Повторне шифрування перервано."
 
-#~ msgid "Enter any LUKS passphrase: "
-#~ msgstr "Введіть довільний пароль LUKS: "
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Не вдалося перевірити якість пароля: %s"
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr "Не вдалося отримати каталог призначених пристроїв."
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+"Помилка під час спроби оцінити якість пароля:\n"
+" %s"
 
-#~ msgid "Backup file %s doesn't exist.\n"
-#~ msgstr "Файла резервної копії, %s, не існує.\n"
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Помилка під час спроби оцінити якість пароля: некоректний пароль (%s)"
 
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Не вдалося відкрити файл %s.\n"
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "Помилка під час читання пароля з термінала."
 
-#~ msgid "<name> <device>"
-#~ msgstr "<назва> <пристрій>"
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Перевірка пароля: "
 
-#~ msgid "create device"
-#~ msgstr "створити пристрій"
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "Паролі не збігаються."
 
-#~ msgid "remove device"
-#~ msgstr "вилучити пристрій"
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "Не можна використовувати відступ у даних, що надходять з термінала."
 
-#~ msgid "remove LUKS mapping"
-#~ msgstr "вилучити призначення LUKS"
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Введіть пароль: "
 
-#~ msgid "open loop-AES device as mapping <name>"
-#~ msgstr "відкрити пристрій loop-AES як призначення <назва>"
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Введіть пароль до %s: "
 
-#~ msgid "remove loop-AES mapping"
-#~ msgstr "вилучити призначення loop-AES"
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "Для цього пароля немає відповідного ключа."
 
-#~ msgid ""
-#~ "Option --allow-discards is allowed only for luksOpen, loopaesOpen and "
-#~ "create operation.\n"
-#~ msgstr ""
-#~ "Параметр --allow-discards можна використовувати лише для дій luksOpen, "
-#~ "loopaesOpen і create.\n"
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr "Немає доступних придатних до користування слотів ключів."
 
-#~ msgid "Cannot open device %s for %s%s access.\n"
-#~ msgstr "Не вдалося відкрити пристрій %s для доступу %s%s.\n"
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Не вдалося відкрити файл ключа %s для запису."
 
-#~ msgid "exclusive "
-#~ msgstr "ексклюзивний "
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Не вдалося виконати запису до файла ключа %s."
 
-#~ msgid "writable"
-#~ msgstr "придатний до запису"
+#: src/utils_luks2.c:47
+#, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Не вдалося відкрити файл %s у режимі лише читання."
 
-#~ msgid "read-only"
-#~ msgstr "тільки читання"
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr "Надайте коректний ключ JSON LUKS2:\n"
 
-#~ msgid "WARNING!!! Possibly insecure memory. Are you root?\n"
-#~ msgstr ""
-#~ "УВАГА!!! Небезпека доступу до даних у пам’яті. Працюєте від імені "
-#~ "адміністратора?\n"
+#: src/utils_luks2.c:67
+msgid "Failed to read JSON file."
+msgstr "Не вдалося прочитати файл JSON."
 
-#~ msgid "Unable to obtain sector size for %s"
-#~ msgstr "Не вдалося отримати розмір сектора %s"
+#: src/utils_luks2.c:72
+msgid ""
+"\n"
+"Read interrupted."
+msgstr ""
+"\n"
+"Читання перервано."
 
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Не вдалося виконати запис до сховища ключів.\n"
+#: src/utils_luks2.c:113
+#, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Не вдалося відкрити файл %s у режимі запису."
 
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr "Не вдалося виконати читання даних зі сховища ключів.\n"
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+"\n"
+"Запис перервано."
 
-#~ msgid ""
-#~ "Cannot use device %s (crypt segments overlaps or in use by another "
-#~ "device).\n"
-#~ msgstr ""
-#~ "Використання пристрою %s неможливе (сегменти шифрування перекриваються "
-#~ "або використовуються іншим пристроєм).\n"
+#: src/utils_luks2.c:126
+msgid "Failed to write JSON file."
+msgstr "Не вдалося записати файл JSON."
index 73a2a9c..26dba1b 100644 (file)
Binary files a/po/vi.gmo and b/po/vi.gmo differ
index 42b446d..b1aa5d1 100644 (file)
--- a/po/vi.po
+++ b/po/vi.po
 # Vietnamese translation for CryptSetup.
 # Bản dịch tiếng Việt dành cho cryptsetup.
-# Copyright © 2015 Free Software Foundation, Inc.
+# Copyright © 2016 Free Software Foundation, Inc.
 # This file is distributed under the same license as the cryptsetup package.
 # Clytie Siddall <clytie@riverland.net.au>, 2010.
-# Trần Ngọc Quân <vnwildman@gmail.com>, 2012-2014, 2015.
+# Trần Ngọc Quân <vnwildman@gmail.com>, 2012-2014, 2015, 2016, 2017.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: cryptsetup 1.6.7\n"
+"Project-Id-Version: cryptsetup 1.7.4\n"
 "Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
-"POT-Creation-Date: 2015-03-19 09:55+0100\n"
-"PO-Revision-Date: 2015-03-20 07:43+0700\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2017-03-05 15:08+0700\n"
 "Last-Translator: Trần Ngọc Quân <vnwildman@gmail.com>\n"
 "Language-Team: Vietnamese <translation-team-vi@lists.sourceforge.net>\n"
 "Language: vi\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
 "Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Gtranslator 2.91.7\n"
 
-#: lib/libdevmapper.c:252
-msgid "Cannot initialize device-mapper, running as non-root user.\n"
-msgstr ""
-"Không thể khởi tạo ánh-xạ-thiết-bị (device-mapper), do không chạy dưới quyền "
-"siêu người dùng.\n"
+#: lib/libdevmapper.c:399
+#, fuzzy
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "Không thể khởi tạo ánh-xạ-thiết-bị (device-mapper), do không chạy dưới quyền siêu người dùng.\n"
 
-#: lib/libdevmapper.c:255
-msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?\n"
+#: lib/libdevmapper.c:402
+#, fuzzy
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
 msgstr ""
 "Không thể khởi tạo tiến trình ánh xạ thiết bị.\n"
 "Mô-đun hạt nhân “dm_mod” được nạp chưa?\n"
 
-#: lib/libdevmapper.c:550
-#, c-format
-msgid "DM-UUID for device %s was truncated.\n"
+#: lib/libdevmapper.c:1131
+#, fuzzy
+msgid "Requested deferred flag is not supported."
+msgstr "Không hỗ trợ chuỗi duy nhất LUKS %s được yêu cầu.\n"
+
+#: lib/libdevmapper.c:1198
+#, fuzzy, c-format
+msgid "DM-UUID for device %s was truncated."
 msgstr "Mã số DM-UUID cho thiết bị %s bị cắt ngắn.\n"
 
-#: lib/libdevmapper.c:698
-msgid "Requested dmcrypt performance options are not supported.\n"
-msgstr "Không hỗ trợ tùy chọn hiệu năng dmcrypt đã yêu cầu.\n"
+#: lib/libdevmapper.c:1520
+msgid "Unknown dm target type."
+msgstr ""
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+#, fuzzy
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "Không hỗ trợ tùy chọn hiệu năng dm-crypt đã yêu cầu.\n"
+
+#: lib/libdevmapper.c:1630
+#, fuzzy
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "Không hỗ trợ tùy chọn xử lý dữ liệu sai hỏng dm-verity đã yêu cầu.\n"
+
+#: lib/libdevmapper.c:1634
+#, fuzzy
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "Không hỗ trợ tùy chọn hiệu năng dm-crypt đã yêu cầu.\n"
+
+#: lib/libdevmapper.c:1638
+#, fuzzy
+msgid "Requested data integrity options are not supported."
+msgstr "Không hỗ trợ tùy chọn hiệu năng dm-crypt đã yêu cầu.\n"
+
+#: lib/libdevmapper.c:1640
+#, fuzzy
+msgid "Requested sector_size option is not supported."
+msgstr "Không hỗ trợ tùy chọn hiệu năng dm-crypt đã yêu cầu.\n"
+
+#: lib/libdevmapper.c:1645
+#, fuzzy
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "Không hỗ trợ tùy chọn xử lý dữ liệu sai hỏng dm-verity đã yêu cầu.\n"
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+#, fuzzy
+msgid "Discard/TRIM is not supported."
+msgstr "Thuật toán băm %s không được hỗ trợ.\n"
+
+#: lib/libdevmapper.c:1653
+#, fuzzy
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "Không hỗ trợ tùy chọn xử lý dữ liệu sai hỏng dm-verity đã yêu cầu.\n"
 
-#: lib/random.c:76
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr ""
+
+#: lib/random.c:75
 msgid ""
 "System is out of entropy while generating volume key.\n"
-"Please move mouse or type some text in another window to gather some random "
-"events.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
 msgstr ""
 "Hệ thống bị nằm ngoài en-trô-pi trong khi tạo khóa vùng chứa.\n"
-"Xin hãy di chuyển con chuột hay gõ vài chữ trong cửa sổ khác để thu thập sự "
-"kiện ngẫu nhiên.\n"
+"Xin hãy di chuyển con chuột hay gõ vài chữ trong cửa sổ khác để thu thập sự kiện ngẫu nhiên.\n"
 
-#: lib/random.c:80
+#: lib/random.c:79
 #, c-format
 msgid "Generating key (%d%% done).\n"
 msgstr "Đang tạo khóa (xong %d%%).\n"
 
-#: lib/random.c:169
-msgid "Fatal error during RNG initialisation.\n"
+#: lib/random.c:165
+#, fuzzy
+msgid "Running in FIPS mode."
+msgstr "Đang chạy trong chế độ FIPS.\n"
+
+#: lib/random.c:171
+#, fuzzy
+msgid "Fatal error during RNG initialisation."
 msgstr "Gặp lỗi nghiêm trọng trong quá trình khởi tạo RNG.\n"
 
-#: lib/random.c:206
-msgid "Unknown RNG quality requested.\n"
+#: lib/random.c:208
+#, fuzzy
+msgid "Unknown RNG quality requested."
 msgstr "Không hiểu chất lượng RNG đã yêu cầu.\n"
 
-#: lib/random.c:211
-#, c-format
-msgid "Error %d reading from RNG: %s\n"
+#: lib/random.c:213
+#, fuzzy
+msgid "Error reading from RNG."
 msgstr "Lỗi %d khi đọc từ RNG: %s\n"
 
-#: lib/setup.c:200
-msgid "Cannot initialize crypto RNG backend.\n"
+#: lib/setup.c:229
+#, fuzzy
+msgid "Cannot initialize crypto RNG backend."
 msgstr "Không thể khởi tạo ứng dụng chạy ở phía sau (backend) mã hóa RNG.\n"
 
-#: lib/setup.c:206
-msgid "Cannot initialize crypto backend.\n"
+#: lib/setup.c:235
+#, fuzzy
+msgid "Cannot initialize crypto backend."
 msgstr "Không thể khởi ứng dụng mã hóa chạy ở phía sau (backend).\n"
 
-#: lib/setup.c:236 lib/setup.c:1192 lib/verity/verity.c:123
-#, c-format
-msgid "Hash algorithm %s not supported.\n"
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, fuzzy, c-format
+msgid "Hash algorithm %s not supported."
 msgstr "Thuật toán băm %s không được hỗ trợ.\n"
 
-#: lib/setup.c:239 lib/loopaes/loopaes.c:90
-#, c-format
-msgid "Key processing error (using hash %s).\n"
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, fuzzy, c-format
+msgid "Key processing error (using hash %s)."
 msgstr "Lỗi xử lý khóa (dùng mã băm %s).\n"
 
-#: lib/setup.c:284
-msgid "Cannot determine device type. Incompatible activation of device?\n"
-msgstr ""
-"Không thể dò tìm kiểu thiết bị. Phần hoạt hóa của thiết bị không tương thích "
-"à?\n"
+#: lib/setup.c:335 lib/setup.c:362
+#, fuzzy
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "Không thể dò tìm kiểu thiết bị. Phần hoạt hóa của thiết bị không tương thích à?\n"
+
+#: lib/setup.c:341 lib/setup.c:3050
+#, fuzzy
+msgid "This operation is supported only for LUKS device."
+msgstr "Thao tác này được hỗ trợ chỉ cho thiết bị LUKS.\n"
 
-#: lib/setup.c:288 lib/setup.c:1537
-msgid "This operation is supported only for LUKS device.\n"
+#: lib/setup.c:368
+#, fuzzy
+msgid "This operation is supported only for LUKS2 device."
 msgstr "Thao tác này được hỗ trợ chỉ cho thiết bị LUKS.\n"
 
-#: lib/setup.c:320
-msgid "All key slots full.\n"
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+#, fuzzy
+msgid "All key slots full."
 msgstr "Mọi khe khóa đều đã đầy.\n"
 
-#: lib/setup.c:327
-#, c-format
-msgid "Key slot %d is invalid, please select between 0 and %d.\n"
-msgstr ""
-"Khe khóa %d không đúng, hãy chọn một giá trị trong phạm vi từ 0 đến %d.\n"
+#: lib/setup.c:434
+#, fuzzy, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "Khe khóa %d không đúng, hãy chọn một giá trị trong phạm vi từ 0 đến %d.\n"
 
-#: lib/setup.c:333
-#, c-format
-msgid "Key slot %d is full, please select another one.\n"
+#: lib/setup.c:440
+#, fuzzy, c-format
+msgid "Key slot %d is full, please select another one."
 msgstr "Khe khóa %d bị đầy, hãy chọn một khe khác.\n"
 
-#: lib/setup.c:472
-#, c-format
-msgid "Enter passphrase for %s: "
-msgstr "Nhập cụm từ mật khẩu cho %s: "
+#: lib/setup.c:525 lib/setup.c:2824
+#, fuzzy
+msgid "Device size is not aligned to device logical block size."
+msgstr "Thiết bị %s không phải là một thiết bị kiểu LUKS đúng.\n"
 
-#: lib/setup.c:653
-#, c-format
-msgid "Header detected but device %s is too small.\n"
+#: lib/setup.c:624
+#, fuzzy, c-format
+msgid "Header detected but device %s is too small."
 msgstr "Phát hiện được phần đầu nhưng mà thiết bị %s quá nhỏ.\n"
 
-#: lib/setup.c:669 lib/setup.c:1420
-msgid "This operation is not supported for this device type.\n"
+#: lib/setup.c:661
+#, fuzzy
+msgid "This operation is not supported for this device type."
 msgstr "Thao tác này không được hỗ trợ cho kiểu thiết bị này.\n"
 
-#: lib/setup.c:908 lib/setup.c:1381 lib/setup.c:2264
-#, c-format
-msgid "Device %s is not active.\n"
+#: lib/setup.c:666
+msgid "Illegal operation with reencryption in-progress."
+msgstr ""
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, fuzzy, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "Phiên bản LUKS không được hỗ trợ %d.\n"
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+#, fuzzy
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "UUID không hỗ trợ kiểu mã hóa này.\n"
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, fuzzy, c-format
+msgid "Device %s is not active."
 msgstr "Thiết bị %s không hoạt động.\n"
 
-#: lib/setup.c:925
-#, c-format
-msgid "Underlying device for crypt device %s disappeared.\n"
+#: lib/setup.c:1444
+#, fuzzy, c-format
+msgid "Underlying device for crypt device %s disappeared."
 msgstr "Thiết bị nằm dưới cho thiết bị crypt %s đã bị biến mất.\n"
 
-#: lib/setup.c:994
-msgid "Invalid plain crypt parameters.\n"
+#: lib/setup.c:1524
+#, fuzzy
+msgid "Invalid plain crypt parameters."
 msgstr "Đặt sai tham số mã hóa bình thường.\n"
 
-#: lib/setup.c:999 lib/setup.c:1119
-msgid "Invalid key size.\n"
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+#, fuzzy
+msgid "Invalid key size."
 msgstr "Kích cỡ khóa không đúng.\n"
 
-#: lib/setup.c:1004 lib/setup.c:1124
-msgid "UUID is not supported for this crypt type.\n"
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+#, fuzzy
+msgid "UUID is not supported for this crypt type."
 msgstr "UUID không hỗ trợ kiểu mã hóa này.\n"
 
-#: lib/setup.c:1046
-msgid "Can't format LUKS without device.\n"
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+#, fuzzy
+msgid "Unsupported encryption sector size."
+msgstr "Không đọc được tập tin nhật ký reencryption.\n"
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+#, fuzzy
+msgid "Device size is not aligned to requested sector size."
+msgstr "Thiết bị %s không phải là một thiết bị kiểu LUKS đúng.\n"
+
+#: lib/setup.c:1608 lib/setup.c:1727
+#, fuzzy
+msgid "Can't format LUKS without device."
 msgstr "Không thể định dạng “LUKS” mà không có thiết bị.\n"
 
-#: lib/setup.c:1089
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr ""
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr ""
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, fuzzy, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "Không thể tẩy xóa phần đầu trên thiết bị %s.\n"
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr ""
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr ""
+
+#: lib/setup.c:1821
+#, fuzzy, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "Mã hóa kiểu %s không sẵn có.\n"
+
+#: lib/setup.c:1854
 #, c-format
-msgid "Cannot format device %s which is still in use.\n"
-msgstr "Không thể định dạng thiết bị %s mà nó lại vẫn đang được sử dụng.\n"
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr ""
 
-#: lib/setup.c:1092
+#: lib/setup.c:1858
 #, c-format
-msgid "Cannot format device %s, permission denied.\n"
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, fuzzy, c-format
+msgid "Device %s is too small."
+msgstr "Thiết bị %s có kích cỡ quá nhỏ.\n"
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, fuzzy, c-format
+msgid "Cannot format device %s in use."
+msgstr "Không thể định dạng thiết bị %s mà nó lại vẫn đang được sử dụng.\n"
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, fuzzy, c-format
+msgid "Cannot format device %s, permission denied."
 msgstr "Không thể định dạng thiết bị %s, không đủ thẩm quyền.\n"
 
-#: lib/setup.c:1096
-#, c-format
-msgid "Cannot wipe header on device %s.\n"
-msgstr "Không thể tẩy xóa phần đầu trên thiết bị %s.\n"
+#: lib/setup.c:1908 lib/setup.c:2229
+#, fuzzy, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "Không thể ghi thiết bị %s.\n"
+
+#: lib/setup.c:1926
+#, fuzzy, c-format
+msgid "Cannot format device %s."
+msgstr "Không thể đọc thiết bị %s.\n"
 
-#: lib/setup.c:1114
-msgid "Can't format LOOPAES without device.\n"
+#: lib/setup.c:1944
+#, fuzzy
+msgid "Can't format LOOPAES without device."
 msgstr "Không thể định dạng “LOOPAES” bên ngoài thiết bị.\n"
 
-#: lib/setup.c:1152
-msgid "Can't format VERITY without device.\n"
+#: lib/setup.c:1989
+#, fuzzy
+msgid "Can't format VERITY without device."
 msgstr "Không thể định dạng “VERITY” mà không có thiết bị.\n"
 
-#: lib/setup.c:1160 lib/verity/verity.c:106
-#, c-format
-msgid "Unsupported VERITY hash type %d.\n"
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, fuzzy, c-format
+msgid "Unsupported VERITY hash type %d."
 msgstr "Kiểu băm “VERITY” %d không được hỗ trợ.\n"
 
-#: lib/setup.c:1166 lib/verity/verity.c:114
-msgid "Unsupported VERITY block size.\n"
+#: lib/setup.c:2006 lib/verity/verity.c:110
+#, fuzzy
+msgid "Unsupported VERITY block size."
 msgstr "Kích thước khối “VERITY” không được hỗ trợ.\n"
 
-#: lib/setup.c:1171 lib/verity/verity.c:76
-msgid "Unsupported VERITY hash offset.\n"
+#: lib/setup.c:2011 lib/verity/verity.c:74
+#, fuzzy
+msgid "Unsupported VERITY hash offset."
+msgstr "Khoảng bù (offset) mã băm “VERITY” không được hỗ trợ.\n"
+
+#: lib/setup.c:2016
+#, fuzzy
+msgid "Unsupported VERITY FEC offset."
 msgstr "Khoảng bù (offset) mã băm “VERITY” không được hỗ trợ.\n"
 
-#: lib/setup.c:1285
+#: lib/setup.c:2040
+#, fuzzy
+msgid "Data area overlaps with hash area."
+msgstr "Vùng dữ liệu chồng lấn với vùng mã băm.\n"
+
+#: lib/setup.c:2065
+#, fuzzy
+msgid "Hash area overlaps with FEC area."
+msgstr "Vùng dữ liệu chồng lấn với vùng mã băm.\n"
+
+#: lib/setup.c:2072
+#, fuzzy
+msgid "Data area overlaps with FEC area."
+msgstr "Vùng dữ liệu chồng lấn với vùng mã băm.\n"
+
+#: lib/setup.c:2208
 #, c-format
-msgid "Unknown crypt device type %s requested.\n"
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
+
+#: lib/setup.c:2286
+#, fuzzy, c-format
+msgid "Unknown crypt device type %s requested."
 msgstr "Không rõ kiểu thiết bị mã hóa %s được yêu cầu.\n"
 
-#: lib/setup.c:1435
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, fuzzy, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "Không thể tẩy xóa phần đầu trên thiết bị %s.\n"
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, fuzzy, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "Không thể tẩy xóa phần đầu trên thiết bị %s.\n"
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr ""
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "Không thể đọc thiết bị %s.\n"
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, fuzzy, c-format
+msgid "Failed to suspend device %s."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "Không thể đọc thiết bị %s.\n"
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr ""
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "Lỗi lấy thư mục trình ánh xạ thiết bị."
+
+#: lib/setup.c:2809
+#, fuzzy
+msgid "Cannot resize loop device."
+msgstr "Không thể đổi cỡ thiết bị vòng ngược (loopback).\n"
+
+#: lib/setup.c:2882
 msgid "Do you really want to change UUID of device?"
 msgstr "Bạn có thực sự muốn thay đổi UUID cho thiết bị?"
 
-#: lib/setup.c:1545
-#, c-format
-msgid "Volume %s is not active.\n"
+#: lib/setup.c:2958
+#, fuzzy
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "Tập tin sao lưu không chứa phần đầu LUKS hợp lệ.\n"
+
+#: lib/setup.c:3058
+#, fuzzy, c-format
+msgid "Volume %s is not active."
 msgstr "Khối tin %s không hoạt động.\n"
 
-#: lib/setup.c:1556
-#, c-format
-msgid "Volume %s is already suspended.\n"
+#: lib/setup.c:3069
+#, fuzzy, c-format
+msgid "Volume %s is already suspended."
 msgstr "Khối %s đã bị ngưng.\n"
 
-#: lib/setup.c:1563
-#, c-format
-msgid "Suspend is not supported for device %s.\n"
+#: lib/setup.c:3082
+#, fuzzy, c-format
+msgid "Suspend is not supported for device %s."
 msgstr "Tạm dừng không được hỗ trợ cho kiểu thiết bị %s.\n"
 
-#: lib/setup.c:1565
-#, c-format
-msgid "Error during suspending device %s.\n"
+#: lib/setup.c:3084
+#, fuzzy, c-format
+msgid "Error during suspending device %s."
 msgstr "Gặp lỗi khi tạm dừng thiết bị %s.\n"
 
-#: lib/setup.c:1591 lib/setup.c:1638
-#, c-format
-msgid "Volume %s is not suspended.\n"
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, fuzzy, c-format
+msgid "Volume %s is not suspended."
 msgstr "Vùng %s không bị treo.\n"
 
-#: lib/setup.c:1605
-#, c-format
-msgid "Resume is not supported for device %s.\n"
+#: lib/setup.c:3146
+#, fuzzy, c-format
+msgid "Resume is not supported for device %s."
 msgstr "Thao tác phục hồi không được hỗ trợ cho kiểu thiết bị %s.\n"
 
-#: lib/setup.c:1607 lib/setup.c:1659
-#, c-format
-msgid "Error during resuming device %s.\n"
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, fuzzy, c-format
+msgid "Error during resuming device %s."
 msgstr "Gặp lỗi khi cho hoạt động trở lại thiết bị %s.\n"
 
-#: lib/setup.c:1645 lib/setup.c:2080 lib/setup.c:2094 src/cryptsetup.c:186
-#: src/cryptsetup.c:248 src/cryptsetup.c:732 src/cryptsetup.c:1151
-msgid "Enter passphrase: "
-msgstr "Gõ cụm từ mật khẩu: "
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+#, fuzzy
+msgid "Volume key does not match the volume."
+msgstr "Khóa khối tin không tương ứng với khối tin đó.\n"
 
-#: lib/setup.c:1707 lib/setup.c:1843
-msgid "Cannot add key slot, all slots disabled and no volume key provided.\n"
-msgstr ""
-"Không thể thêm khe khóa vì mọi khe đều bị tắt và không cung cấp khóa khối "
-"tin.\n"
+#: lib/setup.c:3343 lib/setup.c:3531
+#, fuzzy
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "Không thể thêm khe khóa vì mọi khe đều bị tắt và không cung cấp khóa khối tin.\n"
 
-#: lib/setup.c:1716 lib/setup.c:1849 lib/setup.c:1853
-msgid "Enter any passphrase: "
-msgstr "Nhập bất cứ cụm từ mật khẩu nào: "
+#: lib/setup.c:3483
+#, fuzzy
+msgid "Failed to swap new key slot."
+msgstr "Gặp lỗi khi hoán đổi khe khóa mới.\n"
 
-#: lib/setup.c:1733 lib/setup.c:1866 lib/setup.c:1870 lib/setup.c:1932
-#: src/cryptsetup.c:988 src/cryptsetup.c:1017
-msgid "Enter new passphrase for key slot: "
-msgstr "Gõ cụm từ mật khẩu mới cho khe khóa: "
+#: lib/setup.c:3669
+#, fuzzy, c-format
+msgid "Key slot %d is invalid."
+msgstr "Khe khóa %d không đúng.\n"
 
-#: lib/setup.c:1798
-#, c-format
-msgid "Key slot %d changed.\n"
-msgstr "Khe khóa %d đã thay đổi.\n"
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, fuzzy, c-format
+msgid "Keyslot %d is not active."
+msgstr "Khe khóa %d không được dùng.\n"
 
-#: lib/setup.c:1801
-#, c-format
-msgid "Replaced with key slot %d.\n"
-msgstr "Đã thay thế với khe khóa %d.\n"
+#: lib/setup.c:3694
+#, fuzzy
+msgid "Device header overlaps with data area."
+msgstr "Vùng dữ liệu chồng lấn với vùng mã băm.\n"
 
-#: lib/setup.c:1806
-msgid "Failed to swap new key slot.\n"
-msgstr "Gặp lỗi khi hoán đổi khe khóa mới.\n"
+#: lib/setup.c:3981
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr ""
 
-#: lib/setup.c:1923 lib/setup.c:2184 lib/setup.c:2197 lib/setup.c:2339
-msgid "Volume key does not match the volume.\n"
-msgstr "Khóa khối tin không tương ứng với khối tin đó.\n"
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+#, fuzzy
+msgid "Failed to get reencryption lock."
+msgstr "Không đọc được tập tin nhật ký reencryption.\n"
 
-#: lib/setup.c:1961
-#, c-format
-msgid "Key slot %d is invalid.\n"
-msgstr "Khe khóa %d không đúng.\n"
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+#, fuzzy
+msgid "LUKS2 reencryption recovery failed."
+msgstr "Không mở được tập tin nhật ký reencryption.\n"
 
-#: lib/setup.c:1966
-#, c-format
-msgid "Key slot %d is not used.\n"
-msgstr "Khe khóa %d không được dùng.\n"
+#: lib/setup.c:4127 lib/setup.c:4379
+#, fuzzy
+msgid "Device type is not properly initialized."
+msgstr "Kiểu thiết bị gần như chắc chắn là chưa được thiết lập.\n"
 
-#: lib/setup.c:1996 lib/setup.c:2068 lib/setup.c:2160
-#, c-format
-msgid "Device %s already exists.\n"
+#: lib/setup.c:4171
+#, fuzzy, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "Không thể định dạng thiết bị %s mà nó lại vẫn đang được sử dụng.\n"
+
+#: lib/setup.c:4174
+#, fuzzy, c-format
+msgid "Device %s already exists."
 msgstr "Thiết bị %s đã sẵn có.\n"
 
-#: lib/setup.c:2171
-msgid "Incorrect volume key specified for plain device.\n"
+#: lib/setup.c:4296
+#, fuzzy
+msgid "Incorrect volume key specified for plain device."
 msgstr "Khóa vùng chứa đã chỉ định không đúng cho thiết bị thường.\n"
 
-#: lib/setup.c:2204
-msgid "Incorrect root hash specified for verity device.\n"
+#: lib/setup.c:4405
+#, fuzzy
+msgid "Incorrect root hash specified for verity device."
 msgstr "Mã băm gốc đã chỉ định không đúng cho thiết bị chứng thực (verity).\n"
 
-#: lib/setup.c:2227
-msgid "Device type is not properly initialised.\n"
-msgstr "Kiểu thiết bị gần như chắc chắn là chưa được thiết lập.\n"
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr ""
 
-#: lib/setup.c:2259
-#, c-format
-msgid "Device %s is still in use.\n"
+#: lib/setup.c:4421
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr ""
+
+#: lib/setup.c:4438 lib/setup.c:5915
+#, fuzzy
+msgid "Failed to load key in kernel keyring."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, fuzzy, c-format
+msgid "Device %s is still in use."
 msgstr "Thiết bị %s vẫn đang được sử dụng.\n"
 
-#: lib/setup.c:2268
-#, c-format
-msgid "Invalid device %s.\n"
+#: lib/setup.c:4516
+#, fuzzy, c-format
+msgid "Invalid device %s."
 msgstr "Thiết bị không đúng %s.\n"
 
-#: lib/setup.c:2289
-msgid "Function not available in FIPS mode.\n"
-msgstr "Chức năng không khả dụng trong chế độ “FIPS”.\n"
-
-#: lib/setup.c:2295
-msgid "Volume key buffer too small.\n"
+#: lib/setup.c:4632
+#, fuzzy
+msgid "Volume key buffer too small."
 msgstr "Vùng đệm khóa khối tin quá nhỏ.\n"
 
-#: lib/setup.c:2303
-msgid "Cannot retrieve volume key for plain device.\n"
+#: lib/setup.c:4640
+#, fuzzy
+msgid "Cannot retrieve volume key for plain device."
 msgstr "Không thể lấy khóa khối tin cho thiết bị bình thường.\n"
 
-#: lib/setup.c:2310
-#, c-format
-msgid "This operation is not supported for %s crypt device.\n"
+#: lib/setup.c:4657
+#, fuzzy
+msgid "Cannot retrieve root hash for verity device."
+msgstr "Mã băm gốc đã chỉ định không đúng cho thiết bị chứng thực (verity).\n"
+
+#: lib/setup.c:4659
+#, fuzzy, c-format
+msgid "This operation is not supported for %s crypt device."
 msgstr "Thao tác này không được hỗ trợ cho thiết bị mã hóa %s.\n"
 
-#: lib/setup.c:2506
-msgid "Dump operation is not supported for this device type.\n"
+#: lib/setup.c:4865
+#, fuzzy
+msgid "Dump operation is not supported for this device type."
 msgstr "Thao tác đổ đống (dump) không được hỗ trợ cho kiểu thiết bị này.\n"
 
-#: lib/utils.c:244
-msgid "Cannot get process priority.\n"
-msgstr "Không thể lấy mức ưu tiên của tiến trình.\n"
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr ""
 
-#: lib/utils.c:258
-msgid "Cannot unlock memory.\n"
-msgstr "Không thể mở khóa bộ nhớ.\n"
+#: lib/setup.c:5475
+#, fuzzy, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "Không thể định dạng thiết bị %s mà nó lại vẫn đang được sử dụng.\n"
 
-#: lib/utils_crypt.c:241 lib/utils_crypt.c:254 lib/utils_crypt.c:401
-#: lib/utils_crypt.c:416
-msgid "Out of memory while reading passphrase.\n"
-msgstr "Tràn bộ nhớ trong khi đọc cụm từ mật khẩu.\n"
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr ""
 
-#: lib/utils_crypt.c:246 lib/utils_crypt.c:261
-msgid "Error reading passphrase from terminal.\n"
-msgstr "Gặp lỗi khi đọc cụm từ mật khẩu từ thiết bị cuối.\n"
+#: lib/setup.c:5845
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr ""
 
-#: lib/utils_crypt.c:259
-msgid "Verify passphrase: "
-msgstr "Nhập lại mật khẩu: "
+#: lib/setup.c:5851
+#, fuzzy, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "Gặp lỗi khi hoán đổi khe khóa mới.\n"
 
-#: lib/utils_crypt.c:266
-msgid "Passphrases do not match.\n"
-msgstr "Hai cụm từ mật khẩu không trùng nhau.\n"
+#: lib/setup.c:5982
+#, fuzzy
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "Thao tác này không được hỗ trợ cho kiểu thiết bị này.\n"
 
-#: lib/utils_crypt.c:350
-msgid "Cannot use offset with terminal input.\n"
-msgstr "Không thể sử dụng khoảng bù (offset) với đầu vào là thiết bị cuối.\n"
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, fuzzy, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "Lỗi đọc từ kho lưu khóa.\n"
 
-#: lib/utils_crypt.c:369 lib/tcrypt/tcrypt.c:467
-msgid "Failed to open key file.\n"
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr ""
+
+#: lib/utils.c:80
+#, fuzzy
+msgid "Cannot get process priority."
+msgstr "Không thể lấy mức ưu tiên của tiến trình.\n"
+
+#: lib/utils.c:94
+#, fuzzy
+msgid "Cannot unlock memory."
+msgstr "Không thể mở khóa bộ nhớ.\n"
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+#, fuzzy
+msgid "Failed to open key file."
 msgstr "Gặp lỗi khi mở tập tin khóa.\n"
 
-#: lib/utils_crypt.c:378
-msgid "Failed to stat key file.\n"
+#: lib/utils.c:173
+#, fuzzy
+msgid "Cannot read keyfile from a terminal."
+msgstr "Không thể đọc tập-tin khóa %s.\n"
+
+#: lib/utils.c:190
+#, fuzzy
+msgid "Failed to stat key file."
 msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
 
-#: lib/utils_crypt.c:386 lib/utils_crypt.c:407
-msgid "Cannot seek to requested keyfile offset.\n"
-msgstr ""
-"Không thể di chuyển vị trí đầu đọc tới vị trí tương đối (offset) tập tin "
-"khóa đã yêu cầu.\n"
+#: lib/utils.c:198 lib/utils.c:219
+#, fuzzy
+msgid "Cannot seek to requested keyfile offset."
+msgstr "Không thể di chuyển vị trí đầu đọc tới vị trí tương đối (offset) tập tin khóa đã yêu cầu.\n"
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+#, fuzzy
+msgid "Out of memory while reading passphrase."
+msgstr "Tràn bộ nhớ trong khi đọc cụm từ mật khẩu.\n"
 
-#: lib/utils_crypt.c:424
-msgid "Error reading passphrase.\n"
+#: lib/utils.c:248
+#, fuzzy
+msgid "Error reading passphrase."
 msgstr "Lỗi đọc cụm từ mật khẩu.\n"
 
-#: lib/utils_crypt.c:442
-msgid "Maximum keyfile size exceeded.\n"
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr ""
+
+#: lib/utils.c:272
+#, fuzzy
+msgid "Maximum keyfile size exceeded."
 msgstr "Đã vượt quá kích thước tập tin khóa tối đa.\n"
 
-#: lib/utils_crypt.c:447
-msgid "Cannot read requested amount of data.\n"
+#: lib/utils.c:277
+#, fuzzy
+msgid "Cannot read requested amount of data."
 msgstr "Không thể đọc đống dữ liệu đã yêu cầu.\n"
 
-#: lib/utils_device.c:136 lib/luks1/keyencryption.c:90
-#, c-format
-msgid "Device %s doesn't exist or access denied.\n"
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, fuzzy, c-format
+msgid "Device %s does not exist or access denied."
 msgstr "Thiết bị %s không tồn tại hoặc không đủ quyền truy cập.\n"
 
-#: lib/utils_device.c:430
-msgid "Cannot use a loopback device, running as non-root user.\n"
+#: lib/utils_device.c:197
+#, fuzzy, c-format
+msgid "Device %s is not compatible."
+msgstr "Thiết bị %s không hoạt động.\n"
+
+#: lib/utils_device.c:642
+#, fuzzy, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "Thiết bị %s quá nhỏ. (LUKS cần ít nhất %<PRIu64> byte.)\n"
+
+#: lib/utils_device.c:723
+#, fuzzy, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "Không thể sử dụng thiết bị %s mà nó lại đang được sử dụng (đang được ánh xạ hoặc gắn).\n"
+
+#: lib/utils_device.c:727
+#, fuzzy, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "Không thể ghi thiết bị %s, không đủ thẩm quyền.\n"
+
+#: lib/utils_device.c:730
+#, fuzzy, c-format
+msgid "Cannot get info about device %s."
+msgstr "Không thể lấy thông tin về thiết bị %s.\n"
+
+#: lib/utils_device.c:753
+#, fuzzy
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "Không thể sử dụng thiết-bị vòng ngược (loopback), do không chạy dưới quyền siêu người dùng.\n"
+
+#: lib/utils_device.c:763
+#, fuzzy
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "Gặp lỗi khi gắn thiết bị vòng ngược (loopback) (thiết bị lặp với cờ autoclear là bắt buộc).\n"
+
+#: lib/utils_device.c:809
+#, fuzzy, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "Khoảng bù (offset) đã yêu cầu nằm ngoài kích thước thật của thiết bị %s.\n"
+
+#: lib/utils_device.c:817
+#, fuzzy, c-format
+msgid "Device %s has zero size."
+msgstr "Thiết bị %s có kích cỡ là không.\n"
+
+#: lib/utils_pbkdf.c:100
+msgid "Requested PBKDF target time cannot be zero."
 msgstr ""
-"Không thể sử dụng thiết-bị vòng ngược (loopback), do không chạy dưới quyền "
-"siêu người dùng.\n"
 
-#: lib/utils_device.c:433
-msgid "Cannot find a free loopback device.\n"
-msgstr "Không tìm thấy thiết bị vòng ngược (loopback ) nào còn rảnh.\n"
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr ""
 
-#: lib/utils_device.c:440
-msgid ""
-"Attaching loopback device failed (loop device with autoclear flag is "
-"required).\n"
+#: lib/utils_pbkdf.c:111
+#, fuzzy, c-format
+msgid "Requested hash %s is not supported."
+msgstr "Không hỗ trợ chuỗi duy nhất LUKS %s được yêu cầu.\n"
+
+#: lib/utils_pbkdf.c:122
+#, fuzzy
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "Không hỗ trợ chuỗi duy nhất LUKS %s được yêu cầu.\n"
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
 msgstr ""
-"Gặp lỗi khi gắn thiết bị vòng ngược (loopback) (thiết bị lặp với cờ "
-"autoclear là bắt buộc).\n"
 
-#: lib/utils_device.c:484
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
 #, c-format
-msgid "Cannot use device %s which is in use (already mapped or mounted).\n"
+msgid "Forced iteration count is too low for %s (minimum is %u)."
 msgstr ""
-"Không thể sử dụng thiết bị %s mà nó lại đang được sử dụng (đang được ánh xạ "
-"hoặc gắn).\n"
 
-#: lib/utils_device.c:488
+#: lib/utils_pbkdf.c:148
 #, c-format
-msgid "Cannot get info about device %s.\n"
-msgstr "Không thể lấy thông tin về thiết bị %s.\n"
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr ""
 
-#: lib/utils_device.c:494
+#: lib/utils_pbkdf.c:160
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr ""
+
+#: lib/utils_pbkdf.c:164
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr ""
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr ""
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr ""
+
+#: lib/utils_benchmark.c:191
+#, fuzzy, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "Gặp các tùy chọn PBKDF2 không tương thích (dùng thuật toán chuỗi duy nhất %s).\n"
+
+#: lib/utils_benchmark.c:211
+#, fuzzy
+msgid "Not compatible PBKDF options."
+msgstr "Gặp các tùy chọn PBKDF2 không tương thích (dùng thuật toán chuỗi duy nhất %s).\n"
+
+#: lib/utils_device_locking.c:102
 #, c-format
-msgid "Requested offset is beyond real size of device %s.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
 msgstr ""
-"Khoảng bù (offset) đã yêu cầu nằm ngoài kích thước thật của thiết bị %s.\n"
 
-#: lib/utils_device.c:502
+#: lib/utils_device_locking.c:109
 #, c-format
-msgid "Device %s has zero size.\n"
-msgstr "Thiết bị %s có kích cỡ là không.\n"
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr ""
 
-#: lib/utils_device.c:513
+#: lib/utils_device_locking.c:119
 #, c-format
-msgid "Device %s is too small.\n"
-msgstr "Thiết bị %s có kích cỡ quá nhỏ.\n"
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr ""
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+#, fuzzy
+msgid "Cannot seek to device offset."
+msgstr "Không thể di chuyển vị trí tới vị trí tương đối thiết bị.\n"
 
-#: lib/luks1/keyencryption.c:37
+#: lib/utils_wipe.c:208
 #, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:39
+#, fuzzy, c-format
 msgid ""
 "Failed to setup dm-crypt key mapping for device %s.\n"
-"Check that kernel supports %s cipher (check syslog for more info).\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
 msgstr ""
 "Gặp lỗi khi cài đặt ánh xạ khóa dm-crypt cho thiết bị %s.\n"
-"Kiểm tra lại hạt nhân hỗ trợ mật mã %s (kiểu tra sổ theo dõi hệ thống để tìm "
-"thêm thông tin.)\n"
+"Kiểm tra lại hạt nhân hỗ trợ mật mã %s (kiểu tra sổ theo dõi hệ thống để tìm thêm thông tin.)\n"
 
-#: lib/luks1/keyencryption.c:42
-msgid "Key size in XTS mode must be 256 or 512 bits.\n"
+#: lib/luks1/keyencryption.c:44
+#, fuzzy
+msgid "Key size in XTS mode must be 256 or 512 bits."
 msgstr "Kích thước khóa trong chế độ “XTS” phải là 256 hay 512 bit.\n"
 
-#: lib/luks1/keyencryption.c:96 lib/luks1/keymanage.c:296
-#: lib/luks1/keymanage.c:572 lib/luks1/keymanage.c:1017
-#, c-format
-msgid "Cannot write to device %s, permission denied.\n"
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, fuzzy, c-format
+msgid "Cannot write to device %s, permission denied."
 msgstr "Không thể ghi thiết bị %s, không đủ thẩm quyền.\n"
 
-#: lib/luks1/keyencryption.c:111
-msgid "Failed to open temporary keystore device.\n"
+#: lib/luks1/keyencryption.c:120
+#, fuzzy
+msgid "Failed to open temporary keystore device."
 msgstr "Gặp lỗi khi mở thiết bị lưu trữ khóa tạm thời.\n"
 
-#: lib/luks1/keyencryption.c:118
-msgid "Failed to access temporary keystore device.\n"
+#: lib/luks1/keyencryption.c:127
+#, fuzzy
+msgid "Failed to access temporary keystore device."
 msgstr "Gl khi truy cập đến thiết bị lưu trữ khóa tạm thời.\n"
 
-#: lib/luks1/keyencryption.c:191
-msgid "IO error while encrypting keyslot.\n"
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+#, fuzzy
+msgid "IO error while encrypting keyslot."
 msgstr "Lỗi IO (vào/ra) trong quá trình mã hóa khe khóa.\n"
 
-#: lib/luks1/keyencryption.c:256
-msgid "IO error while decrypting keyslot.\n"
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, fuzzy, c-format
+msgid "Cannot open device %s."
+msgstr "Không thể mở thiết bị %s.\n"
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+#, fuzzy
+msgid "IO error while decrypting keyslot."
 msgstr "Lỗi IO (vào/ra) trong quá trình giải mã khe khóa.\n"
 
-#: lib/luks1/keymanage.c:90
-#, c-format
-msgid "Device %s is too small. (LUKS requires at least %<PRIu64> bytes.)\n"
+#: lib/luks1/keymanage.c:110
+#, fuzzy, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
 msgstr "Thiết bị %s quá nhỏ. (LUKS cần ít nhất %<PRIu64> byte.)\n"
 
-#: lib/luks1/keymanage.c:180 lib/luks1/keymanage.c:418
-#: src/cryptsetup_reencrypt.c:1110
-#, c-format
-msgid "Device %s is not a valid LUKS device.\n"
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, fuzzy, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "khe-khóa LUKS %u là không hợp lệ.\n"
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, fuzzy, c-format
+msgid "Device %s is not a valid LUKS device."
 msgstr "Thiết bị %s không phải là một thiết bị kiểu LUKS đúng.\n"
 
-#: lib/luks1/keymanage.c:198
-#, c-format
-msgid "Requested header backup file %s already exists.\n"
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, fuzzy, c-format
+msgid "Requested header backup file %s already exists."
 msgstr "Phần đầu tập tin sao lưu dự phòng đã yêu cầu %s đã sẵn có.\n"
 
-#: lib/luks1/keymanage.c:200
-#, c-format
-msgid "Cannot create header backup file %s.\n"
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, fuzzy, c-format
+msgid "Cannot create header backup file %s."
 msgstr "Không thể tạo phần đầu của tập tin sao lưu dự phòng %s.\n"
 
-#: lib/luks1/keymanage.c:205
-#, c-format
-msgid "Cannot write header backup file %s.\n"
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, fuzzy, c-format
+msgid "Cannot write header backup file %s."
 msgstr "Không thể ghi tập tin sao lưu phần đầu %s.\n"
 
-#: lib/luks1/keymanage.c:239
-msgid "Backup file doesn't contain valid LUKS header.\n"
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+#, fuzzy
+msgid "Backup file does not contain valid LUKS header."
 msgstr "Tập tin sao lưu không chứa phần đầu LUKS hợp lệ.\n"
 
-#: lib/luks1/keymanage.c:252 lib/luks1/keymanage.c:496
-#, c-format
-msgid "Cannot open header backup file %s.\n"
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, fuzzy, c-format
+msgid "Cannot open header backup file %s."
 msgstr "Không mở được tập tin sao lưu phần đầu %s.\n"
 
-#: lib/luks1/keymanage.c:258
-#, c-format
-msgid "Cannot read header backup file %s.\n"
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, fuzzy, c-format
+msgid "Cannot read header backup file %s."
 msgstr "Không đọc được tập tin sao lưu phần đầu %s.\n"
 
-#: lib/luks1/keymanage.c:269
-msgid "Data offset or key size differs on device and backup, restore failed.\n"
-msgstr ""
-"Khoảng bù dữ liệu hoặc kích cỡ khóa vẫn khác nhau trên thiết bị và bản sao "
-"lưu thì chức năng phục hồi bị lỗi.\n"
+#: lib/luks1/keymanage.c:317
+#, fuzzy
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "Khoảng bù dữ liệu hoặc kích cỡ khóa vẫn khác nhau trên thiết bị và bản sao lưu thì chức năng phục hồi bị lỗi.\n"
 
-#: lib/luks1/keymanage.c:277
+#: lib/luks1/keymanage.c:325
 #, c-format
 msgid "Device %s %s%s"
 msgstr "Thiết bị %s %s%s"
 
-#: lib/luks1/keymanage.c:278
-msgid ""
-"does not contain LUKS header. Replacing header can destroy data on that "
-"device."
-msgstr ""
-"không chứa phần đầu LUKS. Thay thế phần đầu thì cũng có thể hủy dữ liệu trên "
-"thiết bị đó."
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "không chứa phần đầu LUKS. Thay thế phần đầu thì cũng có thể hủy dữ liệu trên thiết bị đó."
 
-#: lib/luks1/keymanage.c:279
-msgid ""
-"already contains LUKS header. Replacing header will destroy existing "
-"keyslots."
-msgstr ""
-"đã chứa phần đầu LUKS. Thay thế phần đầu thì cũng hủy các khe khóa đã có."
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "đã chứa phần đầu LUKS. Thay thế phần đầu thì cũng hủy các khe khóa đã có."
 
-#: lib/luks1/keymanage.c:280
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
 msgid ""
 "\n"
 "WARNING: real device header has different UUID than backup!"
@@ -543,149 +947,120 @@ msgstr ""
 "\n"
 "CẢNH BÁO: phần đầu thiết bị thật có mã số “UUID” khác với bản sao lưu!"
 
-#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:535
-#: lib/luks1/keymanage.c:575 lib/tcrypt/tcrypt.c:624 lib/verity/verity.c:82
-#: lib/verity/verity.c:179 lib/verity/verity_hash.c:292
-#: lib/verity/verity_hash.c:303 lib/verity/verity_hash.c:323
-#, c-format
-msgid "Cannot open device %s.\n"
-msgstr "Không thể mở thiết bị %s.\n"
-
-#: lib/luks1/keymanage.c:329
-msgid "Non standard key size, manual repair required.\n"
+#: lib/luks1/keymanage.c:375
+#, fuzzy
+msgid "Non standard key size, manual repair required."
 msgstr "Kích thước khóa không tiêu chuẩn, yêu cầu sửa chữa bằng tay.\n"
 
-#: lib/luks1/keymanage.c:334
-msgid "Non standard keyslots alignment, manual repair required.\n"
-msgstr ""
-"Không thể đồng chỉnh các khe khóa (keyslot) tiêu chuẩn, yêu cầu sửa chữa "
-"bằng tay.\n"
+#: lib/luks1/keymanage.c:380
+#, fuzzy
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "Không thể đồng chỉnh các khe khóa (keyslot) tiêu chuẩn, yêu cầu sửa chữa bằng tay.\n"
 
-#: lib/luks1/keymanage.c:340
-msgid "Repairing keyslots.\n"
+#: lib/luks1/keymanage.c:390
+#, fuzzy
+msgid "Repairing keyslots."
 msgstr "Đang chuẩn bị các khe khóa (keyslots).\n"
 
-#: lib/luks1/keymanage.c:351
-msgid "Repair failed."
-msgstr "Gặp lỗi khi sửa chữa."
-
-#: lib/luks1/keymanage.c:363
-#, c-format
-msgid "Keyslot %i: offset repaired (%u -> %u).\n"
+#: lib/luks1/keymanage.c:409
+#, fuzzy, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
 msgstr "Khe-khóa (keyslot) %i: khoảng bù (offset) được sửa chữa (%u -> %u).\n"
 
-#: lib/luks1/keymanage.c:371
-#, c-format
-msgid "Keyslot %i: stripes repaired (%u -> %u).\n"
+#: lib/luks1/keymanage.c:417
+#, fuzzy, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
 msgstr "Khe-khóa (keyslot) %i: stripes được sửa chữa (%u -> %u).\n"
 
-#: lib/luks1/keymanage.c:380
-#, c-format
-msgid "Keyslot %i: bogus partition signature.\n"
+#: lib/luks1/keymanage.c:426
+#, fuzzy, c-format
+msgid "Keyslot %i: bogus partition signature."
 msgstr "Khe-khóa (keyslot) %i: chữ ký phân vùng không có thật.\n"
 
-#: lib/luks1/keymanage.c:385
-#, c-format
-msgid "Keyslot %i: salt wiped.\n"
+#: lib/luks1/keymanage.c:431
+#, fuzzy, c-format
+msgid "Keyslot %i: salt wiped."
 msgstr "Khe-khóa (keyslot) %i: muối bị tẩy xóa.\n"
 
-#: lib/luks1/keymanage.c:396
-msgid "Writing LUKS header to disk.\n"
+#: lib/luks1/keymanage.c:448
+#, fuzzy
+msgid "Writing LUKS header to disk."
 msgstr "Đang ghi phần đầu của LUKS lên đĩa.\n"
 
-#: lib/luks1/keymanage.c:421
-#, c-format
-msgid "Unsupported LUKS version %d.\n"
-msgstr "Phiên bản LUKS không được hỗ trợ %d.\n"
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "Gặp lỗi khi sửa chữa."
 
-#: lib/luks1/keymanage.c:427 lib/luks1/keymanage.c:661
-#, c-format
-msgid "Requested LUKS hash %s is not supported.\n"
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, fuzzy, c-format
+msgid "Requested LUKS hash %s is not supported."
 msgstr "Không hỗ trợ chuỗi duy nhất LUKS %s được yêu cầu.\n"
 
-#: lib/luks1/keymanage.c:442
-#, c-format
-msgid "LUKS keyslot %u is invalid.\n"
-msgstr "khe-khóa LUKS %u là không hợp lệ.\n"
-
-#: lib/luks1/keymanage.c:456 src/cryptsetup.c:668
-msgid "No known problems detected for LUKS header.\n"
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+#, fuzzy
+msgid "No known problems detected for LUKS header."
 msgstr "Không phát hiện thấy vấn đề với phần đầu LUKS.\n"
 
-#: lib/luks1/keymanage.c:596
-#, c-format
-msgid "Error during update of LUKS header on device %s.\n"
+#: lib/luks1/keymanage.c:660
+#, fuzzy, c-format
+msgid "Error during update of LUKS header on device %s."
 msgstr "Gặp lỗi trong khi cập nhật phần đầu LUKS trên thiết bị %s.\n"
 
-#: lib/luks1/keymanage.c:603
-#, c-format
-msgid "Error re-reading LUKS header after update on device %s.\n"
-msgstr ""
-"Gặp lỗi trong khi đọc lại phần đầu LUKS sau khi cập nhật trên thiết bị %s.\n"
+#: lib/luks1/keymanage.c:668
+#, fuzzy, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "Gặp lỗi trong khi đọc lại phần đầu LUKS sau khi cập nhật trên thiết bị %s.\n"
+
+#: lib/luks1/keymanage.c:744
+#, fuzzy
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "Khoảng bù dữ liệu cho phần đầu LUKS tách rời phải hoặc là 0 hoặc là lớn hơn kích thước phần đầu (%d cung từ).\n"
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+#, fuzzy
+msgid "Wrong LUKS UUID format provided."
+msgstr "Đưa ra định dạng mã số UUID LUKS không đúng.\n"
 
-#: lib/luks1/keymanage.c:654
-#, c-format
-msgid ""
-"Data offset for detached LUKS header must be either 0 or higher than header "
-"size (%d sectors).\n"
-msgstr ""
-"Khoảng bù dữ liệu cho phần đầu LUKS tách rời phải hoặc là 0 hoặc là lớn hơn "
-"kích thước phần đầu (%d cung từ).\n"
-
-#: lib/luks1/keymanage.c:666 lib/luks1/keymanage.c:757
-msgid "Wrong LUKS UUID format provided.\n"
-msgstr "Đưa ra định dạng mã số UUID LUKS không đúng.\n"
-
-#: lib/luks1/keymanage.c:695
-msgid "Cannot create LUKS header: reading random salt failed.\n"
+#: lib/luks1/keymanage.c:778
+#, fuzzy
+msgid "Cannot create LUKS header: reading random salt failed."
 msgstr "Không thể tạo phần đầu LUKS: lỗi đọc salt ngẫu nhiên.\n"
 
-#: lib/luks1/keymanage.c:702 lib/luks1/keymanage.c:798
-#, c-format
-msgid "Not compatible PBKDF2 options (using hash algorithm %s).\n"
-msgstr ""
-"Gặp các tùy chọn PBKDF2 không tương thích (dùng thuật toán chuỗi duy nhất "
-"%s).\n"
-
-#: lib/luks1/keymanage.c:717
-#, c-format
-msgid "Cannot create LUKS header: header digest failed (using hash %s).\n"
-msgstr ""
-"Không thể tạo phần đầu LUKS: lỗi tạo bản tóm tắt (dùng chuỗi duy nhất %s).\n"
+#: lib/luks1/keymanage.c:804
+#, fuzzy, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "Không thể tạo phần đầu LUKS: lỗi tạo bản tóm tắt (dùng chuỗi duy nhất %s).\n"
 
-#: lib/luks1/keymanage.c:782
-#, c-format
-msgid "Key slot %d active, purge first.\n"
+#: lib/luks1/keymanage.c:848
+#, fuzzy, c-format
+msgid "Key slot %d active, purge first."
 msgstr "Khe khóa %d vẫn hoạt động: cần tẩy trước.\n"
 
-#: lib/luks1/keymanage.c:788
-#, c-format
-msgid "Key slot %d material includes too few stripes. Header manipulation?\n"
-msgstr ""
-"Nguyên liệu khe khóa %d gồm có quá ít sọc. Có nên thao tác phần đầu không?\n"
-
-#: lib/luks1/keymanage.c:950
-#, c-format
-msgid "Key slot %d unlocked.\n"
-msgstr "Khe khóa %d được mở khóa.\n"
+#: lib/luks1/keymanage.c:854
+#, fuzzy, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "Nguyên liệu khe khóa %d gồm có quá ít sọc. Có nên thao tác phần đầu không?\n"
 
-#: lib/luks1/keymanage.c:985 src/cryptsetup.c:858
-#: src/cryptsetup_reencrypt.c:999 src/cryptsetup_reencrypt.c:1036
-msgid "No key available with this passphrase.\n"
-msgstr "Không có khóa sẵn sàng dùng với cụm từ mật khẩu này.\n"
+#: lib/luks1/keymanage.c:990
+#, fuzzy, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "Lỗi xử lý khóa (dùng mã băm %s).\n"
 
-#: lib/luks1/keymanage.c:1003
-#, c-format
-msgid "Key slot %d is invalid, please select keyslot between 0 and %d.\n"
+#: lib/luks1/keymanage.c:1066
+#, fuzzy, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
 msgstr "Khe khóa %d không đúng: hãy chọn khe khóa trong phạm vi 0 đến %d.\n"
 
-#: lib/luks1/keymanage.c:1021
-#, c-format
-msgid "Cannot wipe device %s.\n"
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, fuzzy, c-format
+msgid "Cannot wipe device %s."
 msgstr "Không thể tẩy thiết bị %s.\n"
 
 #: lib/loopaes/loopaes.c:146
-msgid "Detected not yet supported GPG encrypted keyfile.\n"
+#, fuzzy
+msgid "Detected not yet supported GPG encrypted keyfile."
 msgstr "Tìm thấy tập tin khóa mã hóa GPG vẫn chưa được hỗ trợ.\n"
 
 #: lib/loopaes/loopaes.c:147
@@ -693,416 +1068,1408 @@ msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
 msgstr "Hãy dùng gpg --decrypt <TẬP-TIN-KHÓA> | cryptsetup --keyfile=- …\n"
 
 #: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
-msgid "Incompatible loop-AES keyfile detected.\n"
+#, fuzzy
+msgid "Incompatible loop-AES keyfile detected."
 msgstr "Tập tin khóa (keyfile) loop-AES không tương thích được tìm thấy.\n"
 
-#: lib/loopaes/loopaes.c:244
-msgid "Kernel doesn't support loop-AES compatible mapping.\n"
+#: lib/loopaes/loopaes.c:245
+#, fuzzy
+msgid "Kernel does not support loop-AES compatible mapping."
 msgstr "Nhân không hỗ trợ ánh xạ tương thích loop-AES.\n"
 
-#: lib/tcrypt/tcrypt.c:475
-#, c-format
-msgid "Error reading keyfile %s.\n"
+#: lib/tcrypt/tcrypt.c:504
+#, fuzzy, c-format
+msgid "Error reading keyfile %s."
 msgstr "Gặp lỗi khi đọc tập-tin khóa %s.\n"
 
-#: lib/tcrypt/tcrypt.c:513
-#, c-format
-msgid "Maximum TCRYPT passphrase length (%d) exceeded.\n"
+#: lib/tcrypt/tcrypt.c:554
+#, fuzzy, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
 msgstr "Độ dài cụm từ mật khẩu TCRYPT tối đa (%d) đã bị vượt quá.\n"
 
-#: lib/tcrypt/tcrypt.c:543
-#, c-format
-msgid "PBKDF2 hash algorithm %s not available, skipping.\n"
+#: lib/tcrypt/tcrypt.c:595
+#, fuzzy, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
 msgstr "Thuật toán băm PBKDF2 không khả dụng %s, bỏ qua.\n"
 
-#: lib/tcrypt/tcrypt.c:561 src/cryptsetup.c:621
-msgid "Required kernel crypto interface not available.\n"
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+#, fuzzy
+msgid "Required kernel crypto interface not available."
 msgstr "Giao diện mã hóa từ nhân đã yêu cầu không khả dụng.\n"
 
-#: lib/tcrypt/tcrypt.c:563 src/cryptsetup.c:623
-msgid "Ensure you have algif_skcipher kernel module loaded.\n"
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+#, fuzzy
+msgid "Ensure you have algif_skcipher kernel module loaded."
 msgstr "Bạn cần chắc chắn là mô-đun nhân algif_skcipher đã được tải.\n"
 
-#: lib/tcrypt/tcrypt.c:707
-#, c-format
-msgid "Activation is not supported for %d sector size.\n"
+#: lib/tcrypt/tcrypt.c:753
+#, fuzzy, c-format
+msgid "Activation is not supported for %d sector size."
 msgstr "Hoạt hóa không được hỗ trợ cho kích thước cung %d.\n"
 
-#: lib/tcrypt/tcrypt.c:713
-msgid "Kernel doesn't support activation for this TCRYPT legacy mode.\n"
+#: lib/tcrypt/tcrypt.c:759
+#, fuzzy
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
 msgstr "Nhân không hỗ trợ hoạt hóa cho chế độ cũ của TCRYPT.\n"
 
-#: lib/tcrypt/tcrypt.c:744
-#, c-format
-msgid "Activating TCRYPT system encryption for partition %s.\n"
+#: lib/tcrypt/tcrypt.c:793
+#, fuzzy, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
 msgstr "Đang kích hoạt mã hóa hệ thống TCRYPT cho phân vùng %s.\n"
 
-#: lib/tcrypt/tcrypt.c:806
-msgid "Kernel doesn't support TCRYPT compatible mapping.\n"
+#: lib/tcrypt/tcrypt.c:871
+#, fuzzy
+msgid "Kernel does not support TCRYPT compatible mapping."
 msgstr "Nhân không hỗ trợ ánh xạ tương thích TCRYPT.\n"
 
-#: lib/tcrypt/tcrypt.c:1020
+#: lib/tcrypt/tcrypt.c:1093
 msgid "This function is not supported without TCRYPT header load."
 msgstr "Chức năng này không được hỗ trợ mà không có phần tải đầu TCRYPT."
 
-#: lib/verity/verity.c:70 lib/verity/verity.c:172
+#: lib/bitlk/bitlk.c:333
 #, c-format
-msgid "Verity device %s doesn't use on-disk header.\n"
-msgstr "Thiết bị xác thực %s không sử dụng phần đầu on-disk.\n"
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr ""
 
-#: lib/verity/verity.c:94
+#: lib/bitlk/bitlk.c:385
 #, c-format
-msgid "Device %s is not a valid VERITY device.\n"
-msgstr "Thiết bị %s không phải là thiết bị VERITY thích hợp.\n"
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "Lỗi đọc từ kho lưu khóa.\n"
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "Phiên bản LUKS không được hỗ trợ %d.\n"
+
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "Lỗi đọc từ kho lưu khóa.\n"
+
+#: lib/bitlk/bitlk.c:543
+#, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:594
+#, fuzzy
+msgid "Unknown or unsupported encryption type."
+msgstr "UUID không hỗ trợ kiểu mã hóa này.\n"
 
-#: lib/verity/verity.c:101
+#: lib/bitlk/bitlk.c:627
 #, c-format
-msgid "Unsupported VERITY version %d.\n"
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:921
+#, fuzzy
+msgid "This operation is not supported."
+msgstr "Thao tác này không được hỗ trợ cho thiết bị mã hóa %s.\n"
+
+#: lib/bitlk/bitlk.c:929
+#, fuzzy
+msgid "Wrong key size."
+msgstr "Kích cỡ khóa không đúng.\n"
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1069
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr ""
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, fuzzy, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Thiết bị xác thực %s không sử dụng phần đầu on-disk.\n"
+
+#: lib/verity/verity.c:90
+#, fuzzy, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "Thiết bị %s không phải là thiết bị VERITY thích hợp.\n"
+
+#: lib/verity/verity.c:97
+#, fuzzy, c-format
+msgid "Unsupported VERITY version %d."
 msgstr "Không hỗ trợ phiên bản VERITY %d.\n"
 
-#: lib/verity/verity.c:131
-msgid "VERITY header corrupted.\n"
+#: lib/verity/verity.c:128
+#, fuzzy
+msgid "VERITY header corrupted."
 msgstr "phần đầu VERITY sai hỏng.\n"
 
-#: lib/verity/verity.c:166
-#, c-format
-msgid "Wrong VERITY UUID format provided on device %s.\n"
+#: lib/verity/verity.c:165
+#, fuzzy, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
 msgstr "Đưa ra định dạng mã số VERITY không đúng trên thiết bị %s.\n"
 
-#: lib/verity/verity.c:196
-#, c-format
-msgid "Error during update of verity header on device %s.\n"
+#: lib/verity/verity.c:198
+#, fuzzy, c-format
+msgid "Error during update of verity header on device %s."
 msgstr "Gặp lỗi trong khi cập nhật phần đầu xác thực trên thiết bị %s.\n"
 
-#: lib/verity/verity.c:276
-msgid "Kernel doesn't support dm-verity mapping.\n"
+#: lib/verity/verity.c:256
+#, fuzzy
+msgid "Root hash signature verification is not supported."
+msgstr "Thuật toán băm %s không được hỗ trợ.\n"
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:308
+#, fuzzy
+msgid "Kernel does not support dm-verity mapping."
+msgstr "Nhân không hỗ trợ ánh xạ dm-verity.\n"
+
+#: lib/verity/verity.c:312
+#, fuzzy
+msgid "Kernel does not support dm-verity signature option."
 msgstr "Nhân không hỗ trợ ánh xạ dm-verity.\n"
 
-#: lib/verity/verity.c:287
-msgid "Verity device detected corruption after activation.\n"
+#: lib/verity/verity.c:323
+#, fuzzy
+msgid "Verity device detected corruption after activation."
 msgstr "Thiết bị xác thực đã được phát hiện sai hỏng sau khi hoạt hóa.\n"
 
 #: lib/verity/verity_hash.c:59
-#, c-format
-msgid "Spare area is not zeroed at position %<PRIu64>.\n"
+#, fuzzy, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
 msgstr "Vùng để dành không được điền đầy bằng số không tại vị trí %<PRIu64>.\n"
 
-#: lib/verity/verity_hash.c:121 lib/verity/verity_hash.c:249
-#: lib/verity/verity_hash.c:277 lib/verity/verity_hash.c:284
-msgid "Device offset overflow.\n"
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+#, fuzzy
+msgid "Device offset overflow."
 msgstr "Khoảng bù (offset) thiết bị bị tràn.\n"
 
-#: lib/verity/verity_hash.c:161
-#, c-format
-msgid "Verification failed at position %<PRIu64>.\n"
+#: lib/verity/verity_hash.c:203
+#, fuzzy, c-format
+msgid "Verification failed at position %<PRIu64>."
 msgstr "Thẩm tra gặp lỗi tại vị trí %<PRIu64>.\n"
 
-#: lib/verity/verity_hash.c:235
-msgid "Invalid size parameters for verity device.\n"
+#: lib/verity/verity_hash.c:276
+#, fuzzy
+msgid "Invalid size parameters for verity device."
 msgstr "Các tham số kích thước cho thiết bị xác thực không hợp lệ.\n"
 
-#: lib/verity/verity_hash.c:266
-msgid "Too many tree levels for verity volume.\n"
-msgstr "Có quá nhiều mức cây cho mỗi vùng xác thực.\n"
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr ""
 
-#: lib/verity/verity_hash.c:354
-msgid "Verification of data area failed.\n"
+#: lib/verity/verity_hash.c:373
+#, fuzzy
+msgid "Verification of data area failed."
 msgstr "Việc thẩm tra vùng dữ liệu gặp lỗi.\n"
 
-#: lib/verity/verity_hash.c:359
-msgid "Verification of root hash failed.\n"
+#: lib/verity/verity_hash.c:378
+#, fuzzy
+msgid "Verification of root hash failed."
 msgstr "Việc thẩm tra mã băm gốc gặp lỗi.\n"
 
-#: lib/verity/verity_hash.c:365
-msgid "Input/output error while creating hash area.\n"
+#: lib/verity/verity_hash.c:384
+#, fuzzy
+msgid "Input/output error while creating hash area."
 msgstr "Lỗi Vào/Ra trong khi đang tạo vùng băm.\n"
 
-#: lib/verity/verity_hash.c:367
-msgid "Creation of hash area failed.\n"
+#: lib/verity/verity_hash.c:386
+#, fuzzy
+msgid "Creation of hash area failed."
 msgstr "Việc tạo vùng dữ liệu băm gặp lỗi.\n"
 
-#: lib/verity/verity_hash.c:414
+#: lib/verity/verity_hash.c:433
+#, fuzzy, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "CẢNH BÁO: Nhân (kernel) không thể kích hoạt thiết bị nếu kích thước khối dữ liệu vượt quá kích cỡ trang (%u).\n"
+
+#: lib/verity/verity_fec.c:131
+msgid "Failed to allocate RS context."
+msgstr ""
+
+#: lib/verity/verity_fec.c:146
+#, fuzzy
+msgid "Failed to allocate buffer."
+msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
+
+#: lib/verity/verity_fec.c:156
 #, c-format
-msgid ""
-"WARNING: Kernel cannot activate device if data block size exceeds page size "
-"(%u).\n"
+msgid "Failed to read RS block %<PRIu64> byte %d."
 msgstr ""
-"CẢNH BÁO: Nhân (kernel) không thể kích hoạt thiết bị nếu kích thước khối dữ "
-"liệu vượt quá kích cỡ trang (%u).\n"
 
-#: src/cryptsetup.c:91
-msgid "Can't do passphrase verification on non-tty inputs.\n"
-msgstr "Không thể thẩm tra cụm từ mật khẩu trên đầu vào khác TTY.\n"
+#: lib/verity/verity_fec.c:169
+#, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr ""
 
-#: src/cryptsetup.c:133 src/cryptsetup.c:564 src/cryptsetup.c:711
-#: src/cryptsetup_reencrypt.c:502 src/cryptsetup_reencrypt.c:556
-msgid "No known cipher specification pattern detected.\n"
-msgstr "Không phát hiện mẫu đặc tả mã hóa đã biết.\n"
+#: lib/verity/verity_fec.c:177
+#, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr ""
 
-#: src/cryptsetup.c:144
-msgid ""
-"WARNING: The --hash parameter is being ignored in plain mode with keyfile "
-"specified.\n"
+#: lib/verity/verity_fec.c:188
+#, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
 msgstr ""
-"CẢNH BÁO: Tham số --hash bị bỏ qua trong chế độ thường với tập tin khóa đã "
-"cho.\n"
 
-#: src/cryptsetup.c:152
-msgid ""
-"WARNING: The --keyfile-size option is being ignored, the read size is the "
-"same as the encryption key size.\n"
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
 msgstr ""
-"CẢNH BÁO: Đang bỏ qua các tùy chọn kích thước tập-tin-khóa --keyfile-size "
-"--, kích thước đọc giống với kích thước khóa mã hóa.\n"
 
-#: src/cryptsetup.c:218
-msgid "Option --key-file is required.\n"
-msgstr "Cần tùy chọn “--key-file”.\n"
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr ""
 
-#: src/cryptsetup.c:267
-msgid "No device header detected with this passphrase.\n"
-msgstr "Không có phần đầu thiết bị cho cụm từ mật khẩu này.\n"
+#: lib/verity/verity_fec.c:265
+#, fuzzy, c-format
+msgid "Failed to determine size for device %s."
+msgstr "Gặp lỗi khi mở thiết bị lưu trữ khóa tạm thời.\n"
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+#, fuzzy
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "Nhân không hỗ trợ ánh xạ dm-verity.\n"
+
+#: lib/integrity/integrity.c:277
+#, fuzzy
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "Nhân không hỗ trợ ánh xạ dm-verity.\n"
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, fuzzy, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "Gl khi truy cập đến thiết bị lưu trữ khóa tạm thời.\n"
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
 
-#: src/cryptsetup.c:327 src/cryptsetup.c:1140
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
 msgid ""
-"Header dump with volume key is sensitive information\n"
-"which allows access to encrypted partition without passphrase.\n"
-"This dump should be always stored encrypted on safe place."
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
 msgstr ""
-"Đổ đống phần đầu với khóa vùng chứa là thông tin phân biệt hoa thường\n"
-"cái mà cho phép truy cập phân vùng được mã hóa mà không cần mật khẩu.\n"
-"Việc đổ đống này nên luôn được lưu trữ mã hóa tại một nơi an toàn."
 
-#: src/cryptsetup.c:517
-msgid "Result of benchmark is not reliable.\n"
-msgstr "Kết quả đo kiểm không đáng tin cậy.\n"
+#: lib/luks2/luks2_json_format.c:227
+#, fuzzy
+msgid "Requested data offset is too small."
+msgstr "Thiết bị %s có kích cỡ quá nhỏ.\n"
 
-#: src/cryptsetup.c:558
-msgid "# Tests are approximate using memory only (no storage IO).\n"
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
 msgstr ""
-"# Các kiểm tra là chỉ ước lượng việc sử dụng bộ nhớ (không tính IO ổ đĩa).\n"
 
-#: src/cryptsetup.c:583 src/cryptsetup.c:605
-msgid "#  Algorithm | Key |  Encryption |  Decryption\n"
-msgstr "#  Thuật toán| Khóa|  Mã hóa     |  Giải mã\n"
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, fuzzy, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "Gl khi truy cập đến thiết bị lưu trữ khóa tạm thời.\n"
 
-#: src/cryptsetup.c:587
+#: lib/luks2/luks2_json_metadata.c:1167
 #, c-format
-msgid "Cipher %s is not available.\n"
-msgstr "Mã hóa kiểu %s không sẵn có.\n"
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr ""
 
-#: src/cryptsetup.c:614
-msgid "N/A"
-msgstr "N/A"
+#: lib/luks2/luks2_json_metadata.c:1208
+#, fuzzy
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "Khoảng bù dữ liệu hoặc kích cỡ khóa vẫn khác nhau trên thiết bị và bản sao lưu thì chức năng phục hồi bị lỗi.\n"
 
-#: src/cryptsetup.c:639
-#, c-format
-msgid "Cannot read keyfile %s.\n"
-msgstr "Không thể đọc tập-tin khóa %s.\n"
+#: lib/luks2/luks2_json_metadata.c:1214
+#, fuzzy
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "Khoảng bù dữ liệu hoặc kích cỡ khóa vẫn khác nhau trên thiết bị và bản sao lưu thì chức năng phục hồi bị lỗi.\n"
 
-#: src/cryptsetup.c:643
-#, c-format
-msgid "Cannot read %d bytes from keyfile %s.\n"
-msgstr "Không thể đọc %d byte từ tập tin khóa %s.\n"
+#: lib/luks2/luks2_json_metadata.c:1221
+#, fuzzy, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "Thiết bị %s %s%s"
 
-#: src/cryptsetup.c:672
-msgid "Really try to repair LUKS device header?"
-msgstr "Bạn có thực sự muốn thử sửa chữa phần đầu thiết bị LUKS không?"
+#: lib/luks2/luks2_json_metadata.c:1222
+#, fuzzy
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "không chứa phần đầu LUKS. Thay thế phần đầu thì cũng có thể hủy dữ liệu trên thiết bị đó."
 
-#: src/cryptsetup.c:697
-#, c-format
-msgid "This will overwrite data on %s irrevocably."
+#: lib/luks2/luks2_json_metadata.c:1223
+#, fuzzy
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "đã chứa phần đầu LUKS. Thay thế phần đầu thì cũng hủy các khe khóa đã có."
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
 msgstr ""
-"Thao tác này sẽ ghi đè lên dữ liệu trên thiết bị %s một cách không phục hồi "
-"được."
 
-#: src/cryptsetup.c:699
-msgid "memory allocation error in action_luksFormat"
-msgstr "gặp lỗi phân cấp vùng nhớ trong“action_luksFormat”"
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
 
-#: src/cryptsetup.c:717
+#: lib/luks2/luks2_json_metadata.c:1323
 #, c-format
-msgid "Cannot use %s as on-disk header.\n"
-msgstr "Không thể sử dụng %s như là phần đầu on-disk.\n"
-
-#: src/cryptsetup.c:784
-msgid "Reduced data offset is allowed only for detached LUKS header.\n"
+msgid "Ignored unknown flag %s."
 msgstr ""
-"Giảm khoảng bù (offset) dữ liệu chỉ cho phép khi phần đầu LUKS được tách "
-"rời.\n"
 
-#: src/cryptsetup.c:881 src/cryptsetup.c:937
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
 #, c-format
-msgid "Key slot %d selected for deletion.\n"
-msgstr "Khe khóa %d đã được chọn để xóa.\n"
+msgid "Missing key for dm-crypt segment %u"
+msgstr ""
 
-#: src/cryptsetup.c:884
-#, c-format
-msgid "Key %d not active. Can't wipe.\n"
-msgstr "Khóa %d không hoạt động thì không xóa được.\n"
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
 
-#: src/cryptsetup.c:892 src/cryptsetup.c:940
-msgid ""
-"This is the last keyslot. Device will become unusable after purging this key."
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+msgid "Failed to set dm-linear segment."
 msgstr ""
-"Đây là khe khóa cuối cùng. Sau khi tẩy khóa này thì thiết bị không dùng được."
 
-#: src/cryptsetup.c:893
-msgid "Enter any remaining passphrase: "
-msgstr "Gõ cụm từ mật khẩu bất kỳ còn lại: "
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr ""
 
-#: src/cryptsetup.c:921
-msgid "Enter passphrase to be deleted: "
-msgstr "Gõ cụm từ mật khẩu cần xóa: "
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr ""
 
-#: src/cryptsetup.c:1003 src/cryptsetup_reencrypt.c:1074
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
 #, c-format
-msgid "Enter any existing passphrase: "
-msgstr "Hãy nhập mật khẩu bất kỳ sẵn có: "
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr ""
 
-#: src/cryptsetup.c:1052
-msgid "Enter passphrase to be changed: "
-msgstr "Gõ cụm từ mật khẩu cần được thay đổi: "
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr ""
 
-#: src/cryptsetup.c:1066 src/cryptsetup_reencrypt.c:1059
-msgid "Enter new passphrase: "
-msgstr "Gõ cụm từ mật khẩu mới: "
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr ""
 
-#: src/cryptsetup.c:1090
-msgid "Only one device argument for isLuks operation is supported.\n"
-msgstr "Chỉ hỗ trợ một đối số thiết-bị dành cho thao tác isLuks.\n"
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr ""
 
-#: src/cryptsetup.c:1246 src/cryptsetup.c:1267
-msgid "Option --header-backup-file is required.\n"
-msgstr "Cần tùy chọn“--header-backup-file”.\n"
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr ""
 
-#: src/cryptsetup.c:1304
-#, c-format
-msgid "Unrecognized metadata device type %s.\n"
-msgstr "Không nhận ra siêu dữ liệu của kiểu thiết bị %s.\n"
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr ""
 
-#: src/cryptsetup.c:1307
-msgid "Command requires device and mapped name as arguments.\n"
-msgstr "Lệnh cần thiết bị và tên ánh xạ như là các tham số.\n"
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "Khe khóa %d được thẩm định.\n"
 
-#: src/cryptsetup.c:1326
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
 #, c-format
-msgid ""
-"This operation will erase all keyslots on device %s.\n"
-"Device will become unusable after this operation."
+msgid "Cannot use %s-%s cipher for keyslot encryption."
 msgstr ""
-"Thao tác này sẽ tẩy mọi khe khóa trên thiết bị %s.\n"
-"Thiết bị sẽ không dùng được sau thao tác này."
 
-#: src/cryptsetup.c:1360
-msgid "<device> [--type <type>] [<name>]"
-msgstr "<thiết-bị> [--type <kiểu>] [<tên>]"
+#: lib/luks2/luks2_keyslot_luks2.c:480
+#, fuzzy
+msgid "No space for new keyslot."
+msgstr "Gặp lỗi khi hoán đổi khe khóa mới.\n"
 
-#: src/cryptsetup.c:1360
-msgid "open device as mapping <name>"
-msgstr "mở thiết bị như là ánh xạ <tên>"
+#: lib/luks2/luks2_luks1_convert.c:482
+#, fuzzy, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "Không thể kiểm tra chất lượng mật khẩu: %s\n"
 
-#: src/cryptsetup.c:1361 src/cryptsetup.c:1362 src/cryptsetup.c:1363
-#: src/cryptsetup.c:1364 src/veritysetup.c:311 src/veritysetup.c:312
-msgid "<name>"
-msgstr "<tên>"
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr ""
 
-#: src/cryptsetup.c:1361
-msgid "close device (remove mapping)"
-msgstr "đóng thiết bị (gỡ bỏ ánh xạ)"
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr ""
 
-#: src/cryptsetup.c:1362
-msgid "resize active device"
-msgstr "thay đổi kích cỡ của thiết bị hoạt động"
+#: lib/luks2/luks2_luks1_convert.c:599
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr ""
 
-#: src/cryptsetup.c:1363
-msgid "show device status"
-msgstr "hiển thị trạng thái về thiết bị"
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+#, fuzzy
+msgid "Unable to move keyslot area."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
 
-#: src/cryptsetup.c:1364
-msgid "benchmark cipher"
-msgstr "đo kiểm tốc độ mã hóa"
+#: lib/luks2/luks2_luks1_convert.c:697
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr ""
 
-#: src/cryptsetup.c:1365 src/cryptsetup.c:1366 src/cryptsetup.c:1372
-#: src/cryptsetup.c:1373 src/cryptsetup.c:1374 src/cryptsetup.c:1375
-#: src/cryptsetup.c:1376 src/cryptsetup.c:1377 src/cryptsetup.c:1378
-#: src/cryptsetup.c:1379
-msgid "<device>"
-msgstr "<thiết_bị>"
+#: lib/luks2/luks2_luks1_convert.c:705
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr ""
 
-#: src/cryptsetup.c:1365
-msgid "try to repair on-disk metadata"
-msgstr "thử sửa chữa siêu dữ liệu (metadata) on-disk"
+#: lib/luks2/luks2_luks1_convert.c:717
+#, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr ""
 
-#: src/cryptsetup.c:1366
-msgid "erase all keyslots (remove encryption key)"
-msgstr "tẩy mọi khe khóa (gỡ bỏ khóa mã hóa)"
+#: lib/luks2/luks2_luks1_convert.c:725
+#, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr ""
 
-#: src/cryptsetup.c:1367 src/cryptsetup.c:1368
-msgid "<device> [<new key file>]"
-msgstr "<thiết_bị> [<tập_tin_khóa_mới>]"
+#: lib/luks2/luks2_luks1_convert.c:739
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr ""
 
-#: src/cryptsetup.c:1367
-msgid "formats a LUKS device"
-msgstr "định dạng một thiết bị kiểu LUKS"
+#: lib/luks2/luks2_luks1_convert.c:744
+#, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr ""
 
-#: src/cryptsetup.c:1368
-msgid "add key to LUKS device"
-msgstr "thêm khóa vào thiết bị LUKS"
+#: lib/luks2/luks2_luks1_convert.c:749
+#, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr ""
 
-#: src/cryptsetup.c:1369 src/cryptsetup.c:1370
-msgid "<device> [<key file>]"
-msgstr "<thiết_bị> [<tập_tin_khóa>]"
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
 
-#: src/cryptsetup.c:1369
-msgid "removes supplied key or key file from LUKS device"
-msgstr "gỡ bỏ khỏi thiết bị LUKS khóa hoặc tập tin khóa đưa ra"
+#: lib/luks2/luks2_reencrypt.c:897
+#, fuzzy, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "Kích cỡ giảm phải là bội số cung từ (sector) 512 byte"
 
-#: src/cryptsetup.c:1370
-msgid "changes supplied key or key file of LUKS device"
-msgstr "thay đổi khóa hay tập tin khóa đã áp dụng của thiết bị LUKS"
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "Phiên bản LUKS không được hỗ trợ %d.\n"
 
-#: src/cryptsetup.c:1371
-msgid "<device> <key slot>"
-msgstr "<thiết_bị> <khe_khóa>"
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+#, fuzzy
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "Lỗi đọc từ kho lưu khóa.\n"
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, fuzzy, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "Vùng để dành không được điền đầy bằng số không tại vị trí %<PRIu64>.\n"
 
-#: src/cryptsetup.c:1371
-msgid "wipes key with number <key slot> from LUKS device"
-msgstr "xóa khỏi thiết bị LUKS khóa có số <khe_khóa>"
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "Lỗi đọc từ kho lưu khóa.\n"
 
-#: src/cryptsetup.c:1372
-msgid "print UUID of LUKS device"
-msgstr "in ra mã số UUID của thiết bị LUKS"
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
 
-#: src/cryptsetup.c:1373
-msgid "tests <device> for LUKS partition header"
-msgstr "thử <thiết_bị> có phần đầu phân vùng LUKS không"
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr ""
 
-#: src/cryptsetup.c:1374
-msgid "dump LUKS partition information"
-msgstr "đổ thông tin về phân vùng LUKS"
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "Gl khi truy cập đến thiết bị lưu trữ khóa tạm thời.\n"
 
-#: src/cryptsetup.c:1375
-msgid "dump TCRYPT device information"
-msgstr "dump thông tin thiết bị TCRYPT"
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr ""
 
-#: src/cryptsetup.c:1376
-msgid "Suspend LUKS device and wipe key (all IOs are frozen)."
-msgstr "Ngưng thiết bị LUKS và tẩy khóa (thì mọi việc V/R đều đông cứng)."
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "Gặp lỗi khi mở thiết bị lưu trữ khóa tạm thời.\n"
 
-#: src/cryptsetup.c:1377
-msgid "Resume suspended LUKS device."
-msgstr "Tiếp tục lại sử dụng thiết bị LUKS bị ngưng."
+#: lib/luks2/luks2_reencrypt.c:2060
+msgid "Failed to refresh reencryption devices stack."
+msgstr ""
 
-#: src/cryptsetup.c:1378
-msgid "Backup LUKS device header and keyslots"
-msgstr "Sao lưu phần đầu và các khe khóa của thiết bị LUKS"
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "Gặp lỗi khi hoán đổi khe khóa mới.\n"
 
-#: src/cryptsetup.c:1379
-msgid "Restore LUKS device header and keyslots"
+#: lib/luks2/luks2_reencrypt.c:2318
+#, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, fuzzy, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "Không thể sử dụng thiết bị %s mà nó lại đang được sử dụng (đang được ánh xạ hoặc gắn).\n"
+
+#: lib/luks2/luks2_reencrypt.c:2534
+#, fuzzy
+msgid "Device not marked for LUKS2 reencryption."
+msgstr "Khôngười thay đổi khóa, không có mã hóa lại vùng dữ liệu."
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+msgid "Failed to load LUKS2 reencryption context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "Thiết bị %s không hoạt động.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2630
+msgid "Reencryption process is already running."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2632
+#, fuzzy
+msgid "Failed to acquire reencryption lock."
+msgstr "Không đọc được tập tin nhật ký reencryption.\n"
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2834
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2913
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3046
+#, fuzzy
+msgid "Failed to write reencryption resilience metadata."
+msgstr "Không thể ghi tập tin nhật ký reencryption (mã hóa lại).\n"
+
+#: lib/luks2/luks2_reencrypt.c:3053
+#, fuzzy
+msgid "Decryption failed."
+msgstr "Gặp lỗi khi sửa chữa."
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3063
+#, fuzzy
+msgid "Failed to sync data."
+msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: lib/luks2/luks2_reencrypt.c:3161
+msgid "Failed to wipe backup segment data."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3174
+msgid "Failed to disable reencryption requirement flag."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "Không thể khởi ứng dụng mã hóa chạy ở phía sau (backend).\n"
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+#, fuzzy
+msgid "Failed to update reencryption context."
+msgstr "Không mở được tập tin nhật ký reencryption.\n"
+
+#: lib/luks2/luks2_token.c:262
+msgid "No free token slot."
+msgstr ""
+
+#: lib/luks2/luks2_token.c:269
+#, fuzzy, c-format
+msgid "Failed to create builtin token %s."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: src/cryptsetup.c:164
+#, fuzzy
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "Không thể thẩm tra cụm từ mật khẩu trên đầu vào khác TTY.\n"
+
+#: src/cryptsetup.c:221
+#, fuzzy
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "Thao tác này được hỗ trợ chỉ cho thiết bị LUKS.\n"
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+#, fuzzy
+msgid "No known cipher specification pattern detected."
+msgstr "Không phát hiện mẫu đặc tả mã hóa đã biết.\n"
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "CẢNH BÁO: Tham số --hash bị bỏ qua trong chế độ thường với tập tin khóa đã cho.\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "CẢNH BÁO: Đang bỏ qua các tùy chọn kích thước tập-tin-khóa --keyfile-size --, kích thước đọc giống với kích thước khóa mã hóa.\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr ""
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:381
+#, fuzzy
+msgid "Option --key-file is required."
+msgstr "Cần tùy chọn “--key-file”.\n"
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr ""
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr ""
+
+#: src/cryptsetup.c:446
+#, fuzzy
+msgid "Invalid PIM value: 0."
+msgstr "Thiết bị không đúng %s.\n"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr ""
+
+#: src/cryptsetup.c:472
+#, fuzzy
+msgid "No device header detected with this passphrase."
+msgstr "Không có phần đầu thiết bị cho cụm từ mật khẩu này.\n"
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "Thiết bị %s không phải là một thiết bị kiểu LUKS đúng.\n"
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+"Đổ đống phần đầu với khóa vùng chứa là thông tin phân biệt hoa thường\n"
+"cái mà cho phép truy cập phân vùng được mã hóa mà không cần mật khẩu.\n"
+"Việc đổ đống này nên luôn được lưu trữ mã hóa tại một nơi an toàn."
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr ""
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr ""
+
+#: src/cryptsetup.c:838
+#, fuzzy
+msgid "Benchmark interrupted."
+msgstr "đo kiểm tốc độ mã hóa"
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr ""
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr ""
+
+#: src/cryptsetup.c:901
+#, fuzzy
+msgid "Result of benchmark is not reliable."
+msgstr "Kết quả đo kiểm không đáng tin cậy.\n"
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# Các kiểm tra là chỉ ước lượng việc sử dụng bộ nhớ (không tính IO ổ đĩa).\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, fuzzy, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  Thuật toán| Khóa|  Mã hóa     |  Giải mã\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "Mã hóa kiểu %s không sẵn có.\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+#, fuzzy
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  Thuật toán| Khóa|  Mã hóa     |  Giải mã\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "N/A"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "Gõ cụm từ mật khẩu cho khe khóa %u: "
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "Bạn có thực sự muốn thử sửa chữa phần đầu thiết bị LUKS không?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, fuzzy, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "Không thể r thiết bị LUKS tạm thời.\n"
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr ""
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+#, fuzzy
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "Phiên bản LUKS không được hỗ trợ %d.\n"
+
+#: src/cryptsetup.c:1253
+#, fuzzy, c-format
+msgid "Cannot create header file %s."
+msgstr "Không thể tạo phần đầu của tập tin sao lưu dự phòng %s.\n"
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+#, fuzzy
+msgid "No known integrity specification pattern detected."
+msgstr "Không phát hiện mẫu đặc tả mã hóa đã biết.\n"
+
+#: src/cryptsetup.c:1289
+#, fuzzy, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "Không thể sử dụng %s như là phần đầu on-disk.\n"
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "Thao tác này sẽ ghi đè lên dữ liệu trên thiết bị %s một cách không phục hồi được."
+
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+#, fuzzy
+msgid "Failed to set pbkdf parameters."
+msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
+
+#: src/cryptsetup.c:1439
+#, fuzzy
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "Giảm khoảng bù (offset) dữ liệu chỉ cho phép khi phần đầu LUKS được tách rời.\n"
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr ""
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, fuzzy, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "Khe khóa %d đã được chọn để xóa.\n"
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "Đây là khe khóa cuối cùng. Sau khi tẩy khóa này thì thiết bị không dùng được."
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "Gõ cụm từ mật khẩu bất kỳ còn lại: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "Gõ cụm từ mật khẩu cần xóa: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "Gõ cụm từ mật khẩu mới cho khe khóa: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "Hãy nhập mật khẩu bất kỳ sẵn có: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "Gõ cụm từ mật khẩu cần được thay đổi: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "Gõ cụm từ mật khẩu mới: "
+
+#: src/cryptsetup.c:1927
+#, fuzzy
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "Gõ cụm từ mật khẩu cho khe khóa %u: "
+
+#: src/cryptsetup.c:1951
+#, fuzzy
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "Chỉ hỗ trợ một đối số thiết-bị dành cho thao tác isLuks.\n"
+
+#: src/cryptsetup.c:2001
+#, fuzzy
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Đổ đống phần đầu với khóa vùng chứa là thông tin phân biệt hoa thường\n"
+"cái mà cho phép truy cập phân vùng được mã hóa mà không cần mật khẩu.\n"
+"Việc đổ đống này nên luôn được lưu trữ mã hóa tại một nơi an toàn."
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "Khe khóa %d không được dùng.\n"
+
+#: src/cryptsetup.c:2072
+#, fuzzy
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+"Đổ đống phần đầu với khóa vùng chứa là thông tin phân biệt hoa thường\n"
+"cái mà cho phép truy cập phân vùng được mã hóa mà không cần mật khẩu.\n"
+"Việc đổ đống này nên luôn được lưu trữ mã hóa tại một nơi an toàn."
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+#, fuzzy
+msgid "Option --header-backup-file is required."
+msgstr "Cần tùy chọn“--header-backup-file”.\n"
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr ""
+
+#: src/cryptsetup.c:2269
+#, fuzzy, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "Thao tác phục hồi không được hỗ trợ cho kiểu thiết bị %s.\n"
+
+#: src/cryptsetup.c:2311
+#, fuzzy, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "Không nhận ra siêu dữ liệu của kiểu thiết bị %s.\n"
+
+#: src/cryptsetup.c:2314
+#, fuzzy
+msgid "Command requires device and mapped name as arguments."
+msgstr "Lệnh cần thiết bị và tên ánh xạ như là các tham số.\n"
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"Thao tác này sẽ tẩy mọi khe khóa trên thiết bị %s.\n"
+"Thiết bị sẽ không dùng được sau thao tác này."
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr ""
+
+#: src/cryptsetup.c:2398
+#, fuzzy, c-format
+msgid "Device is already %s type."
+msgstr "Thiết bị %s đã sẵn có.\n"
+
+#: src/cryptsetup.c:2403
+#, fuzzy, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "Thao tác này không được hỗ trợ cho thiết bị mã hóa %s.\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr ""
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, fuzzy, c-format
+msgid "Token %d is invalid."
+msgstr "Khe khóa %d không đúng.\n"
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, c-format
+msgid "Token %d in use."
+msgstr ""
+
+#: src/cryptsetup.c:2493
+#, fuzzy, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "Lỗi đọc từ kho lưu khóa.\n"
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, fuzzy, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: src/cryptsetup.c:2519
+#, fuzzy, c-format
+msgid "Token %d is not in use."
+msgstr "Khe khóa %d không được dùng.\n"
+
+#: src/cryptsetup.c:2554
+#, fuzzy
+msgid "Failed to import token from file."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
+
+#: src/cryptsetup.c:2579
+#, fuzzy, c-format
+msgid "Failed to get token %d for export."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr ""
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2613
+#, fuzzy, c-format
+msgid "Invalid token operation %s."
+msgstr "Kích cỡ khóa không đúng %d.\n"
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "Thiết bị %s không phải là một thiết bị kiểu LUKS đúng.\n"
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "Lỗi lấy thư mục trình ánh xạ thiết bị."
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "Thiết bị không đúng %s.\n"
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "Thao tác này được hỗ trợ chỉ cho thiết bị LUKS.\n"
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "Phần đầu tập tin sao lưu dự phòng đã yêu cầu %s đã sẵn có.\n"
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "Không thể tạo phần đầu của tập tin sao lưu dự phòng %s.\n"
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+#, fuzzy
+msgid "Not enough free keyslots for reencryption."
+msgstr "Khôngười thay đổi khóa, không có mã hóa lại vùng dữ liệu."
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+#, fuzzy
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "Tập tin khóa có thể sử dụng với tùy chọn --key-slot hoặc với chính xác một khe khóa hoạt động.\n"
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "Gõ cụm từ mật khẩu cho khe khóa %u: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "Gõ cụm từ mật khẩu cho khe khóa %u: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "Lệnh cần thiết bị và tên ánh xạ như là các tham số.\n"
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr ""
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+#, fuzzy
+msgid "LUKS2 device is not in reencryption."
+msgstr "Tập tin nhật ký %s đã có sẵn rồi, giả định là reencryption (mã hóa lại).\n"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<thiết-bị> [--type <kiểu>] [<tên>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+#, fuzzy
+msgid "open device as <name>"
+msgstr "mở thiết bị như là ánh xạ <tên>"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<tên>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "đóng thiết bị (gỡ bỏ ánh xạ)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "thay đổi kích cỡ của thiết bị hoạt động"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "hiển thị trạng thái về thiết bị"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr "[--cipher <bộ mã hóa>]"
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "đo kiểm tốc độ mã hóa"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<thiết_bị>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "thử sửa chữa siêu dữ liệu (metadata) on-disk"
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "thêm khóa vào thiết bị LUKS"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "tẩy mọi khe khóa (gỡ bỏ khóa mã hóa)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr ""
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr ""
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<thiết_bị> [<tập_tin_khóa_mới>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "định dạng một thiết bị kiểu LUKS"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "thêm khóa vào thiết bị LUKS"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<thiết_bị> [<tập_tin_khóa>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "gỡ bỏ khỏi thiết bị LUKS khóa hoặc tập tin khóa đưa ra"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "thay đổi khóa hay tập tin khóa đã áp dụng của thiết bị LUKS"
+
+#: src/cryptsetup.c:3360
+msgid "converts a key to new pbkdf parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<thiết_bị> <khe_khóa>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "xóa khỏi thiết bị LUKS khóa có số <khe_khóa>"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "in ra mã số UUID của thiết bị LUKS"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "thử <thiết_bị> có phần đầu phân vùng LUKS không"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "đổ thông tin về phân vùng LUKS"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "dump thông tin thiết bị TCRYPT"
+
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "dump thông tin thiết bị TCRYPT"
+
+#: src/cryptsetup.c:3367
+#, fuzzy
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "Ngưng thiết bị LUKS và tẩy khóa (thì mọi việc V/R đều đông cứng)."
+
+#: src/cryptsetup.c:3368
+#, fuzzy
+msgid "Resume suspended LUKS device"
+msgstr "Tiếp tục lại sử dụng thiết bị LUKS bị ngưng."
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "Sao lưu phần đầu và các khe khóa của thiết bị LUKS"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
 msgstr "Phục hồi phần đầu và các khe khóa của thiết bị LUKS"
 
-#: src/cryptsetup.c:1396 src/veritysetup.c:328
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr ""
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr ""
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
 msgid ""
 "\n"
 "<action> is one of:\n"
@@ -1110,19 +2477,20 @@ msgstr ""
 "\n"
 "<thao-tác> là một trong:\n"
 
-#: src/cryptsetup.c:1402
+#: src/cryptsetup.c:3395
+#, fuzzy
 msgid ""
 "\n"
 "You can also use old <action> syntax aliases:\n"
-"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
 msgstr ""
 "\n"
 "Bạn còn có thể sử dụng cú pháp bí danh <thao-tác> kiểu cũ:\n"
 "\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
 "\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
 
-#: src/cryptsetup.c:1406
+#: src/cryptsetup.c:3399
 #, c-format
 msgid ""
 "\n"
@@ -1135,32 +2503,38 @@ msgstr ""
 "<tên> là thiết bị cần tạo dưới %s\n"
 "<thiết_bị> là thiết bị đã mã hóa\n"
 "<khe_khóa> là số thứ tự khe khóa LUKS cần sửa đổi\n"
-"<tập_tin_khóa> là tập tin khóa tùy chọn cho khóa mới trong thao tác "
-"luksAddKey\n"
+"<tập_tin_khóa> là tập tin khóa tùy chọn cho khóa mới trong thao tác luksAddKey\n"
 
-#: src/cryptsetup.c:1413
+#: src/cryptsetup.c:3406
 #, c-format
 msgid ""
 "\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+
+#: src/cryptsetup.c:3411
+#, fuzzy, c-format
+msgid ""
+"\n"
 "Default compiled-in key and passphrase parameters:\n"
-"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d "
-"(characters)\n"
-"Default PBKDF2 iteration time for LUKS: %d (ms)\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
 msgstr ""
 "\n"
 "Các tham số mặc định liên quan đến khóa và mật khẩu được biên dịch sẵn:\n"
-"\tĐộ dài tập tin khóa tối đa: %dkB, Độ dài mật khẩu tương tác tối đa %d (ký "
-"tự)\n"
+"\tĐộ dài tập tin khóa tối đa: %dkB, Độ dài mật khẩu tương tác tối đa %d (ký tự)\n"
 "Thời gian tương tác PBKDF2 mặc định cho LUKS: %d (ms)\n"
 
-#: src/cryptsetup.c:1420
-#, c-format
+#: src/cryptsetup.c:3422
+#, fuzzy, c-format
 msgid ""
 "\n"
 "Default compiled-in device cipher parameters:\n"
 "\tloop-AES: %s, Key %d bits\n"
 "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-"\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
 msgstr ""
 "\n"
 "Các tham số mặc định liên quan đến việc mã hóa được đặt sẵn:\n"
@@ -1168,372 +2542,766 @@ msgstr ""
 "\tdữ liệu thô: %s, Khóa: %d bit, Kiểu băm mật khẩu: %s\n"
 "\tLUKS1: %s, Khóa: %d bit, Kiểu băm cho phần đầu LUKS: %s, RNG: %s\n"
 
-#: src/cryptsetup.c:1437 src/veritysetup.c:460
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
 #, c-format
 msgid "%s: requires %s as arguments"
 msgstr "%s: cần thiết %s làm đối số"
 
-#: src/cryptsetup.c:1470 src/veritysetup.c:368 src/cryptsetup_reencrypt.c:1253
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
 msgid "Show this help message"
 msgstr "Hiển thị trợ giúp này"
 
-#: src/cryptsetup.c:1471 src/veritysetup.c:369 src/cryptsetup_reencrypt.c:1254
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
 msgid "Display brief usage"
 msgstr "Hiển thị thông tin ngắn về cách sử dụng"
 
-#: src/cryptsetup.c:1475 src/veritysetup.c:373 src/cryptsetup_reencrypt.c:1258
-msgid "Help options:"
-msgstr "Tùy chọn trợ giúp:"
-
-#: src/cryptsetup.c:1476 src/veritysetup.c:374 src/cryptsetup_reencrypt.c:1259
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
 msgid "Print package version"
 msgstr "Hiển thị phiên bản của gói"
 
-#: src/cryptsetup.c:1477 src/veritysetup.c:375 src/cryptsetup_reencrypt.c:1260
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "Tùy chọn trợ giúp:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
 msgid "Shows more detailed error messages"
 msgstr "Hiển thị các thông điệp lỗi chi tiết hơn"
 
-#: src/cryptsetup.c:1478 src/veritysetup.c:376 src/cryptsetup_reencrypt.c:1261
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
 msgid "Show debug messages"
 msgstr "Hiển thị thông điệp gỡ lỗi"
 
-#: src/cryptsetup.c:1479 src/cryptsetup_reencrypt.c:1263
+#: src/cryptsetup.c:3489
+#, fuzzy
+msgid "Show debug messages including JSON metadata"
+msgstr "Hiển thị thông điệp gỡ lỗi"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
 msgid "The cipher used to encrypt the disk (see /proc/crypto)"
 msgstr "Mật mã dùng để bảo vệ đĩa (xem “/proc/crypto”)"
 
-#: src/cryptsetup.c:1480 src/cryptsetup_reencrypt.c:1265
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
 msgid "The hash used to create the encryption key from the passphrase"
 msgstr "Chuỗi duy nhất dùng để tạo khóa mã hóa từ cụm từ mật khẩu"
 
-#: src/cryptsetup.c:1481
+#: src/cryptsetup.c:3492
 msgid "Verifies the passphrase by asking for it twice"
 msgstr "Thẩm tra cụm từ mật khẩu bằng cách yêu cầu nó hai lần"
 
-#: src/cryptsetup.c:1482 src/cryptsetup_reencrypt.c:1267
-msgid "Read the key from a file."
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+#, fuzzy
+msgid "Read the key from a file"
 msgstr "Đọc khóa từ một tập tin."
 
-#: src/cryptsetup.c:1483
+#: src/cryptsetup.c:3494
 msgid "Read the volume (master) key from file."
 msgstr "Đọc khóa khối tin (chủ) từ tập tin."
 
-#: src/cryptsetup.c:1484
-msgid "Dump volume (master) key instead of keyslots info."
-msgstr ""
-"Dump (đổ thành đống) khóa vùng chứa (master) thay vì thông tin khe-khóa."
+#: src/cryptsetup.c:3495
+#, fuzzy
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "Dump (đổ thành đống) khóa vùng chứa (master) thay vì thông tin khe-khóa."
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
 msgid "The size of the encryption key"
 msgstr "Kích cỡ của khóa mã hóa"
 
-#: src/cryptsetup.c:1485 src/cryptsetup_reencrypt.c:1264
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
 msgid "BITS"
 msgstr "BIT"
 
-#: src/cryptsetup.c:1486 src/cryptsetup_reencrypt.c:1278
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
 msgid "Limits the read from keyfile"
 msgstr "Giới hạn việc đọc từ tập-tin-khóa"
 
-#: src/cryptsetup.c:1486 src/cryptsetup.c:1487 src/cryptsetup.c:1488
-#: src/cryptsetup.c:1489 src/veritysetup.c:379 src/veritysetup.c:380
-#: src/veritysetup.c:382 src/cryptsetup_reencrypt.c:1277
-#: src/cryptsetup_reencrypt.c:1278 src/cryptsetup_reencrypt.c:1279
-#: src/cryptsetup_reencrypt.c:1280
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
 msgid "bytes"
 msgstr "byte"
 
-#: src/cryptsetup.c:1487 src/cryptsetup_reencrypt.c:1277
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
 msgid "Number of bytes to skip in keyfile"
 msgstr "Số lượng byte nhảy qua trong tập tin khóa"
 
-#: src/cryptsetup.c:1488
+#: src/cryptsetup.c:3499
 msgid "Limits the read from newly added keyfile"
 msgstr "Giới hạn đọc từ tập tin khóa mới thêm vào"
 
-#: src/cryptsetup.c:1489
+#: src/cryptsetup.c:3500
 msgid "Number of bytes to skip in newly added keyfile"
 msgstr "Số lượng byte để nhảy qua trong tập tin khóa mới thêm"
 
-#: src/cryptsetup.c:1490
+#: src/cryptsetup.c:3501
 msgid "Slot number for new key (default is first free)"
 msgstr "Số thứ tự khe cho khóa mới (mặc định là khe trống thứ nhất)"
 
-#: src/cryptsetup.c:1491
+#: src/cryptsetup.c:3502
 msgid "The size of the device"
 msgstr "Kích cỡ của thiết bị"
 
-#: src/cryptsetup.c:1491 src/cryptsetup.c:1492 src/cryptsetup.c:1493
-#: src/cryptsetup.c:1499
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
 msgid "SECTORS"
 msgstr "CUNG-TỪ"
 
-#: src/cryptsetup.c:1492
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "Chỉ sử dụng kích thước dữ liệu thiết bị (bỏ qua phần còn lại của thiết bị). NGUY HIỂM!"
+
+#: src/cryptsetup.c:3504
 msgid "The start offset in the backend device"
 msgstr "Khoảng bù đầu tiên trong thiết bị thật chạy ở phía sau"
 
-#: src/cryptsetup.c:1493
+#: src/cryptsetup.c:3505
 msgid "How many sectors of the encrypted data to skip at the beginning"
 msgstr "Bao nhiêu cung từ dữ liệu mã hóa cần bỏ qua ở đầu"
 
-#: src/cryptsetup.c:1494
+#: src/cryptsetup.c:3506
 msgid "Create a readonly mapping"
 msgstr "Tạo một sự ánh xạ chỉ cho đọc"
 
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "PBKDF2 iteration time for LUKS (in ms)"
-msgstr "Thời gian lặp lại PBKDF2 cho LUKS (theo mili-giây)"
-
-#: src/cryptsetup.c:1495 src/cryptsetup_reencrypt.c:1268
-msgid "msecs"
-msgstr "mili-giây"
-
-#: src/cryptsetup.c:1496 src/cryptsetup_reencrypt.c:1269
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
 msgid "Do not ask for confirmation"
 msgstr "Không cần xác nhận"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508
 msgid "Timeout for interactive passphrase prompt (in seconds)"
 msgstr "Thời gian chờ gõ cụm từ mật khẩu tối đa (theo giây)"
 
-#: src/cryptsetup.c:1497
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
 msgid "secs"
 msgstr "giây"
 
-#: src/cryptsetup.c:1498 src/cryptsetup_reencrypt.c:1270
-msgid "How often the input of the passphrase can be retried"
-msgstr "Số các lần có cho phép thử gõ lại cụm từ mật khẩu"
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr ""
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "Số các lần có cho phép thử gõ lại cụm từ mật khẩu"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "Căn chỉnh trọng tải ở <n> biên giới cung từ — cho định dạng “luksFormat”"
+
+#: src/cryptsetup.c:3512
+#, fuzzy
+msgid "File with LUKS header and keyslots backup"
+msgstr "Tập tin chứa bản sao lưu phần đầu và các khe khóa của thiết bị LUKS."
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+#, fuzzy
+msgid "Use /dev/random for generating volume key"
+msgstr "Dùng /dev/random để tạo khóa volume."
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+#, fuzzy
+msgid "Use /dev/urandom for generating volume key"
+msgstr "Dùng /dev/urandom để tạo khóa vùng."
+
+#: src/cryptsetup.c:3515
+#, fuzzy
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "Thiết bị chia sẻ với đoạn crypt không-chồng-lên-nhau khác."
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+#, fuzzy
+msgid "UUID for device to use"
+msgstr "UUID dành cho tập tin sử dụng."
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+#, fuzzy
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "Cho phép hủy bỏ (được biết đến như là TRIM) các yêu cầu cho thiết bị."
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+#, fuzzy
+msgid "Device or file with separated LUKS header"
+msgstr "Thiết bị hay tập tin với phần đầu LUKS tách nhau."
+
+#: src/cryptsetup.c:3519
+#, fuzzy
+msgid "Do not activate device, just check passphrase"
+msgstr "Không kích hoạt thiết bị, chỉ cần kiểm tra mật khẩu."
+
+#: src/cryptsetup.c:3520
+#, fuzzy
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "Dùng phần đầu ẩn (thiết bị TCRYPT ẩn)."
+
+#: src/cryptsetup.c:3521
+#, fuzzy
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "Thiết bị là ổ đĩa TCRYPT hệ thống (có bootloader)."
+
+#: src/cryptsetup.c:3522
+#, fuzzy
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "Dùng phần đầu (thứ cấp) TCRYPT."
+
+#: src/cryptsetup.c:3523
+#, fuzzy
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "Cũng quét cho thiết bị tương thích VeraCrypt."
+
+#: src/cryptsetup.c:3524
+#, fuzzy
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Cũng quét cho thiết bị tương thích VeraCrypt."
+
+#: src/cryptsetup.c:3525
+#, fuzzy
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "Cũng quét cho thiết bị tương thích VeraCrypt."
+
+#: src/cryptsetup.c:3526
+#, fuzzy
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "Kiểu của siêu dữ liệu thiết bị: luks, plain, loopaes, tcrypt."
+
+#: src/cryptsetup.c:3527
+#, fuzzy
+msgid "Disable password quality check (if enabled)"
+msgstr "Tắt chức năng kiểm tra chất lượng mật khẩu (nếu nó đang bật)."
+
+#: src/cryptsetup.c:3528
+#, fuzzy
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "Dùng tùy chọn tương thích hiệu năng same_cpu_crypt dm-crypt."
+
+#: src/cryptsetup.c:3529
+#, fuzzy
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "Dùng tùy chọn tương thích hiệu năng submit_from_crypt_cpus dm-crypt."
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr ""
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr ""
+
+#: src/cryptsetup.c:3532
+#, fuzzy
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "Thời gian lặp lại PBKDF2 cho LUKS (theo mili-giây)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "mili-giây"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+#, fuzzy
+msgid "kilobytes"
+msgstr "byte"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr ""
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr ""
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr ""
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr ""
+
+#: src/cryptsetup.c:3538
+#, fuzzy
+msgid "Disable locking of on-disk metadata"
+msgstr "thử sửa chữa siêu dữ liệu (metadata) on-disk"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr ""
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr ""
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+msgid "Disable journal for integrity device"
+msgstr ""
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr ""
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr ""
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr ""
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr ""
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr ""
+
+#: src/cryptsetup.c:3550
+#, fuzzy
+msgid "Set label for the LUKS2 device"
+msgstr "định dạng một thiết bị kiểu LUKS"
 
-#: src/cryptsetup.c:1499
-msgid "Align payload at <n> sector boundaries - for luksFormat"
+#: src/cryptsetup.c:3551
+msgid "Set subsystem label for the LUKS2 device"
 msgstr ""
-"Căn chỉnh trọng tải ở <n> biên giới cung từ — cho định dạng “luksFormat”"
 
-#: src/cryptsetup.c:1500
-msgid "File with LUKS header and keyslots backup."
-msgstr "Tập tin chứa bản sao lưu phần đầu và các khe khóa của thiết bị LUKS."
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr ""
 
-#: src/cryptsetup.c:1501 src/cryptsetup_reencrypt.c:1271
-msgid "Use /dev/random for generating volume key."
-msgstr "Dùng /dev/random để tạo khóa volume."
+#: src/cryptsetup.c:3553
+#, fuzzy
+msgid "Read or write the json from or to a file"
+msgstr "Đọc khóa từ một tập tin."
 
-#: src/cryptsetup.c:1502 src/cryptsetup_reencrypt.c:1272
-msgid "Use /dev/urandom for generating volume key."
-msgstr "Dùng /dev/urandom để tạo khóa vùng."
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr ""
 
-#: src/cryptsetup.c:1503
-msgid "Share device with another non-overlapping crypt segment."
-msgstr "Thiết bị chia sẻ với đoạn crypt không-chồng-lên-nhau khác."
+#: src/cryptsetup.c:3555
+#, fuzzy
+msgid "LUKS2 header keyslots area size"
+msgstr "Tập tin chứa bản sao lưu phần đầu và các khe khóa của thiết bị LUKS."
 
-#: src/cryptsetup.c:1504 src/veritysetup.c:385
-msgid "UUID for device to use."
-msgstr "UUID dành cho tập tin sử dụng."
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr ""
 
-#: src/cryptsetup.c:1505
-msgid "Allow discards (aka TRIM) requests for device."
-msgstr "Cho phép hủy bỏ (được biết đến như là TRIM) các yêu cầu cho thiết bị."
+#: src/cryptsetup.c:3557
+#, fuzzy
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "Kích cỡ của khóa mã hóa"
 
-#: src/cryptsetup.c:1506
-msgid "Device or file with separated LUKS header."
-msgstr "Thiết bị hay tập tin với phần đầu LUKS tách nhau."
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr ""
 
-#: src/cryptsetup.c:1507
-msgid "Do not activate device, just check passphrase."
-msgstr "Không kích hoạt thiết bị, chỉ cần kiểm tra mật khẩu."
+#: src/cryptsetup.c:3559
+#, fuzzy
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "Thiết bị mã hóa cố định (gỡ bỏ mã hóa)."
 
-#: src/cryptsetup.c:1508
-msgid "Use hidden header (hidden TCRYPT device)."
-msgstr "Dùng phần đầu ẩn (thiết bị TCRYPT ẩn)."
+#: src/cryptsetup.c:3560
+#, fuzzy
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "Thiết bị mã hóa cố định (gỡ bỏ mã hóa)."
 
-#: src/cryptsetup.c:1509
-msgid "Device is system TCRYPT drive (with bootloader)."
-msgstr "Thiết bị là ổ đĩa TCRYPT hệ thống (có bootloader)."
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
 
-#: src/cryptsetup.c:1510
-msgid "Use backup (secondary) TCRYPT header."
-msgstr "Dùng phần đầu (thứ cấp) TCRYPT."
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
 
-#: src/cryptsetup.c:1511
-msgid "Scan also for VeraCrypt compatible device."
-msgstr "Cũng quét cho thiết bị tương thích VeraCrypt."
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "Giảm kích thước dữ liệu thiết bị (di chuyển offset dữ liệu). NGUY HIỂM!"
 
-#: src/cryptsetup.c:1512
-msgid "Type of device metadata: luks, plain, loopaes, tcrypt."
-msgstr "Kiểu của siêu dữ liệu thiết bị: luks, plain, loopaes, tcrypt."
+#: src/cryptsetup.c:3564
+#, fuzzy
+msgid "Maximal reencryption hotzone size."
+msgstr "Kích thước khối mã hóa lại"
 
-#: src/cryptsetup.c:1513
-msgid "Disable password quality check (if enabled)."
-msgstr "Tắt chức năng kiểm tra chất lượng mật khẩu (nếu nó đang bật)."
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
 
-#: src/cryptsetup.c:1514
-msgid "Use dm-crypt same_cpu_crypt performance compatibility option."
-msgstr "Dùng tùy chọn tương thích hiệu năng same_cpu_crypt dm-crypt."
+#: src/cryptsetup.c:3566
+#, fuzzy
+msgid "Reencryption hotzone checksums hash"
+msgstr "Kích thước khối mã hóa lại"
 
-#: src/cryptsetup.c:1515
-msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option."
-msgstr "Dùng tùy chọn tương thích hiệu năng submit_from_crypt_cpus dm-crypt."
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
 
-#: src/cryptsetup.c:1531 src/veritysetup.c:402
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
 msgid "[OPTION...] <action> <action-specific>"
 msgstr "[TÙY CHỌN…] <thao-tác> <đặc-tả-thao-tác>"
 
-#: src/cryptsetup.c:1572
-msgid "Running in FIPS mode.\n"
-msgstr "Đang chạy trong chế độ FIPS.\n"
-
-#: src/cryptsetup.c:1581 src/veritysetup.c:439
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
 msgid "Argument <action> missing."
 msgstr "Còn thiếu đối số <thao-tác>."
 
-#: src/cryptsetup.c:1634 src/veritysetup.c:445
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
 msgid "Unknown action."
 msgstr "Không hiểu thao-tác."
 
-#: src/cryptsetup.c:1644
-msgid "Option --shared is allowed only for open of plain device.\n"
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
 msgstr ""
-"Tùy chọn “--shared” chỉ cho phép với thao tác tạo mở của thiết bị thường.\n"
 
-#: src/cryptsetup.c:1649
-msgid "Option --allow-discards is allowed only for open operation.\n"
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr "Tùy chọn “--shared” chỉ cho phép với thao tác tạo mở của thiết bị thường.\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "Tùy chọn “--shared” chỉ cho phép với thao tác tạo mở của thiết bị thường.\n"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "Tùy chọn “--allow-discards” chỉ cho phép với thao tác mở.\n"
+
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "Tùy chọn “--allow-discards” chỉ cho phép với thao tác mở.\n"
+
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
 msgstr "Tùy chọn “--allow-discards” chỉ cho phép với thao tác mở.\n"
 
-#: src/cryptsetup.c:1657
+#: src/cryptsetup.c:3743
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr ""
+
+#: src/cryptsetup.c:3753
+#, fuzzy
 msgid ""
-"Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-"To limit read from keyfile use --keyfile-size=(bytes)."
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
 msgstr ""
-"Tùy chọn --key-size thì chỉ cho phép với các thao tác luksFormat, mở và đo "
-"kiểm.\n"
+"Tùy chọn --key-size thì chỉ cho phép với các thao tác luksFormat, mở và đo kiểm.\n"
 "Để giới hạn đọc từ tập-tin-khóa, hãy sử dụng tùy chọn --keyfile-size=(bytes)."
 
-#: src/cryptsetup.c:1664
-msgid ""
-"Option --test-passphrase is allowed only for open of LUKS and TCRYPT "
-"devices.\n"
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "Tùy chọn “--align-payload” chỉ được phép cho “luksFormat”."
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
 msgstr ""
-"Tùy chọn “--test-passphrase” chỉ được phép cho lệnh mở thiết bị LUKS và "
-"TCRYPT.\n"
 
-#: src/cryptsetup.c:1669 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "Tùy chọn “--uuid” thì chỉ cho phép với “luksFormat” và “luksUUID”."
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "Tùy chọn “--test-passphrase” chỉ được phép cho lệnh mở thiết bị LUKS và TCRYPT.\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
 msgid "Key size must be a multiple of 8 bits"
 msgstr "Kích cỡ khóa phải là bội số của 8 bít"
 
-#: src/cryptsetup.c:1676 src/cryptsetup_reencrypt.c:1346
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
 msgid "Key slot is invalid."
 msgstr "Khe khóa không đúng."
 
-#: src/cryptsetup.c:1683
-msgid "Option --key-file takes precedence over specified key file argument.\n"
-msgstr ""
-"Tùy chọn --key-file giữ quyền ưu tiên cao hơn tham số tập tin khóa đã chỉ "
-"định.\n"
+#: src/cryptsetup.c:3794
+#, fuzzy
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "Tùy chọn --key-file giữ quyền ưu tiên cao hơn tham số tập tin khóa đã chỉ định.\n"
 
-#: src/cryptsetup.c:1691 src/veritysetup.c:467 src/cryptsetup_reencrypt.c:1330
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
 msgid "Negative number for option not permitted."
 msgstr "Tùy chọn không chấp nhận giá trị là số âm."
 
-#: src/cryptsetup.c:1695 src/cryptsetup_reencrypt.c:1324
-#: src/cryptsetup_reencrypt.c:1350
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "Chỉ cho phép một tùy chọn --key-file."
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
 msgid "Only one of --use-[u]random options is allowed."
 msgstr "Chỉ cho phép một tùy chọn “--use-[u]random”."
 
-#: src/cryptsetup.c:1699
+#: src/cryptsetup.c:3813
 msgid "Option --use-[u]random is allowed only for luksFormat."
 msgstr "Tùy chọn “--use-[u]random” chỉ được phép cho “luksFormat”."
 
-#: src/cryptsetup.c:1703
+#: src/cryptsetup.c:3817
 msgid "Option --uuid is allowed only for luksFormat and luksUUID."
 msgstr "Tùy chọn “--uuid” thì chỉ cho phép với “luksFormat” và “luksUUID”."
 
-#: src/cryptsetup.c:1707
+#: src/cryptsetup.c:3821
 msgid "Option --align-payload is allowed only for luksFormat."
 msgstr "Tùy chọn “--align-payload” chỉ được phép cho “luksFormat”."
 
-#: src/cryptsetup.c:1713
-msgid ""
-"Option --skip is supported only for open of plain and loopaes devices.\n"
+#: src/cryptsetup.c:3825
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
 msgstr ""
-"Tùy chọn “--skip” chỉ hỗ trợ cho lệnh mở (open) của thiết bị thường và "
-"“loopaes”.\n"
 
-#: src/cryptsetup.c:1719
-msgid ""
-"Option --offset is supported only for open of plain and loopaes devices.\n"
+#: src/cryptsetup.c:3830
+#, fuzzy
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "Đặc tả kích thước thiết bị không đúng."
+
+#: src/cryptsetup.c:3834
+#, fuzzy
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "Đặc tả kích thước thiết bị không đúng."
+
+#: src/cryptsetup.c:3838
+#, fuzzy
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "Tùy chọn “--align-payload” chỉ được phép cho “luksFormat”."
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "Tùy chọn “--skip” chỉ hỗ trợ cho lệnh mở (open) của thiết bị thường và “loopaes”.\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "Tùy chọn “--offset” chỉ hỗ trợ cho lệnh mở (open) của thiết bị thường và “loopaes”.\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "Tùy chọn --tcrypt-hidden, --tcrypt-system hay --tcrypt-backup chỉ được hỗ trợ trên thiết bị TCRYPT.\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "Tùy chọn --tcrypt-hidden không thể được tổ hợp cùng với --allow-discards.\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "Tùy chọn --veracrypt chỉ được hỗ trợ trên thiết bị TCRYPT.\n"
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
 msgstr ""
-"Tùy chọn “--offset” chỉ hỗ trợ cho lệnh mở (open) của thiết bị thường và "
-"“loopaes”.\n"
 
-#: src/cryptsetup.c:1725
-msgid ""
-"Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only "
-"for TCRYPT device.\n"
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "Tùy chọn --veracrypt chỉ được hỗ trợ trên thiết bị TCRYPT.\n"
+
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "Tùy chọn --veracrypt chỉ được hỗ trợ trên thiết bị TCRYPT.\n"
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
 msgstr ""
-"Tùy chọn --tcrypt-hidden, --tcrypt-system hay --tcrypt-backup chỉ được hỗ "
-"trợ trên thiết bị TCRYPT.\n"
 
-#: src/cryptsetup.c:1730
-msgid "Option --tcrypt-hidden cannot be combined with --allow-discards.\n"
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
 msgstr ""
-"Tùy chọn --tcrypt-hidden không thể được tổ hợp cùng với --allow-discards.\n"
 
-#: src/cryptsetup.c:1735
-msgid "Option --veracrypt is supported only for TCRYPT device type.\n"
-msgstr "Tùy chọn --veracrypt chỉ được hỗ trợ trên thiết bị TCRYPT.\n"
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr ""
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr ""
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr ""
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "Thao tác này không được hỗ trợ cho kiểu thiết bị này.\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr ""
+
+#: src/cryptsetup.c:3944
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr ""
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "Tùy chọn “--keep-key” có thể dùng với “--hash” hoặc “--iter-time”."
+
+#: src/cryptsetup.c:3960
+msgid "Cannot disable metadata locking."
+msgstr ""
+
+#: src/cryptsetup.c:3970
+#, fuzzy
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "Đặc tả kích thước thiết bị không đúng."
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "Đặc tả kích thước thiết bị không đúng."
+
+#: src/cryptsetup.c:3981
+#, fuzzy
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "Kích thước thu nhỏ thiết bị tối đa là 64 MiB."
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "Kích cỡ giảm phải là bội số cung từ (sector) 512 byte"
+
+#: src/cryptsetup.c:3989
+#, fuzzy
+msgid "Invalid data size specification."
+msgstr "Đặc tả kích thước thiết bị không đúng."
+
+#: src/cryptsetup.c:3994
+#, fuzzy
+msgid "Reduce size overflow."
+msgstr "Khoảng bù (offset) thiết bị bị tràn.\n"
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
 
-#: src/veritysetup.c:58
-msgid "Invalid salt string specified.\n"
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "Kích cỡ giảm phải là bội số cung từ (sector) 512 byte"
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4014
+#, fuzzy
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr "Không được dùng các tùy chọn --ignore-corruption và --restart-on-corruption cùng một lúc.\n"
+
+#: src/veritysetup.c:66
+#, fuzzy
+msgid "Invalid salt string specified."
 msgstr "Chuỗi salt (muối) đã cho không hợp lệ.\n"
 
-#: src/veritysetup.c:88
-#, c-format
-msgid "Cannot create hash image %s for writing.\n"
+#: src/veritysetup.c:97
+#, fuzzy, c-format
+msgid "Cannot create hash image %s for writing."
 msgstr "Không thể tạo ảnh băm %s để ghi.\n"
 
-#: src/veritysetup.c:148
-msgid "Invalid root hash string specified.\n"
+#: src/veritysetup.c:107
+#, fuzzy, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "Không thể tạo ảnh băm %s để ghi.\n"
+
+#: src/veritysetup.c:179
+#, fuzzy
+msgid "Invalid root hash string specified."
 msgstr "Chuỗi mã băm gốc (thư mục root) đã chỉ ra không hợp lệ.\n"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "Thiết bị không đúng %s.\n"
+
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr "Không thể đọc tập-tin khóa %s.\n"
+
+#: src/veritysetup.c:392
 msgid "<data_device> <hash_device>"
 msgstr "<thiết-bị-dữ-liệu> <thiết-bị-băm>"
 
-#: src/veritysetup.c:308
+#: src/veritysetup.c:392 src/integritysetup.c:479
 msgid "format device"
 msgstr "định dạng thiết bị"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "<data_device> <hash_device> <root_hash>"
 msgstr "<thiết-bị-dữ-liệu> <thiết-bị-băm> <mã-băm-gốc>"
 
-#: src/veritysetup.c:309
+#: src/veritysetup.c:393
 msgid "verify device"
 msgstr "thẩm tra thiết bị"
 
-#: src/veritysetup.c:310
-msgid "<name> <data_device> <hash_device> <root_hash>"
-msgstr "<tên> <thiết-bị-dữ-liệu> <thiết-bị-băm> <mã-băm-gốc>"
-
-#: src/veritysetup.c:310
-msgid "create active device"
-msgstr "tạo thiết bị hoạt động"
-
-#: src/veritysetup.c:311
-msgid "remove (deactivate) device"
-msgstr "gỡ bỏ (dừng hoạt động) thiết bị"
+#: src/veritysetup.c:394
+#, fuzzy
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<thiết-bị-dữ-liệu> <thiết-bị-băm> <mã-băm-gốc>"
 
-#: src/veritysetup.c:312
+#: src/veritysetup.c:396 src/integritysetup.c:482
 msgid "show active device status"
 msgstr "hiển thị trạng thái các thiết bị đang hoạt động"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397
 msgid "<hash_device>"
 msgstr "<thiết_bị_băm>"
 
-#: src/veritysetup.c:313
+#: src/veritysetup.c:397 src/integritysetup.c:483
 msgid "show on-disk information"
 msgstr "hiển thị thông tin trên-đĩa"
 
-#: src/veritysetup.c:332
+#: src/veritysetup.c:416
 #, c-format
 msgid ""
 "\n"
@@ -1542,353 +3310,883 @@ msgid ""
 "<hash_device> is the device containing verification data\n"
 "<root_hash> hash of the root node on <hash_device>\n"
 msgstr ""
-"\n"
-"<tên> là thiết bị để tạo dưới %s\n"
-"<thiết-bị-dữ-liệu> là thiết bị dữ liệu\n"
-"<thiết-bị-băm> là thiết bị chứa dữ liệu xác thực\n"
-"<mã-băm-gốc> mã băm của nút root (gốc) trên <thiết-bị-băm>\n"
+"\n"
+"<tên> là thiết bị để tạo dưới %s\n"
+"<thiết-bị-dữ-liệu> là thiết bị dữ liệu\n"
+"<thiết-bị-băm> là thiết bị chứa dữ liệu xác thực\n"
+"<mã-băm-gốc> mã băm của nút root (gốc) trên <thiết-bị-băm>\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"Các tham số dm-verity dựng sẵn mặc định:\n"
+"\tBăm: %s, Khối dữ liệu (bytes): %u, Khối băm (bytes): %u, Kích thước muối: %u, Định dạng băm: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "Không sử dụng siêu khối thẩm định"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "Kiểu định dạng (1 - thông thường, 0 - Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "số"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "Kích cỡ khối trên thiết bị dữ liệu"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "Kích cỡ của khối trên thiết bị băm"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr ""
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "Số lượng khối trong tập tin dữ liệu"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "khối"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr ""
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr ""
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "Khoảng bù (offset) khởi đầu của thiết bị băm"
+
+#: src/veritysetup.c:474
+#, fuzzy
+msgid "Starting offset on the FEC device"
+msgstr "Khoảng bù (offset) khởi đầu của thiết bị băm"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "Thuật toán băm"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "chuỗi"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "Muối"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "chuỗi hex (thập lục phân)"
+
+#: src/veritysetup.c:478
+#, fuzzy
+msgid "Path to root hash signature file"
+msgstr "Việc tạo vùng dữ liệu băm gặp lỗi.\n"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr "Khởi động lại nhân nếu thấy có sai hỏng"
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "Bỏ qua sai hỏng, chỉ ghi nhật ký lại"
+
+#: src/veritysetup.c:481
+msgid "Do not verify zeroed blocks"
+msgstr "Không thẩm tra các khối không"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr ""
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "Tùy chọn --ignore-corruption, --restart-on-corruption hay --ignore-zero-blocks chỉ được phép dùng cho thao tác tạo.\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "Tùy chọn “--allow-discards” chỉ cho phép với thao tác mở.\n"
+
+#: src/veritysetup.c:592
+#, fuzzy
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "Không được dùng các tùy chọn --ignore-corruption và --restart-on-corruption cùng một lúc.\n"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, fuzzy, c-format
+msgid "Cannot read keyfile %s."
+msgstr "Không thể đọc tập-tin khóa %s.\n"
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, fuzzy, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "Không thể đọc %d byte từ tập tin khóa %s.\n"
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr ""
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+#, fuzzy
+msgid "<integrity_device>"
+msgstr "thẩm tra thiết bị"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr ""
+
+#: src/integritysetup.c:502
+#, fuzzy, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<tên> là thiết bị để tạo dưới %s\n"
+"<thiết-bị-dữ-liệu> là thiết bị dữ liệu\n"
+"<thiết-bị-băm> là thiết bị chứa dữ liệu xác thực\n"
+"<mã-băm-gốc> mã băm của nút root (gốc) trên <thiết-bị-băm>\n"
+
+#: src/integritysetup.c:507
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr ""
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr ""
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr ""
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr ""
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr ""
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr ""
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr ""
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr ""
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:562
+#, fuzzy
+msgid "The size of the data integrity key"
+msgstr "Kích cỡ của khóa mã hóa"
+
+#: src/integritysetup.c:563
+#, fuzzy
+msgid "Read the integrity key from a file"
+msgstr "Đọc khóa từ một tập tin."
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:566
+#, fuzzy
+msgid "The size of the journal integrity key"
+msgstr "Kích cỡ của khóa mã hóa"
+
+#: src/integritysetup.c:567
+#, fuzzy
+msgid "Read the journal integrity key from a file"
+msgstr "Đọc khóa từ một tập tin."
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr ""
+
+#: src/integritysetup.c:570
+#, fuzzy
+msgid "The size of the journal encryption key"
+msgstr "Kích cỡ của khóa mã hóa"
+
+#: src/integritysetup.c:571
+#, fuzzy
+msgid "Read the journal encryption key from a file"
+msgstr "Đọc khóa từ một tập tin."
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr ""
 
-#: src/veritysetup.c:339
-#, c-format
-msgid ""
-"\n"
-"Default compiled-in dm-verity parameters:\n"
-"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, "
-"Hash format: %u\n"
+#: src/integritysetup.c:575
+msgid "Use bitmap to track changes and disable journal for integrity device"
 msgstr ""
-"\n"
-"Các tham số dm-verity dựng sẵn mặc định:\n"
-"\tBăm: %s, Khối dữ liệu (bytes): %u, Khối băm (bytes): %u, Kích thước muối: "
-"%u, Định dạng băm: %u\n"
 
-#: src/veritysetup.c:377
-msgid "Do not use verity superblock"
-msgstr "Không sử dụng siêu khối thẩm định"
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr ""
 
-#: src/veritysetup.c:378
-msgid "Format type (1 - normal, 0 - original Chrome OS)"
-msgstr "Kiểu định dạng (1 - thông thường, 0 - Chrome OS)"
+#: src/integritysetup.c:649
+#, fuzzy
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "Tùy chọn “--allow-discards” chỉ cho phép với thao tác mở.\n"
 
-#: src/veritysetup.c:378
-msgid "number"
-msgstr "số"
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr ""
 
-#: src/veritysetup.c:379
-msgid "Block size on the data device"
-msgstr "Kích cỡ khối trên thiết bị dữ liệu"
+#: src/integritysetup.c:675
+#, fuzzy
+msgid "Invalid journal size specification."
+msgstr "Đặc tả kích thước thiết bị không đúng."
 
-#: src/veritysetup.c:380
-msgid "Block size on the hash device"
-msgstr "Kích cỡ của khối trên thiết bị băm"
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:381
-msgid "The number of blocks in the data file"
-msgstr "Số lượng khối trong tập tin dữ liệu"
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr ""
 
-#: src/veritysetup.c:381
-msgid "blocks"
-msgstr "khối"
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:382
-msgid "Starting offset on the hash device"
-msgstr "Khoảng bù (offset) khởi đầu của thiết bị băm"
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr ""
 
-#: src/veritysetup.c:383
-msgid "Hash algorithm"
-msgstr "Thuật toán băm"
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr ""
 
-#: src/veritysetup.c:383
-msgid "string"
-msgstr "chuỗi"
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr ""
 
-#: src/veritysetup.c:384
-msgid "Salt"
-msgstr "Muối"
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr ""
 
-#: src/veritysetup.c:384
-msgid "hex string"
-msgstr "chuỗi hex (thập lục phân)"
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:147
-#, c-format
-msgid "Cannot exclusively open %s, device in use.\n"
-msgstr "Không thể mở %s một cách đệ qui, thiết bị vẫn đang được sử dụng.\n"
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:151
-#, c-format
-msgid "Cannot open device %s\n"
-msgstr "Không thể mở thiết bị %s\n"
+#: src/cryptsetup_reencrypt.c:172
+#, fuzzy
+msgid "Reencryption already in-progress."
+msgstr "Kích thước khối mã hóa lại"
+
+#: src/cryptsetup_reencrypt.c:208
+#, fuzzy, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "Không thể mở %s một cách đệ qui, thiết bị vẫn đang được sử dụng.\n"
 
-#: src/cryptsetup_reencrypt.c:161 src/cryptsetup_reencrypt.c:893
-msgid "Allocation of aligned memory failed.\n"
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+#, fuzzy
+msgid "Allocation of aligned memory failed."
 msgstr "Phân bổ bộ nhớ điều chỉnh gặp lỗi.\n"
 
-#: src/cryptsetup_reencrypt.c:168
-#, c-format
-msgid "Cannot read device %s.\n"
+#: src/cryptsetup_reencrypt.c:229
+#, fuzzy, c-format
+msgid "Cannot read device %s."
 msgstr "Không thể đọc thiết bị %s.\n"
 
-#: src/cryptsetup_reencrypt.c:179
-#, c-format
-msgid "Marking LUKS device %s unusable.\n"
+#: src/cryptsetup_reencrypt.c:240
+#, fuzzy, c-format
+msgid "Marking LUKS1 device %s unusable."
 msgstr "Đánh dấu thiết bị LUKS %s là không thể dùng.\n"
 
-#: src/cryptsetup_reencrypt.c:184
+#: src/cryptsetup_reencrypt.c:244
 #, c-format
-msgid "Marking LUKS device %s usable.\n"
-msgstr "Đánh dấu thiết bị LUKS %s là có thể dùng.\n"
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:200
-#, c-format
-msgid "Cannot write device %s.\n"
+#: src/cryptsetup_reencrypt.c:261
+#, fuzzy, c-format
+msgid "Cannot write device %s."
 msgstr "Không thể ghi thiết bị %s.\n"
 
-#: src/cryptsetup_reencrypt.c:281
-msgid "Cannot write reencryption log file.\n"
+#: src/cryptsetup_reencrypt.c:309
+#, fuzzy
+msgid "Cannot write reencryption log file."
 msgstr "Không thể ghi tập tin nhật ký reencryption (mã hóa lại).\n"
 
-#: src/cryptsetup_reencrypt.c:337
-msgid "Cannot read reencryption log file.\n"
+#: src/cryptsetup_reencrypt.c:365
+#, fuzzy
+msgid "Cannot read reencryption log file."
 msgstr "Không đọc được tập tin nhật ký reencryption.\n"
 
-#: src/cryptsetup_reencrypt.c:374
+#: src/cryptsetup_reencrypt.c:403
 #, c-format
 msgid "Log file %s exists, resuming reencryption.\n"
-msgstr ""
-"Tập tin nhật ký %s đã có sẵn rồi, giả định là reencryption (mã hóa lại).\n"
+msgstr "Tập tin nhật ký %s đã có sẵn rồi, giả định là reencryption (mã hóa lại).\n"
 
-#: src/cryptsetup_reencrypt.c:403
-msgid "Activating temporary device using old LUKS header.\n"
+#: src/cryptsetup_reencrypt.c:452
+#, fuzzy
+msgid "Activating temporary device using old LUKS header."
 msgstr "Hoạt hóa thiết bị tạm thời sử dụng phần đầu LUKS kiểu cũ.\n"
 
-#: src/cryptsetup_reencrypt.c:414
-msgid "Activating temporary device using new LUKS header.\n"
+#: src/cryptsetup_reencrypt.c:462
+#, fuzzy
+msgid "Activating temporary device using new LUKS header."
 msgstr "Hoạt hóa thiết bị tạm thời sử dụng phần đầu LUKS kiểu mới.\n"
 
-#: src/cryptsetup_reencrypt.c:424
-msgid "Activation of temporary devices failed.\n"
+#: src/cryptsetup_reencrypt.c:472
+#, fuzzy
+msgid "Activation of temporary devices failed."
 msgstr "Việc hoạt hóa các thiết bị tạm thời gặp lỗi.\n"
 
-#: src/cryptsetup_reencrypt.c:450
-#, c-format
-msgid "New LUKS header for device %s created.\n"
+#: src/cryptsetup_reencrypt.c:559
+#, fuzzy
+msgid "Failed to set data offset."
+msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
+
+#: src/cryptsetup_reencrypt.c:565
+#, fuzzy
+msgid "Failed to set metadata size."
+msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
+
+#: src/cryptsetup_reencrypt.c:573
+#, fuzzy, c-format
+msgid "New LUKS header for device %s created."
 msgstr "Phần đầu LUKS mới cho thiết bị %s được tạo.\n"
 
-#: src/cryptsetup_reencrypt.c:458
+#: src/cryptsetup_reencrypt.c:633
 #, c-format
-msgid "Activated keyslot %i.\n"
-msgstr "Khe-khóa (keyslot) đã được kích hoạt %i.\n"
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr ""
 
-#: src/cryptsetup_reencrypt.c:484
-#, c-format
-msgid "LUKS header backup of device %s created.\n"
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:659
+#, fuzzy
+msgid "Failed to write activation flags to new header."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+#, fuzzy
+msgid "Failed to read requirements from backup header."
+msgstr "Lỗi đọc từ kho lưu khóa.\n"
+
+#: src/cryptsetup_reencrypt.c:705
+#, fuzzy, c-format
+msgid "%s header backup of device %s created."
 msgstr "Phần đầu sao lưu LUKS của thiết bị %s được tạo.\n"
 
-#: src/cryptsetup_reencrypt.c:532
-msgid "Creation of LUKS backup headers failed.\n"
+#: src/cryptsetup_reencrypt.c:768
+#, fuzzy
+msgid "Creation of LUKS backup headers failed."
 msgstr "Việc tạo phần đầu LUKS sao lưu dự phòng gặp lỗi.\n"
 
-#: src/cryptsetup_reencrypt.c:634
-#, c-format
-msgid "Cannot restore LUKS header on device %s.\n"
+#: src/cryptsetup_reencrypt.c:901
+#, fuzzy, c-format
+msgid "Cannot restore %s header on device %s."
 msgstr "Không thể phục hồi phần đầu LUKS trên thiết bị %s.\n"
 
-#: src/cryptsetup_reencrypt.c:636
-#, c-format
-msgid "LUKS header on device %s restored.\n"
+#: src/cryptsetup_reencrypt.c:903
+#, fuzzy, c-format
+msgid "%s header on device %s restored."
 msgstr "Phần đầu LUKS trên thiết bị %s đã được phục hồi.\n"
 
-#: src/cryptsetup_reencrypt.c:669
-#, c-format
-msgid ""
-"Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
-msgstr ""
-"Tiến trình: %5.1f%%, ETA %02llu:%02llu, %4llu MiB đã ghi, tốc độ %5.1f MiB/s"
-"%s"
-
-#: src/cryptsetup_reencrypt.c:708 src/cryptsetup_reencrypt.c:784
-#: src/cryptsetup_reencrypt.c:826
-msgid "Cannot seek to device offset.\n"
-msgstr "Không thể di chuyển vị trí tới vị trí tương đối thiết bị.\n"
-
-#: src/cryptsetup_reencrypt.c:865 src/cryptsetup_reencrypt.c:871
-msgid "Cannot open temporary LUKS header file.\n"
-msgstr "Không thể mở tập tin phần đầu LUKS tạm thời.\n"
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+#, fuzzy
+msgid "Cannot open temporary LUKS device."
+msgstr "Không thể r thiết bị LUKS tạm thời.\n"
 
-#: src/cryptsetup_reencrypt.c:876 src/cryptsetup_reencrypt.c:881
-msgid "Cannot get device size.\n"
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+#, fuzzy
+msgid "Cannot get device size."
 msgstr "Không thể lấy kích cỡ thiết bị.\n"
 
-#: src/cryptsetup_reencrypt.c:919
-msgid "Interrupted by a signal.\n"
-msgstr "Bị ngắt bởi tín hiệu signal.\n"
-
-#: src/cryptsetup_reencrypt.c:921
-msgid "IO error during reencryption.\n"
+#: src/cryptsetup_reencrypt.c:1158
+#, fuzzy
+msgid "IO error during reencryption."
 msgstr "Lỗi IO (vào/ra) trong quá trình mã hóa lại.\n"
 
-#: src/cryptsetup_reencrypt.c:1028
-msgid ""
-"Key file can be used only with --key-slot or with exactly one key slot "
-"active.\n"
-msgstr ""
-"Tập tin khóa có thể sử dụng với tùy chọn --key-slot hoặc với chính xác một "
-"khe khóa hoạt động.\n"
-
-#: src/cryptsetup_reencrypt.c:1072 src/cryptsetup_reencrypt.c:1087
-#, c-format
-msgid "Enter passphrase for key slot %u: "
-msgstr "Gõ cụm từ mật khẩu cho khe khóa %u: "
+#: src/cryptsetup_reencrypt.c:1189
+#, fuzzy
+msgid "Provided UUID is invalid."
+msgstr "UUID đã cung cấp không hợp lệ.\n"
 
-#: src/cryptsetup_reencrypt.c:1136
-msgid "Cannot open reencryption log file.\n"
+#: src/cryptsetup_reencrypt.c:1423
+#, fuzzy
+msgid "Cannot open reencryption log file."
 msgstr "Không mở được tập tin nhật ký reencryption.\n"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1429
+#, fuzzy
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "Không có quá trình giải mã nào đang xử lý, UUID đã cung cấp có thể chỉ được dùng để phục hồi lại tiến trình giải mã đã tạm dừng.\n"
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1616
 msgid "Reencryption block size"
 msgstr "Kích thước khối mã hóa lại"
 
-#: src/cryptsetup_reencrypt.c:1262
+#: src/cryptsetup_reencrypt.c:1616
 msgid "MiB"
 msgstr "MiB"
 
-#: src/cryptsetup_reencrypt.c:1266
-msgid "Do not change key, no data area reencryption."
+#: src/cryptsetup_reencrypt.c:1620
+#, fuzzy
+msgid "Do not change key, no data area reencryption"
 msgstr "Khôngười thay đổi khóa, không có mã hóa lại vùng dữ liệu."
 
-#: src/cryptsetup_reencrypt.c:1273
-msgid "Use direct-io when accessing devices."
+#: src/cryptsetup_reencrypt.c:1622
+#, fuzzy
+msgid "Read new volume (master) key from file"
+msgstr "Đọc khóa khối tin (chủ) từ tập tin."
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "Thời gian lặp lại PBKDF2 cho LUKS (theo mili-giây)"
+
+#: src/cryptsetup_reencrypt.c:1629
+#, fuzzy
+msgid "Use direct-io when accessing devices"
 msgstr "Sử dụng vào ra trực tiếp khi truy cập các thiết bị."
 
-#: src/cryptsetup_reencrypt.c:1274
-msgid "Use fsync after each block."
+#: src/cryptsetup_reencrypt.c:1630
+#, fuzzy
+msgid "Use fsync after each block"
 msgstr "Sử dụng fsync sau mỗi khối."
 
-#: src/cryptsetup_reencrypt.c:1275
-msgid "Update log file after every block."
+#: src/cryptsetup_reencrypt.c:1631
+#, fuzzy
+msgid "Update log file after every block"
 msgstr "Cập nhật tập tin nhật ký sau mỗi khối."
 
-#: src/cryptsetup_reencrypt.c:1276
-msgid "Use only this slot (others will be disabled)."
+#: src/cryptsetup_reencrypt.c:1632
+#, fuzzy
+msgid "Use only this slot (others will be disabled)"
 msgstr "Chỉ sử dụng khe này (những cái khác sẽ bị tắt đi)."
 
-#: src/cryptsetup_reencrypt.c:1279
-msgid "Reduce data device size (move data offset). DANGEROUS!"
-msgstr ""
-"Giảm kích thước dữ liệu thiết bị (di chuyển offset dữ liệu). NGUY HIỂM!"
-
-#: src/cryptsetup_reencrypt.c:1280
-msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
-msgstr ""
-"Chỉ sử dụng kích thước dữ liệu thiết bị (bỏ qua phần còn lại của thiết bị). "
-"NGUY HIỂM!"
-
-#: src/cryptsetup_reencrypt.c:1281
-msgid "Create new header on not encrypted device."
+#: src/cryptsetup_reencrypt.c:1637
+#, fuzzy
+msgid "Create new header on not encrypted device"
 msgstr "Tạo phần đầu mới không trên thiết bị được mã hóa."
 
-#: src/cryptsetup_reencrypt.c:1282
-msgid "Permanently decrypt device (remove encryption)."
+#: src/cryptsetup_reencrypt.c:1638
+#, fuzzy
+msgid "Permanently decrypt device (remove encryption)"
 msgstr "Thiết bị mã hóa cố định (gỡ bỏ mã hóa)."
 
-#: src/cryptsetup_reencrypt.c:1298
+#: src/cryptsetup_reencrypt.c:1639
+#, fuzzy
+msgid "The UUID used to resume decryption"
+msgstr "uuid được dùng để khôi phục việc giải mã."
+
+#: src/cryptsetup_reencrypt.c:1640
+#, fuzzy
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "Kiểu của siêu dữ liệu thiết bị: luks, plain, loopaes, tcrypt."
+
+#: src/cryptsetup_reencrypt.c:1659
 msgid "[OPTION...] <device>"
 msgstr "[TÙY_CHỌN…] <thiết-bị>"
 
-#: src/cryptsetup_reencrypt.c:1312
-msgid ""
-"WARNING: this is experimental code, it can completely break your data.\n"
-msgstr ""
-"CẢNH BÁO: đây chỉ là mã thử nghiệm, nó có thể phá hoại dữ liệu của bạn.\n"
-
-#: src/cryptsetup_reencrypt.c:1313
-#, c-format
-msgid "Reencryption will change: volume key%s%s%s%s.\n"
+#: src/cryptsetup_reencrypt.c:1667
+#, fuzzy, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
 msgstr "Reencryption sẽ thay đổi: khóa dung lượng%s%s%s%s.\n"
 
-#: src/cryptsetup_reencrypt.c:1314
-msgid ", set hash to "
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:1670
+#, fuzzy
+msgid "set hash to "
 msgstr ", đặt kiểu băm thành "
 
-#: src/cryptsetup_reencrypt.c:1315
+#: src/cryptsetup_reencrypt.c:1671
 msgid ", set cipher to "
 msgstr ", đặt kiểu mã hóa thành "
 
-#: src/cryptsetup_reencrypt.c:1320
+#: src/cryptsetup_reencrypt.c:1675
 msgid "Argument required."
 msgstr "Cần đối số."
 
-#: src/cryptsetup_reencrypt.c:1336
-msgid ""
-"Only values between 1 MiB and 64 MiB allowed for reencryption block size."
-msgstr ""
-"Chỉ những giá trị nằm giữa 1MiB và 64 MiB là cho phép đối với kích thước "
-"khối reencryption (mã hóa lại)."
-
-#: src/cryptsetup_reencrypt.c:1355 src/cryptsetup_reencrypt.c:1360
-msgid "Invalid device size specification."
-msgstr "Đặc tả kích thước thiết bị không đúng."
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "Chỉ những giá trị nằm giữa 1MiB và 64 MiB là cho phép đối với kích thước khối reencryption (mã hóa lại)."
 
-#: src/cryptsetup_reencrypt.c:1363
+#: src/cryptsetup_reencrypt.c:1730
 msgid "Maximum device reduce size is 64 MiB."
 msgstr "Kích thước thu nhỏ thiết bị tối đa là 64 MiB."
 
-#: src/cryptsetup_reencrypt.c:1366
-msgid "Reduce size must be multiple of 512 bytes sector."
-msgstr "Kích cỡ giảm phải là bội số cung từ (sector) 512 byte"
-
-#: src/cryptsetup_reencrypt.c:1370
-msgid "Option --new must be used together with --reduce-device-size."
+#: src/cryptsetup_reencrypt.c:1737
+#, fuzzy
+msgid "Option --new must be used together with --reduce-device-size or --header."
 msgstr "Tùy chọn “--new” phải được sử dụng cùng với “--reduce-device-size”."
 
-#: src/cryptsetup_reencrypt.c:1374
-msgid "Option --keep-key can be used only with --hash or --iter-time."
+#: src/cryptsetup_reencrypt.c:1741
+#, fuzzy
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
 msgstr "Tùy chọn “--keep-key” có thể dùng với “--hash” hoặc “--iter-time”."
 
-#: src/cryptsetup_reencrypt.c:1378
+#: src/cryptsetup_reencrypt.c:1745
 msgid "Option --new cannot be used together with --decrypt."
 msgstr "Tùy chọn “--new” không được sử dụng cùng với “ --decrypt”."
 
-#: src/cryptsetup_reencrypt.c:1382
+#: src/cryptsetup_reencrypt.c:1749
 msgid "Option --decrypt is incompatible with specified parameters."
 msgstr "Tùy chọn --decrypt không tương thích với các đối số đã cho."
 
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "Tùy chọn “--uuid” chỉ được sử dụng cùng với “ --decrypt”."
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr ""
+
 #: src/utils_tools.c:151
-msgid "Error reading response from terminal.\n"
+#, fuzzy
+msgid "Error reading response from terminal."
 msgstr "Gặp lỗi khi đọc phản hồi từ thiết bị cuối.\n"
 
-#: src/utils_tools.c:173
+#: src/utils_tools.c:186
 msgid "Command successful.\n"
 msgstr "Câu lệnh đã chạy thành công.\n"
 
-#: src/utils_tools.c:191
-#, c-format
-msgid "Command failed with code %i"
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr ""
+
+#: src/utils_tools.c:196
+#, fuzzy
+msgid "no permission or bad passphrase"
+msgstr "Nhập bất cứ cụm từ mật khẩu nào: "
+
+#: src/utils_tools.c:198
+#, fuzzy
+msgid "out of memory"
+msgstr "Không thể mở khóa bộ nhớ.\n"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr ""
+
+#: src/utils_tools.c:202
+#, fuzzy
+msgid "device already exists or device is busy"
+msgstr "Thiết bị %s đã sẵn có.\n"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr ""
+
+#: src/utils_tools.c:206
+#, fuzzy, c-format
+msgid "Command failed with code %i (%s).\n"
 msgstr "Câu lệnh đã thất bại với mã %i"
 
-#: src/utils_password.c:42
+#: src/utils_tools.c:283
+#, fuzzy, c-format
+msgid "Key slot %i created."
+msgstr "Khe khóa %d đã thay đổi.\n"
+
+#: src/utils_tools.c:285
+#, fuzzy, c-format
+msgid "Key slot %i unlocked."
+msgstr "Khe khóa %d được mở khóa.\n"
+
+#: src/utils_tools.c:287
+#, fuzzy, c-format
+msgid "Key slot %i removed."
+msgstr "Khe khóa %d được mở khóa.\n"
+
+#: src/utils_tools.c:296
 #, c-format
-msgid "Cannot check password quality: %s\n"
-msgstr "Không thể kiểm tra chất lượng mật khẩu: %s\n"
+msgid "Token %i created."
+msgstr ""
+
+#: src/utils_tools.c:298
+#, c-format
+msgid "Token %i removed."
+msgstr ""
+
+#: src/utils_tools.c:464
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr ""
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+#, fuzzy
+msgid "Failed to initialize device signature probes."
+msgstr "Lỗi lấy thư mục trình ánh xạ thiết bị."
 
-#: src/utils_password.c:50
+#: src/utils_tools.c:548
+#, fuzzy, c-format
+msgid "Failed to stat device %s."
+msgstr "Gặp lỗi khi lấy thông tin tập tin khóa.\n"
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr ""
+
+#: src/utils_tools.c:563
+#, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr ""
+
+#: src/utils_tools.c:577
 #, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:583
+#, fuzzy
+msgid "Failed to wipe device signature."
+msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
+
+#: src/utils_tools.c:590
+#, fuzzy, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr "Lỗi lấy thư mục trình ánh xạ thiết bị."
+
+#: src/utils_tools.c:629
+#, fuzzy
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr "Kích thước khối mã hóa lại"
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, fuzzy, c-format
+msgid "Cannot check password quality: %s"
+msgstr "Không thể kiểm tra chất lượng mật khẩu: %s\n"
+
+#: src/utils_password.c:51
+#, fuzzy, c-format
 msgid ""
 "Password quality check failed:\n"
-" %s\n"
+" %s"
 msgstr ""
 "Chất lượng mật khẩu không đạt:\n"
 " %s\n"
 
+#: src/utils_password.c:83
+#, fuzzy, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "Gặp lỗi khi kiểm tra chất lượng mật khẩu: mật khẩu sai (%s)\n"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+#, fuzzy
+msgid "Error reading passphrase from terminal."
+msgstr "Gặp lỗi khi đọc cụm từ mật khẩu từ thiết bị cuối.\n"
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "Nhập lại mật khẩu: "
+
+#: src/utils_password.c:213
+#, fuzzy
+msgid "Passphrases do not match."
+msgstr "Hai cụm từ mật khẩu không trùng nhau.\n"
+
+#: src/utils_password.c:250
+#, fuzzy
+msgid "Cannot use offset with terminal input."
+msgstr "Không thể sử dụng khoảng bù (offset) với đầu vào là thiết bị cuối.\n"
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "Gõ cụm từ mật khẩu: "
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "Nhập cụm từ mật khẩu cho %s: "
+
+#: src/utils_password.c:287
+#, fuzzy
+msgid "No key available with this passphrase."
+msgstr "Không có khóa sẵn sàng dùng với cụm từ mật khẩu này.\n"
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr ""
+
+#: src/utils_password.c:328
+#, fuzzy, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "Không thể mở tập tin %s.\n"
+
+#: src/utils_password.c:335
+#, fuzzy, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "Không thể đọc tập-tin khóa %s.\n"
+
+#: src/utils_luks2.c:47
+#, fuzzy, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr ""
+
+#: src/utils_luks2.c:67
+#, fuzzy
+msgid "Failed to read JSON file."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
+
+#: src/utils_luks2.c:72
+#, fuzzy
+msgid ""
+"\n"
+"Read interrupted."
+msgstr "phần đầu VERITY sai hỏng.\n"
+
+#: src/utils_luks2.c:113
+#, fuzzy, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
+
+#: src/utils_luks2.c:122
+msgid ""
+"\n"
+"Write interrupted."
+msgstr ""
+
+#: src/utils_luks2.c:126
+#, fuzzy
+msgid "Failed to write JSON file."
+msgstr "Gặp lỗi khi mở tập tin khóa.\n"
+
+#~ msgid "Replaced with key slot %d.\n"
+#~ msgstr "Đã thay thế với khe khóa %d.\n"
+
+#~ msgid "Function not available in FIPS mode.\n"
+#~ msgstr "Chức năng không khả dụng trong chế độ “FIPS”.\n"
+
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "Có quá nhiều mức cây cho mỗi vùng xác thực.\n"
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "gặp lỗi phân cấp vùng nhớ trong“action_luksFormat”"
+
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "Khóa %d không hoạt động thì không xóa được.\n"
+
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<tên> <thiết-bị-dữ-liệu> <thiết-bị-băm> <mã-băm-gốc>"
+
+#~ msgid "create active device"
+#~ msgstr "tạo thiết bị hoạt động"
+
+#~ msgid "remove (deactivate) device"
+#~ msgstr "gỡ bỏ (dừng hoạt động) thiết bị"
+
+#~ msgid "Activated keyslot %i.\n"
+#~ msgstr "Khe-khóa (keyslot) đã được kích hoạt %i.\n"
+
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "Diễn biến: %5.1f%%, ETA %02llu:%02llu, đã ghi %4llu MiB, tốc độ %5.1f MiB/s%s"
+
+#~ msgid "Interrupted by a signal.\n"
+#~ msgstr "Bị ngắt bởi tín hiệu signal.\n"
+
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "Không tìm thấy thiết bị vòng ngược (loopback) nào còn rảnh.\n"
+
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "Không thể mở thiết bị %s\n"
+
+#~ msgid "Cannot use passed UUID unless decryption in progress.\n"
+#~ msgstr "Không thể dùng UUID chuyển qua trừ khi việc giải mã đang được thực hiện.\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "Đánh dấu thiết bị LUKS %s là có thể dùng.\n"
+
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "CẢNH BÁO: đây chỉ là mã thử nghiệm, nó có thể phá hoại dữ liệu của bạn.\n"
+
 #~ msgid "FIPS checksum verification failed.\n"
 #~ msgstr "Thẩm tra mã băm FIPS không đạt.\n"
 
-#~ msgid ""
-#~ "WARNING: device %s is a partition, for TCRYPT system encryption you "
-#~ "usually need to use whole block device path.\n"
-#~ msgstr ""
-#~ "CẢNH BÁO: thiết-bị %s là một phân vùng, với mã hóa hệ thống TCRYPT bạn "
-#~ "thường cần phải sử dụng toàn bộ đường dẫn thiết-bị khối.\n"
+#~ msgid "WARNING: device %s is a partition, for TCRYPT system encryption you usually need to use whole block device path.\n"
+#~ msgstr "CẢNH BÁO: thiết-bị %s là một phân vùng, với mã hóa hệ thống TCRYPT bạn thường cần phải sử dụng toàn bộ đường dẫn thiết-bị khối.\n"
 
 #~ msgid "Kernel doesn't support plain64 IV.\n"
 #~ msgstr "Nhân không hỗ trợ plain64 IV.\n"
@@ -1902,15 +4200,9 @@ msgstr ""
 #~ msgid "Enter any LUKS passphrase: "
 #~ msgstr "Nhập mật khẩu LUKS vào: "
 
-#~ msgid "Failed to obtain device mapper directory."
-#~ msgstr "Lỗi lấy thư mục trình ánh xạ thiết bị."
-
 #~ msgid "Backup file %s doesn't exist.\n"
 #~ msgstr "Tập tin sao lưu %s không tồn tại.\n"
 
-#~ msgid "Cannot open file %s.\n"
-#~ msgstr "Không thể mở tập tin %s.\n"
-
 #~ msgid "<name> <device>"
 #~ msgstr "<tên> <thiết_bị>"
 
@@ -1929,12 +4221,8 @@ msgstr ""
 #~ msgid "remove loop-AES mapping"
 #~ msgstr "gỡ bỏ ánh xạ loop-AES"
 
-#~ msgid ""
-#~ "Option --allow-discards is allowed only for luksOpen, loopaesOpen and "
-#~ "create operation.\n"
-#~ msgstr ""
-#~ "Tùy chọn “--allow-discards” thì chỉ cho phép với thao tác “luksOpen”, "
-#~ "“loopaesOpen” và tạo (create).\n"
+#~ msgid "Option --allow-discards is allowed only for luksOpen, loopaesOpen and create operation.\n"
+#~ msgstr "Tùy chọn “--allow-discards” thì chỉ cho phép với thao tác “luksOpen”, “loopaesOpen” và tạo (create).\n"
 
 #~ msgid "Cannot open device %s for %s%s access.\n"
 #~ msgstr "Không thể mở thiết bị %s cho truy cập %s%s.\n"
@@ -1949,41 +4237,19 @@ msgstr ""
 #~ msgstr "chỉ đọc"
 
 #~ msgid "WARNING!!! Possibly insecure memory. Are you root?\n"
-#~ msgstr ""
-#~ "CẢNH BÁO!!! Có thể là vùng nhớ không an toàn. Bạn có đang chạy dưới quyền "
-#~ "siêu người dùng (root) không?\n"
+#~ msgstr "CẢNH BÁO!!! Có thể là vùng nhớ không an toàn. Bạn có đang chạy dưới quyền siêu người dùng (root) không?\n"
 
 #~ msgid "Unable to obtain sector size for %s"
 #~ msgstr "Không thể lấy kích cỡ cung từ cho %s"
 
-#~ msgid "Failed to write to key storage.\n"
-#~ msgstr "Lỗi ghi khóa vào kho lưu khóa.\n"
-
-#~ msgid "Failed to read from key storage.\n"
-#~ msgstr "Lỗi đọc từ kho lưu khóa.\n"
-
-#~ msgid ""
-#~ "Cannot use device %s (crypt segments overlaps or in use by another "
-#~ "device).\n"
-#~ msgstr ""
-#~ "Không thể sử dụng thiết bị %s (các đoạn crypt chồng lên nhau hay đang sử "
-#~ "dụng bởi thiết bị khác).\n"
+#~ msgid "Cannot use device %s (crypt segments overlaps or in use by another device).\n"
+#~ msgstr "Không thể sử dụng thiết bị %s (các đoạn crypt chồng lên nhau hay đang sử dụng bởi thiết bị khác).\n"
 
 #~ msgid "Cannot find compatible device-mapper kernel modules.\n"
 #~ msgstr "Không tìm thấy mô-đun hạt nhân ánh xạ thiết bị tương thích.\n"
 
-#~ msgid "Key slot %d verified.\n"
-#~ msgstr "Khe khóa %d được thẩm định.\n"
-
-#~ msgid "Invalid key size %d.\n"
-#~ msgstr "Kích cỡ khóa không đúng %d.\n"
-
-#~ msgid ""
-#~ "Warning: exhausting read requested, but key file %s is not a regular "
-#~ "file, function might never return.\n"
-#~ msgstr ""
-#~ "Cảnh báo: yêu cầu một hàm đọc vét kiệt mà tập tin khóa %s không phải là "
-#~ "một tập tin thông thường thì có thể là hàm chưa bao giờ trả lại.\n"
+#~ msgid "Warning: exhausting read requested, but key file %s is not a regular file, function might never return.\n"
+#~ msgstr "Cảnh báo: yêu cầu một hàm đọc vét kiệt mà tập tin khóa %s không phải là một tập tin thông thường thì có thể là hàm chưa bao giờ trả lại.\n"
 
 #~ msgid "Cannot open device: %s\n"
 #~ msgstr "Không thể mở thiết bị: %s\n"
@@ -2001,15 +4267,11 @@ msgstr ""
 #~ msgstr "sửa đổi thiết bị hoạt động - BỊ PHẢN ĐỐI - xem trang hướng dẫn"
 
 #~ msgid ""
-#~ "The reload action is deprecated. Please use`dmsetup reload' in case you "
-#~ "really need this functionality.\n"
-#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, "
-#~ "hit Ctrl-C now.\n"
+#~ "The reload action is deprecated. Please use`dmsetup reload' in case you really need this functionality.\n"
+#~ "WARNING: do not use reload to touch LUKS devices. If that is the case, hit Ctrl-C now.\n"
 #~ msgstr ""
-#~ "Thao tác nạp lại bị phản đối. Hãy sử dụng“dmsetup reload” trong trường "
-#~ "hợp bạn thực sự yêu cầu chức năng này.\n"
-#~ "CẢNH BÁO: đừng sử dụng chức năng nạp lại để thao tác thiết bị kiểu LUKS. "
-#~ "Trong trường hợp đó, bấm tổ hợp phím Ctrl-C ngay bây giờ.\n"
+#~ "Thao tác nạp lại bị phản đối. Hãy sử dụng“dmsetup reload” trong trường hợp bạn thực sự yêu cầu chức năng này.\n"
+#~ "CẢNH BÁO: đừng sử dụng chức năng nạp lại để thao tác thiết bị kiểu LUKS. Trong trường hợp đó, bấm tổ hợp phím Ctrl-C ngay bây giờ.\n"
 
 #~ msgid "Obsolete option --non-exclusive is ignored.\n"
 #~ msgstr "Tùy chọn cũ“--non-exclusive” bị bỏ qua.\n"
diff --git a/po/zh_CN.gmo b/po/zh_CN.gmo
new file mode 100644 (file)
index 0000000..c133bc4
Binary files /dev/null and b/po/zh_CN.gmo differ
diff --git a/po/zh_CN.po b/po/zh_CN.po
new file mode 100644 (file)
index 0000000..8ac1d9f
--- /dev/null
@@ -0,0 +1,4122 @@
+# Chinese simplified translation for cryptsetup.
+# Copyright (C) 2015 Free Software Foundation, Inc.
+# This file is distributed under the same license as the cryptsetup package.
+# Mingcong Bai <jeffbai@aosc.xyz>, 2015.
+# Mingye Wang <arthur200126@gmail.com>, 2015.
+# Boyuan Yang <073plan@gmail.com>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: cryptsetup 2.0.3.1\n"
+"Report-Msgid-Bugs-To: dm-crypt@saout.de\n"
+"POT-Creation-Date: 2020-05-28 11:32+0200\n"
+"PO-Revision-Date: 2018-04-27 22:41+0800\n"
+"Last-Translator: Boyuan Yang <073plan@gmail.com>\n"
+"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
+"Language: zh_CN\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Bugs: Report translation errors to the Language-Team address.\n"
+"X-Generator: Poedit 2.0.6\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+#: lib/libdevmapper.c:399
+msgid "Cannot initialize device-mapper, running as non-root user."
+msgstr "无法初始化设备映射器,正作为非 root 用户运行。"
+
+#: lib/libdevmapper.c:402
+msgid "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
+msgstr "无法初始化设备映射器。dm_mod 内核模块装载了吗?"
+
+#: lib/libdevmapper.c:1131
+msgid "Requested deferred flag is not supported."
+msgstr "不支持请求的推迟(deferred)标记。"
+
+#: lib/libdevmapper.c:1198
+#, c-format
+msgid "DM-UUID for device %s was truncated."
+msgstr "设备 %s 的 DM-UUID 被截断。"
+
+#: lib/libdevmapper.c:1520
+#, fuzzy
+msgid "Unknown dm target type."
+msgstr "未知的 PBKDF 类型 %s。"
+
+#: lib/libdevmapper.c:1623 lib/libdevmapper.c:1679
+msgid "Requested dm-crypt performance options are not supported."
+msgstr "不支持请求的 dm-crypt 性能选项。"
+
+#: lib/libdevmapper.c:1630
+msgid "Requested dm-verity data corruption handling options are not supported."
+msgstr "不支持请求的 dm-verity 数据损坏处理选项。"
+
+#: lib/libdevmapper.c:1634
+msgid "Requested dm-verity FEC options are not supported."
+msgstr "不支持请求的 dm-verity FEC 选项。"
+
+#: lib/libdevmapper.c:1638
+msgid "Requested data integrity options are not supported."
+msgstr "不支持请求的数据完整性选项。"
+
+#: lib/libdevmapper.c:1640
+msgid "Requested sector_size option is not supported."
+msgstr "不支持请求的 sector_size 选项。"
+
+#: lib/libdevmapper.c:1645
+#, fuzzy
+msgid "Requested automatic recalculation of integrity tags is not supported."
+msgstr "不支持请求的数据完整性选项。"
+
+#: lib/libdevmapper.c:1649 lib/libdevmapper.c:1682 lib/libdevmapper.c:1685
+#: lib/luks2/luks2_json_metadata.c:2160
+#, fuzzy
+msgid "Discard/TRIM is not supported."
+msgstr "不支持哈希算法 %s。"
+
+#: lib/libdevmapper.c:1653
+#, fuzzy
+msgid "Requested dm-integrity bitmap mode is not supported."
+msgstr "不支持请求的数据完整性选项。"
+
+#: lib/libdevmapper.c:2607
+#, c-format
+msgid "Failed to query dm-%s segment."
+msgstr ""
+
+#: lib/random.c:75
+msgid ""
+"System is out of entropy while generating volume key.\n"
+"Please move mouse or type some text in another window to gather some random events.\n"
+msgstr ""
+"系统在生成卷密钥时熵不足。\n"
+"请随意移动鼠标或是在别的窗口打字,以便生成随机事件让系统使用。\n"
+
+#: lib/random.c:79
+#, c-format
+msgid "Generating key (%d%% done).\n"
+msgstr "正生成密钥(%d%% 已完成)\n"
+
+#: lib/random.c:165
+msgid "Running in FIPS mode."
+msgstr "在 FIPS 模式下运行。"
+
+#: lib/random.c:171
+msgid "Fatal error during RNG initialisation."
+msgstr "随机数生成器初始化时发生致命错误。"
+
+#: lib/random.c:208
+msgid "Unknown RNG quality requested."
+msgstr "未知的随机数生成器质量请求。"
+
+#: lib/random.c:213
+msgid "Error reading from RNG."
+msgstr "从随机数生成器(RNG)读取时出错。"
+
+#: lib/setup.c:229
+msgid "Cannot initialize crypto RNG backend."
+msgstr "无法初始化加密随机数生成器后端。"
+
+#: lib/setup.c:235
+msgid "Cannot initialize crypto backend."
+msgstr "无法初始化加密后端。"
+
+#: lib/setup.c:266 lib/setup.c:2046 lib/verity/verity.c:119
+#, c-format
+msgid "Hash algorithm %s not supported."
+msgstr "不支持哈希算法 %s。"
+
+#: lib/setup.c:269 lib/loopaes/loopaes.c:90
+#, c-format
+msgid "Key processing error (using hash %s)."
+msgstr "密钥处理错误(使用散列 %s)。"
+
+#: lib/setup.c:335 lib/setup.c:362
+msgid "Cannot determine device type. Incompatible activation of device?"
+msgstr "无法确定设备类型。不兼容的设备激活?"
+
+#: lib/setup.c:341 lib/setup.c:3050
+msgid "This operation is supported only for LUKS device."
+msgstr "此操作只适用 LUKS 设备。"
+
+#: lib/setup.c:368
+msgid "This operation is supported only for LUKS2 device."
+msgstr "此操作只适用 LUKS2 设备。"
+
+#: lib/setup.c:423 lib/luks2/luks2_reencrypt.c:2345
+msgid "All key slots full."
+msgstr "密钥槽全都满了。"
+
+#: lib/setup.c:434
+#, c-format
+msgid "Key slot %d is invalid, please select between 0 and %d."
+msgstr "密钥槽 %d 无效,请选择 0 到 %d 间的数字。"
+
+#: lib/setup.c:440
+#, c-format
+msgid "Key slot %d is full, please select another one."
+msgstr "密钥槽 %d 满了,请选择另一个。"
+
+#: lib/setup.c:525 lib/setup.c:2824
+#, fuzzy
+msgid "Device size is not aligned to device logical block size."
+msgstr "设备 %s 的大小没有和请求的扇区大小对齐(%u 字节)。"
+
+#: lib/setup.c:624
+#, c-format
+msgid "Header detected but device %s is too small."
+msgstr "检测到标头但设备 %s 太小。"
+
+#: lib/setup.c:661
+msgid "This operation is not supported for this device type."
+msgstr "不支持在这类设备上执行此操作。"
+
+#: lib/setup.c:666
+#, fuzzy
+msgid "Illegal operation with reencryption in-progress."
+msgstr "正在进行离线重加密。中止。"
+
+#: lib/setup.c:832 lib/luks1/keymanage.c:475
+#, c-format
+msgid "Unsupported LUKS version %d."
+msgstr "不支持的 LUKS 版本 %d。"
+
+#: lib/setup.c:849 lib/setup.c:1539 lib/setup.c:1959
+#, fuzzy
+msgid "Detached metadata device is not supported for this crypt type."
+msgstr "此加密类型不支持 UUID。"
+
+#: lib/setup.c:1427 lib/setup.c:2544 lib/setup.c:2616 lib/setup.c:2628
+#: lib/setup.c:2777 lib/setup.c:4512
+#, c-format
+msgid "Device %s is not active."
+msgstr "设备 %s 未激活。"
+
+#: lib/setup.c:1444
+#, c-format
+msgid "Underlying device for crypt device %s disappeared."
+msgstr "加密设备 %s 下层的设备消失了。"
+
+#: lib/setup.c:1524
+msgid "Invalid plain crypt parameters."
+msgstr "无效的纯加密选项。"
+
+#: lib/setup.c:1529 lib/setup.c:1949 src/integritysetup.c:74
+msgid "Invalid key size."
+msgstr "无效的密钥大小。"
+
+#: lib/setup.c:1534 lib/setup.c:1954 lib/setup.c:2157
+msgid "UUID is not supported for this crypt type."
+msgstr "此加密类型不支持 UUID。"
+
+#: lib/setup.c:1549 lib/setup.c:1739 lib/luks2/luks2_reencrypt.c:2308
+#: src/cryptsetup.c:1226 src/cryptsetup.c:3923
+msgid "Unsupported encryption sector size."
+msgstr "不支持的加密扇区大小。"
+
+#: lib/setup.c:1557 lib/setup.c:1864 lib/setup.c:2818
+#, fuzzy
+msgid "Device size is not aligned to requested sector size."
+msgstr "设备 %s 的大小没有和请求的扇区大小对齐(%u 字节)。"
+
+#: lib/setup.c:1608 lib/setup.c:1727
+msgid "Can't format LUKS without device."
+msgstr "无法在没有设备的情况下格式化 LUKS。"
+
+#: lib/setup.c:1614 lib/setup.c:1733
+msgid "Requested data alignment is not compatible with data offset."
+msgstr ""
+
+#: lib/setup.c:1682 lib/setup.c:1851
+msgid "WARNING: Data offset is outside of currently available data device.\n"
+msgstr ""
+
+#: lib/setup.c:1692 lib/setup.c:1879 lib/setup.c:1900 lib/setup.c:2169
+#, c-format
+msgid "Cannot wipe header on device %s."
+msgstr "无法将设备 %s 上的标头擦除。"
+
+#: lib/setup.c:1744
+msgid "WARNING: The device activation will fail, dm-crypt is missing support for requested encryption sector size.\n"
+msgstr ""
+
+#: lib/setup.c:1766
+msgid "Volume key is too small for encryption with integrity extensions."
+msgstr "卷密钥对于带完整性校验扩展的加密而言过小。"
+
+#: lib/setup.c:1821
+#, fuzzy, c-format
+msgid "Cipher %s-%s (key size %zd bits) is not available."
+msgstr "密文 %s 不可用。\n"
+
+#: lib/setup.c:1854
+#, c-format
+msgid "WARNING: LUKS2 metadata size changed to %<PRIu64> bytes.\n"
+msgstr ""
+
+#: lib/setup.c:1858
+#, c-format
+msgid "WARNING: LUKS2 keyslots area size changed to %<PRIu64> bytes.\n"
+msgstr ""
+
+#: lib/setup.c:1882 lib/utils_device.c:828 lib/luks1/keyencryption.c:255
+#: lib/luks2/luks2_reencrypt.c:2356 lib/luks2/luks2_reencrypt.c:3367
+#, c-format
+msgid "Device %s is too small."
+msgstr "设备 %s 太小。"
+
+#: lib/setup.c:1893 lib/setup.c:1919
+#, c-format
+msgid "Cannot format device %s in use."
+msgstr "无法格式化正在使用的设备 %s。"
+
+#: lib/setup.c:1896 lib/setup.c:1922
+#, c-format
+msgid "Cannot format device %s, permission denied."
+msgstr "无法格式化设备 %s,权限被拒绝。"
+
+#: lib/setup.c:1908 lib/setup.c:2229
+#, fuzzy, c-format
+msgid "Cannot format integrity for device %s."
+msgstr "无法写入设备 %s。\n"
+
+#: lib/setup.c:1926
+#, c-format
+msgid "Cannot format device %s."
+msgstr "无法格式化设备 %s。"
+
+#: lib/setup.c:1944
+msgid "Can't format LOOPAES without device."
+msgstr "无法在没有设备的情况下格式化 LOOPAES。"
+
+#: lib/setup.c:1989
+msgid "Can't format VERITY without device."
+msgstr "无法在没有设备的情况下格式化 VERIFY。"
+
+#: lib/setup.c:2000 lib/verity/verity.c:102
+#, c-format
+msgid "Unsupported VERITY hash type %d."
+msgstr "不支持的 VERITY 哈希类型 %d。"
+
+#: lib/setup.c:2006 lib/verity/verity.c:110
+msgid "Unsupported VERITY block size."
+msgstr "不支持的 VERITY 块大小。"
+
+#: lib/setup.c:2011 lib/verity/verity.c:74
+msgid "Unsupported VERITY hash offset."
+msgstr "不支持的 VERITY 哈希偏移量。"
+
+#: lib/setup.c:2016
+msgid "Unsupported VERITY FEC offset."
+msgstr "不支持的 VERITY 哈希偏移量。"
+
+#: lib/setup.c:2040
+msgid "Data area overlaps with hash area."
+msgstr "数据区域重叠覆盖了哈希区域。"
+
+#: lib/setup.c:2065
+msgid "Hash area overlaps with FEC area."
+msgstr "哈希区域重叠覆盖了 FEC 区域。"
+
+#: lib/setup.c:2072
+msgid "Data area overlaps with FEC area."
+msgstr "数据区域重叠覆盖了 FEC 区域。"
+
+#: lib/setup.c:2208
+#, c-format
+msgid "WARNING: Requested tag size %d bytes differs from %s size output (%d bytes).\n"
+msgstr ""
+
+#: lib/setup.c:2286
+#, c-format
+msgid "Unknown crypt device type %s requested."
+msgstr "请求了未知的加密设备类型 %s。"
+
+#: lib/setup.c:2550 lib/setup.c:2622 lib/setup.c:2635
+#, fuzzy, c-format
+msgid "Unsupported parameters on device %s."
+msgstr "无法将设备 %s 上的标头擦除。"
+
+#: lib/setup.c:2556 lib/setup.c:2641 lib/luks2/luks2_reencrypt.c:2408
+#: lib/luks2/luks2_reencrypt.c:2737
+#, fuzzy, c-format
+msgid "Mismatching parameters on device %s."
+msgstr "无法将设备 %s 上的标头擦除。"
+
+#: lib/setup.c:2661
+msgid "Crypt devices mismatch."
+msgstr ""
+
+#: lib/setup.c:2698 lib/setup.c:2703 lib/luks2/luks2_reencrypt.c:2054
+#: lib/luks2/luks2_reencrypt.c:3145
+#, fuzzy, c-format
+msgid "Failed to reload device %s."
+msgstr "无法获取设备 %s 的读取锁。"
+
+#: lib/setup.c:2708 lib/setup.c:2713 lib/luks2/luks2_reencrypt.c:2025
+#: lib/luks2/luks2_reencrypt.c:2032
+#, fuzzy, c-format
+msgid "Failed to suspend device %s."
+msgstr "无法获取设备 %s 的读取锁。"
+
+#: lib/setup.c:2718 lib/luks2/luks2_reencrypt.c:2039
+#: lib/luks2/luks2_reencrypt.c:3080 lib/luks2/luks2_reencrypt.c:3149
+#, fuzzy, c-format
+msgid "Failed to resume device %s."
+msgstr "打开临时密钥存储设备失败。\n"
+
+#: lib/setup.c:2732
+#, c-format
+msgid "Fatal error while reloading device %s (on top of device %s)."
+msgstr ""
+
+#: lib/setup.c:2735 lib/setup.c:2737
+#, fuzzy, c-format
+msgid "Failed to switch device %s to dm-error."
+msgstr "无法获取设备 %s 上的写入锁。"
+
+#: lib/setup.c:2809
+msgid "Cannot resize loop device."
+msgstr "无法改变回环设备大小。"
+
+#: lib/setup.c:2882
+msgid "Do you really want to change UUID of device?"
+msgstr "你真的想改变设备的 UUID 吗?"
+
+#: lib/setup.c:2958
+msgid "Header backup file does not contain compatible LUKS header."
+msgstr "标头备份文件不包含兼容的 LUKS 标头。"
+
+#: lib/setup.c:3058
+#, c-format
+msgid "Volume %s is not active."
+msgstr "卷 %s 未激活。"
+
+#: lib/setup.c:3069
+#, c-format
+msgid "Volume %s is already suspended."
+msgstr "卷 %s 已挂起。"
+
+#: lib/setup.c:3082
+#, c-format
+msgid "Suspend is not supported for device %s."
+msgstr "设备 %s 不支持挂起。"
+
+#: lib/setup.c:3084
+#, c-format
+msgid "Error during suspending device %s."
+msgstr "挂起设备 %s 时出错。"
+
+#: lib/setup.c:3117 lib/setup.c:3184 lib/setup.c:3267
+#, c-format
+msgid "Volume %s is not suspended."
+msgstr "卷 %s 未挂起。"
+
+#: lib/setup.c:3146
+#, c-format
+msgid "Resume is not supported for device %s."
+msgstr "设备 %s 不支持恢复。"
+
+#: lib/setup.c:3148 lib/setup.c:3216 lib/setup.c:3297
+#, c-format
+msgid "Error during resuming device %s."
+msgstr "恢复设备 %s 时出错。"
+
+#: lib/setup.c:3282 lib/setup.c:3648 lib/setup.c:4309 lib/setup.c:4322
+#: lib/setup.c:4330 lib/setup.c:4343 lib/setup.c:4693 lib/setup.c:5839
+msgid "Volume key does not match the volume."
+msgstr "卷密钥与卷不匹配。"
+
+#: lib/setup.c:3343 lib/setup.c:3531
+msgid "Cannot add key slot, all slots disabled and no volume key provided."
+msgstr "无法添加密钥槽,所有密钥槽已禁用且未提供卷密钥。"
+
+#: lib/setup.c:3483
+msgid "Failed to swap new key slot."
+msgstr "交换新密钥槽失败。"
+
+#: lib/setup.c:3669
+#, c-format
+msgid "Key slot %d is invalid."
+msgstr "密钥槽 %d 无效。"
+
+#: lib/setup.c:3675 src/cryptsetup.c:1572 src/cryptsetup.c:1917
+#, fuzzy, c-format
+msgid "Keyslot %d is not active."
+msgstr "密钥槽 %d 未使用。\n"
+
+#: lib/setup.c:3694
+#, fuzzy
+msgid "Device header overlaps with data area."
+msgstr "数据区域重叠覆盖了哈希区域。"
+
+#: lib/setup.c:3981
+#, fuzzy
+msgid "Reencryption in-progress. Cannot activate device."
+msgstr "重加密已在进行中。"
+
+#: lib/setup.c:3983 lib/luks2/luks2_json_metadata.c:2243
+#: lib/luks2/luks2_reencrypt.c:2836
+#, fuzzy
+msgid "Failed to get reencryption lock."
+msgstr "无法获取写入设备锁。"
+
+#: lib/setup.c:3996 lib/luks2/luks2_reencrypt.c:2855
+#, fuzzy
+msgid "LUKS2 reencryption recovery failed."
+msgstr "不支持的加密扇区大小。"
+
+#: lib/setup.c:4127 lib/setup.c:4379
+#, fuzzy
+msgid "Device type is not properly initialized."
+msgstr "设备类型未正确初始化。"
+
+#: lib/setup.c:4171
+#, c-format
+msgid "Cannot use device %s, name is invalid or still in use."
+msgstr "无法使用设备 %s,名称无效或它正被使用。"
+
+#: lib/setup.c:4174
+#, c-format
+msgid "Device %s already exists."
+msgstr "设备 %s 已存在。"
+
+#: lib/setup.c:4296
+msgid "Incorrect volume key specified for plain device."
+msgstr "为普通设备指定的卷密钥有误。"
+
+#: lib/setup.c:4405
+msgid "Incorrect root hash specified for verity device."
+msgstr "为 verity 设备指定的根 hash 不正确。"
+
+#: lib/setup.c:4412
+msgid "Root hash signature required."
+msgstr ""
+
+#: lib/setup.c:4421
+#, fuzzy
+msgid "Kernel keyring missing: required for passing signature to kernel."
+msgstr "该内核不支持内核密钥环。"
+
+#: lib/setup.c:4438 lib/setup.c:5915
+msgid "Failed to load key in kernel keyring."
+msgstr "在内核密钥环中加载密钥失败。"
+
+#: lib/setup.c:4491 lib/setup.c:4507 lib/luks2/luks2_json_metadata.c:2296
+#: src/cryptsetup.c:2664
+#, c-format
+msgid "Device %s is still in use."
+msgstr "设备 %s 仍在使用。"
+
+#: lib/setup.c:4516
+#, c-format
+msgid "Invalid device %s."
+msgstr "设备 %s 无效。"
+
+#: lib/setup.c:4632
+msgid "Volume key buffer too small."
+msgstr "卷密钥缓冲区太小。"
+
+#: lib/setup.c:4640
+msgid "Cannot retrieve volume key for plain device."
+msgstr "无法获取普通设备的卷密钥。"
+
+#: lib/setup.c:4657
+#, fuzzy
+msgid "Cannot retrieve root hash for verity device."
+msgstr "为 verity 设备指定的根 hash 不正确。"
+
+#: lib/setup.c:4659
+#, c-format
+msgid "This operation is not supported for %s crypt device."
+msgstr "不支持在 %s 加密设备上执行此操作。"
+
+#: lib/setup.c:4865
+msgid "Dump operation is not supported for this device type."
+msgstr "不支持在此类设备上执行导出操作。"
+
+#: lib/setup.c:5190
+#, c-format
+msgid "Data offset is not multiple of %u bytes."
+msgstr ""
+
+#: lib/setup.c:5475
+#, c-format
+msgid "Cannot convert device %s which is still in use."
+msgstr "无法转换正在使用的设备 %s。"
+
+#: lib/setup.c:5772
+#, c-format
+msgid "Failed to assign keyslot %u as the new volume key."
+msgstr "将密钥槽 %u 指定为新卷密钥的操作失败。"
+
+#: lib/setup.c:5845
+#, fuzzy
+msgid "Failed to initialize default LUKS2 keyslot parameters."
+msgstr "初始化默认 LUKS2 密钥槽参数失败。"
+
+#: lib/setup.c:5851
+#, fuzzy, c-format
+msgid "Failed to assign keyslot %d to digest."
+msgstr "交换新密钥槽失败。\n"
+
+#: lib/setup.c:5982
+msgid "Kernel keyring is not supported by the kernel."
+msgstr "该内核不支持内核密钥环。"
+
+#: lib/setup.c:5992 lib/luks2/luks2_reencrypt.c:2952
+#, c-format
+msgid "Failed to read passphrase from keyring (error %d)."
+msgstr "从密钥环读取口令失败(错误 %d)。"
+
+#: lib/setup.c:6016
+msgid "Failed to acquire global memory-hard access serialization lock."
+msgstr ""
+
+#: lib/utils.c:80
+msgid "Cannot get process priority."
+msgstr "无法获取进程优先级。"
+
+#: lib/utils.c:94
+msgid "Cannot unlock memory."
+msgstr "无法解锁内存。"
+
+#: lib/utils.c:168 lib/tcrypt/tcrypt.c:497
+msgid "Failed to open key file."
+msgstr "打开 (open) 密钥文件失败。"
+
+#: lib/utils.c:173
+msgid "Cannot read keyfile from a terminal."
+msgstr "无法从终端读取密钥文件。"
+
+# stat() 主要就是出来一个各种文件信息……
+#: lib/utils.c:190
+msgid "Failed to stat key file."
+msgstr "获取 (stat) 密钥文件信息失败。"
+
+#: lib/utils.c:198 lib/utils.c:219
+msgid "Cannot seek to requested keyfile offset."
+msgstr "无法寻找 (seek) 到请求的密钥文件偏移量。"
+
+#: lib/utils.c:213 lib/utils.c:228 src/utils_password.c:188
+#: src/utils_password.c:201
+msgid "Out of memory while reading passphrase."
+msgstr "读取密码时内存耗尽。"
+
+#: lib/utils.c:248
+msgid "Error reading passphrase."
+msgstr "读取口令出错。"
+
+#: lib/utils.c:265
+msgid "Nothing to read on input."
+msgstr ""
+
+#: lib/utils.c:272
+msgid "Maximum keyfile size exceeded."
+msgstr "超出最大密钥文件大小。"
+
+#: lib/utils.c:277
+msgid "Cannot read requested amount of data."
+msgstr "无法读取请求量的数据。"
+
+#: lib/utils_device.c:187 lib/utils_storage_wrappers.c:110
+#: lib/luks1/keyencryption.c:91
+#, fuzzy, c-format
+msgid "Device %s does not exist or access denied."
+msgstr "设备 %s 不存在或访问被拒绝。"
+
+#: lib/utils_device.c:197
+#, fuzzy, c-format
+msgid "Device %s is not compatible."
+msgstr "设备 %s 未激活。"
+
+#: lib/utils_device.c:642
+#, fuzzy, c-format
+msgid "Device %s is too small. Need at least %<PRIu64> bytes."
+msgstr "设备 %s 过小。(LUKS1 需要至少 %<PRIu64> 字节。)"
+
+#: lib/utils_device.c:723
+#, c-format
+msgid "Cannot use device %s which is in use (already mapped or mounted)."
+msgstr "无法使用正被使用的设备 %s(已被映射或挂载)。"
+
+#: lib/utils_device.c:727
+#, c-format
+msgid "Cannot use device %s, permission denied."
+msgstr "无法使用设备 %s,权限被拒绝。"
+
+#: lib/utils_device.c:730
+#, c-format
+msgid "Cannot get info about device %s."
+msgstr "无法获取有关设备 %s 的信息。"
+
+#: lib/utils_device.c:753
+msgid "Cannot use a loopback device, running as non-root user."
+msgstr "无法使用回环设备,正作为非 root 用户运行。"
+
+#: lib/utils_device.c:763
+msgid "Attaching loopback device failed (loop device with autoclear flag is required)."
+msgstr "连接回环设备失败(需要有 autoclear 旗标的回环设备)。"
+
+#: lib/utils_device.c:809
+#, c-format
+msgid "Requested offset is beyond real size of device %s."
+msgstr "请求的偏移量超出设备 %s 的真实大小。"
+
+#: lib/utils_device.c:817
+#, c-format
+msgid "Device %s has zero size."
+msgstr "设备 %s 大小为零。"
+
+#: lib/utils_pbkdf.c:100
+#, fuzzy
+msgid "Requested PBKDF target time cannot be zero."
+msgstr "请求的 PBKDF 目标时间不能为零。"
+
+#: lib/utils_pbkdf.c:106
+#, c-format
+msgid "Unknown PBKDF type %s."
+msgstr "未知的 PBKDF 类型 %s。"
+
+#: lib/utils_pbkdf.c:111
+#, fuzzy, c-format
+msgid "Requested hash %s is not supported."
+msgstr "不支持请求的 LUKS 哈希 %s。"
+
+#: lib/utils_pbkdf.c:122
+msgid "Requested PBKDF type is not supported for LUKS1."
+msgstr "请求的 PBKDF 类型不被 LUKS1 支持。"
+
+#: lib/utils_pbkdf.c:128
+msgid "PBKDF max memory or parallel threads must not be set with pbkdf2."
+msgstr ""
+
+#: lib/utils_pbkdf.c:133 lib/utils_pbkdf.c:143
+#, c-format
+msgid "Forced iteration count is too low for %s (minimum is %u)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:148
+#, c-format
+msgid "Forced memory cost is too low for %s (minimum is %u kilobytes)."
+msgstr ""
+
+#: lib/utils_pbkdf.c:155
+#, c-format
+msgid "Requested maximum PBKDF memory cost is too high (maximum is %d kilobytes)."
+msgstr "请求的最大 PBKDF 内存开销过大(最大为 %d 千字节)。"
+
+#: lib/utils_pbkdf.c:160
+#, fuzzy
+msgid "Requested maximum PBKDF memory cannot be zero."
+msgstr "请求的最大 PBKDF 内存使用量不能为零。"
+
+#: lib/utils_pbkdf.c:164
+#, fuzzy
+msgid "Requested PBKDF parallel threads cannot be zero."
+msgstr "请求的 PBKDF 并行线程数不能为零。"
+
+#: lib/utils_pbkdf.c:184
+msgid "Only PBKDF2 is supported in FIPS mode."
+msgstr ""
+
+#: lib/utils_benchmark.c:172
+msgid "PBKDF benchmark disabled but iterations not set."
+msgstr ""
+
+#: lib/utils_benchmark.c:191
+#, c-format
+msgid "Not compatible PBKDF2 options (using hash algorithm %s)."
+msgstr "PBKDF2 选项不兼容(正在使用哈希算法 %s)。"
+
+#: lib/utils_benchmark.c:211
+msgid "Not compatible PBKDF options."
+msgstr "PBKDF2 选项不兼容。"
+
+#: lib/utils_device_locking.c:102
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (not a directory or missing)."
+msgstr "锁定中止。锁定路径 %s/%s 不可用(不是一个目录或缺失)。"
+
+#: lib/utils_device_locking.c:109
+#, c-format
+msgid "WARNING: Locking directory %s/%s is missing!\n"
+msgstr "警告:锁定目录 %s/%s 缺失!\n"
+
+#: lib/utils_device_locking.c:119
+#, c-format
+msgid "Locking aborted. The locking path %s/%s is unusable (%s is not a directory)."
+msgstr "锁定中止。锁定路径 %s/%s 不可用(%s 不是目录)。"
+
+#: lib/utils_wipe.c:184 src/cryptsetup_reencrypt.c:941
+#: src/cryptsetup_reencrypt.c:1025
+msgid "Cannot seek to device offset."
+msgstr "无法寻找到设备偏移位置。"
+
+#: lib/utils_wipe.c:208
+#, c-format
+msgid "Device wipe error, offset %<PRIu64>."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:39
+#, c-format
+msgid ""
+"Failed to setup dm-crypt key mapping for device %s.\n"
+"Check that kernel supports %s cipher (check syslog for more info)."
+msgstr ""
+"为设备 %s 配置 dm-crypt 键映射失败。\n"
+"请确认内核支持 %s 加密(查看系统日志 (syslog) 以获取更多信息)。"
+
+#: lib/luks1/keyencryption.c:44
+msgid "Key size in XTS mode must be 256 or 512 bits."
+msgstr "XTS 模式的密钥大小必须是 256 或 512 位。"
+
+#: lib/luks1/keyencryption.c:46
+msgid "Cipher specification should be in [cipher]-[mode]-[iv] format."
+msgstr ""
+
+#: lib/luks1/keyencryption.c:97 lib/luks1/keymanage.c:344
+#: lib/luks1/keymanage.c:635 lib/luks1/keymanage.c:1080
+#: lib/luks2/luks2_json_metadata.c:1252 lib/luks2/luks2_keyslot.c:734
+#, c-format
+msgid "Cannot write to device %s, permission denied."
+msgstr "无法写入到设备 %s,访问被拒绝。"
+
+#: lib/luks1/keyencryption.c:120
+msgid "Failed to open temporary keystore device."
+msgstr "打开临时密钥存储设备失败。"
+
+#: lib/luks1/keyencryption.c:127
+msgid "Failed to access temporary keystore device."
+msgstr "访问临时密钥存储设备失败。"
+
+#: lib/luks1/keyencryption.c:200 lib/luks2/luks2_keyslot_luks2.c:60
+#: lib/luks2/luks2_keyslot_luks2.c:78 lib/luks2/luks2_keyslot_reenc.c:134
+msgid "IO error while encrypting keyslot."
+msgstr "加密密钥槽时发生输入输出错误。"
+
+#: lib/luks1/keyencryption.c:246 lib/luks1/keymanage.c:347
+#: lib/luks1/keymanage.c:588 lib/luks1/keymanage.c:638 lib/tcrypt/tcrypt.c:670
+#: lib/verity/verity.c:80 lib/verity/verity.c:178 lib/verity/verity_hash.c:311
+#: lib/verity/verity_hash.c:322 lib/verity/verity_hash.c:342
+#: lib/verity/verity_fec.c:241 lib/verity/verity_fec.c:253
+#: lib/verity/verity_fec.c:258 lib/luks2/luks2_json_metadata.c:1255
+#: src/cryptsetup_reencrypt.c:200 src/cryptsetup_reencrypt.c:212
+#, c-format
+msgid "Cannot open device %s."
+msgstr "无法打开设备 %s。"
+
+#: lib/luks1/keyencryption.c:257 lib/luks2/luks2_keyslot_luks2.c:137
+msgid "IO error while decrypting keyslot."
+msgstr "解密密钥槽时发生输入输出错误。"
+
+#: lib/luks1/keymanage.c:110
+#, c-format
+msgid "Device %s is too small. (LUKS1 requires at least %<PRIu64> bytes.)"
+msgstr "设备 %s 过小。(LUKS1 需要至少 %<PRIu64> 字节。)"
+
+#: lib/luks1/keymanage.c:131 lib/luks1/keymanage.c:139
+#: lib/luks1/keymanage.c:151 lib/luks1/keymanage.c:162
+#: lib/luks1/keymanage.c:174
+#, c-format
+msgid "LUKS keyslot %u is invalid."
+msgstr "LUKS 密钥槽 %u 无效。"
+
+#: lib/luks1/keymanage.c:228 lib/luks1/keymanage.c:472
+#: lib/luks2/luks2_json_metadata.c:1083 src/cryptsetup.c:1433
+#: src/cryptsetup.c:1559 src/cryptsetup.c:1616 src/cryptsetup.c:1672
+#: src/cryptsetup.c:1739 src/cryptsetup.c:1842 src/cryptsetup.c:1906
+#: src/cryptsetup.c:2136 src/cryptsetup.c:2331 src/cryptsetup.c:2391
+#: src/cryptsetup.c:2457 src/cryptsetup.c:2621 src/cryptsetup.c:3271
+#: src/cryptsetup.c:3280 src/cryptsetup_reencrypt.c:1388
+#, c-format
+msgid "Device %s is not a valid LUKS device."
+msgstr "%s 不是有效的 LUKS 设备。"
+
+#: lib/luks1/keymanage.c:246 lib/luks2/luks2_json_metadata.c:1100
+#, c-format
+msgid "Requested header backup file %s already exists."
+msgstr "请求的标头备份文件 %s 已存在。"
+
+#: lib/luks1/keymanage.c:248 lib/luks2/luks2_json_metadata.c:1102
+#, c-format
+msgid "Cannot create header backup file %s."
+msgstr "无法创建标头备份文件 %s。"
+
+#: lib/luks1/keymanage.c:255 lib/luks2/luks2_json_metadata.c:1109
+#, c-format
+msgid "Cannot write header backup file %s."
+msgstr "无法写入标头备份文件 %s。"
+
+#: lib/luks1/keymanage.c:286 lib/luks2/luks2_json_metadata.c:1161
+#, fuzzy
+msgid "Backup file does not contain valid LUKS header."
+msgstr "备份文件不包含有效 LUKS 标头。"
+
+#: lib/luks1/keymanage.c:299 lib/luks1/keymanage.c:549
+#: lib/luks2/luks2_json_metadata.c:1182
+#, c-format
+msgid "Cannot open header backup file %s."
+msgstr "无法打开备份标头文件 %s。"
+
+#: lib/luks1/keymanage.c:307 lib/luks2/luks2_json_metadata.c:1190
+#, c-format
+msgid "Cannot read header backup file %s."
+msgstr "无法读取标头备份文件 %s。"
+
+#: lib/luks1/keymanage.c:317
+#, fuzzy
+msgid "Data offset or key size differs on device and backup, restore failed."
+msgstr "源设备和备份上的数据偏移或密钥大小不符,恢复失败。\n"
+
+#: lib/luks1/keymanage.c:325
+#, c-format
+msgid "Device %s %s%s"
+msgstr "设备 %s %s%s"
+
+#: lib/luks1/keymanage.c:326
+msgid "does not contain LUKS header. Replacing header can destroy data on that device."
+msgstr "不包含 LUKS 标头。替换标头可能损毁设备上的数据。"
+
+#: lib/luks1/keymanage.c:327
+msgid "already contains LUKS header. Replacing header will destroy existing keyslots."
+msgstr "已包含 LUKS 标头。替换标头将损毁已存在的密钥槽。"
+
+#: lib/luks1/keymanage.c:328 lib/luks2/luks2_json_metadata.c:1224
+msgid ""
+"\n"
+"WARNING: real device header has different UUID than backup!"
+msgstr ""
+"\n"
+"警告: 真实设备标头 UUID 和备份不符!"
+
+#: lib/luks1/keymanage.c:375
+msgid "Non standard key size, manual repair required."
+msgstr "不标准的密钥大小,需要手动修复。"
+
+#: lib/luks1/keymanage.c:380
+msgid "Non standard keyslots alignment, manual repair required."
+msgstr "不标准的密钥槽对齐,需要手动修复。"
+
+#: lib/luks1/keymanage.c:390
+msgid "Repairing keyslots."
+msgstr "正在修复密钥槽。"
+
+#: lib/luks1/keymanage.c:409
+#, c-format
+msgid "Keyslot %i: offset repaired (%u -> %u)."
+msgstr "密钥槽 %i: 偏移已修复 (%u -> %u)。"
+
+#: lib/luks1/keymanage.c:417
+#, c-format
+msgid "Keyslot %i: stripes repaired (%u -> %u)."
+msgstr "密钥槽 %i:已修复条带(%u -> %u)。"
+
+#: lib/luks1/keymanage.c:426
+#, c-format
+msgid "Keyslot %i: bogus partition signature."
+msgstr "密钥槽 %i:虚假的分区签名。"
+
+#: lib/luks1/keymanage.c:431
+#, c-format
+msgid "Keyslot %i: salt wiped."
+msgstr "密钥槽 %i: 已清除盐。"
+
+#: lib/luks1/keymanage.c:448
+msgid "Writing LUKS header to disk."
+msgstr "正在将 LUKS 标头写入磁盘。"
+
+#: lib/luks1/keymanage.c:453
+msgid "Repair failed."
+msgstr "修复失败。"
+
+#: lib/luks1/keymanage.c:481 lib/luks1/keymanage.c:750
+#, c-format
+msgid "Requested LUKS hash %s is not supported."
+msgstr "不支持请求的 LUKS 哈希 %s。"
+
+#: lib/luks1/keymanage.c:509 src/cryptsetup.c:1133
+msgid "No known problems detected for LUKS header."
+msgstr "未在 LUKS 标头发现已知问题。"
+
+#: lib/luks1/keymanage.c:660
+#, c-format
+msgid "Error during update of LUKS header on device %s."
+msgstr "更新设备 %s 上的 LUKS 标头时出错。"
+
+#: lib/luks1/keymanage.c:668
+#, c-format
+msgid "Error re-reading LUKS header after update on device %s."
+msgstr "在更新设备 %s 后重新读取 LUKS 标头失败。"
+
+#: lib/luks1/keymanage.c:744
+#, fuzzy
+msgid "Data offset for LUKS header must be either 0 or higher than header size."
+msgstr "分离的 LUKS 标头的数据偏移量必须为零或高于标头大小(%d 扇区)。"
+
+#: lib/luks1/keymanage.c:755 lib/luks1/keymanage.c:825
+#: lib/luks2/luks2_json_format.c:283 lib/luks2/luks2_json_metadata.c:1001
+#: src/cryptsetup.c:2784
+msgid "Wrong LUKS UUID format provided."
+msgstr "提供了错误的 LUKS UUID 格式。"
+
+#: lib/luks1/keymanage.c:778
+msgid "Cannot create LUKS header: reading random salt failed."
+msgstr "无法创建 LUKS 标头:读取随机盐失败。"
+
+#: lib/luks1/keymanage.c:804
+#, c-format
+msgid "Cannot create LUKS header: header digest failed (using hash %s)."
+msgstr "无法创建 LUKS 标头:标头摘要失败(正在使用哈希 %s)。"
+
+#: lib/luks1/keymanage.c:848
+#, c-format
+msgid "Key slot %d active, purge first."
+msgstr "密钥槽 %d 已激活,请先清除。"
+
+#: lib/luks1/keymanage.c:854
+#, fuzzy, c-format
+msgid "Key slot %d material includes too few stripes. Header manipulation?"
+msgstr "密钥槽 %d 条带数过少。标头修改?\n"
+
+#: lib/luks1/keymanage.c:990
+#, fuzzy, c-format
+msgid "Cannot open keyslot (using hash %s)."
+msgstr "密钥处理错误(使用散列 %s)。"
+
+#: lib/luks1/keymanage.c:1066
+#, fuzzy, c-format
+msgid "Key slot %d is invalid, please select keyslot between 0 and %d."
+msgstr "密钥槽 %d 无效,请选择标号 0 到 %d 间的密钥槽。\n"
+
+#: lib/luks1/keymanage.c:1084 lib/luks2/luks2_keyslot.c:738
+#, c-format
+msgid "Cannot wipe device %s."
+msgstr "无法擦除设备 %s。"
+
+#: lib/loopaes/loopaes.c:146
+#, fuzzy
+msgid "Detected not yet supported GPG encrypted keyfile."
+msgstr "探测到未支持的 GPG 加密密钥文件。\n"
+
+#: lib/loopaes/loopaes.c:147
+msgid "Please use gpg --decrypt <KEYFILE> | cryptsetup --keyfile=- ...\n"
+msgstr "请使用 gpg --decrypt <密钥文件> | cryptsetup --keyfile=- ...\n"
+
+#: lib/loopaes/loopaes.c:168 lib/loopaes/loopaes.c:188
+msgid "Incompatible loop-AES keyfile detected."
+msgstr "探测到不兼容的 loop-AES 密钥文件。"
+
+#: lib/loopaes/loopaes.c:245
+#, fuzzy
+msgid "Kernel does not support loop-AES compatible mapping."
+msgstr "内核不支持 loop-AES 兼容映射。\n"
+
+#: lib/tcrypt/tcrypt.c:504
+#, c-format
+msgid "Error reading keyfile %s."
+msgstr "读取密钥文件 %s 出错。"
+
+#: lib/tcrypt/tcrypt.c:554
+#, fuzzy, c-format
+msgid "Maximum TCRYPT passphrase length (%zu) exceeded."
+msgstr "超出 TCRYPT 口令最大长度限制 (%d)。"
+
+#: lib/tcrypt/tcrypt.c:595
+#, c-format
+msgid "PBKDF2 hash algorithm %s not available, skipping."
+msgstr "PBKDF2 哈希算法 %s 不可用,将跳过。"
+
+#: lib/tcrypt/tcrypt.c:611 src/cryptsetup.c:1010
+msgid "Required kernel crypto interface not available."
+msgstr "无法找到所需的内核加密接口。"
+
+#: lib/tcrypt/tcrypt.c:613 src/cryptsetup.c:1012
+msgid "Ensure you have algif_skcipher kernel module loaded."
+msgstr "请确定您已载入内核模块 algif_skcipher。"
+
+#: lib/tcrypt/tcrypt.c:753
+#, c-format
+msgid "Activation is not supported for %d sector size."
+msgstr "扇区大小为 %d 时不支持激活。"
+
+#: lib/tcrypt/tcrypt.c:759
+#, fuzzy
+msgid "Kernel does not support activation for this TCRYPT legacy mode."
+msgstr "内核不支持激活此处的旧 TCRYPT 模式。"
+
+#: lib/tcrypt/tcrypt.c:793
+#, c-format
+msgid "Activating TCRYPT system encryption for partition %s."
+msgstr "正在为分区 %s 激活 TCRYPT 系统加密。"
+
+#: lib/tcrypt/tcrypt.c:871
+#, fuzzy
+msgid "Kernel does not support TCRYPT compatible mapping."
+msgstr "内核不支持 TCRYPT 兼容映射。"
+
+#: lib/tcrypt/tcrypt.c:1093
+msgid "This function is not supported without TCRYPT header load."
+msgstr "未载入 TCRYPT 标头时不支持此功能。"
+
+#: lib/bitlk/bitlk.c:333
+#, c-format
+msgid "Unexpected metadata entry type '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:380
+msgid "Invalid string found when parsing Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:385
+#, c-format
+msgid "Unexpected string ('%s') found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:399
+#, c-format
+msgid "Unexpected metadata entry value '%u' found when parsing supported Volume Master Key."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:479
+#, fuzzy, c-format
+msgid "Failed to read BITLK signature from %s."
+msgstr "读取 LUKS2 需求时失败。"
+
+#: lib/bitlk/bitlk.c:485
+msgid "BITLK version 1 is currently not supported."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:491
+msgid "Invalid or unknown boot signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:503
+msgid "Invalid or unknown signature for BITLK device."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:510
+#, fuzzy, c-format
+msgid "Unsupported sector size %<PRIu16>."
+msgstr "不支持的加密扇区大小。"
+
+#: lib/bitlk/bitlk.c:518
+#, fuzzy, c-format
+msgid "Failed to read BITLK header from %s."
+msgstr "读取 LUKS2 需求时失败。"
+
+#: lib/bitlk/bitlk.c:543
+#, fuzzy, c-format
+msgid "Failed to read BITLK FVE metadata from %s."
+msgstr "读取 LUKS2 需求时失败。"
+
+#: lib/bitlk/bitlk.c:594
+#, fuzzy
+msgid "Unknown or unsupported encryption type."
+msgstr "不支持的加密扇区大小。"
+
+#: lib/bitlk/bitlk.c:627
+#, fuzzy, c-format
+msgid "Failed to read BITLK metadata entries from %s."
+msgstr "读取 LUKS2 需求时失败。"
+
+#: lib/bitlk/bitlk.c:921
+#, fuzzy
+msgid "This operation is not supported."
+msgstr "不支持在 %s 加密设备上执行此操作。"
+
+#: lib/bitlk/bitlk.c:929
+#, fuzzy
+msgid "Wrong key size."
+msgstr "无效的密钥大小。"
+
+#: lib/bitlk/bitlk.c:981
+msgid "This BITLK device is in an unsupported state and cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:987
+#, c-format
+msgid "BITLK devices with type '%s' cannot be activated."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1069
+#, fuzzy
+msgid "Activation of partially decrypted BITLK device is not supported."
+msgstr "激活临时设备失败。"
+
+#: lib/bitlk/bitlk.c:1205
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK IV."
+msgstr ""
+
+#: lib/bitlk/bitlk.c:1209
+msgid "Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."
+msgstr ""
+
+#: lib/verity/verity.c:68 lib/verity/verity.c:171
+#, fuzzy, c-format
+msgid "Verity device %s does not use on-disk header."
+msgstr "Verity 设备 %s 未使用磁盘上的标头。"
+
+#: lib/verity/verity.c:90
+#, c-format
+msgid "Device %s is not a valid VERITY device."
+msgstr "%s 不是有效的 VERITY 设备。"
+
+#: lib/verity/verity.c:97
+#, c-format
+msgid "Unsupported VERITY version %d."
+msgstr "不支持的 VERITY 版本 %d。"
+
+#: lib/verity/verity.c:128
+msgid "VERITY header corrupted."
+msgstr "VERITY 标头损坏。"
+
+#: lib/verity/verity.c:165
+#, fuzzy, c-format
+msgid "Wrong VERITY UUID format provided on device %s."
+msgstr "为设备 %s 提供的 VERITY UUID 错误。\n"
+
+#: lib/verity/verity.c:198
+#, fuzzy, c-format
+msgid "Error during update of verity header on device %s."
+msgstr "更新设备 %s 上的 VERITY 标头时出错。\n"
+
+#: lib/verity/verity.c:256
+#, fuzzy
+msgid "Root hash signature verification is not supported."
+msgstr "不支持请求的 sector_size 选项。"
+
+#: lib/verity/verity.c:267
+msgid "Errors cannot be repaired with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:269
+#, c-format
+msgid "Found %u repairable errors with FEC device."
+msgstr ""
+
+#: lib/verity/verity.c:308
+#, fuzzy
+msgid "Kernel does not support dm-verity mapping."
+msgstr "内核不支持 dm-verity 映射。"
+
+#: lib/verity/verity.c:312
+#, fuzzy
+msgid "Kernel does not support dm-verity signature option."
+msgstr "内核不支持 dm-verity 映射。"
+
+#: lib/verity/verity.c:323
+#, fuzzy
+msgid "Verity device detected corruption after activation."
+msgstr "在 VERITY 设备激活后探测到损坏。\n"
+
+#: lib/verity/verity_hash.c:59
+#, fuzzy, c-format
+msgid "Spare area is not zeroed at position %<PRIu64>."
+msgstr "备用区位置 %<PRIu64> 未清零。\n"
+
+#: lib/verity/verity_hash.c:163 lib/verity/verity_hash.c:290
+#: lib/verity/verity_hash.c:303
+msgid "Device offset overflow."
+msgstr "设备偏移量溢出。"
+
+#: lib/verity/verity_hash.c:203
+#, fuzzy, c-format
+msgid "Verification failed at position %<PRIu64>."
+msgstr "在 %<PRIu64> 上发生检验错误。\n"
+
+#: lib/verity/verity_hash.c:276
+#, fuzzy
+msgid "Invalid size parameters for verity device."
+msgstr "为 VERITY 设备提供的大小指标无效。\n"
+
+#: lib/verity/verity_hash.c:296
+msgid "Hash area overflow."
+msgstr "哈希区域溢出。"
+
+#: lib/verity/verity_hash.c:373
+msgid "Verification of data area failed."
+msgstr "数据区检验失败。"
+
+#: lib/verity/verity_hash.c:378
+msgid "Verification of root hash failed."
+msgstr "根哈希值检验失败。"
+
+#: lib/verity/verity_hash.c:384
+#, fuzzy
+msgid "Input/output error while creating hash area."
+msgstr "创建哈希数据区时发生输入/输出错误。\n"
+
+#: lib/verity/verity_hash.c:386
+msgid "Creation of hash area failed."
+msgstr "创建哈希区失败。"
+
+#: lib/verity/verity_hash.c:433
+#, fuzzy, c-format
+msgid "WARNING: Kernel cannot activate device if data block size exceeds page size (%u)."
+msgstr "警告:如数据块大小超过内存分页大小,内核将无法激活设备 (%u)。\n"
+
+#: lib/verity/verity_fec.c:131
+#, fuzzy
+msgid "Failed to allocate RS context."
+msgstr "打开 (open) 密钥文件失败。\n"
+
+# stat() 主要就是出来一个各种文件信息……
+#: lib/verity/verity_fec.c:146
+#, fuzzy
+msgid "Failed to allocate buffer."
+msgstr "获取 (stat) 密钥文件统计数据失败。\n"
+
+#: lib/verity/verity_fec.c:156
+#, fuzzy, c-format
+msgid "Failed to read RS block %<PRIu64> byte %d."
+msgstr "无法访问临时密钥存储设备。\n"
+
+#: lib/verity/verity_fec.c:169
+#, fuzzy, c-format
+msgid "Failed to read parity for RS block %<PRIu64>."
+msgstr "无法访问临时密钥存储设备。\n"
+
+#: lib/verity/verity_fec.c:177
+#, fuzzy, c-format
+msgid "Failed to repair parity for block %<PRIu64>."
+msgstr "无法访问临时密钥存储设备。\n"
+
+#: lib/verity/verity_fec.c:188
+#, fuzzy, c-format
+msgid "Failed to write parity for RS block %<PRIu64>."
+msgstr "无法访问临时密钥存储设备。\n"
+
+#: lib/verity/verity_fec.c:223
+msgid "Block sizes must match for FEC."
+msgstr ""
+
+#: lib/verity/verity_fec.c:229
+msgid "Invalid number of parity bytes."
+msgstr ""
+
+#: lib/verity/verity_fec.c:265
+#, fuzzy, c-format
+msgid "Failed to determine size for device %s."
+msgstr "打开临时密钥存储设备失败。\n"
+
+#: lib/integrity/integrity.c:271 lib/integrity/integrity.c:343
+#, fuzzy
+msgid "Kernel does not support dm-integrity mapping."
+msgstr "内核不支持 dm-verity 映射。\n"
+
+#: lib/integrity/integrity.c:277
+#, fuzzy
+msgid "Kernel does not support dm-integrity fixed metadata alignment."
+msgstr "内核不支持 dm-verity 映射。\n"
+
+#: lib/luks2/luks2_disk_metadata.c:383 lib/luks2/luks2_json_metadata.c:959
+#: lib/luks2/luks2_json_metadata.c:1244
+#, c-format
+msgid "Failed to acquire write lock on device %s."
+msgstr "无法获取设备 %s 上的写入锁。"
+
+#: lib/luks2/luks2_disk_metadata.c:392
+msgid "Detected attempt for concurrent LUKS2 metadata update. Aborting operation."
+msgstr ""
+
+#: lib/luks2/luks2_disk_metadata.c:691 lib/luks2/luks2_disk_metadata.c:712
+msgid ""
+"Device contains ambiguous signatures, cannot auto-recover LUKS2.\n"
+"Please run \"cryptsetup repair\" for recovery."
+msgstr ""
+
+#: lib/luks2/luks2_json_format.c:227
+#, fuzzy
+msgid "Requested data offset is too small."
+msgstr "设备 %s 太小。"
+
+#: lib/luks2/luks2_json_format.c:271
+#, c-format
+msgid "WARNING: keyslots area (%<PRIu64> bytes) is very small, available LUKS2 keyslot count is very limited.\n"
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:946 lib/luks2/luks2_json_metadata.c:1074
+#: lib/luks2/luks2_json_metadata.c:1150 lib/luks2/luks2_keyslot_luks2.c:92
+#: lib/luks2/luks2_keyslot_luks2.c:114
+#, c-format
+msgid "Failed to acquire read lock on device %s."
+msgstr "无法获取设备 %s 的读取锁。"
+
+#: lib/luks2/luks2_json_metadata.c:1167
+#, c-format
+msgid "Forbidden LUKS2 requirements detected in backup %s."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:1208
+#, fuzzy
+msgid "Data offset differ on device and backup, restore failed."
+msgstr "源设备和备份上的数据偏移或密钥大小不符,恢复失败。\n"
+
+#: lib/luks2/luks2_json_metadata.c:1214
+#, fuzzy
+msgid "Binary header with keyslot areas size differ on device and backup, restore failed."
+msgstr "源设备和备份上的数据偏移或密钥大小不符,恢复失败。\n"
+
+#: lib/luks2/luks2_json_metadata.c:1221
+#, c-format
+msgid "Device %s %s%s%s%s"
+msgstr "设备 %s %s%s%s%s"
+
+#: lib/luks2/luks2_json_metadata.c:1222
+#, fuzzy
+msgid "does not contain LUKS2 header. Replacing header can destroy data on that device."
+msgstr "不包含 LUKS 标头。替换标头可能损毁设备上的数据。"
+
+#: lib/luks2/luks2_json_metadata.c:1223
+#, fuzzy
+msgid "already contains LUKS2 header. Replacing header will destroy existing keyslots."
+msgstr "已包含 LUKS 标头。替换标头将损毁已存在的密钥槽。"
+
+#: lib/luks2/luks2_json_metadata.c:1225
+msgid ""
+"\n"
+"WARNING: unknown LUKS2 requirements detected in real device header!\n"
+"Replacing header with backup may corrupt the data on that device!"
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:1227
+msgid ""
+"\n"
+"WARNING: Unfinished offline reencryption detected on the device!\n"
+"Replacing header with backup may corrupt data."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:1323
+#, c-format
+msgid "Ignored unknown flag %s."
+msgstr "已忽略未知旗标 %s。"
+
+#: lib/luks2/luks2_json_metadata.c:2010 lib/luks2/luks2_reencrypt.c:1746
+#, c-format
+msgid "Missing key for dm-crypt segment %u"
+msgstr ""
+
+# stat() 主要就是出来一个各种文件信息……
+#: lib/luks2/luks2_json_metadata.c:2022 lib/luks2/luks2_reencrypt.c:1764
+#, fuzzy
+msgid "Failed to set dm-crypt segment."
+msgstr "设置 pbkdf 参数失败。"
+
+# stat() 主要就是出来一个各种文件信息……
+#: lib/luks2/luks2_json_metadata.c:2028 lib/luks2/luks2_reencrypt.c:1770
+#, fuzzy
+msgid "Failed to set dm-linear segment."
+msgstr "设置 pbkdf 参数失败。"
+
+#: lib/luks2/luks2_json_metadata.c:2155
+msgid "Unsupported device integrity configuration."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2241
+msgid "Reencryption in-progress. Cannot deactivate device."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2252 lib/luks2/luks2_reencrypt.c:3190
+#, c-format
+msgid "Failed to replace suspended device %s with dm-error target."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2332
+msgid "Failed to read LUKS2 requirements."
+msgstr "读取 LUKS2 需求时失败。"
+
+#: lib/luks2/luks2_json_metadata.c:2339
+msgid "Unmet LUKS2 requirements detected."
+msgstr "探测到未满足的 LUKS2 需求。"
+
+#: lib/luks2/luks2_json_metadata.c:2347
+msgid "Operation incompatible with device marked for legacy reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_json_metadata.c:2349
+msgid "Operation incompatible with device marked for LUKS2 reencryption. Aborting."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:547 lib/luks2/luks2_keyslot.c:584
+msgid "Not enough available memory to open a keyslot."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot.c:549 lib/luks2/luks2_keyslot.c:586
+#, fuzzy
+msgid "Keyslot open failed."
+msgstr "密钥槽 %i: 已清除盐。"
+
+#: lib/luks2/luks2_keyslot_luks2.c:53 lib/luks2/luks2_keyslot_luks2.c:108
+#, c-format
+msgid "Cannot use %s-%s cipher for keyslot encryption."
+msgstr ""
+
+#: lib/luks2/luks2_keyslot_luks2.c:480
+#, fuzzy
+msgid "No space for new keyslot."
+msgstr "交换新密钥槽失败。\n"
+
+#: lib/luks2/luks2_luks1_convert.c:482
+#, fuzzy, c-format
+msgid "Cannot check status of device with uuid: %s."
+msgstr "无法检查密码质量:%s\n"
+
+#: lib/luks2/luks2_luks1_convert.c:508
+msgid "Unable to convert header with LUKSMETA additional metadata."
+msgstr ""
+
+#: lib/luks2/luks2_luks1_convert.c:548
+msgid "Unable to move keyslot area. Not enough space."
+msgstr "无法移动密钥槽区域。空间不足。"
+
+#: lib/luks2/luks2_luks1_convert.c:599
+#, fuzzy
+msgid "Unable to move keyslot area. LUKS2 keyslots area too small."
+msgstr "无法移动密钥槽区域。空间不足。"
+
+#: lib/luks2/luks2_luks1_convert.c:605 lib/luks2/luks2_luks1_convert.c:887
+msgid "Unable to move keyslot area."
+msgstr "无法移动密钥槽区域。"
+
+#: lib/luks2/luks2_luks1_convert.c:697
+#, fuzzy
+msgid "Cannot convert to LUKS1 format - default segment encryption sector size is not 512 bytes."
+msgstr "LUKS 密钥槽 %u 无效。\n"
+
+#: lib/luks2/luks2_luks1_convert.c:705
+#, fuzzy
+msgid "Cannot convert to LUKS1 format - key slot digests are not LUKS1 compatible."
+msgstr "LUKS 密钥槽 %u 无效。\n"
+
+#: lib/luks2/luks2_luks1_convert.c:717
+#, fuzzy, c-format
+msgid "Cannot convert to LUKS1 format - device uses wrapped key cipher %s."
+msgstr "LUKS 密钥槽 %u 无效。\n"
+
+#: lib/luks2/luks2_luks1_convert.c:725
+#, fuzzy, c-format
+msgid "Cannot convert to LUKS1 format - LUKS2 header contains %u token(s)."
+msgstr "LUKS 密钥槽 %u 无效。\n"
+
+#: lib/luks2/luks2_luks1_convert.c:739
+#, fuzzy, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is in invalid state."
+msgstr "LUKS 密钥槽 %u 无效。\n"
+
+#: lib/luks2/luks2_luks1_convert.c:744
+#, fuzzy, c-format
+msgid "Cannot convert to LUKS1 format - slot %u (over maximum slots) is still active."
+msgstr "LUKS 密钥槽 %u 无效。\n"
+
+#: lib/luks2/luks2_luks1_convert.c:749
+#, fuzzy, c-format
+msgid "Cannot convert to LUKS1 format - keyslot %u is not LUKS1 compatible."
+msgstr "LUKS 密钥槽 %u 无效。\n"
+
+#: lib/luks2/luks2_reencrypt.c:892
+#, c-format
+msgid "Hotzone size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:897
+#, fuzzy, c-format
+msgid "Device size must be multiple of calculated zone alignment (%zu bytes)."
+msgstr "设备 %s 的大小没有和请求的扇区大小对齐(%u 字节)。"
+
+#: lib/luks2/luks2_reencrypt.c:941
+#, fuzzy, c-format
+msgid "Unsupported resilience mode %s"
+msgstr "不支持的 LUKS 版本 %d。"
+
+#: lib/luks2/luks2_reencrypt.c:1158 lib/luks2/luks2_reencrypt.c:1313
+#: lib/luks2/luks2_reencrypt.c:1396 lib/luks2/luks2_reencrypt.c:1430
+#: lib/luks2/luks2_reencrypt.c:3030
+#, fuzzy
+msgid "Failed to initialize old segment storage wrapper."
+msgstr "初始化默认 LUKS2 密钥槽参数失败。"
+
+#: lib/luks2/luks2_reencrypt.c:1172 lib/luks2/luks2_reencrypt.c:1291
+#, fuzzy
+msgid "Failed to initialize new segment storage wrapper."
+msgstr "初始化默认 LUKS2 密钥槽参数失败。"
+
+#: lib/luks2/luks2_reencrypt.c:1340
+#, fuzzy
+msgid "Failed to read checksums for current hotzone."
+msgstr "从备份标头读取需求失败。"
+
+#: lib/luks2/luks2_reencrypt.c:1347 lib/luks2/luks2_reencrypt.c:3038
+#, fuzzy, c-format
+msgid "Failed to read hotzone area starting at %<PRIu64>."
+msgstr "无法访问临时密钥存储设备。\n"
+
+# stat() 主要就是出来一个各种文件信息……
+#: lib/luks2/luks2_reencrypt.c:1366
+#, fuzzy, c-format
+msgid "Failed to decrypt sector %zu."
+msgstr "获取 (stat) 密钥文件统计数据失败。\n"
+
+#: lib/luks2/luks2_reencrypt.c:1372
+#, fuzzy, c-format
+msgid "Failed to recover sector %zu."
+msgstr "打开 (open) 密钥文件失败。\n"
+
+#: lib/luks2/luks2_reencrypt.c:1867
+#, c-format
+msgid "Source and target device sizes don't match. Source %<PRIu64>, target: %<PRIu64>."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1965
+#, fuzzy, c-format
+msgid "Failed to activate hotzone device %s."
+msgstr "无法获取设备 %s 上的写入锁。"
+
+#: lib/luks2/luks2_reencrypt.c:1982
+#, c-format
+msgid "Failed to activate overlay device %s with actual origin table."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:1989
+#, fuzzy, c-format
+msgid "Failed to load new mapping for device %s."
+msgstr "打开临时密钥存储设备失败。\n"
+
+#: lib/luks2/luks2_reencrypt.c:2060
+#, fuzzy
+msgid "Failed to refresh reencryption devices stack."
+msgstr "无法获取设备 %s 的读取锁。"
+
+#: lib/luks2/luks2_reencrypt.c:2216
+#, fuzzy
+msgid "Failed to set new keyslots area size."
+msgstr "交换新密钥槽失败。"
+
+#: lib/luks2/luks2_reencrypt.c:2318
+#, fuzzy, c-format
+msgid "Data shift is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "设备 %s 的大小没有和请求的扇区大小对齐(%u 字节)。"
+
+#: lib/luks2/luks2_reencrypt.c:2339
+#, fuzzy, c-format
+msgid "Data device is not aligned to requested encryption sector size (%<PRIu32> bytes)."
+msgstr "设备 %s 的大小没有和请求的扇区大小对齐(%u 字节)。"
+
+#: lib/luks2/luks2_reencrypt.c:2360
+#, c-format
+msgid "Data shift (%<PRIu64> sectors) is less than future data offset (%<PRIu64> sectors)."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2366 lib/luks2/luks2_reencrypt.c:2779
+#: lib/luks2/luks2_reencrypt.c:2800
+#, fuzzy, c-format
+msgid "Failed to open %s in exclusive mode (already mapped or mounted)."
+msgstr "无法使用正被使用的设备 %s(已被映射或挂载)。"
+
+#: lib/luks2/luks2_reencrypt.c:2534
+msgid "Device not marked for LUKS2 reencryption."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2540 lib/luks2/luks2_reencrypt.c:3295
+#, fuzzy
+msgid "Failed to load LUKS2 reencryption context."
+msgstr "打开 (open) 密钥文件失败。\n"
+
+#: lib/luks2/luks2_reencrypt.c:2619
+#, fuzzy
+msgid "Failed to get reencryption state."
+msgstr "打开 (open) 密钥文件失败。\n"
+
+#: lib/luks2/luks2_reencrypt.c:2623
+#, fuzzy
+msgid "Device is not in reencryption."
+msgstr "设备 %s 未激活。"
+
+#: lib/luks2/luks2_reencrypt.c:2630
+#, fuzzy
+msgid "Reencryption process is already running."
+msgstr "重加密已在进行中。"
+
+#: lib/luks2/luks2_reencrypt.c:2632
+#, fuzzy
+msgid "Failed to acquire reencryption lock."
+msgstr "无法获取写入设备锁。"
+
+#: lib/luks2/luks2_reencrypt.c:2650
+msgid "Cannot proceed with reencryption. Run reencryption recovery first."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2750
+msgid "Active device size and requested reencryption size don't match."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2764
+msgid "Illegal device size requested in reencryption parameters."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2834
+#, fuzzy
+msgid "Reencryption in-progress. Cannot perform recovery."
+msgstr "重加密已在进行中。"
+
+#: lib/luks2/luks2_reencrypt.c:2906
+msgid "LUKS2 reencryption already initialized in metadata."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:2913
+#, fuzzy
+msgid "Failed to initialize LUKS2 reencryption in metadata."
+msgstr "初始化默认 LUKS2 密钥槽参数失败。"
+
+#: lib/luks2/luks2_reencrypt.c:3004
+msgid "Failed to set device segments for next reencryption hotzone."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3046
+#, fuzzy
+msgid "Failed to write reencryption resilience metadata."
+msgstr "向新表头写入活动旗标失败。"
+
+#: lib/luks2/luks2_reencrypt.c:3053
+#, fuzzy
+msgid "Decryption failed."
+msgstr "修复失败。"
+
+#: lib/luks2/luks2_reencrypt.c:3058
+#, fuzzy, c-format
+msgid "Failed to write hotzone area starting at %<PRIu64>."
+msgstr "无法访问临时密钥存储设备。\n"
+
+# stat() 主要就是出来一个各种文件信息……
+#: lib/luks2/luks2_reencrypt.c:3063
+#, fuzzy
+msgid "Failed to sync data."
+msgstr "获取 (stat) 密钥文件信息失败。"
+
+#: lib/luks2/luks2_reencrypt.c:3071
+msgid "Failed to update metadata after current reencryption hotzone completed."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3138
+#, fuzzy
+msgid "Failed to write LUKS2 metadata."
+msgstr "读取 LUKS2 需求时失败。"
+
+#: lib/luks2/luks2_reencrypt.c:3161
+#, fuzzy
+msgid "Failed to wipe backup segment data."
+msgstr "交换新密钥槽失败。"
+
+#: lib/luks2/luks2_reencrypt.c:3174
+#, fuzzy
+msgid "Failed to disable reencryption requirement flag."
+msgstr "读取 LUKS2 需求时失败。"
+
+#: lib/luks2/luks2_reencrypt.c:3182
+#, c-format
+msgid "Fatal error while reencrypting chunk starting at %<PRIu64>, %<PRIu64> sectors long."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3191
+msgid "Do not resume the device unless replaced with error target manually."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3240
+msgid "Cannot proceed with reencryption. Unexpected reencryption status."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3246
+msgid "Missing or invalid reencrypt context."
+msgstr ""
+
+#: lib/luks2/luks2_reencrypt.c:3253
+#, fuzzy
+msgid "Failed to initialize reencryption device stack."
+msgstr "无法获取设备 %s 的读取锁。"
+
+#: lib/luks2/luks2_reencrypt.c:3272 lib/luks2/luks2_reencrypt.c:3308
+#, fuzzy
+msgid "Failed to update reencryption context."
+msgstr "打开 (open) 密钥文件失败。\n"
+
+#: lib/luks2/luks2_token.c:262
+#, fuzzy
+msgid "No free token slot."
+msgstr "交换新密钥槽失败。\n"
+
+# stat() 主要就是出来一个各种文件信息……
+#: lib/luks2/luks2_token.c:269
+#, fuzzy, c-format
+msgid "Failed to create builtin token %s."
+msgstr "获取 (stat) 密钥文件统计数据失败。\n"
+
+#: src/cryptsetup.c:164
+#, fuzzy
+msgid "Can't do passphrase verification on non-tty inputs."
+msgstr "无法从非 TTY 输入验证密码。\n"
+
+#: src/cryptsetup.c:221
+#, fuzzy
+msgid "Keyslot encryption parameters can be set only for LUKS2 device."
+msgstr "此操作只适用 LUKS2 设备。"
+
+#: src/cryptsetup.c:251 src/cryptsetup.c:959 src/cryptsetup.c:1269
+#: src/cryptsetup.c:3145 src/cryptsetup_reencrypt.c:723
+#: src/cryptsetup_reencrypt.c:793
+#, fuzzy
+msgid "No known cipher specification pattern detected."
+msgstr "未探测到已知的密文特征。\n"
+
+#: src/cryptsetup.c:259
+msgid "WARNING: The --hash parameter is being ignored in plain mode with keyfile specified.\n"
+msgstr "警告:在纯文本模式下指定密钥文件时将忽略参数 --hash。\n"
+
+#: src/cryptsetup.c:267
+msgid "WARNING: The --keyfile-size option is being ignored, the read size is the same as the encryption key size.\n"
+msgstr "警告:将忽略参数 --keyfile-size,读取大小应与加密密钥大小一致。\n"
+
+#: src/cryptsetup.c:307
+#, c-format
+msgid "Detected device signature(s) on %s. Proceeding further may damage existing data."
+msgstr ""
+
+#: src/cryptsetup.c:313 src/cryptsetup.c:1090 src/cryptsetup.c:1142
+#: src/cryptsetup.c:1246 src/cryptsetup.c:1319 src/cryptsetup.c:1974
+#: src/cryptsetup.c:2682 src/cryptsetup.c:2805 src/integritysetup.c:233
+msgid "Operation aborted.\n"
+msgstr "操作中止。\n"
+
+#: src/cryptsetup.c:381
+msgid "Option --key-file is required."
+msgstr "需要选项 --key-file。"
+
+#: src/cryptsetup.c:434
+msgid "Enter VeraCrypt PIM: "
+msgstr "输入 VeraCrypt PIM: "
+
+#: src/cryptsetup.c:443
+msgid "Invalid PIM value: parse error."
+msgstr "无效的 PIM 值:解析错误。"
+
+#: src/cryptsetup.c:446
+msgid "Invalid PIM value: 0."
+msgstr "无效的 PIM 值:0。"
+
+#: src/cryptsetup.c:449
+msgid "Invalid PIM value: outside of range."
+msgstr "无效的 PIM 值:超出范围。"
+
+#: src/cryptsetup.c:472
+#, fuzzy
+msgid "No device header detected with this passphrase."
+msgstr "未从此密码中探测到设备标头。\n"
+
+#: src/cryptsetup.c:541
+#, fuzzy, c-format
+msgid "Device %s is not a valid BITLK device."
+msgstr "%s 不是有效的 LUKS 设备。"
+
+#: src/cryptsetup.c:576
+msgid ""
+"Header dump with volume key is sensitive information\n"
+"which allows access to encrypted partition without passphrase.\n"
+"This dump should be always stored encrypted on safe place."
+msgstr ""
+
+#: src/cryptsetup.c:673
+#, c-format
+msgid "Device %s is still active and scheduled for deferred removal.\n"
+msgstr ""
+
+#: src/cryptsetup.c:701
+msgid "Resize of active device requires volume key in keyring but --disable-keyring option is set."
+msgstr ""
+
+#: src/cryptsetup.c:838
+#, fuzzy
+msgid "Benchmark interrupted."
+msgstr "测试密文"
+
+#: src/cryptsetup.c:859
+#, c-format
+msgid "PBKDF2-%-9s     N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:861
+#, c-format
+msgid "PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"
+msgstr ""
+
+#: src/cryptsetup.c:875
+#, c-format
+msgid "%-10s N/A\n"
+msgstr ""
+
+#: src/cryptsetup.c:877
+#, c-format
+msgid "%-10s %4u iterations, %5u memory, %1u parallel threads (CPUs) for %zu-bit key (requested %u ms time)\n"
+msgstr ""
+
+#: src/cryptsetup.c:901
+#, fuzzy
+msgid "Result of benchmark is not reliable."
+msgstr "测试结果不可靠。\n"
+
+#: src/cryptsetup.c:951
+msgid "# Tests are approximate using memory only (no storage IO).\n"
+msgstr "# 测试仅使用内存(无存储 IO)。\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:971
+#, fuzzy, c-format
+msgid "#%*s Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  算法      | 密钥 | 加密         | 解密\n"
+
+#: src/cryptsetup.c:975
+#, fuzzy, c-format
+msgid "Cipher %s (with %i bits key) is not available."
+msgstr "密文 %s 不可用。\n"
+
+#. TRANSLATORS: The string is header of a table and must be exactly (right side) aligned.
+#: src/cryptsetup.c:994
+#, fuzzy
+msgid "#     Algorithm |       Key |      Encryption |      Decryption\n"
+msgstr "#  算法      | 密钥 | 加密         | 解密\n"
+
+#: src/cryptsetup.c:1003
+msgid "N/A"
+msgstr "不可用"
+
+#: src/cryptsetup.c:1083
+msgid ""
+"Seems device does not require reencryption recovery.\n"
+"Do you want to proceed anyway?"
+msgstr ""
+
+#: src/cryptsetup.c:1089
+msgid "Really proceed with LUKS2 reencryption recovery?"
+msgstr ""
+
+#: src/cryptsetup.c:1098
+#, fuzzy
+msgid "Enter passphrase for reencryption recovery: "
+msgstr "输入密钥槽 %u 的密码:"
+
+#: src/cryptsetup.c:1141
+msgid "Really try to repair LUKS device header?"
+msgstr "确定要尝试修复 LUKS 设备标头吗?"
+
+#: src/cryptsetup.c:1160 src/integritysetup.c:146
+msgid ""
+"Wiping device to initialize integrity checksum.\n"
+"You can interrupt this by pressing CTRL+c (rest of not wiped device will contain invalid checksum).\n"
+msgstr ""
+
+#: src/cryptsetup.c:1182 src/integritysetup.c:168
+#, fuzzy, c-format
+msgid "Cannot deactivate temporary device %s."
+msgstr "无法打开临时 LUKS 设备。\n"
+
+#: src/cryptsetup.c:1231
+msgid "Integrity option can be used only for LUKS2 format."
+msgstr ""
+
+#: src/cryptsetup.c:1236 src/cryptsetup.c:1296
+#, fuzzy
+msgid "Unsupported LUKS2 metadata size options."
+msgstr "不支持的 LUKS 版本 %d。"
+
+#: src/cryptsetup.c:1253
+#, c-format
+msgid "Cannot create header file %s."
+msgstr "无法创建标头文件 %s。"
+
+#: src/cryptsetup.c:1276 src/integritysetup.c:195 src/integritysetup.c:204
+#: src/integritysetup.c:213 src/integritysetup.c:284 src/integritysetup.c:293
+#: src/integritysetup.c:303
+#, fuzzy
+msgid "No known integrity specification pattern detected."
+msgstr "未探测到已知的密文特征。\n"
+
+#: src/cryptsetup.c:1289
+#, c-format
+msgid "Cannot use %s as on-disk header."
+msgstr "无法将 %s 作为磁盘上的标头使用。"
+
+#: src/cryptsetup.c:1313 src/integritysetup.c:227
+#, c-format
+msgid "This will overwrite data on %s irrevocably."
+msgstr "这将覆盖 %s 上的数据,该动作不可取消。"
+
+# stat() 主要就是出来一个各种文件信息……
+#: src/cryptsetup.c:1354 src/cryptsetup.c:1688 src/cryptsetup.c:1755
+#: src/cryptsetup.c:1857 src/cryptsetup.c:1923 src/cryptsetup_reencrypt.c:553
+msgid "Failed to set pbkdf parameters."
+msgstr "设置 pbkdf 参数失败。"
+
+#: src/cryptsetup.c:1439
+#, fuzzy
+msgid "Reduced data offset is allowed only for detached LUKS header."
+msgstr "仅已脱离的 LUKS 数据头可以使用缩减的数据偏移。\n"
+
+#: src/cryptsetup.c:1450 src/cryptsetup.c:1761
+msgid "Cannot determine volume key size for LUKS without keyslots, please use --key-size option."
+msgstr ""
+
+#: src/cryptsetup.c:1488
+msgid "Device activated but cannot make flags persistent."
+msgstr ""
+
+#: src/cryptsetup.c:1569 src/cryptsetup.c:1639
+#, fuzzy, c-format
+msgid "Keyslot %d is selected for deletion."
+msgstr "已选中密钥槽 %d 以删除。\n"
+
+#: src/cryptsetup.c:1581 src/cryptsetup.c:1642
+msgid "This is the last keyslot. Device will become unusable after purging this key."
+msgstr "这是最后一个密钥槽。设备在清空此密钥后将不可用。"
+
+#: src/cryptsetup.c:1582
+msgid "Enter any remaining passphrase: "
+msgstr "输入任意剩余的口令: "
+
+#: src/cryptsetup.c:1583 src/cryptsetup.c:1644
+msgid "Operation aborted, the keyslot was NOT wiped.\n"
+msgstr ""
+
+#: src/cryptsetup.c:1621
+msgid "Enter passphrase to be deleted: "
+msgstr "输入要移除的口令: "
+
+#: src/cryptsetup.c:1702 src/cryptsetup.c:1776 src/cryptsetup.c:1810
+msgid "Enter new passphrase for key slot: "
+msgstr "输入密钥槽的新口令: "
+
+#: src/cryptsetup.c:1793 src/cryptsetup_reencrypt.c:1343
+#, c-format
+msgid "Enter any existing passphrase: "
+msgstr "输入任意已存在的口令: "
+
+#: src/cryptsetup.c:1861
+msgid "Enter passphrase to be changed: "
+msgstr "输入要更改的口令: "
+
+#: src/cryptsetup.c:1877 src/cryptsetup_reencrypt.c:1329
+msgid "Enter new passphrase: "
+msgstr "输入新口令: "
+
+#: src/cryptsetup.c:1927
+#, fuzzy
+msgid "Enter passphrase for keyslot to be converted: "
+msgstr "输入密钥槽 %u 的密码:"
+
+#: src/cryptsetup.c:1951
+#, fuzzy
+msgid "Only one device argument for isLuks operation is supported."
+msgstr "isLuks 操作仅支持一个设备参数。\n"
+
+#: src/cryptsetup.c:2001
+msgid ""
+"The header dump with volume key is sensitive information\n"
+"that allows access to encrypted partition without a passphrase.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+
+#: src/cryptsetup.c:2066
+#, fuzzy, c-format
+msgid "Keyslot %d does not contain unbound key."
+msgstr "密钥槽 %d 未使用。\n"
+
+#: src/cryptsetup.c:2072
+msgid ""
+"The header dump with unbound key is sensitive information.\n"
+"This dump should be stored encrypted in a safe place."
+msgstr ""
+
+#: src/cryptsetup.c:2207 src/cryptsetup.c:2228
+#, fuzzy
+msgid "Option --header-backup-file is required."
+msgstr "必须指定 --header-backup-file 选项。\n"
+
+#: src/cryptsetup.c:2258
+#, c-format
+msgid "%s is not cryptsetup managed device."
+msgstr ""
+
+#: src/cryptsetup.c:2269
+#, fuzzy, c-format
+msgid "Refresh is not supported for device type %s"
+msgstr "设备 %s 不支持恢复。"
+
+#: src/cryptsetup.c:2311
+#, fuzzy, c-format
+msgid "Unrecognized metadata device type %s."
+msgstr "无法识别的元数据设备类型 %s。\n"
+
+#: src/cryptsetup.c:2314
+#, fuzzy
+msgid "Command requires device and mapped name as arguments."
+msgstr "命令需要设备及映射名作为参数。\n"
+
+#: src/cryptsetup.c:2336
+#, c-format
+msgid ""
+"This operation will erase all keyslots on device %s.\n"
+"Device will become unusable after this operation."
+msgstr ""
+"该操作将清空设备 %s 上所有的密钥槽。\n"
+"设备在此操作后将不可用。"
+
+#: src/cryptsetup.c:2343
+msgid "Operation aborted, keyslots were NOT wiped.\n"
+msgstr "操作已中止,密钥槽没有被擦除。\n"
+
+#: src/cryptsetup.c:2380
+msgid "Invalid LUKS type, only luks1 and luks2 are supported."
+msgstr ""
+
+#: src/cryptsetup.c:2398
+#, c-format
+msgid "Device is already %s type."
+msgstr "设备已为 %s 类型。"
+
+#: src/cryptsetup.c:2403
+#, fuzzy, c-format
+msgid "This operation will convert %s to %s format.\n"
+msgstr "不支持在 %s 加密设备上执行此操作。\n"
+
+#: src/cryptsetup.c:2409
+msgid "Operation aborted, device was NOT converted.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2449
+msgid "Option --priority, --label or --subsystem is missing."
+msgstr "选项 --priority、--label 或 --subsystem 缺失。"
+
+#: src/cryptsetup.c:2483 src/cryptsetup.c:2516 src/cryptsetup.c:2539
+#, fuzzy, c-format
+msgid "Token %d is invalid."
+msgstr "密钥槽 %d 无效。\n"
+
+#: src/cryptsetup.c:2486 src/cryptsetup.c:2542
+#, fuzzy, c-format
+msgid "Token %d in use."
+msgstr "密钥槽 %d 未使用。\n"
+
+# stat() 主要就是出来一个各种文件信息……
+#: src/cryptsetup.c:2493
+#, fuzzy, c-format
+msgid "Failed to add luks2-keyring token %d."
+msgstr "获取 (stat) 密钥文件统计数据失败。\n"
+
+#: src/cryptsetup.c:2502 src/cryptsetup.c:2564
+#, fuzzy, c-format
+msgid "Failed to assign token %d to keyslot %d."
+msgstr "交换新密钥槽失败。\n"
+
+#: src/cryptsetup.c:2519
+#, fuzzy, c-format
+msgid "Token %d is not in use."
+msgstr "密钥槽 %d 未使用。\n"
+
+#: src/cryptsetup.c:2554
+#, fuzzy
+msgid "Failed to import token from file."
+msgstr "打开 (open) 密钥文件失败。"
+
+#: src/cryptsetup.c:2579
+#, fuzzy, c-format
+msgid "Failed to get token %d for export."
+msgstr "交换新密钥槽失败。\n"
+
+#: src/cryptsetup.c:2594
+msgid "--key-description parameter is mandatory for token add action."
+msgstr ""
+
+#: src/cryptsetup.c:2600 src/cryptsetup.c:2608
+msgid "Action requires specific token. Use --token-id parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2613
+#, fuzzy, c-format
+msgid "Invalid token operation %s."
+msgstr "设备 %s 无效。\n"
+
+#: src/cryptsetup.c:2668
+#, c-format
+msgid "Auto-detected active dm device '%s' for data device %s.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2672
+#, fuzzy, c-format
+msgid "Device %s is not a block device.\n"
+msgstr "%s 不是有效的 LUKS 设备。"
+
+#: src/cryptsetup.c:2674
+#, fuzzy, c-format
+msgid "Failed to auto-detect device %s holders."
+msgstr "无法获取设备 %s 上的写入锁。"
+
+#: src/cryptsetup.c:2676
+#, c-format
+msgid ""
+"Unable to decide if device %s is activated or not.\n"
+"Are you sure you want to proceed with reencryption in offline mode?\n"
+"It may lead to data corruption if the device is actually activated.\n"
+"To run reencryption in online mode, use --active-name parameter instead.\n"
+msgstr ""
+
+#: src/cryptsetup.c:2756
+#, fuzzy
+msgid "Invalid LUKS device type."
+msgstr "设备 %s 无效。"
+
+#: src/cryptsetup.c:2761
+msgid "Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."
+msgstr ""
+
+#: src/cryptsetup.c:2766
+msgid "Requested data offset must be less than or equal to half of --reduce-device-size parameter."
+msgstr ""
+
+#: src/cryptsetup.c:2775
+#, c-format
+msgid "Adjusting --reduce-device-size value to twice the --offset %<PRIu64> (sectors).\n"
+msgstr ""
+
+#: src/cryptsetup.c:2779
+#, fuzzy
+msgid "Encryption is supported only for LUKS2 format."
+msgstr "此操作只适用 LUKS2 设备。"
+
+#: src/cryptsetup.c:2801
+#, c-format
+msgid "Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"
+msgstr ""
+
+#: src/cryptsetup.c:2816
+#, fuzzy, c-format
+msgid "Temporary header file %s already exists. Aborting."
+msgstr "请求的标头备份文件 %s 已存在。"
+
+#: src/cryptsetup.c:2818 src/cryptsetup.c:2825
+#, fuzzy, c-format
+msgid "Cannot create temporary header file %s."
+msgstr "无法创建标头文件 %s。"
+
+#: src/cryptsetup.c:2889
+#, c-format
+msgid "%s/%s is now active and ready for online encryption.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3053 src/cryptsetup.c:3059
+#, fuzzy
+msgid "Not enough free keyslots for reencryption."
+msgstr "不要更改密钥,无数据区重加密"
+
+#: src/cryptsetup.c:3079 src/cryptsetup_reencrypt.c:1294
+msgid "Key file can be used only with --key-slot or with exactly one key slot active."
+msgstr "密钥文件只能在指定 --key-slot 时或有且只有一个槽启用时使用。"
+
+#: src/cryptsetup.c:3088 src/cryptsetup_reencrypt.c:1341
+#: src/cryptsetup_reencrypt.c:1352
+#, fuzzy, c-format
+msgid "Enter passphrase for key slot %d: "
+msgstr "输入密钥槽 %u 的口令: "
+
+#: src/cryptsetup.c:3096
+#, c-format
+msgid "Enter passphrase for key slot %u: "
+msgstr "输入密钥槽 %u 的口令: "
+
+#: src/cryptsetup.c:3263
+#, fuzzy
+msgid "Command requires device as argument."
+msgstr "命令需要设备及映射名作为参数。\n"
+
+#: src/cryptsetup.c:3285
+msgid "Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."
+msgstr ""
+
+#: src/cryptsetup.c:3297
+msgid "Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."
+msgstr ""
+
+#: src/cryptsetup.c:3307 src/cryptsetup_reencrypt.c:178
+msgid "Reencryption of device with integrity profile is not supported."
+msgstr "不支持带有完整性 profile 信息的设备的重加密。"
+
+#: src/cryptsetup.c:3315
+msgid "LUKS2 reencryption already initialized. Aborting operation."
+msgstr ""
+
+#: src/cryptsetup.c:3319
+#, fuzzy
+msgid "LUKS2 device is not in reencryption."
+msgstr "日志文件 %s 存在,继续重加密。\n"
+
+#: src/cryptsetup.c:3346
+msgid "<device> [--type <type>] [<name>]"
+msgstr "<设备> [--type <类型>] [<名称>]"
+
+#: src/cryptsetup.c:3346 src/veritysetup.c:394 src/integritysetup.c:480
+msgid "open device as <name>"
+msgstr "以 <名称> 打开设备"
+
+#: src/cryptsetup.c:3347 src/cryptsetup.c:3348 src/cryptsetup.c:3349
+#: src/veritysetup.c:395 src/veritysetup.c:396 src/integritysetup.c:481
+#: src/integritysetup.c:482
+msgid "<name>"
+msgstr "<名称>"
+
+#: src/cryptsetup.c:3347 src/veritysetup.c:395 src/integritysetup.c:481
+msgid "close device (remove mapping)"
+msgstr "关闭设备(移除映射)"
+
+#: src/cryptsetup.c:3348
+msgid "resize active device"
+msgstr "改变活动设备大小。"
+
+#: src/cryptsetup.c:3349
+msgid "show device status"
+msgstr "显示设备状态"
+
+#: src/cryptsetup.c:3350
+msgid "[--cipher <cipher>]"
+msgstr ""
+
+#: src/cryptsetup.c:3350
+msgid "benchmark cipher"
+msgstr "测试密文"
+
+#: src/cryptsetup.c:3351 src/cryptsetup.c:3352 src/cryptsetup.c:3353
+#: src/cryptsetup.c:3354 src/cryptsetup.c:3355 src/cryptsetup.c:3362
+#: src/cryptsetup.c:3363 src/cryptsetup.c:3364 src/cryptsetup.c:3365
+#: src/cryptsetup.c:3366 src/cryptsetup.c:3367 src/cryptsetup.c:3368
+#: src/cryptsetup.c:3369 src/cryptsetup.c:3370
+msgid "<device>"
+msgstr "<设备>"
+
+#: src/cryptsetup.c:3351
+msgid "try to repair on-disk metadata"
+msgstr "尝试修复磁盘上的元数据"
+
+#: src/cryptsetup.c:3352
+#, fuzzy
+msgid "reencrypt LUKS2 device"
+msgstr "向 LUKS 设备添加密钥"
+
+#: src/cryptsetup.c:3353
+msgid "erase all keyslots (remove encryption key)"
+msgstr "清空所有密钥槽(移除加密密钥)"
+
+#: src/cryptsetup.c:3354
+msgid "convert LUKS from/to LUKS2 format"
+msgstr "在 LUKS 和 LUKS2 格式之间转换"
+
+#: src/cryptsetup.c:3355
+msgid "set permanent configuration options for LUKS2"
+msgstr ""
+
+#: src/cryptsetup.c:3356 src/cryptsetup.c:3357
+msgid "<device> [<new key file>]"
+msgstr "<设备> [<新密钥文件>]"
+
+#: src/cryptsetup.c:3356
+msgid "formats a LUKS device"
+msgstr "格式化一个 LUKS 设备"
+
+#: src/cryptsetup.c:3357
+msgid "add key to LUKS device"
+msgstr "向 LUKS 设备添加密钥"
+
+#: src/cryptsetup.c:3358 src/cryptsetup.c:3359 src/cryptsetup.c:3360
+msgid "<device> [<key file>]"
+msgstr "<设备> [<密钥文件>]"
+
+#: src/cryptsetup.c:3358
+msgid "removes supplied key or key file from LUKS device"
+msgstr "移除 LUKS 设备中指定的密钥或密钥文件"
+
+#: src/cryptsetup.c:3359
+msgid "changes supplied key or key file of LUKS device"
+msgstr "更改 LUKS 设备中指定的密钥或密钥文件"
+
+# stat() 主要就是出来一个各种文件信息……
+#: src/cryptsetup.c:3360
+#, fuzzy
+msgid "converts a key to new pbkdf parameters"
+msgstr "获取 (stat) 密钥文件统计数据失败。\n"
+
+#: src/cryptsetup.c:3361
+msgid "<device> <key slot>"
+msgstr "<设备> <密钥槽>"
+
+#: src/cryptsetup.c:3361
+msgid "wipes key with number <key slot> from LUKS device"
+msgstr "从 LUKS 设备清理标号为 <key slot> 的密钥"
+
+#: src/cryptsetup.c:3362
+msgid "print UUID of LUKS device"
+msgstr "输出 LUKS 设备的 UUID(唯一标识符)"
+
+#: src/cryptsetup.c:3363
+msgid "tests <device> for LUKS partition header"
+msgstr "从 <device> 探测 LUKS 分区标头"
+
+#: src/cryptsetup.c:3364
+msgid "dump LUKS partition information"
+msgstr "调出 LUKS 分区信息"
+
+#: src/cryptsetup.c:3365
+msgid "dump TCRYPT device information"
+msgstr "调出 TCRYPT 设备信息"
+
+#: src/cryptsetup.c:3366
+#, fuzzy
+msgid "dump BITLK device information"
+msgstr "调出 TCRYPT 设备信息"
+
+#: src/cryptsetup.c:3367
+#, fuzzy
+msgid "Suspend LUKS device and wipe key (all IOs are frozen)"
+msgstr "挂起 LUKS 设备并清除密钥(冻结所有 IO 操作)。"
+
+#: src/cryptsetup.c:3368
+msgid "Resume suspended LUKS device"
+msgstr "恢复已挂起的 LUKS 设备"
+
+#: src/cryptsetup.c:3369
+msgid "Backup LUKS device header and keyslots"
+msgstr "备份 LUKS 设备标头和密钥槽"
+
+#: src/cryptsetup.c:3370
+msgid "Restore LUKS device header and keyslots"
+msgstr "恢复 LUKS 设备标头和密钥槽"
+
+#: src/cryptsetup.c:3371
+msgid "<add|remove|import|export> <device>"
+msgstr ""
+
+#: src/cryptsetup.c:3371
+msgid "Manipulate LUKS2 tokens"
+msgstr ""
+
+#: src/cryptsetup.c:3389 src/veritysetup.c:412 src/integritysetup.c:498
+msgid ""
+"\n"
+"<action> is one of:\n"
+msgstr ""
+"\n"
+"<动作> 为其中之一:\n"
+
+#: src/cryptsetup.c:3395
+#, fuzzy
+msgid ""
+"\n"
+"You can also use old <action> syntax aliases:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"
+msgstr ""
+"\n"
+"你亦可使用老的 <动作> 语法别名:\n"
+"\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
+"\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"
+
+#: src/cryptsetup.c:3399
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<device> is the encrypted device\n"
+"<key slot> is the LUKS key slot number to modify\n"
+"<key file> optional key file for the new key for luksAddKey action\n"
+msgstr ""
+"\n"
+"<name> 为要在 %s 创建的设备\n"
+"<device> 为加密设备\n"
+"<key slot> 为需要更改的 LUKS 密钥槽\n"
+"<key file> 提供给 luksAddKey 动作的密钥文件\n"
+
+#: src/cryptsetup.c:3406
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in metadata format is %s (for luksFormat action).\n"
+msgstr ""
+
+#: src/cryptsetup.c:3411
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in key and passphrase parameters:\n"
+"\tMaximum keyfile size: %dkB, Maximum interactive passphrase length %d (characters)\n"
+"Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+"Default PBKDF for LUKS2: %s\n"
+"\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"
+msgstr ""
+"\n"
+"默认集成的密钥和密码参数:\n"
+"\t密钥文件的最大大小:%dkB, 交互式密码的最大长度:%d (字符)\n"
+"LUKS 的默认 PBKDF2 迭代时间:%d (毫秒)\n"
+
+#: src/cryptsetup.c:3422
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in device cipher parameters:\n"
+"\tloop-AES: %s, Key %d bits\n"
+"\tplain: %s, Key: %d bits, Password hashing: %s\n"
+"\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"
+msgstr ""
+"\n"
+"默认集成的设备密文参数:\n"
+"\tloop-AES:%s, %d 位密钥\n"
+"\tplain:%s, 密钥:%d 位, 密码哈希:%s\n"
+"\tLUKS1:%s, 密钥:%d bits, LUKS 数据头哈希:%s, RNG:%s\n"
+
+#: src/cryptsetup.c:3431
+msgid "\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"
+msgstr ""
+
+#: src/cryptsetup.c:3447 src/veritysetup.c:569 src/integritysetup.c:642
+#, c-format
+msgid "%s: requires %s as arguments"
+msgstr "%s: 需要 %s 作为参数"
+
+#: src/cryptsetup.c:3480 src/veritysetup.c:457 src/integritysetup.c:536
+#: src/cryptsetup_reencrypt.c:1607
+msgid "Show this help message"
+msgstr "显示此帮助"
+
+#: src/cryptsetup.c:3481 src/veritysetup.c:458 src/integritysetup.c:537
+#: src/cryptsetup_reencrypt.c:1608
+msgid "Display brief usage"
+msgstr "显示简短用法"
+
+#: src/cryptsetup.c:3482 src/veritysetup.c:459 src/integritysetup.c:538
+#: src/cryptsetup_reencrypt.c:1609
+msgid "Print package version"
+msgstr "打印软件包版本"
+
+#: src/cryptsetup.c:3486 src/veritysetup.c:463 src/integritysetup.c:542
+#: src/cryptsetup_reencrypt.c:1613
+msgid "Help options:"
+msgstr "帮助选项:"
+
+#: src/cryptsetup.c:3487 src/veritysetup.c:464 src/integritysetup.c:543
+#: src/cryptsetup_reencrypt.c:1614
+msgid "Shows more detailed error messages"
+msgstr "显示更详细的错误信息"
+
+#: src/cryptsetup.c:3488 src/veritysetup.c:465 src/integritysetup.c:544
+#: src/cryptsetup_reencrypt.c:1615
+msgid "Show debug messages"
+msgstr "显示调试信息"
+
+#: src/cryptsetup.c:3489
+#, fuzzy
+msgid "Show debug messages including JSON metadata"
+msgstr "显示调试信息"
+
+#: src/cryptsetup.c:3490 src/cryptsetup_reencrypt.c:1617
+msgid "The cipher used to encrypt the disk (see /proc/crypto)"
+msgstr "用于加密磁盘的密文(参见 /proc/crypto)"
+
+#: src/cryptsetup.c:3491 src/cryptsetup_reencrypt.c:1619
+msgid "The hash used to create the encryption key from the passphrase"
+msgstr "用于从密码创建加密密钥的哈希值"
+
+#: src/cryptsetup.c:3492
+msgid "Verifies the passphrase by asking for it twice"
+msgstr "两次询问密码以进行验证"
+
+#: src/cryptsetup.c:3493 src/cryptsetup_reencrypt.c:1621
+msgid "Read the key from a file"
+msgstr "从文件读取密钥"
+
+#: src/cryptsetup.c:3494
+msgid "Read the volume (master) key from file."
+msgstr "从文件读取卷(主)密钥。"
+
+#: src/cryptsetup.c:3495
+#, fuzzy
+msgid "Dump volume (master) key instead of keyslots info"
+msgstr "转储卷(主)密钥而不是键槽信息。"
+
+#: src/cryptsetup.c:3496 src/cryptsetup_reencrypt.c:1618
+msgid "The size of the encryption key"
+msgstr "加密密钥大小"
+
+#: src/cryptsetup.c:3496 src/cryptsetup.c:3557 src/integritysetup.c:562
+#: src/integritysetup.c:566 src/integritysetup.c:570
+#: src/cryptsetup_reencrypt.c:1618
+msgid "BITS"
+msgstr "位"
+
+#: src/cryptsetup.c:3497 src/cryptsetup_reencrypt.c:1634
+msgid "Limits the read from keyfile"
+msgstr "限制从密钥文件读取"
+
+#: src/cryptsetup.c:3497 src/cryptsetup.c:3498 src/cryptsetup.c:3499
+#: src/cryptsetup.c:3500 src/cryptsetup.c:3503 src/cryptsetup.c:3554
+#: src/cryptsetup.c:3555 src/cryptsetup.c:3563 src/cryptsetup.c:3564
+#: src/veritysetup.c:468 src/veritysetup.c:469 src/veritysetup.c:470
+#: src/veritysetup.c:473 src/veritysetup.c:474 src/integritysetup.c:551
+#: src/integritysetup.c:557 src/integritysetup.c:558
+#: src/cryptsetup_reencrypt.c:1633 src/cryptsetup_reencrypt.c:1634
+#: src/cryptsetup_reencrypt.c:1635 src/cryptsetup_reencrypt.c:1636
+msgid "bytes"
+msgstr "字节"
+
+#: src/cryptsetup.c:3498 src/cryptsetup_reencrypt.c:1633
+msgid "Number of bytes to skip in keyfile"
+msgstr "要从密钥文件跳过的字节数"
+
+#: src/cryptsetup.c:3499
+msgid "Limits the read from newly added keyfile"
+msgstr "限制从新增密钥文件的读取"
+
+#: src/cryptsetup.c:3500
+msgid "Number of bytes to skip in newly added keyfile"
+msgstr "要从新增密钥文件跳过的字节数"
+
+#: src/cryptsetup.c:3501
+msgid "Slot number for new key (default is first free)"
+msgstr "新密钥的槽号(默认为第一个可用的)"
+
+#: src/cryptsetup.c:3502
+msgid "The size of the device"
+msgstr "设备大小"
+
+#: src/cryptsetup.c:3502 src/cryptsetup.c:3504 src/cryptsetup.c:3505
+#: src/cryptsetup.c:3511 src/integritysetup.c:552 src/integritysetup.c:559
+msgid "SECTORS"
+msgstr "扇区"
+
+#: src/cryptsetup.c:3503 src/cryptsetup_reencrypt.c:1636
+msgid "Use only specified device size (ignore rest of device). DANGEROUS!"
+msgstr "只使用指定的设备大小(忽略设备其余部分)。危险!"
+
+#: src/cryptsetup.c:3504
+msgid "The start offset in the backend device"
+msgstr "后端设备的起始偏移量"
+
+#: src/cryptsetup.c:3505
+msgid "How many sectors of the encrypted data to skip at the beginning"
+msgstr "从开头要跳过的加密数据扇区数量"
+
+#: src/cryptsetup.c:3506
+msgid "Create a readonly mapping"
+msgstr "创建只读映射"
+
+#: src/cryptsetup.c:3507 src/integritysetup.c:545
+#: src/cryptsetup_reencrypt.c:1624
+msgid "Do not ask for confirmation"
+msgstr "不要请求确认"
+
+#: src/cryptsetup.c:3508
+msgid "Timeout for interactive passphrase prompt (in seconds)"
+msgstr "交互式密码提示符超时长度(秒)"
+
+#: src/cryptsetup.c:3508 src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "secs"
+msgstr "秒"
+
+#: src/cryptsetup.c:3509 src/integritysetup.c:546
+#: src/cryptsetup_reencrypt.c:1625
+msgid "Progress line update (in seconds)"
+msgstr ""
+
+#: src/cryptsetup.c:3510 src/cryptsetup_reencrypt.c:1626
+msgid "How often the input of the passphrase can be retried"
+msgstr "输入密码的最大重试频率"
+
+#: src/cryptsetup.c:3511
+msgid "Align payload at <n> sector boundaries - for luksFormat"
+msgstr "于 <n> 个扇区边界处对其载荷数据 - 供 luks 格式用"
+
+#: src/cryptsetup.c:3512
+#, fuzzy
+msgid "File with LUKS header and keyslots backup"
+msgstr "带有 LUKS 数据头和密钥槽备份的文件。"
+
+#: src/cryptsetup.c:3513 src/cryptsetup_reencrypt.c:1627
+msgid "Use /dev/random for generating volume key"
+msgstr "使用 /dev/random 生成卷密钥"
+
+#: src/cryptsetup.c:3514 src/cryptsetup_reencrypt.c:1628
+msgid "Use /dev/urandom for generating volume key"
+msgstr "使用 /dev/urandom 生成卷密钥"
+
+#: src/cryptsetup.c:3515
+#, fuzzy
+msgid "Share device with another non-overlapping crypt segment"
+msgstr "与另一个不重合的加密段共享设备。"
+
+#: src/cryptsetup.c:3516 src/veritysetup.c:477
+#, fuzzy
+msgid "UUID for device to use"
+msgstr "设备使用的 UUID 已占用。"
+
+#: src/cryptsetup.c:3517 src/integritysetup.c:579
+#, fuzzy
+msgid "Allow discards (aka TRIM) requests for device"
+msgstr "允许设备的 discard(或称 TRIM)请求。"
+
+#: src/cryptsetup.c:3518 src/cryptsetup_reencrypt.c:1645
+#, fuzzy
+msgid "Device or file with separated LUKS header"
+msgstr "带有分离 LUKS 数据头的设备或文件。"
+
+#: src/cryptsetup.c:3519
+#, fuzzy
+msgid "Do not activate device, just check passphrase"
+msgstr "不要激活设备,仅检查密码。"
+
+#: src/cryptsetup.c:3520
+#, fuzzy
+msgid "Use hidden header (hidden TCRYPT device)"
+msgstr "使用隐藏数据头(隐藏 TCRYPT 设备)"
+
+#: src/cryptsetup.c:3521
+#, fuzzy
+msgid "Device is system TCRYPT drive (with bootloader)"
+msgstr "设备为系统 TCRYPT 驱动器(带有引导器)。"
+
+#: src/cryptsetup.c:3522
+msgid "Use backup (secondary) TCRYPT header"
+msgstr "使用备份(次级)TCRYPT 标头"
+
+#: src/cryptsetup.c:3523
+#, fuzzy
+msgid "Scan also for VeraCrypt compatible device"
+msgstr "同时扫描 VeraCrypt 兼容的设备。"
+
+#: src/cryptsetup.c:3524
+#, fuzzy
+msgid "Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "同时扫描 VeraCrypt 兼容的设备。"
+
+#: src/cryptsetup.c:3525
+#, fuzzy
+msgid "Query Personal Iteration Multiplier for VeraCrypt compatible device"
+msgstr "同时扫描 VeraCrypt 兼容的设备。"
+
+#: src/cryptsetup.c:3526
+#, fuzzy
+msgid "Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"
+msgstr "设备元数据类型:luks, 纯粹 (plain), loopaes, tcrypt."
+
+#: src/cryptsetup.c:3527
+#, fuzzy
+msgid "Disable password quality check (if enabled)"
+msgstr "禁用密码质量检查 (如果已启用)。"
+
+#: src/cryptsetup.c:3528
+#, fuzzy
+msgid "Use dm-crypt same_cpu_crypt performance compatibility option"
+msgstr "使用 dm-crypt same_cpu_crypt 性能兼容性选项。"
+
+#: src/cryptsetup.c:3529
+#, fuzzy
+msgid "Use dm-crypt submit_from_crypt_cpus performance compatibility option"
+msgstr "使用 dm-crypt submit_from_crypt_cpus 性能兼容性选项。"
+
+#: src/cryptsetup.c:3530
+msgid "Device removal is deferred until the last user closes it"
+msgstr ""
+
+#: src/cryptsetup.c:3531
+msgid "Use global lock to serialize memory hard PBKDF (OOM workaround)"
+msgstr ""
+
+#: src/cryptsetup.c:3532
+msgid "PBKDF iteration time for LUKS (in ms)"
+msgstr "LUKS 默认 PBKDF 迭代时间(毫秒)"
+
+#: src/cryptsetup.c:3532 src/cryptsetup_reencrypt.c:1623
+msgid "msecs"
+msgstr "毫秒"
+
+#: src/cryptsetup.c:3533 src/cryptsetup_reencrypt.c:1641
+msgid "PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"
+msgstr ""
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "PBKDF memory cost limit"
+msgstr "PBKDF 内存开销限制"
+
+#: src/cryptsetup.c:3534 src/cryptsetup_reencrypt.c:1642
+msgid "kilobytes"
+msgstr "千字节"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "PBKDF parallel cost"
+msgstr "PBKDF 并行开销"
+
+#: src/cryptsetup.c:3535 src/cryptsetup_reencrypt.c:1643
+msgid "threads"
+msgstr "线程"
+
+#: src/cryptsetup.c:3536 src/cryptsetup_reencrypt.c:1644
+msgid "PBKDF iterations cost (forced, disables benchmark)"
+msgstr ""
+
+#: src/cryptsetup.c:3537
+msgid "Keyslot priority: ignore, normal, prefer"
+msgstr ""
+
+#: src/cryptsetup.c:3538
+#, fuzzy
+msgid "Disable locking of on-disk metadata"
+msgstr "尝试修复磁盘上的元数据"
+
+#: src/cryptsetup.c:3539
+msgid "Disable loading volume keys via kernel keyring"
+msgstr ""
+
+#: src/cryptsetup.c:3540
+msgid "Data integrity algorithm (LUKS2 only)"
+msgstr ""
+
+#: src/cryptsetup.c:3541 src/integritysetup.c:573
+#, fuzzy
+msgid "Disable journal for integrity device"
+msgstr "为 VERITY 设备提供的大小指标无效。\n"
+
+#: src/cryptsetup.c:3542 src/integritysetup.c:547
+msgid "Do not wipe device after format"
+msgstr ""
+
+#: src/cryptsetup.c:3543 src/integritysetup.c:577
+msgid "Use inefficient legacy padding (old kernels)"
+msgstr ""
+
+#: src/cryptsetup.c:3544
+msgid "Do not ask for passphrase if activation by token fails"
+msgstr ""
+
+#: src/cryptsetup.c:3545
+msgid "Token number (default: any)"
+msgstr ""
+
+#: src/cryptsetup.c:3546
+msgid "Key description"
+msgstr ""
+
+#: src/cryptsetup.c:3547
+msgid "Encryption sector size (default: 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3548
+msgid "Use IV counted in sector size (not in 512 bytes)"
+msgstr ""
+
+#: src/cryptsetup.c:3549
+msgid "Set activation flags persistent for device"
+msgstr ""
+
+#: src/cryptsetup.c:3550
+#, fuzzy
+msgid "Set label for the LUKS2 device"
+msgstr "格式化一个 LUKS 设备"
+
+#: src/cryptsetup.c:3551
+#, fuzzy
+msgid "Set subsystem label for the LUKS2 device"
+msgstr "格式化一个 LUKS 设备"
+
+#: src/cryptsetup.c:3552
+msgid "Create or dump unbound (no assigned data segment) LUKS2 keyslot"
+msgstr ""
+
+#: src/cryptsetup.c:3553
+#, fuzzy
+msgid "Read or write the json from or to a file"
+msgstr "从文件读取密钥"
+
+#: src/cryptsetup.c:3554
+msgid "LUKS2 header metadata area size"
+msgstr ""
+
+#: src/cryptsetup.c:3555
+#, fuzzy
+msgid "LUKS2 header keyslots area size"
+msgstr "带有 LUKS 数据头和密钥槽备份的文件。"
+
+#: src/cryptsetup.c:3556
+msgid "Refresh (reactivate) device with new parameters"
+msgstr ""
+
+#: src/cryptsetup.c:3557
+#, fuzzy
+msgid "LUKS2 keyslot: The size of the encryption key"
+msgstr "加密密钥大小"
+
+#: src/cryptsetup.c:3558
+msgid "LUKS2 keyslot: The cipher used for keyslot encryption"
+msgstr ""
+
+#: src/cryptsetup.c:3559
+#, fuzzy
+msgid "Encrypt LUKS2 device (in-place encryption)."
+msgstr "永久解密设备(移除加密)"
+
+#: src/cryptsetup.c:3560
+#, fuzzy
+msgid "Decrypt LUKS2 device (remove encryption)."
+msgstr "永久解密设备(移除加密)"
+
+#: src/cryptsetup.c:3561
+msgid "Initialize LUKS2 reencryption in metadata only."
+msgstr ""
+
+#: src/cryptsetup.c:3562
+msgid "Resume initialized LUKS2 reencryption only."
+msgstr ""
+
+#: src/cryptsetup.c:3563 src/cryptsetup_reencrypt.c:1635
+msgid "Reduce data device size (move data offset). DANGEROUS!"
+msgstr "减少数据设备大小(移动数据偏移量)。危险!"
+
+#: src/cryptsetup.c:3564
+#, fuzzy
+msgid "Maximal reencryption hotzone size."
+msgstr "重加密块大小"
+
+#: src/cryptsetup.c:3565
+msgid "Reencryption hotzone resilience type (checksum,journal,none)"
+msgstr ""
+
+#: src/cryptsetup.c:3566
+#, fuzzy
+msgid "Reencryption hotzone checksums hash"
+msgstr "重加密块大小"
+
+#: src/cryptsetup.c:3567
+msgid "Override device autodetection of dm device to be reencrypted"
+msgstr ""
+
+#: src/cryptsetup.c:3583 src/veritysetup.c:499 src/integritysetup.c:595
+msgid "[OPTION...] <action> <action-specific>"
+msgstr "[选项…] <动作> <动作特定参数>"
+
+#: src/cryptsetup.c:3634 src/veritysetup.c:533 src/integritysetup.c:606
+msgid "Argument <action> missing."
+msgstr "缺失参数 <动作>。"
+
+#: src/cryptsetup.c:3703 src/veritysetup.c:564 src/integritysetup.c:637
+msgid "Unknown action."
+msgstr "未知动作。"
+
+#: src/cryptsetup.c:3713
+msgid "Options --refresh and --test-passphrase are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3718
+#, fuzzy
+msgid "Option --deferred is allowed only for close command."
+msgstr "选项 --shared 只适用于打开纯设备。\n"
+
+#: src/cryptsetup.c:3723
+#, fuzzy
+msgid "Option --shared is allowed only for open of plain device."
+msgstr "选项 --shared 只适用于打开纯设备。\n"
+
+#: src/cryptsetup.c:3728 src/integritysetup.c:654
+#, fuzzy
+msgid "Option --allow-discards is allowed only for open operation."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/cryptsetup.c:3733
+#, fuzzy
+msgid "Option --persistent is allowed only for open operation."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/cryptsetup.c:3738
+#, fuzzy
+msgid "Option --serialize-memory-hard-pbkdf is allowed only for open operation."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/cryptsetup.c:3743
+#, fuzzy
+msgid "Option --persistent is not allowed with --test-passphrase."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/cryptsetup.c:3753
+#, fuzzy
+msgid ""
+"Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+"open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."
+msgstr ""
+"选项 --key-size 只能用于 luksFormat, 打开和性能测试。\n"
+"要限制密钥文件读取请使用 --keyfile-size=(字节数)。"
+
+#: src/cryptsetup.c:3759
+#, fuzzy
+msgid "Option --integrity is allowed only for luksFormat (LUKS2)."
+msgstr "选项 --align-payload 只允许用于 luksFormat。"
+
+#: src/cryptsetup.c:3764
+msgid "Option --integrity-no-wipe can be used only for format action with integrity extension."
+msgstr ""
+
+#: src/cryptsetup.c:3770
+#, fuzzy
+msgid "Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."
+msgstr "选项 --uuid 只允许用于 luksFormat 和 luksUUID。"
+
+#: src/cryptsetup.c:3776
+#, fuzzy
+msgid "Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."
+msgstr "选项 --test-passphrase 只能用于打开 LUKS 和 TCRYPT 设备。\n"
+
+#: src/cryptsetup.c:3781 src/cryptsetup_reencrypt.c:1708
+msgid "Key size must be a multiple of 8 bits"
+msgstr "密钥尺寸必须是 8 的倍数"
+
+#: src/cryptsetup.c:3787 src/cryptsetup_reencrypt.c:1394
+#: src/cryptsetup_reencrypt.c:1713
+msgid "Key slot is invalid."
+msgstr "密钥槽无效。"
+
+#: src/cryptsetup.c:3794
+#, fuzzy
+msgid "Option --key-file takes precedence over specified key file argument."
+msgstr "选项 --key-file 优先使用指定的密钥文件参数。\n"
+
+#: src/cryptsetup.c:3801 src/veritysetup.c:576 src/integritysetup.c:663
+#: src/cryptsetup_reencrypt.c:1687
+msgid "Negative number for option not permitted."
+msgstr "不允许在选项中填入负数。"
+
+#: src/cryptsetup.c:3805
+msgid "Only one --key-file argument is allowed."
+msgstr "只允许存在一个 --key-file 选项。"
+
+#: src/cryptsetup.c:3809 src/cryptsetup_reencrypt.c:1679
+#: src/cryptsetup_reencrypt.c:1717
+msgid "Only one of --use-[u]random options is allowed."
+msgstr "--use-[u]random 选项只能用一处。"
+
+#: src/cryptsetup.c:3813
+msgid "Option --use-[u]random is allowed only for luksFormat."
+msgstr "选项 --use-[u]random 只适用于 luksFormat。"
+
+#: src/cryptsetup.c:3817
+msgid "Option --uuid is allowed only for luksFormat and luksUUID."
+msgstr "选项 --uuid 只允许用于 luksFormat 和 luksUUID。"
+
+#: src/cryptsetup.c:3821
+msgid "Option --align-payload is allowed only for luksFormat."
+msgstr "选项 --align-payload 只允许用于 luksFormat。"
+
+#: src/cryptsetup.c:3825
+#, fuzzy
+msgid "Options --luks2-metadata-size and --opt-luks2-keyslots-size are allowed only for luksFormat with LUKS2."
+msgstr "选项 --uuid 只允许用于 luksFormat 和 luksUUID。"
+
+#: src/cryptsetup.c:3830
+#, fuzzy
+msgid "Invalid LUKS2 metadata size specification."
+msgstr "无效的设备大小指标。"
+
+#: src/cryptsetup.c:3834
+#, fuzzy
+msgid "Invalid LUKS2 keyslots size specification."
+msgstr "无效的设备大小指标。"
+
+#: src/cryptsetup.c:3838
+#, fuzzy
+msgid "Options --align-payload and --offset cannot be combined."
+msgstr "选项 --align-payload 只允许用于 luksFormat。"
+
+#: src/cryptsetup.c:3844
+#, fuzzy
+msgid "Option --skip is supported only for open of plain and loopaes devices."
+msgstr "选项 --skip 只适用于打开纯设备和 loopaes 设备。\n"
+
+#: src/cryptsetup.c:3851
+#, fuzzy
+msgid "Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."
+msgstr "选项 --offset 只适用于打开纯设备和 loopaes 设备。\n"
+
+#: src/cryptsetup.c:3857
+#, fuzzy
+msgid "Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."
+msgstr "选项 --tcrypt-hidden, --tcrypt-system 或 --tcrypt-backup 只支持 TCRYPT 设备。\n"
+
+#: src/cryptsetup.c:3862
+#, fuzzy
+msgid "Option --tcrypt-hidden cannot be combined with --allow-discards."
+msgstr "选项 --tcrypt-hidden 不能与 --allow-discards 共用。\n"
+
+#: src/cryptsetup.c:3867
+#, fuzzy
+msgid "Option --veracrypt is supported only for TCRYPT device type."
+msgstr "选项 --veracrypt 只支持 TCRYPT 设备类型。\n"
+
+#: src/cryptsetup.c:3873
+msgid "Invalid argument for parameter --veracrypt-pim supplied."
+msgstr ""
+
+#: src/cryptsetup.c:3877
+#, fuzzy
+msgid "Option --veracrypt-pim is supported only for VeraCrypt compatible devices."
+msgstr "选项 --veracrypt 只支持 TCRYPT 设备类型。\n"
+
+#: src/cryptsetup.c:3885
+#, fuzzy
+msgid "Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."
+msgstr "选项 --veracrypt 只支持 TCRYPT 设备类型。\n"
+
+#: src/cryptsetup.c:3889
+msgid "The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."
+msgstr ""
+
+#: src/cryptsetup.c:3896
+msgid "Option --priority can be only ignore/normal/prefer."
+msgstr ""
+
+#: src/cryptsetup.c:3901 src/cryptsetup.c:3939
+msgid "Keyslot specification is required."
+msgstr ""
+
+#: src/cryptsetup.c:3906 src/cryptsetup_reencrypt.c:1693
+msgid "Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."
+msgstr ""
+
+#: src/cryptsetup.c:3911 src/cryptsetup_reencrypt.c:1698
+msgid "PBKDF forced iterations cannot be combined with iteration time option."
+msgstr ""
+
+#: src/cryptsetup.c:3917
+#, fuzzy
+msgid "Sector size option is not supported for this command."
+msgstr "不支持在这类设备上执行此操作。\n"
+
+#: src/cryptsetup.c:3929
+msgid "Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."
+msgstr ""
+
+#: src/cryptsetup.c:3934
+msgid "Key size is required with --unbound option."
+msgstr ""
+
+#: src/cryptsetup.c:3944
+#, fuzzy
+msgid "Option --unbound may be used only with luksAddKey and luksDump actions."
+msgstr "选项 --new 不可与 --decrypt 共用。"
+
+#: src/cryptsetup.c:3949
+#, fuzzy
+msgid "Option --refresh may be used only with open action."
+msgstr "选项 --new 不可与 --decrypt 共用。"
+
+#: src/cryptsetup.c:3960
+#, fuzzy
+msgid "Cannot disable metadata locking."
+msgstr "无法禁用元数据锁定。\n"
+
+#: src/cryptsetup.c:3970
+#, fuzzy
+msgid "Invalid max reencryption hotzone size specification."
+msgstr "无效的设备大小指标。"
+
+#: src/cryptsetup.c:3978 src/cryptsetup_reencrypt.c:1722
+#: src/cryptsetup_reencrypt.c:1727
+msgid "Invalid device size specification."
+msgstr "无效的设备大小指标。"
+
+#: src/cryptsetup.c:3981
+#, fuzzy
+msgid "Maximum device reduce size is 1 GiB."
+msgstr "最大设备缩减大小为 64 MiB。"
+
+#: src/cryptsetup.c:3984 src/cryptsetup_reencrypt.c:1733
+msgid "Reduce size must be multiple of 512 bytes sector."
+msgstr "缩减大小必须为 512 字节扇区的倍数。"
+
+#: src/cryptsetup.c:3989
+#, fuzzy
+msgid "Invalid data size specification."
+msgstr "无效的设备大小指标。"
+
+#: src/cryptsetup.c:3994
+#, fuzzy
+msgid "Reduce size overflow."
+msgstr "设备偏移量溢出。"
+
+#: src/cryptsetup.c:3998
+msgid "LUKS2 decryption requires option --header."
+msgstr ""
+
+#: src/cryptsetup.c:4002
+#, fuzzy
+msgid "Device size must be multiple of 512 bytes sector."
+msgstr "缩减大小必须为 512 字节扇区的倍数。"
+
+#: src/cryptsetup.c:4006
+msgid "Options --reduce-device-size and --data-size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4010
+msgid "Options --device-size and --size cannot be combined."
+msgstr ""
+
+#: src/cryptsetup.c:4014
+msgid "Options --keyslot-cipher and --keyslot-key-size must be used together."
+msgstr ""
+
+#: src/veritysetup.c:66
+msgid "Invalid salt string specified."
+msgstr "指定了无效的盐字串。"
+
+#: src/veritysetup.c:97
+#, fuzzy, c-format
+msgid "Cannot create hash image %s for writing."
+msgstr "无法为创建哈希映像 %s 以供写入。\n"
+
+#: src/veritysetup.c:107
+#, fuzzy, c-format
+msgid "Cannot create FEC image %s for writing."
+msgstr "无法为创建哈希映像 %s 以供写入。\n"
+
+#: src/veritysetup.c:179
+#, fuzzy
+msgid "Invalid root hash string specified."
+msgstr "指定了无效的根哈希值字串。\n"
+
+#: src/veritysetup.c:187
+#, fuzzy, c-format
+msgid "Invalid signature file %s."
+msgstr "设备 %s 无效。"
+
+#: src/veritysetup.c:194
+#, fuzzy, c-format
+msgid "Cannot read signature file %s."
+msgstr ""
+"无法读取密钥文件 %s。\n"
+"\n"
+
+#: src/veritysetup.c:392
+msgid "<data_device> <hash_device>"
+msgstr "<数据设备> <哈希设备>"
+
+#: src/veritysetup.c:392 src/integritysetup.c:479
+msgid "format device"
+msgstr "格式化设备"
+
+#: src/veritysetup.c:393
+msgid "<data_device> <hash_device> <root_hash>"
+msgstr "<数据设备> <哈希设备> <根哈希值>"
+
+#: src/veritysetup.c:393
+msgid "verify device"
+msgstr "验证设备"
+
+#: src/veritysetup.c:394
+#, fuzzy
+msgid "<data_device> <name> <hash_device> <root_hash>"
+msgstr "<数据设备> <哈希设备> <根哈希值>"
+
+#: src/veritysetup.c:396 src/integritysetup.c:482
+msgid "show active device status"
+msgstr "显示已激活的设备信息"
+
+#: src/veritysetup.c:397
+msgid "<hash_device>"
+msgstr "<哈希设备>"
+
+#: src/veritysetup.c:397 src/integritysetup.c:483
+msgid "show on-disk information"
+msgstr "显示磁盘上的信息"
+
+#: src/veritysetup.c:416
+#, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<data_device> is the data device\n"
+"<hash_device> is the device containing verification data\n"
+"<root_hash> hash of the root node on <hash_device>\n"
+msgstr ""
+"\n"
+"<名称> 是在 %s 下要创建的设备\n"
+"<数据设备> 就是数据设备\n"
+"<哈希设备> 是含有验证信息的设备\n"
+"<根哈希值> 是 <哈希设备> 根节点的哈希值\n"
+
+#: src/veritysetup.c:423
+#, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-verity parameters:\n"
+"\tHash: %s, Data block (bytes): %u, Hash block (bytes): %u, Salt size: %u, Hash format: %u\n"
+msgstr ""
+"\n"
+"编译时决定的默认 dm-verify 参数:\n"
+"\t哈希: %s, 数据块 (字节): %u, 哈希块 (字节): %u, 盐大小: %u, 哈希格式: %u\n"
+
+#: src/veritysetup.c:466
+msgid "Do not use verity superblock"
+msgstr "不使用真理超级块"
+
+#: src/veritysetup.c:467
+msgid "Format type (1 - normal, 0 - original Chrome OS)"
+msgstr "格式类型 (1 - 正常, 0 - 原版 Chrome OS)"
+
+#: src/veritysetup.c:467
+msgid "number"
+msgstr "数字"
+
+#: src/veritysetup.c:468
+msgid "Block size on the data device"
+msgstr "数据设备的块大小"
+
+#: src/veritysetup.c:469
+msgid "Block size on the hash device"
+msgstr "哈希设备的块大小"
+
+#: src/veritysetup.c:470
+msgid "FEC parity bytes"
+msgstr "FEC 校验字节"
+
+#: src/veritysetup.c:471
+msgid "The number of blocks in the data file"
+msgstr "数据文件的块数量"
+
+#: src/veritysetup.c:471
+msgid "blocks"
+msgstr "块"
+
+#: src/veritysetup.c:472
+msgid "Path to device with error correction data"
+msgstr ""
+
+#: src/veritysetup.c:472 src/integritysetup.c:549
+msgid "path"
+msgstr ""
+
+#: src/veritysetup.c:473
+msgid "Starting offset on the hash device"
+msgstr "哈希设备开始位置偏移量"
+
+#: src/veritysetup.c:474
+#, fuzzy
+msgid "Starting offset on the FEC device"
+msgstr "哈希设备开始位置偏移量"
+
+#: src/veritysetup.c:475
+msgid "Hash algorithm"
+msgstr "哈希算法"
+
+#: src/veritysetup.c:475
+msgid "string"
+msgstr "字符串"
+
+#: src/veritysetup.c:476
+msgid "Salt"
+msgstr "盐"
+
+#: src/veritysetup.c:476
+msgid "hex string"
+msgstr "十六进制字符串"
+
+#: src/veritysetup.c:478
+#, fuzzy
+msgid "Path to root hash signature file"
+msgstr "创建哈希区失败。"
+
+#: src/veritysetup.c:479
+msgid "Restart kernel if corruption is detected"
+msgstr ""
+
+#: src/veritysetup.c:480
+msgid "Ignore corruption, log it only"
+msgstr "忽略数据损坏,仅对其进行日志记录"
+
+#: src/veritysetup.c:481
+#, fuzzy
+msgid "Do not verify zeroed blocks"
+msgstr "不使用真理超级块"
+
+#: src/veritysetup.c:482
+msgid "Verify data block only the first time it is read"
+msgstr ""
+
+#: src/veritysetup.c:582
+#, fuzzy
+msgid "Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/veritysetup.c:587
+#, fuzzy
+msgid "Option --root-hash-signature can be used only for open operation."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/veritysetup.c:592
+#, fuzzy
+msgid "Option --ignore-corruption and --restart-on-corruption cannot be used together."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/integritysetup.c:84 src/utils_password.c:305
+#, fuzzy, c-format
+msgid "Cannot read keyfile %s."
+msgstr ""
+"无法读取密钥文件 %s。\n"
+"\n"
+
+#: src/integritysetup.c:88 src/utils_password.c:310
+#, fuzzy, c-format
+msgid "Cannot read %d bytes from keyfile %s."
+msgstr "无法从密钥文件 %2$s 读取 %1$d 字节。\n"
+
+#: src/integritysetup.c:254
+#, c-format
+msgid "Formatted with tag size %u, internal integrity %s.\n"
+msgstr ""
+
+#: src/integritysetup.c:479 src/integritysetup.c:483
+#, fuzzy
+msgid "<integrity_device>"
+msgstr "验证设备"
+
+#: src/integritysetup.c:480
+msgid "<integrity_device> <name>"
+msgstr ""
+
+#: src/integritysetup.c:502
+#, fuzzy, c-format
+msgid ""
+"\n"
+"<name> is the device to create under %s\n"
+"<integrity_device> is the device containing data with integrity tags\n"
+msgstr ""
+"\n"
+"<名称> 是在 %s 下要创建的设备\n"
+"<数据设备> 就是数据设备\n"
+"<哈希设备> 是含有验证信息的设备\n"
+"<根哈希值> 是 <哈希设备> 根节点的哈希值\n"
+
+#: src/integritysetup.c:507
+#, fuzzy, c-format
+msgid ""
+"\n"
+"Default compiled-in dm-integrity parameters:\n"
+"\tChecksum algorithm: %s\n"
+msgstr ""
+"\n"
+"编译时决定的默认 dm-verify 参数:\n"
+"\t哈希: %s, 数据块 (字节): %u, 哈希块 (字节): %u, 盐大小: %u, 哈希格式: %u\n"
+
+#: src/integritysetup.c:549
+msgid "Path to data device (if separated)"
+msgstr ""
+
+#: src/integritysetup.c:551
+msgid "Journal size"
+msgstr "日志大小"
+
+#: src/integritysetup.c:552
+msgid "Interleave sectors"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "Journal watermark"
+msgstr ""
+
+#: src/integritysetup.c:553
+msgid "percent"
+msgstr ""
+
+#: src/integritysetup.c:554
+msgid "Journal commit time"
+msgstr "日志提交时间"
+
+#: src/integritysetup.c:554 src/integritysetup.c:556
+msgid "ms"
+msgstr ""
+
+#: src/integritysetup.c:555
+msgid "Number of 512-byte sectors per bit (bitmap mode)."
+msgstr ""
+
+#: src/integritysetup.c:556
+msgid "Bitmap mode flush time"
+msgstr ""
+
+#: src/integritysetup.c:557
+msgid "Tag size (per-sector)"
+msgstr ""
+
+#: src/integritysetup.c:558
+msgid "Sector size"
+msgstr "扇区大小"
+
+#: src/integritysetup.c:559
+msgid "Buffers size"
+msgstr "缓冲大小"
+
+#: src/integritysetup.c:561
+msgid "Data integrity algorithm"
+msgstr "数据完整性校验算法"
+
+#: src/integritysetup.c:562
+#, fuzzy
+msgid "The size of the data integrity key"
+msgstr "加密密钥大小"
+
+#: src/integritysetup.c:563
+#, fuzzy
+msgid "Read the integrity key from a file"
+msgstr "从文件读取密钥。"
+
+#: src/integritysetup.c:565
+msgid "Journal integrity algorithm"
+msgstr ""
+
+#: src/integritysetup.c:566
+#, fuzzy
+msgid "The size of the journal integrity key"
+msgstr "加密密钥大小"
+
+#: src/integritysetup.c:567
+#, fuzzy
+msgid "Read the journal integrity key from a file"
+msgstr "从文件读取密钥。"
+
+#: src/integritysetup.c:569
+msgid "Journal encryption algorithm"
+msgstr "日志加密算法"
+
+#: src/integritysetup.c:570
+#, fuzzy
+msgid "The size of the journal encryption key"
+msgstr "加密密钥大小"
+
+#: src/integritysetup.c:571
+#, fuzzy
+msgid "Read the journal encryption key from a file"
+msgstr "从文件读取密钥。"
+
+#: src/integritysetup.c:574
+msgid "Recovery mode (no journal, no tag checking)"
+msgstr ""
+
+#: src/integritysetup.c:575
+#, fuzzy
+msgid "Use bitmap to track changes and disable journal for integrity device"
+msgstr "为 VERITY 设备提供的大小指标无效。\n"
+
+#: src/integritysetup.c:576
+msgid "Recalculate initial tags automatically."
+msgstr ""
+
+#: src/integritysetup.c:649
+#, fuzzy
+msgid "Option --integrity-recalculate can be used only for open action."
+msgstr "选项 --allow-discards 只适用于打开操作。\n"
+
+#: src/integritysetup.c:669
+msgid "Options --journal-size, --interleave-sectors, --sector-size, --tag-size and --no-wipe can be used only for format action."
+msgstr ""
+
+#: src/integritysetup.c:675
+msgid "Invalid journal size specification."
+msgstr "无效的日志大小指标。"
+
+#: src/integritysetup.c:680
+msgid "Both key file and key size options must be specified."
+msgstr "密钥文件和密钥大小选项均必须指定。"
+
+#: src/integritysetup.c:683
+msgid "Integrity algorithm must be specified if integrity key is used."
+msgstr ""
+
+#: src/integritysetup.c:688
+msgid "Both journal integrity key file and key size options must be specified."
+msgstr ""
+
+#: src/integritysetup.c:691
+msgid "Journal integrity algorithm must be specified if journal integrity key is used."
+msgstr "如果使用了日志加密密钥,则必须指定日志完整性校验算法。"
+
+#: src/integritysetup.c:696
+msgid "Both journal encryption key file and key size options must be specified."
+msgstr "日志加密密钥文件和密钥大小选项均必须指定。"
+
+#: src/integritysetup.c:699
+msgid "Journal encryption algorithm must be specified if journal encryption key is used."
+msgstr "如果使用了日志加密密钥,则必须指定日志加密算法。"
+
+#: src/integritysetup.c:703
+msgid "Recovery and bitmap mode options are mutually exclusive."
+msgstr ""
+
+#: src/integritysetup.c:707
+msgid "Journal options cannot be used in bitmap mode."
+msgstr ""
+
+#: src/integritysetup.c:711
+msgid "Bitmap options can be used only in bitmap mode."
+msgstr ""
+
+#: src/cryptsetup_reencrypt.c:172
+msgid "Reencryption already in-progress."
+msgstr "重加密已在进行中。"
+
+#: src/cryptsetup_reencrypt.c:208
+#, c-format
+msgid "Cannot exclusively open %s, device in use."
+msgstr "无法独占打开 %s,设备正在使用中。"
+
+#: src/cryptsetup_reencrypt.c:222 src/cryptsetup_reencrypt.c:1135
+msgid "Allocation of aligned memory failed."
+msgstr "分配对齐内存失败。"
+
+#: src/cryptsetup_reencrypt.c:229
+#, c-format
+msgid "Cannot read device %s."
+msgstr "无法读取设备 %s。"
+
+#: src/cryptsetup_reencrypt.c:240
+#, c-format
+msgid "Marking LUKS1 device %s unusable."
+msgstr "正在标记 LUKS1 设备 %s 为不可用状态。"
+
+#: src/cryptsetup_reencrypt.c:244
+#, c-format
+msgid "Setting LUKS2 offline reencrypt flag on device %s."
+msgstr "正在设备 %s 上设定 LUKS2 离线重加密旗标。"
+
+#: src/cryptsetup_reencrypt.c:261
+#, c-format
+msgid "Cannot write device %s."
+msgstr "无法写入设备 %s。"
+
+#: src/cryptsetup_reencrypt.c:309
+msgid "Cannot write reencryption log file."
+msgstr "无法写入重加密日志文件。"
+
+#: src/cryptsetup_reencrypt.c:365
+msgid "Cannot read reencryption log file."
+msgstr "无法读取重加密日志文件。"
+
+#: src/cryptsetup_reencrypt.c:403
+#, c-format
+msgid "Log file %s exists, resuming reencryption.\n"
+msgstr "日志文件 %s 存在,继续重加密。\n"
+
+#: src/cryptsetup_reencrypt.c:452
+msgid "Activating temporary device using old LUKS header."
+msgstr "正使用旧 LUKS 标头激活临时设备。"
+
+#: src/cryptsetup_reencrypt.c:462
+msgid "Activating temporary device using new LUKS header."
+msgstr "正使用新 LUKS 标头激活临时设备。"
+
+#: src/cryptsetup_reencrypt.c:472
+msgid "Activation of temporary devices failed."
+msgstr "激活临时设备失败。"
+
+# stat() 主要就是出来一个各种文件信息……
+#: src/cryptsetup_reencrypt.c:559
+#, fuzzy
+msgid "Failed to set data offset."
+msgstr "获取 (stat) 密钥文件信息失败。"
+
+# stat() 主要就是出来一个各种文件信息……
+#: src/cryptsetup_reencrypt.c:565
+#, fuzzy
+msgid "Failed to set metadata size."
+msgstr "获取 (stat) 密钥文件信息失败。"
+
+#: src/cryptsetup_reencrypt.c:573
+#, c-format
+msgid "New LUKS header for device %s created."
+msgstr "已创建设备 %s 的新 LUKS 标头。"
+
+#: src/cryptsetup_reencrypt.c:633
+#, c-format
+msgid "This version of cryptsetup-reencrypt can't handle new internal token type %s."
+msgstr "该版本的 cryptsetup-reencrypt 无法处理新的内部 token 类型 %s。"
+
+#: src/cryptsetup_reencrypt.c:655
+msgid "Failed to read activation flags from backup header."
+msgstr "从备份标头读取活动旗标失败。"
+
+#: src/cryptsetup_reencrypt.c:659
+msgid "Failed to write activation flags to new header."
+msgstr "向新表头写入活动旗标失败。"
+
+#: src/cryptsetup_reencrypt.c:663 src/cryptsetup_reencrypt.c:667
+msgid "Failed to read requirements from backup header."
+msgstr "从备份标头读取需求失败。"
+
+#: src/cryptsetup_reencrypt.c:705
+#, c-format
+msgid "%s header backup of device %s created."
+msgstr "已创建 %s 标头备份(对应设备 %s)。"
+
+#: src/cryptsetup_reencrypt.c:768
+msgid "Creation of LUKS backup headers failed."
+msgstr "LUKS 备份标头创建失败。"
+
+#: src/cryptsetup_reencrypt.c:901
+#, c-format
+msgid "Cannot restore %s header on device %s."
+msgstr "无法恢复 %s 标头(在设备 %s 上)。"
+
+#: src/cryptsetup_reencrypt.c:903
+#, c-format
+msgid "%s header on device %s restored."
+msgstr "已恢复 %s 标头(在设备 %s 上)。"
+
+#: src/cryptsetup_reencrypt.c:1107 src/cryptsetup_reencrypt.c:1113
+msgid "Cannot open temporary LUKS device."
+msgstr "无法打开临时 LUKS 设备。"
+
+#: src/cryptsetup_reencrypt.c:1118 src/cryptsetup_reencrypt.c:1123
+msgid "Cannot get device size."
+msgstr "无法获取设备大小。"
+
+#: src/cryptsetup_reencrypt.c:1158
+msgid "IO error during reencryption."
+msgstr "重加密时发生 IO 错误。"
+
+#: src/cryptsetup_reencrypt.c:1189
+msgid "Provided UUID is invalid."
+msgstr "提供的 UUID 无效。"
+
+#: src/cryptsetup_reencrypt.c:1423
+msgid "Cannot open reencryption log file."
+msgstr "无法打开重加密日志文件。"
+
+#: src/cryptsetup_reencrypt.c:1429
+msgid "No decryption in progress, provided UUID can be used only to resume suspended decryption process."
+msgstr "没有正在进行中的解密操作,提供的 UUID 仅能用于继续已挂起的解密操作。"
+
+#: src/cryptsetup_reencrypt.c:1504
+#, c-format
+msgid "Changed pbkdf parameters in keyslot %i."
+msgstr "已在密钥槽 %i 更改 pbkdf 参数。"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "Reencryption block size"
+msgstr "重加密块大小"
+
+#: src/cryptsetup_reencrypt.c:1616
+msgid "MiB"
+msgstr "MiB"
+
+#: src/cryptsetup_reencrypt.c:1620
+msgid "Do not change key, no data area reencryption"
+msgstr "不要更改密钥,无数据区重加密"
+
+#: src/cryptsetup_reencrypt.c:1622
+msgid "Read new volume (master) key from file"
+msgstr "从文件读取卷(主)密钥"
+
+#: src/cryptsetup_reencrypt.c:1623
+msgid "PBKDF2 iteration time for LUKS (in ms)"
+msgstr "LUKS 默认 PBKDF2 迭代时间(毫秒)"
+
+#: src/cryptsetup_reencrypt.c:1629
+msgid "Use direct-io when accessing devices"
+msgstr "在访问设备时使用 direct-io"
+
+#: src/cryptsetup_reencrypt.c:1630
+msgid "Use fsync after each block"
+msgstr "在每个数据块后使用 fsync"
+
+#: src/cryptsetup_reencrypt.c:1631
+msgid "Update log file after every block"
+msgstr "在每个数据块后更新日志文件"
+
+#: src/cryptsetup_reencrypt.c:1632
+msgid "Use only this slot (others will be disabled)"
+msgstr "仅使用这个密钥槽(其他的密钥槽将被禁用)"
+
+#: src/cryptsetup_reencrypt.c:1637
+msgid "Create new header on not encrypted device"
+msgstr "在未加密的设备上创建新的标头"
+
+#: src/cryptsetup_reencrypt.c:1638
+msgid "Permanently decrypt device (remove encryption)"
+msgstr "永久解密设备(移除加密)"
+
+#: src/cryptsetup_reencrypt.c:1639
+msgid "The UUID used to resume decryption"
+msgstr "用于继续解密的 UUID"
+
+#: src/cryptsetup_reencrypt.c:1640
+msgid "Type of LUKS metadata: luks1, luks2"
+msgstr "LUKS 元数据类型:luks1、luks2"
+
+#: src/cryptsetup_reencrypt.c:1659
+msgid "[OPTION...] <device>"
+msgstr "[选项...] <设备>"
+
+#: src/cryptsetup_reencrypt.c:1667
+#, c-format
+msgid "Reencryption will change: %s%s%s%s%s%s."
+msgstr "重加密会改变:%s%s%s%s%s%s。"
+
+#: src/cryptsetup_reencrypt.c:1668
+msgid "volume key"
+msgstr "卷密钥"
+
+#: src/cryptsetup_reencrypt.c:1670
+msgid "set hash to "
+msgstr "设置哈希值为 "
+
+#: src/cryptsetup_reencrypt.c:1671
+msgid ", set cipher to "
+msgstr ",设定密文为 "
+
+#: src/cryptsetup_reencrypt.c:1675
+msgid "Argument required."
+msgstr "需要参数。"
+
+#: src/cryptsetup_reencrypt.c:1703
+msgid "Only values between 1 MiB and 64 MiB allowed for reencryption block size."
+msgstr "重加密块大小只能是 1 MiB 到 64 MiB 之间的值。"
+
+#: src/cryptsetup_reencrypt.c:1730
+msgid "Maximum device reduce size is 64 MiB."
+msgstr "最大设备缩减大小为 64 MiB。"
+
+#: src/cryptsetup_reencrypt.c:1737
+msgid "Option --new must be used together with --reduce-device-size or --header."
+msgstr "选项 --new 必须与 --reduce-device-size 或 --header 共用。"
+
+#: src/cryptsetup_reencrypt.c:1741
+msgid "Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."
+msgstr "选项 --keep-key 只能与 --hash、--iter-time 或 --pbkdf-force-iterations 共用。"
+
+#: src/cryptsetup_reencrypt.c:1745
+msgid "Option --new cannot be used together with --decrypt."
+msgstr "选项 --new 不可与 --decrypt 共用。"
+
+#: src/cryptsetup_reencrypt.c:1749
+msgid "Option --decrypt is incompatible with specified parameters."
+msgstr "选项 --decrypt 与选定参数不兼容。"
+
+#: src/cryptsetup_reencrypt.c:1753
+msgid "Option --uuid is allowed only together with --decrypt."
+msgstr "选项 --uuid 不可与 --decrypt 共用。"
+
+#: src/cryptsetup_reencrypt.c:1757
+msgid "Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."
+msgstr "无效的 luks 类型。请使用下列选项之一:'luks'、'luks1' 或 'luks2'。"
+
+#: src/utils_tools.c:151
+msgid "Error reading response from terminal."
+msgstr "从终端读取响应时失败。"
+
+#: src/utils_tools.c:186
+msgid "Command successful.\n"
+msgstr "命令成功。\n"
+
+#: src/utils_tools.c:194
+msgid "wrong or missing parameters"
+msgstr "错误或缺失的参数"
+
+#: src/utils_tools.c:196
+msgid "no permission or bad passphrase"
+msgstr "无权限或口令错误"
+
+#: src/utils_tools.c:198
+msgid "out of memory"
+msgstr "内存耗尽"
+
+#: src/utils_tools.c:200
+msgid "wrong device or file specified"
+msgstr "指定了错误的设备或文件"
+
+#: src/utils_tools.c:202
+msgid "device already exists or device is busy"
+msgstr "设备已存在或设备正忙"
+
+#: src/utils_tools.c:204
+msgid "unknown error"
+msgstr "未知错误"
+
+#: src/utils_tools.c:206
+#, c-format
+msgid "Command failed with code %i (%s).\n"
+msgstr "命令失败,代码 %i(%s)。\n"
+
+#: src/utils_tools.c:283
+#, fuzzy, c-format
+msgid "Key slot %i created."
+msgstr "密钥槽 %d 已改变。"
+
+#: src/utils_tools.c:285
+#, fuzzy, c-format
+msgid "Key slot %i unlocked."
+msgstr "密钥槽 %d 已解锁。"
+
+#: src/utils_tools.c:287
+#, fuzzy, c-format
+msgid "Key slot %i removed."
+msgstr "密钥槽 %d 已解锁。"
+
+#: src/utils_tools.c:296
+#, fuzzy, c-format
+msgid "Token %i created."
+msgstr "密钥槽 %d 未使用。\n"
+
+#: src/utils_tools.c:298
+#, fuzzy, c-format
+msgid "Token %i removed."
+msgstr "密钥槽 %d 未使用。\n"
+
+#: src/utils_tools.c:464
+#, fuzzy
+msgid ""
+"\n"
+"Wipe interrupted."
+msgstr "测试密文"
+
+#: src/utils_tools.c:475
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' partition signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:483
+#, c-format
+msgid "WARNING: Device %s already contains a '%s' superblock signature.\n"
+msgstr ""
+
+#: src/utils_tools.c:504 src/utils_tools.c:568
+#, fuzzy
+msgid "Failed to initialize device signature probes."
+msgstr "初始化默认 LUKS2 密钥槽参数失败。"
+
+# stat() 主要就是出来一个各种文件信息……
+#: src/utils_tools.c:548
+#, fuzzy, c-format
+msgid "Failed to stat device %s."
+msgstr "获取 (stat) 密钥文件信息失败。"
+
+#: src/utils_tools.c:561
+#, c-format
+msgid "Device %s is in use. Can not proceed with format operation."
+msgstr ""
+
+#: src/utils_tools.c:563
+#, fuzzy, c-format
+msgid "Failed to open file %s in read/write mode."
+msgstr "无法打开密钥文件 %s 以供写入。"
+
+#: src/utils_tools.c:577
+#, c-format
+msgid "Existing '%s' partition signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:580
+#, c-format
+msgid "Existing '%s' superblock signature (offset: %<PRIi64> bytes) on device %s will be wiped."
+msgstr ""
+
+#: src/utils_tools.c:583
+#, fuzzy
+msgid "Failed to wipe device signature."
+msgstr "无法获取写入设备锁。"
+
+#: src/utils_tools.c:590
+#, c-format
+msgid "Failed to probe device %s for a signature."
+msgstr ""
+
+#: src/utils_tools.c:629
+#, fuzzy
+msgid ""
+"\n"
+"Reencryption interrupted."
+msgstr "测试密文"
+
+#: src/utils_password.c:43 src/utils_password.c:75
+#, c-format
+msgid "Cannot check password quality: %s"
+msgstr "无法检查密码质量:%s"
+
+#: src/utils_password.c:51
+#, c-format
+msgid ""
+"Password quality check failed:\n"
+" %s"
+msgstr ""
+"密码质量检查失败:\n"
+" %s"
+
+#: src/utils_password.c:83
+#, c-format
+msgid "Password quality check failed: Bad passphrase (%s)"
+msgstr "密码质量检查失败:无效密码 (%s)"
+
+#: src/utils_password.c:193 src/utils_password.c:208
+msgid "Error reading passphrase from terminal."
+msgstr "从终端读取口令时出错。"
+
+#: src/utils_password.c:206
+msgid "Verify passphrase: "
+msgstr "确认密码:"
+
+#: src/utils_password.c:213
+msgid "Passphrases do not match."
+msgstr "口令不匹配。"
+
+#: src/utils_password.c:250
+msgid "Cannot use offset with terminal input."
+msgstr "不能将偏移量用于终端输入。"
+
+#: src/utils_password.c:253
+#, c-format
+msgid "Enter passphrase: "
+msgstr "输入口令:"
+
+#: src/utils_password.c:256
+#, c-format
+msgid "Enter passphrase for %s: "
+msgstr "输入 %s 的口令:"
+
+#: src/utils_password.c:287
+msgid "No key available with this passphrase."
+msgstr "此口令无可用的密钥。"
+
+#: src/utils_password.c:289
+msgid "No usable keyslot is available."
+msgstr ""
+
+#: src/utils_password.c:328
+#, c-format
+msgid "Cannot open keyfile %s for write."
+msgstr "无法打开密钥文件 %s 以供写入。"
+
+#: src/utils_password.c:335
+#, c-format
+msgid "Cannot write to keyfile %s."
+msgstr "无法写入密钥文件 %s。"
+
+#: src/utils_luks2.c:47
+#, fuzzy, c-format
+msgid "Failed to open file %s in read-only mode."
+msgstr "打开 (open) 密钥文件失败。"
+
+#: src/utils_luks2.c:60
+msgid "Provide valid LUKS2 token JSON:\n"
+msgstr ""
+
+#: src/utils_luks2.c:67
+#, fuzzy
+msgid "Failed to read JSON file."
+msgstr "打开 (open) 密钥文件失败。"
+
+#: src/utils_luks2.c:72
+#, fuzzy
+msgid ""
+"\n"
+"Read interrupted."
+msgstr "测试密文"
+
+#: src/utils_luks2.c:113
+#, fuzzy, c-format
+msgid "Failed to open file %s in write mode."
+msgstr "无法打开密钥文件 %s 以供写入。"
+
+#: src/utils_luks2.c:122
+#, fuzzy
+msgid ""
+"\n"
+"Write interrupted."
+msgstr "测试密文"
+
+#: src/utils_luks2.c:126
+#, fuzzy
+msgid "Failed to write JSON file."
+msgstr "打开 (open) 密钥文件失败。"
+
+#~ msgid "Cannot format device %s which is still in use."
+#~ msgstr "无法格式化正在使用的设备 %s。"
+
+#~ msgid "Replaced with key slot %d."
+#~ msgstr "替换为密钥槽 %d。"
+
+#~ msgid "Key slot %d is not used."
+#~ msgstr "密钥槽 %d 未使用。"
+
+#~ msgid "Function not available in FIPS mode."
+#~ msgstr "功能在 FIPS 模式无效。"
+
+#~ msgid "Device %s is too small. (LUKS2 requires at least %<PRIu64> bytes.)"
+#~ msgstr "设备 %s 过小。(LUKS2 需要至少 %<PRIu64> 字节。)"
+
+#~ msgid "Key slot %d selected for deletion."
+#~ msgstr "已选中密钥槽 %d 以供删除。"
+
+#~ msgid "open device as mapping <name>"
+#~ msgstr "以映射 <名称> 打开设备"
+
+#~ msgid "Unsupported encryption sector size.\n"
+#~ msgstr "不支持的加密扇区大小。\n"
+
+#, fuzzy
+#~| msgid "close device (remove mapping)"
+#~ msgid "close device (deactivate and remove mapping)"
+#~ msgstr "关闭设备(移除映射)"
+
+# stat() 主要就是出来一个各种文件信息……
+#~ msgid "Failed to set PBKDF parameters."
+#~ msgstr "设置 pbkdf 参数失败。"
+
+#~ msgid "Activated keyslot %i."
+#~ msgstr "已激活密钥槽 %i。"
+
+#~ msgid "Cannot seek to device offset.\n"
+#~ msgstr "无法寻找到设备偏移位置。\n"
+
+#~ msgid "Interrupted by a signal."
+#~ msgstr "被信号中断。"
+
+#~ msgid "memory allocation error in action_luksFormat"
+#~ msgstr "在 action_luksFormat 中发生内存分配错误"
+
+#, fuzzy
+#~| msgid "Key slot is invalid."
+#~ msgid "Key slot is invalid.\n"
+#~ msgstr "密钥槽无效。"
+
+#~ msgid "Cannot find a free loopback device.\n"
+#~ msgstr "找不到空闲的回环设备。\n"
+
+#~ msgid "Too many tree levels for verity volume.\n"
+#~ msgstr "VERITY 卷上的目录树层级过多。\n"
+
+#~ msgid "Key %d not active. Can't wipe.\n"
+#~ msgstr "无法清除未激活的密钥 %d。\n"
+
+#~ msgid "<name> <data_device> <hash_device> <root_hash>"
+#~ msgstr "<名称> <数据设备> <哈希设备> <根哈希值>"
+
+#~ msgid "create active device"
+#~ msgstr "创建已激活的设备"
+
+#~ msgid "remove (deactivate) device"
+#~ msgstr "移除(禁用)设备"
+
+#~ msgid "Cannot open device %s\n"
+#~ msgstr "无法打开设备 %s。\n"
+
+#~ msgid "Marking LUKS device %s usable.\n"
+#~ msgstr "正将 LUKS 设备 %s 标为可用。\n"
+
+#~ msgid "Progress: %5.1f%%, ETA %02llu:%02llu, %4llu MiB written, speed %5.1f MiB/s%s"
+#~ msgstr "进度:%5.1f%%, 生育 %02llu:%02llu, %4llu MiB 已写入, 速度 %5.1f MiB/s%s"
+
+#~ msgid "WARNING: this is experimental code, it can completely break your data.\n"
+#~ msgstr "警告:此为实验性代码,实验性代码可能完全损毁你的数据。\n"
diff --git a/python/Makefile.am b/python/Makefile.am
deleted file mode 100644 (file)
index ab61082..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-AM_CPPFLAGS = -include $(top_srcdir)/config.h -I$(top_srcdir)/lib $(PYTHON_INCLUDES)
-EXTRA_DIST = pycryptsetup-test.py
-CLEANFILES = *.img
-
-if PYTHON_CRYPTSETUP
-TESTS = pycryptsetup-test.py
-
-pyexec_LTLIBRARIES = pycryptsetup.la
-
-pycryptsetup_la_SOURCES = pycryptsetup.c
-pycryptsetup_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) -fno-strict-aliasing
-pycryptsetup_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
-pycryptsetup_la_LIBADD = $(top_builddir)/lib/libcryptsetup.la $(PYTHON_LIBS)
-else
-all:
-endif
diff --git a/python/Makefile.in b/python/Makefile.in
deleted file mode 100644 (file)
index 05c183a..0000000
+++ /dev/null
@@ -1,825 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = python
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(pyexecdir)"
-LTLIBRARIES = $(pyexec_LTLIBRARIES)
-am__DEPENDENCIES_1 =
-@PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_DEPENDENCIES =  \
-@PYTHON_CRYPTSETUP_TRUE@       $(top_builddir)/lib/libcryptsetup.la \
-@PYTHON_CRYPTSETUP_TRUE@       $(am__DEPENDENCIES_1)
-am__pycryptsetup_la_SOURCES_DIST = pycryptsetup.c
-@PYTHON_CRYPTSETUP_TRUE@am_pycryptsetup_la_OBJECTS =  \
-@PYTHON_CRYPTSETUP_TRUE@       pycryptsetup_la-pycryptsetup.lo
-pycryptsetup_la_OBJECTS = $(am_pycryptsetup_la_OBJECTS)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-pycryptsetup_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(AM_CFLAGS) $(CFLAGS) $(pycryptsetup_la_LDFLAGS) $(LDFLAGS) \
-       -o $@
-@PYTHON_CRYPTSETUP_TRUE@am_pycryptsetup_la_rpath = -rpath $(pyexecdir)
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(pycryptsetup_la_SOURCES)
-DIST_SOURCES = $(am__pycryptsetup_la_SOURCES_DIST)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-am__tty_colors_dummy = \
-  mgn= red= grn= lgn= blu= brg= std=; \
-  am__color_tests=no
-am__tty_colors = { \
-  $(am__tty_colors_dummy); \
-  if test "X$(AM_COLOR_TESTS)" = Xno; then \
-    am__color_tests=no; \
-  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
-    am__color_tests=yes; \
-  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
-    am__color_tests=yes; \
-  fi; \
-  if test $$am__color_tests = yes; then \
-    red='\e[0;31m'; \
-    grn='\e[0;32m'; \
-    lgn='\e[1;32m'; \
-    blu='\e[1;34m'; \
-    mgn='\e[0;35m'; \
-    brg='\e[1m'; \
-    std='\e[m'; \
-  fi; \
-}
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -include $(top_srcdir)/config.h -I$(top_srcdir)/lib $(PYTHON_INCLUDES)
-EXTRA_DIST = pycryptsetup-test.py
-CLEANFILES = *.img
-@PYTHON_CRYPTSETUP_TRUE@TESTS = pycryptsetup-test.py
-@PYTHON_CRYPTSETUP_TRUE@pyexec_LTLIBRARIES = pycryptsetup.la
-@PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_SOURCES = pycryptsetup.c
-@PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) -fno-strict-aliasing
-@PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
-@PYTHON_CRYPTSETUP_TRUE@pycryptsetup_la_LIBADD = $(top_builddir)/lib/libcryptsetup.la $(PYTHON_LIBS)
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu python/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES)
-       @$(NORMAL_INSTALL)
-       @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \
-       list2=; for p in $$list; do \
-         if test -f $$p; then \
-           list2="$$list2 $$p"; \
-         else :; fi; \
-       done; \
-       test -z "$$list2" || { \
-         echo " $(MKDIR_P) '$(DESTDIR)$(pyexecdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" || exit 1; \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyexecdir)'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyexecdir)"; \
-       }
-
-uninstall-pyexecLTLIBRARIES:
-       @$(NORMAL_UNINSTALL)
-       @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \
-       for p in $$list; do \
-         $(am__strip_dir) \
-         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyexecdir)/$$f'"; \
-         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyexecdir)/$$f"; \
-       done
-
-clean-pyexecLTLIBRARIES:
-       -test -z "$(pyexec_LTLIBRARIES)" || rm -f $(pyexec_LTLIBRARIES)
-       @list='$(pyexec_LTLIBRARIES)'; \
-       locs=`for p in $$list; do echo $$p; done | \
-             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-             sort -u`; \
-       test -z "$$locs" || { \
-         echo rm -f $${locs}; \
-         rm -f $${locs}; \
-       }
-
-pycryptsetup.la: $(pycryptsetup_la_OBJECTS) $(pycryptsetup_la_DEPENDENCIES) $(EXTRA_pycryptsetup_la_DEPENDENCIES) 
-       $(AM_V_CCLD)$(pycryptsetup_la_LINK) $(am_pycryptsetup_la_rpath) $(pycryptsetup_la_OBJECTS) $(pycryptsetup_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pycryptsetup_la-pycryptsetup.Plo@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-pycryptsetup_la-pycryptsetup.lo: pycryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pycryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pycryptsetup_la-pycryptsetup.lo -MD -MP -MF $(DEPDIR)/pycryptsetup_la-pycryptsetup.Tpo -c -o pycryptsetup_la-pycryptsetup.lo `test -f 'pycryptsetup.c' || echo '$(srcdir)/'`pycryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/pycryptsetup_la-pycryptsetup.Tpo $(DEPDIR)/pycryptsetup_la-pycryptsetup.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='pycryptsetup.c' object='pycryptsetup_la-pycryptsetup.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pycryptsetup_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pycryptsetup_la-pycryptsetup.lo `test -f 'pycryptsetup.c' || echo '$(srcdir)/'`pycryptsetup.c
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-check-TESTS: $(TESTS)
-       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
-       srcdir=$(srcdir); export srcdir; \
-       list=' $(TESTS) '; \
-       $(am__tty_colors); \
-       if test -n "$$list"; then \
-         for tst in $$list; do \
-           if test -f ./$$tst; then dir=./; \
-           elif test -f $$tst; then dir=; \
-           else dir="$(srcdir)/"; fi; \
-           if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *[\ \     ]$$tst[\ \      ]*) \
-               xpass=`expr $$xpass + 1`; \
-               failed=`expr $$failed + 1`; \
-               col=$$red; res=XPASS; \
-             ;; \
-             *) \
-               col=$$grn; res=PASS; \
-             ;; \
-             esac; \
-           elif test $$? -ne 77; then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *[\ \     ]$$tst[\ \      ]*) \
-               xfail=`expr $$xfail + 1`; \
-               col=$$lgn; res=XFAIL; \
-             ;; \
-             *) \
-               failed=`expr $$failed + 1`; \
-               col=$$red; res=FAIL; \
-             ;; \
-             esac; \
-           else \
-             skip=`expr $$skip + 1`; \
-             col=$$blu; res=SKIP; \
-           fi; \
-           echo "$${col}$$res$${std}: $$tst"; \
-         done; \
-         if test "$$all" -eq 1; then \
-           tests="test"; \
-           All=""; \
-         else \
-           tests="tests"; \
-           All="All "; \
-         fi; \
-         if test "$$failed" -eq 0; then \
-           if test "$$xfail" -eq 0; then \
-             banner="$$All$$all $$tests passed"; \
-           else \
-             if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
-             banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
-           fi; \
-         else \
-           if test "$$xpass" -eq 0; then \
-             banner="$$failed of $$all $$tests failed"; \
-           else \
-             if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
-             banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
-           fi; \
-         fi; \
-         dashes="$$banner"; \
-         skipped=""; \
-         if test "$$skip" -ne 0; then \
-           if test "$$skip" -eq 1; then \
-             skipped="($$skip test was not run)"; \
-           else \
-             skipped="($$skip tests were not run)"; \
-           fi; \
-           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$skipped"; \
-         fi; \
-         report=""; \
-         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
-           report="Please report to $(PACKAGE_BUGREPORT)"; \
-           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$report"; \
-         fi; \
-         dashes=`echo "$$dashes" | sed s/./=/g`; \
-         if test "$$failed" -eq 0; then \
-           col="$$grn"; \
-         else \
-           col="$$red"; \
-         fi; \
-         echo "$${col}$$dashes$${std}"; \
-         echo "$${col}$$banner$${std}"; \
-         test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
-         test -z "$$report" || echo "$${col}$$report$${std}"; \
-         echo "$${col}$$dashes$${std}"; \
-         test "$$failed" -eq 0; \
-       else :; fi
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-       for dir in "$(DESTDIR)$(pyexecdir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-pyexecLTLIBRARIES \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-pyexecLTLIBRARIES
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pyexecLTLIBRARIES
-
-.MAKE: check-am install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-       clean-generic clean-libtool clean-pyexecLTLIBRARIES \
-       cscopelist-am ctags ctags-am distclean distclean-compile \
-       distclean-generic distclean-libtool distclean-tags distdir dvi \
-       dvi-am html html-am info info-am install install-am \
-       install-data install-data-am install-dvi install-dvi-am \
-       install-exec install-exec-am install-html install-html-am \
-       install-info install-info-am install-man install-pdf \
-       install-pdf-am install-ps install-ps-am \
-       install-pyexecLTLIBRARIES install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am \
-       uninstall-pyexecLTLIBRARIES
-
-@PYTHON_CRYPTSETUP_FALSE@all:
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/python/pycryptsetup-test.py b/python/pycryptsetup-test.py
deleted file mode 100755 (executable)
index c57348b..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/usr/bin/python
-#
-# Python bindings to libcryptsetup test
-#
-# Copyright (C) 2011-2014, Red Hat, Inc. All rights reserved.
-#
-# This file is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This file is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this file; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-from __future__ import print_function
-
-import sys
-import os
-
-sys.path.insert(0, ".libs")
-import pycryptsetup
-
-IMG = "test.img"
-PASSWORD = "password"
-PASSWORD2 = "password2"
-DEVICE = "pycryptsetup_test_dev"
-
-def log(level, txt):
-    if level == pycryptsetup.CRYPT_LOG_ERROR:
-        print(txt,end="")
-    return
-
-def askyes(txt):
-    print("Question:", txt)
-    return 1
-
-def askpassword(txt):
-    return PASSWORD
-
-def print_status(c):
-    r = c.status()
-    print("status  :",end="")
-    if r == pycryptsetup.CRYPT_ACTIVE:
-        print("ACTIVE")
-    elif r == pycryptsetup.CRYPT_INACTIVE:
-        print("INACTIVE")
-    else:
-       print("ERROR")
-    return
-
-if os.geteuid() != 0:
-       print("WARNING: You must be root to run this test, test skipped.")
-       sys.exit(0)
-
-os.system("dd if=/dev/zero of=" + IMG + " bs=1M count=32 >/dev/null 2>&1")
-
-c = pycryptsetup.CryptSetup(
-        device = IMG,
-        name = DEVICE,
-        yesDialog = askyes,
-        logFunc = log,
-        passwordDialog = askpassword)
-
-#c.debugLevel(pycryptsetup.CRYPT_DEBUG_ALL);
-c.debugLevel(pycryptsetup.CRYPT_DEBUG_NONE);
-c.iterationTime(1)
-r =  c.isLuks()
-print("isLuks  :", r)
-c.askyes(message = "Is there anybody out there?")
-c.log(priority = pycryptsetup.CRYPT_LOG_ERROR, message = "Nobody there...\n")
-c.luksFormat(cipher = "aes", cipherMode= "xts-plain64", keysize = 512)
-print("isLuks  :", c.isLuks())
-print("luksUUID:", c.luksUUID())
-print("addKeyVK:", c.addKeyByVolumeKey(newPassphrase = PASSWORD, slot = 2))
-print("addKeyP :", c.addKeyByPassphrase(passphrase = PASSWORD,
-                                       newPassphrase = PASSWORD2, slot = 3))
-print("removeP :", c.removePassphrase(passphrase = PASSWORD2))
-print("addKeyP :", c.addKeyByPassphrase(PASSWORD, PASSWORD2))
-# original api required wrong passphrase parameter here
-# print "killSlot:", c.killSlot(passphrase = "xxx", slot = 0)
-print("killSlot:", c.killSlot(slot = 0))
-print("activate:", c.activate(name = DEVICE, passphrase = PASSWORD))
-print("suspend :", c.suspend())
-# os.system("dmsetup info -c " + DEVICE)
-print("resume  :", c.resume(passphrase = PASSWORD))
-print_status(c)
-info = c.info()
-print("cipher  :", info["cipher"])
-print("cmode   :", info["cipher_mode"])
-print("keysize :", info["keysize"])
-print("dir     :", info["dir"])
-print("device  :", info["device"])
-print("offset  :", info["offset"])
-print("name    :", info["name"])
-print("uuid    :", info["uuid"])
-# os.system("cryptsetup luksDump " + info["device"])
-print("deact.  :", c.deactivate())
-
-del c
-
-c = pycryptsetup.CryptSetup(
-        device = IMG,
-        name = DEVICE,
-        yesDialog = askyes,
-        logFunc = log,
-        passwordDialog = askpassword)
-
-print("activate:", c.activate(name = DEVICE, passphrase = PASSWORD))
-
-c2 = pycryptsetup.CryptSetup(
-        name = DEVICE,
-        yesDialog = askyes,
-        logFunc = log,
-        passwordDialog = askpassword)
-
-info = c2.info()
-print("cipher  :", info["cipher"])
-print("cmode   :", info["cipher_mode"])
-print("keysize :", info["keysize"])
-
-print("deact.  :", c.deactivate())
-r = c2.deactivate()
-print("deact.  :", r)
-del c
-del c2
-
-os.remove(IMG)
diff --git a/python/pycryptsetup.c b/python/pycryptsetup.c
deleted file mode 100644 (file)
index 6dcda09..0000000
+++ /dev/null
@@ -1,772 +0,0 @@
-/*
- * Python bindings to libcryptsetup
- *
- * Copyright (C) 2009-2014, Red Hat, Inc. All rights reserved.
- * Written by Martin Sivak
- *
- * This file is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This file is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <Python.h>
-#include <structmember.h>
-#include <errno.h>
-
-#include "libcryptsetup.h"
-
-/* Python API use char* where const char* should be used... */
-#define CONST_CAST(x) (x)(uintptr_t)
-
-#if PY_MAJOR_VERSION < 3
-  #define MOD_ERROR_VAL
-  #define MOD_SUCCESS_VAL(val)
-  #define MOD_INIT(name) void init##name(void)
-  #define MOD_DEF(ob, name, doc, methods) \
-          ob = Py_InitModule3(name, methods, doc);
-#else
-  #define PyInt_AsLong PyLong_AsLong
-  #define PyInt_Check PyLong_Check
-  #define MOD_ERROR_VAL NULL
-  #define MOD_SUCCESS_VAL(val) val
-  #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
-  #define MOD_DEF(ob, name, doc, methods) \
-          static struct PyModuleDef moduledef = { \
-            PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \
-          ob = PyModule_Create(&moduledef);
-#endif
-
-MOD_INIT(pycryptsetup);
-
-typedef struct {
-       PyObject_HEAD
-
-       /* Type-specific fields go here. */
-       struct crypt_device *device;
-       char *activated_as;
-
-       /* Callbacks */
-       PyObject *yesDialogCB;
-       PyObject *cmdLineLogCB;
-       PyObject *passwordDialogCB;
-} CryptSetupObject;
-
-static int yesDialog(const char *msg, void *this)
-{
-       CryptSetupObject *self = this;
-       PyObject *result, *arglist;
-       int r;
-
-       if (self->yesDialogCB){
-               arglist = Py_BuildValue("(s)", msg);
-               if (!arglist)
-                       return -ENOMEM;
-
-               result = PyEval_CallObject(self->yesDialogCB, arglist);
-               Py_DECREF(arglist);
-
-               if (!result)
-                       return -EINVAL;
-
-               if (!PyArg_Parse(result, "i", &r))
-                       r = -EINVAL;
-
-               Py_DECREF(result);
-               return r;
-       }
-
-       return 1;
-}
-
-static int passwordDialog(const char *msg, char *buf, size_t length, void *this)
-{
-       CryptSetupObject *self = this;
-       PyObject *result, *arglist;
-       size_t len;
-       char *res = NULL;
-
-       if(self->passwordDialogCB){
-               arglist = Py_BuildValue("(s)", msg);
-               if (!arglist)
-                       return -ENOMEM;
-
-               result = PyEval_CallObject(self->passwordDialogCB, arglist);
-               Py_DECREF(arglist);
-
-               if (!result)
-                       return -EINVAL;
-
-               if (!PyArg_Parse(result, "z", &res)) {
-                       Py_DECREF(result);
-                       return -EINVAL;
-               }
-
-               strncpy(buf, res, length - 1);
-               len = strlen(res);
-
-               memset(res, 0, len);
-               Py_DECREF(result);
-
-               return (int)len;
-       }
-
-       return -EINVAL;
-}
-
-static void cmdLineLog(int cls, const char *msg, void *this)
-{
-       CryptSetupObject *self = this;
-       PyObject *result, *arglist;
-
-       if(self->cmdLineLogCB) {
-               arglist = Py_BuildValue("(is)", cls, msg);
-               if(!arglist)
-                       return;
-
-               result = PyEval_CallObject(self->cmdLineLogCB, arglist);
-               Py_DECREF(arglist);
-               Py_XDECREF(result);
-       }
-}
-
-static void CryptSetup_dealloc(CryptSetupObject* self)
-{
-       /* free the callbacks */
-       Py_XDECREF(self->yesDialogCB);
-       Py_XDECREF(self->cmdLineLogCB);
-       Py_XDECREF(self->passwordDialogCB);
-
-       free(self->activated_as);
-
-       crypt_free(self->device);
-
-       /* free self */
-       Py_TYPE(self)->tp_free((PyObject*)self);
-}
-
-static PyObject *CryptSetup_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-       CryptSetupObject *self = (CryptSetupObject *)type->tp_alloc(type, 0);
-
-       if (self) {
-               self->yesDialogCB = NULL;
-               self->passwordDialogCB = NULL;
-               self->cmdLineLogCB = NULL;
-               self->activated_as = NULL;
-       }
-
-       return (PyObject *)self;
-}
-
-static PyObject *PyObjectResult(int is)
-{
-       PyObject *result = Py_BuildValue("i", is);
-
-       if (!result)
-               PyErr_SetString(PyExc_RuntimeError, "Error during constructing values for return value");
-
-       return result;
-}
-
-static char
-CryptSetup_HELP[] =
-"CryptSetup object\n\n\
-constructor takes one to five arguments:\n\
-  __init__(device, name, yesDialog, passwordDialog, logFunc)\n\n\
-  yesDialog - python function with func(text) signature, \n\
-              which asks the user question text and returns 1\n\
-              of the answer was positive or 0 if not\n\
-  logFunc   - python function with func(level, text) signature to log stuff somewhere";
-
-static int CryptSetup_init(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"device", "name", "yesDialog", "passwordDialog", "logFunc", NULL};
-       PyObject *yesDialogCB = NULL,
-                *passwordDialogCB = NULL,
-                *cmdLineLogCB = NULL,
-                *tmp = NULL;
-       char *device = NULL, *deviceName = NULL;
-       int r;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "|zzOOO", CONST_CAST(char**)kwlist, &device, &deviceName,
-                                        &yesDialogCB, &passwordDialogCB, &cmdLineLogCB))
-               return -1;
-
-       if (device) {
-               if (crypt_init(&(self->device), device)) {
-                       PyErr_SetString(PyExc_IOError, "Device cannot be opened");
-                       return -1;
-               }
-               /* Try to load header form device */
-               r = crypt_load(self->device, NULL, NULL);
-               if (r && r != -EINVAL) {
-                       PyErr_SetString(PyExc_RuntimeError, "Cannot initialize device context");
-                       return -1;
-               }
-       } else if (deviceName) {
-               if (crypt_init_by_name(&(self->device), deviceName)) {
-                       PyErr_SetString(PyExc_IOError, "Device cannot be opened");
-                       return -1;
-               }
-               /* Context is initialized automatically from active device */
-       } else {
-               PyErr_SetString(PyExc_RuntimeError, "Either device file or luks name has to be specified");
-               return -1;
-       }
-
-       if(deviceName)
-               self->activated_as = strdup(deviceName);
-
-       if (yesDialogCB) {
-               tmp = self->yesDialogCB;
-               Py_INCREF(yesDialogCB);
-               self->yesDialogCB = yesDialogCB;
-               Py_XDECREF(tmp);
-               crypt_set_confirm_callback(self->device, yesDialog, self);
-       }
-
-       if (passwordDialogCB) {
-               tmp = self->passwordDialogCB;
-               Py_INCREF(passwordDialogCB);
-               self->passwordDialogCB = passwordDialogCB;
-               Py_XDECREF(tmp);
-               crypt_set_password_callback(self->device, passwordDialog, self);
-       }
-
-       if (cmdLineLogCB) {
-               tmp = self->cmdLineLogCB;
-               Py_INCREF(cmdLineLogCB);
-               self->cmdLineLogCB = cmdLineLogCB;
-               Py_XDECREF(tmp);
-               crypt_set_log_callback(self->device, cmdLineLog, self);
-       }
-
-       return 0;
-}
-
-static char
-CryptSetup_activate_HELP[] =
-"Activate LUKS device\n\n\
-  activate(name)";
-
-static PyObject *CryptSetup_activate(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"name", "passphrase", NULL};
-       char *name = NULL, *passphrase = NULL;
-       int is;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|s", CONST_CAST(char**)kwlist, &name, &passphrase))
-               return NULL;
-
-       // FIXME: allow keyfile and \0 in passphrase
-       is = crypt_activate_by_passphrase(self->device, name, CRYPT_ANY_SLOT,
-                                         passphrase, passphrase ? strlen(passphrase) : 0, 0);
-
-       if (is >= 0) {
-               free(self->activated_as);
-               self->activated_as = strdup(name);
-       }
-
-       return PyObjectResult(is);
-}
-
-static char
-CryptSetup_deactivate_HELP[] =
-"Dectivate LUKS device\n\n\
-  deactivate()";
-
-static PyObject *CryptSetup_deactivate(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       int is = crypt_deactivate(self->device, self->activated_as);
-
-       if (!is) {
-               free(self->activated_as);
-               self->activated_as = NULL;
-       }
-
-       return PyObjectResult(is);
-}
-
-static char
-CryptSetup_askyes_HELP[] =
-"Asks a question using the configured dialog CB\n\n\
-  int askyes(message)";
-
-static PyObject *CryptSetup_askyes(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"message", NULL};
-       PyObject *message = NULL, *result, *arglist;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", CONST_CAST(char**)kwlist, &message))
-               return NULL;
-
-       Py_INCREF(message);
-
-       arglist = Py_BuildValue("(O)", message);
-       if (!arglist){
-               PyErr_SetString(PyExc_RuntimeError, "Error during constructing values for internal call");
-               return NULL;
-       }
-
-       result = PyEval_CallObject(self->yesDialogCB, arglist);
-       Py_DECREF(arglist);
-       Py_DECREF(message);
-
-       return result;
-}
-
-static char
-CryptSetup_log_HELP[] =
-"Logs a string using the configured log CB\n\n\
-  log(int level, message)";
-
-static PyObject *CryptSetup_log(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"priority", "message", NULL};
-       PyObject *message = NULL, *priority = NULL, *result, *arglist;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO", CONST_CAST(char**)kwlist, &message, &priority))
-               return NULL;
-
-       Py_INCREF(message);
-       Py_INCREF(priority);
-
-       arglist = Py_BuildValue("(OO)", message, priority);
-       if (!arglist){
-               PyErr_SetString(PyExc_RuntimeError, "Error during constructing values for internal call");
-               return NULL;
-       }
-
-       result = PyEval_CallObject(self->cmdLineLogCB, arglist);
-       Py_DECREF(arglist);
-       Py_DECREF(priority);
-       Py_DECREF(message);
-
-       return result;
-}
-
-static char
-CryptSetup_luksUUID_HELP[] =
-"Get UUID of the LUKS device\n\n\
-  luksUUID()";
-
-static PyObject *CryptSetup_luksUUID(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       PyObject *result;
-
-       result = Py_BuildValue("s", crypt_get_uuid(self->device));
-       if (!result)
-               PyErr_SetString(PyExc_RuntimeError, "Error during constructing values for return value");
-
-       return result;
-}
-
-static char
-CryptSetup_isLuks_HELP[] =
-"Is the device LUKS?\n\n\
-  isLuks()";
-
-static PyObject *CryptSetup_isLuks(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       return PyObjectResult(crypt_load(self->device, CRYPT_LUKS1, NULL));
-}
-
-static char
-CryptSetup_Info_HELP[] =
-"Returns dictionary with info about opened device\nKeys:\n\
-  dir\n  name\n  uuid\n  cipher\n  cipher_mode\n  keysize\n  device\n\
-  offset\n  size\n  skip\n  mode\n";
-
-static PyObject *CryptSetup_Info(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       PyObject *result;
-
-       result = Py_BuildValue("{s:s,s:s,s:z,s:s,s:s,s:s,s:i,s:K}",
-                               "dir",          crypt_get_dir(),
-                               "device",       crypt_get_device_name(self->device),
-                               "name",         self->activated_as,
-                               "uuid",         crypt_get_uuid(self->device),
-                               "cipher",       crypt_get_cipher(self->device),
-                               "cipher_mode",  crypt_get_cipher_mode(self->device),
-                               "keysize",      crypt_get_volume_key_size(self->device) * 8,
-                               //"size",       co.size,
-                               //"mode",       (co.flags & CRYPT_FLAG_READONLY) ? "readonly" : "read/write",
-                               "offset",       crypt_get_data_offset(self->device)
-                               );
-
-       if (!result)
-               PyErr_SetString(PyExc_RuntimeError, "Error during constructing values for return value");
-
-       return result;
-}
-
-static char
-CryptSetup_luksFormat_HELP[] =
-"Format device to enable LUKS\n\n\
-  luksFormat(cipher = 'aes', cipherMode = 'cbc-essiv:sha256', keysize = 256)\n\n\
-  cipher - cipher specification, e.g. aes, serpent\n\
-  cipherMode - cipher mode specification, e.g. cbc-essiv:sha256, xts-plain64\n\
-  keysize - key size in bits";
-
-static PyObject *CryptSetup_luksFormat(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"cipher", "cipherMode", "keysize", NULL};
-       char *cipher_mode = NULL, *cipher = NULL;
-       int keysize = 256;
-       PyObject *keysize_object = NULL;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "|zzO", CONST_CAST(char**)kwlist,
-                                       &cipher, &cipher_mode, &keysize_object))
-               return NULL;
-
-       if (!keysize_object || keysize_object == Py_None) {
-               /* use default value */
-       } else if (!PyInt_Check(keysize_object)) {
-               PyErr_SetString(PyExc_TypeError, "keysize must be an integer");
-               return NULL;
-       } else if (PyInt_AsLong(keysize_object) % 8) {
-               PyErr_SetString(PyExc_TypeError, "keysize must have integer value dividable by 8");
-               return NULL;
-       } else if (PyInt_AsLong(keysize_object) <= 0) {
-               PyErr_SetString(PyExc_TypeError, "keysize must be positive number bigger than 0");
-               return NULL;
-       } else
-               keysize = PyInt_AsLong(keysize_object);
-
-       // FIXME use #defined defaults
-       return PyObjectResult(crypt_format(self->device, CRYPT_LUKS1,
-                               cipher ?: "aes", cipher_mode ?: "cbc-essiv:sha256",
-                               NULL, NULL, keysize / 8, NULL));
-}
-
-static char
-CryptSetup_addKeyByPassphrase_HELP[] =
-"Initialize keyslot using passphrase\n\n\
-  addKeyByPassphrase(passphrase, newPassphrase, slot)\n\n\
-  passphrase - string or none to ask the user\n\
-  newPassphrase - passphrase to add\n\
-  slot - which slot to use (optional)";
-
-static PyObject *CryptSetup_addKeyByPassphrase(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"passphrase", "newPassphrase", "slot", NULL};
-       char *passphrase = NULL, *newpassphrase = NULL;
-       size_t passphrase_len = 0, newpassphrase_len = 0;
-       int slot = CRYPT_ANY_SLOT;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|i", CONST_CAST(char**)kwlist, &passphrase, &newpassphrase, &slot))
-               return NULL;
-
-       if(passphrase)
-               passphrase_len = strlen(passphrase);
-
-       if(newpassphrase)
-               newpassphrase_len = strlen(newpassphrase);
-
-       return PyObjectResult(crypt_keyslot_add_by_passphrase(self->device, slot,
-                                       passphrase, passphrase_len,
-                                       newpassphrase, newpassphrase_len));
-}
-
-static char
-CryptSetup_addKeyByVolumeKey_HELP[] =
-"Initialize keyslot using cached volume key\n\n\
-  addKeyByVolumeKey(passphrase, newPassphrase, slot)\n\n\
-  newPassphrase - passphrase to add\n\
-  slot - which slot to use (optional)";
-
-static PyObject *CryptSetup_addKeyByVolumeKey(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"newPassphrase", "slot", NULL};
-       char *newpassphrase = NULL;
-       size_t newpassphrase_len = 0;
-       int slot = CRYPT_ANY_SLOT;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|i", CONST_CAST(char**)kwlist, &newpassphrase, &slot))
-               return NULL;
-
-       if (newpassphrase)
-               newpassphrase_len = strlen(newpassphrase);
-
-       return PyObjectResult(crypt_keyslot_add_by_volume_key(self->device, slot,
-                                       NULL, 0, newpassphrase, newpassphrase_len));
-}
-
-static char
-CryptSetup_removePassphrase_HELP[] =
-"Destroy keyslot using passphrase\n\n\
-  removePassphrase(passphrase)\n\n\
-  passphrase - string or none to ask the user";
-
-static PyObject *CryptSetup_removePassphrase(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"passphrase", NULL};
-       char *passphrase = NULL;
-       size_t passphrase_len = 0;
-       int is;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", CONST_CAST(char**)kwlist, &passphrase))
-               return NULL;
-
-       if (passphrase)
-               passphrase_len = strlen(passphrase);
-
-       is = crypt_activate_by_passphrase(self->device, NULL, CRYPT_ANY_SLOT,
-                                         passphrase, passphrase_len, 0);
-       if (is < 0)
-               return PyObjectResult(is);
-
-       return PyObjectResult(crypt_keyslot_destroy(self->device, is));
-}
-
-static char
-CryptSetup_killSlot_HELP[] =
-"Destroy keyslot\n\n\
-  killSlot(slot)\n\n\
-  slot - the slot to remove";
-
-static PyObject *CryptSetup_killSlot(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"slot", NULL};
-       int slot = CRYPT_ANY_SLOT;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", CONST_CAST(char**)kwlist, &slot))
-               return NULL;
-
-       switch (crypt_keyslot_status(self->device, slot)) {
-       case CRYPT_SLOT_ACTIVE:
-               return PyObjectResult(crypt_keyslot_destroy(self->device, slot));
-       case CRYPT_SLOT_ACTIVE_LAST:
-               PyErr_SetString(PyExc_ValueError, "Last slot, removing it would render the device unusable");
-               break;
-       case CRYPT_SLOT_INACTIVE:
-               PyErr_SetString(PyExc_ValueError, "Inactive slot");
-               break;
-       case CRYPT_SLOT_INVALID:
-               PyErr_SetString(PyExc_ValueError, "Invalid slot");
-               break;
-       }
-
-       return NULL;
-}
-
-static char
-CryptSetup_Status_HELP[] =
-"Status of LUKS device\n\n\
-  luksStatus()";
-
-static PyObject *CryptSetup_Status(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       if (!self->activated_as){
-               PyErr_SetString(PyExc_IOError, "Device has not been activated yet.");
-               return NULL;
-       }
-
-       return PyObjectResult(crypt_status(self->device, self->activated_as));
-}
-
-static char
-CryptSetup_Resume_HELP[] =
-"Resume LUKS device\n\n\
-  luksOpen(passphrase)\n\n\
-  passphrase - string or none to ask the user";
-
-static PyObject *CryptSetup_Resume(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"passphrase", NULL};
-       char* passphrase = NULL;
-       size_t passphrase_len = 0;
-
-       if (!self->activated_as){
-               PyErr_SetString(PyExc_IOError, "Device has not been activated yet.");
-               return NULL;
-       }
-
-       if (! PyArg_ParseTupleAndKeywords(args, kwds, "|s", CONST_CAST(char**)kwlist, &passphrase))
-               return NULL;
-
-       if (passphrase)
-               passphrase_len = strlen(passphrase);
-
-       return PyObjectResult(crypt_resume_by_passphrase(self->device, self->activated_as,
-                                       CRYPT_ANY_SLOT, passphrase, passphrase_len));
-}
-
-static char
-CryptSetup_Suspend_HELP[] =
-"Suspend LUKS device\n\n\
-  luksSupsend()";
-
-static PyObject *CryptSetup_Suspend(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       if (!self->activated_as){
-               PyErr_SetString(PyExc_IOError, "Device has not been activated yet.");
-               return NULL;
-       }
-
-       return PyObjectResult(crypt_suspend(self->device, self->activated_as));
-}
-
-static char
-CryptSetup_debugLevel_HELP[] =
-"Set debug level\n\n\
-  debugLevel(level)\n\n\
-  level - debug level";
-
-static PyObject *CryptSetup_debugLevel(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"level", NULL};
-       int level = 0;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", CONST_CAST(char**)kwlist, &level))
-               return NULL;
-
-       crypt_set_debug_level(level);
-
-       Py_RETURN_NONE;
-}
-
-static char
-CryptSetup_iterationTime_HELP[] =
-"Set iteration time\n\n\
-  iterationTime(time_ms)\n\n\
-  time_ms - time in miliseconds";
-
-static PyObject *CryptSetup_iterationTime(CryptSetupObject* self, PyObject *args, PyObject *kwds)
-{
-       static const char *kwlist[] = {"time_ms", NULL};
-       uint64_t time_ms = 0;
-
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "K", CONST_CAST(char**)kwlist, &time_ms))
-               return NULL;
-
-       crypt_set_iteration_time(self->device, time_ms);
-
-       Py_RETURN_NONE;
-}
-
-static PyMemberDef CryptSetup_members[] = {
-       {CONST_CAST(char*)"yesDialogCB", T_OBJECT_EX, offsetof(CryptSetupObject, yesDialogCB), 0, CONST_CAST(char*)"confirmation dialog callback"},
-       {CONST_CAST(char*)"cmdLineLogCB", T_OBJECT_EX, offsetof(CryptSetupObject, cmdLineLogCB), 0, CONST_CAST(char*)"logging callback"},
-       {CONST_CAST(char*)"passwordDialogCB", T_OBJECT_EX, offsetof(CryptSetupObject, passwordDialogCB), 0, CONST_CAST(char*)"password dialog callback"},
-       {NULL}
-};
-
-static PyMethodDef CryptSetup_methods[] = {
-       /* self-test methods */
-       {"log", (PyCFunction)CryptSetup_log, METH_VARARGS|METH_KEYWORDS, CryptSetup_askyes_HELP},
-       {"askyes", (PyCFunction)CryptSetup_askyes, METH_VARARGS|METH_KEYWORDS, CryptSetup_log_HELP},
-
-       /* activation and deactivation */
-       {"deactivate", (PyCFunction)CryptSetup_deactivate, METH_NOARGS, CryptSetup_deactivate_HELP},
-       {"activate", (PyCFunction)CryptSetup_activate, METH_VARARGS|METH_KEYWORDS, CryptSetup_activate_HELP},
-
-       /* cryptsetup info entrypoints */
-       {"luksUUID", (PyCFunction)CryptSetup_luksUUID, METH_NOARGS, CryptSetup_luksUUID_HELP},
-       {"isLuks", (PyCFunction)CryptSetup_isLuks, METH_NOARGS, CryptSetup_isLuks_HELP},
-       {"info", (PyCFunction)CryptSetup_Info, METH_NOARGS, CryptSetup_Info_HELP},
-       {"status", (PyCFunction)CryptSetup_Status, METH_NOARGS, CryptSetup_Status_HELP},
-
-       /* cryptsetup mgmt entrypoints */
-       {"luksFormat", (PyCFunction)CryptSetup_luksFormat, METH_VARARGS|METH_KEYWORDS, CryptSetup_luksFormat_HELP},
-       {"addKeyByPassphrase", (PyCFunction)CryptSetup_addKeyByPassphrase, METH_VARARGS|METH_KEYWORDS, CryptSetup_addKeyByPassphrase_HELP},
-       {"addKeyByVolumeKey", (PyCFunction)CryptSetup_addKeyByVolumeKey, METH_VARARGS|METH_KEYWORDS, CryptSetup_addKeyByVolumeKey_HELP},
-       {"removePassphrase", (PyCFunction)CryptSetup_removePassphrase, METH_VARARGS|METH_KEYWORDS, CryptSetup_removePassphrase_HELP},
-       {"killSlot", (PyCFunction)CryptSetup_killSlot, METH_VARARGS|METH_KEYWORDS, CryptSetup_killSlot_HELP},
-
-       /* suspend resume */
-       {"resume", (PyCFunction)CryptSetup_Resume, METH_VARARGS|METH_KEYWORDS, CryptSetup_Resume_HELP},
-       {"suspend", (PyCFunction)CryptSetup_Suspend, METH_NOARGS, CryptSetup_Suspend_HELP},
-
-       /* misc */
-       {"debugLevel", (PyCFunction)CryptSetup_debugLevel, METH_VARARGS|METH_KEYWORDS, CryptSetup_debugLevel_HELP},
-       {"iterationTime", (PyCFunction)CryptSetup_iterationTime, METH_VARARGS|METH_KEYWORDS, CryptSetup_iterationTime_HELP},
-
-       {NULL} /* Sentinel */
-};
-
-static PyTypeObject CryptSetupType = {
-       PyVarObject_HEAD_INIT(NULL, 0)
-       "pycryptsetup.CryptSetup", /*tp_name*/
-       sizeof(CryptSetupObject), /*tp_basicsize*/
-       0, /*tp_itemsize*/
-       (destructor)CryptSetup_dealloc, /*tp_dealloc*/
-       0, /*tp_print*/
-       0, /*tp_getattr*/
-       0, /*tp_setattr*/
-       0, /*tp_compare*/
-       0, /*tp_repr*/
-       0, /*tp_as_number*/
-       0, /*tp_as_sequence*/
-       0, /*tp_as_mapping*/
-       0, /*tp_hash */
-       0, /*tp_call*/
-       0, /*tp_str*/
-       0, /*tp_getattro*/
-       0, /*tp_setattro*/
-       0, /*tp_as_buffer*/
-       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-       CryptSetup_HELP, /* tp_doc */
-       0, /* tp_traverse */
-       0, /* tp_clear */
-       0, /* tp_richcompare */
-       0, /* tp_weaklistoffset */
-       0, /* tp_iter */
-       0, /* tp_iternext */
-       CryptSetup_methods, /* tp_methods */
-       CryptSetup_members, /* tp_members */
-       0, /* tp_getset */
-       0, /* tp_base */
-       0, /* tp_dict */
-       0, /* tp_descr_get */
-       0, /* tp_descr_set */
-       0, /* tp_dictoffset */
-       (initproc)CryptSetup_init, /* tp_init */
-       0, /* tp_alloc */
-       CryptSetup_new, /* tp_new */
-};
-
-static PyMethodDef pycryptsetup_methods[] = {
-       {NULL} /* Sentinel */
-};
-
-MOD_INIT(pycryptsetup)
-{
-       PyObject *m;
-
-       if (PyType_Ready(&CryptSetupType) < 0)
-               return MOD_ERROR_VAL;
-
-       MOD_DEF(m, "pycryptsetup", "CryptSetup pythonized API.", pycryptsetup_methods);
-       Py_INCREF(&CryptSetupType);
-
-       PyModule_AddObject(m, "CryptSetup", (PyObject *)&CryptSetupType);
-
-       /* debug constants */
-       PyModule_AddIntConstant(m, "CRYPT_DEBUG_ALL", CRYPT_DEBUG_ALL);
-       PyModule_AddIntConstant(m, "CRYPT_DEBUG_NONE", CRYPT_DEBUG_NONE);
-
-       /* log constants */
-       PyModule_AddIntConstant(m, "CRYPT_LOG_NORMAL", CRYPT_LOG_NORMAL);
-       PyModule_AddIntConstant(m, "CRYPT_LOG_ERROR", CRYPT_LOG_ERROR);
-       PyModule_AddIntConstant(m, "CRYPT_LOG_VERBOSE", CRYPT_LOG_VERBOSE);
-       PyModule_AddIntConstant(m, "CRYPT_LOG_DEBUG", CRYPT_LOG_DEBUG);
-
-       /* status constants */
-       PyModule_AddIntConstant(m, "CRYPT_INVALID", CRYPT_INVALID);
-       PyModule_AddIntConstant(m, "CRYPT_INACTIVE", CRYPT_INACTIVE);
-       PyModule_AddIntConstant(m, "CRYPT_ACTIVE", CRYPT_ACTIVE);
-       PyModule_AddIntConstant(m, "CRYPT_BUSY", CRYPT_BUSY);
-
-       return MOD_SUCCESS_VAL(m);
-}
diff --git a/scripts/Makemodule.am b/scripts/Makemodule.am
new file mode 100644 (file)
index 0000000..5bf6ddf
--- /dev/null
@@ -0,0 +1,5 @@
+DISTCLEAN_TARGETS += scripts/cryptsetup.conf
+
+if CRYPTSETUP_TMPFILE
+tmpfilesd_DATA += scripts/cryptsetup.conf
+endif
diff --git a/scripts/cryptsetup.conf.in b/scripts/cryptsetup.conf.in
new file mode 100644 (file)
index 0000000..8bbc5af
--- /dev/null
@@ -0,0 +1 @@
+d @DEFAULT_LUKS2_LOCK_PATH@ @DEFAULT_LUKS2_LOCK_DIR_PERMS@ root root -
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644 (file)
index ee0c814..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-AM_CPPFLAGS = -include config.h \
-       -I$(top_srcdir)                         \
-       -I$(top_srcdir)/lib                     \
-       -DDATADIR=\""$(datadir)"\"              \
-       -DLOCALEDIR=\""$(datadir)/locale"\"     \
-       -DLIBDIR=\""$(libdir)"\"                \
-       -DPREFIX=\""$(prefix)"\"                \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"        \
-       -DVERSION=\""$(VERSION)"\"
-
-# cryptsetup
-cryptsetup_SOURCES = \
-       $(top_builddir)/lib/utils_crypt.c       \
-       $(top_builddir)/lib/utils_loop.c        \
-       $(top_builddir)/lib/utils_fips.c        \
-       utils_tools.c                           \
-       utils_password.c                        \
-       cryptsetup.c                            \
-       cryptsetup.h
-
-cryptsetup_LDADD = \
-       $(top_builddir)/lib/libcryptsetup.la    \
-       @POPT_LIBS@                             \
-       @PWQUALITY_LIBS@
-
-cryptsetup_CFLAGS = $(AM_CFLAGS) -Wall
-
-sbin_PROGRAMS=cryptsetup
-
-if STATIC_TOOLS
-sbin_PROGRAMS += cryptsetup.static
-cryptsetup_static_SOURCES = $(cryptsetup_SOURCES)
-cryptsetup_static_CFLAGS = $(cryptsetup_CFLAGS)
-cryptsetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
-cryptsetup_static_LDADD = $(cryptsetup_LDADD)  \
-       @CRYPTO_STATIC_LIBS@                    \
-       @PWQUALITY_STATIC_LIBS@                 \
-       @DEVMAPPER_STATIC_LIBS@                 \
-       @UUID_LIBS@
-endif
-
-# veritysetup
-if VERITYSETUP
-
-veritysetup_SOURCES = \
-       $(top_builddir)/lib/utils_crypt.c       \
-       $(top_builddir)/lib/utils_loop.c        \
-       utils_tools.c                           \
-       veritysetup.c                           \
-       cryptsetup.h
-
-veritysetup_LDADD = \
-       $(top_builddir)/lib/libcryptsetup.la    \
-       @POPT_LIBS@
-
-veritysetup_CFLAGS = $(cryptsetup_CFLAGS)
-
-sbin_PROGRAMS += veritysetup
-
-if STATIC_TOOLS
-sbin_PROGRAMS += veritysetup.static
-veritysetup_static_SOURCES = $(veritysetup_SOURCES)
-veritysetup_static_CFLAGS = $(veritysetup_CFLAGS)
-veritysetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
-veritysetup_static_LDADD = $(veritysetup_LDADD)        \
-       @CRYPTO_STATIC_LIBS@ \
-       @DEVMAPPER_STATIC_LIBS@ \
-       @UUID_LIBS@
-endif
-endif
-
-# reencrypt
-if REENCRYPT
-cryptsetup_reencrypt_SOURCES = \
-       $(top_builddir)/lib/utils_crypt.c       \
-       utils_tools.c                           \
-       cryptsetup_reencrypt.c                  \
-       cryptsetup.h
-
-cryptsetup_reencrypt_LDADD = $(cryptsetup_LDADD)
-cryptsetup_reencrypt_CFLAGS = $(cryptsetup_CFLAGS)
-
-sbin_PROGRAMS += cryptsetup-reencrypt
-
-if STATIC_TOOLS
-sbin_PROGRAMS += cryptsetup-reencrypt.static
-cryptsetup_reencrypt_static_SOURCES = $(cryptsetup_reencrypt_SOURCES)
-cryptsetup_reencrypt_static_CFLAGS = $(cryptsetup_reencrypt_CFLAGS)
-cryptsetup_reencrypt_static_LDFLAGS = $(AM_LDFLAGS) -all-static
-cryptsetup_reencrypt_static_LDADD = $(cryptsetup_reencrypt_LDADD)      \
-       @CRYPTO_STATIC_LIBS@ \
-       @DEVMAPPER_STATIC_LIBS@ \
-       @UUID_LIBS@
-endif
-endif
diff --git a/src/Makefile.in b/src/Makefile.in
deleted file mode 100644 (file)
index 45ed671..0000000
+++ /dev/null
@@ -1,1265 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-sbin_PROGRAMS = cryptsetup$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
-       $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5)
-@STATIC_TOOLS_TRUE@am__append_1 = cryptsetup.static
-@VERITYSETUP_TRUE@am__append_2 = veritysetup
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@am__append_3 = veritysetup.static
-@REENCRYPT_TRUE@am__append_4 = cryptsetup-reencrypt
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@am__append_5 = cryptsetup-reencrypt.static
-subdir = src
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-@STATIC_TOOLS_TRUE@am__EXEEXT_1 = cryptsetup.static$(EXEEXT)
-@VERITYSETUP_TRUE@am__EXEEXT_2 = veritysetup$(EXEEXT)
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@am__EXEEXT_3 = veritysetup.static$(EXEEXT)
-@REENCRYPT_TRUE@am__EXEEXT_4 = cryptsetup-reencrypt$(EXEEXT)
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@am__EXEEXT_5 = cryptsetup-reencrypt.static$(EXEEXT)
-am__installdirs = "$(DESTDIR)$(sbindir)"
-PROGRAMS = $(sbin_PROGRAMS)
-am_cryptsetup_OBJECTS = cryptsetup-utils_crypt.$(OBJEXT) \
-       cryptsetup-utils_loop.$(OBJEXT) \
-       cryptsetup-utils_fips.$(OBJEXT) \
-       cryptsetup-utils_tools.$(OBJEXT) \
-       cryptsetup-utils_password.$(OBJEXT) \
-       cryptsetup-cryptsetup.$(OBJEXT)
-cryptsetup_OBJECTS = $(am_cryptsetup_OBJECTS)
-cryptsetup_DEPENDENCIES = $(top_builddir)/lib/libcryptsetup.la
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-cryptsetup_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cryptsetup_CFLAGS) \
-       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am__cryptsetup_reencrypt_SOURCES_DIST =  \
-       $(top_builddir)/lib/utils_crypt.c utils_tools.c \
-       cryptsetup_reencrypt.c cryptsetup.h
-@REENCRYPT_TRUE@am_cryptsetup_reencrypt_OBJECTS =  \
-@REENCRYPT_TRUE@       cryptsetup_reencrypt-utils_crypt.$(OBJEXT) \
-@REENCRYPT_TRUE@       cryptsetup_reencrypt-utils_tools.$(OBJEXT) \
-@REENCRYPT_TRUE@       cryptsetup_reencrypt-cryptsetup_reencrypt.$(OBJEXT)
-cryptsetup_reencrypt_OBJECTS = $(am_cryptsetup_reencrypt_OBJECTS)
-am__DEPENDENCIES_1 = $(top_builddir)/lib/libcryptsetup.la
-@REENCRYPT_TRUE@cryptsetup_reencrypt_DEPENDENCIES =  \
-@REENCRYPT_TRUE@       $(am__DEPENDENCIES_1)
-cryptsetup_reencrypt_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-       $(LDFLAGS) -o $@
-am__cryptsetup_reencrypt_static_SOURCES_DIST =  \
-       $(top_builddir)/lib/utils_crypt.c utils_tools.c \
-       cryptsetup_reencrypt.c cryptsetup.h
-@REENCRYPT_TRUE@am__objects_1 = cryptsetup_reencrypt_static-utils_crypt.$(OBJEXT) \
-@REENCRYPT_TRUE@       cryptsetup_reencrypt_static-utils_tools.$(OBJEXT) \
-@REENCRYPT_TRUE@       cryptsetup_reencrypt_static-cryptsetup_reencrypt.$(OBJEXT)
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@am_cryptsetup_reencrypt_static_OBJECTS =  \
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    $(am__objects_1)
-cryptsetup_reencrypt_static_OBJECTS =  \
-       $(am_cryptsetup_reencrypt_static_OBJECTS)
-@REENCRYPT_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_DEPENDENCIES =  \
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    $(am__DEPENDENCIES_2)
-cryptsetup_reencrypt_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) \
-       $(cryptsetup_reencrypt_static_LDFLAGS) $(LDFLAGS) -o $@
-am__cryptsetup_static_SOURCES_DIST =  \
-       $(top_builddir)/lib/utils_crypt.c \
-       $(top_builddir)/lib/utils_loop.c \
-       $(top_builddir)/lib/utils_fips.c utils_tools.c \
-       utils_password.c cryptsetup.c cryptsetup.h
-am__objects_2 = cryptsetup_static-utils_crypt.$(OBJEXT) \
-       cryptsetup_static-utils_loop.$(OBJEXT) \
-       cryptsetup_static-utils_fips.$(OBJEXT) \
-       cryptsetup_static-utils_tools.$(OBJEXT) \
-       cryptsetup_static-utils_password.$(OBJEXT) \
-       cryptsetup_static-cryptsetup.$(OBJEXT)
-@STATIC_TOOLS_TRUE@am_cryptsetup_static_OBJECTS = $(am__objects_2)
-cryptsetup_static_OBJECTS = $(am_cryptsetup_static_OBJECTS)
-@STATIC_TOOLS_TRUE@cryptsetup_static_DEPENDENCIES =  \
-@STATIC_TOOLS_TRUE@    $(am__DEPENDENCIES_1)
-cryptsetup_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(cryptsetup_static_CFLAGS) $(CFLAGS) \
-       $(cryptsetup_static_LDFLAGS) $(LDFLAGS) -o $@
-am__veritysetup_SOURCES_DIST = $(top_builddir)/lib/utils_crypt.c \
-       $(top_builddir)/lib/utils_loop.c utils_tools.c veritysetup.c \
-       cryptsetup.h
-@VERITYSETUP_TRUE@am_veritysetup_OBJECTS =  \
-@VERITYSETUP_TRUE@     veritysetup-utils_crypt.$(OBJEXT) \
-@VERITYSETUP_TRUE@     veritysetup-utils_loop.$(OBJEXT) \
-@VERITYSETUP_TRUE@     veritysetup-utils_tools.$(OBJEXT) \
-@VERITYSETUP_TRUE@     veritysetup-veritysetup.$(OBJEXT)
-veritysetup_OBJECTS = $(am_veritysetup_OBJECTS)
-@VERITYSETUP_TRUE@veritysetup_DEPENDENCIES =  \
-@VERITYSETUP_TRUE@     $(top_builddir)/lib/libcryptsetup.la
-veritysetup_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(veritysetup_CFLAGS) \
-       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am__veritysetup_static_SOURCES_DIST =  \
-       $(top_builddir)/lib/utils_crypt.c \
-       $(top_builddir)/lib/utils_loop.c utils_tools.c veritysetup.c \
-       cryptsetup.h
-@VERITYSETUP_TRUE@am__objects_3 =  \
-@VERITYSETUP_TRUE@     veritysetup_static-utils_crypt.$(OBJEXT) \
-@VERITYSETUP_TRUE@     veritysetup_static-utils_loop.$(OBJEXT) \
-@VERITYSETUP_TRUE@     veritysetup_static-utils_tools.$(OBJEXT) \
-@VERITYSETUP_TRUE@     veritysetup_static-veritysetup.$(OBJEXT)
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@am_veritysetup_static_OBJECTS =  \
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  $(am__objects_3)
-veritysetup_static_OBJECTS = $(am_veritysetup_static_OBJECTS)
-@VERITYSETUP_TRUE@am__DEPENDENCIES_3 =  \
-@VERITYSETUP_TRUE@     $(top_builddir)/lib/libcryptsetup.la
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_DEPENDENCIES =  \
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  $(am__DEPENDENCIES_3)
-veritysetup_static_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-       $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
-       $(veritysetup_static_CFLAGS) $(CFLAGS) \
-       $(veritysetup_static_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-       $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(cryptsetup_SOURCES) $(cryptsetup_reencrypt_SOURCES) \
-       $(cryptsetup_reencrypt_static_SOURCES) \
-       $(cryptsetup_static_SOURCES) $(veritysetup_SOURCES) \
-       $(veritysetup_static_SOURCES)
-DIST_SOURCES = $(cryptsetup_SOURCES) \
-       $(am__cryptsetup_reencrypt_SOURCES_DIST) \
-       $(am__cryptsetup_reencrypt_static_SOURCES_DIST) \
-       $(am__cryptsetup_static_SOURCES_DIST) \
-       $(am__veritysetup_SOURCES_DIST) \
-       $(am__veritysetup_static_SOURCES_DIST)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
-CRYPTO_LIBS = @CRYPTO_LIBS@
-CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
-DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
-DEVMAPPER_STATIC_CFLAGS = @DEVMAPPER_STATIC_CFLAGS@
-DEVMAPPER_STATIC_LIBS = @DEVMAPPER_STATIC_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
-LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NSS_CFLAGS = @NSS_CFLAGS@
-NSS_LIBS = @NSS_LIBS@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
-OPENSSL_STATIC_CFLAGS = @OPENSSL_STATIC_CFLAGS@
-OPENSSL_STATIC_LIBS = @OPENSSL_STATIC_LIBS@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-POPT_LIBS = @POPT_LIBS@
-POSUB = @POSUB@
-PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
-PWQUALITY_LIBS = @PWQUALITY_LIBS@
-PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -include config.h \
-       -I$(top_srcdir)                         \
-       -I$(top_srcdir)/lib                     \
-       -DDATADIR=\""$(datadir)"\"              \
-       -DLOCALEDIR=\""$(datadir)/locale"\"     \
-       -DLIBDIR=\""$(libdir)"\"                \
-       -DPREFIX=\""$(prefix)"\"                \
-       -DSYSCONFDIR=\""$(sysconfdir)"\"        \
-       -DVERSION=\""$(VERSION)"\"
-
-
-# cryptsetup
-cryptsetup_SOURCES = \
-       $(top_builddir)/lib/utils_crypt.c       \
-       $(top_builddir)/lib/utils_loop.c        \
-       $(top_builddir)/lib/utils_fips.c        \
-       utils_tools.c                           \
-       utils_password.c                        \
-       cryptsetup.c                            \
-       cryptsetup.h
-
-cryptsetup_LDADD = \
-       $(top_builddir)/lib/libcryptsetup.la    \
-       @POPT_LIBS@                             \
-       @PWQUALITY_LIBS@
-
-cryptsetup_CFLAGS = $(AM_CFLAGS) -Wall
-@STATIC_TOOLS_TRUE@cryptsetup_static_SOURCES = $(cryptsetup_SOURCES)
-@STATIC_TOOLS_TRUE@cryptsetup_static_CFLAGS = $(cryptsetup_CFLAGS)
-@STATIC_TOOLS_TRUE@cryptsetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
-@STATIC_TOOLS_TRUE@cryptsetup_static_LDADD = $(cryptsetup_LDADD)       \
-@STATIC_TOOLS_TRUE@    @CRYPTO_STATIC_LIBS@                    \
-@STATIC_TOOLS_TRUE@    @PWQUALITY_STATIC_LIBS@                 \
-@STATIC_TOOLS_TRUE@    @DEVMAPPER_STATIC_LIBS@                 \
-@STATIC_TOOLS_TRUE@    @UUID_LIBS@
-
-
-# veritysetup
-@VERITYSETUP_TRUE@veritysetup_SOURCES = \
-@VERITYSETUP_TRUE@     $(top_builddir)/lib/utils_crypt.c       \
-@VERITYSETUP_TRUE@     $(top_builddir)/lib/utils_loop.c        \
-@VERITYSETUP_TRUE@     utils_tools.c                           \
-@VERITYSETUP_TRUE@     veritysetup.c                           \
-@VERITYSETUP_TRUE@     cryptsetup.h
-
-@VERITYSETUP_TRUE@veritysetup_LDADD = \
-@VERITYSETUP_TRUE@     $(top_builddir)/lib/libcryptsetup.la    \
-@VERITYSETUP_TRUE@     @POPT_LIBS@
-
-@VERITYSETUP_TRUE@veritysetup_CFLAGS = $(cryptsetup_CFLAGS)
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_SOURCES = $(veritysetup_SOURCES)
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_CFLAGS = $(veritysetup_CFLAGS)
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@veritysetup_static_LDADD = $(veritysetup_LDADD)   \
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  @CRYPTO_STATIC_LIBS@ \
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  @DEVMAPPER_STATIC_LIBS@ \
-@STATIC_TOOLS_TRUE@@VERITYSETUP_TRUE@  @UUID_LIBS@
-
-
-# reencrypt
-@REENCRYPT_TRUE@cryptsetup_reencrypt_SOURCES = \
-@REENCRYPT_TRUE@       $(top_builddir)/lib/utils_crypt.c       \
-@REENCRYPT_TRUE@       utils_tools.c                           \
-@REENCRYPT_TRUE@       cryptsetup_reencrypt.c                  \
-@REENCRYPT_TRUE@       cryptsetup.h
-
-@REENCRYPT_TRUE@cryptsetup_reencrypt_LDADD = $(cryptsetup_LDADD)
-@REENCRYPT_TRUE@cryptsetup_reencrypt_CFLAGS = $(cryptsetup_CFLAGS)
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_SOURCES = $(cryptsetup_reencrypt_SOURCES)
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_CFLAGS = $(cryptsetup_reencrypt_CFLAGS)
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_LDFLAGS = $(AM_LDFLAGS) -all-static
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@cryptsetup_reencrypt_static_LDADD = $(cryptsetup_reencrypt_LDADD)   \
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    @CRYPTO_STATIC_LIBS@ \
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    @DEVMAPPER_STATIC_LIBS@ \
-@REENCRYPT_TRUE@@STATIC_TOOLS_TRUE@    @UUID_LIBS@
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --gnu src/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-install-sbinPROGRAMS: $(sbin_PROGRAMS)
-       @$(NORMAL_INSTALL)
-       @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
-       fi; \
-       for p in $$list; do echo "$$p $$p"; done | \
-       sed 's/$(EXEEXT)$$//' | \
-       while read p p1; do if test -f $$p \
-        || test -f $$p1 \
-         ; then echo "$$p"; echo "$$p"; else :; fi; \
-       done | \
-       sed -e 'p;s,.*/,,;n;h' \
-           -e 's|.*|.|' \
-           -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-       sed 'N;N;N;s,\n, ,g' | \
-       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-         { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-           if ($$2 == $$4) files[d] = files[d] " " $$1; \
-           else { print "f", $$3 "/" $$4, $$1; } } \
-         END { for (d in files) print "f", d, files[d] }' | \
-       while read type dir files; do \
-           if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-           test -z "$$files" || { \
-           echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
-           $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
-           } \
-       ; done
-
-uninstall-sbinPROGRAMS:
-       @$(NORMAL_UNINSTALL)
-       @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
-       files=`for p in $$list; do echo "$$p"; done | \
-         sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-             -e 's/$$/$(EXEEXT)/' \
-       `; \
-       test -n "$$list" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(sbindir)" && rm -f $$files
-
-clean-sbinPROGRAMS:
-       @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
-       echo " rm -f" $$list; \
-       rm -f $$list || exit $$?; \
-       test -n "$(EXEEXT)" || exit 0; \
-       list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
-       echo " rm -f" $$list; \
-       rm -f $$list
-
-cryptsetup$(EXEEXT): $(cryptsetup_OBJECTS) $(cryptsetup_DEPENDENCIES) $(EXTRA_cryptsetup_DEPENDENCIES) 
-       @rm -f cryptsetup$(EXEEXT)
-       $(AM_V_CCLD)$(cryptsetup_LINK) $(cryptsetup_OBJECTS) $(cryptsetup_LDADD) $(LIBS)
-
-cryptsetup-reencrypt$(EXEEXT): $(cryptsetup_reencrypt_OBJECTS) $(cryptsetup_reencrypt_DEPENDENCIES) $(EXTRA_cryptsetup_reencrypt_DEPENDENCIES) 
-       @rm -f cryptsetup-reencrypt$(EXEEXT)
-       $(AM_V_CCLD)$(cryptsetup_reencrypt_LINK) $(cryptsetup_reencrypt_OBJECTS) $(cryptsetup_reencrypt_LDADD) $(LIBS)
-
-cryptsetup-reencrypt.static$(EXEEXT): $(cryptsetup_reencrypt_static_OBJECTS) $(cryptsetup_reencrypt_static_DEPENDENCIES) $(EXTRA_cryptsetup_reencrypt_static_DEPENDENCIES) 
-       @rm -f cryptsetup-reencrypt.static$(EXEEXT)
-       $(AM_V_CCLD)$(cryptsetup_reencrypt_static_LINK) $(cryptsetup_reencrypt_static_OBJECTS) $(cryptsetup_reencrypt_static_LDADD) $(LIBS)
-
-cryptsetup.static$(EXEEXT): $(cryptsetup_static_OBJECTS) $(cryptsetup_static_DEPENDENCIES) $(EXTRA_cryptsetup_static_DEPENDENCIES) 
-       @rm -f cryptsetup.static$(EXEEXT)
-       $(AM_V_CCLD)$(cryptsetup_static_LINK) $(cryptsetup_static_OBJECTS) $(cryptsetup_static_LDADD) $(LIBS)
-
-veritysetup$(EXEEXT): $(veritysetup_OBJECTS) $(veritysetup_DEPENDENCIES) $(EXTRA_veritysetup_DEPENDENCIES) 
-       @rm -f veritysetup$(EXEEXT)
-       $(AM_V_CCLD)$(veritysetup_LINK) $(veritysetup_OBJECTS) $(veritysetup_LDADD) $(LIBS)
-
-veritysetup.static$(EXEEXT): $(veritysetup_static_OBJECTS) $(veritysetup_static_DEPENDENCIES) $(EXTRA_veritysetup_static_DEPENDENCIES) 
-       @rm -f veritysetup.static$(EXEEXT)
-       $(AM_V_CCLD)$(veritysetup_static_LINK) $(veritysetup_static_OBJECTS) $(veritysetup_static_LDADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup-cryptsetup.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup-utils_crypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup-utils_fips.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup-utils_loop.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup-utils_password.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup-utils_tools.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_reencrypt-cryptsetup_reencrypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_reencrypt-utils_crypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_reencrypt-utils_tools.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_reencrypt_static-cryptsetup_reencrypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_reencrypt_static-utils_crypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_reencrypt_static-utils_tools.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_static-cryptsetup.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_static-utils_crypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_static-utils_fips.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_static-utils_loop.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_static-utils_password.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cryptsetup_static-utils_tools.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup-utils_crypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup-utils_loop.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup-utils_tools.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup-veritysetup.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup_static-utils_crypt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup_static-utils_loop.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup_static-utils_tools.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/veritysetup_static-veritysetup.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-cryptsetup-utils_crypt.o: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_crypt.o -MD -MP -MF $(DEPDIR)/cryptsetup-utils_crypt.Tpo -c -o cryptsetup-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_crypt.Tpo $(DEPDIR)/cryptsetup-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup-utils_crypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-
-cryptsetup-utils_crypt.obj: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_crypt.obj -MD -MP -MF $(DEPDIR)/cryptsetup-utils_crypt.Tpo -c -o cryptsetup-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_crypt.Tpo $(DEPDIR)/cryptsetup-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup-utils_crypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-
-cryptsetup-utils_loop.o: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_loop.o -MD -MP -MF $(DEPDIR)/cryptsetup-utils_loop.Tpo -c -o cryptsetup-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_loop.Tpo $(DEPDIR)/cryptsetup-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='cryptsetup-utils_loop.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-
-cryptsetup-utils_loop.obj: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_loop.obj -MD -MP -MF $(DEPDIR)/cryptsetup-utils_loop.Tpo -c -o cryptsetup-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_loop.Tpo $(DEPDIR)/cryptsetup-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='cryptsetup-utils_loop.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-
-cryptsetup-utils_fips.o: $(top_builddir)/lib/utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_fips.o -MD -MP -MF $(DEPDIR)/cryptsetup-utils_fips.Tpo -c -o cryptsetup-utils_fips.o `test -f '$(top_builddir)/lib/utils_fips.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_fips.Tpo $(DEPDIR)/cryptsetup-utils_fips.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_fips.c' object='cryptsetup-utils_fips.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_fips.o `test -f '$(top_builddir)/lib/utils_fips.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_fips.c
-
-cryptsetup-utils_fips.obj: $(top_builddir)/lib/utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_fips.obj -MD -MP -MF $(DEPDIR)/cryptsetup-utils_fips.Tpo -c -o cryptsetup-utils_fips.obj `if test -f '$(top_builddir)/lib/utils_fips.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_fips.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_fips.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_fips.Tpo $(DEPDIR)/cryptsetup-utils_fips.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_fips.c' object='cryptsetup-utils_fips.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_fips.obj `if test -f '$(top_builddir)/lib/utils_fips.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_fips.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_fips.c'; fi`
-
-cryptsetup-utils_tools.o: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_tools.o -MD -MP -MF $(DEPDIR)/cryptsetup-utils_tools.Tpo -c -o cryptsetup-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_tools.Tpo $(DEPDIR)/cryptsetup-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup-utils_tools.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-
-cryptsetup-utils_tools.obj: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_tools.obj -MD -MP -MF $(DEPDIR)/cryptsetup-utils_tools.Tpo -c -o cryptsetup-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_tools.Tpo $(DEPDIR)/cryptsetup-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup-utils_tools.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-
-cryptsetup-utils_password.o: utils_password.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_password.o -MD -MP -MF $(DEPDIR)/cryptsetup-utils_password.Tpo -c -o cryptsetup-utils_password.o `test -f 'utils_password.c' || echo '$(srcdir)/'`utils_password.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_password.Tpo $(DEPDIR)/cryptsetup-utils_password.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_password.c' object='cryptsetup-utils_password.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_password.o `test -f 'utils_password.c' || echo '$(srcdir)/'`utils_password.c
-
-cryptsetup-utils_password.obj: utils_password.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-utils_password.obj -MD -MP -MF $(DEPDIR)/cryptsetup-utils_password.Tpo -c -o cryptsetup-utils_password.obj `if test -f 'utils_password.c'; then $(CYGPATH_W) 'utils_password.c'; else $(CYGPATH_W) '$(srcdir)/utils_password.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-utils_password.Tpo $(DEPDIR)/cryptsetup-utils_password.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_password.c' object='cryptsetup-utils_password.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-utils_password.obj `if test -f 'utils_password.c'; then $(CYGPATH_W) 'utils_password.c'; else $(CYGPATH_W) '$(srcdir)/utils_password.c'; fi`
-
-cryptsetup-cryptsetup.o: cryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-cryptsetup.o -MD -MP -MF $(DEPDIR)/cryptsetup-cryptsetup.Tpo -c -o cryptsetup-cryptsetup.o `test -f 'cryptsetup.c' || echo '$(srcdir)/'`cryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-cryptsetup.Tpo $(DEPDIR)/cryptsetup-cryptsetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup.c' object='cryptsetup-cryptsetup.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-cryptsetup.o `test -f 'cryptsetup.c' || echo '$(srcdir)/'`cryptsetup.c
-
-cryptsetup-cryptsetup.obj: cryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -MT cryptsetup-cryptsetup.obj -MD -MP -MF $(DEPDIR)/cryptsetup-cryptsetup.Tpo -c -o cryptsetup-cryptsetup.obj `if test -f 'cryptsetup.c'; then $(CYGPATH_W) 'cryptsetup.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup-cryptsetup.Tpo $(DEPDIR)/cryptsetup-cryptsetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup.c' object='cryptsetup-cryptsetup.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_CFLAGS) $(CFLAGS) -c -o cryptsetup-cryptsetup.obj `if test -f 'cryptsetup.c'; then $(CYGPATH_W) 'cryptsetup.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup.c'; fi`
-
-cryptsetup_reencrypt-utils_crypt.o: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt-utils_crypt.o -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt-utils_crypt.Tpo -c -o cryptsetup_reencrypt-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt-utils_crypt.Tpo $(DEPDIR)/cryptsetup_reencrypt-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup_reencrypt-utils_crypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-
-cryptsetup_reencrypt-utils_crypt.obj: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt-utils_crypt.obj -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt-utils_crypt.Tpo -c -o cryptsetup_reencrypt-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt-utils_crypt.Tpo $(DEPDIR)/cryptsetup_reencrypt-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup_reencrypt-utils_crypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-
-cryptsetup_reencrypt-utils_tools.o: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt-utils_tools.o -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt-utils_tools.Tpo -c -o cryptsetup_reencrypt-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt-utils_tools.Tpo $(DEPDIR)/cryptsetup_reencrypt-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup_reencrypt-utils_tools.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-
-cryptsetup_reencrypt-utils_tools.obj: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt-utils_tools.obj -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt-utils_tools.Tpo -c -o cryptsetup_reencrypt-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt-utils_tools.Tpo $(DEPDIR)/cryptsetup_reencrypt-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup_reencrypt-utils_tools.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-
-cryptsetup_reencrypt-cryptsetup_reencrypt.o: cryptsetup_reencrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt-cryptsetup_reencrypt.o -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt-cryptsetup_reencrypt.Tpo -c -o cryptsetup_reencrypt-cryptsetup_reencrypt.o `test -f 'cryptsetup_reencrypt.c' || echo '$(srcdir)/'`cryptsetup_reencrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt-cryptsetup_reencrypt.Tpo $(DEPDIR)/cryptsetup_reencrypt-cryptsetup_reencrypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup_reencrypt.c' object='cryptsetup_reencrypt-cryptsetup_reencrypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt-cryptsetup_reencrypt.o `test -f 'cryptsetup_reencrypt.c' || echo '$(srcdir)/'`cryptsetup_reencrypt.c
-
-cryptsetup_reencrypt-cryptsetup_reencrypt.obj: cryptsetup_reencrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt-cryptsetup_reencrypt.obj -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt-cryptsetup_reencrypt.Tpo -c -o cryptsetup_reencrypt-cryptsetup_reencrypt.obj `if test -f 'cryptsetup_reencrypt.c'; then $(CYGPATH_W) 'cryptsetup_reencrypt.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup_reencrypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt-cryptsetup_reencrypt.Tpo $(DEPDIR)/cryptsetup_reencrypt-cryptsetup_reencrypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup_reencrypt.c' object='cryptsetup_reencrypt-cryptsetup_reencrypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt-cryptsetup_reencrypt.obj `if test -f 'cryptsetup_reencrypt.c'; then $(CYGPATH_W) 'cryptsetup_reencrypt.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup_reencrypt.c'; fi`
-
-cryptsetup_reencrypt_static-utils_crypt.o: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt_static-utils_crypt.o -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt_static-utils_crypt.Tpo -c -o cryptsetup_reencrypt_static-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt_static-utils_crypt.Tpo $(DEPDIR)/cryptsetup_reencrypt_static-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup_reencrypt_static-utils_crypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt_static-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-
-cryptsetup_reencrypt_static-utils_crypt.obj: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt_static-utils_crypt.obj -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt_static-utils_crypt.Tpo -c -o cryptsetup_reencrypt_static-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt_static-utils_crypt.Tpo $(DEPDIR)/cryptsetup_reencrypt_static-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup_reencrypt_static-utils_crypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt_static-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-
-cryptsetup_reencrypt_static-utils_tools.o: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt_static-utils_tools.o -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt_static-utils_tools.Tpo -c -o cryptsetup_reencrypt_static-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt_static-utils_tools.Tpo $(DEPDIR)/cryptsetup_reencrypt_static-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup_reencrypt_static-utils_tools.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt_static-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-
-cryptsetup_reencrypt_static-utils_tools.obj: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt_static-utils_tools.obj -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt_static-utils_tools.Tpo -c -o cryptsetup_reencrypt_static-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt_static-utils_tools.Tpo $(DEPDIR)/cryptsetup_reencrypt_static-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup_reencrypt_static-utils_tools.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt_static-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-
-cryptsetup_reencrypt_static-cryptsetup_reencrypt.o: cryptsetup_reencrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt_static-cryptsetup_reencrypt.o -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt_static-cryptsetup_reencrypt.Tpo -c -o cryptsetup_reencrypt_static-cryptsetup_reencrypt.o `test -f 'cryptsetup_reencrypt.c' || echo '$(srcdir)/'`cryptsetup_reencrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt_static-cryptsetup_reencrypt.Tpo $(DEPDIR)/cryptsetup_reencrypt_static-cryptsetup_reencrypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup_reencrypt.c' object='cryptsetup_reencrypt_static-cryptsetup_reencrypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt_static-cryptsetup_reencrypt.o `test -f 'cryptsetup_reencrypt.c' || echo '$(srcdir)/'`cryptsetup_reencrypt.c
-
-cryptsetup_reencrypt_static-cryptsetup_reencrypt.obj: cryptsetup_reencrypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -MT cryptsetup_reencrypt_static-cryptsetup_reencrypt.obj -MD -MP -MF $(DEPDIR)/cryptsetup_reencrypt_static-cryptsetup_reencrypt.Tpo -c -o cryptsetup_reencrypt_static-cryptsetup_reencrypt.obj `if test -f 'cryptsetup_reencrypt.c'; then $(CYGPATH_W) 'cryptsetup_reencrypt.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup_reencrypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_reencrypt_static-cryptsetup_reencrypt.Tpo $(DEPDIR)/cryptsetup_reencrypt_static-cryptsetup_reencrypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup_reencrypt.c' object='cryptsetup_reencrypt_static-cryptsetup_reencrypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_reencrypt_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_reencrypt_static-cryptsetup_reencrypt.obj `if test -f 'cryptsetup_reencrypt.c'; then $(CYGPATH_W) 'cryptsetup_reencrypt.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup_reencrypt.c'; fi`
-
-cryptsetup_static-utils_crypt.o: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_crypt.o -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_crypt.Tpo -c -o cryptsetup_static-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_crypt.Tpo $(DEPDIR)/cryptsetup_static-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup_static-utils_crypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-
-cryptsetup_static-utils_crypt.obj: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_crypt.obj -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_crypt.Tpo -c -o cryptsetup_static-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_crypt.Tpo $(DEPDIR)/cryptsetup_static-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='cryptsetup_static-utils_crypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-
-cryptsetup_static-utils_loop.o: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_loop.o -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_loop.Tpo -c -o cryptsetup_static-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_loop.Tpo $(DEPDIR)/cryptsetup_static-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='cryptsetup_static-utils_loop.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-
-cryptsetup_static-utils_loop.obj: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_loop.obj -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_loop.Tpo -c -o cryptsetup_static-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_loop.Tpo $(DEPDIR)/cryptsetup_static-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='cryptsetup_static-utils_loop.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-
-cryptsetup_static-utils_fips.o: $(top_builddir)/lib/utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_fips.o -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_fips.Tpo -c -o cryptsetup_static-utils_fips.o `test -f '$(top_builddir)/lib/utils_fips.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_fips.Tpo $(DEPDIR)/cryptsetup_static-utils_fips.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_fips.c' object='cryptsetup_static-utils_fips.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_fips.o `test -f '$(top_builddir)/lib/utils_fips.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_fips.c
-
-cryptsetup_static-utils_fips.obj: $(top_builddir)/lib/utils_fips.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_fips.obj -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_fips.Tpo -c -o cryptsetup_static-utils_fips.obj `if test -f '$(top_builddir)/lib/utils_fips.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_fips.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_fips.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_fips.Tpo $(DEPDIR)/cryptsetup_static-utils_fips.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_fips.c' object='cryptsetup_static-utils_fips.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_fips.obj `if test -f '$(top_builddir)/lib/utils_fips.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_fips.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_fips.c'; fi`
-
-cryptsetup_static-utils_tools.o: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_tools.o -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_tools.Tpo -c -o cryptsetup_static-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_tools.Tpo $(DEPDIR)/cryptsetup_static-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup_static-utils_tools.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-
-cryptsetup_static-utils_tools.obj: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_tools.obj -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_tools.Tpo -c -o cryptsetup_static-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_tools.Tpo $(DEPDIR)/cryptsetup_static-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='cryptsetup_static-utils_tools.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-
-cryptsetup_static-utils_password.o: utils_password.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_password.o -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_password.Tpo -c -o cryptsetup_static-utils_password.o `test -f 'utils_password.c' || echo '$(srcdir)/'`utils_password.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_password.Tpo $(DEPDIR)/cryptsetup_static-utils_password.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_password.c' object='cryptsetup_static-utils_password.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_password.o `test -f 'utils_password.c' || echo '$(srcdir)/'`utils_password.c
-
-cryptsetup_static-utils_password.obj: utils_password.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-utils_password.obj -MD -MP -MF $(DEPDIR)/cryptsetup_static-utils_password.Tpo -c -o cryptsetup_static-utils_password.obj `if test -f 'utils_password.c'; then $(CYGPATH_W) 'utils_password.c'; else $(CYGPATH_W) '$(srcdir)/utils_password.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-utils_password.Tpo $(DEPDIR)/cryptsetup_static-utils_password.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_password.c' object='cryptsetup_static-utils_password.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-utils_password.obj `if test -f 'utils_password.c'; then $(CYGPATH_W) 'utils_password.c'; else $(CYGPATH_W) '$(srcdir)/utils_password.c'; fi`
-
-cryptsetup_static-cryptsetup.o: cryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-cryptsetup.o -MD -MP -MF $(DEPDIR)/cryptsetup_static-cryptsetup.Tpo -c -o cryptsetup_static-cryptsetup.o `test -f 'cryptsetup.c' || echo '$(srcdir)/'`cryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-cryptsetup.Tpo $(DEPDIR)/cryptsetup_static-cryptsetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup.c' object='cryptsetup_static-cryptsetup.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-cryptsetup.o `test -f 'cryptsetup.c' || echo '$(srcdir)/'`cryptsetup.c
-
-cryptsetup_static-cryptsetup.obj: cryptsetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -MT cryptsetup_static-cryptsetup.obj -MD -MP -MF $(DEPDIR)/cryptsetup_static-cryptsetup.Tpo -c -o cryptsetup_static-cryptsetup.obj `if test -f 'cryptsetup.c'; then $(CYGPATH_W) 'cryptsetup.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/cryptsetup_static-cryptsetup.Tpo $(DEPDIR)/cryptsetup_static-cryptsetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='cryptsetup.c' object='cryptsetup_static-cryptsetup.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cryptsetup_static_CFLAGS) $(CFLAGS) -c -o cryptsetup_static-cryptsetup.obj `if test -f 'cryptsetup.c'; then $(CYGPATH_W) 'cryptsetup.c'; else $(CYGPATH_W) '$(srcdir)/cryptsetup.c'; fi`
-
-veritysetup-utils_crypt.o: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-utils_crypt.o -MD -MP -MF $(DEPDIR)/veritysetup-utils_crypt.Tpo -c -o veritysetup-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-utils_crypt.Tpo $(DEPDIR)/veritysetup-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='veritysetup-utils_crypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-
-veritysetup-utils_crypt.obj: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-utils_crypt.obj -MD -MP -MF $(DEPDIR)/veritysetup-utils_crypt.Tpo -c -o veritysetup-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-utils_crypt.Tpo $(DEPDIR)/veritysetup-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='veritysetup-utils_crypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-
-veritysetup-utils_loop.o: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-utils_loop.o -MD -MP -MF $(DEPDIR)/veritysetup-utils_loop.Tpo -c -o veritysetup-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-utils_loop.Tpo $(DEPDIR)/veritysetup-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='veritysetup-utils_loop.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-
-veritysetup-utils_loop.obj: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-utils_loop.obj -MD -MP -MF $(DEPDIR)/veritysetup-utils_loop.Tpo -c -o veritysetup-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-utils_loop.Tpo $(DEPDIR)/veritysetup-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='veritysetup-utils_loop.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-
-veritysetup-utils_tools.o: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-utils_tools.o -MD -MP -MF $(DEPDIR)/veritysetup-utils_tools.Tpo -c -o veritysetup-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-utils_tools.Tpo $(DEPDIR)/veritysetup-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='veritysetup-utils_tools.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-
-veritysetup-utils_tools.obj: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-utils_tools.obj -MD -MP -MF $(DEPDIR)/veritysetup-utils_tools.Tpo -c -o veritysetup-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-utils_tools.Tpo $(DEPDIR)/veritysetup-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='veritysetup-utils_tools.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-
-veritysetup-veritysetup.o: veritysetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-veritysetup.o -MD -MP -MF $(DEPDIR)/veritysetup-veritysetup.Tpo -c -o veritysetup-veritysetup.o `test -f 'veritysetup.c' || echo '$(srcdir)/'`veritysetup.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-veritysetup.Tpo $(DEPDIR)/veritysetup-veritysetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='veritysetup.c' object='veritysetup-veritysetup.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-veritysetup.o `test -f 'veritysetup.c' || echo '$(srcdir)/'`veritysetup.c
-
-veritysetup-veritysetup.obj: veritysetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -MT veritysetup-veritysetup.obj -MD -MP -MF $(DEPDIR)/veritysetup-veritysetup.Tpo -c -o veritysetup-veritysetup.obj `if test -f 'veritysetup.c'; then $(CYGPATH_W) 'veritysetup.c'; else $(CYGPATH_W) '$(srcdir)/veritysetup.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup-veritysetup.Tpo $(DEPDIR)/veritysetup-veritysetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='veritysetup.c' object='veritysetup-veritysetup.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_CFLAGS) $(CFLAGS) -c -o veritysetup-veritysetup.obj `if test -f 'veritysetup.c'; then $(CYGPATH_W) 'veritysetup.c'; else $(CYGPATH_W) '$(srcdir)/veritysetup.c'; fi`
-
-veritysetup_static-utils_crypt.o: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-utils_crypt.o -MD -MP -MF $(DEPDIR)/veritysetup_static-utils_crypt.Tpo -c -o veritysetup_static-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-utils_crypt.Tpo $(DEPDIR)/veritysetup_static-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='veritysetup_static-utils_crypt.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-utils_crypt.o `test -f '$(top_builddir)/lib/utils_crypt.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_crypt.c
-
-veritysetup_static-utils_crypt.obj: $(top_builddir)/lib/utils_crypt.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-utils_crypt.obj -MD -MP -MF $(DEPDIR)/veritysetup_static-utils_crypt.Tpo -c -o veritysetup_static-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-utils_crypt.Tpo $(DEPDIR)/veritysetup_static-utils_crypt.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_crypt.c' object='veritysetup_static-utils_crypt.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-utils_crypt.obj `if test -f '$(top_builddir)/lib/utils_crypt.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_crypt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_crypt.c'; fi`
-
-veritysetup_static-utils_loop.o: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-utils_loop.o -MD -MP -MF $(DEPDIR)/veritysetup_static-utils_loop.Tpo -c -o veritysetup_static-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-utils_loop.Tpo $(DEPDIR)/veritysetup_static-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='veritysetup_static-utils_loop.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-utils_loop.o `test -f '$(top_builddir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_builddir)/lib/utils_loop.c
-
-veritysetup_static-utils_loop.obj: $(top_builddir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-utils_loop.obj -MD -MP -MF $(DEPDIR)/veritysetup_static-utils_loop.Tpo -c -o veritysetup_static-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-utils_loop.Tpo $(DEPDIR)/veritysetup_static-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_builddir)/lib/utils_loop.c' object='veritysetup_static-utils_loop.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-utils_loop.obj `if test -f '$(top_builddir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_builddir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/lib/utils_loop.c'; fi`
-
-veritysetup_static-utils_tools.o: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-utils_tools.o -MD -MP -MF $(DEPDIR)/veritysetup_static-utils_tools.Tpo -c -o veritysetup_static-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-utils_tools.Tpo $(DEPDIR)/veritysetup_static-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='veritysetup_static-utils_tools.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-utils_tools.o `test -f 'utils_tools.c' || echo '$(srcdir)/'`utils_tools.c
-
-veritysetup_static-utils_tools.obj: utils_tools.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-utils_tools.obj -MD -MP -MF $(DEPDIR)/veritysetup_static-utils_tools.Tpo -c -o veritysetup_static-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-utils_tools.Tpo $(DEPDIR)/veritysetup_static-utils_tools.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='utils_tools.c' object='veritysetup_static-utils_tools.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-utils_tools.obj `if test -f 'utils_tools.c'; then $(CYGPATH_W) 'utils_tools.c'; else $(CYGPATH_W) '$(srcdir)/utils_tools.c'; fi`
-
-veritysetup_static-veritysetup.o: veritysetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-veritysetup.o -MD -MP -MF $(DEPDIR)/veritysetup_static-veritysetup.Tpo -c -o veritysetup_static-veritysetup.o `test -f 'veritysetup.c' || echo '$(srcdir)/'`veritysetup.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-veritysetup.Tpo $(DEPDIR)/veritysetup_static-veritysetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='veritysetup.c' object='veritysetup_static-veritysetup.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-veritysetup.o `test -f 'veritysetup.c' || echo '$(srcdir)/'`veritysetup.c
-
-veritysetup_static-veritysetup.obj: veritysetup.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -MT veritysetup_static-veritysetup.obj -MD -MP -MF $(DEPDIR)/veritysetup_static-veritysetup.Tpo -c -o veritysetup_static-veritysetup.obj `if test -f 'veritysetup.c'; then $(CYGPATH_W) 'veritysetup.c'; else $(CYGPATH_W) '$(srcdir)/veritysetup.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/veritysetup_static-veritysetup.Tpo $(DEPDIR)/veritysetup_static-veritysetup.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='veritysetup.c' object='veritysetup_static-veritysetup.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(veritysetup_static_CFLAGS) $(CFLAGS) -c -o veritysetup_static-veritysetup.obj `if test -f 'veritysetup.c'; then $(CYGPATH_W) 'veritysetup.c'; else $(CYGPATH_W) '$(srcdir)/veritysetup.c'; fi`
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-ID: $(am__tagged_files)
-       $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       set x; \
-       here=`pwd`; \
-       $(am__define_uniq_tagged_files); \
-       shift; \
-       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         if test $$# -gt 0; then \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             "$$@" $$unique; \
-         else \
-           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-             $$unique; \
-         fi; \
-       fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-       $(am__define_uniq_tagged_files); \
-       test -z "$(CTAGS_ARGS)$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && $(am__cd) $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-       list='$(am__tagged_files)'; \
-       case "$(srcdir)" in \
-         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-         *) sdir=$(subdir)/$(srcdir) ;; \
-       esac; \
-       for i in $$list; do \
-         if test -f "$$i"; then \
-           echo "$(subdir)/$$i"; \
-         else \
-           echo "$$sdir/$$i"; \
-         fi; \
-       done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(PROGRAMS)
-installdirs:
-       for dir in "$(DESTDIR)$(sbindir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-sbinPROGRAMS
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-sbinPROGRAMS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-       clean-libtool clean-sbinPROGRAMS cscopelist-am ctags ctags-am \
-       distclean distclean-compile distclean-generic \
-       distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-sbinPROGRAMS install-strip \
-       installcheck installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/Makemodule.am b/src/Makemodule.am
new file mode 100644 (file)
index 0000000..ccba17a
--- /dev/null
@@ -0,0 +1,136 @@
+# cryptsetup
+if CRYPTSETUP
+
+cryptsetup_SOURCES =           \
+       lib/utils_crypt.c       \
+       lib/utils_loop.c        \
+       lib/utils_io.c          \
+       lib/utils_blkid.c       \
+       src/utils_tools.c       \
+       src/utils_password.c    \
+       src/utils_luks2.c       \
+       src/utils_blockdev.c    \
+       src/cryptsetup.c        \
+       src/cryptsetup.h
+
+cryptsetup_LDADD = $(LDADD)    \
+       libcryptsetup.la        \
+       @POPT_LIBS@             \
+       @PWQUALITY_LIBS@        \
+       @PASSWDQC_LIBS@         \
+       @UUID_LIBS@             \
+       @BLKID_LIBS@
+
+sbin_PROGRAMS += cryptsetup
+
+if STATIC_TOOLS
+sbin_PROGRAMS += cryptsetup.static
+cryptsetup_static_SOURCES = $(cryptsetup_SOURCES)
+cryptsetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+cryptsetup_static_LDADD =      \
+       $(cryptsetup_LDADD)     \
+       @CRYPTO_STATIC_LIBS@    \
+       @PWQUALITY_STATIC_LIBS@ \
+       @DEVMAPPER_STATIC_LIBS@
+endif
+endif
+
+# veritysetup
+if VERITYSETUP
+
+veritysetup_SOURCES =          \
+       lib/utils_crypt.c       \
+       lib/utils_loop.c        \
+       lib/utils_io.c          \
+       lib/utils_blkid.c       \
+       src/utils_tools.c       \
+       src/utils_password.c    \
+       src/veritysetup.c       \
+       src/cryptsetup.h
+
+veritysetup_LDADD = $(LDADD)   \
+       libcryptsetup.la        \
+       @POPT_LIBS@             \
+       @PWQUALITY_LIBS@        \
+       @PASSWDQC_LIBS@         \
+       @BLKID_LIBS@
+
+sbin_PROGRAMS += veritysetup
+
+if STATIC_TOOLS
+sbin_PROGRAMS += veritysetup.static
+veritysetup_static_SOURCES = $(veritysetup_SOURCES)
+veritysetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+veritysetup_static_LDADD =     \
+       $(veritysetup_LDADD)    \
+       @CRYPTO_STATIC_LIBS@    \
+       @DEVMAPPER_STATIC_LIBS@ \
+       @UUID_LIBS@
+endif
+endif
+
+# integritysetup
+if INTEGRITYSETUP
+
+integritysetup_SOURCES =       \
+       lib/utils_crypt.c       \
+       lib/utils_loop.c        \
+       lib/utils_io.c          \
+       lib/utils_blkid.c       \
+       src/utils_tools.c       \
+       src/integritysetup.c    \
+       src/cryptsetup.h
+
+integritysetup_LDADD = $(LDADD)        \
+       libcryptsetup.la        \
+       @POPT_LIBS@             \
+       @UUID_LIBS@             \
+       @BLKID_LIBS@
+
+sbin_PROGRAMS += integritysetup
+
+if STATIC_TOOLS
+sbin_PROGRAMS += integritysetup.static
+integritysetup_static_SOURCES = $(integritysetup_SOURCES)
+integritysetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+integritysetup_static_LDADD =  \
+       $(integritysetup_LDADD) \
+       @CRYPTO_STATIC_LIBS@    \
+       @DEVMAPPER_STATIC_LIBS@ \
+       @UUID_LIBS@
+endif
+endif
+
+# reencrypt
+if REENCRYPT
+cryptsetup_reencrypt_SOURCES =         \
+       lib/utils_crypt.c               \
+       lib/utils_io.c                  \
+       lib/utils_blkid.c               \
+       src/utils_tools.c               \
+       lib/utils_loop.c                \
+       src/utils_password.c            \
+       src/cryptsetup_reencrypt.c      \
+       src/cryptsetup.h
+
+cryptsetup_reencrypt_LDADD = $(LDADD)  \
+       libcryptsetup.la                \
+       @POPT_LIBS@                     \
+       @PWQUALITY_LIBS@                \
+       @PASSWDQC_LIBS@                 \
+       @UUID_LIBS@                     \
+       @BLKID_LIBS@
+
+sbin_PROGRAMS += cryptsetup-reencrypt
+
+if STATIC_TOOLS
+sbin_PROGRAMS += cryptsetup-reencrypt.static
+cryptsetup_reencrypt_static_SOURCES = $(cryptsetup_reencrypt_SOURCES)
+cryptsetup_reencrypt_static_LDFLAGS = $(AM_LDFLAGS) -all-static
+cryptsetup_reencrypt_static_LDADD =    \
+       $(cryptsetup_reencrypt_LDADD)   \
+       @CRYPTO_STATIC_LIBS@            \
+       @PWQUALITY_STATIC_LIBS@         \
+       @DEVMAPPER_STATIC_LIBS@
+endif
+endif
index 8fc4d6c..c527690 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * cryptsetup - setup cryptographic volumes for dm-crypt
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2015, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2015, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include "cryptsetup.h"
+#include <uuid/uuid.h>
 
 static const char *opt_cipher = NULL;
+static const char *opt_keyslot_cipher = NULL;
 static const char *opt_hash = NULL;
 static int opt_verify_passphrase = 0;
 
+static const char *opt_json_file = NULL;
 static const char *opt_key_file = NULL;
+static const char *opt_keyfile_stdin = NULL;
 static int opt_keyfiles_count = 0;
 static const char *opt_keyfiles[MAX_KEYFILES];
 
@@ -37,18 +41,19 @@ static const char *opt_uuid = NULL;
 static const char *opt_header_device = NULL;
 static const char *opt_type = "luks";
 static int opt_key_size = 0;
+static int opt_keyslot_key_size = 0;
 static long opt_keyfile_size = 0;
 static long opt_new_keyfile_size = 0;
-static long opt_keyfile_offset = 0;
-static long opt_new_keyfile_offset = 0;
+static uint64_t opt_keyfile_offset = 0;
+static uint64_t opt_new_keyfile_offset = 0;
 static int opt_key_slot = CRYPT_ANY_SLOT;
+static int opt_token = CRYPT_ANY_TOKEN;
+static int opt_token_only = 0;
 static uint64_t opt_size = 0;
 static uint64_t opt_offset = 0;
 static uint64_t opt_skip = 0;
 static int opt_skip_valid = 0;
 static int opt_readonly = 0;
-static int opt_iteration_time = DEFAULT_LUKS1_ITER_TIME;
-static int opt_version_mode = 0;
 static int opt_timeout = 0;
 static int opt_tries = 3;
 static int opt_align_payload = 0;
@@ -64,6 +69,57 @@ static int opt_tcrypt_hidden = 0;
 static int opt_tcrypt_system = 0;
 static int opt_tcrypt_backup = 0;
 static int opt_veracrypt = 0;
+static int opt_veracrypt_pim = -1;
+static int opt_veracrypt_query_pim = 0;
+static int opt_deferred_remove = 0;
+static int opt_serialize_memory_hard_pbkdf = 0;
+//FIXME: check uint32 overflow for long type
+static const char *opt_pbkdf = NULL;
+static long opt_pbkdf_memory = DEFAULT_LUKS2_MEMORY_KB;
+static long opt_pbkdf_parallel = DEFAULT_LUKS2_PARALLEL_THREADS;
+static long opt_pbkdf_iterations = 0;
+static int opt_iteration_time = 0;
+static int opt_disable_locks = 0;
+static int opt_disable_keyring = 0;
+static const char *opt_priority = NULL; /* normal */
+static const char *opt_integrity = NULL; /* none */
+static int opt_integrity_nojournal = 0;
+static int opt_integrity_no_wipe = 0;
+static int opt_integrity_legacy_padding = 0;
+static const char *opt_key_description = NULL;
+static int opt_sector_size = 0;
+static int opt_iv_large_sectors = 0;
+static int opt_persistent = 0;
+static const char *opt_label = NULL;
+static const char *opt_subsystem = NULL;
+static int opt_unbound = 0;
+static int opt_refresh = 0;
+
+/* LUKS2 reencryption parameters */
+static const char *opt_active_name = NULL;
+static const char *opt_resilience_mode = "checksum"; // TODO: default resilience
+static const char *opt_resilience_hash = "sha256"; // TODO: default checksum hash
+static int opt_encrypt = 0;
+static int opt_reencrypt_init_only = 0;
+static int opt_reencrypt_resume_only = 0;
+static int opt_decrypt = 0;
+
+static const char *opt_reduce_size_str = NULL;
+static uint64_t opt_reduce_size = 0;
+
+static const char *opt_hotzone_size_str = NULL;
+static uint64_t opt_hotzone_size = 0;
+
+static const char *opt_device_size_str = NULL;
+static uint64_t opt_device_size = 0;
+
+/* do not set from command line, use helpers above */
+static int64_t opt_data_shift;
+
+static const char *opt_luks2_metadata_size_str = NULL;
+static uint64_t opt_luks2_metadata_size = 0;
+static const char *opt_luks2_keyslots_size_str = NULL;
+static uint64_t opt_luks2_keyslots_size = 0;
 
 static const char **action_argv;
 static int action_argc;
@@ -77,9 +133,26 @@ static const char *uuid_or_device_header(const char **data_device)
        return uuid_or_device(opt_header_device ?: action_argv[0]);
 }
 
+static const char *luksType(const char *type)
+{
+       if (type && !strcmp(type, "luks2"))
+               return CRYPT_LUKS2;
+
+       if (type && !strcmp(type, "luks1"))
+               return CRYPT_LUKS1;
+
+       if (type && !strcmp(type, "luks"))
+               return CRYPT_LUKS; /* NULL */
+
+       if (type && *type)
+               return type;
+
+       return CRYPT_LUKS; /* NULL */
+}
+
 static int _verify_passphrase(int def)
 {
-       /* Batch mode switch off verify - if not overrided by -y */
+       /* Batch mode switch off verify - if not overridden by -y */
        if (opt_verify_passphrase)
                def = 1;
        else if (opt_batch_mode)
@@ -88,7 +161,7 @@ static int _verify_passphrase(int def)
        /* Non-tty input doesn't allow verify */
        if (def && !isatty(STDIN_FILENO)) {
                if (opt_verify_passphrase)
-                       log_err(_("Can't do passphrase verification on non-tty inputs.\n"));
+                       log_err(_("Can't do passphrase verification on non-tty inputs."));
                def = 0;
        }
 
@@ -108,37 +181,79 @@ static void _set_activation_flags(uint32_t *flags)
 
        if (opt_perf_submit_from_crypt_cpus)
                *flags |= CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS;
+
+       if (opt_integrity_nojournal)
+               *flags |= CRYPT_ACTIVATE_NO_JOURNAL;
+
+       /* In persistent mode, we use what is set on command line */
+       if (opt_persistent)
+               *flags |= CRYPT_ACTIVATE_IGNORE_PERSISTENT;
+
+       /* Only for LUKS2 but ignored elsewhere */
+       if (opt_test_passphrase)
+               *flags |= CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY;
+
+       if (opt_serialize_memory_hard_pbkdf)
+               *flags |= CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF;
+
+       /* Only for plain */
+       if (opt_iv_large_sectors)
+               *flags |= CRYPT_ACTIVATE_IV_LARGE_SECTORS;
+}
+
+static void _set_reencryption_flags(uint32_t *flags)
+{
+       if (opt_reencrypt_init_only)
+               *flags |= CRYPT_REENCRYPT_INITIALIZE_ONLY;
+
+       if (opt_reencrypt_resume_only)
+               *flags |= CRYPT_REENCRYPT_RESUME_ONLY;
+}
+
+static int _set_keyslot_encryption_params(struct crypt_device *cd)
+{
+       const char *type = crypt_get_type(cd);
+
+       if (!opt_keyslot_key_size && !opt_keyslot_cipher)
+               return 0;
+
+       if (!type || strcmp(type, CRYPT_LUKS2)) {
+               log_err(_("Keyslot encryption parameters can be set only for LUKS2 device."));
+               return -EINVAL;
+       }
+
+       return crypt_keyslot_set_encryption(cd, opt_keyslot_cipher, opt_keyslot_key_size / 8);
 }
 
 static int action_open_plain(void)
 {
-       struct crypt_device *cd = NULL;
-       char cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
+       struct crypt_device *cd = NULL, *cd1 = NULL;
+       const char *pcipher, *pmode;
+       char *msg, cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
+       struct crypt_active_device cad;
        struct crypt_params_plain params = {
                .hash = opt_hash ?: DEFAULT_PLAIN_HASH,
                .skip = opt_skip,
                .offset = opt_offset,
                .size = opt_size,
+               .sector_size = opt_sector_size ?: SECTOR_SIZE
        };
        char *password = NULL;
-       size_t passwordLen;
-       size_t key_size = (opt_key_size ?: DEFAULT_PLAIN_KEYBITS) / 8;
+       const char *activated_name = NULL;
+       size_t passwordLen, key_size_max, signatures = 0,
+              key_size = (opt_key_size ?: DEFAULT_PLAIN_KEYBITS) / 8;
        uint32_t activate_flags = 0;
-       int keyfile_limited = 0;
        int r;
 
        r = crypt_parse_name_and_mode(opt_cipher ?: DEFAULT_CIPHER(PLAIN),
                                      cipher, NULL, cipher_mode);
        if (r < 0) {
-               log_err(_("No known cipher specification pattern detected.\n"));
+               log_err(_("No known cipher specification pattern detected."));
                goto out;
        }
 
-       if (opt_key_file && strcmp(opt_key_file, "-") != 0)
-               keyfile_limited = 1;
-
        /* FIXME: temporary hack, no hashing for keyfiles in plain mode */
-       if (opt_key_file && keyfile_limited) {
+       if (opt_key_file && !tools_is_stdin(opt_key_file)) {
                params.hash = NULL;
                if (!opt_batch_mode && opt_hash)
                        log_std(_("WARNING: The --hash parameter is being ignored "
@@ -148,18 +263,65 @@ static int action_open_plain(void)
        if (params.hash && !strcmp(params.hash, "plain"))
                params.hash = NULL;
 
-       if (!opt_batch_mode && !params.hash && opt_key_file && keyfile_limited && opt_keyfile_size)
+       if (!opt_batch_mode && !params.hash && opt_key_file && !tools_is_stdin(opt_key_file) && opt_keyfile_size)
                log_std(_("WARNING: The --keyfile-size option is being ignored, "
                         "the read size is the same as the encryption key size.\n"));
 
-       if ((r = crypt_init(&cd, action_argv[0])))
-               goto out;
+       if (opt_refresh) {
+               activated_name = action_argc > 1 ? action_argv[1] : action_argv[0];
+               r = crypt_init_by_name_and_header(&cd1, activated_name, NULL);
+               if (r)
+                       goto out;
+               r = crypt_get_active_device(cd1, activated_name, &cad);
+               if (r)
+                       goto out;
+
+               /* copy known parameters from existing device */
+               params.skip = crypt_get_iv_offset(cd1);
+               params.offset = crypt_get_data_offset(cd1);
+               params.size = cad.size;
+               params.sector_size = crypt_get_sector_size(cd1);
+               key_size = crypt_get_volume_key_size(cd1);
+
+               if ((r = crypt_init(&cd, crypt_get_device_name(cd1))))
+                       goto out;
+
+               activate_flags |= CRYPT_ACTIVATE_REFRESH;
+
+               pcipher = crypt_get_cipher(cd1);
+               pmode = crypt_get_cipher_mode(cd1);
+       } else {
+               activated_name = action_argv[1];
+               if ((r = crypt_init(&cd, action_argv[0])))
+                       goto out;
+
+               /* Skip blkid scan when activating plain device with offset */
+               if (!opt_offset) {
+                       /* Print all present signatures in read-only mode */
+                       r = tools_detect_signatures(action_argv[0], 0, &signatures);
+                       if (r < 0)
+                               goto out;
+               }
+
+               if (signatures) {
+                       r = asprintf(&msg, _("Detected device signature(s) on %s. Proceeding further may damage existing data."), action_argv[0]);
+                       if (r == -1) {
+                               r = -ENOMEM;
+                               goto out;
+                       }
+
+                       r = yesDialog(msg, _("Operation aborted.\n")) ? 0 : -EINVAL;
+                       free(msg);
+                       if (r < 0)
+                               goto out;
+               }
 
-       crypt_set_timeout(cd, opt_timeout);
-       crypt_set_password_retry(cd, opt_tries);
+               pcipher = cipher;
+               pmode = cipher_mode;
+       }
 
        r = crypt_format(cd, CRYPT_PLAIN,
-                        cipher, cipher_mode,
+                        pcipher, pmode,
                         NULL, NULL,
                         key_size,
                         &params);
@@ -172,31 +334,31 @@ static int action_open_plain(void)
 
        _set_activation_flags(&activate_flags);
 
-       if (opt_key_file) {
+       if (!tools_is_stdin(opt_key_file)) {
                /* If no hash, key is read directly, read size is always key_size
                 * (possible opt_keyfile_size is ignored.
                 * If hash is specified, opt_keyfile_size is applied.
                 * The opt_keyfile_offset is applied always.
                 */
-               r = crypt_activate_by_keyfile_offset(cd, action_argv[1],
-                       CRYPT_ANY_SLOT, opt_key_file,
-                       params.hash ? opt_keyfile_size : key_size, opt_keyfile_offset,
-                       activate_flags);
+               key_size_max = params.hash ? (size_t)opt_keyfile_size : key_size;
+               r = crypt_activate_by_keyfile_device_offset(cd, action_argv[1],
+                       CRYPT_ANY_SLOT, opt_key_file, key_size_max,
+                       opt_keyfile_offset, activate_flags);
        } else {
-               r = tools_get_key(_("Enter passphrase: "),
-                                 &password, &passwordLen,
-                                 opt_keyfile_offset, opt_keyfile_size,
-                                 NULL, opt_timeout,
-                                 _verify_passphrase(0), 0,
-                                 cd);
+               key_size_max = (opt_key_file && !params.hash) ? key_size : (size_t)opt_keyfile_size;
+               r = tools_get_key(NULL, &password, &passwordLen,
+                                 opt_keyfile_offset, key_size_max,
+                                 opt_key_file, opt_timeout,
+                                 _verify_passphrase(0), 0, cd);
                if (r < 0)
                        goto out;
 
-               r = crypt_activate_by_passphrase(cd, action_argv[1],
+               r = crypt_activate_by_passphrase(cd, activated_name,
                        CRYPT_ANY_SLOT, password, passwordLen, activate_flags);
        }
 out:
        crypt_free(cd);
+       crypt_free(cd1);
        crypt_safe_free(password);
 
        return r;
@@ -212,27 +374,36 @@ static int action_open_loopaes(void)
        };
        unsigned int key_size = (opt_key_size ?: DEFAULT_LOOPAES_KEYBITS) / 8;
        uint32_t activate_flags = 0;
+       const char *activated_name = NULL;
        int r;
 
        if (!opt_key_file) {
-               log_err(_("Option --key-file is required.\n"));
+               log_err(_("Option --key-file is required."));
                return -EINVAL;
        }
 
-       _set_activation_flags(&activate_flags);
+       if (opt_refresh) {
+               activated_name = action_argc > 1 ? action_argv[1] : action_argv[0];
+               if ((r = crypt_init_by_name(&cd, activated_name)))
+                       goto out;
+               activate_flags |= CRYPT_ACTIVATE_REFRESH;
+       } else {
+               activated_name = action_argv[1];
+               if ((r = crypt_init(&cd, action_argv[0])))
+                       goto out;
 
-       if ((r = crypt_init(&cd, action_argv[0])))
-               goto out;
+               r = crypt_format(cd, CRYPT_LOOPAES, opt_cipher ?: DEFAULT_LOOPAES_CIPHER,
+                                NULL, NULL, NULL, key_size, &params);
+               check_signal(&r);
+               if (r < 0)
+                       goto out;
+       }
 
-       r = crypt_format(cd, CRYPT_LOOPAES, opt_cipher ?: DEFAULT_LOOPAES_CIPHER,
-                        NULL, NULL, NULL, key_size, &params);
-       check_signal(&r);
-       if (r < 0)
-               goto out;
+       _set_activation_flags(&activate_flags);
 
-       r = crypt_activate_by_keyfile_offset(cd, action_argv[1], CRYPT_ANY_SLOT,
-                                     opt_key_file, opt_keyfile_size,
-                                     opt_keyfile_offset, activate_flags);
+       r = crypt_activate_by_keyfile_device_offset(cd, activated_name, CRYPT_ANY_SLOT,
+               tools_is_stdin(opt_key_file) ? "/dev/stdin" : opt_key_file, opt_keyfile_size,
+               opt_keyfile_offset, activate_flags);
 out:
        crypt_free(cd);
 
@@ -243,15 +414,49 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
 {
        int r, tries = opt_tries, eperm = 0;
 
+       if (opt_keyfile_stdin)
+               tries = 1;
+
        do {
                /* TCRYPT header is encrypted, get passphrase now */
-               r = tools_get_key(_("Enter passphrase: "),
-                                 CONST_CAST(char**)&params->passphrase,
-                                 &params->passphrase_size, 0, 0, NULL, opt_timeout,
+               r = tools_get_key(NULL, CONST_CAST(char**)&params->passphrase,
+                                 &params->passphrase_size, 0, 0, opt_keyfile_stdin, opt_timeout,
                                 _verify_passphrase(0), 0, cd);
                if (r < 0)
                        continue;
 
+               if (opt_veracrypt_query_pim) {
+                       char *tmp_pim_nptr = NULL;
+                       char *tmp_pim_end = NULL;
+                       size_t tmp_pim_size = 0;
+                       unsigned long long tmp_pim_ull = 0;
+
+                       r = tools_get_key(_("Enter VeraCrypt PIM: "),
+                                       CONST_CAST(char**)&tmp_pim_nptr,
+                                       &tmp_pim_size, 0, 0, opt_keyfile_stdin, opt_timeout,
+                                       _verify_passphrase(0), 0, cd);
+                       if (r < 0)
+                               continue;
+
+                       tmp_pim_ull = strtoull(tmp_pim_nptr, &tmp_pim_end, 10);
+                       if (*tmp_pim_nptr == '\0' || !tmp_pim_end || *tmp_pim_end != '\0') {
+                               log_err(_("Invalid PIM value: parse error."));
+                               r = -EINVAL;
+                       } else if (tmp_pim_ull == 0) {
+                               log_err(_("Invalid PIM value: 0."));
+                               r = -EINVAL;
+                       } else if (tmp_pim_ull > UINT32_MAX) {
+                               log_err(_("Invalid PIM value: outside of range."));
+                               r = -ERANGE;
+                       }
+                       crypt_safe_free(CONST_CAST(char*)tmp_pim_nptr);
+                       if (r < 0)
+                               continue;
+
+                       params->veracrypt_pim = (uint32_t)tmp_pim_ull;
+                       crypt_safe_memzero(&tmp_pim_ull, sizeof(tmp_pim_ull));
+               }
+
                if (opt_tcrypt_hidden)
                        params->flags |= CRYPT_TCRYPT_HIDDEN_HEADER;
 
@@ -264,7 +469,7 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
                r = crypt_load(cd, CRYPT_TCRYPT, params);
 
                if (r == -EPERM) {
-                       log_err(_("No device header detected with this passphrase.\n"));
+                       log_err(_("No device header detected with this passphrase."));
                        eperm = 1;
                }
 
@@ -274,7 +479,7 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
                        params->passphrase_size = 0;
                }
                check_signal(&r);
-       } while (r == -EPERM && (--tries > 0));
+       } while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
 
        /* Report wrong passphrase if at least one try failed */
        if (eperm && r == -EPIPE)
@@ -291,6 +496,7 @@ static int action_open_tcrypt(void)
                .keyfiles_count = opt_keyfiles_count,
                .flags = CRYPT_TCRYPT_LEGACY_MODES |
                         (opt_veracrypt ? CRYPT_TCRYPT_VERA_MODES : 0),
+               .veracrypt_pim = (opt_veracrypt_pim > 0) ? opt_veracrypt_pim : 0,
        };
        const char *activated_name;
        uint32_t activate_flags = 0;
@@ -312,6 +518,49 @@ static int action_open_tcrypt(void)
 out:
        crypt_free(cd);
        crypt_safe_free(CONST_CAST(char*)params.passphrase);
+       crypt_safe_memzero(&params.veracrypt_pim, sizeof(params.veracrypt_pim));
+       return r;
+}
+
+static int action_open_bitlk(void)
+{
+       struct crypt_device *cd = NULL;
+       const char *activated_name;
+       uint32_t activate_flags = 0;
+       int r, tries;
+       char *password = NULL;
+       size_t passwordLen;
+
+       activated_name = opt_test_passphrase ? NULL : action_argv[1];
+
+       if ((r = crypt_init(&cd, action_argv[0])))
+               goto out;
+
+       r = crypt_load(cd, CRYPT_BITLK, NULL);
+       if (r < 0) {
+               log_err(_("Device %s is not a valid BITLK device."), action_argv[0]);
+               goto out;
+       }
+       _set_activation_flags(&activate_flags);
+
+       tries = (tools_is_stdin(opt_key_file) && isatty(STDIN_FILENO)) ? opt_tries : 1;
+       do {
+               r = tools_get_key(NULL, &password, &passwordLen,
+                               opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                               opt_timeout, _verify_passphrase(0), 0, cd);
+               if (r < 0)
+                       goto out;
+
+               r = crypt_activate_by_passphrase(cd, activated_name, CRYPT_ANY_SLOT,
+                                                password, passwordLen, activate_flags);
+               tools_passphrase_msg(r);
+               check_signal(&r);
+               crypt_safe_free(password);
+               password = NULL;
+       } while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
+out:
+       crypt_safe_free(password);
+       crypt_free(cd);
        return r;
 }
 
@@ -365,6 +614,7 @@ static int action_tcryptDump(void)
                .keyfiles_count = opt_keyfiles_count,
                .flags = CRYPT_TCRYPT_LEGACY_MODES |
                         (opt_veracrypt ? CRYPT_TCRYPT_VERA_MODES : 0),
+               .veracrypt_pim = (opt_veracrypt_pim > 0) ? opt_veracrypt_pim : 0,
        };
        int r;
 
@@ -385,14 +635,44 @@ out:
        return r;
 }
 
+static int action_bitlkDump(void)
+{
+       struct crypt_device *cd = NULL;
+       int r;
+
+       if ((r = crypt_init(&cd, action_argv[0])))
+               goto out;
+
+       r = crypt_load(cd, CRYPT_BITLK, NULL);
+       if (r < 0)
+               goto out;
+
+       r = crypt_dump(cd);
+out:
+       crypt_free(cd);
+       return r;
+}
+
 static int action_close(void)
 {
        struct crypt_device *cd = NULL;
+       crypt_status_info ci;
+       uint32_t flags = 0;
        int r;
 
+       if (opt_deferred_remove)
+               flags |= CRYPT_DEACTIVATE_DEFERRED;
+
        r = crypt_init_by_name(&cd, action_argv[0]);
        if (r == 0)
-               r = crypt_deactivate(cd, action_argv[0]);
+               r = crypt_deactivate_by_name(cd, action_argv[0], flags);
+
+       if (!r && opt_deferred_remove) {
+               ci = crypt_status(cd, action_argv[0]);
+               if (ci == CRYPT_ACTIVE || ci == CRYPT_BUSY)
+                       log_std(_("Device %s is still active and scheduled for deferred removal.\n"),
+                                 action_argv[0]);
+       }
 
        crypt_free(cd);
        return r;
@@ -400,13 +680,56 @@ static int action_close(void)
 
 static int action_resize(void)
 {
-       struct crypt_device *cd = NULL;
        int r;
+       size_t passwordLen;
+       struct crypt_active_device cad;
+       char *password = NULL;
+       struct crypt_device *cd = NULL;
 
        r = crypt_init_by_name_and_header(&cd, action_argv[0], opt_header_device);
-       if (r == 0)
-               r = crypt_resize(cd, action_argv[0], opt_size);
+       if (r)
+               goto out;
+
+       /* FIXME: LUKS2 may enforce fixed size and it must not be changed */
+       r = crypt_get_active_device(cd, action_argv[0], &cad);
+       if (r)
+               goto out;
+
+       if (cad.flags & CRYPT_ACTIVATE_KEYRING_KEY) {
+               if (opt_disable_keyring) {
+                       r = -EINVAL;
+                       log_err(_("Resize of active device requires volume key "
+                                 "in keyring but --disable-keyring option is set."));
+                               goto out;
+               }
+
+               /* try load VK in kernel keyring using token */
+               r = crypt_activate_by_token(cd, NULL, opt_token, NULL,
+                                           CRYPT_ACTIVATE_KEYRING_KEY);
+               tools_keyslot_msg(r, UNLOCKED);
+               if (r < 0 && opt_token_only)
+                       goto out;
+
+               r = tools_get_key(NULL, &password, &passwordLen,
+                                 opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                                 opt_timeout, _verify_passphrase(0), 0, cd);
+               if (r < 0)
+                       goto out;
 
+               r = crypt_activate_by_passphrase(cd, NULL, opt_key_slot,
+                                                password, passwordLen,
+                                                CRYPT_ACTIVATE_KEYRING_KEY);
+               tools_passphrase_msg(r);
+               tools_keyslot_msg(r, UNLOCKED);
+               crypt_safe_free(password);
+       }
+
+       if (opt_device_size)
+               opt_size = opt_device_size / SECTOR_SIZE;
+
+       if (r >= 0)
+               r = crypt_resize(cd, action_argv[0], opt_size);
+out:
        crypt_free(cd);
        return r;
 }
@@ -414,7 +737,9 @@ static int action_resize(void)
 static int action_status(void)
 {
        crypt_status_info ci;
+       crypt_reencrypt_info ri;
        struct crypt_active_device cad;
+       struct crypt_params_integrity ip = {};
        struct crypt_device *cd = NULL;
        char *backing_file;
        const char *device;
@@ -451,27 +776,45 @@ static int action_status(void)
 
                log_std("  type:    %s\n", crypt_get_type(cd) ?: "n/a");
 
+               /* Print only CRYPT type devices */
+               if (!crypt_get_cipher(cd))
+                       goto out;
+
+               ri = crypt_reencrypt_status(cd, NULL);
+               if (ri > CRYPT_REENCRYPT_NONE && ri < CRYPT_REENCRYPT_INVALID)
+                       log_std("  reencryption:  in-progress\n");
+
                r = crypt_get_active_device(cd, action_argv[0], &cad);
                if (r < 0)
                        goto out;
 
+               r = crypt_get_integrity_info(cd, &ip);
+               if (r < 0 && r != -ENOTSUP)
+                       goto out;
+
                log_std("  cipher:  %s-%s\n", crypt_get_cipher(cd), crypt_get_cipher_mode(cd));
                log_std("  keysize: %d bits\n", crypt_get_volume_key_size(cd) * 8);
+               log_std("  key location: %s\n", (cad.flags & CRYPT_ACTIVATE_KEYRING_KEY) ? "keyring" : "dm-crypt");
+               if (ip.integrity)
+                       log_std("  integrity: %s\n", ip.integrity);
+               if (ip.integrity_key_size)
+                       log_std("  integrity keysize: %d bits\n", ip.integrity_key_size * 8);
                device = crypt_get_device_name(cd);
                log_std("  device:  %s\n", device);
-               if (crypt_loop_device(device)) {
-                       backing_file = crypt_loop_backing_file(device);
+               if ((backing_file = crypt_loop_backing_file(device))) {
                        log_std("  loop:    %s\n", backing_file);
                        free(backing_file);
                }
+               log_std("  sector size:  %d\n", crypt_get_sector_size(cd));
                log_std("  offset:  %" PRIu64 " sectors\n", cad.offset);
                log_std("  size:    %" PRIu64 " sectors\n", cad.size);
                if (cad.iv_offset)
                        log_std("  skipped: %" PRIu64 " sectors\n", cad.iv_offset);
-               log_std("  mode:    %s\n", cad.flags & CRYPT_ACTIVATE_READONLY ?
-                                          "readonly" : "read/write");
+               log_std("  mode:    %s%s\n", cad.flags & CRYPT_ACTIVATE_READONLY ?
+                                          "readonly" : "read/write",
+                                          (cad.flags & CRYPT_ACTIVATE_SUSPENDED) ? " (suspended)" : "");
                if (cad.flags & (CRYPT_ACTIVATE_ALLOW_DISCARDS|
-                                CRYPT_ACTIVATE_ALLOW_DISCARDS|
+                                CRYPT_ACTIVATE_SAME_CPU_CRYPT|
                                 CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS))
                        log_std("  flags:   %s%s%s\n",
                                (cad.flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) ? "discards " : "",
@@ -485,36 +828,77 @@ out:
        return r;
 }
 
-static int action_benchmark_kdf(const char *hash)
+static int benchmark_callback(uint32_t time_ms, void *usrptr)
 {
-       uint64_t kdf_iters;
-       int r;
+       struct crypt_pbkdf_type *pbkdf = usrptr;
+       int r = 0;
 
-       r = crypt_benchmark_kdf(NULL, "pbkdf2", hash, "foo", 3, "bar", 3,
-                               &kdf_iters);
-       if (r < 0)
-               log_std("PBKDF2-%-9s     N/A\n", hash);
+       check_signal(&r);
+       if (r)
+               log_err(_("Benchmark interrupted."));
        else
-               log_std("PBKDF2-%-9s %7" PRIu64 " iterations per second\n",
-                       hash, kdf_iters);
+               log_dbg("PBKDF benchmark: memory cost = %u, iterations = %u, "
+                       "threads = %u (took %u ms)", pbkdf->max_memory_kb,
+                       pbkdf->iterations, pbkdf->parallel_threads, time_ms);
+       return r;
+}
+
+static int action_benchmark_kdf(const char *kdf, const char *hash, size_t key_size)
+{
+       int r;
+       if (!strcmp(kdf, CRYPT_KDF_PBKDF2)) {
+               struct crypt_pbkdf_type pbkdf = {
+                       .type = CRYPT_KDF_PBKDF2,
+                       .hash = hash,
+                       .time_ms = 1000,
+               };
+
+               r = crypt_benchmark_pbkdf(NULL, &pbkdf, "foo", 3, "bar", 3, key_size,
+                                       &benchmark_callback, &pbkdf);
+               if (r < 0)
+                       log_std(_("PBKDF2-%-9s     N/A\n"), hash);
+               else
+                       log_std(_("PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"),
+                               hash, pbkdf.iterations, key_size * 8);
+       } else {
+               struct crypt_pbkdf_type pbkdf = {
+                       .type = kdf,
+                       .time_ms = opt_iteration_time ?: DEFAULT_LUKS2_ITER_TIME,
+                       .max_memory_kb = opt_pbkdf_memory,
+                       .parallel_threads = opt_pbkdf_parallel,
+               };
+
+               r = crypt_benchmark_pbkdf(NULL, &pbkdf, "foo", 3,
+                       "0123456789abcdef0123456789abcdef", 32,
+                       key_size, &benchmark_callback, &pbkdf);
+               if (r < 0)
+                       log_std(_("%-10s N/A\n"), kdf);
+               else
+                       log_std(_("%-10s %4u iterations, %5u memory, "
+                               "%1u parallel threads (CPUs) for "
+                               "%zu-bit key (requested %u ms time)\n"), kdf,
+                               pbkdf.iterations, pbkdf.max_memory_kb, pbkdf.parallel_threads,
+                               key_size * 8, pbkdf.time_ms);
+       }
+
        return r;
 }
 
 static int benchmark_cipher_loop(const char *cipher, const char *cipher_mode,
-                                size_t volume_key_size, size_t iv_size,
+                                size_t volume_key_size,
                                 double *encryption_mbs, double *decryption_mbs)
 {
        int r, buffer_size = 1024 * 1024;
 
        do {
                r = crypt_benchmark(NULL, cipher, cipher_mode,
-                                   volume_key_size, iv_size, buffer_size,
+                                   volume_key_size, 0, buffer_size,
                                    encryption_mbs, decryption_mbs);
                if (r == -ERANGE) {
                        if (buffer_size < 1024 * 1024 * 65)
                                buffer_size *= 2;
                        else {
-                               log_err(_("Result of benchmark is not reliable.\n"));
+                               log_err(_("Result of benchmark is not reliable."));
                                r = -ENOENT;
                        }
                }
@@ -529,88 +913,93 @@ static int action_benchmark(void)
                const char *cipher;
                const char *mode;
                size_t key_size;
-               size_t iv_size;
        } bciphers[] = {
-               { "aes",     "cbc", 16, 16 },
-               { "serpent", "cbc", 16, 16 },
-               { "twofish", "cbc", 16, 16 },
-               { "aes",     "cbc", 32, 16 },
-               { "serpent", "cbc", 32, 16 },
-               { "twofish", "cbc", 32, 16 },
-               { "aes",     "xts", 32, 16 },
-               { "serpent", "xts", 32, 16 },
-               { "twofish", "xts", 32, 16 },
-               { "aes",     "xts", 64, 16 },
-               { "serpent", "xts", 64, 16 },
-               { "twofish", "xts", 64, 16 },
-               {  NULL, NULL, 0, 0 }
+               { "aes",     "cbc", 16 },
+               { "serpent", "cbc", 16 },
+               { "twofish", "cbc", 16 },
+               { "aes",     "cbc", 32 },
+               { "serpent", "cbc", 32 },
+               { "twofish", "cbc", 32 },
+               { "aes",     "xts", 32 },
+               { "serpent", "xts", 32 },
+               { "twofish", "xts", 32 },
+               { "aes",     "xts", 64 },
+               { "serpent", "xts", 64 },
+               { "twofish", "xts", 64 },
+               {  NULL, NULL, 0 }
        };
-       static const char *bkdfs[] = {
-               "sha1", "sha256", "sha512", "ripemd160", "whirlpool", NULL
+       static struct {
+               const char *type;
+               const char *hash;
+       } bkdfs[] = {
+               { CRYPT_KDF_PBKDF2,   "sha1" },
+               { CRYPT_KDF_PBKDF2,   "sha256" },
+               { CRYPT_KDF_PBKDF2,   "sha512" },
+               { CRYPT_KDF_PBKDF2,   "ripemd160" },
+               { CRYPT_KDF_PBKDF2,   "whirlpool" },
+               { CRYPT_KDF_ARGON2I,  NULL },
+               { CRYPT_KDF_ARGON2ID, NULL },
+               { NULL, NULL }
        };
        char cipher[MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
        double enc_mbr = 0, dec_mbr = 0;
-       int key_size = (opt_key_size ?: DEFAULT_PLAIN_KEYBITS);
-       int iv_size = 16, skipped = 0;
+       int key_size = (opt_key_size ?: DEFAULT_PLAIN_KEYBITS) / 8;
+       int skipped = 0, width;
        char *c;
        int i, r;
 
        log_std(_("# Tests are approximate using memory only (no storage IO).\n"));
-       if (opt_hash) {
-               r = action_benchmark_kdf(opt_hash);
+       if (opt_pbkdf || opt_hash) {
+               if (!opt_pbkdf && opt_hash)
+                       opt_pbkdf = CRYPT_KDF_PBKDF2;
+               r = action_benchmark_kdf(opt_pbkdf, opt_hash, key_size);
        } else if (opt_cipher) {
                r = crypt_parse_name_and_mode(opt_cipher, cipher, NULL, cipher_mode);
                if (r < 0) {
-                       log_err(_("No known cipher specification pattern detected.\n"));
+                       log_err(_("No known cipher specification pattern detected."));
                        return r;
                }
                if ((c  = strchr(cipher_mode, '-')))
                        *c = '\0';
 
-               /* FIXME: not really clever :) */
-               if (strstr(cipher, "des") ||
-                   strstr(cipher, "blowfish") ||
-                   strstr(cipher, "cast5"))
-                       iv_size = 8;
-
-               if (!strcmp(cipher_mode, "ecb"))
-                       iv_size = 0;
-
-               r = benchmark_cipher_loop(cipher, cipher_mode,
-                                         key_size / 8, iv_size,
-                                         &enc_mbr, &dec_mbr);
+               r = benchmark_cipher_loop(cipher, cipher_mode, key_size, &enc_mbr, &dec_mbr);
                if (!r) {
-                       log_std(N_("#  Algorithm | Key |  Encryption |  Decryption\n"));
-                       log_std("%8s-%s  %4db  %6.1f MiB/s  %6.1f MiB/s\n",
-                               cipher, cipher_mode, key_size, enc_mbr, dec_mbr);
-               } else if (r == -ENOENT)
-                       log_err(_("Cipher %s is not available.\n"), opt_cipher);
+                       width = strlen(cipher) + strlen(cipher_mode) + 1;
+                       if (width < 11)
+                               width = 11;
+                       /* TRANSLATORS: The string is header of a table and must be exactly (right side) aligned. */
+                       log_std(_("#%*s Algorithm |       Key |      Encryption |      Decryption\n"), width - 11, "");
+                       log_std("%*s-%s  %9db  %10.1f MiB/s  %10.1f MiB/s\n", width - (int)strlen(cipher_mode) - 1,
+                               cipher, cipher_mode, key_size*8, enc_mbr, dec_mbr);
+               } else if (r < 0)
+                       log_err(_("Cipher %s (with %i bits key) is not available."), opt_cipher, key_size * 8);
        } else {
-               for (i = 0; bkdfs[i]; i++) {
-                       r = action_benchmark_kdf(bkdfs[i]);
+               for (i = 0; bkdfs[i].type; i++) {
+                       r = action_benchmark_kdf(bkdfs[i].type, bkdfs[i].hash, key_size);
                        check_signal(&r);
                        if (r == -EINTR)
                                break;
                }
+
                for (i = 0; bciphers[i].cipher; i++) {
                        r = benchmark_cipher_loop(bciphers[i].cipher, bciphers[i].mode,
-                                           bciphers[i].key_size, bciphers[i].iv_size,
-                                           &enc_mbr, &dec_mbr);
+                                                 bciphers[i].key_size, &enc_mbr, &dec_mbr);
                        check_signal(&r);
                        if (r == -ENOTSUP || r == -EINTR)
                                break;
                        if (r == -ENOENT)
                                skipped++;
                        if (i == 0)
-                               log_std(N_("#  Algorithm | Key |  Encryption |  Decryption\n"));
+                               /* TRANSLATORS: The string is header of a table and must be exactly (right side) aligned. */
+                               log_std(_("#     Algorithm |       Key |      Encryption |      Decryption\n"));
 
                        snprintf(cipher, MAX_CIPHER_LEN, "%s-%s",
                                 bciphers[i].cipher, bciphers[i].mode);
                        if (!r)
-                               log_std("%12s  %4zub  %6.1f MiB/s  %6.1f MiB/s\n",
+                               log_std("%15s  %9zub  %10.1f MiB/s  %10.1f MiB/s\n",
                                        cipher, bciphers[i].key_size*8, enc_mbr, dec_mbr);
                        else
-                               log_std("%12s  %4zub %13s %13s\n", cipher,
+                               log_std("%15s  %9zub %17s %17s\n", cipher,
                                        bciphers[i].key_size*8, _("N/A"), _("N/A"));
                }
                if (skipped && skipped == i)
@@ -618,38 +1007,114 @@ static int action_benchmark(void)
        }
 
        if (r == -ENOTSUP) {
-               log_err(_("Required kernel crypto interface not available.\n"));
+               log_err(_("Required kernel crypto interface not available."));
 #ifdef ENABLE_AF_ALG
-               log_err( _("Ensure you have algif_skcipher kernel module loaded.\n"));
+               log_err( _("Ensure you have algif_skcipher kernel module loaded."));
 #endif
        }
        return r;
 }
 
-static int _read_mk(const char *file, char **key, int keysize)
+static int set_pbkdf_params(struct crypt_device *cd, const char *dev_type)
 {
-       int fd;
+       const struct crypt_pbkdf_type *pbkdf_default;
+       struct crypt_pbkdf_type pbkdf = {};
 
-       *key = crypt_safe_alloc(keysize);
-       if (!*key)
-               return -ENOMEM;
+       pbkdf_default = crypt_get_pbkdf_default(dev_type);
+       if (!pbkdf_default)
+               return -EINVAL;
 
-       fd = open(file, O_RDONLY);
-       if (fd == -1) {
-               log_err(_("Cannot read keyfile %s.\n"), file);
-               goto fail;
+       pbkdf.type = opt_pbkdf ?: pbkdf_default->type;
+       pbkdf.hash = opt_hash ?: pbkdf_default->hash;
+       pbkdf.time_ms = (uint32_t)opt_iteration_time ?: pbkdf_default->time_ms;
+       if (strcmp(pbkdf.type, CRYPT_KDF_PBKDF2)) {
+               pbkdf.max_memory_kb = (uint32_t)opt_pbkdf_memory ?: pbkdf_default->max_memory_kb;
+               pbkdf.parallel_threads = (uint32_t)opt_pbkdf_parallel ?: pbkdf_default->parallel_threads;
        }
-       if ((read(fd, *key, keysize) != keysize)) {
-               log_err(_("Cannot read %d bytes from keyfile %s.\n"), keysize, file);
-               close(fd);
-               goto fail;
+
+       if (opt_pbkdf_iterations) {
+               pbkdf.iterations = opt_pbkdf_iterations;
+               pbkdf.time_ms = 0;
+               pbkdf.flags |= CRYPT_PBKDF_NO_BENCHMARK;
        }
-       close(fd);
-       return 0;
-fail:
-       crypt_safe_free(*key);
-       *key = NULL;
-       return -EINVAL;
+
+       return crypt_set_pbkdf_type(cd, &pbkdf);
+}
+
+static int set_keyslot_params(struct crypt_device *cd, int keyslot)
+{
+       const char *cipher;
+       struct crypt_pbkdf_type pbkdf;
+       size_t key_size;
+
+       cipher = crypt_keyslot_get_encryption(cd, keyslot, &key_size);
+       if (!cipher)
+               return -EINVAL;
+
+       if (crypt_keyslot_set_encryption(cd, cipher, key_size))
+               return -EINVAL;
+
+       /* if requested any of those just reinitialize context pbkdf */
+       if (opt_pbkdf || opt_hash || opt_pbkdf_iterations || opt_iteration_time)
+               return set_pbkdf_params(cd, CRYPT_LUKS2);
+
+       if (crypt_keyslot_get_pbkdf(cd, keyslot, &pbkdf))
+               return -EINVAL;
+
+       pbkdf.flags |= CRYPT_PBKDF_NO_BENCHMARK;
+
+       return crypt_set_pbkdf_type(cd, &pbkdf);
+}
+
+static int _do_luks2_reencrypt_recovery(struct crypt_device *cd)
+{
+       int r;
+       size_t passwordLen;
+       char *password = NULL;
+       struct crypt_params_reencrypt recovery_params = {
+               .flags = CRYPT_REENCRYPT_RECOVERY
+       };
+
+       crypt_reencrypt_info ri = crypt_reencrypt_status(cd, NULL);
+       switch (ri) {
+       case CRYPT_REENCRYPT_NONE:
+               /* fall through */
+       case CRYPT_REENCRYPT_CLEAN:
+               r = noDialog(_("Seems device does not require reencryption recovery.\n"
+                               "Do you want to proceed anyway?"), NULL);
+               if (!r)
+                       return 0;
+               break;
+       case CRYPT_REENCRYPT_CRASH:
+               r = yesDialog(_("Really proceed with LUKS2 reencryption recovery?"),
+                             _("Operation aborted.\n"));
+               if (!r)
+                       return -EINVAL;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       r = tools_get_key(_("Enter passphrase for reencryption recovery: "),
+                         &password, &passwordLen, opt_keyfile_offset,
+                         opt_keyfile_size, opt_key_file, opt_timeout,
+                         _verify_passphrase(0), 0, cd);
+       if (r < 0)
+               return r;
+
+       r = crypt_activate_by_passphrase(cd, NULL, opt_key_slot,
+                                        password, passwordLen, 0);
+       if (r < 0)
+               goto out;
+
+       r = crypt_reencrypt_init_by_passphrase(cd, NULL, password, passwordLen,
+                       opt_key_slot, opt_key_slot, NULL, NULL, &recovery_params);
+       if (r > 0)
+               r = 0;
+out:
+       crypt_safe_free(password);
+
+       return r;
 }
 
 static int action_luksRepair(void)
@@ -657,183 +1122,394 @@ static int action_luksRepair(void)
        struct crypt_device *cd = NULL;
        int r;
 
-       if ((r = crypt_init(&cd, action_argv[0])))
+       if ((r = crypt_init_data_device(&cd, opt_header_device ?: action_argv[0],
+                                       action_argv[0])))
                goto out;
 
-       /* Currently only LUKS1 allows repair */
        crypt_set_log_callback(cd, quiet_log, NULL);
-       r = crypt_load(cd, CRYPT_LUKS1, NULL);
+       r = crypt_load(cd, luksType(opt_type), NULL);
        crypt_set_log_callback(cd, tool_log, NULL);
        if (r == 0) {
-               log_verbose(_("No known problems detected for LUKS header.\n"));
-               goto out;
+               log_verbose(_("No known problems detected for LUKS header."));
+               goto skip_repair;
        }
 
+       r = tools_detect_signatures(action_argv[0], 1, NULL);
+       if (r < 0)
+               goto out;
+
        r = yesDialog(_("Really try to repair LUKS device header?"),
-                      NULL) ? 0 : -EINVAL;
+                      _("Operation aborted.\n")) ? 0 : -EINVAL;
        if (r == 0)
-               r = crypt_repair(cd, CRYPT_LUKS1, NULL);
+               r = crypt_repair(cd, luksType(opt_type), NULL);
+skip_repair:
+       if (!r && crypt_get_type(cd) && !strcmp(crypt_get_type(cd), CRYPT_LUKS2))
+               r = _do_luks2_reencrypt_recovery(cd);
 out:
        crypt_free(cd);
        return r;
 }
 
-static int action_luksFormat(void)
+static int _wipe_data_device(struct crypt_device *cd)
 {
-       int r = -EINVAL, keysize;
-       const char *header_device;
-       char *msg = NULL, *key = NULL, cipher [MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
-       char *password = NULL;
-       size_t passwordLen;
+       char tmp_name[64], tmp_path[128], tmp_uuid[40];
+       uuid_t tmp_uuid_bin;
+       int r;
+
+       if (!opt_batch_mode)
+               log_std(_("Wiping device to initialize integrity checksum.\n"
+                       "You can interrupt this by pressing CTRL+c "
+                       "(rest of not wiped device will contain invalid checksum).\n"));
+
+       /* Activate the device a temporary one */
+       uuid_generate(tmp_uuid_bin);
+       uuid_unparse(tmp_uuid_bin, tmp_uuid);
+       if (snprintf(tmp_name, sizeof(tmp_name), "temporary-cryptsetup-%s", tmp_uuid) < 0)
+               return -EINVAL;
+       if (snprintf(tmp_path, sizeof(tmp_path), "%s/%s", crypt_get_dir(), tmp_name) < 0)
+               return -EINVAL;
+
+       r = crypt_activate_by_volume_key(cd, tmp_name, NULL, 0,
+               CRYPT_ACTIVATE_PRIVATE | CRYPT_ACTIVATE_NO_JOURNAL);
+       if (r < 0)
+               return r;
+
+       /* Wipe the device */
+       set_int_handler(0);
+       r = crypt_wipe(cd, tmp_path, CRYPT_WIPE_ZERO, 0, 0, DEFAULT_WIPE_BLOCK,
+                      0, &tools_wipe_progress, NULL);
+       if (crypt_deactivate(cd, tmp_name))
+               log_err(_("Cannot deactivate temporary device %s."), tmp_path);
+       set_int_block(0);
+
+       return r;
+}
+
+static int strcmp_or_null(const char *str, const char *expected)
+{
+       return !str ? 0 : strcmp(str, expected);
+}
+
+static int _luksFormat(struct crypt_device **r_cd, char **r_password, size_t *r_passwordLen)
+{
+       int r = -EINVAL, keysize, integrity_keysize = 0, fd, created = 0;
+       struct stat st;
+       const char *header_device, *type;
+       char *msg = NULL, *key = NULL, *password = NULL;
+       char cipher [MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN], integrity[MAX_CIPHER_LEN];
+       size_t passwordLen, signatures;
        struct crypt_device *cd = NULL;
-       struct crypt_params_luks1 params = {
+       struct crypt_params_luks1 params1 = {
                .hash = opt_hash ?: DEFAULT_LUKS1_HASH,
                .data_alignment = opt_align_payload,
                .data_device = opt_header_device ? action_argv[0] : NULL,
        };
+       struct crypt_params_luks2 params2 = {
+               .data_alignment = params1.data_alignment,
+               .data_device = params1.data_device,
+               .sector_size = opt_sector_size ?: SECTOR_SIZE,
+               .label = opt_label,
+               .subsystem = opt_subsystem
+       };
+       void *params;
 
-       header_device = opt_header_device ?: action_argv[0];
+       type = luksType(opt_type);
+       if (!type)
+               type = crypt_get_default_type();
 
-       if(asprintf(&msg, _("This will overwrite data on %s irrevocably."),
-                   header_device) == -1) {
-               log_err(_("memory allocation error in action_luksFormat"));
-               r = -ENOMEM;
-               goto out;
-       }
-       r = yesDialog(msg, NULL) ? 0 : -EINVAL;
-       free(msg);
-       if (r < 0)
-               goto out;
+       if (!strcmp(type, CRYPT_LUKS2)) {
+               params = &params2;
+       } else if (!strcmp(type, CRYPT_LUKS1)) {
+               params = &params1;
 
-       r = crypt_parse_name_and_mode(opt_cipher ?: DEFAULT_CIPHER(LUKS1),
-                                     cipher, NULL, cipher_mode);
-       if (r < 0) {
-               log_err(_("No known cipher specification pattern detected.\n"));
+               if (opt_sector_size > SECTOR_SIZE) {
+                       log_err(_("Unsupported encryption sector size."));
+                       return -EINVAL;
+               }
+
+               if (opt_integrity) {
+                       log_err(_("Integrity option can be used only for LUKS2 format."));
+                       return -EINVAL;
+               }
+
+               if (opt_luks2_keyslots_size || opt_luks2_metadata_size) {
+                       log_err(_("Unsupported LUKS2 metadata size options."));
+                       return -EINVAL;
+               }
+       } else
+               return -EINVAL;
+
+       /* Create header file (must contain at least one sector)? */
+       if (opt_header_device && stat(opt_header_device, &st) < 0 && errno == ENOENT) {
+               if (!opt_batch_mode &&
+                   !yesDialog("Header file does not exist, do you want to create it?",
+                           _("Operation aborted.\n")))
+                   return -EPERM;
+
+               log_dbg("Creating header file.");
+               /* coverity[toctou] */
+               fd = open(opt_header_device, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR);
+               if (fd == -1 || posix_fallocate(fd, 0, 4096))
+                       log_err(_("Cannot create header file %s."), opt_header_device);
+               else {
+                       r = 0;
+                       created = 1;
+               }
+               if (fd != -1)
+                       close(fd);
+               if (r < 0)
+                       return r;
+       }
+
+       header_device = opt_header_device ?: action_argv[0];
+
+       r = crypt_parse_name_and_mode(opt_cipher ?: DEFAULT_CIPHER(LUKS1),
+                                     cipher, NULL, cipher_mode);
+       if (r < 0) {
+               log_err(_("No known cipher specification pattern detected."));
                goto out;
        }
 
+       if (opt_integrity) {
+               r = crypt_parse_integrity_mode(opt_integrity, integrity, &integrity_keysize);
+               if (r < 0) {
+                       log_err(_("No known integrity specification pattern detected."));
+                       goto out;
+               }
+               params2.integrity = integrity;
+               /* FIXME: we use default integrity_params (set to NULL) */
+       }
+
+       /* Never call pwquality if using null cipher */
+       if (tools_is_cipher_null(cipher))
+               opt_force_password = 1;
+
        if ((r = crypt_init(&cd, header_device))) {
                if (opt_header_device)
-                       log_err(_("Cannot use %s as on-disk header.\n"), header_device);
-               goto out;
+                       log_err(_("Cannot use %s as on-disk header."), header_device);
+               return r;
+       }
+
+       if (opt_luks2_keyslots_size || opt_luks2_metadata_size) {
+               r = crypt_set_metadata_size(cd, opt_luks2_metadata_size, opt_luks2_keyslots_size);
+               if (r < 0) {
+                       log_err(_("Unsupported LUKS2 metadata size options."));
+                       goto out;
+               }
+       }
+
+       if (opt_offset) {
+               r = crypt_set_data_offset(cd, opt_offset);
+               if (r < 0)
+                       goto out;
        }
 
-       keysize = (opt_key_size ?: DEFAULT_LUKS1_KEYBITS) / 8;
+       /* Print all present signatures in read-only mode */
+       r = tools_detect_signatures(header_device, 0, &signatures);
+       if (r < 0)
+               goto out;
+
+       if (!created) {
+               r = asprintf(&msg, _("This will overwrite data on %s irrevocably."), header_device);
+               if (r == -1) {
+                       r = -ENOMEM;
+                       goto out;
+               }
+
+               r = yesDialog(msg, _("Operation aborted.\n")) ? 0 : -EINVAL;
+               free(msg);
+               if (r < 0)
+                       goto out;
+       }
 
-       crypt_set_timeout(cd, opt_timeout);
-       if (opt_iteration_time)
-               crypt_set_iteration_time(cd, opt_iteration_time);
+#ifdef ENABLE_LUKS_ADJUST_XTS_KEYSIZE
+       if (!opt_key_size && !strncmp(cipher_mode, "xts-", 4)) {
+               if (DEFAULT_LUKS1_KEYBITS == 128)
+                       opt_key_size = 256;
+               else if (DEFAULT_LUKS1_KEYBITS == 256)
+                       opt_key_size = 512;
+       }
+#endif
+       keysize = (opt_key_size ?: DEFAULT_LUKS1_KEYBITS) / 8 + integrity_keysize;
 
        if (opt_random)
                crypt_set_rng_type(cd, CRYPT_RNG_RANDOM);
        else if (opt_urandom)
                crypt_set_rng_type(cd, CRYPT_RNG_URANDOM);
 
-       r = tools_get_key(_("Enter passphrase: "), &password, &passwordLen,
+       r = tools_get_key(NULL, &password, &passwordLen,
                          opt_keyfile_offset, opt_keyfile_size, opt_key_file,
                          opt_timeout, _verify_passphrase(1), 1, cd);
        if (r < 0)
                goto out;
 
        if (opt_master_key_file) {
-               r = _read_mk(opt_master_key_file, &key, keysize);
+               r = tools_read_mk(opt_master_key_file, &key, keysize);
                if (r < 0)
                        goto out;
        }
 
-       r = crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode,
-                        opt_uuid, key, keysize, &params);
+       r = set_pbkdf_params(cd, type);
+       if (r) {
+               log_err(_("Failed to set pbkdf parameters."));
+               goto out;
+       }
+
+       /* Signature candidates found */
+       if (signatures && ((r = tools_wipe_all_signatures(header_device)) < 0))
+               goto out;
+
+       if (opt_integrity_legacy_padding)
+               crypt_set_compatibility(cd, CRYPT_COMPAT_LEGACY_INTEGRITY_PADDING);
+
+       r = crypt_format(cd, type, cipher, cipher_mode,
+                        opt_uuid, key, keysize, params);
        check_signal(&r);
        if (r < 0)
                goto out;
 
+       r = _set_keyslot_encryption_params(cd);
+       if (r < 0)
+               goto out;
+
        r = crypt_keyslot_add_by_volume_key(cd, opt_key_slot,
                                            key, keysize,
                                            password, passwordLen);
+       if (r < 0) {
+               (void) tools_wipe_all_signatures(header_device);
+               goto out;
+       }
+       tools_keyslot_msg(r, CREATED);
+
+       if (opt_integrity && !opt_integrity_no_wipe &&
+           strcmp_or_null(params2.integrity, "none"))
+               r = _wipe_data_device(cd);
 out:
-       crypt_free(cd);
+       if (r >= 0 && r_cd && r_password && r_passwordLen) {
+               *r_cd = cd;
+               *r_password = password;
+               *r_passwordLen = passwordLen;
+       } else {
+               crypt_free(cd);
+               crypt_safe_free(password);
+       }
+
        crypt_safe_free(key);
-       crypt_safe_free(password);
 
        return r;
 }
 
+static int action_luksFormat(void)
+{
+       return _luksFormat(NULL, NULL, NULL);
+}
+
 static int action_open_luks(void)
 {
+       struct crypt_active_device cad;
        struct crypt_device *cd = NULL;
        const char *data_device, *header_device, *activated_name;
        char *key = NULL;
        uint32_t activate_flags = 0;
-       int r, keysize;
-
-       header_device = uuid_or_device_header(&data_device);
+       int r, keysize, tries;
+       char *password = NULL;
+       size_t passwordLen;
 
-       activated_name = opt_test_passphrase ? NULL : action_argv[1];
+       if (opt_refresh) {
+               activated_name = action_argc > 1 ? action_argv[1] : action_argv[0];
+               r = crypt_init_by_name_and_header(&cd, activated_name, opt_header_device);
+               if (r)
+                       goto out;
+               activate_flags |= CRYPT_ACTIVATE_REFRESH;
+       } else {
+               header_device = uuid_or_device_header(&data_device);
 
-       if ((r = crypt_init(&cd, header_device)))
-               goto out;
+               activated_name = opt_test_passphrase ? NULL : action_argv[1];
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
-               goto out;
+               if ((r = crypt_init_data_device(&cd, header_device, data_device)))
+                       goto out;
 
-       if (data_device &&
-           (r = crypt_set_data_device(cd, data_device)))
-               goto out;
+               if ((r = crypt_load(cd, luksType(opt_type), NULL))) {
+                       log_err(_("Device %s is not a valid LUKS device."),
+                               header_device);
+                       goto out;
+               }
 
-       if (!data_device && (crypt_get_data_offset(cd) < 8)) {
-               log_err(_("Reduced data offset is allowed only for detached LUKS header.\n"));
-               r = -EINVAL;
-               goto out;
+               if (!data_device && (crypt_get_data_offset(cd) < 8) && !opt_test_passphrase) {
+                       log_err(_("Reduced data offset is allowed only for detached LUKS header."));
+                       r = -EINVAL;
+                       goto out;
+               }
        }
 
-       crypt_set_timeout(cd, opt_timeout);
-       crypt_set_password_retry(cd, opt_tries);
-       crypt_set_password_verify(cd, _verify_passphrase(0));
-
-       if (opt_iteration_time)
-               crypt_set_iteration_time(cd, opt_iteration_time);
-
        _set_activation_flags(&activate_flags);
 
        if (opt_master_key_file) {
                keysize = crypt_get_volume_key_size(cd);
-               r = _read_mk(opt_master_key_file, &key, keysize);
+               if (!keysize && !opt_key_size) {
+                       log_err(_("Cannot determine volume key size for LUKS without keyslots, please use --key-size option."));
+                       r = -EINVAL;
+                       goto out;
+               } else if (!keysize)
+                       keysize = opt_key_size / 8;
+
+               r = tools_read_mk(opt_master_key_file, &key, keysize);
                if (r < 0)
                        goto out;
                r = crypt_activate_by_volume_key(cd, activated_name,
                                                 key, keysize, activate_flags);
-       } else if (opt_key_file) {
-               crypt_set_password_retry(cd, 1);
-               r = crypt_activate_by_keyfile_offset(cd, activated_name,
-                       opt_key_slot, opt_key_file, opt_keyfile_size,
-                       opt_keyfile_offset, activate_flags);
-       } else
-               r = crypt_activate_by_passphrase(cd, activated_name,
-                       opt_key_slot, NULL, 0, activate_flags);
+       } else {
+               r = crypt_activate_by_token(cd, activated_name, opt_token, NULL, activate_flags);
+               tools_keyslot_msg(r, UNLOCKED);
+               if (r >= 0 || opt_token_only)
+                       goto out;
+
+               tries = (tools_is_stdin(opt_key_file) && isatty(STDIN_FILENO)) ? opt_tries : 1;
+               do {
+                       r = tools_get_key(NULL, &password, &passwordLen,
+                                       opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                                       opt_timeout, _verify_passphrase(0), 0, cd);
+                       if (r < 0)
+                               goto out;
+
+                       r = crypt_activate_by_passphrase(cd, activated_name,
+                               opt_key_slot, password, passwordLen, activate_flags);
+                       tools_keyslot_msg(r, UNLOCKED);
+                       tools_passphrase_msg(r);
+                       check_signal(&r);
+                       crypt_safe_free(password);
+                       password = NULL;
+               } while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
+       }
 out:
+       if (r >= 0 && opt_persistent &&
+           (crypt_get_active_device(cd, activated_name, &cad) ||
+            crypt_persistent_flags_set(cd, CRYPT_FLAGS_ACTIVATION, cad.flags & activate_flags)))
+               log_err(_("Device activated but cannot make flags persistent."));
+
        crypt_safe_free(key);
+       crypt_safe_free(password);
        crypt_free(cd);
        return r;
 }
 
-static int verify_keyslot(struct crypt_device *cd, int key_slot,
-                         char *msg_last, char *msg_pass,
-                         const char *key_file, int keyfile_offset,
+static int verify_keyslot(struct crypt_device *cd, int key_slot, crypt_keyslot_info ki,
+                         char *msg_last, char *msg_pass, char *msg_fail,
+                         const char *key_file, uint64_t keyfile_offset,
                          int keyfile_size)
 {
-       crypt_keyslot_info ki;
        char *password = NULL;
        size_t passwordLen;
-       int i, r;
+       int i, max, r;
 
-       ki = crypt_keyslot_status(cd, key_slot);
-       if (ki == CRYPT_SLOT_ACTIVE_LAST && msg_last && !yesDialog(msg_last, NULL))
+       if (ki == CRYPT_SLOT_ACTIVE_LAST && !opt_batch_mode && !key_file &&
+           msg_last && !yesDialog(msg_last, msg_fail))
                return -EPERM;
 
        r = tools_get_key(msg_pass, &password, &passwordLen,
                          keyfile_offset, keyfile_size, key_file, opt_timeout,
                          _verify_passphrase(0), 0, cd);
-       if(r < 0)
+       if (r < 0)
                goto out;
 
        if (ki == CRYPT_SLOT_ACTIVE_LAST) {
@@ -842,20 +1518,27 @@ static int verify_keyslot(struct crypt_device *cd, int key_slot,
                                                 password, passwordLen, 0);
        } else {
                /* try all other keyslots */
-               for (i = 0; i < crypt_keyslot_max(CRYPT_LUKS1); i++) {
+               r = crypt_keyslot_max(crypt_get_type(cd));
+               if (r < 0)
+                       goto out;
+               max = r;
+
+               for (i = 0; i < max ; i++) {
                        if (i == key_slot)
                                continue;
-                       ki = crypt_keyslot_status(cd, key_slot);
-                       if (ki == CRYPT_SLOT_ACTIVE)
-                       r = crypt_activate_by_passphrase(cd, NULL, i,
-                                                        password, passwordLen, 0);
+                       ki = crypt_keyslot_status(cd, i);
+                       if (ki == CRYPT_SLOT_ACTIVE || ki == CRYPT_SLOT_ACTIVE_LAST)
+                               r = crypt_activate_by_passphrase(cd, NULL, i,
+                                                password, passwordLen, 0);
                        if (r == i)
                                break;
                }
        }
 
-       if (r == -EPERM)
-               log_err(_("No key available with this passphrase.\n"));
+       /* Handle inactive keyslots the same as bad password here */
+       if (r == -ENOENT)
+               r = -EPERM;
+       tools_passphrase_msg(r);
 out:
        crypt_safe_free(password);
        return r;
@@ -864,39 +1547,54 @@ out:
 static int action_luksKillSlot(void)
 {
        struct crypt_device *cd = NULL;
+       crypt_keyslot_info ki;
        int r;
 
        if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
                goto out;
 
        crypt_set_confirm_callback(cd, yesDialog, NULL);
-       crypt_set_timeout(cd, opt_timeout);
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
+       if ((r = crypt_load(cd, luksType(opt_type), NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
                goto out;
+       }
 
-       switch (crypt_keyslot_status(cd, opt_key_slot)) {
+       ki = crypt_keyslot_status(cd, opt_key_slot);
+       switch (ki) {
        case CRYPT_SLOT_ACTIVE_LAST:
        case CRYPT_SLOT_ACTIVE:
-               log_verbose(_("Key slot %d selected for deletion.\n"), opt_key_slot);
+       case CRYPT_SLOT_UNBOUND:
+               log_verbose(_("Keyslot %d is selected for deletion."), opt_key_slot);
                break;
        case CRYPT_SLOT_INACTIVE:
-               log_err(_("Key %d not active. Can't wipe.\n"), opt_key_slot);
+               log_err(_("Keyslot %d is not active."), opt_key_slot);
+               /* fall through */
        case CRYPT_SLOT_INVALID:
                r = -EINVAL;
                goto out;
        }
 
-       if (!opt_batch_mode) {
-               r = verify_keyslot(cd, opt_key_slot,
+       if (!opt_batch_mode || opt_key_file || !isatty(STDIN_FILENO)) {
+               r = verify_keyslot(cd, opt_key_slot, ki,
                        _("This is the last keyslot. Device will become unusable after purging this key."),
                        _("Enter any remaining passphrase: "),
+                       _("Operation aborted, the keyslot was NOT wiped.\n"),
                        opt_key_file, opt_keyfile_offset, opt_keyfile_size);
+               tools_keyslot_msg(r, UNLOCKED);
+
+               if (r == -EPIPE && (!opt_key_file || tools_is_stdin(opt_key_file))) {
+                       log_dbg("Failed read from input, ignoring passphrase.");
+                       r = 0;
+               }
+
                if (r < 0)
                        goto out;
        }
 
        r = crypt_keyslot_destroy(cd, opt_key_slot);
+       tools_keyslot_msg(opt_key_slot, REMOVED);
 out:
        crypt_free(cd);
        return r;
@@ -913,10 +1611,12 @@ static int action_luksRemoveKey(void)
                goto out;
 
        crypt_set_confirm_callback(cd, yesDialog, NULL);
-       crypt_set_timeout(cd, opt_timeout);
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
+       if ((r = crypt_load(cd, luksType(opt_type), NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
                goto out;
+       }
 
        r = tools_get_key(_("Enter passphrase to be deleted: "),
                      &password, &passwordLen,
@@ -929,28 +1629,94 @@ static int action_luksRemoveKey(void)
 
        r = crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT,
                                         password, passwordLen, 0);
+       tools_passphrase_msg(r);
        check_signal(&r);
        if (r < 0)
                goto out;
+       tools_keyslot_msg(r, UNLOCKED);
 
        opt_key_slot = r;
-       log_verbose(_("Key slot %d selected for deletion.\n"), opt_key_slot);
+       log_verbose(_("Keyslot %d is selected for deletion."), opt_key_slot);
 
        if (crypt_keyslot_status(cd, opt_key_slot) == CRYPT_SLOT_ACTIVE_LAST &&
            !yesDialog(_("This is the last keyslot. "
                          "Device will become unusable after purging this key."),
-                       NULL)) {
+                       _("Operation aborted, the keyslot was NOT wiped.\n"))) {
                r = -EPERM;
                goto out;
        }
 
        r = crypt_keyslot_destroy(cd, opt_key_slot);
+       tools_keyslot_msg(opt_key_slot, REMOVED);
 out:
        crypt_safe_free(password);
        crypt_free(cd);
        return r;
 }
 
+static int luksAddUnboundKey(void)
+{
+       int r = -EINVAL, keysize = 0;
+       char *key = NULL;
+       const char *opt_new_key_file = (action_argc > 1 ? action_argv[1] : NULL);
+       char *password_new = NULL;
+       size_t password_new_size = 0;
+       struct crypt_device *cd = NULL;
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               goto out;
+
+       crypt_set_confirm_callback(cd, yesDialog, NULL);
+
+       if ((r = crypt_load(cd, CRYPT_LUKS2, NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               goto out;
+       }
+
+       r = _set_keyslot_encryption_params(cd);
+       if (r < 0)
+               goto out;
+
+       /* Never call pwquality if using null cipher */
+       if (tools_is_cipher_null(crypt_get_cipher(cd)))
+               opt_force_password = 1;
+
+       keysize = opt_key_size / 8;
+       r = set_pbkdf_params(cd, crypt_get_type(cd));
+       if (r) {
+               log_err(_("Failed to set pbkdf parameters."));
+               goto out;
+       }
+
+       if (opt_master_key_file) {
+               r = tools_read_mk(opt_master_key_file, &key, keysize);
+               if (r < 0)
+                       goto out;
+
+               check_signal(&r);
+               if (r < 0)
+                       goto out;
+       }
+
+       r = tools_get_key(_("Enter new passphrase for key slot: "),
+                         &password_new, &password_new_size,
+                         opt_new_keyfile_offset, opt_new_keyfile_size,
+                         opt_new_key_file, opt_timeout,
+                         _verify_passphrase(1), 1, cd);
+       if (r < 0)
+               goto out;
+
+       r = crypt_keyslot_add_by_key(cd, opt_key_slot, key, keysize,
+                       password_new, password_new_size, CRYPT_VOLUME_KEY_NO_SEGMENT);
+       tools_keyslot_msg(r, CREATED);
+out:
+       crypt_safe_free(password_new);
+       crypt_safe_free(key);
+       crypt_free(cd);
+       return r;
+}
+
 static int action_luksAddKey(void)
 {
        int r = -EINVAL, keysize = 0;
@@ -960,23 +1726,45 @@ static int action_luksAddKey(void)
        size_t password_size = 0, password_new_size = 0;
        struct crypt_device *cd = NULL;
 
+       /* Unbound keyslot (no assigned data segment) is special case */
+       if (opt_unbound)
+               return luksAddUnboundKey();
+
        if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
                goto out;
 
        crypt_set_confirm_callback(cd, yesDialog, NULL);
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
+       if ((r = crypt_load(cd, luksType(opt_type), NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               goto out;
+       }
+
+       r = _set_keyslot_encryption_params(cd);
+       if (r < 0)
                goto out;
 
+       /* Never call pwquality if using null cipher */
+       if (tools_is_cipher_null(crypt_get_cipher(cd)))
+               opt_force_password = 1;
+
        keysize = crypt_get_volume_key_size(cd);
-       /* FIXME: lib cannot properly set verification for new/old passphrase */
-       crypt_set_password_verify(cd, _verify_passphrase(0));
-       crypt_set_timeout(cd, opt_timeout);
-       if (opt_iteration_time)
-               crypt_set_iteration_time(cd, opt_iteration_time);
+       r = set_pbkdf_params(cd, crypt_get_type(cd));
+       if (r) {
+               log_err(_("Failed to set pbkdf parameters."));
+               goto out;
+       }
 
        if (opt_master_key_file) {
-               r = _read_mk(opt_master_key_file, &key, keysize);
+               if (!keysize && !opt_key_size) {
+                       log_err(_("Cannot determine volume key size for LUKS without keyslots, please use --key-size option."));
+                       r = -EINVAL;
+                       goto out;
+               } else if (!keysize)
+                       keysize = opt_key_size / 8;
+
+               r = tools_read_mk(opt_master_key_file, &key, keysize);
                if (r < 0)
                        goto out;
 
@@ -995,13 +1783,16 @@ static int action_luksAddKey(void)
 
                r = crypt_keyslot_add_by_volume_key(cd, opt_key_slot, key, keysize,
                                                    password_new, password_new_size);
-       } else if (opt_key_file || opt_new_key_file) {
-               r = crypt_keyslot_add_by_keyfile_offset(cd, opt_key_slot,
+       } else if (opt_key_file && !tools_is_stdin(opt_key_file) &&
+                  opt_new_key_file && !tools_is_stdin(opt_new_key_file)) {
+               r = crypt_keyslot_add_by_keyfile_device_offset(cd, opt_key_slot,
                        opt_key_file, opt_keyfile_size, opt_keyfile_offset,
                        opt_new_key_file, opt_new_keyfile_size, opt_new_keyfile_offset);
+               tools_passphrase_msg(r);
        } else {
                r = tools_get_key(_("Enter any existing passphrase: "),
-                             &password, &password_size, 0, 0, NULL,
+                             &password, &password_size,
+                             opt_keyfile_offset, opt_keyfile_size, opt_key_file,
                              opt_timeout, _verify_passphrase(0), 0, cd);
 
                if (r < 0)
@@ -1011,11 +1802,14 @@ static int action_luksAddKey(void)
                r = crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT,
                                                 password, password_size, 0);
                check_signal(&r);
+               tools_passphrase_msg(r);
                if (r < 0)
                        goto out;
+               tools_keyslot_msg(r, UNLOCKED);
 
                r = tools_get_key(_("Enter new passphrase for key slot: "),
-                                 &password_new, &password_new_size, 0, 0, NULL,
+                                 &password_new, &password_new_size,
+                                 opt_new_keyfile_offset, opt_new_keyfile_size, opt_new_key_file,
                                  opt_timeout, _verify_passphrase(1), 1, cd);
                if (r < 0)
                        goto out;
@@ -1025,6 +1819,7 @@ static int action_luksAddKey(void)
                                                    password_new, password_new_size);
        }
 out:
+       tools_keyslot_msg(r, CREATED);
        crypt_safe_free(password);
        crypt_safe_free(password_new);
        crypt_safe_free(key);
@@ -1043,11 +1838,25 @@ static int action_luksChangeKey(void)
        if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
                goto out;
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
+       if ((r = crypt_load(cd, luksType(opt_type), NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               goto out;
+       }
+
+       r = _set_keyslot_encryption_params(cd);
+       if (r < 0)
                goto out;
 
-       if (opt_iteration_time)
-               crypt_set_iteration_time(cd, opt_iteration_time);
+       /* Never call pwquality if using null cipher */
+       if (tools_is_cipher_null(crypt_get_cipher(cd)))
+               opt_force_password = 1;
+
+       r = set_pbkdf_params(cd, crypt_get_type(cd));
+       if (r) {
+               log_err(_("Failed to set pbkdf parameters."));
+               goto out;
+       }
 
        r = tools_get_key(_("Enter passphrase to be changed: "),
                      &password, &password_size,
@@ -1058,10 +1867,12 @@ static int action_luksChangeKey(void)
 
        /* Check password before asking for new one */
        r = crypt_activate_by_passphrase(cd, NULL, opt_key_slot,
-                                        password, password_size, 0);
+                                        password, password_size, CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY);
+       tools_passphrase_msg(r);
        check_signal(&r);
        if (r < 0)
                goto out;
+       tools_keyslot_msg(r, UNLOCKED);
 
        r = tools_get_key(_("Enter new passphrase: "),
                          &password_new, &password_new_size,
@@ -1073,6 +1884,7 @@ static int action_luksChangeKey(void)
 
        r = crypt_keyslot_change_by_passphrase(cd, opt_key_slot, opt_key_slot,
                password, password_size, password_new, password_new_size);
+       tools_keyslot_msg(r, CREATED);
 out:
        crypt_safe_free(password);
        crypt_safe_free(password_new);
@@ -1080,6 +1892,55 @@ out:
        return r;
 }
 
+static int action_luksConvertKey(void)
+{
+       struct crypt_device *cd = NULL;
+       char *password = NULL;
+       size_t password_size = 0;
+       int r;
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               goto out;
+
+       if ((r = crypt_load(cd, CRYPT_LUKS2, NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               goto out;
+       }
+
+       r = _set_keyslot_encryption_params(cd);
+       if (r < 0)
+               goto out;
+
+       if (crypt_keyslot_status(cd, opt_key_slot) == CRYPT_SLOT_INACTIVE) {
+               r = -EINVAL;
+               log_err(_("Keyslot %d is not active."), opt_key_slot);
+               goto out;
+       }
+
+       r = set_pbkdf_params(cd, crypt_get_type(cd));
+       if (r) {
+               log_err(_("Failed to set pbkdf parameters."));
+               goto out;
+       }
+
+       r = tools_get_key(_("Enter passphrase for keyslot to be converted: "),
+                     &password, &password_size,
+                     opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                     opt_timeout, _verify_passphrase(0), 0, cd);
+       if (r < 0)
+               goto out;
+
+       r = crypt_keyslot_change_by_passphrase(cd, opt_key_slot, opt_key_slot,
+                       password, password_size, password, password_size);
+       tools_passphrase_msg(r);
+       tools_keyslot_msg(r, CREATED);
+out:
+       crypt_safe_free(password);
+       crypt_free(cd);
+       return r;
+}
+
 static int action_isLuks(void)
 {
        struct crypt_device *cd = NULL;
@@ -1087,7 +1948,7 @@ static int action_isLuks(void)
 
        /* FIXME: argc > max should be checked for other operations as well */
        if (action_argc > 1) {
-               log_err(_("Only one device argument for isLuks operation is supported.\n"));
+               log_err(_("Only one device argument for isLuks operation is supported."));
                return -ENODEV;
        }
 
@@ -1095,7 +1956,7 @@ static int action_isLuks(void)
                goto out;
 
        crypt_set_log_callback(cd, quiet_log, NULL);
-       r = crypt_load(cd, CRYPT_LUKS1, NULL);
+       r = crypt_load(cd, luksType(opt_type), NULL);
 out:
        crypt_free(cd);
        return r;
@@ -1110,9 +1971,9 @@ static int action_luksUUID(void)
        if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
                goto out;
 
-       crypt_set_confirm_callback(cd, yesDialog, NULL);
+       crypt_set_confirm_callback(cd, yesDialog, _("Operation aborted.\n"));
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
+       if ((r = crypt_load(cd, luksType(opt_type), NULL)))
                goto out;
 
        if (opt_uuid)
@@ -1137,9 +1998,9 @@ static int luksDump_with_volume_key(struct crypt_device *cd)
 
        crypt_set_confirm_callback(cd, yesDialog, NULL);
        if (!yesDialog(
-           _("Header dump with volume key is sensitive information\n"
-             "which allows access to encrypted partition without passphrase.\n"
-             "This dump should be always stored encrypted on safe place."),
+           _("The header dump with volume key is sensitive information\n"
+             "that allows access to encrypted partition without a passphrase.\n"
+             "This dump should be stored encrypted in a safe place."),
              NULL))
                return -EPERM;
 
@@ -1148,7 +2009,7 @@ static int luksDump_with_volume_key(struct crypt_device *cd)
        if (!vk)
                return -ENOMEM;
 
-       r = tools_get_key(_("Enter passphrase: "), &password, &passwordLen,
+       r = tools_get_key(NULL, &password, &passwordLen,
                          opt_keyfile_offset, opt_keyfile_size, opt_key_file,
                          opt_timeout, 0, 0, cd);
        if (r < 0)
@@ -1156,9 +2017,17 @@ static int luksDump_with_volume_key(struct crypt_device *cd)
 
        r = crypt_volume_key_get(cd, CRYPT_ANY_SLOT, vk, &vk_size,
                                 password, passwordLen);
+       tools_passphrase_msg(r);
        check_signal(&r);
        if (r < 0)
                goto out;
+       tools_keyslot_msg(r, UNLOCKED);
+
+       if (opt_master_key_file) {
+               r = tools_write_mk(opt_master_key_file, vk, vk_size);
+               if (r < 0)
+                       goto out;
+       }
 
        log_std("LUKS header information for %s\n", crypt_get_device_name(cd));
        log_std("Cipher name:   \t%s\n", crypt_get_cipher(cd));
@@ -1166,6 +2035,10 @@ static int luksDump_with_volume_key(struct crypt_device *cd)
        log_std("Payload offset:\t%d\n", (int)crypt_get_data_offset(cd));
        log_std("UUID:          \t%s\n", crypt_get_uuid(cd));
        log_std("MK bits:       \t%d\n", (int)vk_size * 8);
+       if (opt_master_key_file) {
+               log_std("Key stored to file %s.\n", opt_master_key_file);
+               goto out;
+       }
        log_std("MK dump:\t");
 
        for(i = 0; i < vk_size; i++) {
@@ -1181,171 +2054,1284 @@ out:
        return r;
 }
 
-static int action_luksDump(void)
+static int luksDump_with_unbound_key(struct crypt_device *cd)
 {
-       struct crypt_device *cd = NULL;
-       int r;
+       crypt_keyslot_info ki;
+       char *uk = NULL, *password = NULL;
+       size_t uk_size, passwordLen = 0;
+       int i, r;
 
-       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
-               goto out;
+       ki = crypt_keyslot_status(cd, opt_key_slot);
+       if (ki != CRYPT_SLOT_UNBOUND) {
+               log_err(_("Keyslot %d does not contain unbound key."), opt_key_slot);
+               return -EINVAL;
+       }
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
-               goto out;
+       crypt_set_confirm_callback(cd, yesDialog, NULL);
+       if (!yesDialog(
+           _("The header dump with unbound key is sensitive information.\n"
+             "This dump should be stored encrypted in a safe place."),
+             NULL))
+               return -EPERM;
 
-       if (opt_dump_master_key)
-               r = luksDump_with_volume_key(cd);
-       else
-               r = crypt_dump(cd);
-out:
-       crypt_free(cd);
-       return r;
-}
+       r = crypt_keyslot_get_key_size(cd, opt_key_slot);
+       if (r < 0)
+               return -EINVAL;
+       uk_size = r;
+       uk = crypt_safe_alloc(uk_size);
+       if (!uk)
+               return -ENOMEM;
 
-static int action_luksSuspend(void)
-{
-       struct crypt_device *cd = NULL;
-       int r;
+       r = tools_get_key(NULL, &password, &passwordLen,
+                         opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                         opt_timeout, 0, 0, cd);
+       if (r < 0)
+               goto out;
 
-       r = crypt_init_by_name_and_header(&cd, action_argv[0], uuid_or_device(opt_header_device));
+       r = crypt_volume_key_get(cd, opt_key_slot, uk, &uk_size,
+                                password, passwordLen);
+       tools_passphrase_msg(r);
+       check_signal(&r);
+       if (r < 0)
+               goto out;
+       tools_keyslot_msg(r, UNLOCKED);
+
+       if (opt_master_key_file) {
+               r = tools_write_mk(opt_master_key_file, uk, uk_size);
+               if (r < 0)
+                       goto out;
+       }
+
+       log_std("LUKS header information for %s\n", crypt_get_device_name(cd));
+       log_std("UUID:    \t%s\n", crypt_get_uuid(cd));
+       log_std("Keyslot: \t%d\n", opt_key_slot);
+       log_std("Key bits:\t%d\n", (int)uk_size * 8);
+       if (opt_master_key_file) {
+               log_std("Key stored to file %s.\n", opt_master_key_file);
+               goto out;
+       }
+       log_std("Unbound Key:\t");
+
+       for(i = 0; i < (int)uk_size; i++) {
+               if (i && !(i % 16))
+                       log_std("\n\t\t");
+               log_std("%02hhx ", (char)uk[i]);
+       }
+       log_std("\n");
+out:
+       crypt_safe_free(password);
+       crypt_safe_free(uk);
+       return r;
+}
+
+static int action_luksDump(void)
+{
+       struct crypt_device *cd = NULL;
+       int r;
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               goto out;
+
+       if ((r = crypt_load(cd, luksType(opt_type), NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               goto out;
+       }
+
+       if (opt_dump_master_key)
+               r = luksDump_with_volume_key(cd);
+       else if (opt_unbound)
+               r = luksDump_with_unbound_key(cd);
+       else
+               r = crypt_dump(cd);
+out:
+       crypt_free(cd);
+       return r;
+}
+
+static int action_luksSuspend(void)
+{
+       struct crypt_device *cd = NULL;
+       int r;
+
+       r = crypt_init_by_name_and_header(&cd, action_argv[0], uuid_or_device(opt_header_device));
        if (!r)
                r = crypt_suspend(cd, action_argv[0]);
 
-       crypt_free(cd);
-       return r;
+       crypt_free(cd);
+       return r;
+}
+
+static int action_luksResume(void)
+{
+       struct crypt_device *cd = NULL;
+       char *password = NULL;
+       size_t passwordLen;
+       int r, tries;
+
+       if ((r = crypt_init_by_name_and_header(&cd, action_argv[0], uuid_or_device(opt_header_device))))
+               goto out;
+
+       if ((r = crypt_load(cd, luksType(opt_type), NULL)))
+               goto out;
+
+       tries = (tools_is_stdin(opt_key_file) && isatty(STDIN_FILENO)) ? opt_tries : 1;
+       do {
+               r = tools_get_key(NULL, &password, &passwordLen,
+                       opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                       opt_timeout, _verify_passphrase(0), 0, cd);
+               if (r < 0)
+                       goto out;
+
+               r = crypt_resume_by_passphrase(cd, action_argv[0], CRYPT_ANY_SLOT,
+                                              password, passwordLen);
+               tools_passphrase_msg(r);
+               check_signal(&r);
+               tools_keyslot_msg(r, UNLOCKED);
+
+               crypt_safe_free(password);
+               password = NULL;
+       } while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
+out:
+       crypt_safe_free(password);
+       crypt_free(cd);
+       return r;
+}
+
+static int action_luksBackup(void)
+{
+       struct crypt_device *cd = NULL;
+       int r;
+
+       if (!opt_header_backup_file) {
+               log_err(_("Option --header-backup-file is required."));
+               return -EINVAL;
+       }
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               goto out;
+
+       crypt_set_confirm_callback(cd, yesDialog, NULL);
+
+       r = crypt_header_backup(cd, NULL, opt_header_backup_file);
+out:
+       crypt_free(cd);
+       return r;
+}
+
+static int action_luksRestore(void)
+{
+       struct crypt_device *cd = NULL;
+       int r = 0;
+
+       if (!opt_header_backup_file) {
+               log_err(_("Option --header-backup-file is required."));
+               return -EINVAL;
+       }
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               goto out;
+
+       crypt_set_confirm_callback(cd, yesDialog, NULL);
+       r = crypt_header_restore(cd, NULL, opt_header_backup_file);
+out:
+       crypt_free(cd);
+       return r;
+}
+
+static const char *_get_device_type(void)
+{
+       const char *type, *name = NULL;
+       struct crypt_device *cd = NULL;
+
+       if (action_argc > 1)
+               name = action_argv[1];
+       else if (action_argc == 1)
+               name = action_argv[0];
+
+       if (crypt_init_by_name_and_header(&cd, name, opt_header_device))
+               return NULL;
+
+       type = crypt_get_type(cd);
+       if (!type) {
+               crypt_free(cd);
+               log_err(_("%s is not cryptsetup managed device."), name);
+               return NULL;
+       }
+
+       if (!strncmp(type, "LUKS", 4))
+               type = "luks";
+       else if (!strcmp(type, CRYPT_PLAIN))
+               type = "plain";
+       else if (!strcmp(type, CRYPT_LOOPAES))
+               type = "loopaes";
+       else {
+               log_err(_("Refresh is not supported for device type %s"), type);
+               type = NULL;
+       }
+
+       crypt_free(cd);
+
+       return type;
+}
+
+static int action_open(void)
+{
+       if (opt_refresh && !opt_type)
+               /* read device type from active mapping */
+               opt_type = _get_device_type();
+
+       if (!opt_type)
+               return -EINVAL;
+
+       if (!strcmp(opt_type, "luks") ||
+           !strcmp(opt_type, "luks1") ||
+           !strcmp(opt_type, "luks2")) {
+               if (action_argc < 2 && (!opt_test_passphrase && !opt_refresh))
+                       goto args;
+               return action_open_luks();
+       } else if (!strcmp(opt_type, "plain")) {
+               if (action_argc < 2 && !opt_refresh)
+                       goto args;
+               return action_open_plain();
+       } else if (!strcmp(opt_type, "loopaes")) {
+               if (action_argc < 2 && !opt_refresh)
+                       goto args;
+               return action_open_loopaes();
+       } else if (!strcmp(opt_type, "tcrypt")) {
+               if (action_argc < 2 && !opt_test_passphrase)
+                       goto args;
+               return action_open_tcrypt();
+       } else if (!strcmp(opt_type, "bitlk")) {
+               if (action_argc < 2 && !opt_test_passphrase)
+                       goto args;
+               return action_open_bitlk();
+       }
+
+       log_err(_("Unrecognized metadata device type %s."), opt_type);
+       return -EINVAL;
+args:
+       log_err(_("Command requires device and mapped name as arguments."));
+       return -EINVAL;
+}
+
+static int action_luksErase(void)
+{
+       struct crypt_device *cd = NULL;
+       crypt_keyslot_info ki;
+       char *msg = NULL;
+       int i, max, r;
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               goto out;
+
+       crypt_set_confirm_callback(cd, yesDialog, NULL);
+
+       if ((r = crypt_load(cd, luksType(opt_type), NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               goto out;
+       }
+
+       if(asprintf(&msg, _("This operation will erase all keyslots on device %s.\n"
+                           "Device will become unusable after this operation."),
+                           uuid_or_device_header(NULL)) == -1) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       if (!yesDialog(msg, _("Operation aborted, keyslots were NOT wiped.\n"))) {
+               r = -EPERM;
+               goto out;
+       }
+
+       /* Safety check */
+       max = crypt_keyslot_max(crypt_get_type(cd));
+       if (max <= 0)
+               return -EINVAL;
+
+       for (i = 0; i < max; i++) {
+               ki = crypt_keyslot_status(cd, i);
+               if (ki == CRYPT_SLOT_ACTIVE || ki == CRYPT_SLOT_ACTIVE_LAST) {
+                       r = crypt_keyslot_destroy(cd, i);
+                       if (r < 0)
+                               goto out;
+                       tools_keyslot_msg(i, REMOVED);
+               }
+       }
+out:
+       free(msg);
+       crypt_free(cd);
+       return r;
+}
+
+static int action_luksConvert(void)
+{
+       struct crypt_device *cd = NULL;
+       char *msg = NULL;
+       const char *to_type, *from_type;
+       int r;
+
+       if (!strcmp(opt_type, "luks2")) {
+               to_type = CRYPT_LUKS2;
+       } else if (!strcmp(opt_type, "luks1")) {
+               to_type = CRYPT_LUKS1;
+       } else {
+               log_err(_("Invalid LUKS type, only luks1 and luks2 are supported."));
+               return -EINVAL;
+       }
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               return r;
+
+       crypt_set_confirm_callback(cd, yesDialog, NULL);
+
+       if ((r = crypt_load(cd, CRYPT_LUKS, NULL)) ||
+           !(from_type = crypt_get_type(cd))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               crypt_free(cd);
+               return r;
+       }
+
+       if (!strcmp(from_type, to_type)) {
+               log_err(_("Device is already %s type."), to_type);
+               crypt_free(cd);
+               return -EINVAL;
+       }
+
+       if (asprintf(&msg, _("This operation will convert %s to %s format.\n"),
+                           uuid_or_device_header(NULL), to_type) == -1) {
+               crypt_free(cd);
+               return -ENOMEM;
+       }
+
+       if (yesDialog(msg, _("Operation aborted, device was NOT converted.\n")))
+               r = crypt_convert(cd, to_type, NULL);
+       else
+               r = -EPERM;
+
+       free(msg);
+       crypt_free(cd);
+       return r;
+}
+
+static int _config_priority(struct crypt_device *cd)
+{
+       crypt_keyslot_info cs;
+       crypt_keyslot_priority priority = CRYPT_SLOT_PRIORITY_INVALID;
+
+       if (!strcmp("normal", opt_priority))
+               priority = CRYPT_SLOT_PRIORITY_NORMAL;
+       else if (!strcmp("prefer", opt_priority))
+               priority = CRYPT_SLOT_PRIORITY_PREFER;
+       else if (!strcmp("ignore", opt_priority))
+               priority = CRYPT_SLOT_PRIORITY_IGNORE;
+
+       cs = crypt_keyslot_status(cd, opt_key_slot);
+       if (cs != CRYPT_SLOT_INVALID)
+               return crypt_keyslot_set_priority(cd, opt_key_slot, priority);
+
+       return -EINVAL;
+}
+
+static int _config_labels(struct crypt_device *cd)
+{
+       return crypt_set_label(cd, opt_label, opt_subsystem);
+}
+
+static int action_luksConfig(void)
+{
+       struct crypt_device *cd = NULL;
+       int r;
+
+       if (!opt_priority && !opt_label && !opt_subsystem) {
+               log_err(_("Option --priority, --label or --subsystem is missing."));
+               return -EINVAL;
+       }
+
+       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
+               return r;
+
+       if ((r = crypt_load(cd, CRYPT_LUKS2, NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device_header(NULL));
+               goto out;
+       }
+
+       if (opt_priority && (r = _config_priority(cd)))
+               goto out;
+
+       if ((opt_label || opt_subsystem) && (r = _config_labels(cd)))
+               goto out;
+out:
+       crypt_free(cd);
+       return r;
+}
+
+static int _token_add(struct crypt_device *cd)
+{
+       int r, token;
+       crypt_token_info token_info;
+       const struct crypt_token_params_luks2_keyring params = {
+               .key_description = opt_key_description
+       };
+
+       if (opt_token != CRYPT_ANY_TOKEN) {
+               token_info = crypt_token_status(cd, opt_token, NULL);
+               if (token_info < CRYPT_TOKEN_INACTIVE) {
+                       log_err(_("Token %d is invalid."), opt_token);
+                       return -EINVAL;
+               } else if (token_info > CRYPT_TOKEN_INACTIVE) {
+                       log_err(_("Token %d in use."), opt_token);
+                       return -EINVAL;
+               }
+       }
+
+       r = crypt_token_luks2_keyring_set(cd, opt_token, &params);
+       if (r < 0) {
+               log_err(_("Failed to add luks2-keyring token %d."), opt_token);
+               return r;
+       }
+
+       token = r;
+       tools_token_msg(token, CREATED);
+
+       r = crypt_token_assign_keyslot(cd, token, opt_key_slot);
+       if (r < 0) {
+               log_err(_("Failed to assign token %d to keyslot %d."), token, opt_key_slot);
+               (void) crypt_token_json_set(cd, token, NULL);
+       }
+
+       return r;
+}
+
+static int _token_remove(struct crypt_device *cd)
+{
+       crypt_token_info token_info;
+       int r;
+
+       token_info = crypt_token_status(cd, opt_token, NULL);
+       if (token_info < CRYPT_TOKEN_INACTIVE) {
+               log_err(_("Token %d is invalid."), opt_token);
+               return -EINVAL;
+       } else if (token_info == CRYPT_TOKEN_INACTIVE) {
+               log_err(_("Token %d is not in use."), opt_token);
+               return -EINVAL;
+       }
+
+       r = crypt_token_json_set(cd, opt_token, NULL);
+       tools_token_msg(r, REMOVED);
+
+       return r;
+}
+
+static int _token_import(struct crypt_device *cd)
+{
+       char *json;
+       size_t json_length;
+       crypt_token_info token_info;
+       int r, token;
+
+       if (opt_token != CRYPT_ANY_TOKEN) {
+               token_info = crypt_token_status(cd, opt_token, NULL);
+               if (token_info < CRYPT_TOKEN_INACTIVE) {
+                       log_err(_("Token %d is invalid."), opt_token);
+                       return -EINVAL;
+               } else if (token_info > CRYPT_TOKEN_INACTIVE) {
+                       log_err(_("Token %d in use."), opt_token);
+                       return -EINVAL;
+               }
+       }
+
+       r = tools_read_json_file(cd, opt_json_file, &json, &json_length);
+       if (r)
+               return r;
+
+       r = crypt_token_json_set(cd, opt_token, json);
+       free(json);
+       if (r < 0) {
+               log_err(_("Failed to import token from file."));
+               return r;
+       }
+
+       token = r;
+       tools_token_msg(token, CREATED);
+
+       if (opt_key_slot != CRYPT_ANY_SLOT) {
+               r = crypt_token_assign_keyslot(cd, token, opt_key_slot);
+               if (r < 0) {
+                       log_err(_("Failed to assign token %d to keyslot %d."), token, opt_key_slot);
+                       (void) crypt_token_json_set(cd, token, NULL);
+               }
+       }
+
+       return r;
+}
+
+static int _token_export(struct crypt_device *cd)
+{
+       const char *json;
+       int r;
+
+       r = crypt_token_json_get(cd, opt_token, &json);
+       if (r < 0) {
+               log_err(_("Failed to get token %d for export."), opt_token);
+               return r;
+       }
+
+       return tools_write_json_file(cd, opt_json_file, json);
+}
+
+static int action_token(void)
+{
+       int r;
+       struct crypt_device *cd = NULL;
+       enum { ADD = 0, REMOVE, IMPORT, EXPORT } action;
+
+       if (!strcmp(action_argv[0], "add")) {
+               if (!opt_key_description) {
+                       log_err(_("--key-description parameter is mandatory for token add action."));
+                       return -EINVAL;
+               }
+               action = ADD;
+       } else if (!strcmp(action_argv[0], "remove")) {
+               if (opt_token == CRYPT_ANY_TOKEN) {
+                       log_err(_("Action requires specific token. Use --token-id parameter."));
+                       return -EINVAL;
+               }
+               action = REMOVE;
+       } else if (!strcmp(action_argv[0], "import")) {
+               action = IMPORT;
+       } else if (!strcmp(action_argv[0], "export")) {
+               if (opt_token == CRYPT_ANY_TOKEN) {
+                       log_err(_("Action requires specific token. Use --token-id parameter."));
+                       return -EINVAL;
+               }
+               action = EXPORT;
+       } else {
+               log_err(_("Invalid token operation %s."), action_argv[0]);
+               return -EINVAL;
+       }
+
+       if ((r = crypt_init(&cd, uuid_or_device(opt_header_device ?: action_argv[1]))))
+               return r;
+
+       if ((r = crypt_load(cd, CRYPT_LUKS2, NULL))) {
+               log_err(_("Device %s is not a valid LUKS device."),
+                       uuid_or_device(opt_header_device ?: action_argv[1]));
+               crypt_free(cd);
+               return r;
+       }
+
+       if (action == ADD)
+               r = _token_add(cd); /* adds only luks2-keyring type */
+       else if (action == REMOVE)
+               r = _token_remove(cd);
+       else if (action == IMPORT)
+               r = _token_import(cd);
+       else if (action == EXPORT)
+               r = _token_export(cd);
+       else {
+               log_dbg("Internal token action error.");
+               r = -EINVAL;
+       }
+
+       crypt_free(cd);
+
+       return r;
+}
+
+static int auto_detect_active_name(struct crypt_device *cd, const char *data_device, char *dm_name, size_t dm_name_len)
+{
+       int r;
+
+       r = tools_lookup_crypt_device(cd, crypt_get_type(cd), data_device, dm_name, dm_name_len);
+       if (r > 0)
+               log_dbg("Device %s has %d active holders.", data_device, r);
+
+       return r;
+}
+
+static int _get_device_active_name(struct crypt_device *cd, const char *data_device, char *buffer, size_t buffer_size)
+{
+       char *msg;
+       int r;
+
+       r = auto_detect_active_name(cd, action_argv[0], buffer, buffer_size);
+       if (r > 0) {
+               if (*buffer == '\0') {
+                       log_err(_("Device %s is still in use."), data_device);
+                       return -EINVAL;
+               }
+               if (!opt_batch_mode)
+                       log_std(_("Auto-detected active dm device '%s' for data device %s.\n"), buffer, data_device);
+       }
+       if (r < 0) {
+               if (r == -ENOTBLK)
+                       log_std(_("Device %s is not a block device.\n"), data_device);
+               else
+                       log_err(_("Failed to auto-detect device %s holders."), data_device);
+
+               r = asprintf(&msg, _("Unable to decide if device %s is activated or not.\n"
+                                    "Are you sure you want to proceed with reencryption in offline mode?\n"
+                                    "It may lead to data corruption if the device is actually activated.\n"
+                                    "To run reencryption in online mode, use --active-name parameter instead.\n"), data_device);
+               if (r < 0)
+                       return -ENOMEM;
+               r = noDialog(msg, _("Operation aborted.\n")) ? 0 : -EINVAL;
+               free(msg);
+       }
+
+       return r;
+}
+
+static int action_reencrypt_load(struct crypt_device *cd)
+{
+       int r;
+       size_t passwordLen;
+       char dm_name[PATH_MAX] = {}, *password = NULL;
+       const char *active_name = NULL;
+       struct crypt_params_reencrypt params = {
+               .resilience = opt_resilience_mode,
+               .hash = opt_resilience_hash,
+               .max_hotzone_size = opt_hotzone_size / SECTOR_SIZE,
+               .device_size = opt_device_size / SECTOR_SIZE,
+               .flags = CRYPT_REENCRYPT_RESUME_ONLY
+       };
+
+       r = tools_get_key(NULL, &password, &passwordLen,
+                       opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                       opt_timeout, _verify_passphrase(0), 0, cd);
+       if (r < 0)
+               return r;
+
+       if (!opt_active_name) {
+               r = _get_device_active_name(cd, action_argv[0], dm_name, sizeof(dm_name));
+               if (r > 0)
+                       active_name = dm_name;
+               if (r < 0) {
+                       crypt_safe_free(password);
+                       return -EINVAL;
+               }
+       } else
+               active_name = opt_active_name;
+
+       r = crypt_reencrypt_init_by_passphrase(cd, active_name, password, passwordLen, opt_key_slot, opt_key_slot, NULL, NULL, &params);
+
+       crypt_safe_free(password);
+
+       return r;
+}
+
+static int action_encrypt_luks2(struct crypt_device **cd)
+{
+       const char *type, *activated_name = NULL;
+       int keyslot, r, fd;
+       uuid_t uuid;
+       size_t passwordLen;
+       char *msg, uuid_str[37], header_file[PATH_MAX] = { 0 }, *password = NULL;
+       uint32_t activate_flags = 0;
+       const struct crypt_params_luks2 luks2_params = {
+               .sector_size = opt_sector_size ?: SECTOR_SIZE
+       };
+       struct crypt_params_reencrypt params = {
+               .mode = CRYPT_REENCRYPT_ENCRYPT,
+               .direction = opt_data_shift < 0 ? CRYPT_REENCRYPT_BACKWARD : CRYPT_REENCRYPT_FORWARD,
+               .resilience = opt_resilience_mode,
+               .hash = opt_resilience_hash,
+               .max_hotzone_size = opt_hotzone_size / SECTOR_SIZE,
+               .device_size = opt_device_size / SECTOR_SIZE,
+               .luks2 = &luks2_params,
+               .flags = CRYPT_REENCRYPT_INITIALIZE_ONLY
+       };
+
+       _set_reencryption_flags(&params.flags);
+
+       type = luksType(opt_type);
+       if (!type)
+               type = crypt_get_default_type();
+
+       if (strcmp(type, CRYPT_LUKS2)) {
+               log_err(_("Invalid LUKS device type."));
+               return -EINVAL;
+       }
+
+       if (!opt_data_shift && !opt_header_device) {
+               log_err(_("Encryption without detached header (--header) is not possible without data device size reduction (--reduce-device-size)."));
+               return -ENOTSUP;
+       }
+
+       if (!opt_header_device && opt_offset && opt_data_shift && (opt_offset > (imaxabs(opt_data_shift) / (2 * SECTOR_SIZE)))) {
+               log_err(_("Requested data offset must be less than or equal to half of --reduce-device-size parameter."));
+               return -EINVAL;
+       }
+
+       /* TODO: ask user to confirm. It's useless to do data device reduction and than use smaller value */
+       if (!opt_header_device && opt_offset && opt_data_shift && (opt_offset < (imaxabs(opt_data_shift) / (2 * SECTOR_SIZE)))) {
+               opt_data_shift = -(opt_offset * 2 * SECTOR_SIZE);
+               if (opt_data_shift >= 0)
+                       return -EINVAL;
+               log_std(_("Adjusting --reduce-device-size value to twice the --offset %" PRIu64 " (sectors).\n"), opt_offset * 2);
+       }
+
+       if (strncmp(type, CRYPT_LUKS2, strlen(CRYPT_LUKS2))) {
+               log_err(_("Encryption is supported only for LUKS2 format."));
+               return -EINVAL;
+       }
+
+       if (opt_uuid && uuid_parse(opt_uuid, uuid) == -1) {
+               log_err(_("Wrong LUKS UUID format provided."));
+               return -EINVAL;
+       }
+
+       if (!opt_uuid) {
+               uuid_generate(uuid);
+               uuid_unparse(uuid, uuid_str);
+               opt_uuid = uuid_str;
+       }
+
+       /* Check the data device is not LUKS device already */
+       if ((r = crypt_init(cd, action_argv[0])))
+               return r;
+       r = crypt_load(*cd, CRYPT_LUKS, NULL);
+       crypt_free(*cd);
+       *cd = NULL;
+       if (!r) {
+               r = asprintf(&msg, _("Detected LUKS device on %s. Do you want to encrypt that LUKS device again?"), action_argv[0]);
+               if (r == -1)
+                       return -ENOMEM;
+
+               r = yesDialog(msg, _("Operation aborted.\n")) ? 0 : -EINVAL;
+               free(msg);
+               if (r < 0)
+                       return r;
+       }
+
+       if (!opt_header_device) {
+               snprintf(header_file, sizeof(header_file), "LUKS2-temp-%s.new", opt_uuid);
+               fd = open(header_file, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR);
+               if (fd == -1) {
+                       if (errno == EEXIST)
+                               log_err(_("Temporary header file %s already exists. Aborting."), header_file);
+                       else
+                               log_err(_("Cannot create temporary header file %s."), header_file);
+                       return -EINVAL;
+               }
+
+               r = posix_fallocate(fd, 0, 4096);
+               close(fd);
+               if (r) {
+                       log_err(_("Cannot create temporary header file %s."), header_file);
+                       r = -EINVAL;
+                       goto err;
+               }
+
+               opt_header_device = header_file;
+               /*
+                * FIXME: just override offset here, but we should support both.
+                * offset and implicit offset via data shift (lvprepend?)
+                */
+               if (!opt_offset)
+                       opt_offset = imaxabs(opt_data_shift) / (2 * SECTOR_SIZE);
+               opt_data_shift >>= 1;
+               params.flags |= CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT;
+       } else if (opt_data_shift < 0) {
+               if (!opt_luks2_metadata_size)
+                       opt_luks2_metadata_size = 0x4000; /* missing default here */
+               if (!opt_luks2_keyslots_size)
+                       opt_luks2_keyslots_size = -opt_data_shift - 2 * opt_luks2_metadata_size;
+
+               if (2 * opt_luks2_metadata_size + opt_luks2_keyslots_size > (uint64_t)-opt_data_shift) {
+                       log_err("LUKS2 metadata size is larger than data shift value.");
+                       return -EINVAL;
+               }
+       }
+
+       r = _luksFormat(cd, &password, &passwordLen);
+       if (r < 0)
+               goto err;
+
+       if (opt_data_shift) {
+               params.data_shift = imaxabs(opt_data_shift) / SECTOR_SIZE,
+               params.resilience = "datashift";
+       }
+       keyslot = opt_key_slot < 0 ? 0 : opt_key_slot;
+       r = crypt_reencrypt_init_by_passphrase(*cd, NULL, password, passwordLen,
+                       CRYPT_ANY_SLOT, keyslot, crypt_get_cipher(*cd),
+                       crypt_get_cipher_mode(*cd), &params);
+       if (r < 0) {
+               crypt_keyslot_destroy(*cd, keyslot);
+               goto err;
+       }
+
+       /* Restore temporary header in head of data device */
+       if (*header_file) {
+               crypt_free(*cd);
+               *cd = NULL;
+
+               r = crypt_init(cd, action_argv[0]);
+               if (!r)
+                       r = crypt_header_restore(*cd, CRYPT_LUKS2, header_file);
+
+               if (r) {
+                       log_err("Failed to place new header at head of device %s.", action_argv[0]);
+                       goto err;
+               }
+       }
+
+       /* activate device */
+       if (action_argc > 1) {
+               activated_name = action_argv[1];
+               _set_activation_flags(&activate_flags);
+               r = crypt_activate_by_passphrase(*cd, activated_name, opt_key_slot, password, passwordLen, activate_flags);
+               if (r >= 0)
+                       log_std(_("%s/%s is now active and ready for online encryption.\n"), crypt_get_dir(), activated_name);
+       }
+
+       if (r < 0)
+               goto err;
+
+       /* just load reencryption context to continue reencryption */
+       if (!opt_reencrypt_init_only) {
+               params.flags &= ~CRYPT_REENCRYPT_INITIALIZE_ONLY;
+               r = crypt_reencrypt_init_by_passphrase(*cd, activated_name, password, passwordLen,
+                               CRYPT_ANY_SLOT, keyslot, NULL, NULL, &params);
+       }
+err:
+       crypt_safe_free(password);
+       if (*header_file)
+               unlink(header_file);
+       return r;
+}
+
+static int action_decrypt_luks2(struct crypt_device *cd)
+{
+       int r;
+       char dm_name[PATH_MAX], *password = NULL;
+       const char *active_name = NULL;
+       struct crypt_params_reencrypt params = {
+               .mode = CRYPT_REENCRYPT_DECRYPT,
+               .direction = opt_data_shift > 0 ? CRYPT_REENCRYPT_FORWARD : CRYPT_REENCRYPT_BACKWARD,
+               .resilience = opt_data_shift ? "datashift" : opt_resilience_mode,
+               .hash = opt_resilience_hash,
+               .data_shift = imaxabs(opt_data_shift) / SECTOR_SIZE,
+               .device_size = opt_device_size / SECTOR_SIZE,
+               .max_hotzone_size = opt_hotzone_size / SECTOR_SIZE,
+       };
+       size_t passwordLen;
+
+       _set_reencryption_flags(&params.flags);
+
+       r = tools_get_key(NULL, &password, &passwordLen,
+                       opt_keyfile_offset, opt_keyfile_size, opt_key_file,
+                       opt_timeout, _verify_passphrase(0), 0, cd);
+       if (r < 0)
+               return r;
+
+       if (!opt_active_name) {
+               r = _get_device_active_name(cd, action_argv[0], dm_name, sizeof(dm_name));
+               if (r > 0)
+                       active_name = dm_name;
+               if (r < 0)
+                       goto err;
+       } else
+               active_name = opt_active_name;
+
+       if (!active_name)
+               log_dbg("Device %s seems unused. Proceeding with offline operation.", action_argv[0]);
+
+       r = crypt_reencrypt_init_by_passphrase(cd, active_name, password,
+                       passwordLen, opt_key_slot, CRYPT_ANY_SLOT, NULL, NULL, &params);
+err:
+       crypt_safe_free(password);
+       return r;
+}
+
+struct keyslot_passwords {
+       char *password;
+       size_t passwordLen;
+       int new;
+};
+
+static struct keyslot_passwords *init_keyslot_passwords(size_t count)
+{
+       size_t i;
+       struct keyslot_passwords *tmp = calloc(count, sizeof(struct keyslot_passwords));
+
+       if (!tmp)
+               return tmp;
+
+       for (i = 0; i < count; i++)
+               tmp[i].new = -1;
+
+       return tmp;
+}
+
+static int init_passphrase(struct keyslot_passwords *kp, size_t keyslot_passwords_length,
+                          struct crypt_device *cd, const char *msg, int slot_to_check)
+{
+       crypt_keyslot_info ki;
+       char *password;
+       int r = -EINVAL, retry_count;
+       size_t passwordLen;
+
+       if (slot_to_check != CRYPT_ANY_SLOT) {
+               ki = crypt_keyslot_status(cd, slot_to_check);
+               if (ki < CRYPT_SLOT_ACTIVE || ki == CRYPT_SLOT_UNBOUND)
+                       return -ENOENT;
+       }
+
+       retry_count = (opt_tries && !opt_key_file) ? opt_tries : 1;
+       while (retry_count--) {
+               r = tools_get_key(msg,  &password, &passwordLen, 0, 0,
+                                 opt_key_file, 0, 0, 0 /*pwquality*/, cd);
+               if (r < 0)
+                       return r;
+               if (quit) {
+                       crypt_safe_free(password);
+                       password = NULL;
+                       passwordLen = 0;
+                       return -EAGAIN;
+               }
+
+               r = crypt_activate_by_passphrase(cd, NULL, slot_to_check,
+                                                password, passwordLen, 0);
+               if (r < 0) {
+                       crypt_safe_free(password);
+                       password = NULL;
+                       passwordLen = 0;
+               }
+               if (r < 0 && r != -EPERM)
+                       return r;
+
+               if (r >= 0) {
+                       tools_keyslot_msg(r, UNLOCKED);
+                       if ((size_t)r >= keyslot_passwords_length) {
+                               crypt_safe_free(password);
+                               return -EINVAL;
+                       }
+                       kp[r].password = password;
+                       kp[r].passwordLen = passwordLen;
+                       break;
+               }
+               tools_passphrase_msg(r);
+       }
+
+       password = NULL;
+       passwordLen = 0;
+
+       return r;
+}
+
+static int _check_luks2_keyslots(struct crypt_device *cd)
+{
+       int i, max = crypt_keyslot_max(CRYPT_LUKS2), active = 0, unbound = 0;
+
+       if (max < 0)
+               return max;
+
+       for (i = 0; i < max; i++) {
+               switch (crypt_keyslot_status(cd, i)) {
+               case CRYPT_SLOT_INVALID:
+                       return -EINVAL;
+               case CRYPT_SLOT_ACTIVE:
+                       /* fall-through */
+               case CRYPT_SLOT_ACTIVE_LAST:
+                       active++;
+                       break;
+               case CRYPT_SLOT_UNBOUND:
+                       unbound++;
+                       /* fall-through */
+               default:
+                       break;
+               }
+       }
+
+       /* at least one keyslot for reencryption plus new volume key */
+       if (active + unbound > max - 2) {
+               log_err(_("Not enough free keyslots for reencryption."));
+               return -EINVAL;
+       }
+
+       if ((opt_key_slot == CRYPT_ANY_SLOT) &&
+            (2 * active + unbound > max - 1)) {
+               log_err(_("Not enough free keyslots for reencryption."));
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int fill_keyslot_passwords(struct crypt_device *cd,
+               struct keyslot_passwords *kp, size_t kp_size)
+{
+       char msg[128];
+       crypt_keyslot_info ki;
+       int i, r = 0;
+
+       if (opt_key_slot == CRYPT_ANY_SLOT && opt_key_file) {
+               for (i = 0; (size_t)i < kp_size; i++) {
+                       ki = crypt_keyslot_status(cd, i);
+                       if (ki == CRYPT_SLOT_INVALID)
+                               return -EINVAL;
+                       if (ki == CRYPT_SLOT_ACTIVE) {
+                               log_err(_("Key file can be used only with --key-slot or with "
+                                         "exactly one key slot active."));
+                               return -EINVAL;
+                       }
+               }
+       }
+
+       if (opt_key_slot == CRYPT_ANY_SLOT) {
+               for (i = 0; (size_t)i < kp_size; i++) {
+                       snprintf(msg, sizeof(msg), _("Enter passphrase for key slot %d: "), i);
+                       r = init_passphrase(kp, kp_size, cd, msg, i);
+                       if (r == -ENOENT)
+                               r = 0;
+                       if (r < 0)
+                               break;
+               }
+       } else {
+               snprintf(msg, sizeof(msg), _("Enter passphrase for key slot %u: "), opt_key_slot);
+               r = init_passphrase(kp, kp_size, cd, msg, opt_key_slot);
+       }
+
+       return r < 0 ? r : 0;
 }
 
-static int action_luksResume(void)
+static int assign_tokens(struct crypt_device *cd, int keyslot_old, int keyslot_new)
 {
-       struct crypt_device *cd = NULL;
-       int r;
+       int token = 0, r = crypt_token_is_assigned(cd, token, keyslot_old);
 
-       if ((r = crypt_init_by_name_and_header(&cd, action_argv[0], uuid_or_device(opt_header_device))))
-               goto out;
-
-       crypt_set_timeout(cd, opt_timeout);
-       crypt_set_password_retry(cd, opt_tries);
-       crypt_set_password_verify(cd, _verify_passphrase(0));
+       while (r != -EINVAL) {
+               if (!r && (token != crypt_token_assign_keyslot(cd, token, keyslot_new)))
+                       return -EINVAL;
+               token++;
+               r = crypt_token_is_assigned(cd, token, keyslot_old);
+       }
 
-       if (opt_key_file)
-               r = crypt_resume_by_keyfile_offset(cd, action_argv[0], CRYPT_ANY_SLOT,
-                       opt_key_file, opt_keyfile_size, opt_keyfile_offset);
-       else
-               r = crypt_resume_by_passphrase(cd, action_argv[0], CRYPT_ANY_SLOT,
-                                              NULL, 0);
-out:
-       crypt_free(cd);
-       return r;
+       /* we reached max token number, exit */
+       return 0;
 }
 
-static int action_luksBackup(void)
+static int action_reencrypt_luks2(struct crypt_device *cd)
 {
-       struct crypt_device *cd = NULL;
-       int r;
+       size_t i, vk_size, kp_size;
+       int r, keyslot_old = CRYPT_ANY_SLOT, keyslot_new = CRYPT_ANY_SLOT, key_size;
+       char dm_name[PATH_MAX], cipher [MAX_CIPHER_LEN], mode[MAX_CIPHER_LEN], *vk;
+       const char *active_name = NULL;
+       struct keyslot_passwords *kp;
+       struct crypt_params_luks2 luks2_params = {};
+       struct crypt_params_reencrypt params = {
+               .mode = CRYPT_REENCRYPT_REENCRYPT,
+               .direction = opt_data_shift < 0 ? CRYPT_REENCRYPT_BACKWARD : CRYPT_REENCRYPT_FORWARD,
+               .resilience = opt_data_shift ? "datashift" : opt_resilience_mode,
+               .hash = opt_resilience_hash,
+               .data_shift = imaxabs(opt_data_shift) / SECTOR_SIZE,
+               .max_hotzone_size = opt_hotzone_size / SECTOR_SIZE,
+               .device_size = opt_device_size / SECTOR_SIZE,
+               .luks2 = &luks2_params,
+       };
 
-       if (!opt_header_backup_file) {
-               log_err(_("Option --header-backup-file is required.\n"));
-               return -EINVAL;
-       }
+       _set_reencryption_flags(&params.flags);
 
-       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
-               goto out;
+       if (!opt_cipher) {
+               strncpy(cipher, crypt_get_cipher(cd), MAX_CIPHER_LEN - 1);
+               strncpy(mode, crypt_get_cipher_mode(cd), MAX_CIPHER_LEN - 1);
+               cipher[MAX_CIPHER_LEN-1] = '\0';
+               mode[MAX_CIPHER_LEN-1] = '\0';
+       } else if ((r = crypt_parse_name_and_mode(opt_cipher, cipher, NULL, mode))) {
+               log_err(_("No known cipher specification pattern detected."));
+               return r;
+       }
 
-       crypt_set_confirm_callback(cd, yesDialog, NULL);
+       luks2_params.sector_size = opt_sector_size ?: crypt_get_sector_size(cd);
 
-       r = crypt_header_backup(cd, CRYPT_LUKS1, opt_header_backup_file);
-out:
-       crypt_free(cd);
-       return r;
-}
+       r = _check_luks2_keyslots(cd);
+       if (r)
+               return r;
 
-static int action_luksRestore(void)
-{
-       struct crypt_device *cd = NULL;
-       int r = 0;
+       if (opt_key_size)
+               key_size = opt_key_size / 8;
+       else if (opt_cipher)
+               key_size = DEFAULT_LUKS1_KEYBITS / 8;
+       else
+               key_size = crypt_get_volume_key_size(cd);
 
-       if (!opt_header_backup_file) {
-               log_err(_("Option --header-backup-file is required.\n"));
+       if (!key_size)
                return -EINVAL;
+
+       r = crypt_keyslot_max(CRYPT_LUKS2);
+       if (r < 0)
+               return r;
+       kp_size = r;
+       kp = init_keyslot_passwords(kp_size);
+
+       if (!kp)
+               return -ENOMEM;
+
+       r = fill_keyslot_passwords(cd, kp, kp_size);
+       if (r)
+               goto err;
+
+       vk_size = key_size;
+       vk = crypt_safe_alloc(vk_size);
+       if (!vk) {
+               r = -ENOMEM;
+               goto err;
        }
 
-       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
-               goto out;
+       r = -ENOENT;
 
-       crypt_set_confirm_callback(cd, yesDialog, NULL);
-       r = crypt_header_restore(cd, CRYPT_LUKS1, opt_header_backup_file);
-out:
-       crypt_free(cd);
+       for (i = 0; i < kp_size; i++) {
+               if (kp[i].password && keyslot_new < 0) {
+                       r = set_keyslot_params(cd, i);
+                       if (r < 0)
+                               break;
+                       r = crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, NULL, key_size,
+                                       kp[i].password, kp[i].passwordLen, CRYPT_VOLUME_KEY_NO_SEGMENT);
+                       tools_keyslot_msg(r, CREATED);
+                       if (r < 0)
+                               break;
+
+                       kp[i].new = r;
+                       keyslot_new = r;
+                       keyslot_old = i;
+                       r = crypt_volume_key_get(cd, keyslot_new, vk, &vk_size, kp[i].password, kp[i].passwordLen);
+                       if (r < 0)
+                               break;
+                       r = assign_tokens(cd, i, r);
+                       if (r < 0)
+                               break;
+               } else if (kp[i].password) {
+                       r = set_keyslot_params(cd, i);
+                       if (r < 0)
+                               break;
+                       r = crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, vk, key_size,
+                                       kp[i].password, kp[i].passwordLen, CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_DIGEST_REUSE);
+                       tools_keyslot_msg(r, CREATED);
+                       if (r < 0)
+                               break;
+                       kp[i].new = r;
+                       r = assign_tokens(cd, i, r);
+                       if (r < 0)
+                               break;
+               }
+       }
+
+       crypt_safe_free(vk);
+
+       if (r < 0)
+               goto err;
+
+       if (!opt_active_name && !opt_reencrypt_init_only) {
+               r = _get_device_active_name(cd, action_argv[0], dm_name, sizeof(dm_name));
+               if (r > 0)
+                       active_name = dm_name;
+               if (r < 0)
+                       goto err;
+       } else if (opt_active_name)
+               active_name = opt_active_name;
+
+       if (!active_name && !opt_reencrypt_init_only)
+               log_dbg("Device %s seems unused. Proceeding with offline operation.", action_argv[0]);
+
+       r = crypt_reencrypt_init_by_passphrase(cd, active_name, kp[keyslot_old].password,
+                       kp[keyslot_old].passwordLen, keyslot_old, kp[keyslot_old].new,
+                       cipher, mode, &params);
+err:
+       for (i = 0; i < kp_size; i++) {
+               crypt_safe_free(kp[i].password);
+               if (r < 0 && kp[i].new >= 0 &&
+                   crypt_reencrypt_status(cd, NULL) == CRYPT_REENCRYPT_NONE &&
+                   crypt_keyslot_destroy(cd, kp[i].new))
+                       log_dbg("Failed to remove keyslot %d with unbound key.", kp[i].new);
+       }
+       free(kp);
        return r;
 }
 
-static int action_open(void)
+static int action_reencrypt(void)
 {
-       if (!opt_type)
-               return -EINVAL;
+       uint32_t flags;
+       struct crypt_device *cd = NULL;
+       struct crypt_params_integrity ip = { 0 };
+       int r = 0;
 
-       if (!strcmp(opt_type, "luks") || !strcmp(opt_type, "luks1")) {
-               if (action_argc < 2 && !opt_test_passphrase)
-                       goto args;
-               return action_open_luks();
-       } else if (!strcmp(opt_type, "plain")) {
-               if (action_argc < 2)
-                       goto args;
-               return action_open_plain();
-       } else if (!strcmp(opt_type, "loopaes")) {
-               if (action_argc < 2)
-                       goto args;
-               return action_open_loopaes();
-       } else if (!strcmp(opt_type, "tcrypt")) {
-               if (action_argc < 2 && !opt_test_passphrase)
-                       goto args;
-               return action_open_tcrypt();
+       if (action_argc < 1 && (!opt_active_name || opt_encrypt)) {
+               log_err(_("Command requires device as argument."));
+               return -EINVAL;
        }
 
-       log_err(_("Unrecognized metadata device type %s.\n"), opt_type);
-       return -EINVAL;
-args:
-       log_err(_("Command requires device and mapped name as arguments.\n"));
-       return -EINVAL;
-}
+       if (!opt_encrypt || opt_reencrypt_resume_only) {
+               if (opt_active_name) {
+                       r = crypt_init_by_name_and_header(&cd, opt_active_name, opt_header_device);
+                       if (r || !crypt_get_type(cd) || strcmp(crypt_get_type(cd), CRYPT_LUKS2)) {
+                               log_err(_("Device %s is not a valid LUKS device."), opt_active_name);
+                               r = -EINVAL;
+                               goto out;
+                       }
+               } else {
+                       if ((r = crypt_init_data_device(&cd, uuid_or_device(opt_header_device ?: action_argv[0]), action_argv[0])))
+                               return r;
 
-static int action_luksErase(void)
-{
-       struct crypt_device *cd = NULL;
-       crypt_keyslot_info ki;
-       char *msg = NULL;
-       int i, r;
+                       if ((r = crypt_load(cd, CRYPT_LUKS, NULL))) {
+                               log_err(_("Device %s is not a valid LUKS device."),
+                                       uuid_or_device(opt_header_device ?: action_argv[0]));
+                               goto out;
+                       }
+                       if (strcmp(crypt_get_type(cd), CRYPT_LUKS2)) {
+                               log_err(_("Only LUKS2 format is currently supported. Please use cryptsetup-reencrypt tool for LUKS1."));
+                               r = -EINVAL;
+                               goto out;
+                       }
+               }
 
-       if ((r = crypt_init(&cd, uuid_or_device_header(NULL))))
-               goto out;
+               if (crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &flags)) {
+                       r = -EINVAL;
+                       goto out;
+               }
 
-       crypt_set_confirm_callback(cd, yesDialog, NULL);
+               if (flags & CRYPT_REQUIREMENT_OFFLINE_REENCRYPT) {
+                       log_err(_("Legacy offline reencryption already in-progress. Use cryptsetup-reencrypt utility."));
+                       r = -EINVAL;
+                       goto out;
+               }
 
-       if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
-               goto out;
+               if (flags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT)
+                       r = -EBUSY;
 
-       if(asprintf(&msg, _("This operation will erase all keyslots on device %s.\n"
-                           "Device will become unusable after this operation."),
-                           uuid_or_device_header(NULL)) == -1) {
-               r = -ENOMEM;
-               goto out;
+               /* raw integrity info is available since 2.0 */
+               if (crypt_get_integrity_info(cd, &ip) || ip.tag_size) {
+                       log_err(_("Reencryption of device with integrity profile is not supported."));
+                       r = -ENOTSUP;
+                       goto out;
+               }
        }
 
-       if (!yesDialog(msg, NULL)) {
-               r = -EPERM;
-               goto out;
-       }
+       if (r == -EBUSY) {
+               if (opt_reencrypt_init_only)
+                       log_err(_("LUKS2 reencryption already initialized. Aborting operation."));
+               else
+                       r = action_reencrypt_load(cd);
+       } else if (!r && opt_reencrypt_resume_only) {
+               log_err(_("LUKS2 device is not in reencryption."));
+               r = -EINVAL;
+       } else if (opt_decrypt)
+               r = action_decrypt_luks2(cd);
+       else if (opt_encrypt && !opt_reencrypt_resume_only)
+               r = action_encrypt_luks2(&cd);
+       else
+               r = action_reencrypt_luks2(cd);
 
-       for (i = 0; i < crypt_keyslot_max(CRYPT_LUKS1); i++) {
-               ki = crypt_keyslot_status(cd, i);
-               if (ki == CRYPT_SLOT_ACTIVE || ki == CRYPT_SLOT_ACTIVE_LAST) {
-                       r = crypt_keyslot_destroy(cd, i);
-                       if (r < 0)
-                               goto out;
-               }
+       if (r >= 0 && !opt_reencrypt_init_only) {
+               set_int_handler(0);
+               r = crypt_reencrypt(cd, tools_reencrypt_progress);
        }
 out:
-       free(msg);
        crypt_free(cd);
+
        return r;
 }
 
@@ -1357,26 +3343,32 @@ static struct action_type {
        const char *arg_desc;
        const char *desc;
 } action_types[] = {
-       { "open",         action_open,         1, 1, N_("<device> [--type <type>] [<name>]"),N_("open device as mapping <name>") },
+       { "open",         action_open,         1, 1, N_("<device> [--type <type>] [<name>]"),N_("open device as <name>") },
        { "close",        action_close,        1, 1, N_("<name>"), N_("close device (remove mapping)") },
        { "resize",       action_resize,       1, 1, N_("<name>"), N_("resize active device") },
        { "status",       action_status,       1, 0, N_("<name>"), N_("show device status") },
-       { "benchmark",    action_benchmark,    0, 0, N_("<name>"), N_("benchmark cipher") },
+       { "benchmark",    action_benchmark,    0, 0, N_("[--cipher <cipher>]"), N_("benchmark cipher") },
        { "repair",       action_luksRepair,   1, 1, N_("<device>"), N_("try to repair on-disk metadata") },
+       { "reencrypt",    action_reencrypt,    0, 0, N_("<device>"), N_("reencrypt LUKS2 device") },
        { "erase",        action_luksErase ,   1, 1, N_("<device>"), N_("erase all keyslots (remove encryption key)") },
+       { "convert",      action_luksConvert,  1, 1, N_("<device>"), N_("convert LUKS from/to LUKS2 format") },
+       { "config",       action_luksConfig,   1, 1, N_("<device>"), N_("set permanent configuration options for LUKS2") },
        { "luksFormat",   action_luksFormat,   1, 1, N_("<device> [<new key file>]"), N_("formats a LUKS device") },
        { "luksAddKey",   action_luksAddKey,   1, 1, N_("<device> [<new key file>]"), N_("add key to LUKS device") },
        { "luksRemoveKey",action_luksRemoveKey,1, 1, N_("<device> [<key file>]"), N_("removes supplied key or key file from LUKS device") },
        { "luksChangeKey",action_luksChangeKey,1, 1, N_("<device> [<key file>]"), N_("changes supplied key or key file of LUKS device") },
+       { "luksConvertKey",action_luksConvertKey,1, 1, N_("<device> [<key file>]"), N_("converts a key to new pbkdf parameters") },
        { "luksKillSlot", action_luksKillSlot, 2, 1, N_("<device> <key slot>"), N_("wipes key with number <key slot> from LUKS device") },
        { "luksUUID",     action_luksUUID,     1, 0, N_("<device>"), N_("print UUID of LUKS device") },
        { "isLuks",       action_isLuks,       1, 0, N_("<device>"), N_("tests <device> for LUKS partition header") },
        { "luksDump",     action_luksDump,     1, 1, N_("<device>"), N_("dump LUKS partition information") },
        { "tcryptDump",   action_tcryptDump,   1, 1, N_("<device>"), N_("dump TCRYPT device information") },
-       { "luksSuspend",  action_luksSuspend,  1, 1, N_("<device>"), N_("Suspend LUKS device and wipe key (all IOs are frozen).") },
-       { "luksResume",   action_luksResume,   1, 1, N_("<device>"), N_("Resume suspended LUKS device.") },
+       { "bitlkDump",    action_bitlkDump,    1, 1, N_("<device>"), N_("dump BITLK device information") },
+       { "luksSuspend",  action_luksSuspend,  1, 1, N_("<device>"), N_("Suspend LUKS device and wipe key (all IOs are frozen)") },
+       { "luksResume",   action_luksResume,   1, 1, N_("<device>"), N_("Resume suspended LUKS device") },
        { "luksHeaderBackup", action_luksBackup,1,1, N_("<device>"), N_("Backup LUKS device header and keyslots") },
        { "luksHeaderRestore",action_luksRestore,1,1,N_("<device>"), N_("Restore LUKS device header and keyslots") },
+       { "token",        action_token,        2, 0, N_("<add|remove|import|export> <device>"), N_("Manipulate LUKS2 tokens") },
        {}
 };
 
@@ -1388,6 +3380,7 @@ static void help(poptContext popt_context,
 {
        if (key->shortName == '?') {
                struct action_type *action;
+               const struct crypt_pbkdf_type *pbkdf_luks1, *pbkdf_luks2;
 
                log_std("%s\n",PACKAGE_STRING);
 
@@ -1401,8 +3394,8 @@ static void help(poptContext popt_context,
 
                log_std(_("\n"
                          "You can also use old <action> syntax aliases:\n"
-                         "\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen\n"
-                         "\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose\n"));
+                         "\topen: create (plainOpen), luksOpen, loopaesOpen, tcryptOpen, bitlkOpen\n"
+                         "\tclose: remove (plainClose), luksClose, loopaesClose, tcryptClose, bitlkClose\n"));
                log_std(_("\n"
                         "<name> is the device to create under %s\n"
                         "<device> is the encrypted device\n"
@@ -1410,21 +3403,38 @@ static void help(poptContext popt_context,
                         "<key file> optional key file for the new key for luksAddKey action\n"),
                        crypt_get_dir());
 
+               log_std(_("\nDefault compiled-in metadata format is %s (for luksFormat action).\n"),
+                         crypt_get_default_type());
+
+               pbkdf_luks1 = crypt_get_pbkdf_default(CRYPT_LUKS1);
+               pbkdf_luks2 = crypt_get_pbkdf_default(CRYPT_LUKS2);
                log_std(_("\nDefault compiled-in key and passphrase parameters:\n"
                         "\tMaximum keyfile size: %dkB, "
                         "Maximum interactive passphrase length %d (characters)\n"
-                        "Default PBKDF2 iteration time for LUKS: %d (ms)\n"),
+                        "Default PBKDF for LUKS1: %s, iteration time: %d (ms)\n"
+                        "Default PBKDF for LUKS2: %s\n"
+                        "\tIteration time: %d, Memory required: %dkB, Parallel threads: %d\n"),
                         DEFAULT_KEYFILE_SIZE_MAXKB, DEFAULT_PASSPHRASE_SIZE_MAX,
-                        DEFAULT_LUKS1_ITER_TIME);
+                        pbkdf_luks1->type,  pbkdf_luks1->time_ms,
+                        pbkdf_luks2->type, pbkdf_luks2->time_ms, pbkdf_luks2->max_memory_kb,
+                        pbkdf_luks2->parallel_threads);
 
                log_std(_("\nDefault compiled-in device cipher parameters:\n"
                         "\tloop-AES: %s, Key %d bits\n"
                         "\tplain: %s, Key: %d bits, Password hashing: %s\n"
-                        "\tLUKS1: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"),
+                        "\tLUKS: %s, Key: %d bits, LUKS header hashing: %s, RNG: %s\n"),
                         DEFAULT_LOOPAES_CIPHER, DEFAULT_LOOPAES_KEYBITS,
                         DEFAULT_CIPHER(PLAIN), DEFAULT_PLAIN_KEYBITS, DEFAULT_PLAIN_HASH,
                         DEFAULT_CIPHER(LUKS1), DEFAULT_LUKS1_KEYBITS, DEFAULT_LUKS1_HASH,
                         DEFAULT_RNG);
+#if defined(ENABLE_LUKS_ADJUST_XTS_KEYSIZE) && DEFAULT_LUKS1_KEYBITS != 512
+               log_std(_("\tLUKS: Default keysize with XTS mode (two internal keys) will be doubled.\n"));
+#endif
+               poptFreeContext(popt_context);
+               exit(EXIT_SUCCESS);
+       } else if (key->shortName == 'V') {
+               log_std("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+               poptFreeContext(popt_context);
                exit(EXIT_SUCCESS);
        } else
                usage(popt_context, EXIT_SUCCESS, NULL, NULL);
@@ -1469,56 +3479,98 @@ int main(int argc, const char **argv)
                { NULL,    '\0', POPT_ARG_CALLBACK, help, 0, NULL,                         NULL },
                { "help",  '?',  POPT_ARG_NONE,     NULL, 0, N_("Show this help message"), NULL },
                { "usage", '\0', POPT_ARG_NONE,     NULL, 0, N_("Display brief usage"),    NULL },
+               { "version",'V', POPT_ARG_NONE,     NULL, 0, N_("Print package version"),  NULL },
                POPT_TABLEEND
        };
        static struct poptOption popt_options[] = {
                { NULL,                '\0', POPT_ARG_INCLUDE_TABLE, popt_help_options, 0, N_("Help options:"), NULL },
-               { "version",           '\0', POPT_ARG_NONE, &opt_version_mode,          0, N_("Print package version"), NULL },
                { "verbose",           'v',  POPT_ARG_NONE, &opt_verbose,               0, N_("Shows more detailed error messages"), NULL },
                { "debug",             '\0', POPT_ARG_NONE, &opt_debug,                 0, N_("Show debug messages"), NULL },
+               { "debug-json",        '\0', POPT_ARG_NONE, &opt_debug_json,            0, N_("Show debug messages including JSON metadata"), NULL },
                { "cipher",            'c',  POPT_ARG_STRING, &opt_cipher,              0, N_("The cipher used to encrypt the disk (see /proc/crypto)"), NULL },
                { "hash",              'h',  POPT_ARG_STRING, &opt_hash,                0, N_("The hash used to create the encryption key from the passphrase"), NULL },
                { "verify-passphrase", 'y',  POPT_ARG_NONE, &opt_verify_passphrase,     0, N_("Verifies the passphrase by asking for it twice"), NULL },
-               { "key-file",          'd',  POPT_ARG_STRING, &opt_key_file,            5, N_("Read the key from a file."), NULL },
+               { "key-file",          'd',  POPT_ARG_STRING, &opt_key_file,            6, N_("Read the key from a file"), NULL },
                { "master-key-file",  '\0',  POPT_ARG_STRING, &opt_master_key_file,     0, N_("Read the volume (master) key from file."), NULL },
-               { "dump-master-key",  '\0',  POPT_ARG_NONE, &opt_dump_master_key,       0, N_("Dump volume (master) key instead of keyslots info."), NULL },
+               { "dump-master-key",  '\0',  POPT_ARG_NONE, &opt_dump_master_key,       0, N_("Dump volume (master) key instead of keyslots info"), NULL },
                { "key-size",          's',  POPT_ARG_INT, &opt_key_size,               0, N_("The size of the encryption key"), N_("BITS") },
                { "keyfile-size",      'l',  POPT_ARG_LONG, &opt_keyfile_size,          0, N_("Limits the read from keyfile"), N_("bytes") },
-               { "keyfile-offset",   '\0',  POPT_ARG_LONG, &opt_keyfile_offset,        0, N_("Number of bytes to skip in keyfile"), N_("bytes") },
+               { "keyfile-offset",   '\0',  POPT_ARG_STRING, &popt_tmp,                4, N_("Number of bytes to skip in keyfile"), N_("bytes") },
                { "new-keyfile-size", '\0',  POPT_ARG_LONG, &opt_new_keyfile_size,      0, N_("Limits the read from newly added keyfile"), N_("bytes") },
-               { "new-keyfile-offset",'\0', POPT_ARG_LONG, &opt_new_keyfile_offset,    0, N_("Number of bytes to skip in newly added keyfile"), N_("bytes") },
+               { "new-keyfile-offset",'\0', POPT_ARG_STRING, &popt_tmp,                5, N_("Number of bytes to skip in newly added keyfile"), N_("bytes") },
                { "key-slot",          'S',  POPT_ARG_INT, &opt_key_slot,               0, N_("Slot number for new key (default is first free)"), NULL },
                { "size",              'b',  POPT_ARG_STRING, &popt_tmp,                1, N_("The size of the device"), N_("SECTORS") },
+               { "device-size",      '\0',  POPT_ARG_STRING, &opt_device_size_str,     0, N_("Use only specified device size (ignore rest of device). DANGEROUS!"), N_("bytes") },
                { "offset",            'o',  POPT_ARG_STRING, &popt_tmp,                2, N_("The start offset in the backend device"), N_("SECTORS") },
                { "skip",              'p',  POPT_ARG_STRING, &popt_tmp,                3, N_("How many sectors of the encrypted data to skip at the beginning"), N_("SECTORS") },
                { "readonly",          'r',  POPT_ARG_NONE, &opt_readonly,              0, N_("Create a readonly mapping"), NULL },
-               { "iter-time",         'i',  POPT_ARG_INT, &opt_iteration_time,         0, N_("PBKDF2 iteration time for LUKS (in ms)"), N_("msecs") },
                { "batch-mode",        'q',  POPT_ARG_NONE, &opt_batch_mode,            0, N_("Do not ask for confirmation"), NULL },
                { "timeout",           't',  POPT_ARG_INT, &opt_timeout,                0, N_("Timeout for interactive passphrase prompt (in seconds)"), N_("secs") },
+               { "progress-frequency",'\0', POPT_ARG_INT, &opt_progress_frequency,     0, N_("Progress line update (in seconds)"), N_("secs") },
                { "tries",             'T',  POPT_ARG_INT, &opt_tries,                  0, N_("How often the input of the passphrase can be retried"), NULL },
                { "align-payload",     '\0', POPT_ARG_INT, &opt_align_payload,          0, N_("Align payload at <n> sector boundaries - for luksFormat"), N_("SECTORS") },
-               { "header-backup-file",'\0', POPT_ARG_STRING, &opt_header_backup_file,  0, N_("File with LUKS header and keyslots backup."), NULL },
-               { "use-random",        '\0', POPT_ARG_NONE, &opt_random,                0, N_("Use /dev/random for generating volume key."), NULL },
-               { "use-urandom",       '\0', POPT_ARG_NONE, &opt_urandom,               0, N_("Use /dev/urandom for generating volume key."), NULL },
-               { "shared",            '\0', POPT_ARG_NONE, &opt_shared,                0, N_("Share device with another non-overlapping crypt segment."), NULL },
-               { "uuid",              '\0', POPT_ARG_STRING, &opt_uuid,                0, N_("UUID for device to use."), NULL },
-               { "allow-discards",    '\0', POPT_ARG_NONE, &opt_allow_discards,        0, N_("Allow discards (aka TRIM) requests for device."), NULL },
-               { "header",            '\0', POPT_ARG_STRING, &opt_header_device,       0, N_("Device or file with separated LUKS header."), NULL },
-               { "test-passphrase",   '\0', POPT_ARG_NONE, &opt_test_passphrase,       0, N_("Do not activate device, just check passphrase."), NULL },
-               { "tcrypt-hidden",     '\0', POPT_ARG_NONE, &opt_tcrypt_hidden,         0, N_("Use hidden header (hidden TCRYPT device)."), NULL },
-               { "tcrypt-system",     '\0', POPT_ARG_NONE, &opt_tcrypt_system,         0, N_("Device is system TCRYPT drive (with bootloader)."), NULL },
-               { "tcrypt-backup",     '\0', POPT_ARG_NONE, &opt_tcrypt_backup,         0, N_("Use backup (secondary) TCRYPT header."), NULL },
-               { "veracrypt",         '\0', POPT_ARG_NONE, &opt_veracrypt,             0, N_("Scan also for VeraCrypt compatible device."), NULL },
-               { "type",               'M', POPT_ARG_STRING, &opt_type,                0, N_("Type of device metadata: luks, plain, loopaes, tcrypt."), NULL },
-               { "force-password",    '\0', POPT_ARG_NONE, &opt_force_password,        0, N_("Disable password quality check (if enabled)."), NULL },
-               { "perf-same_cpu_crypt",'\0', POPT_ARG_NONE, &opt_perf_same_cpu_crypt,  0, N_("Use dm-crypt same_cpu_crypt performance compatibility option."), NULL },
-               { "perf-submit_from_crypt_cpus",'\0', POPT_ARG_NONE, &opt_perf_submit_from_crypt_cpus,0,N_("Use dm-crypt submit_from_crypt_cpus performance compatibility option."), NULL },
+               { "header-backup-file",'\0', POPT_ARG_STRING, &opt_header_backup_file,  0, N_("File with LUKS header and keyslots backup"), NULL },
+               { "use-random",        '\0', POPT_ARG_NONE, &opt_random,                0, N_("Use /dev/random for generating volume key"), NULL },
+               { "use-urandom",       '\0', POPT_ARG_NONE, &opt_urandom,               0, N_("Use /dev/urandom for generating volume key"), NULL },
+               { "shared",            '\0', POPT_ARG_NONE, &opt_shared,                0, N_("Share device with another non-overlapping crypt segment"), NULL },
+               { "uuid",              '\0', POPT_ARG_STRING, &opt_uuid,                0, N_("UUID for device to use"), NULL },
+               { "allow-discards",    '\0', POPT_ARG_NONE, &opt_allow_discards,        0, N_("Allow discards (aka TRIM) requests for device"), NULL },
+               { "header",            '\0', POPT_ARG_STRING, &opt_header_device,       0, N_("Device or file with separated LUKS header"), NULL },
+               { "test-passphrase",   '\0', POPT_ARG_NONE, &opt_test_passphrase,       0, N_("Do not activate device, just check passphrase"), NULL },
+               { "tcrypt-hidden",     '\0', POPT_ARG_NONE, &opt_tcrypt_hidden,         0, N_("Use hidden header (hidden TCRYPT device)"), NULL },
+               { "tcrypt-system",     '\0', POPT_ARG_NONE, &opt_tcrypt_system,         0, N_("Device is system TCRYPT drive (with bootloader)"), NULL },
+               { "tcrypt-backup",     '\0', POPT_ARG_NONE, &opt_tcrypt_backup,         0, N_("Use backup (secondary) TCRYPT header"), NULL },
+               { "veracrypt",         '\0', POPT_ARG_NONE, &opt_veracrypt,             0, N_("Scan also for VeraCrypt compatible device"), NULL },
+               { "veracrypt-pim",     '\0', POPT_ARG_INT, &opt_veracrypt_pim,          0, N_("Personal Iteration Multiplier for VeraCrypt compatible device"), NULL },
+               { "veracrypt-query-pim", '\0', POPT_ARG_NONE, &opt_veracrypt_query_pim, 0, N_("Query Personal Iteration Multiplier for VeraCrypt compatible device"), NULL },
+               { "type",               'M', POPT_ARG_STRING, &opt_type,                0, N_("Type of device metadata: luks, luks1, luks2, plain, loopaes, tcrypt, bitlk"), NULL },
+               { "force-password",    '\0', POPT_ARG_NONE, &opt_force_password,        0, N_("Disable password quality check (if enabled)"), NULL },
+               { "perf-same_cpu_crypt",'\0', POPT_ARG_NONE, &opt_perf_same_cpu_crypt,  0, N_("Use dm-crypt same_cpu_crypt performance compatibility option"), NULL },
+               { "perf-submit_from_crypt_cpus",'\0', POPT_ARG_NONE, &opt_perf_submit_from_crypt_cpus,0,N_("Use dm-crypt submit_from_crypt_cpus performance compatibility option"), NULL },
+               { "deferred",          '\0', POPT_ARG_NONE, &opt_deferred_remove,       0, N_("Device removal is deferred until the last user closes it"), NULL },
+               { "serialize-memory-hard-pbkdf", '\0', POPT_ARG_NONE, &opt_serialize_memory_hard_pbkdf, 0, N_("Use global lock to serialize memory hard PBKDF (OOM workaround)"), NULL },
+               { "iter-time",         'i',  POPT_ARG_INT, &opt_iteration_time,         0, N_("PBKDF iteration time for LUKS (in ms)"), N_("msecs") },
+               { "pbkdf",             '\0', POPT_ARG_STRING, &opt_pbkdf,               0, N_("PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"), NULL },
+               { "pbkdf-memory",      '\0', POPT_ARG_LONG, &opt_pbkdf_memory,          0, N_("PBKDF memory cost limit"), N_("kilobytes") },
+               { "pbkdf-parallel",    '\0', POPT_ARG_LONG, &opt_pbkdf_parallel,        0, N_("PBKDF parallel cost"), N_("threads") },
+               { "pbkdf-force-iterations",'\0',POPT_ARG_LONG, &opt_pbkdf_iterations,   0, N_("PBKDF iterations cost (forced, disables benchmark)"), NULL },
+               { "priority",          '\0', POPT_ARG_STRING, &opt_priority,            0, N_("Keyslot priority: ignore, normal, prefer"), NULL },
+               { "disable-locks",     '\0', POPT_ARG_NONE, &opt_disable_locks,         0, N_("Disable locking of on-disk metadata"), NULL },
+               { "disable-keyring",   '\0', POPT_ARG_NONE, &opt_disable_keyring,       0, N_("Disable loading volume keys via kernel keyring"), NULL },
+               { "integrity",          'I', POPT_ARG_STRING, &opt_integrity,           0, N_("Data integrity algorithm (LUKS2 only)"), NULL },
+               { "integrity-no-journal",'\0',POPT_ARG_NONE, &opt_integrity_nojournal,  0, N_("Disable journal for integrity device"), NULL },
+               { "integrity-no-wipe", '\0', POPT_ARG_NONE, &opt_integrity_no_wipe,     0, N_("Do not wipe device after format"), NULL },
+               { "integrity-legacy-padding",'\0', POPT_ARG_NONE, &opt_integrity_legacy_padding,0, N_("Use inefficient legacy padding (old kernels)"), NULL },
+               { "token-only",        '\0', POPT_ARG_NONE, &opt_token_only,            0, N_("Do not ask for passphrase if activation by token fails"), NULL },
+               { "token-id",          '\0', POPT_ARG_INT, &opt_token,                  0, N_("Token number (default: any)"), NULL },
+               { "key-description",   '\0', POPT_ARG_STRING, &opt_key_description,     0, N_("Key description"), NULL },
+               { "sector-size",       '\0', POPT_ARG_INT, &opt_sector_size,            0, N_("Encryption sector size (default: 512 bytes)"), NULL },
+               { "iv-large-sectors",  '\0', POPT_ARG_NONE, &opt_iv_large_sectors,      0, N_("Use IV counted in sector size (not in 512 bytes)"), NULL },
+               { "persistent",        '\0', POPT_ARG_NONE, &opt_persistent,            0, N_("Set activation flags persistent for device"), NULL },
+               { "label",             '\0', POPT_ARG_STRING, &opt_label,               0, N_("Set label for the LUKS2 device"), NULL },
+               { "subsystem",         '\0', POPT_ARG_STRING, &opt_subsystem,           0, N_("Set subsystem label for the LUKS2 device"), NULL },
+               { "unbound",           '\0', POPT_ARG_NONE, &opt_unbound,               0, N_("Create or dump unbound (no assigned data segment) LUKS2 keyslot"), NULL },
+               { "json-file",         '\0', POPT_ARG_STRING, &opt_json_file,           0, N_("Read or write the json from or to a file"), NULL },
+               { "luks2-metadata-size",'\0',POPT_ARG_STRING,&opt_luks2_metadata_size_str,0,N_("LUKS2 header metadata area size"), N_("bytes") },
+               { "luks2-keyslots-size",'\0',POPT_ARG_STRING,&opt_luks2_keyslots_size_str,0,N_("LUKS2 header keyslots area size"), N_("bytes") },
+               { "refresh",           '\0', POPT_ARG_NONE, &opt_refresh,               0, N_("Refresh (reactivate) device with new parameters"), NULL },
+               { "keyslot-key-size",  '\0', POPT_ARG_INT, &opt_keyslot_key_size,       0, N_("LUKS2 keyslot: The size of the encryption key"), N_("BITS") },
+               { "keyslot-cipher",    '\0', POPT_ARG_STRING, &opt_keyslot_cipher,      0, N_("LUKS2 keyslot: The cipher used for keyslot encryption"), NULL },
+               { "encrypt",           '\0', POPT_ARG_NONE, &opt_encrypt,               0, N_("Encrypt LUKS2 device (in-place encryption)."), NULL },
+               { "decrypt",           '\0', POPT_ARG_NONE, &opt_decrypt,               0, N_("Decrypt LUKS2 device (remove encryption)."), NULL },
+               { "init-only",         '\0', POPT_ARG_NONE, &opt_reencrypt_init_only,   0, N_("Initialize LUKS2 reencryption in metadata only."), NULL },
+               { "resume-only",       '\0', POPT_ARG_NONE, &opt_reencrypt_resume_only, 0, N_("Resume initialized LUKS2 reencryption only."), NULL },
+               { "reduce-device-size",'\0', POPT_ARG_STRING, &opt_reduce_size_str,     0, N_("Reduce data device size (move data offset). DANGEROUS!"), N_("bytes") },
+               { "hotzone-size",      '\0', POPT_ARG_STRING, &opt_hotzone_size_str,    0, N_("Maximal reencryption hotzone size."), N_("bytes") },
+               { "resilience",        '\0', POPT_ARG_STRING, &opt_resilience_mode,     0, N_("Reencryption hotzone resilience type (checksum,journal,none)"), NULL },
+               { "resilience-hash",   '\0', POPT_ARG_STRING, &opt_resilience_hash,     0, N_("Reencryption hotzone checksums hash"), NULL },
+               { "active-name",       '\0', POPT_ARG_STRING, &opt_active_name,         0, N_("Override device autodetection of dm device to be reencrypted"), NULL },
                POPT_TABLEEND
        };
        poptContext popt_context;
        struct action_type *action;
        const char *aname;
-       int r;
+       int r, total_keyfiles = 0;
 
        crypt_set_log_callback(NULL, tool_log, NULL);
 
@@ -1534,15 +3586,19 @@ int main(int argc, const char **argv)
                unsigned long long ull_value;
                char *endp;
 
-               if (r == 5) {
-                       if (opt_keyfiles_count < MAX_KEYFILES)
-                               opt_keyfiles[opt_keyfiles_count++] = poptGetOptArg(popt_context);
+               if (r == 6) {
+                       const char *kf = poptGetOptArg(popt_context);
+                       if (tools_is_stdin(kf))
+                               opt_keyfile_stdin = kf;
+                       else if (opt_keyfiles_count < MAX_KEYFILES)
+                               opt_keyfiles[opt_keyfiles_count++] = kf;
+                       total_keyfiles++;
                        continue;
                }
 
                errno = 0;
                ull_value = strtoull(popt_tmp, &endp, 0);
-               if (*endp || !*popt_tmp ||
+               if (*endp || !*popt_tmp || !isdigit(*popt_tmp) ||
                    (errno == ERANGE && ull_value == ULLONG_MAX) ||
                    (errno != 0 && ull_value == 0))
                        r = POPT_ERROR_BADNUMBER;
@@ -1558,6 +3614,12 @@ int main(int argc, const char **argv)
                                opt_skip = ull_value;
                                opt_skip_valid = 1;
                                break;
+                       case 4:
+                               opt_keyfile_offset = ull_value;
+                               break;
+                       case 5:
+                               opt_new_keyfile_offset = ull_value;
+                               break;
                }
 
                if (r < 0)
@@ -1568,15 +3630,6 @@ int main(int argc, const char **argv)
                usage(popt_context, EXIT_FAILURE, poptStrerror(r),
                      poptBadOption(popt_context, POPT_BADOPTION_NOALIAS));
 
-       if (crypt_fips_mode())
-               crypt_log(NULL, CRYPT_LOG_VERBOSE, _("Running in FIPS mode.\n"));
-
-       if (opt_version_mode) {
-               log_std("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
-               poptFreeContext(popt_context);
-               exit(EXIT_SUCCESS);
-       }
-
        if (!(aname = poptGetArg(popt_context)))
                usage(popt_context, EXIT_FAILURE, _("Argument <action> missing."),
                      poptGetInvocationName(popt_context));
@@ -1613,19 +3666,35 @@ int main(int argc, const char **argv)
        } else if (!strcmp(aname, "tcryptOpen")) {
                aname = "open";
                opt_type = "tcrypt";
+       } else if (!strcmp(aname, "bitlkOpen")) {
+               aname = "open";
+               opt_type = "bitlk";
        } else if (!strcmp(aname, "tcryptDump")) {
                opt_type = "tcrypt";
+       } else if (!strcmp(aname, "bitlkDump")) {
+               opt_type = "bitlk";
        } else if (!strcmp(aname, "remove") ||
                   !strcmp(aname, "plainClose") ||
                   !strcmp(aname, "luksClose") ||
                   !strcmp(aname, "loopaesClose") ||
-                  !strcmp(aname, "tcryptClose")) {
+                  !strcmp(aname, "tcryptClose") ||
+                  !strcmp(aname, "bitlkClose")) {
                aname = "close";
        } else if (!strcmp(aname, "luksErase")) {
                aname = "erase";
                opt_type = "luks";
+       } else if (!strcmp(aname, "luksConfig")) {
+               aname = "config";
+               opt_type = "luks2";
+       } else if (!strcmp(aname, "refresh")) {
+               aname = "open";
+               opt_refresh = 1;
        }
 
+       /* ignore user supplied type and query device type instead */
+       if (opt_refresh)
+               opt_type = NULL;
+
        for(action = action_types; action->type; action++)
                if (strcmp(action->type, aname) == 0)
                        break;
@@ -1639,40 +3708,82 @@ int main(int argc, const char **argv)
 
        /* FIXME: rewrite this from scratch */
 
-       if (opt_shared && (strcmp(aname, "open") || strcmp(opt_type, "plain")) )
+       if (opt_refresh && opt_test_passphrase)
                usage(popt_context, EXIT_FAILURE,
-                     _("Option --shared is allowed only for open of plain device.\n"),
+                     _("Options --refresh and --test-passphrase are mutually exclusive."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_deferred_remove && strcmp(aname, "close"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --deferred is allowed only for close command."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_shared && (strcmp(aname, "open") || strcmp_or_null(opt_type, "plain")))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --shared is allowed only for open of plain device."),
                      poptGetInvocationName(popt_context));
 
        if (opt_allow_discards && strcmp(aname, "open"))
                usage(popt_context, EXIT_FAILURE,
-                     _("Option --allow-discards is allowed only for open operation.\n"),
+                     _("Option --allow-discards is allowed only for open operation."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_persistent && strcmp(aname, "open"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --persistent is allowed only for open operation."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_serialize_memory_hard_pbkdf && strcmp(aname, "open"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --serialize-memory-hard-pbkdf is allowed only for open operation."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_persistent && opt_test_passphrase)
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --persistent is not allowed with --test-passphrase."),
                      poptGetInvocationName(popt_context));
 
        if (opt_key_size &&
+          strcmp(aname, "reencrypt") &&
           strcmp(aname, "luksFormat") &&
           strcmp(aname, "open") &&
-          strcmp(aname, "benchmark"))
+          strcmp(aname, "benchmark") &&
+          strcmp(aname, "luksAddKey"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --key-size is allowed only for luksFormat, luksAddKey,\n"
+                       "open and benchmark actions. To limit read from keyfile use --keyfile-size=(bytes)."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_integrity && strcmp(aname, "luksFormat"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --integrity is allowed only for luksFormat (LUKS2)."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_integrity_no_wipe && !opt_integrity)
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --integrity-no-wipe"
+                       " can be used only for format action with integrity extension."),
+                     poptGetInvocationName(popt_context));
+
+       if ((opt_label || opt_subsystem) && strcmp(aname, "luksFormat") && strcmp(aname, "config"))
                usage(popt_context, EXIT_FAILURE,
-                     _("Option --key-size is allowed only for luksFormat, open and benchmark.\n"
-                       "To limit read from keyfile use --keyfile-size=(bytes)."),
+                     _("Options --label and --subsystem are allowed only for luksFormat and config LUKS2 operations."),
                      poptGetInvocationName(popt_context));
 
-       if (opt_test_passphrase && (strcmp(aname, "open") ||
-           (strcmp(opt_type, "luks") && strcmp(opt_type, "tcrypt"))))
+       if (opt_test_passphrase && (strcmp(aname, "open") || !opt_type ||
+           (strncmp(opt_type, "luks", 4) && strcmp(opt_type, "tcrypt") && strcmp(opt_type, "bitlk"))))
                usage(popt_context, EXIT_FAILURE,
-                     _("Option --test-passphrase is allowed only for open of LUKS and TCRYPT devices.\n"),
+                     _("Option --test-passphrase is allowed only for open of LUKS, TCRYPT and BITLK devices."),
                      poptGetInvocationName(popt_context));
 
-       if (opt_key_size % 8)
+       if (opt_key_size % 8 || opt_keyslot_key_size % 8)
                usage(popt_context, EXIT_FAILURE,
                      _("Key size must be a multiple of 8 bits"),
                      poptGetInvocationName(popt_context));
 
        if (!strcmp(aname, "luksKillSlot") && action_argc > 1)
                opt_key_slot = atoi(action_argv[1]);
-       if (opt_key_slot != CRYPT_ANY_SLOT &&
-           (opt_key_slot < 0 || opt_key_slot >= crypt_keyslot_max(CRYPT_LUKS1)))
+       if (opt_key_slot != CRYPT_ANY_SLOT && opt_key_slot < 0)
                usage(popt_context, EXIT_FAILURE, _("Key slot is invalid."),
                      poptGetInvocationName(popt_context));
 
@@ -1680,17 +3791,20 @@ int main(int argc, const char **argv)
             !strcmp(aname, "luksFormat")) &&
             action_argc > 1) {
                if (opt_key_file)
-                       log_err(_("Option --key-file takes precedence over specified key file argument.\n"));
+                       log_err(_("Option --key-file takes precedence over specified key file argument."));
                else
                        opt_key_file = action_argv[1];
        }
 
-       if (opt_keyfile_size < 0 || opt_new_keyfile_size < 0 || opt_key_size < 0 ||
-           opt_keyfile_offset < 0 || opt_new_keyfile_offset < 0)
+       if (opt_keyfile_size < 0 || opt_new_keyfile_size < 0 || opt_key_size < 0)
                usage(popt_context, EXIT_FAILURE,
                      _("Negative number for option not permitted."),
                      poptGetInvocationName(popt_context));
 
+       if (total_keyfiles > 1 && (strcmp_or_null(opt_type, "tcrypt")))
+               usage(popt_context, EXIT_FAILURE, _("Only one --key-file argument is allowed."),
+                     poptGetInvocationName(popt_context));
+
        if (opt_random && opt_urandom)
                usage(popt_context, EXIT_FAILURE, _("Only one of --use-[u]random options is allowed."),
                      poptGetInvocationName(popt_context));
@@ -1707,40 +3821,199 @@ int main(int argc, const char **argv)
                usage(popt_context, EXIT_FAILURE, _("Option --align-payload is allowed only for luksFormat."),
                      poptGetInvocationName(popt_context));
 
+       if ((opt_luks2_metadata_size_str || opt_luks2_keyslots_size_str) && strcmp(aname, "luksFormat") && strcmp(aname, "reencrypt"))
+               usage(popt_context, EXIT_FAILURE, _("Options --luks2-metadata-size and --opt-luks2-keyslots-size "
+               "are allowed only for luksFormat with LUKS2."),
+                     poptGetInvocationName(popt_context));
+       if (opt_luks2_metadata_size_str &&
+           tools_string_to_size(NULL, opt_luks2_metadata_size_str, &opt_luks2_metadata_size))
+               usage(popt_context, EXIT_FAILURE, _("Invalid LUKS2 metadata size specification."),
+                     poptGetInvocationName(popt_context));
+       if (opt_luks2_keyslots_size_str &&
+           tools_string_to_size(NULL, opt_luks2_keyslots_size_str, &opt_luks2_keyslots_size))
+               usage(popt_context, EXIT_FAILURE, _("Invalid LUKS2 keyslots size specification."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_align_payload && opt_offset)
+               usage(popt_context, EXIT_FAILURE, _("Options --align-payload and --offset cannot be combined."),
+                     poptGetInvocationName(popt_context));
+
        if (opt_skip && (strcmp(aname, "open") ||
-           (strcmp(opt_type, "plain") && strcmp(opt_type, "loopaes"))))
+           (strcmp_or_null(opt_type, "plain") && strcmp(opt_type, "loopaes"))))
                usage(popt_context, EXIT_FAILURE,
-               _("Option --skip is supported only for open of plain and loopaes devices.\n"),
+               _("Option --skip is supported only for open of plain and loopaes devices."),
                poptGetInvocationName(popt_context));
 
-       if (opt_offset && (strcmp(aname, "open") ||
-           (strcmp(opt_type, "plain") && strcmp(opt_type, "loopaes"))))
+       if (opt_offset && ((strcmp(aname, "reencrypt") && strcmp(aname, "open") && strcmp(aname, "luksFormat")) ||
+           (!strcmp(aname, "open") && strcmp_or_null(opt_type, "plain") && strcmp(opt_type, "loopaes")) ||
+           (!strcmp(aname, "luksFormat") && opt_type && strncmp(opt_type, "luks", 4))))
                usage(popt_context, EXIT_FAILURE,
-               _("Option --offset is supported only for open of plain and loopaes devices.\n"),
+               _("Option --offset is supported only for open of plain and loopaes devices, luksFormat and device reencryption."),
                poptGetInvocationName(popt_context));
 
        if ((opt_tcrypt_hidden || opt_tcrypt_system || opt_tcrypt_backup) && strcmp(aname, "tcryptDump") &&
-           (strcmp(aname, "open") || strcmp(opt_type, "tcrypt")))
+           (strcmp(aname, "open") || !opt_type || strcmp(opt_type, "tcrypt")))
                usage(popt_context, EXIT_FAILURE,
-               _("Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device.\n"),
+               _("Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device."),
                poptGetInvocationName(popt_context));
 
        if (opt_tcrypt_hidden && opt_allow_discards)
                usage(popt_context, EXIT_FAILURE,
-               _("Option --tcrypt-hidden cannot be combined with --allow-discards.\n"),
+               _("Option --tcrypt-hidden cannot be combined with --allow-discards."),
                poptGetInvocationName(popt_context));
 
-       if (opt_veracrypt && strcmp(opt_type, "tcrypt"))
+       if (opt_veracrypt && (!opt_type || strcmp(opt_type, "tcrypt")))
                usage(popt_context, EXIT_FAILURE,
-               _("Option --veracrypt is supported only for TCRYPT device type.\n"),
+               _("Option --veracrypt is supported only for TCRYPT device type."),
                poptGetInvocationName(popt_context));
 
-       if (opt_debug) {
+       if (opt_veracrypt_pim != -1) {
+               if (opt_veracrypt_pim < -1) {
+                       usage(popt_context, EXIT_FAILURE,
+                       _("Invalid argument for parameter --veracrypt-pim supplied."),
+                       poptGetInvocationName(popt_context));
+               } else if (!opt_veracrypt) {
+                       usage(popt_context, EXIT_FAILURE,
+                       _("Option --veracrypt-pim is supported only for VeraCrypt compatible devices."),
+                       poptGetInvocationName(popt_context));
+               }
+       }
+
+       if (opt_veracrypt_query_pim) {
+               if (!opt_veracrypt) {
+                       usage(popt_context, EXIT_FAILURE,
+                       _("Option --veracrypt-query-pim is supported only for VeraCrypt compatible devices."),
+                       poptGetInvocationName(popt_context));
+               } else if (opt_veracrypt_pim != -1) {
+                       usage(popt_context, EXIT_FAILURE,
+                       _("The options --veracrypt-pim and --veracrypt-query-pim are mutually exclusive."),
+                       poptGetInvocationName(popt_context));
+               }
+       }
+
+       if (opt_priority && strcmp(opt_priority, "normal") && strcmp(opt_priority, "prefer") && strcmp(opt_priority, "ignore"))
+               usage(popt_context, EXIT_FAILURE,
+               _("Option --priority can be only ignore/normal/prefer."),
+               poptGetInvocationName(popt_context));
+
+       if (!strcmp(aname, "config") && opt_priority && opt_key_slot == CRYPT_ANY_SLOT)
+               usage(popt_context, EXIT_FAILURE,
+               _("Keyslot specification is required."),
+               poptGetInvocationName(popt_context));
+
+       if (opt_pbkdf && crypt_parse_pbkdf(opt_pbkdf, &opt_pbkdf))
+               usage(popt_context, EXIT_FAILURE,
+               _("Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."),
+               poptGetInvocationName(popt_context));
+
+       if (opt_pbkdf_iterations && opt_iteration_time)
+               usage(popt_context, EXIT_FAILURE,
+               _("PBKDF forced iterations cannot be combined with iteration time option."),
+               poptGetInvocationName(popt_context));
+
+       if (opt_sector_size && strcmp(aname, "reencrypt") && strcmp(aname, "luksFormat") &&
+           (strcmp(aname, "open") || strcmp_or_null(opt_type, "plain")))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Sector size option is not supported for this command."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_sector_size && (opt_sector_size < SECTOR_SIZE || opt_sector_size > MAX_SECTOR_SIZE ||
+           (opt_sector_size & (opt_sector_size - 1))))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Unsupported encryption sector size."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_iv_large_sectors && (strcmp(aname, "open") || strcmp_or_null(opt_type, "plain") ||
+           opt_sector_size <= SECTOR_SIZE))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Large IV sectors option is supported only for opening plain type device with sector size larger than 512 bytes."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_unbound && !opt_key_size && !strcmp(aname, "luksAddKey"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Key size is required with --unbound option."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_unbound && !strcmp(aname, "luksDump") && opt_key_slot == CRYPT_ANY_SLOT)
+               usage(popt_context, EXIT_FAILURE,
+                     _("Keyslot specification is required."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_unbound && strcmp(aname, "luksAddKey") && strcmp(aname, "luksDump"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --unbound may be used only with luksAddKey and luksDump actions."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_refresh && strcmp(aname, "open"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --refresh may be used only with open action."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_debug || opt_debug_json) {
+               opt_debug = 1;
                opt_verbose = 1;
-               crypt_set_debug_level(-1);
+               crypt_set_debug_level(opt_debug_json? CRYPT_DEBUG_JSON : CRYPT_DEBUG_ALL);
                dbg_version_and_cmd(argc, argv);
        }
 
+       if (opt_disable_locks && crypt_metadata_locking(NULL, 0)) {
+               log_std(_("Cannot disable metadata locking."));
+               poptFreeContext(popt_context);
+               exit(EXIT_FAILURE);
+       }
+
+       if (opt_disable_keyring)
+               (void) crypt_volume_key_keyring(NULL, 0);
+
+       if (opt_hotzone_size_str &&
+           (tools_string_to_size(NULL, opt_hotzone_size_str, &opt_hotzone_size) || !opt_hotzone_size))
+               usage(popt_context, EXIT_FAILURE, _("Invalid max reencryption hotzone size specification."),
+                     poptGetInvocationName(popt_context));
+
+       if (!opt_hotzone_size && opt_resilience_mode && !strcmp(opt_resilience_mode, "none"))
+               opt_hotzone_size = 50 * 1024 * 1024;
+
+       if (opt_reduce_size_str &&
+           tools_string_to_size(NULL, opt_reduce_size_str, &opt_reduce_size))
+               usage(popt_context, EXIT_FAILURE, _("Invalid device size specification."),
+                     poptGetInvocationName(popt_context));
+       if (opt_reduce_size > 1024 * 1024 * 1024)
+               usage(popt_context, EXIT_FAILURE, _("Maximum device reduce size is 1 GiB."),
+                     poptGetInvocationName(popt_context));
+       if (opt_reduce_size % SECTOR_SIZE)
+               usage(popt_context, EXIT_FAILURE, _("Reduce size must be multiple of 512 bytes sector."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_device_size_str &&
+           tools_string_to_size(NULL, opt_device_size_str, &opt_device_size))
+               usage(popt_context, EXIT_FAILURE, _("Invalid data size specification."),
+                     poptGetInvocationName(popt_context));
+
+       opt_data_shift = -(int64_t)opt_reduce_size;
+       if (opt_data_shift > 0)
+               usage(popt_context, EXIT_FAILURE, _("Reduce size overflow."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_decrypt && !opt_header_device)
+               usage(popt_context, EXIT_FAILURE, _("LUKS2 decryption requires option --header."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_device_size % SECTOR_SIZE)
+               usage(popt_context, EXIT_FAILURE, _("Device size must be multiple of 512 bytes sector."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_data_shift && opt_device_size)
+               usage(popt_context, EXIT_FAILURE, _("Options --reduce-device-size and --data-size cannot be combined."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_device_size && opt_size)
+               usage(popt_context, EXIT_FAILURE, _("Options --device-size and --size cannot be combined."),
+                     poptGetInvocationName(popt_context));
+
+       if ((opt_keyslot_cipher && !opt_keyslot_key_size) || (!opt_keyslot_cipher && opt_keyslot_key_size))
+               usage(popt_context, EXIT_FAILURE, _("Options --keyslot-cipher and --keyslot-key-size must be used together."),
+                     poptGetInvocationName(popt_context));
+
        r = run_action(action);
        poptFreeContext(popt_context);
        return r;
index 5d322cf..1afcf43 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * cryptsetup - setup cryptographic volumes for dm-crypt
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2014, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #include <fcntl.h>
 #include <popt.h>
 #include <sys/stat.h>
+#include <sys/time.h>
 
 #include "lib/nls.h"
 #include "lib/utils_crypt.h"
 #include "lib/utils_loop.h"
 #include "lib/utils_fips.h"
+#include "lib/utils_io.h"
+#include "lib/utils_blkid.h"
 
 #include "libcryptsetup.h"
 
 #define CONST_CAST(x) (x)(uintptr_t)
 #define DEFAULT_CIPHER(type)   (DEFAULT_##type##_CIPHER "-" DEFAULT_##type##_MODE)
 #define SECTOR_SIZE 512
+#define MAX_SECTOR_SIZE 4096
 #define ROUND_SECTOR(x) (((x) + SECTOR_SIZE - 1) / SECTOR_SIZE)
 
+#define DEFAULT_WIPE_BLOCK     1048576 /* 1 MiB */
+
 extern int opt_debug;
+extern int opt_debug_json;
 extern int opt_verbose;
 extern int opt_batch_mode;
 extern int opt_force_password;
+extern int opt_progress_frequency;
 
 /* Common tools */
 void clogger(struct crypt_device *cd, int level, const char *file, int line,
@@ -61,7 +69,8 @@ void clogger(struct crypt_device *cd, int level, const char *file, int line,
 void tool_log(int level, const char *msg, void *usrptr __attribute__((unused)));
 void quiet_log(int level, const char *msg, void *usrptr);
 
-int yesDialog(const char *msg, void *usrptr __attribute__((unused)));
+int yesDialog(const char *msg, void *usrptr);
+int noDialog(const char *msg, void *usrptr);
 void show_status(int errcode);
 const char *uuid_or_device(const char *spec);
 __attribute__ ((noreturn)) \
@@ -69,6 +78,10 @@ void usage(poptContext popt_context, int exitcode, const char *error, const char
 void dbg_version_and_cmd(int argc, const char **argv);
 int translate_errno(int r);
 
+typedef enum { CREATED, UNLOCKED, REMOVED  } crypt_object_op;
+void tools_keyslot_msg(int keyslot, crypt_object_op op);
+void tools_token_msg(int token, crypt_object_op op);
+
 extern volatile int quit;
 void set_int_block(int block);
 void set_int_handler(int block);
@@ -77,10 +90,31 @@ int tools_signals_blocked(void);
 
 int tools_get_key(const char *prompt,
                  char **key, size_t *key_size,
-                 size_t keyfile_offset, size_t keyfile_size_max,
+                 uint64_t keyfile_offset, size_t keyfile_size_max,
                  const char *key_file,
                  int timeout, int verify, int pwquality,
                  struct crypt_device *cd);
+void tools_passphrase_msg(int r);
+int tools_is_stdin(const char *key_file);
+int tools_string_to_size(struct crypt_device *cd, const char *s, uint64_t *size);
+int tools_is_cipher_null(const char *cipher);
+
+void tools_clear_line(void);
+
+int tools_wipe_progress(uint64_t size, uint64_t offset, void *usrptr);
+int tools_reencrypt_progress(uint64_t size, uint64_t offset, void *usrptr);
+
+int tools_read_mk(const char *file, char **key, int keysize);
+int tools_write_mk(const char *file, const char *key, int keysize);
+
+int tools_read_json_file(struct crypt_device *cd, const char *file, char **json, size_t *json_size);
+int tools_write_json_file(struct crypt_device *cd, const char *file, const char *json);
+
+int tools_detect_signatures(const char *device, int ignore_luks, size_t *count);
+int tools_wipe_all_signatures(const char *path);
+
+int tools_lookup_crypt_device(struct crypt_device *cd, const char *type,
+               const char *data_device_path, char *name, size_t name_length);
 
 /* Log */
 #define log_dbg(x...) clogger(NULL, CRYPT_LOG_DEBUG, __FILE__, __LINE__, x)
index 1db3588..a536093 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * cryptsetup-reencrypt - crypt utility for offline re-encryption
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2015, Milan Broz All rights reserved.
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 
 #include "cryptsetup.h"
 #include <sys/ioctl.h>
-#include <sys/time.h>
 #include <linux/fs.h>
 #include <arpa/inet.h>
+#include <uuid/uuid.h>
 
-#define PACKAGE_REENC "crypt_reencrypt"
+#define PACKAGE_REENC "cryptsetup-reencrypt"
 
 #define NO_UUID "cafecafe-cafe-cafe-cafe-cafecafeeeee"
-#define MAX_BCK_SECTORS 8192
 
 static const char *opt_cipher = NULL;
 static const char *opt_hash = NULL;
 static const char *opt_key_file = NULL;
+static const char *opt_master_key_file = NULL;
+static const char *opt_uuid = NULL;
+static const char *opt_type = "luks";
 static long opt_keyfile_size = 0;
 static long opt_keyfile_offset = 0;
-static int opt_iteration_time = 1000;
-static int opt_version_mode = 0;
+static int opt_iteration_time = 0;
+static const char *opt_pbkdf = NULL;
+static long opt_pbkdf_memory = DEFAULT_LUKS2_MEMORY_KB;
+static long opt_pbkdf_parallel = DEFAULT_LUKS2_PARALLEL_THREADS;
+static long opt_pbkdf_iterations = 0;
 static int opt_random = 0;
 static int opt_urandom = 0;
 static int opt_bsize = 4;
@@ -49,6 +54,7 @@ static int opt_key_size = 0;
 static int opt_new = 0;
 static int opt_keep_key = 0;
 static int opt_decrypt = 0;
+static const char *opt_header_device = NULL;
 
 static const char *opt_reduce_size_str = NULL;
 static uint64_t opt_reduce_size = 0;
@@ -58,21 +64,27 @@ static uint64_t opt_device_size = 0;
 
 static const char **action_argv;
 
-#define MAX_SLOT 8
+#define MAX_SLOT 32
+#define MAX_TOKEN 32
 struct reenc_ctx {
        char *device;
+       char *device_header;
        char *device_uuid;
-       uint64_t device_size; /* overrided by parameter */
+       const char *type;
+       uint64_t device_size; /* overridden by parameter */
        uint64_t device_size_new_real;
        uint64_t device_size_org_real;
        uint64_t device_offset;
        uint64_t device_shift;
+       uint64_t data_offset;
 
-       int in_progress:1;
+       unsigned int stained:1;
+       unsigned int in_progress:1;
        enum { FORWARD = 0, BACKWARD = 1 } reencrypt_direction;
        enum { REENCRYPT = 0, ENCRYPT = 1, DECRYPT = 2 } reencrypt_mode;
 
        char header_file_org[PATH_MAX];
+       char header_file_tmp[PATH_MAX];
        char header_file_new[PATH_MAX];
        char log_file[PATH_MAX];
 
@@ -87,7 +99,6 @@ struct reenc_ctx {
        } p[MAX_SLOT];
        int keyslot;
 
-       struct timeval start_time, end_time;
        uint64_t resume_bytes;
 };
 
@@ -109,13 +120,6 @@ static void _quiet_log(int level, const char *msg, void *usrptr)
        tool_log(level, msg, usrptr);
 }
 
-/* The difference in seconds between two times in "timeval" format. */
-static double time_diff(struct timeval start, struct timeval end)
-{
-       return (end.tv_sec - start.tv_sec)
-               + (end.tv_usec - start.tv_usec) / 1E6;
-}
-
 static int alignment(int fd)
 {
        int alignment;
@@ -132,23 +136,80 @@ static size_t pagesize(void)
        return r < 0 ? 4096 : (size_t)r;
 }
 
+static const char *luksType(const char *type)
+{
+       if (type && !strcmp(type, "luks2"))
+               return CRYPT_LUKS2;
+
+       if (type && !strcmp(type, "luks1"))
+               return CRYPT_LUKS1;
+
+       if (!type || !strcmp(type, "luks"))
+               return crypt_get_default_type();
+
+       return NULL;
+}
+
+static const char *hdr_device(const struct reenc_ctx *rc)
+{
+       return rc->device_header ?: rc->device;
+}
+
+static int set_reencrypt_requirement(const struct reenc_ctx *rc)
+{
+       uint32_t reqs;
+       int r = -EINVAL;
+       struct crypt_device *cd = NULL;
+       struct crypt_params_integrity ip = { 0 };
+
+       if (crypt_init(&cd, hdr_device(rc)) ||
+           crypt_load(cd, CRYPT_LUKS2, NULL) ||
+           crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &reqs))
+               goto out;
+
+       /* reencrypt already in-progress */
+       if (reqs & CRYPT_REQUIREMENT_OFFLINE_REENCRYPT) {
+               log_err(_("Reencryption already in-progress."));
+               goto out;
+       }
+
+       /* raw integrity info is available since 2.0 */
+       if (crypt_get_integrity_info(cd, &ip) || ip.tag_size) {
+               log_err(_("Reencryption of device with integrity profile is not supported."));
+               r = -ENOTSUP;
+               goto out;
+       }
+
+       r = crypt_persistent_flags_set(cd, CRYPT_FLAGS_REQUIREMENTS, reqs | CRYPT_REQUIREMENT_OFFLINE_REENCRYPT);
+out:
+       crypt_free(cd);
+       return r;
+}
+
 /* Depends on the first two fields of LUKS1 header format, magic and version */
-static int device_check(struct reenc_ctx *rc, header_magic set_magic)
+static int device_check(struct reenc_ctx *rc, const char *device, header_magic set_magic)
 {
        char *buf = NULL;
        int r, devfd;
        ssize_t s;
        uint16_t version;
        size_t buf_size = pagesize();
+       struct stat st;
 
-       devfd = open(rc->device, O_RDWR | O_EXCL | O_DIRECT);
+       if (stat(device, &st)) {
+               log_err(_("Cannot open device %s."), device);
+               return -EINVAL;
+       }
+
+       /* coverity[toctou] */
+       devfd = open(device, O_RDWR | (S_ISBLK(st.st_mode) ? O_EXCL : 0));
        if (devfd == -1) {
                if (errno == EBUSY) {
-                       log_err(_("Cannot exclusively open %s, device in use.\n"),
-                               rc->device);
+                       log_err(_("Cannot exclusively open %s, device in use."),
+                               device);
                        return -EBUSY;
                }
-               log_err(_("Cannot open device %s\n"), rc->device);
+               log_err(_("Cannot open device %s."), device);
                return -EINVAL;
        }
 
@@ -158,14 +219,14 @@ static int device_check(struct reenc_ctx *rc, header_magic set_magic)
        }
 
        if (posix_memalign((void *)&buf, alignment(devfd), buf_size)) {
-               log_err(_("Allocation of aligned memory failed.\n"));
+               log_err(_("Allocation of aligned memory failed."));
                r = -ENOMEM;
                goto out;
        }
 
        s = read(devfd, buf, buf_size);
        if (s < 0 || s != (ssize_t)buf_size) {
-               log_err(_("Cannot read device %s.\n"), rc->device);
+               log_err(_("Cannot read device %s."), device);
                r = -EIO;
                goto out;
        }
@@ -176,14 +237,14 @@ static int device_check(struct reenc_ctx *rc, header_magic set_magic)
 
        if (set_magic == MAKE_UNUSABLE && !memcmp(buf, MAGIC, MAGIC_L) &&
            version == 1) {
-               log_verbose(_("Marking LUKS device %s unusable.\n"), rc->device);
+               log_verbose(_("Marking LUKS1 device %s unusable."), device);
                memcpy(buf, NOMAGIC, MAGIC_L);
                r = 0;
-       } else if (set_magic == MAKE_USABLE && !memcmp(buf, NOMAGIC, MAGIC_L) &&
-                  version == 1) {
-               log_verbose(_("Marking LUKS device %s usable.\n"), rc->device);
-               memcpy(buf, MAGIC, MAGIC_L);
-               r = 0;
+       } else if (set_magic == MAKE_UNUSABLE && version == 2) {
+               log_verbose(_("Setting LUKS2 offline reencrypt flag on device %s."), device);
+               r = set_reencrypt_requirement(rc);
+               if (!r)
+                       rc->stained = 1;
        } else if (set_magic == CHECK_UNUSABLE && version == 1) {
                r = memcmp(buf, NOMAGIC, MAGIC_L) ? -EINVAL : 0;
                if (!r)
@@ -192,16 +253,19 @@ static int device_check(struct reenc_ctx *rc, header_magic set_magic)
        } else
                r = -EINVAL;
 
-       if (!r) {
+       if (!r && version == 1) {
                if (lseek(devfd, 0, SEEK_SET) == -1)
                        goto out;
                s = write(devfd, buf, buf_size);
-               if (s < 0 || s != (ssize_t)buf_size) {
-                       log_err(_("Cannot write device %s.\n"), rc->device);
+               if (s < 0 || s != (ssize_t)buf_size || fsync(devfd) < 0) {
+                       log_err(_("Cannot write device %s."), device);
                        r = -EIO;
                }
-       } else
-               log_dbg("LUKS signature check failed for %s.", rc->device);
+               if (s > 0 && set_magic == MAKE_UNUSABLE)
+                       rc->stained = 1;
+       }
+       if (r)
+               log_dbg("LUKS signature check failed for %s.", device);
 out:
        if (buf)
                memset(buf, 0, buf_size);
@@ -210,55 +274,19 @@ out:
        return r;
 }
 
-static int create_empty_header(const char *new_file, const char *old_file,
-                              uint64_t data_sector)
+static int create_empty_header(const char *new_file)
 {
-       struct stat st;
-       ssize_t size = 0;
        int fd, r = 0;
-       char *buf;
 
-       /* Never create header > 4MiB */
-       if (data_sector > MAX_BCK_SECTORS)
-               data_sector = MAX_BCK_SECTORS;
+       log_dbg("Creating empty file %s of size 4096.", new_file);
 
-       /* new header file of the same size as old backup */
-       if (old_file) {
-               if (stat(old_file, &st) == -1 ||
-                   (st.st_mode & S_IFMT) != S_IFREG ||
-                   (st.st_size > 16 * 1024 * 1024))
-                       return -EINVAL;
-               size = st.st_size;
-       }
-
-       /*
-        * if requesting key size change, try to use offset
-        * here can be enough space to fit new key.
-        */
-       if (opt_key_size)
-               size = data_sector * SECTOR_SIZE;
-
-       /* if reducing size, be sure we have enough space */
-       if (opt_reduce_size)
-               size += opt_reduce_size;
-
-       log_dbg("Creating empty file %s of size %lu.", new_file, (unsigned long)size);
-
-       if (!size || !(buf = malloc(size)))
-               return -ENOMEM;
-       memset(buf, 0, size);
-
-       fd = creat(new_file, S_IRUSR|S_IWUSR);
-       if(fd == -1) {
-               free(buf);
-               return -EINVAL;
-       }
-
-       if (write(fd, buf, size) < size)
-               r = -EIO;
+       /* coverity[toctou] */
+       fd = open(new_file, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR);
+       if (fd == -1 || posix_fallocate(fd, 0, 4096))
+               r = -EINVAL;
+       if (fd >= 0)
+               close(fd);
 
-       close(fd);
-       free(buf);
        return r;
 }
 
@@ -278,7 +306,7 @@ static int write_log(struct reenc_ctx *rc)
 
        r = write(rc->log_fd, rc->log_buf, SECTOR_SIZE);
        if (r < 0 || r != SECTOR_SIZE) {
-               log_err(_("Cannot write reencryption log file.\n"));
+               log_err(_("Cannot write reencryption log file."));
                return -EIO;
        }
 
@@ -334,7 +362,7 @@ static int parse_log(struct reenc_ctx *rc)
 
        s = read(rc->log_fd, rc->log_buf, SECTOR_SIZE);
        if (s == -1) {
-               log_err(_("Cannot read reencryption log file.\n"));
+               log_err(_("Cannot read reencryption log file."));
                return -EIO;
        }
 
@@ -345,7 +373,7 @@ static int parse_log(struct reenc_ctx *rc)
                if (end) {
                        *end++ = '\0';
                        if (parse_line_log(rc, start)) {
-                               log_err("Wrong log format.\n");
+                               log_err("Wrong log format.");
                                return -EINVAL;
                        }
                }
@@ -370,6 +398,7 @@ static int open_log(struct reenc_ctx *rc)
        rc->log_fd = open(rc->log_file, O_RDWR|O_EXCL|O_CREAT|flags, S_IRUSR|S_IWUSR);
        if (rc->log_fd != -1) {
                log_dbg("Created LUKS reencryption log file %s.", rc->log_file);
+               rc->stained = 0;
        } else if (errno == EEXIST) {
                log_std(_("Log file %s exists, resuming reencryption.\n"), rc->log_file);
                rc->log_fd = open(rc->log_file, O_RDWR|flags);
@@ -391,29 +420,48 @@ static int open_log(struct reenc_ctx *rc)
 static int activate_luks_headers(struct reenc_ctx *rc)
 {
        struct crypt_device *cd = NULL, *cd_new = NULL;
+       const char *pwd_old, *pwd_new, pwd_empty[] = "";
+       size_t pwd_old_len, pwd_new_len;
        int r;
 
        log_dbg("Activating LUKS devices from headers.");
 
-       if ((r = crypt_init(&cd, rc->header_file_org)) ||
-           (r = crypt_load(cd, CRYPT_LUKS1, NULL)) ||
-           (r = crypt_set_data_device(cd, rc->device)))
+       /* Never use real password for empty header processing */
+       if (rc->reencrypt_mode == REENCRYPT) {
+               pwd_old = rc->p[rc->keyslot].password;
+               pwd_old_len = rc->p[rc->keyslot].passwordLen;
+               pwd_new = pwd_old;
+               pwd_new_len = pwd_old_len;
+       } else if (rc->reencrypt_mode == DECRYPT) {
+               pwd_old = rc->p[rc->keyslot].password;
+               pwd_old_len = rc->p[rc->keyslot].passwordLen;
+               pwd_new = pwd_empty;
+               pwd_new_len = 0;
+       } else if (rc->reencrypt_mode == ENCRYPT) {
+               pwd_old = pwd_empty;
+               pwd_old_len = 0;
+               pwd_new = rc->p[rc->keyslot].password;
+               pwd_new_len = rc->p[rc->keyslot].passwordLen;
+       } else
+               return -EINVAL;
+
+       if ((r = crypt_init_data_device(&cd, rc->header_file_org, rc->device)) ||
+           (r = crypt_load(cd, CRYPT_LUKS, NULL)))
                goto out;
 
-       log_verbose(_("Activating temporary device using old LUKS header.\n"));
+       log_verbose(_("Activating temporary device using old LUKS header."));
        if ((r = crypt_activate_by_passphrase(cd, rc->header_file_org,
-               opt_key_slot, rc->p[rc->keyslot].password, rc->p[rc->keyslot].passwordLen,
+               opt_key_slot, pwd_old, pwd_old_len,
                CRYPT_ACTIVATE_READONLY|CRYPT_ACTIVATE_PRIVATE)) < 0)
                goto out;
 
-       if ((r = crypt_init(&cd_new, rc->header_file_new)) ||
-           (r = crypt_load(cd_new, CRYPT_LUKS1, NULL)) ||
-           (r = crypt_set_data_device(cd_new, rc->device)))
+       if ((r = crypt_init_data_device(&cd_new, rc->header_file_new, rc->device)) ||
+           (r = crypt_load(cd_new, CRYPT_LUKS, NULL)))
                goto out;
 
-       log_verbose(_("Activating temporary device using new LUKS header.\n"));
+       log_verbose(_("Activating temporary device using new LUKS header."));
        if ((r = crypt_activate_by_passphrase(cd_new, rc->header_file_new,
-               opt_key_slot, rc->p[rc->keyslot].password, rc->p[rc->keyslot].passwordLen,
+               opt_key_slot, pwd_new, pwd_new_len,
                CRYPT_ACTIVATE_SHARED|CRYPT_ACTIVATE_PRIVATE)) < 0)
                goto out;
        r = 0;
@@ -421,14 +469,73 @@ out:
        crypt_free(cd);
        crypt_free(cd_new);
        if (r < 0)
-               log_err(_("Activation of temporary devices failed.\n"));
+               log_err(_("Activation of temporary devices failed."));
+       return r;
+}
+
+static int set_pbkdf_params(struct crypt_device *cd, const char *dev_type)
+{
+       const struct crypt_pbkdf_type *pbkdf_default;
+       struct crypt_pbkdf_type pbkdf = {};
+
+       pbkdf_default = crypt_get_pbkdf_default(dev_type);
+       if (!pbkdf_default)
+               return -EINVAL;
+
+       pbkdf.type = opt_pbkdf ?: pbkdf_default->type;
+       pbkdf.hash = opt_hash ?: pbkdf_default->hash;
+       pbkdf.time_ms = (uint32_t)opt_iteration_time ?: pbkdf_default->time_ms;
+       if (strcmp(pbkdf.type, CRYPT_KDF_PBKDF2)) {
+               pbkdf.max_memory_kb = (uint32_t)opt_pbkdf_memory ?: pbkdf_default->max_memory_kb;
+               pbkdf.parallel_threads = (uint32_t)opt_pbkdf_parallel ?: pbkdf_default->parallel_threads;
+       }
+
+       if (opt_pbkdf_iterations) {
+               pbkdf.iterations = opt_pbkdf_iterations;
+               pbkdf.time_ms = 0;
+               pbkdf.flags |= CRYPT_PBKDF_NO_BENCHMARK;
+       }
+
+       return crypt_set_pbkdf_type(cd, &pbkdf);
+}
+
+static int create_new_keyslot(struct reenc_ctx *rc, int keyslot,
+                             struct crypt_device *cd_old,
+                             struct crypt_device *cd_new)
+{
+       int r;
+       char *key = NULL;
+       size_t key_size;
+
+       if (cd_old && crypt_keyslot_status(cd_old, keyslot) == CRYPT_SLOT_UNBOUND) {
+               key_size = 4096;
+               key = crypt_safe_alloc(key_size);
+               if (!key)
+                       return -ENOMEM;
+               r = crypt_volume_key_get(cd_old, keyslot, key, &key_size,
+                       rc->p[keyslot].password, rc->p[keyslot].passwordLen);
+               if (r == keyslot) {
+                       r = crypt_keyslot_add_by_key(cd_new, keyslot, key, key_size,
+                               rc->p[keyslot].password, rc->p[keyslot].passwordLen,
+                               CRYPT_VOLUME_KEY_NO_SEGMENT);
+               } else
+                       r = -EINVAL;
+               crypt_safe_free(key);
+       } else
+               r = crypt_keyslot_add_by_volume_key(cd_new, keyslot, NULL, 0,
+                       rc->p[keyslot].password, rc->p[keyslot].passwordLen);
+
        return r;
 }
 
-static int create_new_header(struct reenc_ctx *rc, const char *cipher,
-                            const char *cipher_mode, const char *uuid,
+static int create_new_header(struct reenc_ctx *rc, struct crypt_device *cd_old,
+                            const char *cipher, const char *cipher_mode,
+                            const char *uuid,
                             const char *key, int key_size,
-                            struct crypt_params_luks1 *params)
+                            const char *type,
+                            uint64_t metadata_size,
+                            uint64_t keyslots_size,
+                            void *params)
 {
        struct crypt_device *cd_new = NULL;
        int i, r;
@@ -441,21 +548,39 @@ static int create_new_header(struct reenc_ctx *rc, const char *cipher,
        else if (opt_urandom)
                crypt_set_rng_type(cd_new, CRYPT_RNG_URANDOM);
 
-       if (opt_iteration_time)
-               crypt_set_iteration_time(cd_new, opt_iteration_time);
+       r = set_pbkdf_params(cd_new, type);
+       if (r) {
+               log_err(_("Failed to set pbkdf parameters."));
+               goto out;
+       }
+
+       r = crypt_set_data_offset(cd_new, rc->data_offset);
+       if (r) {
+               log_err(_("Failed to set data offset."));
+               goto out;
+       }
 
-       if ((r = crypt_format(cd_new, CRYPT_LUKS1, cipher, cipher_mode,
-                             uuid, key, key_size, params)))
+       r = crypt_set_metadata_size(cd_new, metadata_size, keyslots_size);
+       if (r) {
+               log_err(_("Failed to set metadata size."));
+               goto out;
+       }
+
+       r = crypt_format(cd_new, type, cipher, cipher_mode, uuid, key, key_size, params);
+       check_signal(&r);
+       if (r < 0)
                goto out;
-       log_verbose(_("New LUKS header for device %s created.\n"), rc->device);
+       log_verbose(_("New LUKS header for device %s created."), rc->device);
 
-       for (i = 0; i < MAX_SLOT; i++) {
+       for (i = 0; i < crypt_keyslot_max(type); i++) {
                if (!rc->p[i].password)
                        continue;
-               if ((r = crypt_keyslot_add_by_volume_key(cd_new, i,
-                       NULL, 0, rc->p[i].password, rc->p[i].passwordLen)) < 0)
+
+               r = create_new_keyslot(rc, i, cd_old, cd_new);
+               check_signal(&r);
+               if (r < 0)
                        goto out;
-               log_verbose(_("Activated keyslot %i.\n"), r);
+               tools_keyslot_msg(r, CREATED);
                r = 0;
        }
 out:
@@ -463,73 +588,184 @@ out:
        return r;
 }
 
+static int isLUKS2(const char *type)
+{
+       return (type && !strcmp(type, CRYPT_LUKS2));
+}
+
+static int luks2_metadata_copy(struct reenc_ctx *rc)
+{
+       const char *json, *type;
+       crypt_token_info ti;
+       uint32_t flags;
+       int i, r = -EINVAL;
+       struct crypt_device *cd_old = NULL, *cd_new = NULL;
+
+       if (crypt_init(&cd_old, rc->header_file_tmp) ||
+           crypt_load(cd_old, CRYPT_LUKS2, NULL))
+               goto out;
+
+       if (crypt_init(&cd_new, rc->header_file_new) ||
+           crypt_load(cd_new, CRYPT_LUKS2, NULL))
+               goto out;
+
+       /*
+        * we have to erase keyslots missing in new header so that we can
+        * transfer tokens from old header to new one
+        */
+       for (i = 0; i < crypt_keyslot_max(CRYPT_LUKS2); i++)
+               if (!rc->p[i].password && crypt_keyslot_status(cd_old, i) == CRYPT_SLOT_ACTIVE) {
+                       r = crypt_keyslot_destroy(cd_old, i);
+                       if (r < 0)
+                               goto out;
+               }
+
+       for (i = 0; i < MAX_TOKEN; i++) {
+               ti = crypt_token_status(cd_old, i, &type);
+               switch (ti) {
+               case CRYPT_TOKEN_INVALID:
+                       log_dbg("Internal error.");
+                       r = -EINVAL;
+                       goto out;
+               case CRYPT_TOKEN_INACTIVE:
+                       break;
+               case CRYPT_TOKEN_INTERNAL_UNKNOWN:
+                       log_err(_("This version of cryptsetup-reencrypt can't handle new internal token type %s."), type);
+                       r = -EINVAL;
+                       goto out;
+               case CRYPT_TOKEN_INTERNAL:
+                       /* fallthrough */
+               case CRYPT_TOKEN_EXTERNAL:
+                       /* fallthrough */
+               case CRYPT_TOKEN_EXTERNAL_UNKNOWN:
+                       if (crypt_token_json_get(cd_old, i, &json) != i) {
+                               log_dbg("Failed to get %s token (%d).", type, i);
+                               r = -EINVAL;
+                               goto out;
+                       }
+                       if (crypt_token_json_set(cd_new, i, json) != i) {
+                               log_dbg("Failed to create %s token (%d).", type, i);
+                               r = -EINVAL;
+                               goto out;
+                       }
+               }
+       }
+
+       if ((r = crypt_persistent_flags_get(cd_old, CRYPT_FLAGS_ACTIVATION, &flags))) {
+               log_err(_("Failed to read activation flags from backup header."));
+               goto out;
+       }
+       if ((r = crypt_persistent_flags_set(cd_new, CRYPT_FLAGS_ACTIVATION, flags))) {
+               log_err(_("Failed to write activation flags to new header."));
+               goto out;
+       }
+       if ((r = crypt_persistent_flags_get(cd_old, CRYPT_FLAGS_REQUIREMENTS, &flags))) {
+               log_err(_("Failed to read requirements from backup header."));
+               goto out;
+       }
+       if ((r = crypt_persistent_flags_set(cd_new, CRYPT_FLAGS_REQUIREMENTS, flags)))
+               log_err(_("Failed to read requirements from backup header."));
+out:
+       crypt_free(cd_old);
+       crypt_free(cd_new);
+       unlink(rc->header_file_tmp);
+
+       return r;
+}
+
 static int backup_luks_headers(struct reenc_ctx *rc)
 {
        struct crypt_device *cd = NULL;
        struct crypt_params_luks1 params = {0};
+       struct crypt_params_luks2 params2 = {0};
+       struct stat st;
        char cipher [MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
-       char *old_key = NULL;
-       size_t old_key_size;
+       char *key = NULL;
+       size_t key_size;
+       uint64_t mdata_size = 0, keyslots_size = 0;
        int r;
 
-       log_dbg("Creating LUKS header backup for device %s.", rc->device);
+       log_dbg("Creating LUKS header backup for device %s.", hdr_device(rc));
 
-       if ((r = crypt_init(&cd, rc->device)) ||
-           (r = crypt_load(cd, CRYPT_LUKS1, NULL)))
+       if ((r = crypt_init(&cd, hdr_device(rc))) ||
+           (r = crypt_load(cd, CRYPT_LUKS, NULL)))
                goto out;
 
-       crypt_set_confirm_callback(cd, NULL, NULL);
-       if ((r = crypt_header_backup(cd, CRYPT_LUKS1, rc->header_file_org)))
+       if ((r = crypt_header_backup(cd, CRYPT_LUKS, rc->header_file_org)))
                goto out;
-       log_verbose(_("LUKS header backup of device %s created.\n"), rc->device);
+       if (isLUKS2(rc->type)) {
+               if ((r = crypt_header_backup(cd, CRYPT_LUKS2, rc->header_file_tmp)))
+                       goto out;
+               if ((r = stat(rc->header_file_tmp, &st)))
+                       goto out;
+               /* coverity[toctou] */
+               if ((r = chmod(rc->header_file_tmp, st.st_mode | S_IWUSR)))
+                       goto out;
+       }
+       log_verbose(_("%s header backup of device %s created."), isLUKS2(rc->type) ? "LUKS2" : "LUKS1", rc->device);
 
        /* For decrypt, new header will be fake one, so we are done here. */
        if (rc->reencrypt_mode == DECRYPT)
                goto out;
 
-       if ((r = create_empty_header(rc->header_file_new, rc->header_file_org,
-               crypt_get_data_offset(cd))))
+       rc->data_offset = crypt_get_data_offset(cd) + ROUND_SECTOR(opt_reduce_size);
+
+       if ((r = create_empty_header(rc->header_file_new)))
                goto out;
 
        params.hash = opt_hash ?: DEFAULT_LUKS1_HASH;
-       params.data_alignment = crypt_get_data_offset(cd);
-       params.data_alignment += ROUND_SECTOR(opt_reduce_size);
-       params.data_device = rc->device;
+       params2.data_device = params.data_device = rc->device;
+       params2.sector_size = crypt_get_sector_size(cd);
 
        if (opt_cipher) {
                r = crypt_parse_name_and_mode(opt_cipher, cipher, NULL, cipher_mode);
                if (r < 0) {
-                       log_err(_("No known cipher specification pattern detected.\n"));
+                       log_err(_("No known cipher specification pattern detected."));
                        goto out;
                }
        }
 
+       key_size = opt_key_size ? opt_key_size / 8 : crypt_get_volume_key_size(cd);
+
        if (opt_keep_key) {
                log_dbg("Keeping key from old header.");
-               old_key_size  = crypt_get_volume_key_size(cd);
-               old_key = crypt_safe_alloc(old_key_size);
-               if (!old_key) {
+               key_size = crypt_get_volume_key_size(cd);
+               key = crypt_safe_alloc(key_size);
+               if (!key) {
                        r = -ENOMEM;
                        goto out;
                }
-               r = crypt_volume_key_get(cd, CRYPT_ANY_SLOT, old_key, &old_key_size,
+               r = crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size,
                        rc->p[rc->keyslot].password, rc->p[rc->keyslot].passwordLen);
-               if (r < 0)
-                       goto out;
+       } else if (opt_master_key_file) {
+               log_dbg("Loading new key from file.");
+               r = tools_read_mk(opt_master_key_file, &key, key_size);
        }
 
-       r = create_new_header(rc,
+       if (r < 0)
+               goto out;
+
+       if (isLUKS2(crypt_get_type(cd)) && crypt_get_metadata_size(cd, &mdata_size, &keyslots_size))
+               goto out;
+
+       r = create_new_header(rc, cd,
                opt_cipher ? cipher : crypt_get_cipher(cd),
                opt_cipher ? cipher_mode : crypt_get_cipher_mode(cd),
                crypt_get_uuid(cd),
-               old_key,
-               opt_key_size ? opt_key_size / 8 : crypt_get_volume_key_size(cd),
-               &params);
+               key,
+               key_size,
+               rc->type,
+               mdata_size,
+               keyslots_size,
+               isLUKS2(rc->type) ? (void*)&params2 : (void*)&params);
+
+       if (!r && isLUKS2(rc->type))
+               r = luks2_metadata_copy(rc);
 out:
        crypt_free(cd);
-       crypt_safe_free(old_key);
+       crypt_safe_free(key);
        if (r)
-               log_err(_("Creation of LUKS backup headers failed.\n"));
+               log_err(_("Creation of LUKS backup headers failed."));
        return r;
 }
 
@@ -538,6 +774,7 @@ static int backup_fake_header(struct reenc_ctx *rc)
 {
        struct crypt_device *cd_new = NULL;
        struct crypt_params_luks1 params = {0};
+       struct crypt_params_luks2 params2 = {0};
        char cipher [MAX_CIPHER_LEN], cipher_mode[MAX_CIPHER_LEN];
        const char *header_file_fake;
        int r;
@@ -553,18 +790,20 @@ static int backup_fake_header(struct reenc_ctx *rc)
        if (opt_cipher) {
                r = crypt_parse_name_and_mode(opt_cipher, cipher, NULL, cipher_mode);
                if (r < 0) {
-                       log_err(_("No known cipher specification pattern detected.\n"));
+                       log_err(_("No known cipher specification pattern detected."));
                        goto out;
                }
        }
 
-       r = create_empty_header(header_file_fake, NULL, MAX_BCK_SECTORS);
+       r = create_empty_header(header_file_fake);
        if (r < 0)
                return r;
 
        params.hash = opt_hash ?: DEFAULT_LUKS1_HASH;
-       params.data_alignment = 0;
-       params.data_device = rc->device;
+       params2.data_alignment = params.data_alignment = 0;
+       params2.data_device = params.data_device = rc->device;
+       params2.sector_size = crypt_get_sector_size(NULL);
+       params2.pbkdf = crypt_get_pbkdf_default(CRYPT_LUKS2);
 
        r = crypt_init(&cd_new, header_file_fake);
        if (r < 0)
@@ -572,29 +811,36 @@ static int backup_fake_header(struct reenc_ctx *rc)
 
        r = crypt_format(cd_new, CRYPT_LUKS1, "cipher_null", "ecb",
                         NO_UUID, NULL, opt_key_size / 8, &params);
+       check_signal(&r);
        if (r < 0)
                goto out;
 
        r = crypt_keyslot_add_by_volume_key(cd_new, rc->keyslot, NULL, 0,
                        rc->p[rc->keyslot].password, rc->p[rc->keyslot].passwordLen);
+       check_signal(&r);
        if (r < 0)
                goto out;
 
        /* The real header is backup header created in backup_luks_headers() */
-       if (rc->reencrypt_mode == DECRYPT)
+       if (rc->reencrypt_mode == DECRYPT) {
+               r = 0;
                goto out;
+       }
 
-       r = create_empty_header(rc->header_file_new, rc->header_file_org, 0);
+       r = create_empty_header(rc->header_file_new);
        if (r < 0)
                goto out;
 
-       params.data_alignment = ROUND_SECTOR(opt_reduce_size);
-       r = create_new_header(rc,
+       params2.data_alignment = params.data_alignment = ROUND_SECTOR(opt_reduce_size);
+       r = create_new_header(rc, NULL,
                opt_cipher ? cipher : DEFAULT_LUKS1_CIPHER,
                opt_cipher ? cipher_mode : DEFAULT_LUKS1_MODE,
                NULL, NULL,
                (opt_key_size ? opt_key_size : DEFAULT_LUKS1_KEYBITS) / 8,
-               &params);
+               rc->type,
+               0,
+               0,
+               isLUKS2(rc->type) ? (void*)&params2 : (void*)&params);
 out:
        crypt_free(cd_new);
        return r;
@@ -618,61 +864,48 @@ static void remove_headers(struct reenc_ctx *rc)
 
 static int restore_luks_header(struct reenc_ctx *rc)
 {
+       struct stat st;
        struct crypt_device *cd = NULL;
-       int r;
+       int fd, r;
 
-       log_dbg("Restoring header for %s from %s.", rc->device, rc->header_file_new);
+       log_dbg("Restoring header for %s from %s.", hdr_device(rc), rc->header_file_new);
 
-       r = crypt_init(&cd, rc->device);
+       /*
+        * For new encryption and new detached header in file just move it.
+        * For existing file try to ensure we have preallocated space for restore.
+        */
+       if (opt_new && rc->device_header) {
+               r = stat(rc->device_header, &st);
+               if (r == -1) {
+                       r = rename(rc->header_file_new, rc->device_header);
+                       goto out;
+               } else if ((st.st_mode & S_IFMT) == S_IFREG &&
+                       stat(rc->header_file_new, &st) != -1) {
+                       /* coverity[toctou] */
+                       fd = open(rc->device_header, O_WRONLY);
+                       if (fd != -1) {
+                               if (posix_fallocate(fd, 0, st.st_size)) {};
+                               close(fd);
+                       }
+               }
+       }
+
+       r = crypt_init(&cd, hdr_device(rc));
        if (r == 0) {
-               crypt_set_confirm_callback(cd, NULL, NULL);
-               r = crypt_header_restore(cd, CRYPT_LUKS1, rc->header_file_new);
+               r = crypt_header_restore(cd, rc->type, rc->header_file_new);
        }
 
        crypt_free(cd);
+out:
        if (r)
-               log_err(_("Cannot restore LUKS header on device %s.\n"), rc->device);
-       else
-               log_verbose(_("LUKS header on device %s restored.\n"), rc->device);
+               log_err(_("Cannot restore %s header on device %s."), isLUKS2(rc->type) ? "LUKS2" : "LUKS1", hdr_device(rc));
+       else {
+               log_verbose(_("%s header on device %s restored."), isLUKS2(rc->type) ? "LUKS2" : "LUKS1", hdr_device(rc));
+               rc->stained = 0;
+       }
        return r;
 }
 
-static void print_progress(struct reenc_ctx *rc, uint64_t bytes, int final)
-{
-       unsigned long long mbytes, eta;
-       struct timeval now_time;
-       double tdiff, mib;
-
-       gettimeofday(&now_time, NULL);
-       if (!final && time_diff(rc->end_time, now_time) < 0.5)
-               return;
-
-       rc->end_time = now_time;
-
-       if (opt_batch_mode)
-               return;
-
-       tdiff = time_diff(rc->start_time, rc->end_time);
-       if (!tdiff)
-               return;
-
-       mbytes = (bytes - rc->resume_bytes) / 1024 / 1024;
-       mib = (double)(mbytes) / tdiff;
-       if (!mib)
-               return;
-
-       /* FIXME: calculate this from last minute only and remaining space */
-       eta = (unsigned long long)(rc->device_size / 1024 / 1024 / mib - tdiff);
-
-       /* vt100 code clear line */
-       log_err("\33[2K\r");
-       log_err(_("Progress: %5.1f%%, ETA %02llu:%02llu, "
-               "%4llu MiB written, speed %5.1f MiB/s%s"),
-               (double)bytes / rc->device_size * 100,
-               eta / 60, eta % 60, mbytes, mib,
-               final ? "\n" :"");
-}
-
 static ssize_t read_buf(int fd, void *buf, size_t count)
 {
        size_t read_size = 0;
@@ -705,12 +938,14 @@ static int copy_data_forward(struct reenc_ctx *rc, int fd_old, int fd_new,
 
        if (lseek64(fd_old, rc->device_offset, SEEK_SET) < 0 ||
            lseek64(fd_new, rc->device_offset, SEEK_SET) < 0) {
-               log_err(_("Cannot seek to device offset.\n"));
+               log_err(_("Cannot seek to device offset."));
                return -EIO;
        }
 
        rc->resume_bytes = *bytes = rc->device_offset;
 
+       tools_reencrypt_progress(rc->device_size, *bytes, NULL);
+
        if (write_log(rc) < 0)
                return -EIO;
 
@@ -744,7 +979,8 @@ static int copy_data_forward(struct reenc_ctx *rc, int fd_old, int fd_new,
                }
 
                *bytes += (uint64_t)s2;
-               print_progress(rc, *bytes, 0);
+
+               tools_reencrypt_progress(rc->device_size, *bytes, NULL);
        }
 
        return quit ? -EAGAIN : 0;
@@ -767,9 +1003,14 @@ static int copy_data_backward(struct reenc_ctx *rc, int fd_old, int fd_new,
                *bytes = rc->resume_bytes;
        }
 
+       tools_reencrypt_progress(rc->device_size, *bytes, NULL);
+
        if (write_log(rc) < 0)
                return -EIO;
 
+       /* dirty the device during ENCRYPT mode */
+       rc->stained = 1;
+
        while (!quit && rc->device_offset) {
                if (rc->device_offset < block_size) {
                        working_offset = 0;
@@ -781,7 +1022,7 @@ static int copy_data_backward(struct reenc_ctx *rc, int fd_old, int fd_new,
 
                if (lseek64(fd_old, working_offset, SEEK_SET) < 0 ||
                    lseek64(fd_new, working_offset, SEEK_SET) < 0) {
-                       log_err(_("Cannot seek to device offset.\n"));
+                       log_err(_("Cannot seek to device offset."));
                        return -EIO;
                }
 
@@ -809,7 +1050,8 @@ static int copy_data_backward(struct reenc_ctx *rc, int fd_old, int fd_new,
                }
 
                *bytes += (uint64_t)s2;
-               print_progress(rc, *bytes, 0);
+
+               tools_reencrypt_progress(rc->device_size, *bytes, NULL);
        }
 
        return quit ? -EAGAIN : 0;
@@ -823,7 +1065,7 @@ static void zero_rest_of_device(int fd, size_t block_size, void *buf,
        log_dbg("Zeroing rest of device.");
 
        if (lseek64(fd, offset, SEEK_SET) < 0) {
-               log_dbg(_("Cannot seek to device offset.\n"));
+               log_dbg("Cannot seek to device offset.");
                return;
        }
 
@@ -831,13 +1073,13 @@ static void zero_rest_of_device(int fd, size_t block_size, void *buf,
        s1 = block_size;
 
        while (!quit && *bytes) {
-               if (*bytes < s1)
+               if (*bytes < (uint64_t)s1)
                        s1 = *bytes;
 
                s2 = write(fd, buf, s1);
-               if (s2 < 0) {
-                       log_dbg("Write error, expecting %zu, got %zd.",
-                               block_size, s2);
+               if (s2 != s1) {
+                       log_dbg("Write error, expecting %zd, got %zd.",
+                               s1, s2);
                        return;
                }
 
@@ -862,23 +1104,23 @@ static int copy_data(struct reenc_ctx *rc)
 
        fd_old = open(rc->crypt_path_org, O_RDONLY | (opt_directio ? O_DIRECT : 0));
        if (fd_old == -1) {
-               log_err(_("Cannot open temporary LUKS header file.\n"));
+               log_err(_("Cannot open temporary LUKS device."));
                goto out;
        }
 
        fd_new = open(rc->crypt_path_new, O_WRONLY | (opt_directio ? O_DIRECT : 0));
        if (fd_new == -1) {
-               log_err(_("Cannot open temporary LUKS header file.\n"));
+               log_err(_("Cannot open temporary LUKS device."));
                goto out;
        }
 
        if (ioctl(fd_old, BLKGETSIZE64, &rc->device_size_org_real) < 0) {
-               log_err(_("Cannot get device size.\n"));
+               log_err(_("Cannot get device size."));
                goto out;
        }
 
        if (ioctl(fd_new, BLKGETSIZE64, &rc->device_size_new_real) < 0) {
-               log_err(_("Cannot get device size.\n"));
+               log_err(_("Cannot get device size."));
                goto out;
        }
 
@@ -890,21 +1132,18 @@ static int copy_data(struct reenc_ctx *rc)
                rc->device_size = rc->device_size_new_real;
 
        if (posix_memalign((void *)&buf, alignment(fd_new), block_size)) {
-               log_err(_("Allocation of aligned memory failed.\n"));
+               log_err(_("Allocation of aligned memory failed."));
                r = -ENOMEM;
                goto out;
        }
 
        set_int_handler(0);
-       gettimeofday(&rc->start_time, NULL);
 
        if (rc->reencrypt_direction == FORWARD)
                r = copy_data_forward(rc, fd_old, fd_new, block_size, buf, &bytes);
        else
                r = copy_data_backward(rc, fd_old, fd_new, block_size, buf, &bytes);
 
-       print_progress(rc, bytes, 1);
-
        /* Zero (wipe) rest of now plain-only device when decrypting.
         * (To not leave any sign of encryption here.) */
        if (!r && rc->reencrypt_mode == DECRYPT &&
@@ -915,10 +1154,8 @@ static int copy_data(struct reenc_ctx *rc)
 
        set_int_block(1);
 
-       if (r == -EAGAIN)
-                log_err(_("Interrupted by a signal.\n"));
-       else if (r < 0)
-               log_err(_("IO error during reencryption.\n"));
+       if (r < 0 && r != -EAGAIN)
+               log_err(_("IO error during reencryption."));
 
        (void)write_log(rc);
 out:
@@ -934,52 +1171,76 @@ static int initialize_uuid(struct reenc_ctx *rc)
 {
        struct crypt_device *cd = NULL;
        int r;
+       uuid_t device_uuid;
 
        log_dbg("Initialising UUID.");
 
        if (opt_new) {
                rc->device_uuid = strdup(NO_UUID);
+               rc->type = luksType(opt_type);
                return 0;
        }
 
+       if (opt_decrypt && opt_uuid) {
+               r = uuid_parse(opt_uuid, device_uuid);
+               if (!r)
+                       rc->device_uuid = strdup(opt_uuid);
+               else
+                       log_err(_("Provided UUID is invalid."));
+
+               return r;
+       }
+
        /* Try to load LUKS from device */
-       if ((r = crypt_init(&cd, rc->device)))
+       if ((r = crypt_init(&cd, hdr_device(rc))))
                return r;
        crypt_set_log_callback(cd, _quiet_log, NULL);
-       r = crypt_load(cd, CRYPT_LUKS1, NULL);
+       r = crypt_load(cd, CRYPT_LUKS, NULL);
        if (!r)
                rc->device_uuid = strdup(crypt_get_uuid(cd));
        else
                /* Reencryption already in progress - magic header? */
-               r = device_check(rc, CHECK_UNUSABLE);
+               r = device_check(rc, hdr_device(rc), CHECK_UNUSABLE);
+
+       if (!r)
+               rc->type = isLUKS2(crypt_get_type(cd)) ? CRYPT_LUKS2 : CRYPT_LUKS1;
 
        crypt_free(cd);
        return r;
 }
 
 static int init_passphrase1(struct reenc_ctx *rc, struct crypt_device *cd,
-                           const char *msg, int slot_to_check, int check)
+                           const char *msg, int slot_to_check, int check, int verify)
 {
+       crypt_keyslot_info ki;
        char *password;
        int r = -EINVAL, retry_count;
        size_t passwordLen;
 
+       /* mode ENCRYPT call this without header */
+       if (cd && slot_to_check != CRYPT_ANY_SLOT) {
+               ki = crypt_keyslot_status(cd, slot_to_check);
+               if (ki < CRYPT_SLOT_ACTIVE)
+                       return -ENOENT;
+       } else
+               ki = CRYPT_SLOT_ACTIVE;
+
        retry_count = opt_tries ?: 1;
        while (retry_count--) {
-               set_int_handler(0);
-               r = crypt_get_key(msg, &password, &passwordLen,
-                       0, 0, NULL /*opt_key_file*/,
-                       0, 0, cd);
+               r = tools_get_key(msg,  &password, &passwordLen, 0, 0,
+                                 NULL /*opt_key_file*/, 0, verify, 0 /*pwquality*/, cd);
                if (r < 0)
                        return r;
-               if (quit)
+               if (quit) {
+                       crypt_safe_free(password);
+                       password = NULL;
+                       passwordLen = 0;
                        return -EAGAIN;
+               }
 
-               /* library uses sigint internally, until it is fixed...*/
-               set_int_block(1);
                if (check)
                        r = crypt_activate_by_passphrase(cd, NULL, slot_to_check,
-                               password, passwordLen, 0);
+                               password, passwordLen, CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY);
                else
                        r = (slot_to_check == CRYPT_ANY_SLOT) ? 0 : slot_to_check;
 
@@ -990,13 +1251,16 @@ static int init_passphrase1(struct reenc_ctx *rc, struct crypt_device *cd,
                }
                if (r < 0 && r != -EPERM)
                        return r;
+
                if (r >= 0) {
-                       rc->keyslot = r;
+                       tools_keyslot_msg(r, UNLOCKED);
                        rc->p[r].password = password;
                        rc->p[r].passwordLen = passwordLen;
+                       if (ki != CRYPT_SLOT_UNBOUND)
+                               rc->keyslot = r;
                        break;
                }
-               log_err(_("No key available with this passphrase.\n"));
+               tools_passphrase_msg(r);
        }
 
        password = NULL;
@@ -1011,29 +1275,33 @@ static int init_keyfile(struct reenc_ctx *rc, struct crypt_device *cd, int slot_
        int r;
        size_t passwordLen;
 
-       r = crypt_get_key(NULL, &password, &passwordLen, opt_keyfile_offset,
-                         opt_keyfile_size, opt_key_file, 0, 0, cd);
+       r = tools_get_key(NULL, &password, &passwordLen, opt_keyfile_offset,
+                         opt_keyfile_size, opt_key_file, 0, 0, 0, cd);
        if (r < 0)
                return r;
 
-       r = crypt_activate_by_passphrase(cd, NULL, slot_check, password,
-                                        passwordLen, 0);
-
-       /*
-        * Allow keyslot only if it is last slot or if user explicitly
-        * specify which slot to use (IOW others will be disabled).
-        */
-       if (r >= 0 && opt_key_slot == CRYPT_ANY_SLOT &&
-           crypt_keyslot_status(cd, r) != CRYPT_SLOT_ACTIVE_LAST) {
-               log_err(_("Key file can be used only with --key-slot or with "
-                         "exactly one key slot active.\n"));
-               r = -EINVAL;
+       /* mode ENCRYPT call this without header */
+       if (cd) {
+               r = crypt_activate_by_passphrase(cd, NULL, slot_check, password,
+                                                passwordLen, 0);
+
+               /*
+                * Allow keyslot only if it is last slot or if user explicitly
+                * specify which slot to use (IOW others will be disabled).
+                */
+               if (r >= 0 && opt_key_slot == CRYPT_ANY_SLOT &&
+                   crypt_keyslot_status(cd, r) != CRYPT_SLOT_ACTIVE_LAST) {
+                       log_err(_("Key file can be used only with --key-slot or with "
+                                 "exactly one key slot active."));
+                       r = -EINVAL;
+               }
+       } else {
+               r = slot_check == CRYPT_ANY_SLOT ? 0 : slot_check;
        }
 
        if (r < 0) {
                crypt_safe_free(password);
-               if (r == -EPERM)
-                       log_err(_("No key available with this passphrase.\n"));
+               tools_passphrase_msg(r);
        } else {
                rc->keyslot = r;
                rc->p[r].password = password;
@@ -1049,27 +1317,28 @@ static int init_keyfile(struct reenc_ctx *rc, struct crypt_device *cd, int slot_
 static int initialize_passphrase(struct reenc_ctx *rc, const char *device)
 {
        struct crypt_device *cd = NULL;
-       crypt_keyslot_info ki;
        char msg[256];
        int i, r;
 
-       log_dbg("Passhrases initialization.");
+       log_dbg("Passphrases initialization.");
 
        if (rc->reencrypt_mode == ENCRYPT && !rc->in_progress) {
-               r = init_passphrase1(rc, cd, _("Enter new passphrase: "), opt_key_slot, 0);
+               if (opt_key_file)
+                       r = init_keyfile(rc, NULL, opt_key_slot);
+               else
+                       r = init_passphrase1(rc, NULL, _("Enter new passphrase: "), opt_key_slot, 0, 1);
                return r > 0 ? 0 : r;
        }
 
-       if ((r = crypt_init(&cd, device)) ||
-           (r = crypt_load(cd, CRYPT_LUKS1, NULL)) ||
-           (r = crypt_set_data_device(cd, rc->device))) {
+       if ((r = crypt_init_data_device(&cd, device, rc->device)) ||
+           (r = crypt_load(cd, CRYPT_LUKS, NULL))) {
                crypt_free(cd);
                return r;
        }
 
        if (opt_key_slot != CRYPT_ANY_SLOT)
                snprintf(msg, sizeof(msg),
-                        _("Enter passphrase for key slot %u: "), opt_key_slot);
+                        _("Enter passphrase for key slot %d: "), opt_key_slot);
        else
                snprintf(msg, sizeof(msg), _("Enter any existing passphrase: "));
 
@@ -1078,14 +1347,14 @@ static int initialize_passphrase(struct reenc_ctx *rc, const char *device)
        } else if (rc->in_progress ||
                   opt_key_slot != CRYPT_ANY_SLOT ||
                   rc->reencrypt_mode == DECRYPT) {
-               r = init_passphrase1(rc, cd, msg, opt_key_slot, 1);
-       } else for (i = 0; i < MAX_SLOT; i++) {
-               ki = crypt_keyslot_status(cd, i);
-               if (ki != CRYPT_SLOT_ACTIVE && ki != CRYPT_SLOT_ACTIVE_LAST)
+               r = init_passphrase1(rc, cd, msg, opt_key_slot, 1, 0);
+       } else for (i = 0; i < crypt_keyslot_max(crypt_get_type(cd)); i++) {
+               snprintf(msg, sizeof(msg), _("Enter passphrase for key slot %d: "), i);
+               r = init_passphrase1(rc, cd, msg, i, 1, 0);
+               if (r == -ENOENT) {
+                       r = 0;
                        continue;
-
-               snprintf(msg, sizeof(msg), _("Enter passphrase for key slot %u: "), i);
-               r = init_passphrase1(rc, cd, msg, i, 1);
+               }
                if (r < 0)
                        break;
        }
@@ -1098,16 +1367,31 @@ static int initialize_context(struct reenc_ctx *rc, const char *device)
 {
        log_dbg("Initialising reencryption context.");
 
-       rc->log_fd =-1;
+       rc->log_fd = -1;
+
+       /* FIXME: replace MAX_KEYSLOT with crypt_keyslot_max(CRYPT_LUKS2) */
+       if (crypt_keyslot_max(CRYPT_LUKS2) > MAX_SLOT) {
+               log_dbg("Internal error");
+               return -EINVAL;
+       }
 
        if (!(rc->device = strndup(device, PATH_MAX)))
                return -ENOMEM;
 
-       if (device_check(rc, CHECK_OPEN) < 0)
+       if (opt_header_device && !(rc->device_header = strndup(opt_header_device, PATH_MAX)))
+               return -ENOMEM;
+
+       if (device_check(rc, rc->device, CHECK_OPEN) < 0)
                return -EINVAL;
 
        if (initialize_uuid(rc)) {
-               log_err(_("Device %s is not a valid LUKS device.\n"), device);
+               log_err(_("Device %s is not a valid LUKS device."), device);
+               return -EINVAL;
+       }
+
+       if (opt_key_slot != CRYPT_ANY_SLOT &&
+           opt_key_slot >= crypt_keyslot_max(rc->type)) {
+               log_err(_("Key slot is invalid."));
                return -EINVAL;
        }
 
@@ -1121,6 +1405,9 @@ static int initialize_context(struct reenc_ctx *rc, const char *device)
        if (snprintf(rc->header_file_new, PATH_MAX,
                     "LUKS-%s.new", rc->device_uuid) < 0)
                return -ENOMEM;
+       if (snprintf(rc->header_file_tmp, PATH_MAX,
+                    "LUKS-%s.tmp", rc->device_uuid) < 0)
+               return -ENOMEM;
 
        /* Paths to encrypted devices */
        if (snprintf(rc->crypt_path_org, PATH_MAX,
@@ -1133,11 +1420,17 @@ static int initialize_context(struct reenc_ctx *rc, const char *device)
        remove_headers(rc);
 
        if (open_log(rc) < 0) {
-               log_err(_("Cannot open reencryption log file.\n"));
+               log_err(_("Cannot open reencryption log file."));
                return -EINVAL;
        }
 
        if (!rc->in_progress) {
+               if (opt_uuid) {
+                       log_err(_("No decryption in progress, provided UUID can "
+                       "be used only to resume suspended decryption process."));
+                       return -EINVAL;
+               }
+
                if (!opt_reduce_size)
                        rc->reencrypt_direction = FORWARD;
                else {
@@ -1165,38 +1458,92 @@ static void destroy_context(struct reenc_ctx *rc)
        close_log(rc);
        remove_headers(rc);
 
-       if ((rc->reencrypt_direction == FORWARD &&
-            rc->device_offset == rc->device_size) ||
-           (rc->reencrypt_direction == BACKWARD &&
-            (rc->device_offset == 0 || rc->device_offset == (uint64_t)~0))) {
+       if (!rc->stained) {
                unlink(rc->log_file);
                unlink(rc->header_file_org);
                unlink(rc->header_file_new);
+               unlink(rc->header_file_tmp);
        }
 
        for (i = 0; i < MAX_SLOT; i++)
                crypt_safe_free(rc->p[i].password);
 
        free(rc->device);
+       free(rc->device_header);
        free(rc->device_uuid);
 }
 
+static int luks2_change_pbkdf_params(struct reenc_ctx *rc)
+{
+       int i, r;
+       struct crypt_device *cd = NULL;
+
+       if ((r = initialize_passphrase(rc, hdr_device(rc))))
+               return r;
+
+       if (crypt_init(&cd, hdr_device(rc)) ||
+           crypt_load(cd, CRYPT_LUKS2, NULL)) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       if ((r = set_pbkdf_params(cd, CRYPT_LUKS2)))
+               goto out;
+
+       log_dbg("LUKS2 keyslot pbkdf params change.");
+
+       r = -EINVAL;
+
+       for (i = 0; i < crypt_keyslot_max(CRYPT_LUKS2); i++) {
+               if (!rc->p[i].password)
+                       continue;
+               if ((r = crypt_keyslot_change_by_passphrase(cd, i, i,
+                       rc->p[i].password, rc->p[i].passwordLen,
+                       rc->p[i].password, rc->p[i].passwordLen)) < 0)
+                       goto out;
+               log_verbose(_("Changed pbkdf parameters in keyslot %i."), r);
+               r = 0;
+       }
+
+       if (r)
+               goto out;
+
+       /* see create_new_header */
+       for (i = 0; i < crypt_keyslot_max(CRYPT_LUKS2); i++)
+               if (!rc->p[i].password)
+                       (void)crypt_keyslot_destroy(cd, i);
+out:
+       crypt_free(cd);
+       return r;
+}
+
 static int run_reencrypt(const char *device)
 {
        int r = -EINVAL;
-       static struct reenc_ctx rc = {};
+       static struct reenc_ctx rc = {
+               .stained = 1
+       };
+
+       set_int_handler(0);
 
        if (initialize_context(&rc, device))
                goto out;
 
+       /* short-circuit LUKS2 keyslot parameters change */
+       if (opt_keep_key && isLUKS2(rc.type)) {
+               r = luks2_change_pbkdf_params(&rc);
+               goto out;
+       }
+
        log_dbg("Running reencryption.");
 
        if (!rc.in_progress) {
-               if ((r = initialize_passphrase(&rc, rc.device)))
+               if ((r = initialize_passphrase(&rc, hdr_device(&rc))))
                        goto out;
 
+               log_dbg("Storing backup of LUKS headers.");
                if (rc.reencrypt_mode == ENCRYPT) {
-                       /* Create fake header for exising device */
+                       /* Create fake header for existing device */
                        if ((r = backup_fake_header(&rc)))
                                goto out;
                } else {
@@ -1206,11 +1553,11 @@ static int run_reencrypt(const char *device)
                        if (rc.reencrypt_mode == DECRYPT &&
                            (r = backup_fake_header(&rc)))
                                goto out;
-                       if ((r = device_check(&rc, MAKE_UNUSABLE)))
+                       if ((r = device_check(&rc, hdr_device(&rc), MAKE_UNUSABLE)))
                                goto out;
                }
        } else {
-               if ((r = initialize_passphrase(&rc, rc.header_file_new)))
+               if ((r = initialize_passphrase(&rc, opt_decrypt ? rc.header_file_org : rc.header_file_new)))
                        goto out;
        }
 
@@ -1227,6 +1574,8 @@ static int run_reencrypt(const char *device)
        // FIXME: fix error path above to not skip this
        if (rc.reencrypt_mode != DECRYPT)
                r = restore_luks_header(&rc);
+       else
+               rc.stained = 0;
 out:
        destroy_context(&rc);
        return r;
@@ -1241,6 +1590,11 @@ static void help(poptContext popt_context,
        if (key->shortName == '?') {
                log_std("%s %s\n", PACKAGE_REENC, PACKAGE_VERSION);
                poptPrintHelp(popt_context, stdout, 0);
+               poptFreeContext(popt_context);
+               exit(EXIT_SUCCESS);
+       } else if (key->shortName == 'V') {
+               log_std("%s %s\n", PACKAGE_REENC, PACKAGE_VERSION);
+               poptFreeContext(popt_context);
                exit(EXIT_SUCCESS);
        } else
                usage(popt_context, EXIT_SUCCESS, NULL, NULL);
@@ -1252,34 +1606,43 @@ int main(int argc, const char **argv)
                { NULL,    '\0', POPT_ARG_CALLBACK, help, 0, NULL,                         NULL },
                { "help",  '?',  POPT_ARG_NONE,     NULL, 0, N_("Show this help message"), NULL },
                { "usage", '\0', POPT_ARG_NONE,     NULL, 0, N_("Display brief usage"),    NULL },
+               { "version",'V', POPT_ARG_NONE,     NULL, 0, N_("Print package version"),  NULL },
                POPT_TABLEEND
        };
        static struct poptOption popt_options[] = {
                { NULL,                '\0', POPT_ARG_INCLUDE_TABLE, popt_help_options, 0, N_("Help options:"), NULL },
-               { "version",           '\0', POPT_ARG_NONE, &opt_version_mode,          0, N_("Print package version"), NULL },
                { "verbose",           'v',  POPT_ARG_NONE, &opt_verbose,               0, N_("Shows more detailed error messages"), NULL },
                { "debug",             '\0', POPT_ARG_NONE, &opt_debug,                 0, N_("Show debug messages"), NULL },
                { "block-size",        'B',  POPT_ARG_INT, &opt_bsize,                  0, N_("Reencryption block size"), N_("MiB") },
                { "cipher",            'c',  POPT_ARG_STRING, &opt_cipher,              0, N_("The cipher used to encrypt the disk (see /proc/crypto)"), NULL },
                { "key-size",          's',  POPT_ARG_INT, &opt_key_size,               0, N_("The size of the encryption key"), N_("BITS") },
                { "hash",              'h',  POPT_ARG_STRING, &opt_hash,                0, N_("The hash used to create the encryption key from the passphrase"), NULL },
-               { "keep-key",          '\0', POPT_ARG_NONE, &opt_keep_key,              0, N_("Do not change key, no data area reencryption."), NULL },
-               { "key-file",          'd',  POPT_ARG_STRING, &opt_key_file,            0, N_("Read the key from a file."), NULL },
+               { "keep-key",          '\0', POPT_ARG_NONE, &opt_keep_key,              0, N_("Do not change key, no data area reencryption"), NULL },
+               { "key-file",          'd',  POPT_ARG_STRING, &opt_key_file,            0, N_("Read the key from a file"), NULL },
+               { "master-key-file",   '\0', POPT_ARG_STRING, &opt_master_key_file,     0, N_("Read new volume (master) key from file"), NULL },
                { "iter-time",         'i',  POPT_ARG_INT, &opt_iteration_time,         0, N_("PBKDF2 iteration time for LUKS (in ms)"), N_("msecs") },
                { "batch-mode",        'q',  POPT_ARG_NONE, &opt_batch_mode,            0, N_("Do not ask for confirmation"), NULL },
+               { "progress-frequency",'\0', POPT_ARG_INT, &opt_progress_frequency,     0, N_("Progress line update (in seconds)"), N_("secs") },
                { "tries",             'T',  POPT_ARG_INT, &opt_tries,                  0, N_("How often the input of the passphrase can be retried"), NULL },
-               { "use-random",        '\0', POPT_ARG_NONE, &opt_random,                0, N_("Use /dev/random for generating volume key."), NULL },
-               { "use-urandom",       '\0', POPT_ARG_NONE, &opt_urandom,               0, N_("Use /dev/urandom for generating volume key."), NULL },
-               { "use-directio",      '\0', POPT_ARG_NONE, &opt_directio,              0, N_("Use direct-io when accessing devices."), NULL },
-               { "use-fsync",         '\0', POPT_ARG_NONE, &opt_fsync,                 0, N_("Use fsync after each block."), NULL },
-               { "write-log",         '\0', POPT_ARG_NONE, &opt_write_log,             0, N_("Update log file after every block."), NULL },
-               { "key-slot",          'S',  POPT_ARG_INT, &opt_key_slot,               0, N_("Use only this slot (others will be disabled)."), NULL },
+               { "use-random",        '\0', POPT_ARG_NONE, &opt_random,                0, N_("Use /dev/random for generating volume key"), NULL },
+               { "use-urandom",       '\0', POPT_ARG_NONE, &opt_urandom,               0, N_("Use /dev/urandom for generating volume key"), NULL },
+               { "use-directio",      '\0', POPT_ARG_NONE, &opt_directio,              0, N_("Use direct-io when accessing devices"), NULL },
+               { "use-fsync",         '\0', POPT_ARG_NONE, &opt_fsync,                 0, N_("Use fsync after each block"), NULL },
+               { "write-log",         '\0', POPT_ARG_NONE, &opt_write_log,             0, N_("Update log file after every block"), NULL },
+               { "key-slot",          'S',  POPT_ARG_INT, &opt_key_slot,               0, N_("Use only this slot (others will be disabled)"), NULL },
                { "keyfile-offset",   '\0',  POPT_ARG_LONG, &opt_keyfile_offset,        0, N_("Number of bytes to skip in keyfile"), N_("bytes") },
                { "keyfile-size",      'l',  POPT_ARG_LONG, &opt_keyfile_size,          0, N_("Limits the read from keyfile"), N_("bytes") },
                { "reduce-device-size",'\0', POPT_ARG_STRING, &opt_reduce_size_str,     0, N_("Reduce data device size (move data offset). DANGEROUS!"), N_("bytes") },
                { "device-size",       '\0', POPT_ARG_STRING, &opt_device_size_str,     0, N_("Use only specified device size (ignore rest of device). DANGEROUS!"), N_("bytes") },
-               { "new",               'N',  POPT_ARG_NONE, &opt_new,                   0, N_("Create new header on not encrypted device."), NULL },
-               { "decrypt",           '\0', POPT_ARG_NONE, &opt_decrypt,               0, N_("Permanently decrypt device (remove encryption)."), NULL },
+               { "new",               'N',  POPT_ARG_NONE, &opt_new,                   0, N_("Create new header on not encrypted device"), NULL },
+               { "decrypt",           '\0', POPT_ARG_NONE, &opt_decrypt,               0, N_("Permanently decrypt device (remove encryption)"), NULL },
+               { "uuid",              '\0', POPT_ARG_STRING, &opt_uuid,                0, N_("The UUID used to resume decryption"), NULL },
+               { "type",              '\0', POPT_ARG_STRING, &opt_type,                0, N_("Type of LUKS metadata: luks1, luks2"), NULL },
+               { "pbkdf",             '\0', POPT_ARG_STRING, &opt_pbkdf,               0, N_("PBKDF algorithm (for LUKS2): argon2i, argon2id, pbkdf2"), NULL },
+               { "pbkdf-memory",      '\0', POPT_ARG_LONG, &opt_pbkdf_memory,          0, N_("PBKDF memory cost limit"), N_("kilobytes") },
+               { "pbkdf-parallel",    '\0', POPT_ARG_LONG, &opt_pbkdf_parallel,        0, N_("PBKDF parallel cost"), N_("threads") },
+               { "pbkdf-force-iterations",'\0',POPT_ARG_LONG, &opt_pbkdf_iterations,   0, N_("PBKDF iterations cost (forced, disables benchmark)"), NULL },
+               { "header",            '\0', POPT_ARG_STRING, &opt_header_device,       0, N_("Device or file with separated LUKS header"), NULL },
                POPT_TABLEEND
        };
        poptContext popt_context;
@@ -1287,8 +1650,6 @@ int main(int argc, const char **argv)
 
        crypt_set_log_callback(NULL, tool_log, NULL);
 
-       set_int_block(1);
-
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
@@ -1302,18 +1663,12 @@ int main(int argc, const char **argv)
                usage(popt_context, EXIT_FAILURE, poptStrerror(r),
                      poptBadOption(popt_context, POPT_BADOPTION_NOALIAS));
 
-       if (opt_version_mode) {
-               log_std("%s %s\n", PACKAGE_REENC, PACKAGE_VERSION);
-               poptFreeContext(popt_context);
-               exit(EXIT_SUCCESS);
-       }
-
-       if (!opt_batch_mode) {
-               log_std(_("WARNING: this is experimental code, it can completely break your data.\n"));
-               log_verbose(_("Reencryption will change: volume key%s%s%s%s.\n"),
-                       opt_hash   ? _(", set hash to ")  : "", opt_hash   ?: "",
+       if (!opt_batch_mode)
+               log_verbose(_("Reencryption will change: %s%s%s%s%s%s."),
+                       opt_keep_key ? "" :  _("volume key"),
+                       (!opt_keep_key && opt_hash) ? ", " : "",
+                       opt_hash   ? _("set hash to ")    : "", opt_hash   ?: "",
                        opt_cipher ? _(", set cipher to "): "", opt_cipher ?: "");
-       }
 
        action_argv = poptGetArgs(popt_context);
        if(!action_argv)
@@ -1325,12 +1680,24 @@ int main(int argc, const char **argv)
                      poptGetInvocationName(popt_context));
 
        if (opt_bsize < 0 || opt_key_size < 0 || opt_iteration_time < 0 ||
-           opt_tries < 0 || opt_keyfile_offset < 0 || opt_key_size < 0) {
+           opt_tries < 0 || opt_keyfile_offset < 0 || opt_key_size < 0 ||
+           opt_pbkdf_iterations < 0 || opt_pbkdf_memory < 0 ||
+           opt_pbkdf_parallel < 0) {
                usage(popt_context, EXIT_FAILURE,
                      _("Negative number for option not permitted."),
                      poptGetInvocationName(popt_context));
        }
 
+       if (opt_pbkdf && crypt_parse_pbkdf(opt_pbkdf, &opt_pbkdf))
+               usage(popt_context, EXIT_FAILURE,
+               _("Password-based key derivation function (PBKDF) can be only pbkdf2 or argon2i/argon2id."),
+               poptGetInvocationName(popt_context));
+
+       if (opt_pbkdf_iterations && opt_iteration_time)
+               usage(popt_context, EXIT_FAILURE,
+               _("PBKDF forced iterations cannot be combined with iteration time option."),
+               poptGetInvocationName(popt_context));
+
        if (opt_bsize < 1 || opt_bsize > 64)
                usage(popt_context, EXIT_FAILURE,
                      _("Only values between 1 MiB and 64 MiB allowed for reencryption block size."),
@@ -1342,7 +1709,7 @@ int main(int argc, const char **argv)
                      poptGetInvocationName(popt_context));
 
        if (opt_key_slot != CRYPT_ANY_SLOT &&
-           (opt_key_slot < 0 || opt_key_slot >= crypt_keyslot_max(CRYPT_LUKS1)))
+           (opt_key_slot < 0 || opt_key_slot >= crypt_keyslot_max(CRYPT_LUKS2)))
                usage(popt_context, EXIT_FAILURE, _("Key slot is invalid."),
                      poptGetInvocationName(popt_context));
 
@@ -1351,12 +1718,12 @@ int main(int argc, const char **argv)
                      poptGetInvocationName(popt_context));
 
        if (opt_device_size_str &&
-           crypt_string_to_size(NULL, opt_device_size_str, &opt_device_size))
+           tools_string_to_size(NULL, opt_device_size_str, &opt_device_size))
                usage(popt_context, EXIT_FAILURE, _("Invalid device size specification."),
                      poptGetInvocationName(popt_context));
 
        if (opt_reduce_size_str &&
-           crypt_string_to_size(NULL, opt_reduce_size_str, &opt_reduce_size))
+           tools_string_to_size(NULL, opt_reduce_size_str, &opt_reduce_size))
                usage(popt_context, EXIT_FAILURE, _("Invalid device size specification."),
                      poptGetInvocationName(popt_context));
        if (opt_reduce_size > 64 * 1024 * 1024)
@@ -1366,12 +1733,12 @@ int main(int argc, const char **argv)
                usage(popt_context, EXIT_FAILURE, _("Reduce size must be multiple of 512 bytes sector."),
                      poptGetInvocationName(popt_context));
 
-       if (opt_new && !opt_reduce_size)
-               usage(popt_context, EXIT_FAILURE, _("Option --new must be used together with --reduce-device-size."),
+       if (opt_new && (!opt_reduce_size && !opt_header_device))
+               usage(popt_context, EXIT_FAILURE, _("Option --new must be used together with --reduce-device-size or --header."),
                      poptGetInvocationName(popt_context));
 
-       if (opt_keep_key && ((!opt_hash && !opt_iteration_time) || opt_cipher || opt_new))
-               usage(popt_context, EXIT_FAILURE, _("Option --keep-key can be used only with --hash or --iter-time."),
+       if (opt_keep_key && (opt_cipher || opt_new || opt_master_key_file))
+               usage(popt_context, EXIT_FAILURE, _("Option --keep-key can be used only with --hash, --iter-time or --pbkdf-force-iterations."),
                      poptGetInvocationName(popt_context));
 
        if (opt_new && opt_decrypt)
@@ -1382,6 +1749,14 @@ int main(int argc, const char **argv)
                usage(popt_context, EXIT_FAILURE, _("Option --decrypt is incompatible with specified parameters."),
                      poptGetInvocationName(popt_context));
 
+       if (opt_uuid && !opt_decrypt)
+               usage(popt_context, EXIT_FAILURE, _("Option --uuid is allowed only together with --decrypt."),
+                     poptGetInvocationName(popt_context));
+
+       if (!luksType(opt_type))
+               usage(popt_context, EXIT_FAILURE, _("Invalid luks type. Use one of these: 'luks', 'luks1' or 'luks2'."),
+                     poptGetInvocationName(popt_context));
+
        if (opt_debug) {
                opt_verbose = 1;
                crypt_set_debug_level(-1);
diff --git a/src/integritysetup.c b/src/integritysetup.c
new file mode 100644 (file)
index 0000000..51778da
--- /dev/null
@@ -0,0 +1,723 @@
+/*
+ * integritysetup - setup integrity protected volumes for dm-integrity
+ *
+ * Copyright (C) 2017-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2017-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "cryptsetup.h"
+#include <uuid/uuid.h>
+
+#define PACKAGE_INTEGRITY "integritysetup"
+
+#define DEFAULT_ALG_NAME "crc32c"
+#define MAX_KEY_SIZE 4096
+
+static const char *opt_journal_size_str = NULL;
+static uint64_t opt_journal_size = 0;
+static int opt_interleave_sectors = 0;
+static int opt_journal_watermark = 0;
+static int opt_bitmap_sectors_per_bit = 0;
+static int opt_journal_commit_time = 0;
+static int opt_bitmap_flush_time = 0;
+static int opt_tag_size = 0;
+static int opt_sector_size = 0;
+static int opt_buffer_sectors = 0;
+
+static int opt_no_wipe = 0;
+
+static const char *opt_data_device = NULL;
+
+static const char *opt_integrity = DEFAULT_ALG_NAME;
+static const char *opt_integrity_key_file = NULL;
+static int opt_integrity_key_size = 0;
+
+static const char *opt_journal_integrity = NULL; /* none */
+static const char *opt_journal_integrity_key_file = NULL;
+static int opt_journal_integrity_key_size = 0;
+
+static const char *opt_journal_crypt = NULL; /* none */
+static const char *opt_journal_crypt_key_file = NULL;
+static int opt_journal_crypt_key_size = 0;
+
+static int opt_integrity_nojournal = 0;
+static int opt_integrity_recovery = 0;
+static int opt_integrity_bitmap = 0;
+static int opt_integrity_legacy_padding = 0;
+
+static int opt_integrity_recalculate = 0;
+static int opt_allow_discards = 0;
+
+static const char **action_argv;
+static int action_argc;
+
+// FIXME: move this to tools and handle EINTR
+static int _read_mk(const char *file, char **key, int keysize)
+{
+       int fd;
+
+       if (keysize <= 0 || keysize > MAX_KEY_SIZE) {
+               log_err(_("Invalid key size."));
+               return -EINVAL;
+       }
+
+       *key = crypt_safe_alloc(keysize);
+       if (!*key)
+               return -ENOMEM;
+
+       fd = open(file, O_RDONLY);
+       if (fd == -1) {
+               log_err(_("Cannot read keyfile %s."), file);
+               goto fail;
+       }
+       if ((read(fd, *key, keysize) != keysize)) {
+               log_err(_("Cannot read %d bytes from keyfile %s."), keysize, file);
+               close(fd);
+               goto fail;
+       }
+       close(fd);
+       return 0;
+fail:
+       crypt_safe_free(*key);
+       *key = NULL;
+       return -EINVAL;
+}
+
+static int _read_keys(char **integrity_key, struct crypt_params_integrity *params)
+{
+       char *int_key = NULL, *journal_integrity_key = NULL, *journal_crypt_key = NULL;
+       int r;
+
+       if (integrity_key && opt_integrity_key_file) {
+               r = _read_mk(opt_integrity_key_file, &int_key, opt_integrity_key_size);
+               if (r < 0)
+                       return r;
+               params->integrity_key_size = opt_integrity_key_size;
+       }
+
+       if (opt_journal_integrity_key_file) {
+               r = _read_mk(opt_journal_integrity_key_file, &journal_integrity_key, opt_journal_integrity_key_size);
+               if (r < 0) {
+                       crypt_safe_free(int_key);
+                       return r;
+               }
+               params->journal_integrity_key = journal_integrity_key;
+               params->journal_integrity_key_size = opt_journal_integrity_key_size;
+       }
+
+       if (opt_journal_crypt_key_file) {
+               r = _read_mk(opt_journal_crypt_key_file, &journal_crypt_key, opt_journal_crypt_key_size);
+               if (r < 0) {
+                       crypt_safe_free(int_key);
+                       crypt_safe_free(journal_integrity_key);
+                       return r;
+               }
+               params->journal_crypt_key = journal_crypt_key;
+               params->journal_crypt_key_size = opt_journal_crypt_key_size;
+       }
+
+       if (integrity_key)
+               *integrity_key = int_key;
+
+       return 0;
+}
+
+static int _wipe_data_device(struct crypt_device *cd, const char *integrity_key)
+{
+       char tmp_name[64], tmp_path[128], tmp_uuid[40];
+       uuid_t tmp_uuid_bin;
+       int r;
+
+       if (!opt_batch_mode)
+               log_std(_("Wiping device to initialize integrity checksum.\n"
+                       "You can interrupt this by pressing CTRL+c "
+                       "(rest of not wiped device will contain invalid checksum).\n"));
+
+       /* Activate the device a temporary one */
+       uuid_generate(tmp_uuid_bin);
+       uuid_unparse(tmp_uuid_bin, tmp_uuid);
+       if (snprintf(tmp_name, sizeof(tmp_name), "temporary-cryptsetup-%s", tmp_uuid) < 0)
+               return -EINVAL;
+       if (snprintf(tmp_path, sizeof(tmp_path), "%s/%s", crypt_get_dir(), tmp_name) < 0)
+               return -EINVAL;
+
+       r = crypt_activate_by_volume_key(cd, tmp_name, integrity_key,
+               opt_integrity_key_size, CRYPT_ACTIVATE_PRIVATE | CRYPT_ACTIVATE_NO_JOURNAL);
+       if (r < 0)
+               return r;
+
+       /* Wipe the device */
+       set_int_handler(0);
+       r = crypt_wipe(cd, tmp_path, CRYPT_WIPE_ZERO, 0, 0, DEFAULT_WIPE_BLOCK,
+                      0, &tools_wipe_progress, NULL);
+       if (crypt_deactivate(cd, tmp_name))
+               log_err(_("Cannot deactivate temporary device %s."), tmp_path);
+       set_int_block(0);
+
+       return r;
+}
+
+static int action_format(int arg)
+{
+       struct crypt_device *cd = NULL;
+       struct crypt_params_integrity params = {
+               .journal_size = opt_journal_size,
+               .interleave_sectors = opt_interleave_sectors,
+               /* in bitmap mode we have to overload these values... */
+               .journal_watermark = opt_integrity_bitmap ? opt_bitmap_sectors_per_bit : opt_journal_watermark,
+               .journal_commit_time = opt_integrity_bitmap ? opt_bitmap_flush_time : opt_journal_commit_time,
+               .buffer_sectors = opt_buffer_sectors,
+               .tag_size = opt_tag_size,
+               .sector_size = opt_sector_size ?: SECTOR_SIZE,
+       }, params2;
+       char integrity[MAX_CIPHER_LEN], journal_integrity[MAX_CIPHER_LEN], journal_crypt[MAX_CIPHER_LEN];
+       char *integrity_key = NULL, *msg = NULL;
+       int r;
+       size_t signatures;
+
+       if (opt_integrity) {
+               r = crypt_parse_hash_integrity_mode(opt_integrity, integrity);
+               if (r < 0) {
+                       log_err(_("No known integrity specification pattern detected."));
+                       return r;
+               }
+               params.integrity = integrity;
+       }
+
+       if (opt_journal_integrity) {
+               r = crypt_parse_hash_integrity_mode(opt_journal_integrity, journal_integrity);
+               if (r < 0) {
+                       log_err(_("No known integrity specification pattern detected."));
+                       return r;
+               }
+               params.journal_integrity = journal_integrity;
+       }
+
+       if (opt_journal_crypt) {
+               r = crypt_parse_hash_integrity_mode(opt_journal_crypt, journal_crypt);
+               if (r < 0) {
+                       log_err(_("No known integrity specification pattern detected."));
+                       return r;
+               }
+               params.journal_crypt = journal_crypt;
+       }
+
+       r = _read_keys(&integrity_key, &params);
+       if (r)
+               goto out;
+
+       r = crypt_init_data_device(&cd, action_argv[0], opt_data_device);
+       if (r < 0)
+               goto out;
+
+       r = asprintf(&msg, _("This will overwrite data on %s irrevocably."), action_argv[0]);
+       if (r == -1) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       r = yesDialog(msg, _("Operation aborted.\n")) ? 0 : -EINVAL;
+       free(msg);
+       if (r < 0)
+               goto out;
+
+       r = tools_detect_signatures(action_argv[0], 0, &signatures);
+       if (r < 0)
+               goto out;
+
+       /* Signature candidates found */
+       if (signatures && ((r = tools_wipe_all_signatures(action_argv[0])) < 0))
+               goto out;
+
+       if (opt_integrity_legacy_padding)
+               crypt_set_compatibility(cd, CRYPT_COMPAT_LEGACY_INTEGRITY_PADDING);
+
+       r = crypt_format(cd, CRYPT_INTEGRITY, NULL, NULL, NULL, NULL, 0, &params);
+       if (r < 0) /* FIXME: call wipe signatures again */
+               goto out;
+
+       if (!opt_batch_mode && !crypt_get_integrity_info(cd, &params2))
+               log_std(_("Formatted with tag size %u, internal integrity %s.\n"),
+                       params2.tag_size, params2.integrity);
+
+       if (!opt_no_wipe)
+               r = _wipe_data_device(cd, integrity_key);
+out:
+       crypt_safe_free(integrity_key);
+       crypt_safe_free(CONST_CAST(void*)params.journal_integrity_key);
+       crypt_safe_free(CONST_CAST(void*)params.journal_crypt_key);
+       crypt_free(cd);
+       return r;
+}
+
+static int action_open(int arg)
+{
+       struct crypt_device *cd = NULL;
+       struct crypt_params_integrity params = {
+               /* in bitmap mode we have to overload these values... */
+               .journal_watermark = opt_integrity_bitmap ? opt_bitmap_sectors_per_bit : opt_journal_watermark,
+               .journal_commit_time = opt_integrity_bitmap ? opt_bitmap_flush_time : opt_journal_commit_time,
+               .buffer_sectors = opt_buffer_sectors,
+       };
+       uint32_t activate_flags = 0;
+       char integrity[MAX_CIPHER_LEN], journal_integrity[MAX_CIPHER_LEN], journal_crypt[MAX_CIPHER_LEN];
+       char *integrity_key = NULL;
+       int r;
+
+       if (opt_integrity) {
+               r = crypt_parse_hash_integrity_mode(opt_integrity, integrity);
+               if (r < 0) {
+                       log_err(_("No known integrity specification pattern detected."));
+                       return r;
+               }
+               params.integrity = integrity;
+       }
+
+       if (opt_journal_integrity) {
+               r = crypt_parse_hash_integrity_mode(opt_journal_integrity, journal_integrity);
+               if (r < 0) {
+                       log_err(_("No known integrity specification pattern detected."));
+                       return r;
+
+               }
+               params.journal_integrity = journal_integrity;
+       }
+
+       if (opt_journal_crypt) {
+               r = crypt_parse_hash_integrity_mode(opt_journal_crypt, journal_crypt);
+               if (r < 0) {
+                       log_err(_("No known integrity specification pattern detected."));
+                       return r;
+               }
+               params.journal_crypt = journal_crypt;
+       }
+
+       if (opt_integrity_nojournal || opt_integrity_bitmap)
+               activate_flags |= CRYPT_ACTIVATE_NO_JOURNAL;
+       if (opt_integrity_recovery)
+               activate_flags |= CRYPT_ACTIVATE_RECOVERY;
+       if (opt_integrity_bitmap)
+               activate_flags |= CRYPT_ACTIVATE_NO_JOURNAL_BITMAP;
+
+       if (opt_integrity_recalculate)
+               activate_flags |= CRYPT_ACTIVATE_RECALCULATE;
+       if (opt_allow_discards)
+               activate_flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
+
+       r = _read_keys(&integrity_key, &params);
+       if (r)
+               goto out;
+
+       if ((r = crypt_init_data_device(&cd, action_argv[0], opt_data_device)))
+               goto out;
+
+       r = crypt_load(cd, CRYPT_INTEGRITY, &params);
+       if (r)
+               goto out;
+
+       r = crypt_activate_by_volume_key(cd, action_argv[1], integrity_key,
+                                        opt_integrity_key_size, activate_flags);
+out:
+       crypt_safe_free(integrity_key);
+       crypt_safe_free(CONST_CAST(void*)params.journal_integrity_key);
+       crypt_safe_free(CONST_CAST(void*)params.journal_crypt_key);
+       crypt_free(cd);
+       return r;
+}
+
+static int action_close(int arg)
+{
+       struct crypt_device *cd = NULL;
+       int r;
+
+       r = crypt_init_by_name(&cd, action_argv[0]);
+       if (r == 0)
+               r = crypt_deactivate(cd, action_argv[0]);
+
+       crypt_free(cd);
+       return r;
+}
+
+static int action_status(int arg)
+{
+       crypt_status_info ci;
+       struct crypt_active_device cad;
+       struct crypt_params_integrity ip = {};
+       struct crypt_device *cd = NULL;
+       char *backing_file;
+       const char *device, *metadata_device;
+       int path = 0, r = 0;
+
+       /* perhaps a path, not a dm device name */
+       if (strchr(action_argv[0], '/'))
+               path = 1;
+
+       ci = crypt_status(NULL, action_argv[0]);
+       switch (ci) {
+       case CRYPT_INVALID:
+               r = -EINVAL;
+               break;
+       case CRYPT_INACTIVE:
+               if (path)
+                       log_std("%s is inactive.\n", action_argv[0]);
+               else
+                       log_std("%s/%s is inactive.\n", crypt_get_dir(), action_argv[0]);
+               r = -ENODEV;
+               break;
+       case CRYPT_ACTIVE:
+       case CRYPT_BUSY:
+               if (path)
+                       log_std("%s is active%s.\n", action_argv[0],
+                               ci == CRYPT_BUSY ? " and is in use" : "");
+               else
+                       log_std("%s/%s is active%s.\n", crypt_get_dir(), action_argv[0],
+                               ci == CRYPT_BUSY ? " and is in use" : "");
+
+               r = crypt_init_by_name_and_header(&cd, action_argv[0], NULL);
+               if (r < 0)
+                       goto out;
+
+               log_std("  type:    %s\n", crypt_get_type(cd) ?: "n/a");
+
+               r = crypt_get_active_device(cd, action_argv[0], &cad);
+               if (r < 0)
+                       goto out;
+
+               /* Print only INTEGRITY (and LUKS2 with integrity) info */
+               r = crypt_get_integrity_info(cd, &ip);
+               if (r < 0)
+                       goto out;
+
+               log_std("  tag size: %u\n", ip.tag_size);
+               log_std("  integrity: %s\n", ip.integrity ?: "(none)");
+               device = crypt_get_device_name(cd);
+               metadata_device = crypt_get_metadata_device_name(cd);
+               log_std("  device:  %s%s\n", device, metadata_device ? " (detached)" : "");
+               if ((backing_file = crypt_loop_backing_file(device))) {
+                       log_std("  loop:    %s\n", backing_file);
+                       free(backing_file);
+               }
+               if (metadata_device) {
+                       log_std("  metadata device:  %s\n", metadata_device);
+                       if ((backing_file = crypt_loop_backing_file(metadata_device))) {
+                               log_std("  loop:    %s\n", backing_file);
+                               free(backing_file);
+                       }
+               }
+               log_std("  sector size:  %u bytes\n", crypt_get_sector_size(cd));
+               log_std("  interleave sectors: %u\n", ip.interleave_sectors);
+               log_std("  size:    %" PRIu64 " sectors\n", cad.size);
+               log_std("  mode:    %s%s\n",
+                       cad.flags & CRYPT_ACTIVATE_READONLY ? "readonly" : "read/write",
+                       cad.flags & CRYPT_ACTIVATE_RECOVERY ? " recovery" : "");
+               log_std("  failures: %" PRIu64 "\n",
+                       crypt_get_active_integrity_failures(cd, action_argv[0]));
+               if (cad.flags & CRYPT_ACTIVATE_NO_JOURNAL_BITMAP) {
+                       log_std("  bitmap 512-byte sectors per bit: %u\n", ip.journal_watermark);
+                       log_std("  bitmap flush interval: %u ms\n", ip.journal_commit_time);
+               } if (cad.flags & CRYPT_ACTIVATE_NO_JOURNAL) {
+                       log_std("  journal: not active\n");
+               } else {
+                       log_std("  journal size: %" PRIu64 " bytes\n", ip.journal_size);
+                       log_std("  journal watermark: %u%%\n", ip.journal_watermark);
+                       log_std("  journal commit time: %u ms\n", ip.journal_commit_time);
+                       if (ip.journal_integrity)
+                               log_std("  journal integrity MAC: %s\n", ip.journal_integrity);
+                       if (ip.journal_crypt)
+                               log_std("  journal encryption: %s\n", ip.journal_crypt);
+               }
+               if (cad.flags & (CRYPT_ACTIVATE_ALLOW_DISCARDS))
+                       log_std("  flags: %s\n",
+                               (cad.flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) ? "discards " : "");
+       }
+out:
+       crypt_free(cd);
+       if (r == -ENOTSUP)
+               r = 0;
+       return r;
+       return -EINVAL;
+}
+
+static int action_dump(int arg)
+{
+       struct crypt_device *cd = NULL;
+       struct crypt_params_integrity params = {};
+       int r;
+
+       if ((r = crypt_init(&cd, action_argv[0])))
+               return r;
+
+       r = crypt_load(cd, CRYPT_INTEGRITY, &params);
+       if (!r)
+               crypt_dump(cd);
+
+       crypt_free(cd);
+       return r;
+}
+
+static struct action_type {
+       const char *type;
+       int (*handler)(int);
+       int required_action_argc;
+       const char *arg_desc;
+       const char *desc;
+} action_types[] = {
+       { "format",     action_format, 1, N_("<integrity_device>"),N_("format device") },
+       { "open",       action_open,   2, N_("<integrity_device> <name>"),N_("open device as <name>") },
+       { "close",      action_close,  1, N_("<name>"),N_("close device (remove mapping)") },
+       { "status",     action_status, 1, N_("<name>"),N_("show active device status") },
+       { "dump",       action_dump,   1, N_("<integrity_device>"),N_("show on-disk information") },
+       { NULL, NULL, 0, NULL, NULL }
+};
+
+static void help(poptContext popt_context,
+                enum poptCallbackReason reason __attribute__((unused)),
+                struct poptOption *key,
+                const char *arg __attribute__((unused)),
+                void *data __attribute__((unused)))
+{
+       struct action_type *action;
+
+       if (key->shortName == '?') {
+               log_std("%s %s\n", PACKAGE_INTEGRITY, PACKAGE_VERSION);
+               poptPrintHelp(popt_context, stdout, 0);
+               log_std(_("\n"
+                        "<action> is one of:\n"));
+               for(action = action_types; action->type; action++)
+                       log_std("\t%s %s - %s\n", action->type, _(action->arg_desc), _(action->desc));
+               log_std(_("\n"
+                        "<name> is the device to create under %s\n"
+                        "<integrity_device> is the device containing data with integrity tags\n"),
+                       crypt_get_dir());
+
+               log_std(_("\nDefault compiled-in dm-integrity parameters:\n"
+                         "\tChecksum algorithm: %s\n"), DEFAULT_ALG_NAME);
+               poptFreeContext(popt_context);
+               exit(EXIT_SUCCESS);
+       } else if (key->shortName == 'V') {
+               log_std("%s %s\n", PACKAGE_INTEGRITY, PACKAGE_VERSION);
+               poptFreeContext(popt_context);
+               exit(EXIT_SUCCESS);
+       } else
+               usage(popt_context, EXIT_SUCCESS, NULL, NULL);
+}
+
+static int run_action(struct action_type *action)
+{
+       int r;
+
+       log_dbg("Running command %s.", action->type);
+
+       r = action->handler(0);
+
+       show_status(r);
+       return translate_errno(r);
+}
+
+int main(int argc, const char **argv)
+{
+       static const char *null_action_argv[] = {NULL};
+       static struct poptOption popt_help_options[] = {
+               { NULL,    '\0', POPT_ARG_CALLBACK, help, 0, NULL,                         NULL },
+               { "help",  '?',  POPT_ARG_NONE,     NULL, 0, N_("Show this help message"), NULL },
+               { "usage", '\0', POPT_ARG_NONE,     NULL, 0, N_("Display brief usage"),    NULL },
+               { "version",'V', POPT_ARG_NONE,     NULL, 0, N_("Print package version"),  NULL },
+               POPT_TABLEEND
+       };
+       static struct poptOption popt_options[] = {
+               { NULL,                 '\0', POPT_ARG_INCLUDE_TABLE, popt_help_options, 0, N_("Help options:"), NULL },
+               { "verbose",             'v', POPT_ARG_NONE, &opt_verbose,            0, N_("Shows more detailed error messages"), NULL },
+               { "debug",              '\0', POPT_ARG_NONE, &opt_debug,              0, N_("Show debug messages"), NULL },
+               { "batch-mode",          'q', POPT_ARG_NONE, &opt_batch_mode,         0, N_("Do not ask for confirmation"), NULL },
+               { "progress-frequency", '\0', POPT_ARG_INT,  &opt_progress_frequency, 0, N_("Progress line update (in seconds)"), N_("secs") },
+               { "no-wipe",            '\0', POPT_ARG_NONE, &opt_no_wipe,            0, N_("Do not wipe device after format"), NULL },
+
+               { "data-device",        '\0', POPT_ARG_STRING, &opt_data_device,      0, N_("Path to data device (if separated)"), N_("path") },
+
+               { "journal-size",        'j', POPT_ARG_STRING,&opt_journal_size_str,  0, N_("Journal size"), N_("bytes") },
+               { "interleave-sectors", '\0', POPT_ARG_INT,  &opt_interleave_sectors, 0, N_("Interleave sectors"), N_("SECTORS") },
+               { "journal-watermark",  '\0', POPT_ARG_INT,  &opt_journal_watermark,  0, N_("Journal watermark"),N_("percent") },
+               { "journal-commit-time",'\0', POPT_ARG_INT,  &opt_journal_commit_time,0, N_("Journal commit time"), N_("ms") },
+               { "bitmap-sectors-per-bit",'\0', POPT_ARG_INT,&opt_bitmap_sectors_per_bit, 0, N_("Number of 512-byte sectors per bit (bitmap mode)."), NULL },
+               { "bitmap-flush-time",  '\0', POPT_ARG_INT,  &opt_bitmap_flush_time,  0, N_("Bitmap mode flush time"), N_("ms") },
+               { "tag-size",            't', POPT_ARG_INT,  &opt_tag_size,           0, N_("Tag size (per-sector)"), N_("bytes") },
+               { "sector-size",         's', POPT_ARG_INT,  &opt_sector_size,        0, N_("Sector size"), N_("bytes") },
+               { "buffer-sectors",     '\0', POPT_ARG_INT,  &opt_buffer_sectors,     0, N_("Buffers size"), N_("SECTORS") },
+
+               { "integrity",                  'I', POPT_ARG_STRING, &opt_integrity,                 0, N_("Data integrity algorithm"), NULL },
+               { "integrity-key-size",        '\0', POPT_ARG_INT,    &opt_integrity_key_size,        0, N_("The size of the data integrity key"), N_("BITS") },
+               { "integrity-key-file",        '\0', POPT_ARG_STRING, &opt_integrity_key_file,        0, N_("Read the integrity key from a file"), NULL },
+
+               { "journal-integrity",         '\0', POPT_ARG_STRING, &opt_journal_integrity,         0, N_("Journal integrity algorithm"), NULL },
+               { "journal-integrity-key-size",'\0', POPT_ARG_INT,    &opt_journal_integrity_key_size,0, N_("The size of the journal integrity key"), N_("BITS") },
+               { "journal-integrity-key-file",'\0', POPT_ARG_STRING, &opt_journal_integrity_key_file,0, N_("Read the journal integrity key from a file"), NULL },
+
+               { "journal-crypt",             '\0', POPT_ARG_STRING, &opt_journal_crypt,             0, N_("Journal encryption algorithm"), NULL },
+               { "journal-crypt-key-size",    '\0', POPT_ARG_INT,    &opt_journal_crypt_key_size,    0, N_("The size of the journal encryption key"), N_("BITS") },
+               { "journal-crypt-key-file",    '\0', POPT_ARG_STRING, &opt_journal_crypt_key_file,    0, N_("Read the journal encryption key from a file"), NULL },
+
+               { "integrity-no-journal",       'D', POPT_ARG_NONE,  &opt_integrity_nojournal, 0, N_("Disable journal for integrity device"), NULL },
+               { "integrity-recovery-mode",    'R', POPT_ARG_NONE,  &opt_integrity_recovery,  0, N_("Recovery mode (no journal, no tag checking)"), NULL },
+               { "integrity-bitmap-mode",      'B', POPT_ARG_NONE,  &opt_integrity_bitmap, 0, N_("Use bitmap to track changes and disable journal for integrity device"), NULL },
+               { "integrity-recalculate",     '\0', POPT_ARG_NONE,  &opt_integrity_recalculate,  0, N_("Recalculate initial tags automatically."), NULL },
+               { "integrity-legacy-padding",  '\0', POPT_ARG_NONE,  &opt_integrity_legacy_padding, 0, N_("Use inefficient legacy padding (old kernels)"), NULL },
+
+               { "allow-discards",            '\0', POPT_ARG_NONE,  &opt_allow_discards, 0, N_("Allow discards (aka TRIM) requests for device"), NULL },
+               POPT_TABLEEND
+       };
+       poptContext popt_context;
+       struct action_type *action;
+       const char *aname;
+       int r;
+
+       crypt_set_log_callback(NULL, tool_log, NULL);
+
+       setlocale(LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
+       popt_context = poptGetContext("integrity", argc, argv, popt_options, 0);
+       poptSetOtherOptionHelp(popt_context,
+                              _("[OPTION...] <action> <action-specific>"));
+
+
+       while ((r = poptGetNextOpt(popt_context)) >= 0) {
+       }
+
+       if (r < -1)
+               usage(popt_context, EXIT_FAILURE, poptStrerror(r),
+                     poptBadOption(popt_context, POPT_BADOPTION_NOALIAS));
+
+       if (!(aname = poptGetArg(popt_context)))
+               usage(popt_context, EXIT_FAILURE, _("Argument <action> missing."),
+                     poptGetInvocationName(popt_context));
+
+       action_argc = 0;
+       action_argv = poptGetArgs(popt_context);
+       /* Make return values of poptGetArgs more consistent in case of remaining argc = 0 */
+       if (!action_argv)
+               action_argv = null_action_argv;
+
+       /* Count args, somewhat unnice, change? */
+       while (action_argv[action_argc] != NULL)
+               action_argc++;
+
+       /* Handle aliases */
+       if (!strcmp(aname, "create") && action_argc > 1) {
+               /* create command had historically switched arguments */
+               if (action_argv[0] && action_argv[1]) {
+                       const char *tmp = action_argv[0];
+                       action_argv[0] = action_argv[1];
+                       action_argv[1] = tmp;
+               }
+               aname = "open";
+       } else if (!strcmp(aname, "remove")) {
+               aname = "close";
+       }
+
+       for (action = action_types; action->type; action++)
+               if (strcmp(action->type, aname) == 0)
+                       break;
+
+       if (!action->type)
+               usage(popt_context, EXIT_FAILURE, _("Unknown action."),
+                     poptGetInvocationName(popt_context));
+
+       if (action_argc < action->required_action_argc) {
+               char buf[128];
+               snprintf(buf, 128,_("%s: requires %s as arguments"), action->type, action->arg_desc);
+               usage(popt_context, EXIT_FAILURE, buf,
+                     poptGetInvocationName(popt_context));
+       }
+
+       if (opt_integrity_recalculate && strcmp(aname, "open"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --integrity-recalculate can be used only for open action."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_allow_discards && strcmp(aname, "open"))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Option --allow-discards is allowed only for open operation."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_interleave_sectors < 0 || opt_journal_watermark < 0 ||
+           opt_journal_commit_time < 0 || opt_tag_size < 0 ||
+           opt_sector_size < 0 || opt_buffer_sectors < 0 ||
+           opt_integrity_key_size < 0 || opt_journal_integrity_key_size < 0 ||
+           opt_journal_crypt_key_size < 0 || opt_bitmap_flush_time < 0 || opt_bitmap_sectors_per_bit < 0)
+                usage(popt_context, EXIT_FAILURE,
+                      _("Negative number for option not permitted."),
+                      poptGetInvocationName(popt_context));
+
+       if (strcmp(aname, "format") && (opt_journal_size_str || opt_interleave_sectors ||
+               opt_sector_size || opt_tag_size || opt_no_wipe ))
+               usage(popt_context, EXIT_FAILURE,
+                     _("Options --journal-size, --interleave-sectors, --sector-size, --tag-size"
+                       " and --no-wipe can be used only for format action."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_journal_size_str &&
+           tools_string_to_size(NULL, opt_journal_size_str, &opt_journal_size))
+               usage(popt_context, EXIT_FAILURE, _("Invalid journal size specification."),
+                     poptGetInvocationName(popt_context));
+
+       if ((opt_integrity_key_file && !opt_integrity_key_size) ||
+          (!opt_integrity_key_file && opt_integrity_key_size))
+               usage(popt_context, EXIT_FAILURE, _("Both key file and key size options must be specified."),
+                     poptGetInvocationName(popt_context));
+       if (!opt_integrity && opt_integrity_key_file)
+               usage(popt_context, EXIT_FAILURE, _("Integrity algorithm must be specified if integrity key is used."),
+                     poptGetInvocationName(popt_context));
+
+       if ((opt_journal_integrity_key_file && !opt_journal_integrity_key_size) ||
+          (!opt_journal_integrity_key_file && opt_journal_integrity_key_size))
+               usage(popt_context, EXIT_FAILURE, _("Both journal integrity key file and key size options must be specified."),
+                     poptGetInvocationName(popt_context));
+       if (!opt_journal_integrity && opt_journal_integrity_key_file)
+               usage(popt_context, EXIT_FAILURE, _("Journal integrity algorithm must be specified if journal integrity key is used."),
+                     poptGetInvocationName(popt_context));
+
+       if ((opt_journal_crypt_key_file && !opt_journal_crypt_key_size) ||
+          (!opt_journal_crypt_key_file && opt_journal_crypt_key_size))
+               usage(popt_context, EXIT_FAILURE, _("Both journal encryption key file and key size options must be specified."),
+                     poptGetInvocationName(popt_context));
+       if (!opt_journal_crypt && opt_journal_crypt_key_file)
+               usage(popt_context, EXIT_FAILURE, _("Journal encryption algorithm must be specified if journal encryption key is used."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_integrity_recovery && opt_integrity_bitmap)
+               usage(popt_context, EXIT_FAILURE, _("Recovery and bitmap mode options are mutually exclusive."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_integrity_bitmap && (opt_journal_integrity_key_file || opt_journal_crypt || opt_journal_watermark || opt_journal_commit_time))
+               usage(popt_context, EXIT_FAILURE, _("Journal options cannot be used in bitmap mode."),
+                     poptGetInvocationName(popt_context));
+
+       if (!opt_integrity_bitmap && (opt_bitmap_flush_time || opt_bitmap_sectors_per_bit))
+               usage(popt_context, EXIT_FAILURE, _("Bitmap options can be used only in bitmap mode."),
+                     poptGetInvocationName(popt_context));
+
+       if (opt_debug) {
+               opt_verbose = 1;
+               crypt_set_debug_level(-1);
+               dbg_version_and_cmd(argc, argv);
+       }
+
+       r = run_action(action);
+       poptFreeContext(popt_context);
+       return r;
+}
diff --git a/src/utils_blockdev.c b/src/utils_blockdev.c
new file mode 100644 (file)
index 0000000..960b7a7
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Linux block devices helpers
+ *
+ * Copyright (C) 2018-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2018-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "cryptsetup.h"
+#include <dirent.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+# include <sys/sysmacros.h>     /* for major, minor */
+#endif
+#include <uuid/uuid.h>
+
+#define DM_UUID_LEN            129
+#define DM_BY_ID_PREFIX                "dm-uuid-"
+#define DM_BY_ID_PREFIX_LEN    8
+#define DM_UUID_PREFIX         "CRYPT-"
+#define DM_UUID_PREFIX_LEN     6
+#define UUID_LEN 37 /* 36 + \0, libuuid ... */
+
+static int dm_prepare_uuid(const char *type, const char *uuid, char *buf, size_t buflen)
+{
+       char *ptr, uuid2[UUID_LEN] = {0};
+       uuid_t uu;
+       unsigned i = 0;
+
+       /* Remove '-' chars */
+       if (uuid) {
+               if (uuid_parse(uuid, uu) < 0) {
+                       log_dbg("Requested UUID %s has invalid format.", uuid);
+                       return 0;
+               }
+
+               for (ptr = uuid2, i = 0; i < UUID_LEN; i++)
+                       if (uuid[i] != '-') {
+                               *ptr = uuid[i];
+                               ptr++;
+                       }
+       }
+
+       snprintf(buf, buflen, DM_UUID_PREFIX "%s%s%s%s",
+               type ?: "", type ? "-" : "",
+               uuid2[0] ? uuid2 : "", uuid2[0] ? "-" : "");
+
+       return 1;
+}
+
+/* return number of holders in general, if matched dm_uuid prefix it's returned via dm_name */
+/* negative value is error */
+static int lookup_holder_dm_name(const char *dm_uuid, size_t max_len, dev_t devno, char *dm_name, size_t dm_name_length)
+{
+       struct dirent *entry;
+       char dm_subpath[PATH_MAX], data_dev_dir[PATH_MAX], uuid[max_len];
+       ssize_t s;
+       struct stat st;
+       int dmfd, fd, len, r = 0; /* not found */
+       DIR *dir;
+
+       if (!dm_name || !dm_name_length)
+               return -EINVAL;
+
+       *dm_name = '\0';
+
+       len = snprintf(data_dev_dir, PATH_MAX, "/sys/dev/block/%u:%u/holders", major(devno), minor(devno));
+       if (len < 0 || len >= PATH_MAX)
+               return -EINVAL;
+
+       if (!(dir = opendir(data_dev_dir)))
+               /* map ENOTDIR to ENOENT we'll handle both errors same */
+               return errno == ENOTDIR ? -ENOENT : -errno;
+
+       while (r != 1 && (entry = readdir(dir))) {
+               if (entry->d_name[0] == '.' ||
+                   !strncmp(entry->d_name, "..", 2))
+                       continue;
+
+               /* there's a holder */
+               r++;
+
+               /* we already have a dm_name, just count remaining holders */
+               if (*dm_name != '\0')
+                       continue;
+
+               len = snprintf(dm_subpath, PATH_MAX, "%s/%s", entry->d_name, "dm");
+               if (len < 0 || len >= PATH_MAX) {
+                       r = -EINVAL;
+                       break;
+               }
+
+               /* looking for dm-X/dm directory, symlinks are fine */
+               dmfd = openat(dirfd(dir), dm_subpath, O_DIRECTORY | O_RDONLY);
+               if (dmfd < 0)
+                       continue;
+
+               fd = openat(dmfd, "uuid", O_RDONLY);
+               if (fd < 0) {
+                       close(dmfd);
+                       continue;
+               }
+
+               if (fstat(fd, &st) || !S_ISREG(st.st_mode)) {
+                       close(fd);
+                       close(dmfd);
+                       continue;
+               }
+
+               /* reads binary data */
+               s = read_buffer(fd, uuid, max_len - 1);
+               close(fd);
+               uuid[s > 0 ? s : 0] = '\0';
+               if (!strncmp(uuid, dm_uuid, strlen(dm_uuid)))
+                       log_dbg("Found candidate device %s", entry->d_name);
+               else {
+                       close(dmfd);
+                       continue;
+               }
+
+               fd = openat(dmfd, "name", O_RDONLY);
+               if (fd < 0) {
+                       close(dmfd);
+                       continue;
+               }
+
+               if (fstat(fd, &st) || !S_ISREG(st.st_mode)) {
+                       close(fd);
+                       close(dmfd);
+                       continue;
+               }
+
+               /* reads binary data */
+               s = read_buffer(fd, dm_name, dm_name_length - 1);
+               close(fd);
+               close(dmfd);
+               if (s > 1) {
+                       dm_name[s-1] = '\0';
+                       log_dbg("Found dm device %s", dm_name);
+               }
+       }
+
+       closedir(dir);
+
+       return r;
+}
+
+int tools_lookup_crypt_device(struct crypt_device *cd, const char *type,
+               const char *data_device_path, char *name, size_t name_length)
+{
+       int r;
+       char *c;
+       struct stat st;
+       char dev_uuid[DM_UUID_LEN + DM_BY_ID_PREFIX_LEN] = DM_BY_ID_PREFIX;
+
+       if (!dm_prepare_uuid(type, crypt_get_uuid(cd), dev_uuid + DM_BY_ID_PREFIX_LEN, DM_UUID_LEN))
+               return -EINVAL;
+
+       c = strrchr(dev_uuid, '-');
+       if (!c)
+               return -EINVAL;
+
+       /* cut of dm name */
+       *c = '\0';
+
+       log_dbg("Looking for any dm device with prefix: %s", dev_uuid);
+
+       if (stat(data_device_path, &st) < 0)
+               return -ENODEV;
+
+       if (!S_ISBLK(st.st_mode))
+               return -ENOTBLK;
+
+       r = lookup_holder_dm_name(dev_uuid + DM_BY_ID_PREFIX_LEN, DM_UUID_LEN,
+                       st.st_rdev, name, name_length);
+       return r;
+}
diff --git a/src/utils_luks2.c b/src/utils_luks2.c
new file mode 100644 (file)
index 0000000..535d85f
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Helper utilities for LUKS2 features
+ *
+ * Copyright (C) 2018-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2018-2020 Milan Broz
+ * Copyright (C) 2018-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "cryptsetup.h"
+
+/*
+ * FIXME: 4MiBs is max LUKS2 mda length (including binary header).
+ * In future, read max allowed JSON size from config section.
+ */
+#define LUKS2_MAX_MDA_SIZE 0x400000
+int tools_read_json_file(struct crypt_device *cd, const char *file, char **json, size_t *json_size)
+{
+       ssize_t ret;
+       int fd, block, r;
+       void *buf = NULL;
+
+       block = tools_signals_blocked();
+       if (block)
+               set_int_block(0);
+
+       if (tools_is_stdin(file)) {
+               fd = STDIN_FILENO;
+               log_dbg("STDIN descriptor JSON read requested.");
+       } else {
+               log_dbg("File descriptor JSON read requested.");
+               fd = open(file, O_RDONLY);
+               if (fd < 0) {
+                       log_err(_("Failed to open file %s in read-only mode."), file);
+                       r = -EINVAL;
+                       goto out;
+               }
+       }
+
+       buf = malloc(LUKS2_MAX_MDA_SIZE);
+       if (!buf) {
+               r = -ENOMEM;
+               goto out;
+       }
+
+       if (isatty(fd) && !opt_batch_mode)
+               log_std(_("Provide valid LUKS2 token JSON:\n"));
+
+       /* we expect JSON (string) */
+       r = 0;
+       ret = read_buffer_intr(fd, buf, LUKS2_MAX_MDA_SIZE - 1, &quit);
+       if (ret < 0) {
+               r = -EIO;
+               log_err(_("Failed to read JSON file."));
+               goto out;
+       }
+       check_signal(&r);
+       if (r) {
+               log_err(_("\nRead interrupted."));
+               goto out;
+       }
+
+       *json_size = (size_t)ret;
+       *json = buf;
+       *(*json + ret) = '\0';
+out:
+       if (block && !quit)
+               set_int_block(1);
+       if (fd >= 0 && fd != STDIN_FILENO)
+               close(fd);
+       if (r && buf) {
+               memset(buf, 0, LUKS2_MAX_MDA_SIZE);
+               free(buf);
+       }
+       return r;
+}
+
+int tools_write_json_file(struct crypt_device *cd, const char *file, const char *json)
+{
+       int block, fd, r;
+       size_t json_len;
+       ssize_t ret;
+
+       if (!json || !(json_len = strlen(json)) || json_len >= LUKS2_MAX_MDA_SIZE)
+               return -EINVAL;
+
+       block = tools_signals_blocked();
+       if (block)
+               set_int_block(0);
+
+       if (tools_is_stdin(file)) {
+               fd = STDOUT_FILENO;
+               log_dbg("STDOUT descriptor JSON write requested.");
+       } else {
+               log_dbg("File descriptor JSON write requested.");
+               fd = open(file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
+       }
+
+       if (fd < 0) {
+               log_err(_("Failed to open file %s in write mode."), file ?: "");
+               r = -EINVAL;
+               goto out;
+       }
+
+       r = 0;
+       ret = write_buffer_intr(fd, json, json_len, &quit);
+       check_signal(&r);
+       if (r) {
+               log_err(_("\nWrite interrupted."));
+               goto out;
+       }
+       if (ret < 0 || (size_t)ret != json_len) {
+               log_err(_("Failed to write JSON file."));
+               r = -EIO;
+               goto out;
+       }
+
+       if (isatty(fd))
+               (void) write_buffer_intr(fd, "\n", 1, &quit);
+out:
+       if (block && !quit)
+               set_int_block(1);
+       if (fd >=0 && fd != STDOUT_FILENO)
+               close(fd);
+       return r;
+}
index 541806c..55c1343 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Password quality check wrapper
  *
- * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2014, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include "cryptsetup.h"
+#include <termios.h>
 
 int opt_force_password = 0;
 
-#if ENABLE_PWQUALITY
+#if defined ENABLE_PWQUALITY
 #include <pwquality.h>
 
 static int tools_check_pwquality(const char *password)
@@ -39,7 +40,7 @@ static int tools_check_pwquality(const char *password)
 
        r = pwquality_read_config(pwq, NULL, &auxerror);
        if (r) {
-               log_err(_("Cannot check password quality: %s\n"),
+               log_err(_("Cannot check password quality: %s"),
                        pwquality_strerror(NULL, 0, r, auxerror));
                pwquality_free_settings(pwq);
                return -EINVAL;
@@ -47,7 +48,7 @@ static int tools_check_pwquality(const char *password)
 
        r = pwquality_check(pwq, password, NULL, NULL, &auxerror);
        if (r < 0) {
-               log_err(_("Password quality check failed:\n %s\n"),
+               log_err(_("Password quality check failed:\n %s"),
                        pwquality_strerror(NULL, 0, r, auxerror));
                r = -EPERM;
        } else {
@@ -58,28 +59,218 @@ static int tools_check_pwquality(const char *password)
        pwquality_free_settings(pwq);
        return r;
 }
-#else /* ENABLE_PWQUALITY */
+#elif defined ENABLE_PASSWDQC
+#include <passwdqc.h>
+
+static int tools_check_pwquality(const char *password)
+{
+       passwdqc_params_t params;
+       char *parse_reason;
+       const char *check_reason;
+       const char *config = PASSWDQC_CONFIG_FILE;
+
+       passwdqc_params_reset(&params);
+
+       if (*config && passwdqc_params_load(&params, &parse_reason, config)) {
+               log_err(_("Cannot check password quality: %s"),
+                       (parse_reason ? parse_reason : "Out of memory"));
+               free(parse_reason);
+               return -EINVAL;
+       }
+
+       check_reason = passwdqc_check(&params.qc, password, NULL, NULL);
+       if (check_reason) {
+               log_err(_("Password quality check failed: Bad passphrase (%s)"),
+                       check_reason);
+               return -EPERM;
+       }
+
+       return 0;
+}
+#else /* !(ENABLE_PWQUALITY || ENABLE_PASSWDQC) */
 static int tools_check_pwquality(const char *password)
 {
        return 0;
 }
-#endif /* ENABLE_PWQUALITY */
+#endif /* ENABLE_PWQUALITY || ENABLE_PASSWDQC */
+
+/* Password reading helpers */
+static int untimed_read(int fd, char *pass, size_t maxlen)
+{
+       ssize_t i;
+
+       i = read(fd, pass, maxlen);
+       if (i > 0) {
+               pass[i-1] = '\0';
+               i = 0;
+       } else if (i == 0) { /* EOF */
+               *pass = 0;
+               i = -1;
+       }
+       return i;
+}
+
+static int timed_read(int fd, char *pass, size_t maxlen, long timeout)
+{
+       struct timeval t;
+       fd_set fds = {}; /* Just to avoid scan-build false report for FD_SET */
+       int failed = -1;
+
+       FD_ZERO(&fds);
+       FD_SET(fd, &fds);
+       t.tv_sec = timeout;
+       t.tv_usec = 0;
 
+       if (select(fd+1, &fds, NULL, NULL, &t) > 0)
+               failed = untimed_read(fd, pass, maxlen);
+
+       return failed;
+}
+
+static int interactive_pass(const char *prompt, char *pass, size_t maxlen,
+               long timeout)
+{
+       struct termios orig, tmp;
+       int failed = -1;
+       int infd, outfd;
+
+       if (maxlen < 1)
+               return failed;
+
+       /* Read and write to /dev/tty if available */
+       infd = open("/dev/tty", O_RDWR);
+       if (infd == -1) {
+               infd = STDIN_FILENO;
+               outfd = STDERR_FILENO;
+       } else
+               outfd = infd;
+
+       if (tcgetattr(infd, &orig))
+               goto out_err;
+
+       memcpy(&tmp, &orig, sizeof(tmp));
+       tmp.c_lflag &= ~ECHO;
+
+       if (prompt && write(outfd, prompt, strlen(prompt)) < 0)
+               goto out_err;
+
+       tcsetattr(infd, TCSAFLUSH, &tmp);
+       if (timeout)
+               failed = timed_read(infd, pass, maxlen, timeout);
+       else
+               failed = untimed_read(infd, pass, maxlen);
+       tcsetattr(infd, TCSAFLUSH, &orig);
+
+out_err:
+       if (!failed && write(outfd, "\n", 1)) {};
+
+       if (infd != STDIN_FILENO)
+               close(infd);
+       return failed;
+}
+
+static int crypt_get_key_tty(const char *prompt,
+                            char **key, size_t *key_size,
+                            int timeout, int verify,
+                            struct crypt_device *cd)
+{
+       int key_size_max = DEFAULT_PASSPHRASE_SIZE_MAX;
+       int r = -EINVAL;
+       char *pass = NULL, *pass_verify = NULL;
+
+       *key = NULL;
+       *key_size = 0;
+
+       log_dbg("Interactive passphrase entry requested.");
+
+       pass = crypt_safe_alloc(key_size_max + 1);
+       if (!pass) {
+               log_err( _("Out of memory while reading passphrase."));
+               return -ENOMEM;
+       }
+
+       if (interactive_pass(prompt, pass, key_size_max, timeout)) {
+               log_err(_("Error reading passphrase from terminal."));
+               goto out_err;
+       }
+       pass[key_size_max] = '\0';
+
+       if (verify) {
+               pass_verify = crypt_safe_alloc(key_size_max);
+               if (!pass_verify) {
+                       log_err(_("Out of memory while reading passphrase."));
+                       r = -ENOMEM;
+                       goto out_err;
+               }
+
+               if (interactive_pass(_("Verify passphrase: "),
+                   pass_verify, key_size_max, timeout)) {
+                       log_err(_("Error reading passphrase from terminal."));
+                       goto out_err;
+               }
+
+               if (strncmp(pass, pass_verify, key_size_max)) {
+                       log_err(_("Passphrases do not match."));
+                       r = -EPERM;
+                       goto out_err;
+               }
+       }
+
+       *key = pass;
+       *key_size = strlen(pass);
+       r = 0;
+out_err:
+       crypt_safe_free(pass_verify);
+       if (r)
+               crypt_safe_free(pass);
+       return r;
+}
+
+/*
+ * Note: --key-file=- is interpreted as a read from a binary file (stdin)
+ * key_size_max == 0 means detect maximum according to input type (tty/file)
+ */
 int tools_get_key(const char *prompt,
                  char **key, size_t *key_size,
-                 size_t keyfile_offset, size_t keyfile_size_max,
+                 uint64_t keyfile_offset, size_t keyfile_size_max,
                  const char *key_file,
                  int timeout, int verify, int pwquality,
                  struct crypt_device *cd)
 {
-       int r, block;
+       char tmp[PATH_MAX], *backing_file;
+       int r = -EINVAL, block;
 
        block = tools_signals_blocked();
        if (block)
                set_int_block(0);
 
-       r = crypt_get_key(prompt, key, key_size, keyfile_offset,
-                         keyfile_size_max, key_file, timeout, verify, cd);
+       if (tools_is_stdin(key_file)) {
+               if (isatty(STDIN_FILENO)) {
+                       if (keyfile_offset) {
+                               log_err(_("Cannot use offset with terminal input."));
+                       } else {
+                               if (!prompt && !crypt_get_device_name(cd))
+                                       snprintf(tmp, sizeof(tmp), _("Enter passphrase: "));
+                               else if (!prompt) {
+                                       backing_file = crypt_loop_backing_file(crypt_get_device_name(cd));
+                                       snprintf(tmp, sizeof(tmp), _("Enter passphrase for %s: "), backing_file ?: crypt_get_device_name(cd));
+                                       free(backing_file);
+                               }
+                               r = crypt_get_key_tty(prompt ?: tmp, key, key_size, timeout, verify, cd);
+                       }
+               } else {
+                       log_dbg("STDIN descriptor passphrase entry requested.");
+                       /* No keyfile means STDIN with EOL handling (\n will end input)). */
+                       r = crypt_keyfile_device_read(cd, NULL, key, key_size,
+                                       keyfile_offset, keyfile_size_max,
+                                       key_file ? 0 : CRYPT_KEYFILE_STOP_EOL);
+               }
+       } else {
+               log_dbg("File descriptor passphrase entry requested.");
+               r = crypt_keyfile_device_read(cd, key_file, key, key_size,
+                                             keyfile_offset, keyfile_size_max, 0);
+       }
+
        if (block && !quit)
                set_int_block(1);
 
@@ -89,3 +280,60 @@ int tools_get_key(const char *prompt,
 
        return r;
 }
+
+void tools_passphrase_msg(int r)
+{
+       if (r == -EPERM)
+               log_err(_("No key available with this passphrase."));
+       else if (r == -ENOENT)
+               log_err(_("No usable keyslot is available."));
+}
+
+int tools_read_mk(const char *file, char **key, int keysize)
+{
+       int fd;
+
+       if (!keysize || !key)
+               return -EINVAL;
+
+       *key = crypt_safe_alloc(keysize);
+       if (!*key)
+               return -ENOMEM;
+
+       fd = open(file, O_RDONLY);
+       if (fd == -1) {
+               log_err(_("Cannot read keyfile %s."), file);
+               goto fail;
+       }
+
+       if (read_buffer(fd, *key, keysize) != keysize) {
+               log_err(_("Cannot read %d bytes from keyfile %s."), keysize, file);
+               close(fd);
+               goto fail;
+       }
+       close(fd);
+       return 0;
+fail:
+       crypt_safe_free(*key);
+       *key = NULL;
+       return -EINVAL;
+}
+
+int tools_write_mk(const char *file, const char *key, int keysize)
+{
+       int fd, r = -EINVAL;
+
+       fd = open(file, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR);
+       if (fd < 0) {
+               log_err(_("Cannot open keyfile %s for write."), file);
+               return r;
+       }
+
+       if (write_buffer(fd, key, keysize) == keysize)
+               r = 0;
+       else
+               log_err(_("Cannot write to keyfile %s."), file);
+
+       close(fd);
+       return r;
+}
index 23e4acb..47bcfe1 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * cryptsetup - setup cryptographic volumes for dm-crypt
  *
- * Copyright (C) 2004, Jana Saout <jana@saout.de>
- * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2014, Milan Broz
+ * Copyright (C) 2004 Jana Saout <jana@saout.de>
+ * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  */
 
 #include "cryptsetup.h"
+#include <math.h>
 #include <signal.h>
 
 int opt_verbose = 0;
 int opt_debug = 0;
+int opt_debug_json = 0;
 int opt_batch_mode = 0;
+int opt_progress_frequency = 0;
 
 /* interrupt handling */
 volatile int quit = 0;
@@ -74,29 +77,27 @@ void check_signal(int *r)
                *r = -EINTR;
 }
 
+#define LOG_MAX_LEN 4096
+
 __attribute__((format(printf, 5, 6)))
 void clogger(struct crypt_device *cd, int level, const char *file, int line,
             const char *format, ...)
 {
        va_list argp;
-       char *target = NULL;
+       char target[LOG_MAX_LEN + 2];
 
        va_start(argp, format);
 
-       if (vasprintf(&target, format, argp) > 0) {
-               if (level >= 0) {
-                       crypt_log(cd, level, target);
-#ifdef CRYPT_DEBUG
-               } else if (opt_debug)
-                       printf("# %s:%d %s\n", file ?: "?", line, target);
-#else
-               } else if (opt_debug)
-                       printf("# %s\n", target);
-#endif
+       if (vsnprintf(&target[0], LOG_MAX_LEN, format, argp) > 0) {
+               /* All verbose and error messages in tools end with EOL. */
+               if (level == CRYPT_LOG_VERBOSE || level == CRYPT_LOG_ERROR ||
+                   level == CRYPT_LOG_DEBUG || level == CRYPT_LOG_DEBUG_JSON)
+                       strncat(target, "\n", LOG_MAX_LEN);
+
+               crypt_log(cd, level, target);
        }
 
        va_end(argp);
-       free(target);
 }
 
 void tool_log(int level, const char *msg, void *usrptr __attribute__((unused)))
@@ -104,21 +105,19 @@ void tool_log(int level, const char *msg, void *usrptr __attribute__((unused)))
        switch(level) {
 
        case CRYPT_LOG_NORMAL:
-               fputs(msg, stdout);
+               fprintf(stdout, "%s", msg);
                break;
        case CRYPT_LOG_VERBOSE:
                if (opt_verbose)
-                       fputs(msg, stdout);
+                       fprintf(stdout, "%s", msg);
                break;
        case CRYPT_LOG_ERROR:
-               fputs(msg, stderr);
+               fprintf(stderr, "%s", msg);
                break;
+       case CRYPT_LOG_DEBUG_JSON:
        case CRYPT_LOG_DEBUG:
                if (opt_debug)
-                       printf("# %s\n", msg);
-               break;
-       default:
-               fprintf(stderr, "Internal error on logging class for msg: %s", msg);
+                       fprintf(stdout, "# %s", msg);
                break;
        }
 }
@@ -130,29 +129,33 @@ void quiet_log(int level, const char *msg, void *usrptr)
        tool_log(level, msg, usrptr);
 }
 
-int yesDialog(const char *msg, void *usrptr __attribute__((unused)))
+static int _dialog(const char *msg, void *usrptr, int default_answer)
 {
+       const char *fail_msg = (const char *)usrptr;
        char *answer = NULL;
        size_t size = 0;
-       int r = 1, block;
+       int r = default_answer, block;
 
        block = tools_signals_blocked();
        if (block)
                set_int_block(0);
 
-       if(isatty(STDIN_FILENO) && !opt_batch_mode) {
+       if (isatty(STDIN_FILENO) && !opt_batch_mode) {
                log_std("\nWARNING!\n========\n");
-               log_std("%s\n\nAre you sure? (Type uppercase yes): ", msg);
+               log_std("%s\n\nAre you sure? (Type 'yes' in capital letters): ", msg);
                fflush(stdout);
                if(getline(&answer, &size, stdin) == -1) {
                        r = 0;
                        /* Aborted by signal */
                        if (!quit)
-                               log_err(_("Error reading response from terminal.\n"));
+                               log_err(_("Error reading response from terminal."));
                        else
                                log_dbg("Query interrupted on signal.");
-               } else if(strcmp(answer, "YES\n"))
-                       r = 0;
+               } else {
+                       r = !strcmp(answer, "YES\n");
+                       if (!r && fail_msg)
+                               log_err("%s", fail_msg);
+               }
        }
 
        if (block && !quit)
@@ -162,9 +165,19 @@ int yesDialog(const char *msg, void *usrptr __attribute__((unused)))
        return r;
 }
 
+int yesDialog(const char *msg, void *usrptr)
+{
+       return _dialog(msg, usrptr, 1);
+}
+
+int noDialog(const char *msg, void *usrptr)
+{
+       return _dialog(msg, usrptr, 0);
+}
+
 void show_status(int errcode)
 {
-       char error[256];
+       char *crypt_error;
 
        if(!opt_verbose)
                return;
@@ -174,25 +187,23 @@ void show_status(int errcode)
                return;
        }
 
-       crypt_get_error(error, sizeof(error));
-
-       if (*error) {
-#ifdef STRERROR_R_CHAR_P /* GNU-specific strerror_r */
-               char *error_ = strerror_r(-errcode, error, sizeof(error));
-               if (error_ != error)
-                       strncpy(error, error_, sizeof(error));
-#else /* POSIX strerror_r variant */
-               if (strerror_r(-errcode, error, sizeof(error)))
-                       *error = '\0';
-#endif
-               error[sizeof(error) - 1] = '\0';
-       }
-
-       log_err(_("Command failed with code %i"), -errcode);
-       if (*error)
-               log_err(": %s\n", error);
+       if (errcode < 0)
+               errcode = translate_errno(errcode);
+
+       if (errcode == 1)
+               crypt_error = _("wrong or missing parameters");
+       else if (errcode == 2)
+               crypt_error = _("no permission or bad passphrase");
+       else if (errcode == 3)
+               crypt_error = _("out of memory");
+       else if (errcode == 4)
+               crypt_error = _("wrong device or file specified");
+       else if (errcode == 5)
+               crypt_error = _("device already exists or device is busy");
        else
-               log_err(".\n");
+               crypt_error = _("unknown error");
+
+       log_std(_("Command failed with code %i (%s).\n"), -errcode, crypt_error);
 }
 
 const char *uuid_or_device(const char *spec)
@@ -206,7 +217,7 @@ const char *uuid_or_device(const char *spec)
                strcpy(device, "/dev/disk/by-uuid/");
                ptr = &device[strlen(device)];
                i = uuid_len;
-               while ((s = spec[i++]) && i < PATH_MAX) {
+               while ((s = spec[i++]) && i < (PATH_MAX - 13)) {
                        if (!isxdigit(s) && s != '-')
                                return spec; /* Bail it out */
                        if (isalpha(s))
@@ -226,7 +237,7 @@ __attribute__ ((noreturn)) void usage(poptContext popt_context,
 {
        poptPrintUsage(popt_context, stderr, 0);
        if (error)
-               log_err("%s: %s\n", more, error);
+               log_err("%s: %s", more, error);
        poptFreeContext(popt_context);
        exit(exitcode);
 }
@@ -262,3 +273,361 @@ int translate_errno(int r)
        }
        return r;
 }
+
+void tools_keyslot_msg(int keyslot, crypt_object_op op)
+{
+       if (keyslot < 0)
+               return;
+
+       if (op == CREATED)
+               log_verbose(_("Key slot %i created."), keyslot);
+       else if (op == UNLOCKED)
+               log_verbose(_("Key slot %i unlocked."), keyslot);
+       else if (op == REMOVED)
+               log_verbose(_("Key slot %i removed."), keyslot);
+}
+
+void tools_token_msg(int token, crypt_object_op op)
+{
+       if (token < 0)
+               return;
+
+       if (op == CREATED)
+               log_verbose(_("Token %i created."), token);
+       else if (op == REMOVED)
+               log_verbose(_("Token %i removed."), token);
+}
+
+/*
+ * Device size string parsing, suffixes:
+ * s|S - 512 bytes sectors
+ * k  |K  |m  |M  |g  |G  |t  |T   - 1024 base
+ * kiB|KiB|miB|MiB|giB|GiB|tiB|TiB - 1024 base
+ * kb |KB |mM |MB |gB |GB |tB |TB  - 1000 base
+ */
+int tools_string_to_size(struct crypt_device *cd, const char *s, uint64_t *size)
+{
+       char *endp = NULL;
+       size_t len;
+       uint64_t mult_base, mult, tmp;
+
+       *size = strtoull(s, &endp, 10);
+       if (!isdigit(s[0]) ||
+           (errno == ERANGE && *size == ULLONG_MAX) ||
+           (errno != 0 && *size == 0))
+               return -EINVAL;
+
+       if (!endp || !*endp)
+               return 0;
+
+       len = strlen(endp);
+       /* Allow "B" and "iB" suffixes */
+       if (len > 3 ||
+          (len == 3 && (endp[1] != 'i' || endp[2] != 'B')) ||
+          (len == 2 && endp[1] != 'B'))
+               return -EINVAL;
+
+       if (len == 1 || len == 3)
+               mult_base = 1024;
+       else
+               mult_base = 1000;
+
+       mult = 1;
+       switch (endp[0]) {
+       case 's':
+       case 'S': mult = 512;
+               break;
+       case 't':
+       case 'T': mult *= mult_base;
+                /* Fall through */
+       case 'g':
+       case 'G': mult *= mult_base;
+                /* Fall through */
+       case 'm':
+       case 'M': mult *= mult_base;
+                /* Fall through */
+       case 'k':
+       case 'K': mult *= mult_base;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       tmp = *size * mult;
+       if (*size && (tmp / *size) != mult) {
+               log_dbg("Device size overflow.");
+               return -EINVAL;
+       }
+
+       *size = tmp;
+       return 0;
+}
+
+/* Time progress helper */
+
+/* The difference in seconds between two times in "timeval" format. */
+static double time_diff(struct timeval *start, struct timeval *end)
+{
+       return (end->tv_sec - start->tv_sec)
+               + (end->tv_usec - start->tv_usec) / 1E6;
+}
+
+void tools_clear_line(void)
+{
+       if (opt_progress_frequency)
+               return;
+       /* vt100 code clear line */
+       log_std("\33[2K\r");
+}
+
+static void tools_time_progress(uint64_t device_size, uint64_t bytes, uint64_t *start_bytes,
+                        struct timeval *start_time, struct timeval *end_time)
+{
+       struct timeval now_time;
+       unsigned long long mbytes, eta;
+       double tdiff, uib, frequency;
+       int final = (bytes == device_size);
+       const char *eol, *ustr = "";
+
+       if (opt_batch_mode)
+               return;
+
+       gettimeofday(&now_time, NULL);
+       if (start_time->tv_sec == 0 && start_time->tv_usec == 0) {
+               *start_time = now_time;
+               *end_time = now_time;
+               *start_bytes = bytes;
+               return;
+       }
+
+       if (opt_progress_frequency) {
+               frequency = (double)opt_progress_frequency;
+               eol = "\n";
+       } else {
+               frequency = 0.5;
+               eol = "";
+       }
+
+       if (!final && time_diff(end_time, &now_time) < frequency)
+               return;
+
+       *end_time = now_time;
+
+       tdiff = time_diff(start_time, end_time);
+       if (!tdiff)
+               return;
+
+       mbytes = bytes  / 1024 / 1024;
+       uib = (double)(bytes - *start_bytes) / tdiff;
+
+       /* FIXME: calculate this from last minute only. */
+       eta = (unsigned long long)(device_size / uib - tdiff);
+
+       if (uib > 1073741824.0f) {
+               uib /= 1073741824.0f;
+               ustr = "Gi";
+       } else if (uib > 1048576.0f) {
+               uib /= 1048576.0f;
+               ustr = "Mi";
+       } else if (uib > 1024.0f) {
+               uib /= 1024.0f;
+               ustr = "Ki";
+       }
+
+       tools_clear_line();
+       if (final)
+               log_std("Finished, time %02llu:%02llu.%03llu, "
+                       "%4llu MiB written, speed %5.1f %sB/s\n",
+                       (unsigned long long)tdiff / 60,
+                       (unsigned long long)tdiff % 60,
+                       (unsigned long long)((tdiff - floor(tdiff)) * 1000.0),
+                       mbytes, uib, ustr);
+       else
+               log_std("Progress: %5.1f%%, ETA %02llu:%02llu, "
+                       "%4llu MiB written, speed %5.1f %sB/s%s",
+                       (double)bytes / device_size * 100,
+                       eta / 60, eta % 60, mbytes, uib, ustr, eol);
+       fflush(stdout);
+}
+
+int tools_wipe_progress(uint64_t size, uint64_t offset, void *usrptr)
+{
+       static struct timeval start_time = {}, end_time = {};
+       static uint64_t start_offset = 0;
+       int r = 0;
+
+       tools_time_progress(size, offset, &start_offset, &start_time, &end_time);
+
+       check_signal(&r);
+       if (r) {
+               tools_clear_line();
+               log_err(_("\nWipe interrupted."));
+       }
+
+       return r;
+}
+
+static void report_partition(const char *value, const char *device)
+{
+       if (opt_batch_mode)
+               log_dbg("Device %s already contains a '%s' partition signature.", device, value);
+       else
+               log_std(_("WARNING: Device %s already contains a '%s' partition signature.\n"), device, value);
+}
+
+static void report_superblock(const char *value, const char *device)
+{
+       if (opt_batch_mode)
+               log_dbg("Device %s already contains a '%s' superblock signature.", device, value);
+       else
+               log_std(_("WARNING: Device %s already contains a '%s' superblock signature.\n"), device, value);
+}
+
+int tools_detect_signatures(const char *device, int ignore_luks, size_t *count)
+{
+       int r;
+       size_t tmp_count;
+       struct blkid_handle *h;
+       blk_probe_status pr;
+
+       if (!count)
+               count = &tmp_count;
+
+       *count = 0;
+
+       if (!blk_supported()) {
+               log_dbg("Blkid support disabled.");
+               return 0;
+       }
+
+       if ((r = blk_init_by_path(&h, device))) {
+               log_err(_("Failed to initialize device signature probes."));
+               return -EINVAL;
+       }
+
+       blk_set_chains_for_full_print(h);
+
+       if (ignore_luks && blk_superblocks_filter_luks(h)) {
+               r = -EINVAL;
+               goto out;
+       }
+
+       while ((pr = blk_probe(h)) < PRB_EMPTY) {
+               if (blk_is_partition(h))
+                       report_partition(blk_get_partition_type(h), device);
+               else if (blk_is_superblock(h))
+                       report_superblock(blk_get_superblock_type(h), device);
+               else {
+                       log_dbg("Internal tools_detect_signatures() error.");
+                       r = -EINVAL;
+                       goto out;
+               }
+               (*count)++;
+       }
+
+       if (pr == PRB_FAIL)
+               r = -EINVAL;
+out:
+       blk_free(h);
+       return r;
+}
+
+int tools_wipe_all_signatures(const char *path)
+{
+       int fd, flags, r;
+       blk_probe_status pr;
+       struct stat st;
+       struct blkid_handle *h = NULL;
+
+       if (!blk_supported()) {
+               log_dbg("Blkid support disabled.");
+               return 0;
+       }
+
+       if (stat(path, &st)) {
+               log_err(_("Failed to stat device %s."), path);
+               return -EINVAL;
+       }
+
+       flags = O_RDWR;
+       if (S_ISBLK(st.st_mode))
+               flags |= O_EXCL;
+
+       /* better than opening regular file with O_EXCL (undefined) */
+       /* coverity[toctou] */
+       fd = open(path, flags);
+       if (fd < 0) {
+               if (errno == EBUSY)
+                       log_err(_("Device %s is in use. Can not proceed with format operation."), path);
+               else
+                       log_err(_("Failed to open file %s in read/write mode."), path);
+               return -EINVAL;
+       }
+
+       if ((r = blk_init_by_fd(&h, fd))) {
+               log_err(_("Failed to initialize device signature probes."));
+               r = -EINVAL;
+               goto out;
+       }
+
+       blk_set_chains_for_wipes(h);
+
+       while ((pr = blk_probe(h)) < PRB_EMPTY) {
+               if (blk_is_partition(h))
+                       log_verbose(_("Existing '%s' partition signature (offset: %" PRIi64 " bytes) on device %s will be wiped."),
+                                   blk_get_partition_type(h), blk_get_offset(h), path);
+               if (blk_is_superblock(h))
+                       log_verbose(_("Existing '%s' superblock signature (offset: %" PRIi64 " bytes) on device %s will be wiped."),
+                                   blk_get_superblock_type(h), blk_get_offset(h), path);
+               if (blk_do_wipe(h)) {
+                       log_err(_("Failed to wipe device signature."));
+                       r = -EINVAL;
+                       goto out;
+               }
+       }
+
+       if (pr != PRB_EMPTY) {
+               log_err(_("Failed to probe device %s for a signature."), path);
+               r = -EINVAL;
+       }
+out:
+       close(fd);
+       blk_free(h);
+       return r;
+}
+
+int tools_is_cipher_null(const char *cipher)
+{
+       if (!cipher)
+               return 0;
+
+       return !strcmp(cipher, "cipher_null") ? 1 : 0;
+}
+
+/*
+ * Keyfile - is standard input treated as a binary file (no EOL handling).
+ */
+int tools_is_stdin(const char *key_file)
+{
+       if (!key_file)
+               return 1;
+
+       return strcmp(key_file, "-") ? 0 : 1;
+}
+
+int tools_reencrypt_progress(uint64_t size, uint64_t offset, void *usrptr)
+{
+       static struct timeval start_time = {}, end_time = {};
+       static uint64_t start_offset = 0;
+       int r = 0;
+
+       tools_time_progress(size, offset, &start_offset, &start_time, &end_time);
+
+       check_signal(&r);
+       if (r) {
+               tools_clear_line();
+               log_err(_("\nReencryption interrupted."));
+       }
+
+       return r;
+}
index 8f45be4..e29b75d 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * veritysetup - setup cryptographic volumes for dm-verity
  *
- * Copyright (C) 2012-2013, Red Hat, Inc. All rights reserved.
- * Copyright (C) 2012-2013, Milan Broz
+ * Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2012-2020 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -25,6 +25,8 @@
 
 static int use_superblock = 1;
 
+static const char *fec_device = NULL;
+static int fec_roots = DEFAULT_VERITY_FEC_ROOTS;
 static const char *hash_algorithm = NULL;
 static int hash_type = 1;
 static int data_block_size = DEFAULT_VERITY_DATA_BLOCK;
@@ -32,9 +34,13 @@ static int hash_block_size = DEFAULT_VERITY_HASH_BLOCK;
 static uint64_t data_blocks = 0;
 static const char *salt_string = NULL;
 static uint64_t hash_offset = 0;
+static uint64_t fec_offset = 0;
 static const char *opt_uuid = NULL;
-
-static int opt_version_mode = 0;
+static int opt_restart_on_corruption = 0;
+static int opt_ignore_corruption = 0;
+static int opt_ignore_zero_blocks = 0;
+static int opt_check_at_most_once = 0;
+static const char *opt_root_hash_signature = NULL;
 
 static const char **action_argv;
 static int action_argc;
@@ -48,6 +54,8 @@ static int _prepare_format(struct crypt_params_verity *params,
 
        params->hash_name = hash_algorithm ?: DEFAULT_VERITY_HASH;
        params->data_device = data_device;
+       params->fec_device = fec_device;
+       params->fec_roots = fec_roots;
 
        if (salt_string && !strcmp(salt_string, "-")) {
                params->salt_size = 0;
@@ -55,7 +63,7 @@ static int _prepare_format(struct crypt_params_verity *params,
        } else if (salt_string) {
                len = crypt_hex_to_bytes(salt_string, &salt, 0);
                if (len < 0) {
-                       log_err(_("Invalid salt string specified.\n"));
+                       log_err(_("Invalid salt string specified."));
                        return -EINVAL;
                }
                params->salt_size = len;
@@ -69,6 +77,7 @@ static int _prepare_format(struct crypt_params_verity *params,
        params->hash_block_size = hash_block_size;
        params->data_size = data_blocks;
        params->hash_area_offset = hash_offset;
+       params->fec_area_offset = fec_offset;
        params->hash_type = hash_type;
        params->flags = flags;
 
@@ -85,12 +94,23 @@ static int action_format(int arg)
        /* Try to create hash image if doesn't exist */
        r = open(action_argv[1], O_WRONLY | O_EXCL | O_CREAT, S_IRUSR | S_IWUSR);
        if (r < 0 && errno != EEXIST) {
-               log_err(_("Cannot create hash image %s for writing.\n"), action_argv[1]);
+               log_err(_("Cannot create hash image %s for writing."), action_argv[1]);
                return -EINVAL;
        } else if (r >= 0) {
                log_dbg("Created hash image %s.", action_argv[1]);
                close(r);
        }
+       /* Try to create FEC image if doesn't exist */
+       if (fec_device) {
+               r = open(fec_device, O_WRONLY | O_EXCL | O_CREAT, S_IRUSR | S_IWUSR);
+               if (r < 0 && errno != EEXIST) {
+                       log_err(_("Cannot create FEC image %s for writing."), fec_device);
+                       return -EINVAL;
+               } else if (r >= 0) {
+                       log_dbg("Created FEC image %s.", fec_device);
+                       close(r);
+               }
+       }
 
        if ((r = crypt_init(&cd, action_argv[1])))
                goto out;
@@ -122,14 +142,28 @@ static int _activate(const char *dm_device,
        uint32_t activate_flags = CRYPT_ACTIVATE_READONLY;
        char *root_hash_bytes = NULL;
        ssize_t hash_size;
-       int r;
+       struct stat st;
+       char *signature = NULL;
+       int signature_size = 0, r;
 
-       if ((r = crypt_init(&cd, hash_device)))
+       if ((r = crypt_init_data_device(&cd, hash_device, data_device)))
                goto out;
 
+       if (opt_ignore_corruption)
+               activate_flags |= CRYPT_ACTIVATE_IGNORE_CORRUPTION;
+       if (opt_restart_on_corruption)
+               activate_flags |= CRYPT_ACTIVATE_RESTART_ON_CORRUPTION;
+       if (opt_ignore_zero_blocks)
+               activate_flags |= CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS;
+       if (opt_check_at_most_once)
+               activate_flags |= CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE;
+
        if (use_superblock) {
                params.flags = flags;
                params.hash_area_offset = hash_offset;
+               params.fec_area_offset = fec_offset;
+               params.fec_device = fec_device;
+               params.fec_roots = fec_roots;
                r = crypt_load(cd, CRYPT_VERITY, &params);
        } else {
                r = _prepare_format(&params, data_device, flags | CRYPT_VERITY_NO_HEADER);
@@ -139,33 +173,48 @@ static int _activate(const char *dm_device,
        }
        if (r < 0)
                goto out;
-       r = crypt_set_data_device(cd, data_device);
-       if (r < 0)
-               goto out;
 
        hash_size = crypt_get_volume_key_size(cd);
        if (crypt_hex_to_bytes(root_hash, &root_hash_bytes, 0) != hash_size) {
-               log_err(_("Invalid root hash string specified.\n"));
+               log_err(_("Invalid root hash string specified."));
                r = -EINVAL;
                goto out;
        }
-       r = crypt_activate_by_volume_key(cd, dm_device,
+
+       if (opt_root_hash_signature) {
+               // FIXME: check max file size
+               if (stat(opt_root_hash_signature, &st) || !S_ISREG(st.st_mode) || !st.st_size) {
+                       log_err(_("Invalid signature file %s."), opt_root_hash_signature);
+                       r = -EINVAL;
+                       goto out;
+               }
+               signature_size = st.st_size;
+               r = tools_read_mk(opt_root_hash_signature, &signature, signature_size);
+               if (r < 0) {
+                       log_err(_("Cannot read signature file %s."), opt_root_hash_signature);
+                       goto out;
+               }
+       }
+       r = crypt_activate_by_signed_key(cd, dm_device,
                                         root_hash_bytes,
                                         hash_size,
+                                        signature, signature_size,
                                         activate_flags);
 out:
+       crypt_safe_free(signature);
        crypt_free(cd);
        free(root_hash_bytes);
        free(CONST_CAST(char*)params.salt);
        return r;
 }
 
-static int action_create(int arg)
+static int action_open(int arg)
 {
-       return _activate(action_argv[0],
-                        action_argv[1],
+       return _activate(action_argv[1],
+                        action_argv[0],
                         action_argv[2],
-                        action_argv[3], 0);
+                        action_argv[3],
+                        opt_root_hash_signature ? CRYPT_VERITY_ROOT_HASH_SIGNATURE : 0);
 }
 
 static int action_verify(int arg)
@@ -177,7 +226,7 @@ static int action_verify(int arg)
                         CRYPT_VERITY_CHECK_HASH);
 }
 
-static int action_remove(int arg)
+static int action_close(int arg)
 {
        struct crypt_device *cd = NULL;
        int r;
@@ -197,7 +246,8 @@ static int action_status(int arg)
        struct crypt_params_verity vp = {};
        struct crypt_device *cd = NULL;
        struct stat st;
-       char *backing_file;
+       char *backing_file, *root_hash;
+       size_t root_hash_size;
        unsigned i, path = 0;
        int r = 0;
 
@@ -227,22 +277,24 @@ static int action_status(int arg)
                                ci == CRYPT_BUSY ? " and is in use" : "");
 
                r = crypt_init_by_name_and_header(&cd, action_argv[0], NULL);
-               if (r < 0 || !crypt_get_type(cd))
+               if (r < 0)
                        goto out;
 
-               log_std("  type:        %s\n", crypt_get_type(cd));
+               log_std("  type:        %s\n", crypt_get_type(cd) ?: "n/a");
 
                r = crypt_get_active_device(cd, action_argv[0], &cad);
                if (r < 0)
                        goto out;
 
-               log_std("  status:      %s\n",
-                       cad.flags & CRYPT_ACTIVATE_CORRUPTED ? "corrupted" : "verified");
-
+               /* Print only VERITY type devices */
                r = crypt_get_verity_info(cd, &vp);
                if (r < 0)
                        goto out;
 
+               log_std("  status:      %s%s\n",
+                       cad.flags & CRYPT_ACTIVATE_CORRUPTED ? "corrupted" : "verified",
+                       vp.flags & CRYPT_VERITY_ROOT_HASH_SIGNATURE ? " (with signature)" : "");
+
                log_std("  hash type:   %u\n", vp.hash_type);
                log_std("  data block:  %u\n", vp.data_block_size);
                log_std("  hash block:  %u\n", vp.hash_block_size);
@@ -256,8 +308,7 @@ static int action_status(int arg)
                log_std("\n");
 
                log_std("  data device: %s\n", vp.data_device);
-               if (crypt_loop_device(vp.data_device)) {
-                       backing_file = crypt_loop_backing_file(vp.data_device);
+               if ((backing_file = crypt_loop_backing_file(vp.data_device))) {
                        log_std("  data loop:   %s\n", backing_file);
                        free(backing_file);
                }
@@ -266,13 +317,45 @@ static int action_status(int arg)
                                           "readonly" : "read/write");
 
                log_std("  hash device: %s\n", vp.hash_device);
-               if (crypt_loop_device(vp.hash_device)) {
-                       backing_file = crypt_loop_backing_file(vp.hash_device);
+               if ((backing_file = crypt_loop_backing_file(vp.hash_device))) {
                        log_std("  hash loop:   %s\n", backing_file);
                        free(backing_file);
                }
                log_std("  hash offset: %" PRIu64 " sectors\n",
                        vp.hash_area_offset * vp.hash_block_size / 512);
+
+               if (vp.fec_device) {
+                       log_std("  FEC device:  %s\n", vp.fec_device);
+                       if ((backing_file = crypt_loop_backing_file(vp.fec_device))) {
+                               log_std("  FEC loop:    %s\n", backing_file);
+                               free(backing_file);
+                       }
+                       log_std("  FEC offset:  %" PRIu64 " sectors\n",
+                               vp.fec_area_offset * vp.hash_block_size / 512);
+                       log_std("  FEC roots:   %u\n", vp.fec_roots);
+               }
+
+               root_hash_size = crypt_get_volume_key_size(cd);
+               if (root_hash_size > 0 && (root_hash = malloc(root_hash_size))) {
+                       r = crypt_volume_key_get(cd, CRYPT_ANY_SLOT, root_hash, &root_hash_size, NULL, 0);
+                       if (!r) {
+                               log_std("  root hash:   ");
+                               for (i = 0; i < root_hash_size; i++)
+                                       log_std("%02hhx", (const char)root_hash[i]);
+                               log_std("\n");
+                       }
+                       free(root_hash);
+               }
+
+               if (cad.flags & (CRYPT_ACTIVATE_IGNORE_CORRUPTION|
+                                CRYPT_ACTIVATE_RESTART_ON_CORRUPTION|
+                                CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS|
+                                CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE))
+                       log_std("  flags:       %s%s%s%s\n",
+                               (cad.flags & CRYPT_ACTIVATE_IGNORE_CORRUPTION) ? "ignore_corruption " : "",
+                               (cad.flags & CRYPT_ACTIVATE_RESTART_ON_CORRUPTION) ? "restart_on_corruption " : "",
+                               (cad.flags & CRYPT_ACTIVATE_IGNORE_ZERO_BLOCKS) ? "ignore_zero_blocks " : "",
+                               (cad.flags & CRYPT_ACTIVATE_CHECK_AT_MOST_ONCE) ? "check_at_most_once" : "");
        }
 out:
        crypt_free(cd);
@@ -291,6 +374,7 @@ static int action_dump(int arg)
                return r;
 
        params.hash_area_offset = hash_offset;
+       params.fec_area_offset = fec_offset;
        r = crypt_load(cd, CRYPT_VERITY, &params);
        if (!r)
                crypt_dump(cd);
@@ -307,8 +391,8 @@ static struct action_type {
 } action_types[] = {
        { "format",     action_format, 2, N_("<data_device> <hash_device>"),N_("format device") },
        { "verify",     action_verify, 3, N_("<data_device> <hash_device> <root_hash>"),N_("verify device") },
-       { "create",     action_create, 4, N_("<name> <data_device> <hash_device> <root_hash>"),N_("create active device") },
-       { "remove",     action_remove, 1, N_("<name>"),N_("remove (deactivate) device") },
+       { "open",       action_open,   4, N_("<data_device> <name> <hash_device> <root_hash>"),N_("open device as <name>") },
+       { "close",      action_close,  1, N_("<name>"),N_("close device (remove mapping)") },
        { "status",     action_status, 1, N_("<name>"),N_("show active device status") },
        { "dump",       action_dump,   1, N_("<hash_device>"),N_("show on-disk information") },
        { NULL, NULL, 0, NULL, NULL }
@@ -342,6 +426,11 @@ static void help(poptContext popt_context,
                        DEFAULT_VERITY_HASH, DEFAULT_VERITY_DATA_BLOCK,
                        DEFAULT_VERITY_HASH_BLOCK, DEFAULT_VERITY_SALT_SIZE,
                        1);
+               poptFreeContext(popt_context);
+               exit(EXIT_SUCCESS);
+       } else if (key->shortName == 'V') {
+               log_std("%s %s\n", PACKAGE_VERITY, PACKAGE_VERSION);
+               poptFreeContext(popt_context);
                exit(EXIT_SUCCESS);
        } else
                usage(popt_context, EXIT_SUCCESS, NULL, NULL);
@@ -367,22 +456,30 @@ int main(int argc, const char **argv)
                { NULL,    '\0', POPT_ARG_CALLBACK, help, 0, NULL,                         NULL },
                { "help",  '?',  POPT_ARG_NONE,     NULL, 0, N_("Show this help message"), NULL },
                { "usage", '\0', POPT_ARG_NONE,     NULL, 0, N_("Display brief usage"),    NULL },
+               { "version",'V', POPT_ARG_NONE,     NULL, 0, N_("Print package version"),  NULL },
                POPT_TABLEEND
        };
        static struct poptOption popt_options[] = {
                { NULL,              '\0', POPT_ARG_INCLUDE_TABLE, popt_help_options, 0, N_("Help options:"), NULL },
-               { "version",         '\0', POPT_ARG_NONE, &opt_version_mode, 0, N_("Print package version"), NULL },
                { "verbose",         'v',  POPT_ARG_NONE, &opt_verbose,      0, N_("Shows more detailed error messages"), NULL },
                { "debug",           '\0', POPT_ARG_NONE, &opt_debug,        0, N_("Show debug messages"), NULL },
                { "no-superblock",   0,    POPT_ARG_VAL,  &use_superblock,   0, N_("Do not use verity superblock"), NULL },
                { "format",          0,    POPT_ARG_INT,  &hash_type,        0, N_("Format type (1 - normal, 0 - original Chrome OS)"), N_("number") },
                { "data-block-size", 0,    POPT_ARG_INT,  &data_block_size,  0, N_("Block size on the data device"), N_("bytes") },
                { "hash-block-size", 0,    POPT_ARG_INT,  &hash_block_size,  0, N_("Block size on the hash device"), N_("bytes") },
+               { "fec-roots",       0,    POPT_ARG_INT,  &fec_roots,        0, N_("FEC parity bytes"), N_("bytes") },
                { "data-blocks",     0,    POPT_ARG_STRING, &popt_tmp,       1, N_("The number of blocks in the data file"), N_("blocks") },
+               { "fec-device",      0,    POPT_ARG_STRING, &fec_device,     0, N_("Path to device with error correction data"), N_("path") },
                { "hash-offset",     0,    POPT_ARG_STRING, &popt_tmp,       2, N_("Starting offset on the hash device"), N_("bytes") },
+               { "fec-offset",      0,    POPT_ARG_STRING, &popt_tmp,       3, N_("Starting offset on the FEC device"), N_("bytes") },
                { "hash",            'h',  POPT_ARG_STRING, &hash_algorithm, 0, N_("Hash algorithm"), N_("string") },
                { "salt",            's',  POPT_ARG_STRING, &salt_string,    0, N_("Salt"), N_("hex string") },
-               { "uuid",            '\0', POPT_ARG_STRING, &opt_uuid,       0, N_("UUID for device to use."), NULL },
+               { "uuid",            '\0', POPT_ARG_STRING, &opt_uuid,       0, N_("UUID for device to use"), NULL },
+               { "root-hash-signature",'\0', POPT_ARG_STRING, &opt_root_hash_signature,  0, N_("Path to root hash signature file"), NULL },
+               { "restart-on-corruption", 0,POPT_ARG_NONE,&opt_restart_on_corruption, 0, N_("Restart kernel if corruption is detected"), NULL },
+               { "ignore-corruption", 0,  POPT_ARG_NONE, &opt_ignore_corruption,  0, N_("Ignore corruption, log it only"), NULL },
+               { "ignore-zero-blocks", 0, POPT_ARG_NONE, &opt_ignore_zero_blocks, 0, N_("Do not verify zeroed blocks"), NULL },
+               { "check-at-most-once", 0, POPT_ARG_NONE, &opt_check_at_most_once, 0, N_("Verify data block only the first time it is read"), NULL },
                POPT_TABLEEND
        };
 
@@ -419,6 +516,9 @@ int main(int argc, const char **argv)
                        case 2:
                                hash_offset = ull_value;
                                break;
+                       case 3:
+                               fec_offset = ull_value;
+                               break;
                }
 
                if (r < 0)
@@ -429,21 +529,9 @@ int main(int argc, const char **argv)
                usage(popt_context, EXIT_FAILURE, poptStrerror(r),
                      poptBadOption(popt_context, POPT_BADOPTION_NOALIAS));
 
-       if (opt_version_mode) {
-               log_std("%s %s\n", PACKAGE_VERITY, PACKAGE_VERSION);
-               poptFreeContext(popt_context);
-               exit(EXIT_SUCCESS);
-       }
-
        if (!(aname = poptGetArg(popt_context)))
                usage(popt_context, EXIT_FAILURE, _("Argument <action> missing."),
                      poptGetInvocationName(popt_context));
-       for(action = action_types; action->type; action++)
-               if (strcmp(action->type, aname) == 0)
-                       break;
-       if (!action->type)
-               usage(popt_context, EXIT_FAILURE, _("Unknown action."),
-                     poptGetInvocationName(popt_context));
 
        action_argc = 0;
        action_argv = poptGetArgs(popt_context);
@@ -455,7 +543,28 @@ int main(int argc, const char **argv)
        while(action_argv[action_argc] != NULL)
                action_argc++;
 
-       if(action_argc < action->required_action_argc) {
+       /* Handle aliases */
+       if (!strcmp(aname, "create") && action_argc > 1) {
+               /* create command had historically switched arguments */
+               if (action_argv[0] && action_argv[1]) {
+                       const char *tmp = action_argv[0];
+                       action_argv[0] = action_argv[1];
+                       action_argv[1] = tmp;
+               }
+               aname = "open";
+       } else if (!strcmp(aname, "remove")) {
+               aname = "close";
+       }
+
+       for (action = action_types; action->type; action++)
+               if (strcmp(action->type, aname) == 0)
+                       break;
+
+       if (!action->type)
+               usage(popt_context, EXIT_FAILURE, _("Unknown action."),
+                     poptGetInvocationName(popt_context));
+
+       if (action_argc < action->required_action_argc) {
                char buf[128];
                snprintf(buf, 128,_("%s: requires %s as arguments"), action->type, action->arg_desc);
                usage(popt_context, EXIT_FAILURE, buf,
@@ -468,6 +577,21 @@ int main(int argc, const char **argv)
                      poptGetInvocationName(popt_context));
        }
 
+       if ((opt_ignore_corruption || opt_restart_on_corruption || opt_ignore_zero_blocks) && strcmp(aname, "open"))
+               usage(popt_context, EXIT_FAILURE,
+               _("Option --ignore-corruption, --restart-on-corruption or --ignore-zero-blocks is allowed only for open operation."),
+               poptGetInvocationName(popt_context));
+
+       if (opt_root_hash_signature && strcmp(aname, "open"))
+               usage(popt_context, EXIT_FAILURE,
+               _("Option --root-hash-signature can be used only for open operation."),
+               poptGetInvocationName(popt_context));
+
+       if (opt_ignore_corruption && opt_restart_on_corruption)
+               usage(popt_context, EXIT_FAILURE,
+               _("Option --ignore-corruption and --restart-on-corruption cannot be used together."),
+               poptGetInvocationName(popt_context));
+
        if (opt_debug) {
                opt_verbose = 1;
                crypt_set_debug_level(-1);
diff --git a/tests/00modules-test b/tests/00modules-test
new file mode 100755 (executable)
index 0000000..64e054a
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+
+function pversion() {
+       if [ ! -x $CRYPTSETUP_PATH/$1 ] ; then
+               return
+       fi
+
+       echo -n "$CRYPTSETUP_PATH/"
+       $CRYPTSETUP_PATH/$1 --version
+}
+
+echo "Cryptsetup test environment ($(date))"
+uname -a
+if [ "$(cat /proc/sys/crypto/fips_enabled 2>/dev/null)" = "1" ] ; then
+       echo "Kernel running in FIPS mode."
+fi
+
+if [ -f /etc/os-release ] ; then
+       source /etc/os-release
+       echo "$PRETTY_NAME ($NAME) $VERSION"
+fi
+
+echo "Memory"
+free -h
+
+pversion cryptsetup
+pversion veritysetup
+pversion integritysetup
+pversion cryptsetup-reencrypt
+
+[ $(id -u) != 0 ] && exit 77
+
+modprobe dm-crypt     >/dev/null 2>&1
+modprobe dm-verity    >/dev/null 2>&1
+modprobe dm-integrity >/dev/null 2>&1
+modprobe dm-zero      >/dev/null 2>&1
+
+dmsetup version
+
+echo "Device mapper targets:"
+dmsetup targets
+
+exit 0
index 862e0f0..5a7e21d 100644 (file)
-TESTS = api-test \
+TESTS = 00modules-test \
+       api-test \
+       api-test-2 \
        compat-test \
+       compat-test2 \
        loopaes-test \
        align-test \
+       align-test2 \
        discards-test \
        mode-test \
        password-hash-test \
        tcrypt-compat-test \
        luks1-compat-test \
-       device-test
+       device-test \
+       keyring-test \
+       keyring-compat-test \
+       luks2-validation-test \
+       luks2-integrity-test \
+       vectors-test \
+       blockwise-compat \
+       bitlk-compat-test
 
 if VERITYSETUP
 TESTS += verity-compat-test
 endif
 
 if REENCRYPT
-TESTS += reencryption-compat-test
+TESTS += reencryption-compat-test reencryption-compat-test2 luks2-reencryption-test
+endif
+
+if INTEGRITYSETUP
+TESTS += integrity-compat-test
 endif
 
-EXTRA_DIST = compatimage.img.bz2 compatv10image.img.bz2 \
-       img_fs_ext4.img.bz2 img_fs_vfat.img.bz2 img_fs_xfs.img.bz2 \
-       valid_header_file.bz2 \
-       evil_hdr-payload_overwrite.bz2 \
-       evil_hdr-stripes_payload_dmg.bz2 \
-       evil_hdr-luks_hdr_damage.bz2 \
-       evil_hdr-small_luks_device.bz2 \
-       tcrypt-images.tar.bz2 \
-       luks1-images.tar.bz2 \
-       compat-test loopaes-test align-test discards-test mode-test password-hash-test \
-       verity-compat-test \
+EXTRA_DIST = compatimage.img.xz compatv10image.img.xz \
+       compatimage2.img.xz \
+       conversion_imgs.tar.xz \
+       luks2_keyslot_unassigned.img.xz \
+       img_fs_ext4.img.xz img_fs_vfat.img.xz img_fs_xfs.img.xz \
+       valid_header_file.xz \
+       luks2_valid_hdr.img.xz \
+       luks2_header_requirements.xz \
+       luks2_header_requirements_free.xz \
+       luks2_mda_images.tar.xz \
+       evil_hdr-payload_overwrite.xz \
+       evil_hdr-stripes_payload_dmg.xz \
+       evil_hdr-luks_hdr_damage.xz \
+       evil_hdr-small_luks_device.xz \
+       evil_hdr-keyslot_overlap.xz \
+       tcrypt-images.tar.xz \
+       luks1-images.tar.xz \
+       00modules-test \
+       compat-test \
+       compat-test2 \
+       loopaes-test align-test discards-test mode-test password-hash-test \
+       align-test2 verity-compat-test \
        reencryption-compat-test \
+       reencryption-compat-test2 \
+       luks2-reencryption-test \
        tcrypt-compat-test \
        luks1-compat-test \
+       luks2-validation-test generators \
+       luks2-integrity-test \
        device-test \
-       cryptsetup-valg-supps valg.sh valg-api.sh
+       keyring-test \
+       keyring-compat-test \
+       integrity-compat-test \
+       cryptsetup-valg-supps valg.sh valg-api.sh \
+       blockwise-compat \
+       blkid-luks2-pv.img.xz \
+       Makefile.localtest \
+       bitlk-compat-test \
+       bitlk-images.tar.xz
 
-CLEANFILES = cryptsetup-tst* valglog*
+CLEANFILES = cryptsetup-tst* valglog* *-fail-*.log
 clean-local:
-       -rm -rf tcrypt-images luks1-images
+       -rm -rf tcrypt-images luks1-images luks2-images bitlk-images conversion_imgs luks2_valid_hdr.img blkid-luks2-pv-img blkid-luks2-pv-img.bcp
 
 differ_SOURCES = differ.c
 differ_CFLAGS = $(AM_CFLAGS) -Wall -O2
 
-api_test_SOURCES = api-test.c $(top_srcdir)/lib/utils_loop.c
-api_test_LDADD = ../lib/libcryptsetup.la
+api_test_SOURCES = api-test.c api_test.h test_utils.c
+api_test_LDADD = $(LDADD) ../libcryptsetup.la
 api_test_LDFLAGS = $(AM_LDFLAGS) -static
 api_test_CFLAGS = -g -Wall -O0 $(AM_CFLAGS) -I$(top_srcdir)/lib/ -I$(top_srcdir)/lib/luks1
 api_test_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
 
-check_PROGRAMS = api-test differ
+api_test_2_SOURCES = api-test-2.c api_test.h test_utils.c
+api_test_2_LDADD = $(LDADD) ../libcryptsetup.la
+api_test_2_LDFLAGS = $(AM_LDFLAGS) -static
+api_test_2_CFLAGS = -g -Wall -O0 $(AM_CFLAGS) -I$(top_srcdir)/lib/ -I$(top_srcdir)/lib/luks1
+api_test_2_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
+
+vectors_test_SOURCES = crypto-vectors.c
+vectors_test_LDADD = ../libcrypto_backend.la @CRYPTO_LIBS@ @LIBARGON2_LIBS@
+vectors_test_LDFLAGS = $(AM_LDFLAGS) -static
+vectors_test_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/lib/crypto_backend/ @CRYPTO_CFLAGS@
+vectors_test_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
+
+unit_utils_io_SOURCES = unit-utils-io.c
+unit_utils_io_LDADD = ../libutils_io.la
+unit_utils_io_LDFLAGS = $(AM_LDFLAGS) -static
+unit_utils_io_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/lib
+unit_utils_io_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
+
+check_PROGRAMS = api-test api-test-2 differ vectors-test unit-utils-io
+
+conversion_imgs:
+       @tar xJf conversion_imgs.tar.xz
 
 compatimage.img:
-       @bzip2 -k -d compatimage.img.bz2
+       @xz -k -d compatimage.img.xz
 
-valgrind-check: api-test differ
-       @VALG=1 ./compat-test
+valgrind-check: api-test api-test-2 differ
+       @VALG=1 ./compat-test2
+       @VALG=1 ./luks2-validation-test
+       @VALG=1 ./verity-compat-test
+       @VALG=1 ./integrity-compat-test
        @INFOSTRING="api-test-000" ./valg-api.sh ./api-test
+       @INFOSTRING="api-test-002" ./valg-api.sh ./api-test-2
+       @VALG=1 ./luks2-reencryption-test
+       @VALG=1 ./compat-test
 
 .PHONY: valgrind-check
index bdfc0c0..19c0000 100644 (file)
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.2 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+    false; \
+  elif test -n '$(MAKE_HOST)'; then \
+    true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+    true; \
+  else \
+    false; \
+  fi; \
+}
 am__make_running_with_option = \
   case $${target_option-} in \
       ?) ;; \
@@ -77,34 +87,39 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-TESTS = api-test$(EXEEXT) compat-test loopaes-test align-test \
+TESTS = 00modules-test api-test$(EXEEXT) api-test-2$(EXEEXT) \
+       compat-test compat-test2 loopaes-test align-test align-test2 \
        discards-test mode-test password-hash-test tcrypt-compat-test \
-       luks1-compat-test device-test $(am__append_1) $(am__append_2)
+       luks1-compat-test device-test keyring-test keyring-compat-test \
+       luks2-validation-test luks2-integrity-test \
+       vectors-test$(EXEEXT) blockwise-compat bitlk-compat-test \
+       $(am__append_1) $(am__append_2) $(am__append_3)
 @VERITYSETUP_TRUE@am__append_1 = verity-compat-test
-@REENCRYPT_TRUE@am__append_2 = reencryption-compat-test
-check_PROGRAMS = api-test$(EXEEXT) differ$(EXEEXT)
+@REENCRYPT_TRUE@am__append_2 = reencryption-compat-test reencryption-compat-test2 luks2-reencryption-test
+@INTEGRITYSETUP_TRUE@am__append_3 = integrity-compat-test
+check_PROGRAMS = api-test$(EXEEXT) api-test-2$(EXEEXT) differ$(EXEEXT) \
+       vectors-test$(EXEEXT) unit-utils-io$(EXEEXT)
 subdir = tests
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-       $(top_srcdir)/depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
-       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
-       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
-       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/configure.ac
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+       $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am_api_test_OBJECTS = api_test-api-test.$(OBJEXT) \
-       api_test-utils_loop.$(OBJEXT)
+       api_test-test_utils.$(OBJEXT)
 api_test_OBJECTS = $(am_api_test_OBJECTS)
-api_test_DEPENDENCIES = ../lib/libcryptsetup.la
+api_test_DEPENDENCIES = ../libcryptsetup.la
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -112,12 +127,31 @@ am__v_lt_1 =
 api_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(api_test_CFLAGS) \
        $(CFLAGS) $(api_test_LDFLAGS) $(LDFLAGS) -o $@
+am_api_test_2_OBJECTS = api_test_2-api-test-2.$(OBJEXT) \
+       api_test_2-test_utils.$(OBJEXT)
+api_test_2_OBJECTS = $(am_api_test_2_OBJECTS)
+api_test_2_DEPENDENCIES = ../libcryptsetup.la
+api_test_2_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(api_test_2_CFLAGS) \
+       $(CFLAGS) $(api_test_2_LDFLAGS) $(LDFLAGS) -o $@
 am_differ_OBJECTS = differ-differ.$(OBJEXT)
 differ_OBJECTS = $(am_differ_OBJECTS)
 differ_LDADD = $(LDADD)
 differ_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(differ_CFLAGS) $(CFLAGS) \
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_unit_utils_io_OBJECTS = unit_utils_io-unit-utils-io.$(OBJEXT)
+unit_utils_io_OBJECTS = $(am_unit_utils_io_OBJECTS)
+unit_utils_io_DEPENDENCIES = ../libutils_io.la
+unit_utils_io_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(unit_utils_io_CFLAGS) \
+       $(CFLAGS) $(unit_utils_io_LDFLAGS) $(LDFLAGS) -o $@
+am_vectors_test_OBJECTS = vectors_test-crypto-vectors.$(OBJEXT)
+vectors_test_OBJECTS = $(am_vectors_test_OBJECTS)
+vectors_test_DEPENDENCIES = ../libcrypto_backend.la
+vectors_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(vectors_test_CFLAGS) \
+       $(CFLAGS) $(vectors_test_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -132,7 +166,14 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/api_test-api-test.Po \
+       ./$(DEPDIR)/api_test-test_utils.Po \
+       ./$(DEPDIR)/api_test_2-api-test-2.Po \
+       ./$(DEPDIR)/api_test_2-test_utils.Po \
+       ./$(DEPDIR)/differ-differ.Po \
+       ./$(DEPDIR)/unit_utils_io-unit-utils-io.Po \
+       ./$(DEPDIR)/vectors_test-crypto-vectors.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -152,8 +193,11 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(api_test_SOURCES) $(differ_SOURCES)
-DIST_SOURCES = $(api_test_SOURCES) $(differ_SOURCES)
+SOURCES = $(api_test_SOURCES) $(api_test_2_SOURCES) $(differ_SOURCES) \
+       $(unit_utils_io_SOURCES) $(vectors_test_SOURCES)
+DIST_SOURCES = $(api_test_SOURCES) $(api_test_2_SOURCES) \
+       $(differ_SOURCES) $(unit_utils_io_SOURCES) \
+       $(vectors_test_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -200,6 +244,7 @@ am__tty_colors = { \
     std='\e[m'; \
   fi; \
 }
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -209,6 +254,8 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BLKID_CFLAGS = @BLKID_CFLAGS@
+BLKID_LIBS = @BLKID_LIBS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -218,6 +265,9 @@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
 CRYPTO_LIBS = @CRYPTO_LIBS@
 CRYPTO_STATIC_LIBS = @CRYPTO_STATIC_LIBS@
 CYGPATH_W = @CYGPATH_W@
+DEFAULT_LUKS2_LOCK_DIR_PERMS = @DEFAULT_LUKS2_LOCK_DIR_PERMS@
+DEFAULT_LUKS2_LOCK_PATH = @DEFAULT_LUKS2_LOCK_PATH@
+DEFAULT_TMPFILESDIR = @DEFAULT_TMPFILESDIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DEVMAPPER_CFLAGS = @DEVMAPPER_CFLAGS@
@@ -233,6 +283,7 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
 GMSGFMT = @GMSGFMT@
 GMSGFMT_015 = @GMSGFMT_015@
 GREP = @GREP@
@@ -243,8 +294,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+JSON_C_CFLAGS = @JSON_C_CFLAGS@
+JSON_C_LIBS = @JSON_C_LIBS@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
+LIBARGON2_CFLAGS = @LIBARGON2_CFLAGS@
+LIBARGON2_LIBS = @LIBARGON2_LIBS@
 LIBCRYPTSETUP_VERSION = @LIBCRYPTSETUP_VERSION@
 LIBCRYPTSETUP_VERSION_INFO = @LIBCRYPTSETUP_VERSION_INFO@
 LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
@@ -260,6 +315,7 @@ LN_S = @LN_S@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
@@ -285,6 +341,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
+PASSWDQC_LIBS = @PASSWDQC_LIBS@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
@@ -294,13 +351,6 @@ POSUB = @POSUB@
 PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
 PWQUALITY_LIBS = @PWQUALITY_LIBS@
 PWQUALITY_STATIC_LIBS = @PWQUALITY_STATIC_LIBS@
-PYTHON = @PYTHON@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-PYTHON_PLATFORM = @PYTHON_PLATFORM@
-PYTHON_PREFIX = @PYTHON_PREFIX@
-PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -311,6 +361,7 @@ UUID_LIBS = @UUID_LIBS@
 VERSION = @VERSION@
 XGETTEXT = @XGETTEXT@
 XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -352,46 +403,82 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
+systemd_tmpfilesdir = @systemd_tmpfilesdir@
 target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXTRA_DIST = compatimage.img.bz2 compatv10image.img.bz2 \
-       img_fs_ext4.img.bz2 img_fs_vfat.img.bz2 img_fs_xfs.img.bz2 \
-       valid_header_file.bz2 \
-       evil_hdr-payload_overwrite.bz2 \
-       evil_hdr-stripes_payload_dmg.bz2 \
-       evil_hdr-luks_hdr_damage.bz2 \
-       evil_hdr-small_luks_device.bz2 \
-       tcrypt-images.tar.bz2 \
-       luks1-images.tar.bz2 \
-       compat-test loopaes-test align-test discards-test mode-test password-hash-test \
-       verity-compat-test \
+EXTRA_DIST = compatimage.img.xz compatv10image.img.xz \
+       compatimage2.img.xz \
+       conversion_imgs.tar.xz \
+       luks2_keyslot_unassigned.img.xz \
+       img_fs_ext4.img.xz img_fs_vfat.img.xz img_fs_xfs.img.xz \
+       valid_header_file.xz \
+       luks2_valid_hdr.img.xz \
+       luks2_header_requirements.xz \
+       luks2_header_requirements_free.xz \
+       luks2_mda_images.tar.xz \
+       evil_hdr-payload_overwrite.xz \
+       evil_hdr-stripes_payload_dmg.xz \
+       evil_hdr-luks_hdr_damage.xz \
+       evil_hdr-small_luks_device.xz \
+       evil_hdr-keyslot_overlap.xz \
+       tcrypt-images.tar.xz \
+       luks1-images.tar.xz \
+       00modules-test \
+       compat-test \
+       compat-test2 \
+       loopaes-test align-test discards-test mode-test password-hash-test \
+       align-test2 verity-compat-test \
        reencryption-compat-test \
+       reencryption-compat-test2 \
+       luks2-reencryption-test \
        tcrypt-compat-test \
        luks1-compat-test \
+       luks2-validation-test generators \
+       luks2-integrity-test \
        device-test \
-       cryptsetup-valg-supps valg.sh valg-api.sh
-
-CLEANFILES = cryptsetup-tst* valglog*
+       keyring-test \
+       keyring-compat-test \
+       integrity-compat-test \
+       cryptsetup-valg-supps valg.sh valg-api.sh \
+       blockwise-compat \
+       blkid-luks2-pv.img.xz \
+       Makefile.localtest \
+       bitlk-compat-test \
+       bitlk-images.tar.xz
+
+CLEANFILES = cryptsetup-tst* valglog* *-fail-*.log
 differ_SOURCES = differ.c
 differ_CFLAGS = $(AM_CFLAGS) -Wall -O2
-api_test_SOURCES = api-test.c $(top_srcdir)/lib/utils_loop.c
-api_test_LDADD = ../lib/libcryptsetup.la
+api_test_SOURCES = api-test.c api_test.h test_utils.c
+api_test_LDADD = $(LDADD) ../libcryptsetup.la
 api_test_LDFLAGS = $(AM_LDFLAGS) -static
 api_test_CFLAGS = -g -Wall -O0 $(AM_CFLAGS) -I$(top_srcdir)/lib/ -I$(top_srcdir)/lib/luks1
 api_test_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
+api_test_2_SOURCES = api-test-2.c api_test.h test_utils.c
+api_test_2_LDADD = $(LDADD) ../libcryptsetup.la
+api_test_2_LDFLAGS = $(AM_LDFLAGS) -static
+api_test_2_CFLAGS = -g -Wall -O0 $(AM_CFLAGS) -I$(top_srcdir)/lib/ -I$(top_srcdir)/lib/luks1
+api_test_2_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
+vectors_test_SOURCES = crypto-vectors.c
+vectors_test_LDADD = ../libcrypto_backend.la @CRYPTO_LIBS@ @LIBARGON2_LIBS@
+vectors_test_LDFLAGS = $(AM_LDFLAGS) -static
+vectors_test_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/lib/crypto_backend/ @CRYPTO_CFLAGS@
+vectors_test_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
+unit_utils_io_SOURCES = unit-utils-io.c
+unit_utils_io_LDADD = ../libutils_io.la
+unit_utils_io_LDFLAGS = $(AM_LDFLAGS) -static
+unit_utils_io_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/lib
+unit_utils_io_CPPFLAGS = $(AM_CPPFLAGS) -include config.h
 all: all-am
 
 .SUFFIXES:
@@ -408,14 +495,13 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
        $(am__cd) $(top_srcdir) && \
          $(AUTOMAKE) --gnu tests/Makefile
-.PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        @case '$?' in \
          *config.status*) \
            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
          *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
        esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -440,37 +526,62 @@ api-test$(EXEEXT): $(api_test_OBJECTS) $(api_test_DEPENDENCIES) $(EXTRA_api_test
        @rm -f api-test$(EXEEXT)
        $(AM_V_CCLD)$(api_test_LINK) $(api_test_OBJECTS) $(api_test_LDADD) $(LIBS)
 
+api-test-2$(EXEEXT): $(api_test_2_OBJECTS) $(api_test_2_DEPENDENCIES) $(EXTRA_api_test_2_DEPENDENCIES) 
+       @rm -f api-test-2$(EXEEXT)
+       $(AM_V_CCLD)$(api_test_2_LINK) $(api_test_2_OBJECTS) $(api_test_2_LDADD) $(LIBS)
+
 differ$(EXEEXT): $(differ_OBJECTS) $(differ_DEPENDENCIES) $(EXTRA_differ_DEPENDENCIES) 
        @rm -f differ$(EXEEXT)
        $(AM_V_CCLD)$(differ_LINK) $(differ_OBJECTS) $(differ_LDADD) $(LIBS)
 
+unit-utils-io$(EXEEXT): $(unit_utils_io_OBJECTS) $(unit_utils_io_DEPENDENCIES) $(EXTRA_unit_utils_io_DEPENDENCIES) 
+       @rm -f unit-utils-io$(EXEEXT)
+       $(AM_V_CCLD)$(unit_utils_io_LINK) $(unit_utils_io_OBJECTS) $(unit_utils_io_LDADD) $(LIBS)
+
+vectors-test$(EXEEXT): $(vectors_test_OBJECTS) $(vectors_test_DEPENDENCIES) $(EXTRA_vectors_test_DEPENDENCIES) 
+       @rm -f vectors-test$(EXEEXT)
+       $(AM_V_CCLD)$(vectors_test_LINK) $(vectors_test_OBJECTS) $(vectors_test_LDADD) $(LIBS)
+
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
 
 distclean-compile:
        -rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/api_test-api-test.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/api_test-utils_loop.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/differ-differ.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/api_test-api-test.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/api_test-test_utils.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/api_test_2-api-test-2.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/api_test_2-test_utils.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/differ-differ.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit_utils_io-unit-utils-io.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vectors_test-crypto-vectors.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+       @$(MKDIR_P) $(@D)
+       @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
 .c.obj:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Po
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.lo:
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@   $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@   $(am__mv) $$depbase.Tpo $$depbase.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
@@ -489,19 +600,47 @@ api_test-api-test.obj: api-test.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -c -o api_test-api-test.obj `if test -f 'api-test.c'; then $(CYGPATH_W) 'api-test.c'; else $(CYGPATH_W) '$(srcdir)/api-test.c'; fi`
 
-api_test-utils_loop.o: $(top_srcdir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -MT api_test-utils_loop.o -MD -MP -MF $(DEPDIR)/api_test-utils_loop.Tpo -c -o api_test-utils_loop.o `test -f '$(top_srcdir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test-utils_loop.Tpo $(DEPDIR)/api_test-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_srcdir)/lib/utils_loop.c' object='api_test-utils_loop.o' libtool=no @AMDEPBACKSLASH@
+api_test-test_utils.o: test_utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -MT api_test-test_utils.o -MD -MP -MF $(DEPDIR)/api_test-test_utils.Tpo -c -o api_test-test_utils.o `test -f 'test_utils.c' || echo '$(srcdir)/'`test_utils.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test-test_utils.Tpo $(DEPDIR)/api_test-test_utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='test_utils.c' object='api_test-test_utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -c -o api_test-test_utils.o `test -f 'test_utils.c' || echo '$(srcdir)/'`test_utils.c
+
+api_test-test_utils.obj: test_utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -MT api_test-test_utils.obj -MD -MP -MF $(DEPDIR)/api_test-test_utils.Tpo -c -o api_test-test_utils.obj `if test -f 'test_utils.c'; then $(CYGPATH_W) 'test_utils.c'; else $(CYGPATH_W) '$(srcdir)/test_utils.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test-test_utils.Tpo $(DEPDIR)/api_test-test_utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='test_utils.c' object='api_test-test_utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -c -o api_test-test_utils.obj `if test -f 'test_utils.c'; then $(CYGPATH_W) 'test_utils.c'; else $(CYGPATH_W) '$(srcdir)/test_utils.c'; fi`
+
+api_test_2-api-test-2.o: api-test-2.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -MT api_test_2-api-test-2.o -MD -MP -MF $(DEPDIR)/api_test_2-api-test-2.Tpo -c -o api_test_2-api-test-2.o `test -f 'api-test-2.c' || echo '$(srcdir)/'`api-test-2.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test_2-api-test-2.Tpo $(DEPDIR)/api_test_2-api-test-2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='api-test-2.c' object='api_test_2-api-test-2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -c -o api_test_2-api-test-2.o `test -f 'api-test-2.c' || echo '$(srcdir)/'`api-test-2.c
+
+api_test_2-api-test-2.obj: api-test-2.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -MT api_test_2-api-test-2.obj -MD -MP -MF $(DEPDIR)/api_test_2-api-test-2.Tpo -c -o api_test_2-api-test-2.obj `if test -f 'api-test-2.c'; then $(CYGPATH_W) 'api-test-2.c'; else $(CYGPATH_W) '$(srcdir)/api-test-2.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test_2-api-test-2.Tpo $(DEPDIR)/api_test_2-api-test-2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='api-test-2.c' object='api_test_2-api-test-2.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -c -o api_test-utils_loop.o `test -f '$(top_srcdir)/lib/utils_loop.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/utils_loop.c
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -c -o api_test_2-api-test-2.obj `if test -f 'api-test-2.c'; then $(CYGPATH_W) 'api-test-2.c'; else $(CYGPATH_W) '$(srcdir)/api-test-2.c'; fi`
 
-api_test-utils_loop.obj: $(top_srcdir)/lib/utils_loop.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -MT api_test-utils_loop.obj -MD -MP -MF $(DEPDIR)/api_test-utils_loop.Tpo -c -o api_test-utils_loop.obj `if test -f '$(top_srcdir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/utils_loop.c'; fi`
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test-utils_loop.Tpo $(DEPDIR)/api_test-utils_loop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='$(top_srcdir)/lib/utils_loop.c' object='api_test-utils_loop.obj' libtool=no @AMDEPBACKSLASH@
+api_test_2-test_utils.o: test_utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -MT api_test_2-test_utils.o -MD -MP -MF $(DEPDIR)/api_test_2-test_utils.Tpo -c -o api_test_2-test_utils.o `test -f 'test_utils.c' || echo '$(srcdir)/'`test_utils.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test_2-test_utils.Tpo $(DEPDIR)/api_test_2-test_utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='test_utils.c' object='api_test_2-test_utils.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_CPPFLAGS) $(CPPFLAGS) $(api_test_CFLAGS) $(CFLAGS) -c -o api_test-utils_loop.obj `if test -f '$(top_srcdir)/lib/utils_loop.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/utils_loop.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/utils_loop.c'; fi`
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -c -o api_test_2-test_utils.o `test -f 'test_utils.c' || echo '$(srcdir)/'`test_utils.c
+
+api_test_2-test_utils.obj: test_utils.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -MT api_test_2-test_utils.obj -MD -MP -MF $(DEPDIR)/api_test_2-test_utils.Tpo -c -o api_test_2-test_utils.obj `if test -f 'test_utils.c'; then $(CYGPATH_W) 'test_utils.c'; else $(CYGPATH_W) '$(srcdir)/test_utils.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/api_test_2-test_utils.Tpo $(DEPDIR)/api_test_2-test_utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='test_utils.c' object='api_test_2-test_utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(api_test_2_CPPFLAGS) $(CPPFLAGS) $(api_test_2_CFLAGS) $(CFLAGS) -c -o api_test_2-test_utils.obj `if test -f 'test_utils.c'; then $(CYGPATH_W) 'test_utils.c'; else $(CYGPATH_W) '$(srcdir)/test_utils.c'; fi`
 
 differ-differ.o: differ.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(differ_CFLAGS) $(CFLAGS) -MT differ-differ.o -MD -MP -MF $(DEPDIR)/differ-differ.Tpo -c -o differ-differ.o `test -f 'differ.c' || echo '$(srcdir)/'`differ.c
@@ -517,6 +656,34 @@ differ-differ.obj: differ.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(differ_CFLAGS) $(CFLAGS) -c -o differ-differ.obj `if test -f 'differ.c'; then $(CYGPATH_W) 'differ.c'; else $(CYGPATH_W) '$(srcdir)/differ.c'; fi`
 
+unit_utils_io-unit-utils-io.o: unit-utils-io.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(unit_utils_io_CPPFLAGS) $(CPPFLAGS) $(unit_utils_io_CFLAGS) $(CFLAGS) -MT unit_utils_io-unit-utils-io.o -MD -MP -MF $(DEPDIR)/unit_utils_io-unit-utils-io.Tpo -c -o unit_utils_io-unit-utils-io.o `test -f 'unit-utils-io.c' || echo '$(srcdir)/'`unit-utils-io.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/unit_utils_io-unit-utils-io.Tpo $(DEPDIR)/unit_utils_io-unit-utils-io.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='unit-utils-io.c' object='unit_utils_io-unit-utils-io.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(unit_utils_io_CPPFLAGS) $(CPPFLAGS) $(unit_utils_io_CFLAGS) $(CFLAGS) -c -o unit_utils_io-unit-utils-io.o `test -f 'unit-utils-io.c' || echo '$(srcdir)/'`unit-utils-io.c
+
+unit_utils_io-unit-utils-io.obj: unit-utils-io.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(unit_utils_io_CPPFLAGS) $(CPPFLAGS) $(unit_utils_io_CFLAGS) $(CFLAGS) -MT unit_utils_io-unit-utils-io.obj -MD -MP -MF $(DEPDIR)/unit_utils_io-unit-utils-io.Tpo -c -o unit_utils_io-unit-utils-io.obj `if test -f 'unit-utils-io.c'; then $(CYGPATH_W) 'unit-utils-io.c'; else $(CYGPATH_W) '$(srcdir)/unit-utils-io.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/unit_utils_io-unit-utils-io.Tpo $(DEPDIR)/unit_utils_io-unit-utils-io.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='unit-utils-io.c' object='unit_utils_io-unit-utils-io.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(unit_utils_io_CPPFLAGS) $(CPPFLAGS) $(unit_utils_io_CFLAGS) $(CFLAGS) -c -o unit_utils_io-unit-utils-io.obj `if test -f 'unit-utils-io.c'; then $(CYGPATH_W) 'unit-utils-io.c'; else $(CYGPATH_W) '$(srcdir)/unit-utils-io.c'; fi`
+
+vectors_test-crypto-vectors.o: crypto-vectors.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vectors_test_CPPFLAGS) $(CPPFLAGS) $(vectors_test_CFLAGS) $(CFLAGS) -MT vectors_test-crypto-vectors.o -MD -MP -MF $(DEPDIR)/vectors_test-crypto-vectors.Tpo -c -o vectors_test-crypto-vectors.o `test -f 'crypto-vectors.c' || echo '$(srcdir)/'`crypto-vectors.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/vectors_test-crypto-vectors.Tpo $(DEPDIR)/vectors_test-crypto-vectors.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto-vectors.c' object='vectors_test-crypto-vectors.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vectors_test_CPPFLAGS) $(CPPFLAGS) $(vectors_test_CFLAGS) $(CFLAGS) -c -o vectors_test-crypto-vectors.o `test -f 'crypto-vectors.c' || echo '$(srcdir)/'`crypto-vectors.c
+
+vectors_test-crypto-vectors.obj: crypto-vectors.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vectors_test_CPPFLAGS) $(CPPFLAGS) $(vectors_test_CFLAGS) $(CFLAGS) -MT vectors_test-crypto-vectors.obj -MD -MP -MF $(DEPDIR)/vectors_test-crypto-vectors.Tpo -c -o vectors_test-crypto-vectors.obj `if test -f 'crypto-vectors.c'; then $(CYGPATH_W) 'crypto-vectors.c'; else $(CYGPATH_W) '$(srcdir)/crypto-vectors.c'; fi`
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/vectors_test-crypto-vectors.Tpo $(DEPDIR)/vectors_test-crypto-vectors.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='crypto-vectors.c' object='vectors_test-crypto-vectors.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(vectors_test_CPPFLAGS) $(CPPFLAGS) $(vectors_test_CFLAGS) $(CFLAGS) -c -o vectors_test-crypto-vectors.obj `if test -f 'crypto-vectors.c'; then $(CYGPATH_W) 'crypto-vectors.c'; else $(CYGPATH_W) '$(srcdir)/crypto-vectors.c'; fi`
+
 mostlyclean-libtool:
        -rm -f *.lo
 
@@ -668,7 +835,10 @@ check-TESTS: $(TESTS)
          test "$$failed" -eq 0; \
        else :; fi
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
        list='$(DISTFILES)'; \
@@ -741,7 +911,13 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
        mostlyclean-am
 
 distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
+               -rm -f ./$(DEPDIR)/api_test-api-test.Po
+       -rm -f ./$(DEPDIR)/api_test-test_utils.Po
+       -rm -f ./$(DEPDIR)/api_test_2-api-test-2.Po
+       -rm -f ./$(DEPDIR)/api_test_2-test_utils.Po
+       -rm -f ./$(DEPDIR)/differ-differ.Po
+       -rm -f ./$(DEPDIR)/unit_utils_io-unit-utils-io.Po
+       -rm -f ./$(DEPDIR)/vectors_test-crypto-vectors.Po
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-tags
@@ -787,7 +963,13 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
+               -rm -f ./$(DEPDIR)/api_test-api-test.Po
+       -rm -f ./$(DEPDIR)/api_test-test_utils.Po
+       -rm -f ./$(DEPDIR)/api_test_2-api-test-2.Po
+       -rm -f ./$(DEPDIR)/api_test_2-test_utils.Po
+       -rm -f ./$(DEPDIR)/differ-differ.Po
+       -rm -f ./$(DEPDIR)/unit_utils_io-unit-utils-io.Po
+       -rm -f ./$(DEPDIR)/vectors_test-crypto-vectors.Po
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -808,29 +990,40 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-       clean-checkPROGRAMS clean-generic clean-libtool clean-local \
-       cscopelist-am ctags ctags-am distclean distclean-compile \
-       distclean-generic distclean-libtool distclean-tags distdir dvi \
-       dvi-am html html-am info info-am install install-am \
-       install-data install-data-am install-dvi install-dvi-am \
-       install-exec install-exec-am install-html install-html-am \
-       install-info install-info-am install-man install-pdf \
-       install-pdf-am install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-am uninstall uninstall-am
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+       check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+       clean-local cscopelist-am ctags ctags-am distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am install-man \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
 
 clean-local:
-       -rm -rf tcrypt-images luks1-images
+       -rm -rf tcrypt-images luks1-images luks2-images bitlk-images conversion_imgs luks2_valid_hdr.img blkid-luks2-pv-img blkid-luks2-pv-img.bcp
+
+conversion_imgs:
+       @tar xJf conversion_imgs.tar.xz
 
 compatimage.img:
-       @bzip2 -k -d compatimage.img.bz2
+       @xz -k -d compatimage.img.xz
 
-valgrind-check: api-test differ
-       @VALG=1 ./compat-test
+valgrind-check: api-test api-test-2 differ
+       @VALG=1 ./compat-test2
+       @VALG=1 ./luks2-validation-test
+       @VALG=1 ./verity-compat-test
+       @VALG=1 ./integrity-compat-test
        @INFOSTRING="api-test-000" ./valg-api.sh ./api-test
+       @INFOSTRING="api-test-002" ./valg-api.sh ./api-test-2
+       @VALG=1 ./luks2-reencryption-test
+       @VALG=1 ./compat-test
 
 .PHONY: valgrind-check
 
diff --git a/tests/Makefile.localtest b/tests/Makefile.localtest
new file mode 100644 (file)
index 0000000..29a62f3
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# Makefile to run tests with system binaries
+# USE: make -f Makefile.localtest tests CRYPTSETUP_PATH=/sbin
+#
+CPPFLAGS=-I../lib/ -I../lib/luks1 -DHAVE_DECL_DM_TASK_RETRY_REMOVE -DKERNEL_KEYRING -DHAVE_SYS_SYSMACROS_H -DNO_CRYPTSETUP_PATH
+CFLAGS=-O2 -g -Wall
+LDLIBS=-lcryptsetup -ldevmapper
+TESTS=$(wildcard *-test *-test2) api-test api-test-2
+
+differ: differ.o
+       $(CC) -o $@ $^
+
+api-test: api-test.o test_utils.o
+       $(CC) -o $@ $^ $(LDLIBS)
+
+api-test-2: api-test-2.o test_utils.o
+       $(CC) -o $@ $^ $(LDLIBS)
+
+tests: differ $(TESTS)
+       @for test in $(sort $(TESTS)); do \
+               echo [$$test]; \
+               ./$$test; \
+               [ $$? -ne 77 -a $$? -ne 0 ] && exit 1; \
+               true; \
+       done;
+
+clean:
+       rm -f *.o differ api-test api-test-2
+
+.PHONY: clean
index c6de95d..ac3af88 100755 (executable)
@@ -1,11 +1,14 @@
 #!/bin/bash
 
-CRYPTSETUP="../src/cryptsetup"
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 DEV=""
 DEV_STACKED="luks0xbabe"
+DEV_NAME="dummyalign"
 MNT_DIR="./mnt_luks"
 PWD1="93R4P4pIqAH8"
 PWD2="mymJeD8ivEhE"
+FAST_PBKDF="--pbkdf-force-iterations 1000"
 
 cleanup() {
        udevadm settle >/dev/null 2>&1
@@ -13,14 +16,19 @@ cleanup() {
            umount -f $MNT_DIR 2>/dev/null
            rmdir $MNT_DIR 2>/dev/null
        fi
-       [ -b /dev/mapper/$DEV_STACKED ] && dmsetup remove $DEV_STACKED >/dev/null 2>&1
+       [ -b /dev/mapper/$DEV_STACKED ] && dmsetup remove --retry $DEV_STACKED >/dev/null 2>&1
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME >/dev/null 2>&1
+       # FIXME scsi_debug sometimes in-use here
+       sleep 1
        rmmod scsi_debug 2>/dev/null
-       sleep 2
+       sleep 1
 }
 
 fail()
 {
-       if [ -n "$1" ] ; then echo "FAIL $1" ; else echo "FAIL" ; fi
+       if [ -n "$1" ] ; then echo "FAIL $1" ; fi
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        cleanup
        exit 100
 }
@@ -32,11 +40,34 @@ skip()
        exit 0
 }
 
+function dm_crypt_features()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+       VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
+
+       [ $VER_MAJ -lt 1 ] && return
+       [ $VER_MAJ -gt 1 ] && {
+               DM_PERF_CPU=1
+               DM_SECTOR_SIZE=1
+               return
+       }
+
+       [ $VER_MIN -lt 14 ] && return
+       DM_PERF_CPU=1
+       if [ $VER_MIN -ge 17 -o \( $VER_MIN -eq 14 -a $VER_PTC -ge 5 \) ]; then
+               DM_SECTOR_SIZE=1
+       fi
+}
+
 add_device() {
-       modprobe scsi_debug $@
+       modprobe scsi_debug $@ delay=0
        if [ $? -ne 0 ] ; then
                echo "This kernel seems to not support proper scsi_debug module, test skipped."
-               exit 0
+               exit 77
        fi
 
        sleep 2
@@ -45,7 +76,7 @@ add_device() {
        if [ ! -e /sys/block/$DEV/alignment_offset ] ; then
                echo "This kernel seems to not support topology info, test skipped."
                cleanup
-               exit 0
+               exit 77
        fi
 
        DEV="/dev/$DEV"
@@ -56,12 +87,16 @@ format() # key_bits expected [forced]
 {
        if [ -z "$3" ] ; then
                echo -n "Formatting using topology info ($1 bits key)..."
-               echo $PWD1 | $CRYPTSETUP luksFormat $DEV -q -i1 -c aes-cbc-essiv:sha256 -s $1
+               echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -c aes-cbc-essiv:sha256 -s $1 || fail
        else
                echo -n "Formatting using forced sector alignment $3 ($1 bits key)..."
-               echo $PWD1 | $CRYPTSETUP luksFormat $DEV -q -i1 -s $1 -c aes-cbc-essiv:sha256 --align-payload=$2
+               echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -s $1 -c aes-cbc-essiv:sha256 --align-payload=$3 ||fail
        fi
 
+       # check the device can be activated
+       echo $PWD1 | $CRYPTSETUP luksOpen $DEV $DEV_NAME || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+
        ALIGN=$($CRYPTSETUP luksDump $DEV |grep "Payload offset" | sed -e s/.*\\t//)
        #echo "ALIGN = $ALIGN"
 
@@ -69,7 +104,7 @@ format() # key_bits expected [forced]
        [ $ALIGN -ne $2 ] && fail "Expected alignment differs: expected $2 != detected $ALIGN"
 
        # test some operation, just in case
-       echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $DEV -i1 --key-slot 1
+       echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $DEV $FAST_PBKDF --key-slot 1
        [ $? -ne 0 ] && fail "Keyslot add failed."
 
        $CRYPTSETUP -q luksKillSlot $DEV 1
@@ -87,18 +122,22 @@ format_null()
 {
        if [ $3 -eq 0 ] ; then
                echo -n "Formatting using topology info ($1 bits key) [slot 0"
-               echo $PWD1 | $CRYPTSETUP luksFormat $DEV -q -i1 -c null -s $1
+               echo | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -c null -s $1 || fail
        else
                echo -n "Formatting using forced sector alignment $3 ($1 bits key) [slot 0"
-               echo $PWD1 | $CRYPTSETUP luksFormat $DEV -q -i1 -c null -s $1 --align-payload=$3
+               echo | $CRYPTSETUP luksFormat --type luks1 $DEV -q $FAST_PBKDF -c null -s $1 --align-payload=$3 || fail
        fi
 
+       # check the device can be activated
+       echo | $CRYPTSETUP luksOpen $DEV $DEV_NAME || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+
        POFF=$(get_offsets "Payload offset")
        [ -z "$POFF" ] && fail
        [ $POFF != $2 ] && fail "Expected data offset differs: expected $2 != detected $POFF"
        if [ -n "$4" ] ; then
                for j in 1 2 3 4 5 6 7 ; do
-                       echo -e "$PWD1\n$PWD2$j" | $CRYPTSETUP luksAddKey $DEV -q -i1 --key-slot $j -c null $PARAMS
+                       echo -e "\n" | $CRYPTSETUP luksAddKey $DEV -q $FAST_PBKDF --key-slot $j -c null $PARAMS
                        echo -n $j
                        [ $? -ne 0 ] && fail
                done
@@ -111,21 +150,56 @@ format_null()
        echo "]...PASSED"
 }
 
+format_plain() # sector size
+{
+       echo -n "Formatting plain device (sector size $1)..."
+       if [ -n "$DM_SECTOR_SIZE" ] ; then
+               echo $PWD1 | $CRYPTSETUP open --type plain --hash sha256 --sector-size $1 $DEV $DEV_NAME || fail
+               $CRYPTSETUP close $DEV_NAME || fail
+               echo "PASSED"
+       else
+               echo "N/A"
+       fi
+}
+
+format_plain_fail() # sector size
+{
+       echo -n "Formatting plain device (sector size $1, must fail)..."
+       if [ -n "$DM_SECTOR_SIZE" ] ; then
+               echo $PWD1 | $CRYPTSETUP open --type plain --hash sha256 --sector-size $1 $DEV $DEV_NAME >/dev/null 2>&1 && fail
+               echo "PASSED"
+       else
+               echo "N/A"
+       fi
+}
+
 if [ $(id -u) != 0 ]; then
        echo "WARNING: You must be root to run this test, test skipped."
-       exit 0
+       exit 77
 fi
 
-modprobe --dry-run scsi_debug || exit 0
+dm_crypt_features
+modprobe --dry-run scsi_debug || exit 77
 cleanup
 
 echo "# Create desktop-class 4K drive"
 echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0)"
 add_device dev_size_mb=16 sector_size=512 physblk_exp=3 num_tgts=1
 format 256 4096
-format 256 2112 8
+format 256 2056 8
+format 128 2048
+format 128 1032 8
+format 256 8192 8192
+format 128 8192 8192
+cleanup
+
+echo "# Create desktop-class 4K drive with misaligned opt-io (some bad USB enclosures)"
+echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0, opt-io=1025)"
+add_device dev_size_mb=16 sector_size=512 physblk_exp=3 num_tgts=1 opt_blks=1025
+format 256 4096
+format 256 2056 8
 format 128 2048
-format 128 1088 8
+format 128 1032 8
 format 256 8192 8192
 format 128 8192 8192
 cleanup
@@ -134,18 +208,18 @@ echo "# Create desktop-class 4K drive w/ 63-sector DOS partition compensation"
 echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=3584)"
 add_device dev_size_mb=16 sector_size=512 physblk_exp=3 lowest_aligned=7 num_tgts=1
 format 256 4103
-format 256 2119 8
+format 256 2056 8
 format 128 2055
-format 128 1095 8
+format 128 1032 8
 cleanup
 
 echo "# Create enterprise-class 4K drive"
 echo "# (logical_block_size=4096, physical_block_size=4096, alignment_offset=0)"
-add_device dev_size_mb=16 sector_size=4096 num_tgts=1
+add_device dev_size_mb=16 sector_size=4096 num_tgts=1 opt_blks=64
 format 256 4096
-format 256 2560 8
+format 256 2056 8
 format 128 2048
-format 128 1536 8
+format 128 1032 8
 cleanup
 
 echo "# Create classic 512B drive and stack dm-linear"
@@ -155,12 +229,32 @@ DEV2=$DEV
 DEV=/dev/mapper/$DEV_STACKED
 dmsetup create $DEV_STACKED --table "0 32768 linear $DEV2 0"
 format 256 4096
-format 256 2112 8
+format 256 2056 8
 format 128 2048
-format 128 1088 8
+format 128 1032 8
 format 128 8192 8192
 cleanup
 
+echo "# Create classic 512B drive and stack dm-linear (plain mode)"
+add_device dev_size_mb=16 sector_size=512 num_tgts=1
+DEV2=$DEV
+DEV=/dev/mapper/$DEV_STACKED
+dmsetup create $DEV_STACKED --table "0 32768 linear $DEV2 0"
+format_plain 512
+format_plain 1024
+format_plain 2048
+format_plain 4096
+format_plain_fail 1111
+format_plain_fail 8192
+echo "# Create classic 512B drive, unaligned to 4096 and stack dm-linear (plain mode)"
+dmsetup remove --retry $DEV_STACKED >/dev/null 2>&1
+dmsetup create $DEV_STACKED --table "0 32762 linear $DEV2 0"
+format_plain 512
+format_plain 1024
+format_plain_fail 2048
+format_plain_fail 4096
+cleanup
+
 echo "# Offset check: 512B sector drive"
 add_device dev_size_mb=16 sector_size=512 num_tgts=1
 #           |k| expO reqO expected slot offsets
@@ -187,7 +281,7 @@ format_null 512 4096 2048
 cleanup
 
 echo "# Offset check: 4096B sector drive"
-add_device dev_size_mb=16 sector_size=4096 num_tgts=1
+add_device dev_size_mb=16 sector_size=4096 num_tgts=1 opt_blks=64
 format_null  64 2048    0 8:72:136:200:264:328:392:456
 format_null  64  520    1
 format_null  64  520    8
@@ -213,14 +307,14 @@ cleanup
 echo "# Create enterprise-class 4K drive with fs and LUKS images."
 # loop device here presents 512 block but images have 4k block
 # cryptsetup should properly use 4k block on direct-io
-add_device dev_size_mb=16 sector_size=4096 physblk_exp=0 num_tgts=1
-for file in $(ls img_fs_*.img.bz2) ; do
+add_device dev_size_mb=32 sector_size=4096 physblk_exp=0 num_tgts=1 opt_blks=64
+for file in $(ls img_fs_*.img.xz) ; do
     echo "Format using fs image $file."
-    bzip2 -d -c $file | dd of=$DEV bs=1M 2>/dev/null || fail "bad image"
+    xz -d -c $file | dd of=$DEV bs=1M 2>/dev/null || fail "bad image"
     [ ! -d $MNT_DIR ] && mkdir $MNT_DIR
     mount $DEV $MNT_DIR || skip "Mounting image is not available."
-    echo $PWD1 | $CRYPTSETUP luksFormat -i 1 $MNT_DIR/luks.img || fail
-    echo $PWD2 | $CRYPTSETUP luksFormat -i 1 $MNT_DIR/luks.img --header $MNT_DIR/luks_header.img || fail
+    echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 --key-size 256 $FAST_PBKDF $MNT_DIR/luks.img || fail
+    echo $PWD2 | $CRYPTSETUP luksFormat --type luks1 --key-size 256 $FAST_PBKDF $MNT_DIR/luks.img --header $MNT_DIR/luks_header.img || fail
     umount $MNT_DIR
 done
 cleanup
diff --git a/tests/align-test2 b/tests/align-test2
new file mode 100755 (executable)
index 0000000..f1b387e
--- /dev/null
@@ -0,0 +1,342 @@
+#!/bin/bash
+
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+DEV=""
+DEV_STACKED="luks0xbabe"
+DEV_NAME="dummyalign"
+MNT_DIR="./mnt_luks"
+PWD1="93R4P4pIqAH8"
+PWD2="mymJeD8ivEhE"
+FAST_PBKDF="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
+
+cleanup() {
+       udevadm settle >/dev/null 2>&1
+       if [ -d "$MNT_DIR" ] ; then
+           umount -f $MNT_DIR 2>/dev/null
+           rmdir $MNT_DIR 2>/dev/null
+       fi
+       [ -b /dev/mapper/$DEV_STACKED ] && dmsetup remove --retry $DEV_STACKED >/dev/null 2>&1
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME >/dev/null 2>&1
+       # FIXME scsi_debug sometimes in-use here
+       sleep 1
+       rmmod scsi_debug 2>/dev/null
+       sleep 1
+}
+
+fail()
+{
+       if [ -n "$1" ] ; then echo "FAIL $1" ; fi
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       cleanup
+       exit 100
+}
+
+skip()
+{
+       echo "TEST SKIPPED: $1"
+       cleanup
+       exit 0
+}
+
+function dm_crypt_features()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+       VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
+
+       [ $VER_MAJ -lt 1 ] && return
+       [ $VER_MAJ -gt 1 ] && {
+               DM_PERF_CPU=1
+               DM_SECTOR_SIZE=1
+               return
+       }
+
+       [ $VER_MIN -lt 14 ] && return
+       DM_PERF_CPU=1
+       if [ $VER_MIN -ge 17 -o \( $VER_MIN -eq 14 -a $VER_PTC -ge 5 \) ]; then
+               DM_SECTOR_SIZE=1
+       fi
+}
+
+add_device() {
+       modprobe scsi_debug $@ delay=0
+       if [ $? -ne 0 ] ; then
+               echo "This kernel seems to not support proper scsi_debug module, test skipped."
+               exit 77
+       fi
+
+       sleep 2
+       DEV=$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+
+       if [ ! -e /sys/block/$DEV/alignment_offset ] ; then
+               echo "This kernel seems to not support topology info, test skipped."
+               cleanup
+               exit 77
+       fi
+
+       DEV="/dev/$DEV"
+       [ -b $DEV ] || fail "Cannot find $DEV."
+}
+
+format() # expected [forced] [encryption_sector_size]
+{
+       local _sec_size=512
+
+       local _exp=$1
+
+       if [ "${2:0:1}" = "s" ]; then
+               _sec_size=${2:1}
+               shift
+       fi
+
+       test "${3:0:1}" = "s" && _sec_size=${3:1}
+
+       test $_sec_size -eq 512 || local _smsg=" (encryption sector size $_sec_size)"
+
+       if [ -z "$2" ] ; then
+               echo -n "Formatting using topology info$_smsg..."
+               echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF --type luks2 $DEV -q -c aes-cbc-essiv:sha256 --sector-size $_sec_size >/dev/null || fail
+       else
+               echo -n "Formatting using forced sector alignment $2$_smsg..."
+               echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF --type luks2 $DEV -q -c aes-cbc-essiv:sha256 --align-payload=$2 --sector-size $_sec_size >/dev/null || fail
+       fi
+
+       # check the device can be activated
+       if [ -n "$DM_SECTOR_SIZE" ] ; then
+               echo $PWD1 | $CRYPTSETUP luksOpen $DEV $DEV_NAME || fail
+               $CRYPTSETUP close $DEV_NAME || fail
+       fi
+
+       ALIGN=$($CRYPTSETUP luksDump $DEV | tee  /tmp/last_dump | grep -A1 "0: crypt" | grep "offset:" | cut -d ' ' -f2)
+       # echo "ALIGN = $ALIGN"
+
+       [ -z "$ALIGN" ] && fail
+       ALIGN=$((ALIGN/512))
+       [ $ALIGN -ne $_exp ] && fail "Expected alignment differs: expected $_exp != detected $ALIGN"
+
+       # test some operation, just in case
+       echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $DEV $FAST_PBKDF --key-slot 1
+       [ $? -ne 0 ] && fail "Keyslot add failed."
+
+       $CRYPTSETUP -q luksKillSlot $DEV 1
+       [ $? -ne 0 ] && fail "Keyslot removal failed."
+
+       echo "PASSED"
+}
+
+format_fail() # expected [forced] [encryption_sector_size]
+{
+       local _sec_size=512
+
+       local _exp=$1
+
+       if [ "${2:0:1}" = "s" ]; then
+               _sec_size=${2:1}
+               shift
+       fi
+
+       test "${3:0:1}" = "s" && _sec_size=${3:1}
+
+       test $_sec_size -eq 512 || local _smsg=" (encryption sector size $_sec_size)"
+
+       if [ -z "$2" ] ; then
+               echo -n "Formatting using topology info$_smsg (must fail)..."
+               echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF --type luks2 $DEV -q -c aes-cbc-essiv:sha256 --sector-size $_sec_size >/dev/null 2>&1 && fail
+       else
+               echo -n "Formatting using forced sector alignment $2$_smsg (must fail)..."
+               echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF --type luks2 $DEV -q -c aes-cbc-essiv:sha256 --align-payload=$2 --sector-size $_sec_size >/dev/null 2>&1 && fail
+       fi
+
+       echo "PASSED"
+}
+
+if [ $(id -u) != 0 ]; then
+       echo "WARNING: You must be root to run this test, test skipped."
+       exit 77
+fi
+
+dm_crypt_features
+modprobe --dry-run scsi_debug || exit 77
+cleanup
+
+add_device dev_size_mb=32
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF --type luks2 $DEV -q  >/dev/null || fail
+EXPCT=$($CRYPTSETUP luksDump $DEV | grep "offset: " | cut -f 2 -d ' ')
+test "$EXPCT" -gt 512 || fail
+EXPCT=$((EXPCT/512))
+echo "Default alignment detected: $EXPCT sectors"
+cleanup
+
+echo "# Create desktop-class 4K drive"
+echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0)"
+add_device dev_size_mb=32 sector_size=512 physblk_exp=3 num_tgts=1
+format $EXPCT
+format $EXPCT s1024
+format $EXPCT s2048
+format $EXPCT s4096
+format $EXPCT 1
+format $EXPCT 1 s1024
+format $EXPCT 1 s2048
+format $EXPCT 1 s4096
+format $EXPCT 8
+format $EXPCT 8 s1024
+format $EXPCT 8 s2048
+format $EXPCT 8 s4096
+format $((EXPCT+1)) $((EXPCT+1))
+format_fail $((EXPCT+1)) $((EXPCT+1)) s1024
+format_fail $((EXPCT+1)) $((EXPCT+1)) s2048
+format_fail $((EXPCT+1)) $((EXPCT+1)) s4096
+format $EXPCT $EXPCT
+format $EXPCT $EXPCT s1024
+format $EXPCT $EXPCT s2048
+format $EXPCT $EXPCT s4096
+cleanup
+
+echo "# Create desktop-class 4K drive with misaligned opt-io (some bad USB enclosures)"
+echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0, opt-io=1025)"
+add_device dev_size_mb=32 sector_size=512 physblk_exp=3 num_tgts=1 opt_blks=1025
+format $EXPCT
+format $EXPCT s1024
+format $EXPCT s2048
+format $EXPCT s4096
+format $EXPCT 1
+format $EXPCT 1 s1024
+format $EXPCT 1 s2048
+format $EXPCT 1 s4096
+format $EXPCT 8
+format $EXPCT 8 s1024
+format $EXPCT 8 s2048
+format $EXPCT 8 s4096
+format $((EXPCT+1)) $((EXPCT+1))
+format_fail $((EXPCT+1)) $((EXPCT+1)) s1024
+format_fail $((EXPCT+1)) $((EXPCT+1)) s2048
+format_fail $((EXPCT+1)) $((EXPCT+1)) s4096
+format $EXPCT $EXPCT
+format $EXPCT $EXPCT s1024
+format $EXPCT $EXPCT s2048
+format $EXPCT $EXPCT s4096
+cleanup
+
+echo "# Create desktop-class 4K drive w/ 1-sector shift (original bug report)"
+echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=512)"
+add_device dev_size_mb=32 sector_size=512 physblk_exp=3 lowest_aligned=1 num_tgts=1
+format $((EXPCT+1))
+format_fail $((EXPCT+1)) s1024
+format_fail $((EXPCT+1)) s2048
+format_fail $((EXPCT+1)) s4096
+format $EXPCT 1
+format $EXPCT 1 s1024
+format $EXPCT 1 s2048
+format $EXPCT 1 s4096
+format $EXPCT 8
+format $EXPCT 8 s1024
+format $EXPCT 8 s2048
+format $EXPCT 8 s4096
+format $((EXPCT+1)) $((EXPCT+1))
+format_fail $((EXPCT+1)) $((EXPCT+1)) s1024
+format_fail $((EXPCT+1)) $((EXPCT+1)) s2048
+format_fail $((EXPCT+1)) $((EXPCT+1)) s4096
+format $EXPCT $EXPCT
+format $EXPCT $EXPCT s1024
+format $EXPCT $EXPCT s2048
+format $EXPCT $EXPCT s4096
+cleanup
+
+echo "# Create desktop-class 4K drive w/ 63-sector DOS partition compensation"
+echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=3584)"
+add_device dev_size_mb=32 sector_size=512 physblk_exp=3 lowest_aligned=7 num_tgts=1
+format $((EXPCT+7))
+format_fail $((EXPCT+7)) s1024
+format_fail $((EXPCT+7)) s2048
+format_fail $((EXPCT+7)) s4096
+format $EXPCT 1
+format $EXPCT 1 s1024
+format $EXPCT 1 s2048
+format $EXPCT 1 s4096
+format $EXPCT 8
+format $EXPCT 8 s1024
+format $EXPCT 8 s2048
+format $EXPCT 8 s4096
+format $((EXPCT+1)) $((EXPCT+1))
+format_fail $((EXPCT+1)) $((EXPCT+1)) s1024
+format_fail $((EXPCT+1)) $((EXPCT+1)) s2048
+format_fail $((EXPCT+1)) $((EXPCT+1)) s4096
+format $EXPCT $EXPCT
+format $EXPCT $EXPCT s1024
+format $EXPCT $EXPCT s2048
+format $EXPCT $EXPCT s4096
+cleanup
+
+echo "# Create enterprise-class 4K drive"
+echo "# (logical_block_size=4096, physical_block_size=4096, alignment_offset=0)"
+add_device dev_size_mb=32 sector_size=4096 num_tgts=1 opt_blks=64
+format $EXPCT
+format $EXPCT s1024
+format $EXPCT s2048
+format $EXPCT s4096
+format $EXPCT 1
+format $EXPCT 1 s1024
+format $EXPCT 1 s2048
+format $EXPCT 1 s4096
+format $EXPCT 8
+format $EXPCT 8 s1024
+format $EXPCT 8 s2048
+format $EXPCT 8 s4096
+#FIXME: kernel limits issue?
+##format $((EXPCT+1)) $((EXPCT+1))
+format_fail $((EXPCT+1)) $((EXPCT+1)) s1024
+format_fail $((EXPCT+1)) $((EXPCT+1)) s2048
+format_fail $((EXPCT+1)) $((EXPCT+1)) s4096
+format $EXPCT $EXPCT
+format $EXPCT $EXPCT s1024
+format $EXPCT $EXPCT s2048
+format $EXPCT $EXPCT s4096
+cleanup
+
+echo "# Create classic 512B drive and stack dm-linear"
+echo "# (logical_block_size=512, physical_block_size=512, alignment_offset=0)"
+add_device dev_size_mb=32 sector_size=512 num_tgts=1
+DEV2=$DEV
+DEV=/dev/mapper/$DEV_STACKED
+dmsetup create $DEV_STACKED --table "0 65536 linear $DEV2 0"
+format $EXPCT
+format $EXPCT s1024
+format $EXPCT s2048
+format $EXPCT s4096
+format $EXPCT 1
+format $EXPCT 1 s1024
+format $EXPCT 1 s2048
+format $EXPCT 1 s4096
+format $EXPCT 8
+format $EXPCT 8 s1024
+format $EXPCT 8 s2048
+format $EXPCT 8 s4096
+format $((EXPCT+1)) $((EXPCT+1))
+format_fail $((EXPCT+1)) $((EXPCT+1)) s1024
+format_fail $((EXPCT+1)) $((EXPCT+1)) s2048
+format_fail $((EXPCT+1)) $((EXPCT+1)) s4096
+format $EXPCT $EXPCT
+format $EXPCT $EXPCT s1024
+format $EXPCT $EXPCT s2048
+format $EXPCT $EXPCT s4096
+cleanup
+
+echo "# Create enterprise-class 4K drive with fs and LUKS images."
+# loop device here presents 512 block but images have 4k block
+# cryptsetup should properly use 4k block on direct-io
+add_device dev_size_mb=32 sector_size=4096 physblk_exp=0 num_tgts=1 opt_blks=64
+for file in $(ls img_fs_*.img.xz) ; do
+    echo "Format using fs image $file."
+    xz -d -c $file | dd of=$DEV bs=1M 2>/dev/null || fail "bad image"
+    [ ! -d $MNT_DIR ] && mkdir $MNT_DIR
+    mount $DEV $MNT_DIR || skip "Mounting image is not available."
+    echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF --type luks2 $MNT_DIR/luks.img --offset 8192 || fail
+    echo $PWD2 | $CRYPTSETUP luksFormat $FAST_PBKDF --type luks2 $MNT_DIR/luks.img --header $MNT_DIR/luks_header.img || fail
+    umount $MNT_DIR
+done
+cleanup
diff --git a/tests/api-test-2.c b/tests/api-test-2.c
new file mode 100644 (file)
index 0000000..8386c08
--- /dev/null
@@ -0,0 +1,4443 @@
+/*
+ * cryptsetup library LUKS2 API check functions
+ *
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ * Copyright (C) 2016-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/stat.h>
+#include <inttypes.h>
+#include <sys/types.h>
+#ifdef KERNEL_KEYRING
+#include <linux/keyctl.h>
+#include <sys/syscall.h>
+#ifndef HAVE_KEY_SERIAL_T
+#define HAVE_KEY_SERIAL_T
+#include <stdint.h>
+typedef int32_t key_serial_t;
+#endif
+#endif
+
+#include "api_test.h"
+#include "luks.h"
+#include "libcryptsetup.h"
+
+#define DMDIR "/dev/mapper/"
+
+#define DEVICE_1_UUID "28632274-8c8a-493f-835b-da802e1c576b"
+#define DEVICE_EMPTY_name "crypt_zero"
+#define DEVICE_EMPTY DMDIR DEVICE_EMPTY_name
+#define DEVICE_ERROR_name "crypt_error"
+#define DEVICE_ERROR DMDIR DEVICE_ERROR_name
+
+#define CDEVICE_1 "ctest1"
+#define CDEVICE_2 "ctest2"
+#define CDEVICE_WRONG "O_o"
+#define H_DEVICE "head_ok"
+#define H_DEVICE_WRONG "head_wr"
+#define L_DEVICE_1S "luks_onesec"
+#define L_DEVICE_0S "luks_zerosec"
+#define L_DEVICE_WRONG "luks_wr"
+#define L_DEVICE_OK "luks_ok"
+#define REQS_LUKS2_HEADER "luks2_header_requirements"
+#define NO_REQS_LUKS2_HEADER "luks2_header_requirements_free"
+#define BACKUP_FILE "csetup_backup_file"
+#define IMAGE1 "compatimage2.img"
+#define IMAGE_EMPTY "empty.img"
+#define IMAGE_EMPTY_SMALL "empty_small.img"
+#define IMAGE_EMPTY_SMALL_2 "empty_small2.img"
+#define IMAGE_PV_LUKS2_SEC "blkid-luks2-pv.img"
+
+#define KEYFILE1 "key1.file"
+#define KEY1 "compatkey"
+
+#define KEYFILE2 "key2.file"
+#define KEY2 "0123456789abcdef"
+
+#define PASSPHRASE "blabla"
+#define PASSPHRASE1 "albalb"
+
+#define DEVICE_TEST_UUID "12345678-1234-1234-1234-123456789abc"
+
+#define DEVICE_WRONG "/dev/Ooo_"
+#define DEVICE_CHAR "/dev/zero"
+#define THE_LFILE_TEMPLATE "cryptsetup-tstlp.XXXXXX"
+
+#define KEY_DESC_TEST0 "cs_token_test:test_key0"
+#define KEY_DESC_TEST1 "cs_token_test:test_key1"
+
+#define CONV_DIR "conversion_imgs"
+#define CONV_L1_128 "l1_128b"
+#define CONV_L1_256 "l1_256b"
+#define CONV_L1_512 "l1_512b"
+#define CONV_L2_128 "l2_128b"
+#define CONV_L2_128_FULL "l2_128b_full"
+#define CONV_L2_256 "l2_256b"
+#define CONV_L2_256_FULL "l2_256b_full"
+#define CONV_L2_512 "l2_512b"
+#define CONV_L2_512_FULL "l2_512b_full"
+#define CONV_L1_128_DET "l1_128b_det"
+#define CONV_L1_256_DET "l1_256b_det"
+#define CONV_L1_512_DET "l1_512b_det"
+#define CONV_L2_128_DET "l2_128b_det"
+#define CONV_L2_128_DET_FULL "l2_128b_det_full"
+#define CONV_L2_256_DET "l2_256b_det"
+#define CONV_L2_256_DET_FULL "l2_256b_det_full"
+#define CONV_L2_512_DET "l2_512b_det"
+#define CONV_L2_512_DET_FULL "l2_512b_det_full"
+#define CONV_L1_256_LEGACY "l1_256b_legacy_offset"
+#define CONV_L1_256_UNMOVABLE "l1_256b_unmovable"
+#define PASS0 "aaa"
+#define PASS1 "hhh"
+#define PASS2 "ccc"
+#define PASS3 "ddd"
+#define PASS4 "eee"
+#define PASS5 "fff"
+#define PASS6 "ggg"
+#define PASS7 "bbb"
+#define PASS8 "iii"
+
+/* Allow to run without config.h */
+#ifndef DEFAULT_LUKS1_HASH
+  #define DEFAULT_LUKS1_HASH "sha256"
+  #define DEFAULT_LUKS1_ITER_TIME 2000
+  #define DEFAULT_LUKS2_ITER_TIME 2000
+  #define DEFAULT_LUKS2_MEMORY_KB 1048576
+  #define DEFAULT_LUKS2_PARALLEL_THREADS 4
+  #define DEFAULT_LUKS2_PBKDF "argon2i"
+#endif
+
+static int _fips_mode = 0;
+
+static char *DEVICE_1 = NULL;
+static char *DEVICE_2 = NULL;
+static char *DEVICE_3 = NULL;
+static char *DEVICE_4 = NULL;
+static char *DEVICE_5 = NULL;
+static char *DEVICE_6 = NULL;
+
+static char *tmp_file_1 = NULL;
+static char *test_loop_file = NULL;
+
+unsigned int test_progress_steps;
+
+struct crypt_device *cd = NULL, *cd2 = NULL;
+
+// Helpers
+
+static unsigned cpus_online(void)
+{
+       static long r = -1;
+
+       if (r < 0) {
+               r = sysconf(_SC_NPROCESSORS_ONLN);
+               if (r < 0)
+                       r = 1;
+       }
+
+       return r;
+}
+
+static uint32_t adjusted_pbkdf_memory(void)
+{
+       long pagesize = sysconf(_SC_PAGESIZE);
+       long pages = sysconf(_SC_PHYS_PAGES);
+       uint64_t memory_kb;
+
+       if (pagesize <= 0 || pages <= 0)
+               return DEFAULT_LUKS2_MEMORY_KB;
+
+       memory_kb = pagesize / 1024 * pages / 2;
+
+       if (memory_kb < DEFAULT_LUKS2_MEMORY_KB)
+               return (uint32_t)memory_kb;
+
+       return DEFAULT_LUKS2_MEMORY_KB;
+}
+
+static unsigned _min(unsigned a, unsigned b)
+{
+       return a < b ? a : b;
+}
+
+static int get_luks2_offsets(int metadata_device,
+                           unsigned int alignpayload_sec,
+                           unsigned int sector_size,
+                           uint64_t *r_header_size,
+                           uint64_t *r_payload_offset)
+{
+       struct crypt_device *cd = NULL;
+       static uint64_t default_header_size = 0;
+
+       if (!default_header_size) {
+               if (crypt_init(&cd, THE_LOOP_DEV))
+                       return -EINVAL;
+               if (crypt_format(cd, CRYPT_LUKS2, "aes", "xts-plain64", NULL, NULL, 64, NULL)) {
+                       crypt_free(cd);
+                       return -EINVAL;
+               }
+
+               default_header_size = crypt_get_data_offset(cd);
+
+               crypt_free(cd);
+       }
+
+       if (!sector_size)
+               sector_size = 512; /* default? */
+
+       if ((sector_size % 512) && (sector_size % 4096))
+               return -1;
+
+       if (r_payload_offset) {
+               if (metadata_device)
+                       *r_payload_offset = DIV_ROUND_UP_MODULO(default_header_size * 512, (alignpayload_sec ?: 1) * sector_size);
+               else
+                       *r_payload_offset = alignpayload_sec * sector_size;
+
+               *r_payload_offset /= sector_size;
+       }
+
+       if (r_header_size)
+               *r_header_size = default_header_size;
+
+       return 0;
+}
+
+static void _remove_keyfiles(void)
+{
+       remove(KEYFILE1);
+       remove(KEYFILE2);
+}
+
+#if HAVE_DECL_DM_TASK_RETRY_REMOVE
+#define DM_RETRY "--retry "
+#else
+#define DM_RETRY ""
+#endif
+
+#define DM_NOSTDERR " 2>/dev/null"
+
+static void _cleanup_dmdevices(void)
+{
+       struct stat st;
+
+       if (!stat(DMDIR H_DEVICE, &st))
+               _system("dmsetup remove " DM_RETRY H_DEVICE DM_NOSTDERR, 0);
+
+       if (!stat(DMDIR H_DEVICE_WRONG, &st))
+               _system("dmsetup remove " DM_RETRY H_DEVICE_WRONG DM_NOSTDERR, 0);
+
+       if (!stat(DMDIR L_DEVICE_0S, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_0S DM_NOSTDERR, 0);
+
+       if (!stat(DMDIR L_DEVICE_1S, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_1S DM_NOSTDERR, 0);
+
+       if (!stat(DMDIR L_DEVICE_WRONG, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_WRONG DM_NOSTDERR, 0);
+
+       if (!stat(DMDIR L_DEVICE_OK, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_OK DM_NOSTDERR, 0);
+
+       t_dev_offset = 0;
+}
+
+static void _cleanup(void)
+{
+       struct stat st;
+
+       CRYPT_FREE(cd);
+       CRYPT_FREE(cd2);
+
+       //_system("udevadm settle", 0);
+
+       if (!stat(DMDIR CDEVICE_1, &st))
+               _system("dmsetup remove " DM_RETRY CDEVICE_1 DM_NOSTDERR, 0);
+
+       if (!stat(DMDIR CDEVICE_2, &st))
+               _system("dmsetup remove " DM_RETRY CDEVICE_2 DM_NOSTDERR, 0);
+
+       if (!stat(DEVICE_EMPTY, &st))
+               _system("dmsetup remove " DM_RETRY DEVICE_EMPTY_name DM_NOSTDERR, 0);
+
+       if (!stat(DEVICE_ERROR, &st))
+               _system("dmsetup remove " DM_RETRY DEVICE_ERROR_name DM_NOSTDERR, 0);
+
+       _cleanup_dmdevices();
+
+       if (loop_device(THE_LOOP_DEV))
+               loop_detach(THE_LOOP_DEV);
+
+       if (loop_device(DEVICE_1))
+               loop_detach(DEVICE_1);
+
+       if (loop_device(DEVICE_2))
+               loop_detach(DEVICE_2);
+
+       if (loop_device(DEVICE_3))
+               loop_detach(DEVICE_3);
+
+       if (loop_device(DEVICE_4))
+               loop_detach(DEVICE_4);
+
+       if (loop_device(DEVICE_5))
+               loop_detach(DEVICE_5);
+
+       if (loop_device(DEVICE_6))
+               loop_detach(DEVICE_6);
+
+       _system("rm -f " IMAGE_EMPTY, 0);
+       _system("rm -f " IMAGE1, 0);
+       _system("rm -rf " CONV_DIR, 0);
+
+       if (test_loop_file)
+               remove(test_loop_file);
+       if (tmp_file_1)
+               remove(tmp_file_1);
+
+       remove(REQS_LUKS2_HEADER);
+       remove(NO_REQS_LUKS2_HEADER);
+       remove(BACKUP_FILE);
+       remove(IMAGE_PV_LUKS2_SEC);
+       remove(IMAGE_PV_LUKS2_SEC ".bcp");
+       remove(IMAGE_EMPTY_SMALL);
+       remove(IMAGE_EMPTY_SMALL_2);
+
+       _remove_keyfiles();
+
+       free(tmp_file_1);
+       free(test_loop_file);
+       free(THE_LOOP_DEV);
+       free(DEVICE_1);
+       free(DEVICE_2);
+       free(DEVICE_3);
+       free(DEVICE_4);
+       free(DEVICE_5);
+       free(DEVICE_6);
+}
+
+static int _setup(void)
+{
+       int fd, ro = 0;
+       char cmd[128];
+
+       test_loop_file = strdup(THE_LFILE_TEMPLATE);
+       if ((fd=mkstemp(test_loop_file)) == -1) {
+               printf("cannot create temporary file with template %s\n", test_loop_file);
+               return 1;
+       }
+       close(fd);
+       snprintf(cmd, sizeof(cmd), "dd if=/dev/zero of=%s bs=%d count=%d 2>/dev/null",
+                test_loop_file, SECTOR_SIZE, TST_LOOP_FILE_SIZE);
+       if (_system(cmd, 1))
+               return 1;
+
+       fd = loop_attach(&THE_LOOP_DEV, test_loop_file, 0, 0, &ro);
+       close(fd);
+
+       tmp_file_1 = strdup(THE_LFILE_TEMPLATE);
+       if ((fd=mkstemp(tmp_file_1)) == -1) {
+               printf("cannot create temporary file with template %s\n", tmp_file_1);
+               return 1;
+       }
+       close(fd);
+       snprintf(cmd, sizeof(cmd), "dd if=/dev/zero of=%s bs=%d count=%d 2>/dev/null",
+                tmp_file_1, SECTOR_SIZE, 10);
+       if (_system(cmd, 1))
+               return 1;
+
+       _system("dmsetup create " DEVICE_EMPTY_name " --table \"0 10000 zero\"", 1);
+       _system("dmsetup create " DEVICE_ERROR_name " --table \"0 10000 error\"", 1);
+
+       _system(" [ ! -e " IMAGE1 " ] && xz -dk " IMAGE1 ".xz", 1);
+       fd = loop_attach(&DEVICE_1, IMAGE1, 0, 0, &ro);
+       close(fd);
+
+       _system("dd if=/dev/zero of=" IMAGE_EMPTY " bs=1M count=32 2>/dev/null", 1);
+       fd = loop_attach(&DEVICE_2, IMAGE_EMPTY, 0, 0, &ro);
+       close(fd);
+
+       _system("dd if=/dev/zero of=" IMAGE_EMPTY_SMALL " bs=1M count=7 2>/dev/null", 1);
+
+       _system("dd if=/dev/zero of=" IMAGE_EMPTY_SMALL_2 " bs=512 count=2050 2>/dev/null", 1);
+
+       _system(" [ ! -e " NO_REQS_LUKS2_HEADER " ] && xz -dk " NO_REQS_LUKS2_HEADER ".xz", 1);
+       fd = loop_attach(&DEVICE_4, NO_REQS_LUKS2_HEADER, 0, 0, &ro);
+       close(fd);
+
+       _system(" [ ! -e " REQS_LUKS2_HEADER " ] && xz -dk " REQS_LUKS2_HEADER ".xz", 1);
+       fd = loop_attach(&DEVICE_5, REQS_LUKS2_HEADER, 0, 0, &ro);
+       close(fd);
+
+       _system(" [ ! -e " IMAGE_PV_LUKS2_SEC " ] && xz -dk " IMAGE_PV_LUKS2_SEC ".xz", 1);
+       _system(" [ ! -e " IMAGE_PV_LUKS2_SEC ".bcp ] && cp " IMAGE_PV_LUKS2_SEC " " IMAGE_PV_LUKS2_SEC ".bcp", 1);
+       fd = loop_attach(&DEVICE_6, IMAGE_PV_LUKS2_SEC, 0, 0, &ro);
+       close(fd);
+
+       _system(" [ ! -d " CONV_DIR " ] && tar xJf " CONV_DIR ".tar.xz 2>/dev/null", 1);
+
+       if (_system("modprobe dm-crypt", 1))
+               return 1;
+
+       if (t_dm_check_versions())
+               return 1;
+
+       _system("rmmod dm-crypt", 0);
+
+       _fips_mode = fips_mode();
+       if (_debug)
+               printf("FIPS MODE: %d\n", _fips_mode);
+
+       /* Use default log callback */
+       crypt_set_log_callback(NULL, &global_log_callback, NULL);
+
+       return 0;
+}
+
+#ifdef KERNEL_KEYRING
+static key_serial_t add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t keyring)
+{
+       return syscall(__NR_add_key, type, description, payload, plen, keyring);
+}
+
+static key_serial_t keyctl_unlink(key_serial_t key, key_serial_t keyring)
+{
+       return syscall(__NR_keyctl, KEYCTL_UNLINK, key, keyring);
+}
+
+static key_serial_t request_key(const char *type,
+       const char *description,
+       const char *callout_info,
+       key_serial_t keyring)
+{
+       return syscall(__NR_request_key, type, description, callout_info, keyring);
+}
+
+static key_serial_t _kernel_key_by_segment(struct crypt_device *cd, int segment)
+{
+       char key_description[1024];
+
+       if (snprintf(key_description, sizeof(key_description), "cryptsetup:%s-d%u", crypt_get_uuid(cd), segment) < 1)
+               return -1;
+
+       return request_key("logon", key_description, NULL, 0);
+}
+
+static int _volume_key_in_keyring(struct crypt_device *cd, int segment)
+{
+       return _kernel_key_by_segment(cd, segment) >= 0 ? 0 : -1;
+}
+
+static int _drop_keyring_key(struct crypt_device *cd, int segment)
+{
+       key_serial_t kid = _kernel_key_by_segment(cd, segment);
+
+       if (kid < 0)
+               return -1;
+
+       return keyctl_unlink(kid, KEY_SPEC_THREAD_KEYRING);
+}
+#endif
+
+static int test_open(struct crypt_device *cd,
+                    int token,
+                    char **buffer,
+                    size_t *buffer_len,
+                    void *usrptr)
+{
+       const char *str = (const char *)usrptr;
+
+       *buffer = strdup(str);
+       if (!*buffer)
+               return -ENOMEM;
+       *buffer_len = strlen(*buffer);
+
+       return 0;
+}
+
+static int test_validate(struct crypt_device *cd, const char *json)
+{
+       return (strstr(json, "magic_string") == NULL);
+}
+
+static void UseLuks2Device(void)
+{
+       char key[128];
+       size_t key_size;
+
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
+       OK_(crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
+       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0), "already open");
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       FAIL_(crypt_deactivate(cd, CDEVICE_1), "no such device");
+
+#if KERNEL_KEYRING
+       // repeat previous tests and check kernel keyring is released when not needed
+       if (t_dm_crypt_keyring_support()) {
+               OK_(crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
+               FAIL_(_drop_keyring_key(cd, 0), "");
+               OK_(crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), CRYPT_ACTIVATE_KEYRING_KEY));
+               OK_(_drop_keyring_key(cd, 0));
+               OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
+               OK_(_drop_keyring_key(cd, 0));
+               FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0), "already open");
+               FAIL_(_volume_key_in_keyring(cd, 0), "");
+               OK_(crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
+               OK_(crypt_deactivate(cd, CDEVICE_1));
+               FAIL_(_volume_key_in_keyring(cd, 0), "");
+       }
+#endif
+
+       key_size = 16;
+       OK_(strcmp("aes", crypt_get_cipher(cd)));
+       OK_(strcmp("cbc-essiv:sha256", crypt_get_cipher_mode(cd)));
+       OK_(strcmp(DEVICE_1_UUID, crypt_get_uuid(cd)));
+       EQ_((int)key_size, crypt_get_volume_key_size(cd));
+       EQ_(8192, crypt_get_data_offset(cd));
+
+       EQ_(0, crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, KEY1, strlen(KEY1)));
+       OK_(crypt_volume_key_verify(cd, key, key_size));
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       key[1] = ~key[1];
+       FAIL_(crypt_volume_key_verify(cd, key, key_size), "key mismatch");
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "key mismatch");
+
+       CRYPT_FREE(cd);
+}
+
+static void SuspendDevice(void)
+{
+       struct crypt_active_device cad;
+       char key[128];
+       size_t key_size;
+       int suspend_status;
+
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
+
+       suspend_status = crypt_suspend(cd, CDEVICE_1);
+       if (suspend_status == -ENOTSUP) {
+               printf("WARNING: Suspend/Resume not supported, skipping test.\n");
+               OK_(crypt_deactivate(cd, CDEVICE_1));
+               CRYPT_FREE(cd);
+               return;
+       }
+
+       OK_(suspend_status);
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(CRYPT_ACTIVATE_SUSPENDED, cad.flags & CRYPT_ACTIVATE_SUSPENDED);
+#ifdef KERNEL_KEYRING
+       FAIL_(_volume_key_in_keyring(cd, 0), "");
+#endif
+       FAIL_(crypt_suspend(cd, CDEVICE_1), "already suspended");
+
+       FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)-1), "wrong key");
+       OK_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)));
+       FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)), "not suspended");
+
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(0, cad.flags & CRYPT_ACTIVATE_SUSPENDED);
+
+       OK_(prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
+       OK_(crypt_suspend(cd, CDEVICE_1));
+       FAIL_(crypt_resume_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1 "blah", 0), "wrong keyfile");
+       FAIL_(crypt_resume_by_keyfile_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 1, 0), "wrong key");
+       OK_(crypt_resume_by_keyfile_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
+       FAIL_(crypt_resume_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0), "not suspended");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       /* create LUKS device with detached header */
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_data_device(cd, DEVICE_2));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
+       CRYPT_FREE(cd);
+
+       /* Should be able to suspend but not resume if not header specified */
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       OK_(crypt_suspend(cd, CDEVICE_1));
+       FAIL_(crypt_suspend(cd, CDEVICE_1), "already suspended");
+       FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)-1), "no header");
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DEVICE_1));
+       OK_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)));
+
+       /* Resume by volume key */
+       OK_(crypt_suspend(cd, CDEVICE_1));
+       key_size = sizeof(key);
+       memset(key, 0, key_size);
+       FAIL_(crypt_resume_by_volume_key(cd, CDEVICE_1, key, key_size), "wrong key");
+       OK_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, KEY1, strlen(KEY1)));
+       OK_(crypt_resume_by_volume_key(cd, CDEVICE_1, key, key_size));
+
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       _remove_keyfiles();
+}
+
+static void AddDeviceLuks2(void)
+{
+       enum { OFFSET_1M = 2048 , OFFSET_2M = 4096, OFFSET_4M = 8192, OFFSET_8M = 16384 };
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha256",
+               .parallel_threads = 4,
+               .max_memory_kb = 1024,
+               .time_ms = 1
+       }, pbkdf_tmp;
+       struct crypt_params_luks2 params = {
+               .pbkdf = &pbkdf,
+               .data_device = DEVICE_2,
+               .sector_size = 512
+       };
+       char key[128], key2[128], key3[128];
+
+       const char *passphrase = "blabla", *passphrase2 = "nsdkFI&Y#.sd";
+       const char *mk_hex = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       const char *mk_hex2 = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1e";
+       size_t key_size = strlen(mk_hex) / 2;
+       const char *cipher = "aes";
+       const char *cipher_mode = "cbc-essiv:sha256";
+       uint64_t r_payload_offset, r_header_size, r_size_1;
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+       }
+
+       crypt_decode_key(key, mk_hex, key_size);
+       crypt_decode_key(key3, mk_hex2, key_size);
+
+       // init test devices
+       OK_(get_luks2_offsets(1, 0, 0, &r_header_size, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(H_DEVICE_WRONG, r_header_size - 1));
+
+
+       // format
+       OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG));
+       params.data_alignment = 0;
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Not enough space for keyslots material");
+       CRYPT_FREE(cd);
+
+       // test payload_offset = 0 for encrypted device with external header device
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_(crypt_get_data_offset(cd), 0);
+       CRYPT_FREE(cd);
+
+       params.data_alignment = 0;
+       params.data_device = NULL;
+
+       // test payload_offset = 0. format() should look up alignment offset from device topology
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(!(crypt_get_data_offset(cd) > 0));
+       CRYPT_FREE(cd);
+
+       // set_data_offset has priority, alignment must be 0 or must be compatible
+       params.data_alignment = 0;
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_set_data_offset(cd, OFFSET_8M));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_(crypt_get_data_offset(cd), OFFSET_8M);
+       CRYPT_FREE(cd);
+
+       // Load gets the value from metadata
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_set_data_offset(cd, OFFSET_2M));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), OFFSET_8M);
+       CRYPT_FREE(cd);
+
+       params.data_alignment = OFFSET_4M;
+       OK_(crypt_init(&cd, DEVICE_2));
+       FAIL_(crypt_set_data_offset(cd, OFFSET_2M + 1), "Not aligned to 4096"); // must be aligned to 4k
+       OK_(crypt_set_data_offset(cd, OFFSET_2M));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Alignment not compatible");
+       OK_(crypt_set_data_offset(cd, OFFSET_4M));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_(crypt_get_data_offset(cd), OFFSET_4M);
+       CRYPT_FREE(cd);
+
+       /*
+        * test limit values for backing device size
+        */
+       params.data_alignment = OFFSET_4M;
+       OK_(get_luks2_offsets(1, params.data_alignment, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_0S, r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_payload_offset + 1));
+       OK_(create_dmdevice_over_loop(L_DEVICE_WRONG, r_payload_offset - 1));
+
+       // 1 sector less than required
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_WRONG));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Device too small");
+       CRYPT_FREE(cd);
+
+       // 0 sectors for encrypted area
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Encrypted area too small");
+       CRYPT_FREE(cd);
+
+       // 1 sector for encrypted area
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_(crypt_get_data_offset(cd), r_payload_offset);
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(t_device_size(DMDIR CDEVICE_1, &r_size_1));
+       EQ_(r_size_1, SECTOR_SIZE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
+       // restrict format only to empty context
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Context is already formatted");
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, NULL), "Context is already formatted");
+       // change data device to wrong one
+       OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_0S));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Device too small");
+       OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       params.data_alignment = 0;
+       params.data_device = DEVICE_2;
+
+       // generate keyslot material at the end of luks header
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_((int)key_size, crypt_get_volume_key_size(cd));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 7, key, key_size, passphrase, strlen(passphrase)), 7);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 7, passphrase, strlen(passphrase) ,0), 7);
+
+       OK_(crypt_keyslot_get_pbkdf(cd, 7, &pbkdf_tmp));
+       OK_(strcmp(pbkdf_tmp.type, pbkdf.type));
+       if (!_fips_mode) {
+               NULL_(pbkdf_tmp.hash);
+               OK_(!(pbkdf_tmp.max_memory_kb >= 32));
+               OK_(!(pbkdf_tmp.parallel_threads >= 1));
+       } else
+               OK_(strcmp(pbkdf_tmp.hash, pbkdf.hash));
+       OK_(!(pbkdf_tmp.iterations >= 4));
+       EQ_(0, pbkdf_tmp.time_ms); /* not usable in per-keyslot call */
+
+       CRYPT_FREE(cd);
+       OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DMDIR H_DEVICE));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Context is already formatted");
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       CRYPT_FREE(cd);
+       // check active status without header
+       OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, NULL));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       NULL_(crypt_get_type(cd));
+       OK_(strcmp(cipher, crypt_get_cipher(cd)));
+       OK_(strcmp(cipher_mode, crypt_get_cipher_mode(cd)));
+       EQ_((int)key_size, crypt_get_volume_key_size(cd));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       params.data_alignment = OFFSET_1M;
+       params.data_device = NULL;
+
+       // test uuid mismatch and _init_by_name_and_header
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       CRYPT_FREE(cd);
+       params.data_alignment = 0;
+       params.data_device = DEVICE_2;
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       CRYPT_FREE(cd);
+       // there we've got uuid mismatch
+       OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DMDIR H_DEVICE));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       NULL_(crypt_get_type(cd));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Device is active");
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, key, key_size, 0), "Device is active");
+       EQ_(crypt_status(cd, CDEVICE_2), CRYPT_INACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       params.data_device = NULL;
+
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+
+       // even with no keyslots defined it can be activated by volume key
+       OK_(crypt_volume_key_verify(cd, key, key_size));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_2, key, key_size, 0));
+       EQ_(crypt_status(cd, CDEVICE_2), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_2));
+
+       // now with keyslot
+       EQ_(7, crypt_keyslot_add_by_volume_key(cd, 7, key, key_size, passphrase, strlen(passphrase)));
+       EQ_(CRYPT_SLOT_ACTIVE_LAST, crypt_keyslot_status(cd, 7));
+       EQ_(7, crypt_activate_by_passphrase(cd, CDEVICE_2, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0));
+       EQ_(crypt_status(cd, CDEVICE_2), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_2));
+
+       crypt_set_iteration_time(cd, 1);
+       EQ_(1, crypt_keyslot_add_by_volume_key(cd, 1, key, key_size, KEY1, strlen(KEY1)));
+       OK_(prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
+       OK_(prepare_keyfile(KEYFILE2, KEY2, strlen(KEY2)));
+       EQ_(2, crypt_keyslot_add_by_keyfile(cd, 2, KEYFILE1, 0, KEYFILE2, 0));
+       FAIL_(crypt_keyslot_add_by_keyfile_offset(cd, 3, KEYFILE1, 0, 1, KEYFILE2, 0, 1), "wrong key");
+       EQ_(3, crypt_keyslot_add_by_keyfile_offset(cd, 3, KEYFILE1, 0, 0, KEYFILE2, 0, 1));
+       EQ_(4, crypt_keyslot_add_by_keyfile_offset(cd, 4, KEYFILE2, 0, 1, KEYFILE1, 0, 1));
+       FAIL_(crypt_activate_by_keyfile(cd, CDEVICE_2, CRYPT_ANY_SLOT, KEYFILE2, strlen(KEY2)-1, 0), "key mismatch");
+       EQ_(2, crypt_activate_by_keyfile(cd, NULL, CRYPT_ANY_SLOT, KEYFILE2, 0, 0));
+       EQ_(3, crypt_activate_by_keyfile_offset(cd, NULL, CRYPT_ANY_SLOT, KEYFILE2, 0, 1, 0));
+       EQ_(4, crypt_activate_by_keyfile_offset(cd, NULL, CRYPT_ANY_SLOT, KEYFILE1, 0, 1, 0));
+       FAIL_(crypt_activate_by_keyfile_offset(cd, CDEVICE_2, CRYPT_ANY_SLOT, KEYFILE2, strlen(KEY2), 2, 0), "not enough data");
+       FAIL_(crypt_activate_by_keyfile_offset(cd, CDEVICE_2, CRYPT_ANY_SLOT, KEYFILE2, 0, strlen(KEY2) + 1, 0), "cannot seek");
+       FAIL_(crypt_activate_by_keyfile_offset(cd, CDEVICE_2, CRYPT_ANY_SLOT, KEYFILE2, 0, 2, 0), "wrong key");
+       EQ_(2, crypt_activate_by_keyfile(cd, CDEVICE_2, CRYPT_ANY_SLOT, KEYFILE2, 0, 0));
+       OK_(crypt_keyslot_destroy(cd, 1));
+       OK_(crypt_keyslot_destroy(cd, 2));
+       OK_(crypt_keyslot_destroy(cd, 3));
+       OK_(crypt_keyslot_destroy(cd, 4));
+       OK_(crypt_deactivate(cd, CDEVICE_2));
+       _remove_keyfiles();
+
+       FAIL_(crypt_keyslot_add_by_volume_key(cd, 7, key, key_size, passphrase, strlen(passphrase)), "slot used");
+       key[1] = ~key[1];
+       FAIL_(crypt_keyslot_add_by_volume_key(cd, 6, key, key_size, passphrase, strlen(passphrase)), "key mismatch");
+       key[1] = ~key[1];
+       EQ_(6, crypt_keyslot_add_by_volume_key(cd, 6, key, key_size, passphrase, strlen(passphrase)));
+       EQ_(CRYPT_SLOT_ACTIVE, crypt_keyslot_status(cd, 6));
+
+       FAIL_(crypt_keyslot_destroy(cd, 8), "invalid keyslot");
+       FAIL_(crypt_keyslot_destroy(cd, CRYPT_ANY_SLOT), "invalid keyslot");
+       FAIL_(crypt_keyslot_destroy(cd, 0), "keyslot not used");
+       OK_(crypt_keyslot_destroy(cd, 7));
+       EQ_(CRYPT_SLOT_INACTIVE, crypt_keyslot_status(cd, 7));
+       EQ_(CRYPT_SLOT_ACTIVE_LAST, crypt_keyslot_status(cd, 6));
+
+       EQ_(7, crypt_keyslot_change_by_passphrase(cd, 6, 7, passphrase, strlen(passphrase), passphrase2, strlen(passphrase2)));
+       EQ_(CRYPT_SLOT_ACTIVE_LAST, crypt_keyslot_status(cd, 7));
+       EQ_(7, crypt_activate_by_passphrase(cd, NULL, 7, passphrase2, strlen(passphrase2), 0));
+       EQ_(6, crypt_keyslot_change_by_passphrase(cd, CRYPT_ANY_SLOT, 6, passphrase2, strlen(passphrase2), passphrase, strlen(passphrase)));
+
+       EQ_(6, crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key2, &key_size, passphrase, strlen(passphrase)));
+       OK_(crypt_volume_key_verify(cd, key2, key_size));
+       OK_(memcmp(key, key2, key_size));
+
+       OK_(strcmp(cipher, crypt_get_cipher(cd)));
+       OK_(strcmp(cipher_mode, crypt_get_cipher_mode(cd)));
+       EQ_((int)key_size, crypt_get_volume_key_size(cd));
+       EQ_(r_payload_offset, crypt_get_data_offset(cd));
+       OK_(strcmp(DEVICE_2, crypt_get_device_name(cd)));
+
+       reset_log();
+       OK_(crypt_dump(cd));
+       OK_(!(global_lines != 0));
+       reset_log();
+
+       FAIL_(crypt_set_uuid(cd, "blah"), "wrong UUID format");
+       OK_(crypt_set_uuid(cd, DEVICE_TEST_UUID));
+       OK_(strcmp(DEVICE_TEST_UUID, crypt_get_uuid(cd)));
+
+       FAIL_(crypt_deactivate(cd, CDEVICE_2), "not active");
+       CRYPT_FREE(cd);
+       _cleanup_dmdevices();
+
+       /* LUKSv2 format tests */
+
+       /* very basic test */
+       OK_(crypt_init(&cd, DEVICE_2));
+       crypt_set_iteration_time(cd, 1);
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 0, NULL), "Wrong key size");
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, NULL));
+       CRYPT_FREE(cd);
+       /* some invalid parameters known to cause troubles */
+       OK_(crypt_init(&cd, DEVICE_2));
+       crypt_set_iteration_time(cd, 0); /* wrong for argon2 but we don't know the pbkdf type yet, ignored */
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, NULL));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DEVICE_2));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, NULL));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, key_size, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DEVICE_2));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, key_size, NULL));
+       FAIL_(crypt_keyslot_add_by_volume_key(cd, CRYPT_ANY_SLOT, key, key_size, PASSPHRASE, strlen(PASSPHRASE)), "VK doesn't match any digest");
+       FAIL_(crypt_keyslot_add_by_volume_key(cd, 1, key, key_size, PASSPHRASE, strlen(PASSPHRASE)), "VK doesn't match any digest");
+       CRYPT_FREE(cd);
+
+       OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_payload_offset + 1));
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, NULL));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 3, NULL, key_size, PASSPHRASE, strlen(PASSPHRASE)), 3);
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key3, key_size, 0), "VK doesn't match any digest assigned to segment 0");
+       CRYPT_FREE(cd);
+
+       /*
+        * Check regression in getting keyslot encryption parameters when
+        * volume key size is unknown (no active keyslots).
+        */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, NULL));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, key_size, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       /* drop context copy of volume key */
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       EQ_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       OK_(crypt_keyslot_destroy(cd, 0));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, key, key_size, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void Luks2MetadataSize(void)
+{
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha256",
+               .parallel_threads = 1,
+               .max_memory_kb = 128,
+               .iterations = 4,
+               .flags = CRYPT_PBKDF_NO_BENCHMARK
+       };
+       struct crypt_params_luks2 params = {
+               .pbkdf = &pbkdf,
+               .data_device = DEVICE_2,
+               .sector_size = 512
+       };
+       char key[128], tmp[128];
+
+       const char *passphrase = "blabla";
+       const char *mk_hex = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       size_t key_size = strlen(mk_hex) / 2;
+       const char *cipher = "aes";
+       const char *cipher_mode = "cbc-essiv:sha256";
+       uint64_t r_header_size, default_mdata_size, default_keyslots_size, mdata_size,
+                keyslots_size, r_header_wrong_size = 14336;
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+               pbkdf.iterations = 1000;
+       }
+
+       crypt_decode_key(key, mk_hex, key_size);
+
+       // init test devices
+       OK_(get_luks2_offsets(1, 0, 0, &r_header_size, NULL));
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(H_DEVICE_WRONG, r_header_wrong_size)); /* 7 MiBs only */
+       //default metadata sizes
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, 0);
+       EQ_(keyslots_size, 0);
+       OK_(crypt_set_metadata_size(cd, 0, 0));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, 0);
+       EQ_(keyslots_size, 0);
+       OK_(crypt_set_metadata_size(cd, 0x004000, 0x004000));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, 0x004000);
+       EQ_(keyslots_size, 0x004000);
+       OK_(crypt_set_metadata_size(cd, 0x008000, 0x008000));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, 0x008000);
+       EQ_(keyslots_size, 0x008000);
+       FAIL_(crypt_set_metadata_size(cd, 0x008001, 0x008000), "Wrong size");
+       FAIL_(crypt_set_metadata_size(cd, 0x008000, 0x008001), "Wrong size");
+       CRYPT_FREE(cd);
+
+       // metadata settings
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_set_metadata_size(cd, 0x080000, 0x080000));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 7, key, key_size, passphrase, strlen(passphrase)), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, 0x080000);
+       EQ_(keyslots_size, 0x080000);
+       CRYPT_FREE(cd);
+       // default
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_get_metadata_size(cd, &default_mdata_size, &default_keyslots_size));
+       EQ_(default_mdata_size, 0x04000);
+       EQ_(default_keyslots_size, (r_header_size * 512) - 2 * 0x04000);
+       CRYPT_FREE(cd);
+       // check keyslots size calculation is correct
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_set_metadata_size(cd, 0x80000, 0));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, 0x80000);
+       EQ_(keyslots_size, (r_header_size * 512) - 2 * 0x80000);
+       CRYPT_FREE(cd);
+
+       // various metadata size checks combined with data offset
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_set_metadata_size(cd, 0, default_keyslots_size + 4096));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Device is too small.");
+       OK_(crypt_set_metadata_size(cd, 0x20000, (r_header_size * 512) - 2 * 0x20000 + 4096));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Device is too small.");
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_set_metadata_size(cd, 0x80000, 0));
+       OK_(crypt_set_data_offset(cd, 0x80000 / 512 - 8));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Data offset is too small.");
+       CRYPT_FREE(cd);
+
+       // H_DEVICE_WRONG size is 7MiB
+       OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, default_mdata_size);
+       EQ_(keyslots_size, (r_header_wrong_size * 512) - 2 * default_mdata_size);
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG));
+       OK_(crypt_set_metadata_size(cd, 0x400000, 0));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params), "Device is too small.");
+       CRYPT_FREE(cd);
+
+       // IMAGE_EMPTY_SMALL size is 7MiB but now it's regulare file
+       OK_(crypt_init(&cd, IMAGE_EMPTY_SMALL));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, default_mdata_size);
+       EQ_(keyslots_size, default_keyslots_size);
+       EQ_(crypt_get_data_offset(cd), 0);
+       CRYPT_FREE(cd);
+
+       sprintf(tmp, "truncate -s %" PRIu64 " " IMAGE_EMPTY_SMALL, r_header_wrong_size * 512);
+       _system(tmp, 1);
+
+       // check explicit keyslots size and data offset are respected even with regular file mdevice
+       OK_(crypt_init(&cd, IMAGE_EMPTY_SMALL));
+       OK_(crypt_set_metadata_size(cd, 0, default_keyslots_size));
+       OK_(crypt_set_data_offset(cd, r_header_size + 8));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, default_mdata_size);
+       EQ_(keyslots_size, default_keyslots_size);
+       EQ_(crypt_get_data_offset(cd), r_header_size + 8);
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void UseTempVolumes(void)
+{
+       char tmp[256];
+
+       // Tepmporary device without keyslot but with on-disk LUKS header
+       OK_(crypt_init(&cd, DEVICE_2));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0), "not yet formatted");
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 16, NULL));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0));
+       EQ_(crypt_status(cd, CDEVICE_2), CRYPT_ACTIVE);
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init_by_name(&cd, CDEVICE_2));
+       OK_(crypt_deactivate(cd, CDEVICE_2));
+       CRYPT_FREE(cd);
+
+       // Dirty checks: device without UUID
+       // we should be able to remove it but not manipulate with it
+       snprintf(tmp, sizeof(tmp), "dmsetup create %s --table \""
+               "0 100 crypt aes-cbc-essiv:sha256 deadbabedeadbabedeadbabedeadbabe 0 "
+               "%s 2048\"", CDEVICE_2, DEVICE_2);
+       _system(tmp, 1);
+       OK_(crypt_init_by_name(&cd, CDEVICE_2));
+       OK_(crypt_deactivate(cd, CDEVICE_2));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0), "No known device type");
+       CRYPT_FREE(cd);
+
+       // Dirty checks: device with UUID but LUKS header key fingerprint must fail)
+       snprintf(tmp, sizeof(tmp), "dmsetup create %s --table \""
+               "0 100 crypt aes-cbc-essiv:sha256 deadbabedeadbabedeadbabedeadbabe 0 "
+               "%s 2048\" -u CRYPT-LUKS2-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-ctest1",
+                CDEVICE_2, DEVICE_2);
+       _system(tmp, 1);
+       OK_(crypt_init_by_name(&cd, CDEVICE_2));
+       OK_(crypt_deactivate(cd, CDEVICE_2));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0), "wrong volume key");
+       CRYPT_FREE(cd);
+
+       // No slots
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0), "volume key is lost");
+       CRYPT_FREE(cd);
+}
+
+static void Luks2HeaderRestore(void)
+{
+       char key[128];
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha256",
+               .parallel_threads = 4,
+               .max_memory_kb = 1024,
+               .time_ms = 1
+       };
+       struct crypt_params_luks2 params = {
+               .pbkdf = &pbkdf,
+               .data_alignment = 8192, // 4M, data offset will be 4096
+               .sector_size = 512
+       };
+       struct crypt_params_plain pl_params = {
+               .hash = "sha1",
+               .skip = 0,
+               .offset = 0,
+               .size = 0
+       };
+       struct crypt_params_luks1 luks1 = {
+               .data_alignment = 8192, // 4M offset to pass alignment test
+       };
+       uint32_t flags = 0;
+
+       const char *mk_hex = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       size_t key_size = strlen(mk_hex) / 2;
+       const char *cipher = "aes";
+       const char *cipher_mode = "cbc-essiv:sha256";
+       uint64_t r_payload_offset;
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+       }
+
+       crypt_decode_key(key, mk_hex, key_size);
+
+       OK_(get_luks2_offsets(1, params.data_alignment, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 5000));
+
+       // do not restore header over plain device
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &pl_params));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       FAIL_(crypt_header_restore(cd, CRYPT_PLAIN, NO_REQS_LUKS2_HEADER), "Cannot restore header to PLAIN type device");
+       FAIL_(crypt_header_restore(cd, CRYPT_LUKS2, NO_REQS_LUKS2_HEADER), "Cannot restore header over PLAIN type device");
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       // FIXME: does following test make a sense in LUKS2?
+       // volume key_size mismatch
+       // OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       // memcpy(key2, key, key_size / 2);
+       // OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key2, key_size / 2, &params));
+       // FAIL_(crypt_header_restore(cd, CRYPT_LUKS2, VALID_LUKS2_HEADER), "Volume keysize mismatch");
+       // CRYPT_FREE(cd);
+
+       // payload offset mismatch
+       params.data_alignment = 8193;
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       FAIL_(crypt_header_restore(cd, CRYPT_LUKS2, NO_REQS_LUKS2_HEADER), "Payload offset mismatch");
+       CRYPT_FREE(cd);
+       params.data_alignment = 4096;
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       // FIXME: either format has to fail or next line must be true
+       // EQ_(crypt_get_data_offset(cd), params.data_alignment);
+       // FAIL_(crypt_header_restore(cd, CRYPT_LUKS2, VALID_LUKS2_HEADER), "Payload offset mismatch");
+       CRYPT_FREE(cd);
+
+       // do not allow restore over LUKS1 header on device
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, NULL, 32, &luks1));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       FAIL_(crypt_header_restore(cd, CRYPT_LUKS2, NO_REQS_LUKS2_HEADER), "LUKS1 format detected");
+       CRYPT_FREE(cd);
+
+       /* check crypt_header_restore() properly loads crypt_device context */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_wipe(cd, NULL, CRYPT_WIPE_ZERO, 0, 1*1024*1024, 1*1024*1024, 0, NULL, NULL));
+       OK_(crypt_header_restore(cd, CRYPT_LUKS2, NO_REQS_LUKS2_HEADER));
+       /* check LUKS2 specific API call returns non-error code */
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &flags));
+       EQ_(flags, 0);
+       /* same test, any LUKS */
+       OK_(crypt_wipe(cd, NULL, CRYPT_WIPE_ZERO, 0, 1*1024*1024, 1*1024*1024, 0, NULL, NULL));
+       OK_(crypt_header_restore(cd, CRYPT_LUKS, NO_REQS_LUKS2_HEADER));
+       /* check LUKS2 specific API call returns non-error code */
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &flags));
+       EQ_(flags, 0);
+
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void Luks2HeaderLoad(void)
+{
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha256",
+               .parallel_threads = 4,
+               .max_memory_kb = 1024,
+               .time_ms = 1
+       };
+       struct crypt_params_luks2 params = {
+               .pbkdf = &pbkdf,
+               .data_alignment = 8192, // 4M, data offset will be 4096
+               .data_device = DEVICE_2,
+               .sector_size = 512
+       };
+       struct crypt_params_plain pl_params = {
+               .hash = "sha1",
+               .skip = 0,
+               .offset = 0,
+               .size = 0
+       };
+       char key[128], cmd[256];
+
+       const char *mk_hex = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       size_t key_size = strlen(mk_hex) / 2;
+       const char *cipher = "aes";
+       const char *cipher_mode = "cbc-essiv:sha256";
+       uint64_t r_payload_offset, r_header_size, img_size;
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+       }
+
+       crypt_decode_key(key, mk_hex, key_size);
+
+       // hardcoded values for existing image IMAGE1
+       img_size = 8192;
+       // prepare test env
+       OK_(get_luks2_offsets(1, 0, 0, &r_header_size, &r_payload_offset));
+       // external header device
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       // prepared header on a device too small to contain header and payload
+       //OK_(create_dmdevice_over_loop(H_DEVICE_WRONG, r_payload_offset - 1));
+       OK_(create_dmdevice_over_loop(H_DEVICE_WRONG, img_size - 1));
+       snprintf(cmd, sizeof(cmd), "dd if=" IMAGE1 " of=" DMDIR H_DEVICE_WRONG " bs=%" PRIu32 " count=%" PRIu64 " 2>/dev/null", params.sector_size, img_size - 1);
+       OK_(_system(cmd, 1));
+       // some device
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1000));
+       // 1 sector device
+       OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_header_size + 1));
+       // 0 sectors device for payload
+       OK_(create_dmdevice_over_loop(L_DEVICE_0S, r_header_size));
+
+       // valid metadata and device size
+       params.data_alignment = 0;
+       params.data_device = DMDIR L_DEVICE_OK;
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(!crypt_get_metadata_device_name(cd));
+       EQ_(strcmp(DMDIR H_DEVICE, crypt_get_metadata_device_name(cd)), 0);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       // repeat with init with two devices
+       OK_(crypt_init_data_device(&cd, DMDIR H_DEVICE, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       CRYPT_FREE(cd);
+       OK_(crypt_init_data_device(&cd, DMDIR H_DEVICE, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(!crypt_get_metadata_device_name(cd));
+       EQ_(strcmp(DMDIR H_DEVICE, crypt_get_metadata_device_name(cd)), 0);
+       CRYPT_FREE(cd);
+
+       // bad header: device too small (payloadOffset > device_size)
+       OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG));
+       FAIL_(crypt_load(cd, CRYPT_LUKS2, NULL), "Device too small");
+       NULL_(crypt_get_type(cd));
+       CRYPT_FREE(cd);
+
+       // 0 secs for encrypted data area
+       params.data_alignment = 8192;
+       params.data_device = NULL;
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       CRYPT_FREE(cd);
+       // load should be ok
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Device too small");
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
+       CRYPT_FREE(cd);
+
+       // damaged header
+       OK_(_system("dd if=/dev/zero of=" DMDIR L_DEVICE_OK " bs=512 count=8 2>/dev/null", 1));
+       OK_(_system("dd if=/dev/zero of=" DMDIR L_DEVICE_OK " bs=512 seek=32 count=8 2>/dev/null", 1));
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       FAIL_(crypt_load(cd, CRYPT_LUKS2, NULL), "Header not found");
+       CRYPT_FREE(cd);
+
+       // plain device
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       FAIL_(crypt_load(cd, CRYPT_PLAIN, NULL), "Can't load nonLUKS device type");
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, key, key_size, &pl_params));
+       FAIL_(crypt_load(cd, CRYPT_LUKS2, NULL), "Can't load over nonLUKS device type");
+       CRYPT_FREE(cd);
+
+       //LUKSv2 device
+       OK_(crypt_init(&cd, DEVICE_4));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DEVICE_4));
+       crypt_set_iteration_time(cd, 0); /* invalid for argon2 pbkdf, ignored */
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       CRYPT_FREE(cd);
+
+       /* check load sets proper device type */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       EQ_(strcmp(CRYPT_LUKS2, crypt_get_type(cd)), 0);
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void Luks2HeaderBackup(void)
+{
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha256",
+               .parallel_threads = 4,
+               .max_memory_kb = 1024,
+               .time_ms = 1
+       };
+       struct crypt_params_luks2 params = {
+               .pbkdf = &pbkdf,
+               .data_alignment = 8192, // 4M, data offset will be 4096
+               .data_device = DEVICE_2,
+               .sector_size = 512
+       };
+       char key[128];
+       int fd, ro = O_RDONLY;
+
+       const char *mk_hex = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       size_t key_size = strlen(mk_hex) / 2;
+       const char *cipher = "aes";
+       const char *cipher_mode = "cbc-essiv:sha256";
+       uint64_t r_payload_offset;
+
+       const char *passphrase = PASSPHRASE;
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+       }
+
+       crypt_decode_key(key, mk_hex, key_size);
+
+       OK_(get_luks2_offsets(0, params.data_alignment, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1));
+
+       // create LUKS device and backup the header
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 7, key, key_size, passphrase, strlen(passphrase)), 7);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, key, key_size, passphrase, strlen(passphrase)), 0);
+       OK_(crypt_header_backup(cd, CRYPT_LUKS2, BACKUP_FILE));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       // restore header from backup
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_header_restore(cd, CRYPT_LUKS2, BACKUP_FILE));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       // exercise luksOpen using backup header in file
+       OK_(crypt_init(&cd, BACKUP_FILE));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_OK));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, passphrase, strlen(passphrase), 0), 0);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, BACKUP_FILE));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_OK));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 7, passphrase, strlen(passphrase), 0), 7);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       // exercise luksOpen using backup header on block device
+       fd = loop_attach(&DEVICE_3, BACKUP_FILE, 0, 0, &ro);
+       NOTFAIL_(fd, "Bad loop device.");
+       close(fd);
+       OK_(crypt_init(&cd, DEVICE_3));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_OK));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, passphrase, strlen(passphrase), 0), 0);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DEVICE_3));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_OK));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 7, passphrase, strlen(passphrase), 0), 7);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void ResizeDeviceLuks2(void)
+{
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha256",
+               .parallel_threads = 4,
+               .max_memory_kb = 1024,
+               .time_ms = 1
+       };
+       struct crypt_params_luks2 params = {
+               .pbkdf = &pbkdf,
+               .data_alignment = 8192, // 4M, data offset will be 4096
+               .sector_size = 512
+       };
+       char key[128];
+
+       const char *mk_hex = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       size_t key_size = strlen(mk_hex) / 2;
+       const char *cipher = "aes";
+       const char *cipher_mode = "cbc-essiv:sha256";
+       uint64_t r_payload_offset, r_header_size, r_size;
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+       }
+
+       crypt_decode_key(key, mk_hex, key_size);
+
+       // prepare env
+       OK_(get_luks2_offsets(1, params.data_alignment, 0, NULL, &r_payload_offset));
+       OK_(get_luks2_offsets(1, 0, 0, &r_header_size, NULL));
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1000));
+       OK_(create_dmdevice_over_loop(L_DEVICE_0S, 1000));
+       OK_(create_dmdevice_over_loop(L_DEVICE_WRONG, r_payload_offset + 1000));
+
+       // test header and encrypted payload all in one device
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       // disable loading VKs in kernel keyring (compatible mode)
+       OK_(crypt_volume_key_keyring(cd, 0));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       OK_(crypt_resize(cd, CDEVICE_1, 0));
+       OK_(crypt_resize(cd, CDEVICE_1, 42));
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
+               EQ_(42, r_size >> SECTOR_SHIFT);
+       OK_(crypt_resize(cd, CDEVICE_1, 0));
+       // autodetect encrypted device area size
+       OK_(crypt_resize(cd, CDEVICE_1, 0));
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
+               EQ_(1000, r_size >> SECTOR_SHIFT);
+       FAIL_(crypt_resize(cd, CDEVICE_1, 1001), "Device too small");
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
+               EQ_(1000, r_size >> SECTOR_SHIFT);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       params.data_alignment = 0;
+       params.data_device = DMDIR L_DEVICE_0S;
+       // test case for external header
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       OK_(crypt_resize(cd, CDEVICE_1, 666));
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
+               EQ_(666, r_size >> SECTOR_SHIFT);
+       // autodetect encrypted device size
+       OK_(crypt_resize(cd, CDEVICE_1, 0));
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
+               EQ_(1000, r_size >> SECTOR_SHIFT);
+       FAIL_(crypt_resize(cd, CDEVICE_1, 1001), "Device too small");
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
+               EQ_(1000, r_size >> SECTOR_SHIFT);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+#ifdef KERNEL_KEYRING
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       // enable loading VKs in kernel keyring (default mode)
+       OK_(crypt_volume_key_keyring(cd, 1));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       // erase volume key from kernel keyring
+       if (t_dm_crypt_keyring_support())
+               OK_(_drop_keyring_key(cd, 0));
+       else
+               FAIL_(_drop_keyring_key(cd, 0), "key not found");
+       // same size is ok
+       OK_(crypt_resize(cd, CDEVICE_1, 0));
+       // kernel fails to find the volume key in keyring
+       if (t_dm_crypt_keyring_support())
+               FAIL_(crypt_resize(cd, CDEVICE_1, 42), "Unable to find volume key in keyring");
+       else
+               OK_(crypt_resize(cd, CDEVICE_1, 42));
+       // test mode must not load vk in keyring
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
+       if (t_dm_crypt_keyring_support())
+               FAIL_(crypt_resize(cd, CDEVICE_1, 44), "VK must be in keyring to perform resize");
+       else
+               OK_(crypt_resize(cd, CDEVICE_1, 44));
+       // reinstate the volume key in keyring
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, t_dm_crypt_keyring_support() ? CRYPT_ACTIVATE_KEYRING_KEY : 0));
+       OK_(crypt_resize(cd, CDEVICE_1, 43));
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
+               EQ_(43, r_size >> SECTOR_SHIFT);
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       // check userspace gets hint volume key must be properly loaded in kernel keyring
+       if (t_dm_crypt_keyring_support())
+               EQ_(crypt_resize(cd, CDEVICE_1, 0), -EPERM);
+       else
+               OK_(crypt_resize(cd, CDEVICE_1, 0));
+       CRYPT_FREE(cd);
+
+       // same as above for handles initialised by name
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       if (t_dm_crypt_keyring_support())
+               EQ_(crypt_resize(cd, CDEVICE_1, 0), -EPERM);
+       else
+               OK_(crypt_resize(cd, CDEVICE_1, 0));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+#endif
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, NULL, NULL));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+
+       /* create second LUKS2 device */
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_WRONG));
+       OK_(crypt_format(cd2, CRYPT_LUKS2, cipher, cipher_mode, crypt_get_uuid(cd), key, key_size, &params));
+       OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, key_size, 0));
+       /* do not allow resize of other device */
+       FAIL_(crypt_resize(cd2, CDEVICE_1, 1), "Device got resized by wrong device context.");
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd2);
+
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_WRONG));
+       crypt_set_iteration_time(cd2, 1);
+       OK_(crypt_format(cd2, CRYPT_LUKS1, cipher, cipher_mode, crypt_get_uuid(cd), key, key_size, NULL));
+       OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, key_size, 0));
+       FAIL_(crypt_resize(cd2, CDEVICE_1, 1), "Device got resized by wrong device context.");
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd2);
+
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_WRONG));
+       OK_(crypt_format(cd2, CRYPT_PLAIN, cipher, cipher_mode, NULL, key, key_size, NULL));
+       OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, key_size, 0));
+       FAIL_(crypt_resize(cd2, CDEVICE_1, 1), "Device got resized by wrong device context.");
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd2);
+
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void TokenActivationByKeyring(void)
+{
+#ifdef KERNEL_KEYRING
+       key_serial_t kid, kid1;
+       struct crypt_active_device cad;
+
+       const char *cipher = "aes";
+       const char *cipher_mode = "xts-plain64";
+
+       const struct crypt_token_params_luks2_keyring params = {
+               .key_description = KEY_DESC_TEST0
+       }, params2 = {
+               .key_description = KEY_DESC_TEST1
+       };
+       uint64_t r_payload_offset;
+
+       if (!t_dm_crypt_keyring_support()) {
+               printf("WARNING: Kernel keyring not supported, skipping test.\n");
+               return;
+       }
+
+       kid = add_key("user", KEY_DESC_TEST0, PASSPHRASE, strlen(PASSPHRASE), KEY_SPEC_THREAD_KEYRING);
+       NOTFAIL_(kid, "Test or kernel keyring are broken.");
+
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_payload_offset + 1));
+
+       // prepare the device
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, NULL));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_token_luks2_keyring_set(cd, 3, &params), 3);
+       EQ_(crypt_token_assign_keyslot(cd, 3, 0), 3);
+       CRYPT_FREE(cd);
+
+       // test thread keyring key in token 0
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 3, NULL, 0), 0);
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 3, NULL, 0), "already open");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       NOTFAIL_(keyctl_unlink(kid, KEY_SPEC_THREAD_KEYRING), "Test or kernel keyring are broken.");
+
+       kid = add_key("user", KEY_DESC_TEST0, PASSPHRASE, strlen(PASSPHRASE), KEY_SPEC_PROCESS_KEYRING);
+       NOTFAIL_(kid, "Test or kernel keyring are broken.");
+
+       // add token 1 with process keyring key
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_token_json_set(cd, 3, NULL), 3);
+       EQ_(crypt_token_luks2_keyring_set(cd, 1, &params), 1);
+       EQ_(crypt_token_assign_keyslot(cd, 1, 0), 1);
+       CRYPT_FREE(cd);
+
+       // test process keyring key in token 1
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 1, NULL, 0), 0);
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 1, NULL, 0), "already open");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       NOTFAIL_(keyctl_unlink(kid, KEY_SPEC_PROCESS_KEYRING), "Test or kernel keyring are broken.");
+
+       // create two tokens and let the cryptsetup unlock the volume with the valid one
+       kid = add_key("user", KEY_DESC_TEST0, PASSPHRASE, strlen(PASSPHRASE), KEY_SPEC_THREAD_KEYRING);
+       NOTFAIL_(kid, "Test or kernel keyring are broken.");
+
+       kid1 = add_key("user", KEY_DESC_TEST1, PASSPHRASE1, strlen(PASSPHRASE1), KEY_SPEC_THREAD_KEYRING);
+       NOTFAIL_(kid1, "Test or kernel keyring are broken.");
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_token_luks2_keyring_set(cd, 0, &params), 0);
+       EQ_(crypt_token_assign_keyslot(cd, 0, 0), 0);
+       EQ_(crypt_token_luks2_keyring_set(cd, 1, &params2), 1);
+       FAIL_(crypt_token_assign_keyslot(cd, 1, 1), "Keyslot 1 doesn't exist");
+       crypt_set_iteration_time(cd, 1);
+       EQ_(crypt_keyslot_add_by_passphrase(cd, 1, PASSPHRASE, strlen(PASSPHRASE), PASSPHRASE1, strlen(PASSPHRASE1)), 1);
+       EQ_(crypt_token_assign_keyslot(cd, 1, 1), 1);
+       CRYPT_FREE(cd);
+
+       // activate by specific token
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 0, NULL, 0), 0);
+       if (t_dm_crypt_keyring_support()) {
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               EQ_(cad.flags & CRYPT_ACTIVATE_KEYRING_KEY, CRYPT_ACTIVATE_KEYRING_KEY);
+       }
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 1, NULL, 0), 1);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       NOTFAIL_(keyctl_unlink(kid, KEY_SPEC_THREAD_KEYRING), "Test or kernel keyring are broken.");
+
+       // activate by any token with token 0 having absent pass from keyring
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, CRYPT_ANY_TOKEN, NULL, 0), 1);
+       if (t_dm_crypt_keyring_support()) {
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               EQ_(cad.flags & CRYPT_ACTIVATE_KEYRING_KEY, CRYPT_ACTIVATE_KEYRING_KEY);
+       }
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       kid = add_key("user", KEY_DESC_TEST0, PASSPHRASE, strlen(PASSPHRASE), KEY_SPEC_THREAD_KEYRING);
+       NOTFAIL_(kid, "Test or kernel keyring are broken.");
+
+       // replace pass for keyslot 0 making token 0 invalid
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_keyslot_destroy(cd, 0));
+       crypt_set_iteration_time(cd, 1);
+       EQ_(crypt_keyslot_add_by_passphrase(cd, 0, PASSPHRASE1, strlen(PASSPHRASE1), PASSPHRASE1, strlen(PASSPHRASE1)), 0);
+       CRYPT_FREE(cd);
+
+       // activate by any token with token 0 having wrong pass for keyslot 0
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, CRYPT_ANY_TOKEN, NULL, 0), 1);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+        // create new device, with two tokens:
+        // 1st token being invalid (missing key in keyring)
+        // 2nd token can activate keyslot 1 after failing to do so w/ keyslot 0 (wrong pass)
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, NULL));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 1, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1)), 1);
+       EQ_(crypt_token_luks2_keyring_set(cd, 0, &params), 0);
+       EQ_(crypt_token_assign_keyslot(cd, 0, 0), 0);
+       EQ_(crypt_token_luks2_keyring_set(cd, 2, &params2), 2);
+       EQ_(crypt_token_assign_keyslot(cd, 2, 1), 2);
+       CRYPT_FREE(cd);
+
+       NOTFAIL_(keyctl_unlink(kid, KEY_SPEC_THREAD_KEYRING), "Test or kernel keyring are broken.");
+
+       kid1 = add_key("user", KEY_DESC_TEST1, PASSPHRASE1, strlen(PASSPHRASE1), KEY_SPEC_THREAD_KEYRING);
+       NOTFAIL_(kid1, "Test or kernel keyring are broken.");
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, CRYPT_ANY_TOKEN, NULL, 0), 1);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+       _cleanup_dmdevices();
+#else
+       printf("WARNING: cryptsetup compiled with kernel keyring service disabled, skipping test.\n");
+#endif
+}
+
+static void Tokens(void)
+{
+#define TEST_TOKEN_JSON(x) "{\"type\":\"test_token\",\"keyslots\":[" x "]," \
+                       "\"key_length\":32,\"a_field\":\"magic_string\"}"
+
+#define TEST_TOKEN_JSON_INVALID(x) "{\"type\":\"test_token\",\"keyslots\":[" x "]," \
+                       "\"key_length\":32}"
+
+#define TEST_TOKEN1_JSON(x) "{\"type\":\"test_token1\",\"keyslots\":[" x "]," \
+                       "\"key_length\":32,\"a_field\":\"magic_string\"}"
+
+#define TEST_TOKEN1_JSON_INVALID(x) "{\"type\":\"test_token1\",\"keyslots\":[" x "]," \
+                       "\"key_length\":32}"
+
+#define BOGUS_TOKEN0_JSON "{\"type\":\"luks2-\",\"keyslots\":[]}"
+#define BOGUS_TOKEN1_JSON "{\"type\":\"luks2-a\",\"keyslots\":[]}"
+
+#define LUKS2_KEYRING_TOKEN_JSON(x, y) "{\"type\":\"luks2-keyring\",\"keyslots\":[" x "]," \
+                       "\"key_description\":" y "}"
+
+#define LUKS2_KEYRING_TOKEN_JSON_BAD(x, y) "{\"type\":\"luks2-keyring\",\"keyslots\":[" x "]," \
+                       "\"key_description\":" y ", \"some_field\":\"some_value\"}"
+
+
+       const char *dummy;
+       const char *cipher = "aes";
+       const char *cipher_mode = "xts-plain64";
+       char passptr[] = PASSPHRASE;
+       char passptr1[] = PASSPHRASE1;
+
+       static const crypt_token_handler th = {
+               .name = "test_token",
+               .open = test_open,
+               .validate = test_validate
+       }, th2 = {
+               .name = "test_token",
+               .open = test_open
+       }, th3 = {
+               .name = "test_token1",
+               .open = test_open,
+               .validate = test_validate
+       }, th_reserved = {
+               .name = "luks2-prefix",
+               .open = test_open
+       };
+
+       struct crypt_token_params_luks2_keyring params = {
+               .key_description = "desc"
+       };
+       uint64_t r_payload_offset;
+
+       OK_(crypt_token_register(&th));
+       FAIL_(crypt_token_register(&th2), "Token handler with the name already registered.");
+
+       FAIL_(crypt_token_register(&th_reserved), "luks2- is reserved prefix");
+
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_payload_offset + 1));
+
+       // basic token API tests
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, NULL));
+       EQ_(crypt_token_status(cd, -1, NULL), CRYPT_TOKEN_INVALID);
+       EQ_(crypt_token_status(cd, 32, NULL), CRYPT_TOKEN_INVALID);
+       EQ_(crypt_token_status(cd, 0, NULL), CRYPT_TOKEN_INACTIVE);
+       EQ_(crypt_token_status(cd, 31, NULL), CRYPT_TOKEN_INACTIVE);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 1, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1)), 1);
+       FAIL_(crypt_token_json_set(cd, CRYPT_ANY_TOKEN, TEST_TOKEN_JSON_INVALID("\"0\"")), "Token validation failed");
+       EQ_(crypt_token_json_set(cd, CRYPT_ANY_TOKEN, TEST_TOKEN_JSON("\"0\"")), 0);
+       EQ_(crypt_token_status(cd, 0, NULL), CRYPT_TOKEN_EXTERNAL);
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 0, passptr, 0), 0);
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 0, passptr, 0), "already active");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       // write invalid token and verify that validate() can detect it after handler being registered
+       EQ_(crypt_token_json_set(cd, CRYPT_ANY_TOKEN, TEST_TOKEN1_JSON_INVALID("\"1\"")), 1);
+       EQ_(crypt_token_status(cd, 1, NULL), CRYPT_TOKEN_EXTERNAL_UNKNOWN);
+       EQ_(crypt_token_json_set(cd, CRYPT_ANY_TOKEN, TEST_TOKEN1_JSON("\"1\"")), 2);
+       EQ_(crypt_token_status(cd, 2, &dummy), CRYPT_TOKEN_EXTERNAL_UNKNOWN);
+       OK_(strcmp(dummy, "test_token1"));
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 1, passptr1, 0), "Unknown token handler");
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 2, passptr1, 0), "Unknown token handler");
+       OK_(crypt_token_register(&th3));
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 1, passptr1, 0), "Token validation failed");
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 2, passptr1, 0), 1);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       // test crypt_token_json_get returns correct token id
+       EQ_(crypt_token_json_get(cd, 2, &dummy), 2);
+
+       // exercise assign/unassign keyslots API
+       EQ_(crypt_token_unassign_keyslot(cd, 2, 1), 2);
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 2, passptr1, 0), "Token assigned to no keyslot");
+       EQ_(crypt_token_assign_keyslot(cd, 2, 0), 2);
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 2, passptr1, 0), "Wrong passphrase");
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 2, passptr, 0), 0);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_token_json_set(cd, 1, NULL), 1);
+       FAIL_(crypt_token_json_get(cd, 1, &dummy), "Token is not there");
+       EQ_(crypt_token_unassign_keyslot(cd, 2, CRYPT_ANY_SLOT), 2);
+       EQ_(crypt_token_unassign_keyslot(cd, 0, CRYPT_ANY_SLOT), 0);
+
+       // various tests related to unassigned keyslot to volume segment
+       EQ_(crypt_keyslot_add_by_key(cd, 3, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT), 3);
+       EQ_(crypt_token_assign_keyslot(cd, 2, 0), 2);
+       EQ_(crypt_token_assign_keyslot(cd, 0, 3), 0);
+
+       EQ_(crypt_activate_by_token(cd, NULL, 2, passptr, 0), 0);
+       EQ_(crypt_activate_by_token(cd, NULL, 0, passptr1, CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY), 3);
+       // FIXME: useless error message here (or missing one to be specific)
+       FAIL_(crypt_activate_by_token(cd, CDEVICE_1, 0, passptr1, 0), "No volume key available in token keyslots");
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 2, passptr, 0), 0);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_token_assign_keyslot(cd, 0, 1), 0);
+       OK_(crypt_token_is_assigned(cd, 0, 1));
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 0, passptr1, 0), 1);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       EQ_(crypt_token_assign_keyslot(cd, 2, 3), 2);
+       OK_(crypt_token_is_assigned(cd, 2, 3));
+       EQ_(crypt_activate_by_token(cd, NULL, 2, passptr, 0), 0);
+       EQ_(crypt_activate_by_token(cd, CDEVICE_1, 2, passptr, 0), 0);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+#ifdef KERNEL_KEYRING
+       if (t_dm_crypt_keyring_support()) {
+               EQ_(crypt_activate_by_token(cd, NULL, 2, passptr, CRYPT_ACTIVATE_KEYRING_KEY), 0);
+               OK_(_volume_key_in_keyring(cd, 0));
+       }
+       OK_(crypt_volume_key_keyring(cd, 0));
+#endif
+       FAIL_(crypt_activate_by_token(cd, NULL, 2, passptr, CRYPT_ACTIVATE_KEYRING_KEY), "Can't use keyring when disabled in library");
+       OK_(crypt_volume_key_keyring(cd, 1));
+
+       EQ_(crypt_token_luks2_keyring_set(cd, 5, &params), 5);
+       EQ_(crypt_token_status(cd, 5, &dummy), CRYPT_TOKEN_INTERNAL);
+       OK_(strcmp(dummy, "luks2-keyring"));
+
+       FAIL_(crypt_token_luks2_keyring_get(cd, 2, &params), "Token is not luks2-keyring type");
+
+       FAIL_(crypt_token_json_set(cd, CRYPT_ANY_TOKEN, BOGUS_TOKEN0_JSON), "luks2- reserved prefix.");
+       FAIL_(crypt_token_json_set(cd, CRYPT_ANY_TOKEN, BOGUS_TOKEN1_JSON), "luks2- reserved prefix.");
+
+       // test we can use crypt_token_json_set for valid luks2-keyring token
+       FAIL_(crypt_token_json_set(cd, 12, LUKS2_KEYRING_TOKEN_JSON_BAD("\"0\"", "\"my_desc_x\"")), "Strict luks2-keyring token validation failed");
+       EQ_(crypt_token_status(cd, 12, NULL), CRYPT_TOKEN_INACTIVE);
+       FAIL_(crypt_token_json_set(cd, 12, LUKS2_KEYRING_TOKEN_JSON("\"5\"", "\"my_desc\"")), "Missing keyslot 5.");
+       EQ_(crypt_token_json_set(cd, 10, LUKS2_KEYRING_TOKEN_JSON("\"1\"", "\"my_desc\"")), 10);
+       EQ_(crypt_token_status(cd, 10, &dummy), CRYPT_TOKEN_INTERNAL);
+       OK_(strcmp(dummy, "luks2-keyring"));
+       params.key_description = NULL;
+       EQ_(crypt_token_luks2_keyring_get(cd, 10, &params), 10);
+       OK_(strcmp(params.key_description, "my_desc"));
+
+       OK_(crypt_token_is_assigned(cd, 10, 1));
+       // unassigned tests
+       EQ_(crypt_token_is_assigned(cd, 10, 21), -ENOENT);
+       EQ_(crypt_token_is_assigned(cd, 21, 1), -ENOENT);
+       // wrong keyslot or token id tests
+       EQ_(crypt_token_is_assigned(cd, -1, 1), -EINVAL);
+       EQ_(crypt_token_is_assigned(cd, 32, 1), -EINVAL);
+       EQ_(crypt_token_is_assigned(cd, 10, -1), -EINVAL);
+       EQ_(crypt_token_is_assigned(cd, 10, 32), -EINVAL);
+       EQ_(crypt_token_is_assigned(cd, -1, -1), -EINVAL);
+       EQ_(crypt_token_is_assigned(cd, 32, 32), -EINVAL);
+
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void LuksConvert(void)
+{
+       uint64_t offset, r_payload_offset;
+
+       const char *json = "{\"type\":\"convert_block\",\"keyslots\":[]}";
+       const struct crypt_pbkdf_type argon = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha512",
+               .time_ms = 1,
+               .max_memory_kb = 1024,
+               .parallel_threads = 1
+       }, pbkdf2 = {
+               .type = CRYPT_KDF_PBKDF2,
+               .hash = "sha1",
+               .time_ms = 1
+       };
+
+       struct crypt_params_luks1 luks1 = {
+               .hash = "sha256",
+               .data_device = DMDIR L_DEVICE_1S
+       };
+
+       struct crypt_params_luks2 luks2 = {
+               .pbkdf = &pbkdf2,
+               .sector_size = 512
+       };
+
+       const char *cipher = "aes";
+       const char *cipher_mode = "xts-plain64";
+
+       // prepare the device
+       OK_(crypt_init(&cd, DEVICE_1));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, NULL, 32, NULL));
+       offset = crypt_get_data_offset(cd);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 7, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1)), 7);
+       CRYPT_FREE(cd);
+
+       // convert LUKSv1 -> LUKSv2
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "format is already LUKSv1");
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       FAIL_(crypt_convert(cd, CRYPT_LUKS2, NULL), "device is active");
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS1));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS2));
+       CRYPT_FREE(cd);
+
+       // check result
+       OK_(crypt_init(&cd, DEVICE_1));
+       FAIL_(crypt_load(cd, CRYPT_LUKS1, NULL), "wrong luks format");
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS2));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE1, strlen(PASSPHRASE1), 0), 7);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       FAIL_(crypt_convert(cd, CRYPT_LUKS2, NULL), "format is already LUKSv2");
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS2));
+       CRYPT_FREE(cd);
+
+       // convert LUKSv2 -> LUKSv1
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "device is active");
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS2));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS1));
+       CRYPT_FREE(cd);
+
+       // check result
+       OK_(crypt_init(&cd, DEVICE_1));
+       FAIL_(crypt_load(cd, CRYPT_LUKS2, NULL), "wrong luks format");
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS1));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE1, strlen(PASSPHRASE1), 0), 7);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "format is already LUKSv1");
+       OK_(strcmp(crypt_get_type(cd), CRYPT_LUKS1));
+       CRYPT_FREE(cd);
+
+       // exercice non-pbkdf2 LUKSv2 conversion
+       if (!_fips_mode) {
+               OK_(crypt_init(&cd, DEVICE_1));
+               OK_(crypt_set_data_offset(cd, offset));
+               OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, NULL));
+               OK_(crypt_set_pbkdf_type(cd, &argon));
+               EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+               FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "Incompatible pbkdf with LUKSv1 format");
+               CRYPT_FREE(cd);
+       }
+
+       // exercice non LUKS1 compatible keyslot
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_set_data_offset(cd, offset));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, &luks2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       // FIXME: following test fails as expected but for a different reason
+       FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "Unassigned keyslots are incompatible with LUKSv1 format");
+       CRYPT_FREE(cd);
+
+       // exercice LUKSv2 conversion with single pbkdf2 keyslot being active
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_set_data_offset(cd, offset));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, NULL));
+       offset = crypt_get_data_offset(cd);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       if (!_fips_mode) {
+               OK_(crypt_set_pbkdf_type(cd, &argon));
+               EQ_(crypt_keyslot_add_by_volume_key(cd, 1, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 1);
+               FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "Different hash for digest and keyslot.");
+               OK_(crypt_keyslot_destroy(cd, 1));
+       }
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       CRYPT_FREE(cd);
+
+       // do not allow conversion on keyslot No > 7
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_set_data_offset(cd, offset));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, &luks2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 8, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1)), 8);
+       FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "Can't convert keyslot No 8");
+       CRYPT_FREE(cd);
+
+       // do not allow conversion with token
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_set_data_offset(cd, offset));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, &luks2));
+       OK_(crypt_token_json_set(cd, CRYPT_ANY_TOKEN, json));
+       FAIL_(crypt_convert(cd, CRYPT_LUKS1, NULL), "Can't convert header with token.");
+       CRYPT_FREE(cd);
+
+       // should be enough for both luks1 and luks2 devices with all vk lengths
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_payload_offset + 1));
+
+       // do not allow conversion for legacy luks1 device (non-aligned keyslot offset)
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L1_256_LEGACY " of=" DMDIR L_DEVICE_1S " bs=1M count=2 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       FAIL_(crypt_convert(cd, CRYPT_LUKS2, NULL), "Can't convert device with unaligned keyslot offset");
+       CRYPT_FREE(cd);
+
+       /*
+        * do not allow conversion on images if there's not enough space between
+        * last keyslot and data offset (should not happen on headers created
+        * with cryptsetup)
+        */
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L1_256_UNMOVABLE " of=" DMDIR L_DEVICE_1S " bs=1M count=2 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       FAIL_(crypt_convert(cd, CRYPT_LUKS2, NULL), "Can't convert device with unaligned keyslot offset");
+       CRYPT_FREE(cd);
+
+       // compat conversion tests
+       // LUKS1 -> LUKS2
+
+       // 128b key
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L1_128 " of=" DMDIR L_DEVICE_1S " bs=1M count=2 oflag=direct 2>/dev/null", 1));
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS2), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 256b key
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L1_256 " of=" DMDIR L_DEVICE_1S " bs=1M count=2 oflag=direct 2>/dev/null", 1));
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS2), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 512b key
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L1_512 " of=" DMDIR L_DEVICE_1S " bs=1M count=2 oflag=direct 2>/dev/null", 1));
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS2), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // detached LUKS1 header conversion
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L1_128_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS2), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L1_128_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 256b key
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L1_256_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS2), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L1_256_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 512b key
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L1_512_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS2), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L1_512_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // LUKS2 -> LUKS1
+       // 128b key
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L2_128 " of=" DMDIR L_DEVICE_1S " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 128b all LUKS1 keyslots used
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L2_128_FULL " of=" DMDIR L_DEVICE_1S " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASS1, strlen(PASS1), 0), 1);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 2, PASS2, strlen(PASS2), 0), 2);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 3, PASS3, strlen(PASS3), 0), 3);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 4, PASS4, strlen(PASS4), 0), 4);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 5, PASS5, strlen(PASS5), 0), 5);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 6, PASS6, strlen(PASS6), 0), 6);
+       CRYPT_FREE(cd);
+
+       // 256b key
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L2_256 " of=" DMDIR L_DEVICE_1S " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 256b all LUKS1 keyslots used
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L2_256_FULL " of=" DMDIR L_DEVICE_1S " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASS1, strlen(PASS1), 0), 1);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 2, PASS2, strlen(PASS2), 0), 2);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 3, PASS3, strlen(PASS3), 0), 3);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 4, PASS4, strlen(PASS4), 0), 4);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 5, PASS5, strlen(PASS5), 0), 5);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 6, PASS6, strlen(PASS6), 0), 6);
+       CRYPT_FREE(cd);
+
+       // 512b key
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L2_512 " of=" DMDIR L_DEVICE_1S " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 512b all LUKS1 keyslots used
+       OK_(_system("dd if=" CONV_DIR "/" CONV_L2_512_FULL " of=" DMDIR L_DEVICE_1S " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASS1, strlen(PASS1), 0), 1);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 2, PASS2, strlen(PASS2), 0), 2);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 3, PASS3, strlen(PASS3), 0), 3);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 4, PASS4, strlen(PASS4), 0), 4);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 5, PASS5, strlen(PASS5), 0), 5);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 6, PASS6, strlen(PASS6), 0), 6);
+       CRYPT_FREE(cd);
+
+       // detached headers
+       // 128b
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_128_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_128_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 128b all LUKS1 keyslots used
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_128_DET_FULL));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_128_DET_FULL));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASS1, strlen(PASS1), 0), 1);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 2, PASS2, strlen(PASS2), 0), 2);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 3, PASS3, strlen(PASS3), 0), 3);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 4, PASS4, strlen(PASS4), 0), 4);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 5, PASS5, strlen(PASS5), 0), 5);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 6, PASS6, strlen(PASS6), 0), 6);
+       CRYPT_FREE(cd);
+
+       // 256b key
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_256_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_256_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 256b all LUKS1 keyslots used
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_256_DET_FULL));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_256_DET_FULL));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASS1, strlen(PASS1), 0), 1);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 2, PASS2, strlen(PASS2), 0), 2);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 3, PASS3, strlen(PASS3), 0), 3);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 4, PASS4, strlen(PASS4), 0), 4);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 5, PASS5, strlen(PASS5), 0), 5);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 6, PASS6, strlen(PASS6), 0), 6);
+       CRYPT_FREE(cd);
+
+       // 512b key
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_512_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       offset = crypt_get_data_offset(cd);
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_512_DET));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), offset);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       CRYPT_FREE(cd);
+
+       // 512b all LUKS1 keyslots used
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_512_DET_FULL));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_convert(cd, CRYPT_LUKS1, NULL));
+       EQ_(strcmp(crypt_get_type(cd), CRYPT_LUKS1), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, CONV_DIR "/" CONV_L2_512_DET_FULL));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 0, PASS0, strlen(PASS0), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 7, PASS7, strlen(PASS7), 0), 7);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASS1, strlen(PASS1), 0), 1);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 2, PASS2, strlen(PASS2), 0), 2);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 3, PASS3, strlen(PASS3), 0), 3);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 4, PASS4, strlen(PASS4), 0), 4);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 5, PASS5, strlen(PASS5), 0), 5);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 6, PASS6, strlen(PASS6), 0), 6);
+       CRYPT_FREE(cd);
+
+       // detached LUKS1 header upconversion
+       OK_(create_dmdevice_over_loop(H_DEVICE, 2050)); // default LUKS1 header should fit there
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       crypt_set_iteration_time(cd, 1);
+       //OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       OK_(crypt_format(cd, CRYPT_LUKS1, "aes", "xts-plain64", NULL, NULL, 32, &luks1));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 7, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 7);
+       FAIL_(crypt_convert(cd, CRYPT_LUKS2, NULL), "Unable to move keyslots. Not enough space.");
+       CRYPT_FREE(cd);
+
+       // 2050 sectors, empty file
+       OK_(crypt_init(&cd, IMAGE_EMPTY_SMALL_2));
+       //OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS1, "aes", "xts-plain64", NULL, NULL, 32, &luks1));
+       EQ_(crypt_get_data_offset(cd), 0);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 7, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 7);
+       OK_(crypt_convert(cd, CRYPT_LUKS2, NULL));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void Pbkdf(void)
+{
+       const struct crypt_pbkdf_type *pbkdf;
+
+       const char *cipher = "aes", *mode="xts-plain64";
+       struct crypt_pbkdf_type argon2 = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = DEFAULT_LUKS1_HASH,
+               .time_ms = 6,
+               .max_memory_kb = 1024,
+               .parallel_threads = 1
+       }, pbkdf2 = {
+               .type = CRYPT_KDF_PBKDF2,
+               .hash = DEFAULT_LUKS1_HASH,
+               .time_ms = 9
+       }, bad = {
+               .type = "hamster_pbkdf",
+               .hash = DEFAULT_LUKS1_HASH
+       };
+       struct crypt_params_plain params = {
+               .hash = "sha1",
+               .skip = 0,
+               .offset = 0,
+               .size = 0
+       };
+       struct crypt_params_luks1 luks1 = {
+               .hash = "whirlpool", // test non-standard hash
+               .data_alignment = 2048,
+       };
+
+       uint64_t r_payload_offset;
+
+       /* Only PBKDF2 is allowed in FIPS, these tests cannot be run. */
+       if (_fips_mode)
+               return;
+
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1));
+
+       NULL_(crypt_get_pbkdf_type_params(NULL));
+       NULL_(crypt_get_pbkdf_type_params("suslik"));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type_params(CRYPT_KDF_PBKDF2));
+       OK_(strcmp(pbkdf->type, CRYPT_KDF_PBKDF2));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type_params(CRYPT_KDF_ARGON2I));
+       OK_(strcmp(pbkdf->type, CRYPT_KDF_ARGON2I));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type_params(CRYPT_KDF_ARGON2ID));
+       OK_(strcmp(pbkdf->type, CRYPT_KDF_ARGON2ID));
+
+       // test empty context
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       NULL_(crypt_get_pbkdf_type(cd));
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+       NOTNULL_(crypt_get_pbkdf_type(cd));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       NOTNULL_(crypt_get_pbkdf_type(cd));
+       OK_(crypt_set_pbkdf_type(cd, NULL));
+       NOTNULL_(crypt_get_pbkdf_type(cd));
+
+       // test plain device
+       OK_(crypt_format(cd, CRYPT_PLAIN, cipher, mode, NULL, NULL, 32, &params));
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       OK_(crypt_set_pbkdf_type(cd, NULL));
+       NOTNULL_(crypt_get_pbkdf_type(cd));
+       CRYPT_FREE(cd);
+
+       // test LUKSv1 device
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, mode, NULL, NULL, 32, NULL));
+       FAIL_(crypt_set_pbkdf_type(cd, &argon2), "Unsupported with non-LUKS2 devices");
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       OK_(crypt_set_pbkdf_type(cd, NULL));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       EQ_(pbkdf->time_ms, DEFAULT_LUKS1_ITER_TIME);
+       CRYPT_FREE(cd);
+       // test value set in crypt_set_iteration_time() can be obtained via following crypt_get_pbkdf_type()
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       crypt_set_iteration_time(cd, 42);
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, mode, NULL, NULL, 32, NULL));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       EQ_(pbkdf->time_ms, 42);
+       // test crypt_get_pbkdf_type() returns expected values for LUKSv1
+       OK_(strcmp(pbkdf->type, CRYPT_KDF_PBKDF2));
+       OK_(strcmp(pbkdf->hash, DEFAULT_LUKS1_HASH));
+       EQ_(pbkdf->max_memory_kb, 0);
+       EQ_(pbkdf->parallel_threads, 0);
+       crypt_set_iteration_time(cd, 43);
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       EQ_(pbkdf->time_ms, 43);
+       CRYPT_FREE(cd);
+       // test whether crypt_get_pbkdf_type() after double crypt_load()
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       crypt_set_iteration_time(cd, 42);
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       EQ_(pbkdf->time_ms, 42);
+       CRYPT_FREE(cd);
+       // test whether hash passed via *params in crypt_load() has higher priority
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, mode, NULL, NULL, 32, &luks1));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->hash, luks1.hash));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->hash, luks1.hash));
+       CRYPT_FREE(cd);
+
+       // test LUKSv2 device
+       // test default values are set
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, mode, NULL, NULL, 32, NULL));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->type, DEFAULT_LUKS2_PBKDF));
+       OK_(strcmp(pbkdf->hash, DEFAULT_LUKS1_HASH));
+       EQ_(pbkdf->time_ms, DEFAULT_LUKS2_ITER_TIME);
+       EQ_(pbkdf->max_memory_kb, adjusted_pbkdf_memory());
+       EQ_(pbkdf->parallel_threads, _min(cpus_online(), DEFAULT_LUKS2_PARALLEL_THREADS));
+       // set and verify argon2 type
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->type, argon2.type));
+       OK_(strcmp(pbkdf->hash, argon2.hash));
+       EQ_(pbkdf->time_ms, argon2.time_ms);
+       EQ_(pbkdf->max_memory_kb, argon2.max_memory_kb);
+       EQ_(pbkdf->parallel_threads, argon2.parallel_threads);
+       // set and verify pbkdf2 type
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->type, pbkdf2.type));
+       OK_(strcmp(pbkdf->hash, pbkdf2.hash));
+       EQ_(pbkdf->time_ms, pbkdf2.time_ms);
+       EQ_(pbkdf->max_memory_kb, pbkdf2.max_memory_kb);
+       EQ_(pbkdf->parallel_threads, pbkdf2.parallel_threads);
+       // reset and verify default values
+       crypt_set_iteration_time(cd, 1); // it's supposed to override this call
+       OK_(crypt_set_pbkdf_type(cd, NULL));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->type, DEFAULT_LUKS2_PBKDF));
+       OK_(strcmp(pbkdf->hash, DEFAULT_LUKS1_HASH));
+       EQ_(pbkdf->time_ms, DEFAULT_LUKS2_ITER_TIME);
+       EQ_(pbkdf->max_memory_kb, adjusted_pbkdf_memory());
+       EQ_(pbkdf->parallel_threads, _min(cpus_online(), DEFAULT_LUKS2_PARALLEL_THREADS));
+       // try to pass illegal values
+       argon2.parallel_threads = 0;
+       FAIL_(crypt_set_pbkdf_type(cd, &argon2), "Parallel threads can't be 0");
+       argon2.parallel_threads = 1;
+       argon2.max_memory_kb = 0;
+       FAIL_(crypt_set_pbkdf_type(cd, &argon2), "Memory can't be 0");
+       argon2.max_memory_kb = 1024;
+       pbkdf2.parallel_threads = 1;
+       FAIL_(crypt_set_pbkdf_type(cd, &pbkdf2), "Parallel threads can't be set with pbkdf2 type");
+       pbkdf2.parallel_threads = 0;
+       pbkdf2.max_memory_kb = 512;
+       FAIL_(crypt_set_pbkdf_type(cd, &pbkdf2), "Memory can't be set with pbkdf2 type");
+       FAIL_(crypt_set_pbkdf_type(cd, &bad), "Unknown type member");
+       bad.type = CRYPT_KDF_PBKDF2;
+       bad.hash = NULL;
+       FAIL_(crypt_set_pbkdf_type(cd, &bad), "Hash member is empty");
+       bad.type = NULL;
+       bad.hash = DEFAULT_LUKS1_HASH;
+       FAIL_(crypt_set_pbkdf_type(cd, &bad), "Pbkdf type member is empty");
+       bad.hash = "hamster_hash";
+       FAIL_(crypt_set_pbkdf_type(cd, &pbkdf2), "Unknown hash member");
+       CRYPT_FREE(cd);
+       // test whether crypt_get_pbkdf_type() behaves accordingly after second crypt_load() call
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->type, DEFAULT_LUKS2_PBKDF));
+       OK_(strcmp(pbkdf->hash, DEFAULT_LUKS1_HASH));
+       EQ_(pbkdf->time_ms, DEFAULT_LUKS2_ITER_TIME);
+       EQ_(pbkdf->max_memory_kb, adjusted_pbkdf_memory());
+       EQ_(pbkdf->parallel_threads, _min(cpus_online(), DEFAULT_LUKS2_PARALLEL_THREADS));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       OK_(strcmp(pbkdf->type, DEFAULT_LUKS2_PBKDF));
+       OK_(strcmp(pbkdf->hash, DEFAULT_LUKS1_HASH));
+       EQ_(pbkdf->time_ms, 1);
+       EQ_(pbkdf->max_memory_kb, adjusted_pbkdf_memory());
+       EQ_(pbkdf->parallel_threads, _min(cpus_online(), DEFAULT_LUKS2_PARALLEL_THREADS));
+       CRYPT_FREE(cd);
+
+       // test crypt_set_pbkdf_type() overwrites invalid value set by crypt_set_iteration_time()
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       crypt_set_iteration_time(cd, 0);
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       OK_(strcmp(pbkdf->type, argon2.type));
+       EQ_(pbkdf->time_ms, argon2.time_ms);
+
+       // force iterations
+       argon2.iterations = 33;
+       argon2.flags = CRYPT_PBKDF_NO_BENCHMARK;
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+       NOTNULL_(pbkdf = crypt_get_pbkdf_type(cd));
+       EQ_(pbkdf->iterations, 33);
+       EQ_(pbkdf->flags, CRYPT_PBKDF_NO_BENCHMARK);
+
+       // time may be unset with iterations
+       argon2.time_ms = 0;
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+       argon2.flags &= ~CRYPT_PBKDF_NO_BENCHMARK;
+       FAIL_(crypt_set_pbkdf_type(cd, &argon2), "Illegal time value.");
+
+       pbkdf2.time_ms = 0;
+       pbkdf2.flags = CRYPT_PBKDF_NO_BENCHMARK;
+       pbkdf2.parallel_threads = 0;
+       pbkdf2.max_memory_kb = 0;
+       pbkdf2.iterations = 1000;
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       pbkdf2.flags &= ~CRYPT_PBKDF_NO_BENCHMARK;
+       FAIL_(crypt_set_pbkdf_type(cd, &pbkdf2), "Illegal time value.");
+
+       // hash is relevant only with pbkdf2
+       pbkdf2.time_ms = 9;
+       pbkdf2.hash = NULL;
+       FAIL_(crypt_set_pbkdf_type(cd, &pbkdf2), "Hash is mandatory for pbkdf2");
+       pbkdf2.hash = "sha1";
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+
+       argon2.time_ms = 9;
+       argon2.hash = "sha1"; // will be ignored
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+       argon2.hash = NULL;
+       OK_(crypt_set_pbkdf_type(cd, &argon2));
+
+       CRYPT_FREE(cd);
+
+       NOTNULL_(pbkdf = crypt_get_pbkdf_default(CRYPT_LUKS1));
+       OK_(strcmp(pbkdf->type, CRYPT_KDF_PBKDF2));
+       EQ_(pbkdf->time_ms, DEFAULT_LUKS1_ITER_TIME);
+       OK_(strcmp(pbkdf->hash, DEFAULT_LUKS1_HASH));
+       EQ_(pbkdf->max_memory_kb, 0);
+       EQ_(pbkdf->parallel_threads, 0);
+
+       NOTNULL_(pbkdf = crypt_get_pbkdf_default(CRYPT_LUKS2));
+       OK_(strcmp(pbkdf->type, DEFAULT_LUKS2_PBKDF));
+       EQ_(pbkdf->time_ms, DEFAULT_LUKS2_ITER_TIME);
+       OK_(strcmp(pbkdf->hash, DEFAULT_LUKS1_HASH));
+       EQ_(pbkdf->max_memory_kb, DEFAULT_LUKS2_MEMORY_KB);
+       EQ_(pbkdf->parallel_threads, DEFAULT_LUKS2_PARALLEL_THREADS);
+
+       NULL_(pbkdf = crypt_get_pbkdf_default(CRYPT_PLAIN));
+
+       _cleanup_dmdevices();
+}
+
+static void Luks2KeyslotAdd(void)
+{
+       char key[128], key2[128], key_ret[128];
+       const char *cipher = "aes", *cipher_mode="xts-plain64";
+       const char *mk_hex =  "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       const char *mk_hex2 = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1e";
+       size_t key_ret_len, key_size = strlen(mk_hex) / 2;
+       uint64_t r_payload_offset;
+       struct crypt_pbkdf_type pbkdf = {
+               .type = "argon2i",
+               .hash = "sha256",
+               .iterations = 4,
+               .max_memory_kb = 32,
+               .parallel_threads = 1,
+               .flags = CRYPT_PBKDF_NO_BENCHMARK,
+       };
+       struct crypt_params_luks2 params2 = {
+               .pbkdf = &pbkdf,
+               .sector_size = SECTOR_SIZE
+       };
+
+       crypt_decode_key(key, mk_hex, key_size);
+       crypt_decode_key(key2, mk_hex2, key_size);
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+               pbkdf.iterations = 1000;
+       }
+
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1));
+
+       /* test crypt_keyslot_add_by_key */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params2));
+       EQ_(crypt_keyslot_add_by_key(cd, 1, key2, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, key, key_size, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_status(cd, 0), CRYPT_SLOT_ACTIVE_LAST);
+       EQ_(crypt_keyslot_status(cd, 1), CRYPT_SLOT_UNBOUND);
+       /* must not activate volume with keyslot unassigned to a segment */
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key2, key_size, 0), "Key doesn't match volume key digest");
+       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, 1, PASSPHRASE1, strlen(PASSPHRASE1), 0), "Keyslot not assigned to volume");
+       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE1, strlen(PASSPHRASE1), 0), "No keyslot assigned to volume with this passphrase");
+       /* unusable for volume activation even in test mode */
+       FAIL_(crypt_activate_by_volume_key(cd, NULL, key2, key_size, 0), "Key doesn't match volume key digest");
+       /* otoh passphrase check should pass */
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY), 1);
+       EQ_(crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY), 1);
+       /* in general crypt_keyslot_add_by_key must allow any reasonable key size
+        * even though such keyslot will not be usable for segment encryption */
+       EQ_(crypt_keyslot_add_by_key(cd, 2, key2, key_size-1, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT), 2);
+       EQ_(crypt_keyslot_add_by_key(cd, 3, key2, 13, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT), 3);
+
+       FAIL_(crypt_keyslot_get_key_size(cd, CRYPT_ANY_SLOT), "Bad keyslot specification.");
+       EQ_(crypt_get_volume_key_size(cd), key_size);
+       EQ_(crypt_keyslot_get_key_size(cd, 0), key_size);
+       EQ_(crypt_keyslot_get_key_size(cd, 1), key_size);
+       EQ_(crypt_keyslot_get_key_size(cd, 2), key_size-1);
+       EQ_(crypt_keyslot_get_key_size(cd, 3), 13);
+
+       key_ret_len = key_size - 1;
+       FAIL_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key_ret, &key_ret_len, PASSPHRASE1, strlen(PASSPHRASE1)), "Wrong size");
+
+       key_ret_len = 13;
+       FAIL_(crypt_volume_key_get(cd, 2, key_ret, &key_ret_len, PASSPHRASE1, strlen(PASSPHRASE1)), "wrong size");
+       EQ_(crypt_volume_key_get(cd, 3, key_ret, &key_ret_len, PASSPHRASE1, strlen(PASSPHRASE1)), 3);
+       FAIL_(crypt_activate_by_volume_key(cd, NULL, key_ret, key_ret_len, 0), "Not a volume key");
+       key_ret_len = key_size;
+       EQ_(crypt_volume_key_get(cd, 1, key_ret, &key_ret_len, PASSPHRASE1, strlen(PASSPHRASE1)), 1);
+
+       /* test force volume key change works as expected */
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 0, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_SET), 1);
+       OK_(crypt_activate_by_volume_key(cd, NULL, key2, key_size, 0));
+       OK_(crypt_activate_by_volume_key(cd, NULL, key_ret, key_ret_len, 0));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key2, key_size, 0));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_activate_by_passphrase(cd, NULL, 1, PASSPHRASE1, strlen(PASSPHRASE1), 0), 1);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 1, PASSPHRASE1, strlen(PASSPHRASE1), 0), 1);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       /* old keyslot must be unusable */
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Key doesn't match volume key digest");
+       FAIL_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0), "Key doesn't match volume key digest");
+       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, PASSPHRASE, strlen(PASSPHRASE), 0), "Keyslot not assigned to volume");
+       EQ_(crypt_keyslot_add_by_passphrase(cd, 5, PASSPHRASE1, strlen(PASSPHRASE1), PASSPHRASE1, strlen(PASSPHRASE1)), 5);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, key2, key_size, PASSPHRASE1, strlen(PASSPHRASE1)), 6);
+       /* regression test. check new keyslot is properly assigned to new volume key digest */
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 5, PASSPHRASE1, strlen(PASSPHRASE1), 0), 5);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 6, PASSPHRASE1, strlen(PASSPHRASE1), 0), 6);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, &params2));
+       /* keyslot 0, volume key, digest 0 */
+       EQ_(crypt_keyslot_add_by_key(cd, 0, key, key_size, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+        /* keyslot 1, unbound key, digest 1 */
+       EQ_(crypt_keyslot_add_by_key(cd, 1, key2, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+        /* keyslot 2, unbound key, digest 1 */
+       EQ_(crypt_keyslot_add_by_key(cd, 2, key2, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_DIGEST_REUSE), 2);
+        /* keyslot 3, unbound key, digest 2 */
+       EQ_(crypt_keyslot_add_by_key(cd, 3, key2, key_size - 1, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_DIGEST_REUSE), 3);
+        /* keyslot 4, unbound key, digest 1 */
+       EQ_(crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, key2, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_DIGEST_REUSE), 4);
+       FAIL_(crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, key, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_SET), "Illegal");
+       FAIL_(crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, key, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT | CRYPT_VOLUME_KEY_SET | CRYPT_VOLUME_KEY_DIGEST_REUSE), "Illegal");
+       /* Such key doesn't exist, nothing to reuse */
+       FAIL_(crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, key2, key_size - 2, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_DIGEST_REUSE), "Key digest doesn't match any existing.");
+       /* Keyslot 5, volume key, digest 0 */
+       EQ_(crypt_keyslot_add_by_key(cd, 5, key, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_DIGEST_REUSE), 5);
+
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_SET), 1);
+       OK_(crypt_activate_by_volume_key(cd, NULL, key2, key_size, 0));
+       FAIL_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0), "Not a volume key");
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 1, PASSPHRASE1, strlen(PASSPHRASE1), 0), 1);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 2, PASSPHRASE1, strlen(PASSPHRASE1), 0), 2);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, PASSPHRASE, strlen(PASSPHRASE), 0), "No volume key keyslot");
+
+       /* TODO: key is unusable with aes-xts */
+       // FAIL_(crypt_keyslot_add_by_key(cd, 3, NULL, 0, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_SET), "Unusable key with segment cipher");
+
+       EQ_(crypt_keyslot_add_by_key(cd, 5, NULL, 0, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_SET), 5);
+       FAIL_(crypt_activate_by_volume_key(cd, NULL, key2, key_size, 0), "Not a volume key");
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 5, PASSPHRASE1, strlen(PASSPHRASE1), 0), 5);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+}
+
+static void Luks2KeyslotParams(void)
+{
+       char key[128], key2[128];
+       const char *cipher = "aes", *cipher_mode="xts-plain64";
+       const char *cipher_spec = "aes-xts-plain64", *cipher_keyslot = "aes-cbc-essiv:sha256";
+       const char *mk_hex =  "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       const char *mk_hex2 = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1e";
+       size_t key_size_ret, key_size = strlen(mk_hex) / 2, keyslot_key_size = 16;
+       uint64_t r_payload_offset;
+
+       crypt_decode_key(key, mk_hex, key_size);
+       crypt_decode_key(key2, mk_hex2, key_size);
+
+       OK_(prepare_keyfile(KEYFILE1, PASSPHRASE, strlen(PASSPHRASE)));
+       OK_(prepare_keyfile(KEYFILE2, PASSPHRASE1, strlen(PASSPHRASE1)));
+
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1));
+
+       EQ_(key_size, 2 * keyslot_key_size);
+       /* test crypt_keyslot_add_by_key */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, key, key_size, NULL));
+       NULL_(crypt_keyslot_get_encryption(cd, 0, &key_size_ret));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, CRYPT_ANY_SLOT, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+
+       // Normal slots
+       EQ_(0, crypt_keyslot_add_by_volume_key(cd, 0, key, key_size, PASSPHRASE, strlen(PASSPHRASE)));
+       EQ_(1, crypt_keyslot_add_by_passphrase(cd, 1, PASSPHRASE, strlen(PASSPHRASE), PASSPHRASE1,strlen(PASSPHRASE1)));
+       EQ_(2, crypt_keyslot_add_by_key(cd, 2, key2, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT));
+       EQ_(6, crypt_keyslot_add_by_keyfile(cd, 6, KEYFILE1, 0, KEYFILE2, 0));
+
+       // Slots with different encryption type
+       OK_(crypt_keyslot_set_encryption(cd, cipher_keyslot, keyslot_key_size));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, CRYPT_ANY_SLOT, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       EQ_(3, crypt_keyslot_add_by_volume_key(cd, 3, key, key_size, PASSPHRASE, strlen(PASSPHRASE)));
+       EQ_(4, crypt_keyslot_add_by_passphrase(cd, 4, PASSPHRASE, strlen(PASSPHRASE), PASSPHRASE1,strlen(PASSPHRASE1)));
+       EQ_(5, crypt_keyslot_add_by_key(cd, 5, key2, key_size, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT));
+       EQ_(7, crypt_keyslot_add_by_keyfile(cd, 7, KEYFILE1, 0, KEYFILE2, 0));
+
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+
+       EQ_(crypt_keyslot_status(cd, 0), CRYPT_SLOT_ACTIVE);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 0, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+
+       EQ_(crypt_keyslot_status(cd, 1), CRYPT_SLOT_ACTIVE);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 1, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+
+       EQ_(crypt_keyslot_status(cd, 2), CRYPT_SLOT_UNBOUND);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 2, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+
+       EQ_(crypt_keyslot_status(cd, 6), CRYPT_SLOT_ACTIVE);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 6, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+
+       EQ_(crypt_keyslot_status(cd, 3), CRYPT_SLOT_ACTIVE);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 3, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       EQ_(crypt_keyslot_status(cd, 4), CRYPT_SLOT_ACTIVE);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 4, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       EQ_(crypt_keyslot_status(cd, 5), CRYPT_SLOT_UNBOUND);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 5, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       EQ_(crypt_keyslot_status(cd, 7), CRYPT_SLOT_ACTIVE);
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 7, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       crypt_set_iteration_time(cd, 1);
+       EQ_(8, crypt_keyslot_change_by_passphrase(cd, 1, 8, PASSPHRASE1, strlen(PASSPHRASE1), PASSPHRASE, strlen(PASSPHRASE)));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 8, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+
+       /* Revert to default */
+       EQ_(9, crypt_keyslot_change_by_passphrase(cd, 5, 9, PASSPHRASE1, strlen(PASSPHRASE1), PASSPHRASE, strlen(PASSPHRASE)));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 9, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+
+       /* Set new encryption params */
+       OK_(crypt_keyslot_set_encryption(cd, cipher_keyslot, keyslot_key_size));
+
+       EQ_(1, crypt_keyslot_change_by_passphrase(cd, 8, 1, PASSPHRASE, strlen(PASSPHRASE), PASSPHRASE1, strlen(PASSPHRASE1)));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 1, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       EQ_(10, crypt_keyslot_change_by_passphrase(cd, 2, 10, PASSPHRASE1, strlen(PASSPHRASE1), PASSPHRASE, strlen(PASSPHRASE)));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 10, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       EQ_(0, crypt_keyslot_change_by_passphrase(cd, 0, 0, PASSPHRASE, strlen(PASSPHRASE), PASSPHRASE1, strlen(PASSPHRASE1)));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 0, &key_size_ret), cipher_keyslot));
+       EQ_(key_size_ret, keyslot_key_size);
+
+       CRYPT_FREE(cd);
+
+       /* LUKS1 compatible calls */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, NULL));
+       NULL_(crypt_keyslot_get_encryption(cd, 0, &key_size_ret));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, CRYPT_ANY_SLOT, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+       EQ_(0, crypt_keyslot_add_by_volume_key(cd, 0, key, key_size, PASSPHRASE, strlen(PASSPHRASE)));
+       OK_(strcmp(crypt_keyslot_get_encryption(cd, 0, &key_size_ret), cipher_spec));
+       EQ_(key_size_ret, key_size);
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+       _remove_keyfiles();
+}
+
+static void Luks2ActivateByKeyring(void)
+{
+#ifdef KERNEL_KEYRING
+
+       key_serial_t kid, kid1;
+       uint64_t r_payload_offset;
+
+       const char *cipher = "aes";
+       const char *cipher_mode = "xts-plain64";
+
+       if (!t_dm_crypt_keyring_support()) {
+               printf("WARNING: Kernel keyring not supported, skipping test.\n");
+               return;
+       }
+
+       kid = add_key("user", KEY_DESC_TEST0, PASSPHRASE, strlen(PASSPHRASE), KEY_SPEC_THREAD_KEYRING);
+       NOTFAIL_(kid, "Test or kernel keyring are broken.");
+       kid1 = add_key("user", KEY_DESC_TEST1, PASSPHRASE1, strlen(PASSPHRASE1), KEY_SPEC_THREAD_KEYRING);
+       NOTFAIL_(kid1, "Test or kernel keyring are broken.");
+
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1));
+
+       // prepare the device
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       crypt_set_iteration_time(cd, 1);
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, 32, NULL));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 2, NULL, 32, PASSPHRASE1, strlen(PASSPHRASE1)), 2);
+       CRYPT_FREE(cd);
+
+       // FIXME: all following tests work as expected but most error messages are missing
+       // check activate by keyring works exactly same as by passphrase
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST0, 0, 0), 0);
+       EQ_(crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST0, 0, 0), 0);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       FAIL_(crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST0, 0, 0), "already open");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
+       EQ_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST1, 1, CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY), 1);
+       EQ_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST1, 2, 0), 2);
+       FAIL_(crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST1, 1, 0), "Keyslot not assigned to volume");
+       EQ_(crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST1, 2, 0), 2);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST1, CRYPT_ANY_SLOT, 0), 2);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       FAIL_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST0, 2, 0), "Failed to unclock keyslot");
+       FAIL_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST1, 0, 0), "Failed to unclock keyslot");
+       CRYPT_FREE(cd);
+
+       NOTFAIL_(keyctl_unlink(kid, KEY_SPEC_THREAD_KEYRING), "Test or kernel keyring are broken.");
+       NOTFAIL_(keyctl_unlink(kid1, KEY_SPEC_THREAD_KEYRING), "Test or kernel keyring are broken.");
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       FAIL_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST0, CRYPT_ANY_SLOT, 0), "no such key in keyring");
+       FAIL_(crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST0, CRYPT_ANY_SLOT, 0), "no such key in keyring");
+       FAIL_(crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST1, 2, 0), "no such key in keyring");
+       FAIL_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST1, 1, 0), "no such key in keyring");
+       CRYPT_FREE(cd);
+       _cleanup_dmdevices();
+#else
+       printf("WARNING: cryptsetup compiled with kernel keyring service disabled, skipping test.\n");
+#endif
+}
+
+static void Luks2Requirements(void)
+{
+       int r;
+       char key[128];
+       size_t key_size = 128;
+       const struct crypt_pbkdf_type *pbkdf;
+#ifdef KERNEL_KEYRING
+       key_serial_t kid;
+#endif
+       uint32_t flags;
+       uint64_t dummy, r_payload_offset;
+       struct crypt_active_device cad;
+
+       const char *token, *json = "{\"type\":\"test_token\",\"keyslots\":[]}";
+       struct crypt_pbkdf_type argon2 = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = DEFAULT_LUKS1_HASH,
+               .time_ms = 6,
+               .max_memory_kb = 1024,
+               .parallel_threads = 1
+       }, pbkdf2 = {
+               .type = CRYPT_KDF_PBKDF2,
+               .hash = DEFAULT_LUKS1_HASH,
+               .time_ms = 9
+       };
+       struct crypt_token_params_luks2_keyring params_get, params = {
+               .key_description = KEY_DESC_TEST0
+       };
+
+       OK_(prepare_keyfile(KEYFILE1, "aaa", 3));
+       OK_(prepare_keyfile(KEYFILE2, "xxx", 3));
+
+       /* crypt_load (unrestricted) */
+       OK_(crypt_init(&cd, DEVICE_5));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DEVICE_5));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+
+       /* crypt_dump (unrestricted) */
+       reset_log();
+       OK_(crypt_dump(cd));
+       OK_(!(global_lines != 0));
+       reset_log();
+
+       /* get & set pbkdf params (unrestricted) */
+       if (!_fips_mode) {
+               OK_(crypt_set_pbkdf_type(cd, &argon2));
+               NOTNULL_(crypt_get_pbkdf_type(cd));
+       }
+
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf2));
+       NOTNULL_(crypt_get_pbkdf_type(cd));
+
+       /* crypt_set_iteration_time (unrestricted) */
+       crypt_set_iteration_time(cd, 1);
+       pbkdf = crypt_get_pbkdf_type(cd);
+       NOTNULL_(pbkdf);
+       EQ_(pbkdf->time_ms, 1);
+
+       /* crypt_convert (restricted) */
+       FAIL_((r = crypt_convert(cd, CRYPT_LUKS1, NULL)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_set_uuid (restricted) */
+       FAIL_((r = crypt_set_uuid(cd, NULL)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_set_label (restricted) */
+       FAIL_((r = crypt_set_label(cd, "label", "subsystem")), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_repair (with current repair capabilities it's unrestricted) */
+       OK_(crypt_repair(cd, CRYPT_LUKS2, NULL));
+
+       /* crypt_keyslot_add_passphrase (restricted) */
+       FAIL_((r = crypt_keyslot_add_by_passphrase(cd, CRYPT_ANY_SLOT, "aaa", 3, "bbb", 3)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_keyslot_change_by_passphrase (restricted) */
+       FAIL_((r = crypt_keyslot_change_by_passphrase(cd, CRYPT_ANY_SLOT, 9, "aaa", 3, "bbb", 3)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_keyslot_add_by_keyfile (restricted) */
+       FAIL_((r = crypt_keyslot_add_by_keyfile(cd, CRYPT_ANY_SLOT, KEYFILE1, 0, KEYFILE2, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_keyslot_add_by_keyfile_offset (restricted) */
+       FAIL_((r = crypt_keyslot_add_by_keyfile_offset(cd, CRYPT_ANY_SLOT, KEYFILE1, 0, 0, KEYFILE2, 0, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_volume_key_get (unrestricted, but see below) */
+       OK_(crypt_volume_key_get(cd, 0, key, &key_size, "aaa", 3));
+
+       /* crypt_keyslot_add_by_volume_key (restricted) */
+       FAIL_((r = crypt_keyslot_add_by_volume_key(cd, CRYPT_ANY_SLOT, key, key_size, "xxx", 3)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_keyslot_add_by_key (restricted) */
+       FAIL_((r = crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, NULL, key_size, "xxx", 3, CRYPT_VOLUME_KEY_NO_SEGMENT)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_keyslot_add_by_key (restricted) */
+       FAIL_((r = crypt_keyslot_add_by_key(cd, CRYPT_ANY_SLOT, key, key_size, "xxx", 3, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_persistent_flasgs_set (restricted) */
+       FAIL_((r = crypt_persistent_flags_set(cd, CRYPT_FLAGS_ACTIVATION, CRYPT_ACTIVATE_ALLOW_DISCARDS)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_persistent_flasgs_get (unrestricted) */
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &flags));
+       EQ_(flags, (uint32_t) CRYPT_REQUIREMENT_UNKNOWN);
+
+       /* crypt_activate_by_passphrase (restricted for activation only) */
+       FAIL_((r = crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+       OK_(crypt_activate_by_passphrase(cd, NULL, 0, "aaa", 3, 0));
+       OK_(crypt_activate_by_passphrase(cd, NULL, 0, "aaa", 3, t_dm_crypt_keyring_support() ? CRYPT_ACTIVATE_KEYRING_KEY : 0));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
+
+       /* crypt_activate_by_keyfile (restricted for activation only) */
+       FAIL_((r = crypt_activate_by_keyfile(cd, CDEVICE_1, 0, KEYFILE1, 0, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+       OK_(crypt_activate_by_keyfile(cd, NULL, 0, KEYFILE1, 0, 0));
+       OK_(crypt_activate_by_keyfile(cd, NULL, 0, KEYFILE1, 0, t_dm_crypt_keyring_support() ? CRYPT_ACTIVATE_KEYRING_KEY : 0));
+
+       /* crypt_activate_by_volume_key (restricted for activation only) */
+       FAIL_((r = crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, t_dm_crypt_keyring_support() ? CRYPT_ACTIVATE_KEYRING_KEY : 0));
+
+#ifdef KERNEL_KEYRING
+       if (t_dm_crypt_keyring_support()) {
+               kid = add_key("user", KEY_DESC_TEST0, "aaa", 3, KEY_SPEC_THREAD_KEYRING);
+               NOTFAIL_(kid, "Test or kernel keyring are broken.");
+
+               /* crypt_activate_by_keyring (restricted for activation only) */
+               FAIL_((r = crypt_activate_by_keyring(cd, CDEVICE_1, KEY_DESC_TEST0, 0, 0)), "Unmet requirements detected");
+               EQ_(r, t_dm_crypt_keyring_support() ? -ETXTBSY : -EINVAL);
+               OK_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST0, 0, 0));
+               OK_(crypt_activate_by_keyring(cd, NULL, KEY_DESC_TEST0, 0, CRYPT_ACTIVATE_KEYRING_KEY));
+       }
+#endif
+
+       /* crypt_volume_key_verify (unrestricted) */
+       OK_(crypt_volume_key_verify(cd, key, key_size));
+
+       /* crypt_get_cipher (unrestricted) */
+       OK_(strcmp(crypt_get_cipher(cd)?:"", "aes"));
+
+       /* crypt_get_cipher_mode (unrestricted) */
+       OK_(strcmp(crypt_get_cipher_mode(cd)?:"", "xts-plain64"));
+
+       /* crypt_get_uuid (unrestricted) */
+       NOTNULL_(crypt_get_uuid(cd));
+
+       /* crypt_get_device_name (unrestricted) */
+       NOTNULL_(crypt_get_device_name(cd));
+
+       /* crypt_get_data_offset (unrestricted) */
+       OK_(!crypt_get_data_offset(cd));
+
+       /* crypt_get_iv_offset (unrestricted, nothing to test) */
+
+       /* crypt_get_volume_key_size (unrestricted) */
+       EQ_(crypt_get_volume_key_size(cd), key_size);
+
+       /* crypt_keyslot_status (unrestricted) */
+       EQ_(crypt_keyslot_status(cd, 0), CRYPT_SLOT_ACTIVE_LAST);
+       EQ_(crypt_keyslot_status(cd, 1), CRYPT_SLOT_INACTIVE);
+
+       /* crypt_keyslot_get_priority (unrestricted) */
+       EQ_(crypt_keyslot_get_priority(cd, 0), CRYPT_SLOT_PRIORITY_NORMAL);
+
+       /* crypt_keyslot_set_priority (restricted) */
+       FAIL_((r = crypt_keyslot_set_priority(cd, 0, CRYPT_SLOT_PRIORITY_PREFER)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_keyslot_area (unrestricted) */
+       OK_(crypt_keyslot_area(cd, 0, &dummy, &dummy));
+       OK_(!dummy);
+
+       /* crypt_header_backup (unrestricted) */
+       remove(BACKUP_FILE);
+       OK_(crypt_header_backup(cd, CRYPT_LUKS, BACKUP_FILE));
+
+       /* crypt_header_restore (restricted, do not drop the test until we have safe option) */
+       FAIL_((r = crypt_header_restore(cd, CRYPT_LUKS2, BACKUP_FILE)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+       remove(BACKUP_FILE);
+
+       /* crypt_token_json_set (restricted) */
+       FAIL_((r = crypt_token_json_set(cd, CRYPT_ANY_TOKEN, json)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_token_json_get (unrestricted) */
+       OK_(crypt_token_json_get(cd, 0, &token));
+       NOTNULL_(strstr(token, "user_type"));
+
+       /* crypt_token_status (unrestricted) */
+       EQ_(crypt_token_status(cd, 0, &token), CRYPT_TOKEN_EXTERNAL_UNKNOWN);
+       OK_(strcmp(token, "user_type"));
+       EQ_(crypt_token_status(cd, 1, &token), CRYPT_TOKEN_INTERNAL);
+       OK_(strcmp(token, "luks2-keyring"));
+       EQ_(crypt_token_status(cd, 2, NULL), CRYPT_TOKEN_INACTIVE);
+       EQ_(crypt_token_status(cd, 6, &token), CRYPT_TOKEN_INTERNAL_UNKNOWN);
+
+       /* crypt_token_luks2_keyring_set (restricted) */
+       FAIL_((r = crypt_token_luks2_keyring_set(cd, CRYPT_ANY_TOKEN, &params)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_token_luks2_keyring_get (unrestricted) */
+       EQ_(crypt_token_luks2_keyring_get(cd, 1, &params_get), 1);
+       OK_(strcmp(params_get.key_description, KEY_DESC_TEST0));
+
+       /* crypt_token_assign_keyslot (unrestricted) */
+       FAIL_((r = crypt_token_assign_keyslot(cd, 0, 1)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_token_unassign_keyslot (unrestricted) */
+       FAIL_((r = crypt_token_unassign_keyslot(cd, CRYPT_ANY_TOKEN, CRYPT_ANY_SLOT)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_activate_by_token (restricted for activation only) */
+#ifdef KERNEL_KEYRING
+       if (t_dm_crypt_keyring_support()) {
+               FAIL_((r = crypt_activate_by_token(cd, CDEVICE_1, 1, NULL, 0)), ""); // supposed to be silent
+               EQ_(r, -ETXTBSY);
+               OK_(crypt_activate_by_token(cd, NULL, 1, NULL, 0));
+               OK_(crypt_activate_by_token(cd, NULL, 1, NULL, CRYPT_ACTIVATE_KEYRING_KEY));
+       }
+#endif
+       OK_(get_luks2_offsets(1, 8192, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 2));
+       //OK_(_system("dd if=" NO_REQS_LUKS2_HEADER " of=" NO_REQS_LUKS2_HEADER " bs=4096 2>/dev/null", 1));
+       OK_(_system("dd if=" NO_REQS_LUKS2_HEADER " of=" DMDIR L_DEVICE_OK " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+
+       /* need to fake activated LUKSv2 device with requirements features */
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, 0));
+       OK_(crypt_header_backup(cd, CRYPT_LUKS2, BACKUP_FILE));
+       /* replace header with no requirements */
+       OK_(_system("dd if=" REQS_LUKS2_HEADER " of=" DMDIR L_DEVICE_OK " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DEVICE_5));
+       CRYPT_FREE(cd);
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+
+       /* crypt_header_restore (restricted with confirmation required) */
+       /* allow force restore over device header w/ requirements */
+       OK_(crypt_header_restore(cd, CRYPT_LUKS2, BACKUP_FILE));
+       remove(BACKUP_FILE);
+       OK_(_system("dd if=" REQS_LUKS2_HEADER " of=" DMDIR L_DEVICE_OK " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_header_backup(cd, CRYPT_LUKS2, BACKUP_FILE)); /* create backup with requirements */
+
+       /* crypt_suspend (restricted) */
+       FAIL_((r = crypt_suspend(cd, CDEVICE_1)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+       CRYPT_FREE(cd);
+
+       /* replace header again to suspend the device */
+       OK_(_system("dd if=" NO_REQS_LUKS2_HEADER " of=" DMDIR L_DEVICE_OK " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       OK_(crypt_suspend(cd, CDEVICE_1));
+
+       /* crypt_header_restore (restricted, do not drop the test until we have safe option) */
+       /* refuse to overwrite header w/ backup including requirements */
+       FAIL_((r = crypt_header_restore(cd, CRYPT_LUKS2, BACKUP_FILE)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       CRYPT_FREE(cd);
+
+       OK_(_system("dd if=" REQS_LUKS2_HEADER " of=" DMDIR L_DEVICE_OK " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+
+       /* crypt_resume_by_passphrase (restricted) */
+       FAIL_((r = crypt_resume_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_resume_by_keyfile (restricted) */
+       FAIL_((r = crypt_resume_by_keyfile(cd, CDEVICE_1, 0, KEYFILE1, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+
+       /* crypt_resume_by_keyfile_offset (restricted) */
+       FAIL_((r = crypt_resume_by_keyfile_offset(cd, CDEVICE_1, 0, KEYFILE1, 0, 0)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+       CRYPT_FREE(cd);
+
+       OK_(_system("dd if=" NO_REQS_LUKS2_HEADER " of=" DMDIR L_DEVICE_OK " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       OK_(crypt_resume_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3));
+       CRYPT_FREE(cd);
+       OK_(_system("dd if=" REQS_LUKS2_HEADER " of=" DMDIR L_DEVICE_OK " bs=1M count=4 oflag=direct 2>/dev/null", 1));
+
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       /* load VK in keyring */
+       OK_(crypt_activate_by_passphrase(cd, NULL, 0, "aaa", 3, t_dm_crypt_keyring_support() ? CRYPT_ACTIVATE_KEYRING_KEY : 0));
+       /* crypt_resize (restricted) */
+       FAIL_((r = crypt_resize(cd, CDEVICE_1, 1)), "Unmet requirements detected");
+       EQ_(r, -ETXTBSY);
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+
+       /* crypt_get_active_device (unrestricted) */
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+#ifdef KERNEL_KEYRING
+       if (t_dm_crypt_keyring_support())
+               EQ_(cad.flags & CRYPT_ACTIVATE_KEYRING_KEY, CRYPT_ACTIVATE_KEYRING_KEY);
+#endif
+
+       /* crypt_deactivate (unrestricted) */
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       /* crypt_token_is_assigned (unrestricted) */
+       OK_(crypt_token_is_assigned(cd, 1, 0));
+       OK_(crypt_token_is_assigned(cd, 6, 0));
+       EQ_(crypt_token_is_assigned(cd, 0, 0), -ENOENT);
+
+       /* crypt_keyslot_destroy (unrestricted) */
+       OK_(crypt_keyslot_destroy(cd, 0));
+
+       CRYPT_FREE(cd);
+       _cleanup_dmdevices();
+}
+
+static void Luks2Integrity(void)
+{
+       struct crypt_params_integrity ip = {};
+       struct crypt_params_luks2 params = {
+               .sector_size = 512,
+               .integrity = "hmac(sha256)"
+       };
+       size_t key_size = 32 + 32;
+       const char *passphrase = "blabla";
+       const char *cipher = "aes";
+       const char *cipher_mode = "xts-random";
+       int ret;
+
+       // FIXME: This is just a stub
+       OK_(crypt_init(&cd, DEVICE_2));
+       ret = crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, key_size, &params);
+       if (ret < 0) {
+               printf("WARNING: cannot format integrity device, skipping test.\n");
+               CRYPT_FREE(cd);
+               return;
+       }
+
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 7, NULL, key_size, passphrase, strlen(passphrase)), 7);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_2, 7, passphrase, strlen(passphrase) ,0), 7);
+       EQ_(crypt_status(cd, CDEVICE_2), CRYPT_ACTIVE);
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init_by_name_and_header(&cd, CDEVICE_2, NULL));
+       OK_(crypt_get_integrity_info(cd, &ip));
+       OK_(strcmp(cipher, crypt_get_cipher(cd)));
+       OK_(strcmp(cipher_mode, crypt_get_cipher_mode(cd)));
+       OK_(strcmp("hmac(sha256)", ip.integrity));
+       EQ_(32, ip.integrity_key_size);
+       EQ_(32+16, ip.tag_size);
+       OK_(crypt_deactivate(cd, CDEVICE_2));
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DEVICE_2));
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, cipher_mode, NULL, NULL, key_size - 32, &params), "Wrong key size.");
+       FAIL_(crypt_format(cd, CRYPT_LUKS2, cipher, "xts-plainx", NULL, NULL, key_size, &params), "Wrong cipher.");
+       CRYPT_FREE(cd);
+}
+
+static int set_fast_pbkdf(struct crypt_device *cd)
+{
+       struct crypt_pbkdf_type pbkdf = {
+               .type = "argon2id",
+               .hash = "sha256",
+               .iterations = 4,
+               .max_memory_kb = 32,
+               .parallel_threads = 1,
+               .flags = CRYPT_PBKDF_NO_BENCHMARK
+       };
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+               pbkdf.iterations = 1000;
+       }
+       return crypt_set_pbkdf_type(cd, &pbkdf);
+}
+
+static int check_flag(uint32_t flags, uint32_t flag)
+{
+       return (flags & flag) ? 0 : -1;
+}
+
+static void Luks2Refresh(void)
+{
+       uint64_t r_payload_offset;
+       char key[128], key1[128];
+       const char *cipher = "aes", *mode = "xts-plain64";
+       const char *mk_hex =  "bb21158c733229347bd4e681891e213d94c645be6a5b84818afe7a78a6de7a1a";
+       const char *mk_hex2 = "bb22158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1e";
+       size_t key_size = strlen(mk_hex) / 2;
+       struct crypt_params_luks2 params = {
+               .sector_size = 512,
+               .integrity = "aead"
+       };
+       struct crypt_active_device cad = {};
+
+       crypt_decode_key(key, mk_hex, key_size);
+       crypt_decode_key(key1, mk_hex2, key_size);
+
+       OK_(get_luks2_offsets(1, 0, 0, NULL, &r_payload_offset));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1000));
+       OK_(create_dmdevice_over_loop(L_DEVICE_WRONG, r_payload_offset + 5000));
+       OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_payload_offset + 1));
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_payload_offset));
+
+       /* prepare test device */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(set_fast_pbkdf(cd));
+       OK_(crypt_format(cd, CRYPT_LUKS2, cipher, mode, NULL, key, 32, NULL));
+       OK_(crypt_keyslot_add_by_volume_key(cd, CRYPT_ANY_SLOT, key, 32, "aaa", 3));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, 0));
+
+       /* check we can refresh significant flags */
+       if (t_dm_crypt_discard_support()) {
+               OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_ALLOW_DISCARDS));
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_ALLOW_DISCARDS));
+               cad.flags = 0;
+       }
+
+       if (t_dm_crypt_cpu_switch_support()) {
+               OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_SAME_CPU_CRYPT));
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_SAME_CPU_CRYPT));
+               cad.flags = 0;
+
+               OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS));
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS));
+               cad.flags = 0;
+
+               OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS));
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS));
+               cad.flags = 0;
+       }
+
+       OK_(crypt_volume_key_keyring(cd, 0));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH));
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       FAIL_(check_flag(cad.flags, CRYPT_ACTIVATE_KEYRING_KEY), "Unexpected flag raised.");
+       cad.flags = 0;
+
+#ifdef KERNEL_KEYRING
+       if (t_dm_crypt_keyring_support()) {
+               OK_(crypt_volume_key_keyring(cd, 1));
+               OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH));
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_KEYRING_KEY));
+               cad.flags = 0;
+       }
+#endif
+
+       /* multiple flags at once */
+       if (t_dm_crypt_discard_support() && t_dm_crypt_cpu_switch_support()) {
+               OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS | CRYPT_ACTIVATE_ALLOW_DISCARDS));
+               OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS | CRYPT_ACTIVATE_ALLOW_DISCARDS));
+               cad.flags = 0;
+       }
+
+       /* do not allow reactivation with read-only (and drop flag silently because activation behaves exactly same) */
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_READONLY));
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       FAIL_(check_flag(cad.flags, CRYPT_ACTIVATE_READONLY), "Reactivated with read-only flag.");
+       cad.flags = 0;
+
+       /* reload flag is dropped silently */
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH));
+
+       /* check read-only flag is not lost after reload */
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_READONLY));
+       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH));
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       OK_(check_flag(cad.flags, CRYPT_ACTIVATE_READONLY));
+       cad.flags = 0;
+
+       /* check LUKS2 with auth. enc. reload */
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_WRONG));
+       if (!crypt_format(cd2, CRYPT_LUKS2, "aes", "gcm-random", crypt_get_uuid(cd), key, 32, &params)) {
+               OK_(crypt_keyslot_add_by_volume_key(cd2, 0, key, 32, "aaa", 3));
+               OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, 32, 0));
+               OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, 32, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_NO_JOURNAL));
+               OK_(crypt_get_active_device(cd2, CDEVICE_2, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_NO_JOURNAL));
+               cad.flags = 0;
+               OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, 32, CRYPT_ACTIVATE_REFRESH | CRYPT_ACTIVATE_NO_JOURNAL | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS));
+               OK_(crypt_get_active_device(cd2, CDEVICE_2, &cad));
+               OK_(check_flag(cad.flags, CRYPT_ACTIVATE_NO_JOURNAL | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS));
+               cad.flags = 0;
+               OK_(crypt_activate_by_passphrase(cd2, CDEVICE_2, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH));
+               OK_(crypt_get_active_device(cd2, CDEVICE_2, &cad));
+               FAIL_(check_flag(cad.flags, CRYPT_ACTIVATE_NO_JOURNAL), "");
+               FAIL_(check_flag(cad.flags, CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS), "");
+               FAIL_(crypt_activate_by_passphrase(cd2, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH), "Refreshed LUKS2 device with LUKS2/aead context");
+               OK_(crypt_deactivate(cd2, CDEVICE_2));
+       } else {
+               printf("WARNING: cannot format integrity device, skipping few reload tests.\n");
+       }
+       CRYPT_FREE(cd2);
+
+       /* Use LUKS1 context on LUKS2 device */
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_1S));
+       OK_(crypt_format(cd2, CRYPT_LUKS1, cipher, mode, crypt_get_uuid(cd), key, 32, NULL));
+       OK_(crypt_keyslot_add_by_volume_key(cd2, CRYPT_ANY_SLOT, NULL, 32, "aaa", 3));
+       FAIL_(crypt_activate_by_passphrase(cd2, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH), "Refreshed LUKS2 device with LUKS1 context");
+       CRYPT_FREE(cd2);
+
+       /* Use PLAIN context on LUKS2 device */
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_1S));
+       OK_(crypt_format(cd2, CRYPT_PLAIN, cipher, mode, NULL, key, 32, NULL));
+       OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, key_size, 0));
+       FAIL_(crypt_activate_by_volume_key(cd2, CDEVICE_1, key, key_size, CRYPT_ACTIVATE_REFRESH), "Refreshed LUKS2 device with PLAIN context");
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd2);
+
+       /* (snapshot-like case) */
+       /* try to refresh almost identical device (differs only in major:minor of data device) */
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_WRONG));
+       OK_(set_fast_pbkdf(cd2));
+       OK_(crypt_format(cd2, CRYPT_LUKS2, cipher, mode, crypt_get_uuid(cd), key, 32, NULL));
+       OK_(crypt_keyslot_add_by_volume_key(cd2, CRYPT_ANY_SLOT, key, 32, "aaa", 3));
+       FAIL_(crypt_activate_by_passphrase(cd2, CDEVICE_1, 0, "aaa", 3, CRYPT_ACTIVATE_REFRESH), "Refreshed dm-crypt mapped over mismatching data device");
+
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       CRYPT_FREE(cd);
+       CRYPT_FREE(cd2);
+
+       _cleanup_dmdevices();
+}
+
+static void Luks2Flags(void)
+{
+       uint32_t flags = 42;
+
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+
+       /* check library erase passed variable on success when no flags set */
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_ACTIVATION, &flags));
+       EQ_(flags, 0);
+
+       /* check set and get behave as expected */
+       flags = CRYPT_ACTIVATE_ALLOW_DISCARDS;
+       OK_(crypt_persistent_flags_set(cd, CRYPT_FLAGS_ACTIVATION, flags));
+       flags = 0;
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_ACTIVATION, &flags));
+       EQ_(flags, CRYPT_ACTIVATE_ALLOW_DISCARDS);
+
+       flags = CRYPT_ACTIVATE_ALLOW_DISCARDS | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS;
+       OK_(crypt_persistent_flags_set(cd, CRYPT_FLAGS_ACTIVATION, flags));
+       flags = (uint32_t)~0;
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_ACTIVATION, &flags));
+       EQ_(flags,CRYPT_ACTIVATE_ALLOW_DISCARDS | CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS);
+
+       CRYPT_FREE(cd);
+}
+
+static int test_progress(uint64_t size, uint64_t offset, void *usrptr)
+{
+       while (--test_progress_steps)
+               return 0;
+       return 1;
+}
+
+static void Luks2Reencryption(void)
+{
+/* reencryption currently depends on kernel keyring support */
+#if KERNEL_KEYRING
+       /* NOTES:
+        *  - reencryption requires luks2 parameters. can we avoid it?
+        */
+       uint32_t getflags;
+       uint64_t r_header_size, r_size_1;
+       struct crypt_active_device cad;
+       struct crypt_pbkdf_type pbkdf = {
+               .type = CRYPT_KDF_ARGON2I,
+               .hash = "sha256",
+               .parallel_threads = 1,
+               .max_memory_kb = 128,
+               .iterations = 4,
+               .flags = CRYPT_PBKDF_NO_BENCHMARK
+       };
+       struct crypt_params_luks2 params2 = {
+               .pbkdf = &pbkdf,
+               .sector_size = 4096
+       };
+       struct crypt_params_reencrypt retparams = {}, rparams = {
+               .direction = CRYPT_REENCRYPT_FORWARD,
+               .resilience = "checksum",
+               .hash = "sha1",
+               .luks2 = &params2,
+       };
+
+       /* reencryption currently depends on kernel keyring support in dm-crypt */
+       if (!t_dm_crypt_keyring_support())
+               return;
+
+       /* Cannot use Argon2 in FIPS */
+       if (_fips_mode) {
+               pbkdf.type = CRYPT_KDF_PBKDF2;
+               pbkdf.parallel_threads = 0;
+               pbkdf.max_memory_kb = 0;
+               pbkdf.iterations = 1000;
+       }
+
+       OK_(get_luks2_offsets(0, 0, 0, &r_header_size, NULL));
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_header_size + 16));
+
+       /* create device */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 21, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 21);
+
+       /* add several unbound keys */
+       EQ_(crypt_keyslot_add_by_key(cd, 9, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 9);
+       EQ_(crypt_keyslot_add_by_key(cd, 10, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 10);
+       EQ_(crypt_keyslot_add_by_key(cd, 11, NULL, 42, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 11);
+       EQ_(crypt_keyslot_status(cd, 21), CRYPT_SLOT_ACTIVE_LAST);
+
+       /* test cipher parameters validation */
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 11, "aes", "xts-plain64", &rparams), "Cipher not compatible with new volume key size.");
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 10, "tHeHamstErciphErr", "xts-plain64", &rparams), "Wrong cipher.");
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 10, "aes", "HamSterMoOode-plain64", &rparams), "Wrong mode.");
+
+       /* test reencryption flags */
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Reencryption not initialized.");
+       rparams.flags |= CRYPT_REENCRYPT_INITIALIZE_ONLY;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Invalid flags combination.");
+
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0);
+       FAIL_(crypt_reencrypt(cd, NULL), "Reencryption context not initialized.");
+
+       rparams.flags &= ~CRYPT_REENCRYPT_RESUME_ONLY;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams));
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, CRYPT_REQUIREMENT_ONLINE_REENCRYPT);
+
+       /* check reencrypt status is correct */
+       EQ_(crypt_reencrypt_status(cd, &retparams), CRYPT_REENCRYPT_CLEAN);
+       EQ_(retparams.mode, CRYPT_REENCRYPT_REENCRYPT);
+       EQ_(retparams.direction, CRYPT_REENCRYPT_FORWARD);
+       EQ_(retparams.data_shift, 0);
+       EQ_(retparams.device_size, 0);
+
+       /* check reencryption flag in metadata */
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, CRYPT_REQUIREMENT_ONLINE_REENCRYPT);
+
+       /* some parameters are expected to change immediately after reencryption initialization */
+       EQ_(crypt_get_volume_key_size(cd), 64);
+       OK_(strcmp(crypt_get_cipher_mode(cd), "xts-plain64"));
+       EQ_(crypt_get_sector_size(cd), 4096);
+       /* reencrypt keyslot must be unbound */
+       EQ_(crypt_keyslot_status(cd, 0), CRYPT_SLOT_UNBOUND);
+       /* keyslot assigned to new segment is switched to last active */
+       EQ_(crypt_keyslot_status(cd, 9), CRYPT_SLOT_ACTIVE_LAST);
+       /* keyslot assigned to old segment remains active */
+       EQ_(crypt_keyslot_status(cd, 21), CRYPT_SLOT_ACTIVE);
+
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 10, "aes", "xts-plain", &rparams), "Reencryption already initialized.");
+
+       rparams.flags = 0;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams));
+       OK_(crypt_reencrypt(cd, NULL));
+
+       /* check keyslots are reassigned to segment after reencryption */
+       EQ_(crypt_keyslot_status(cd, 0), CRYPT_SLOT_INACTIVE);
+       EQ_(crypt_keyslot_status(cd, 9), CRYPT_SLOT_ACTIVE_LAST);
+       EQ_(crypt_keyslot_status(cd, 10), CRYPT_SLOT_UNBOUND);
+       EQ_(crypt_keyslot_status(cd, 11), CRYPT_SLOT_UNBOUND);
+       EQ_(crypt_keyslot_status(cd, 21), CRYPT_SLOT_INACTIVE);
+
+       EQ_(crypt_keyslot_add_by_key(cd, 21, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 21);
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY;
+       params2.sector_size = 512;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 9, 21, "aes", "xts-plain64", &rparams));
+
+       /* fixed device size parameter impact */
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       rparams.device_size = 24;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 9, 21, "aes", "xts-plain64", &rparams), "Invalid device size.");
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, CRYPT_REQUIREMENT_ONLINE_REENCRYPT);
+       rparams.device_size = 15;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 9, 21, "aes", "xts-plain64", &rparams), "Invalid device size alignment.");
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, CRYPT_REQUIREMENT_ONLINE_REENCRYPT);
+       FAIL_(crypt_reencrypt(cd, NULL), "Reencryption context not initialized.");
+       rparams.device_size = 16;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 9, 21, "aes", "xts-plain64", &rparams));
+       OK_(crypt_reencrypt(cd, NULL));
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, 0);
+
+       /* limited hotzone size parameter impact */
+       EQ_(crypt_keyslot_add_by_key(cd, 9, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 9);
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY;
+       rparams.device_size = 0;
+       params2.sector_size = 4096;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams));
+
+       /* max hotzone size parameter impact */
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       rparams.max_hotzone_size = 1;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Invalid hotzone size alignment.");
+       rparams.max_hotzone_size = 24; /* should be ok. Device size is 16 sectors and the parameter defines upper limit, not lower */
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams));
+       rparams.max_hotzone_size = 8;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams));
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+
+       rparams.max_hotzone_size = 0;
+       rparams.resilience = "haMster";
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Invalid resilience mode.");
+       rparams.resilience = "checksum";
+       rparams.hash = "hamSter";
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Invalid resilience hash.");
+
+       rparams.hash = "sha1";
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams));
+       OK_(crypt_reencrypt(cd, NULL));
+
+       /* FIXME: this is a bug, but not critical (data shift parameter is ignored after initialization) */
+       //rparams.data_shift = 8;
+       //FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Invalid reencryption parameters.");
+
+       EQ_(crypt_keyslot_add_by_key(cd, 21, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 21);
+       rparams.flags = 0;
+       rparams.resilience = "none";
+       rparams.max_hotzone_size = 2048;
+       /* online reencryption on inactive device */
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 9, 21, "aes", "xts-plain64", &rparams), "Device is not active.");
+       /* FIXME: this is minor bug. In fact we need only key from keyslot 9 */
+       //EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 9, PASSPHRASE, strlen(PASSPHRASE), 0), 9);
+       NOTFAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), "Failed to activate device.");
+       /* offline reencryption on active device */
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 9, 21, "aes", "xts-plain64", &rparams), "Device mounted or active.");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       /* Wrong context checks */
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 9, 21, "aes", "xts-plain64", &rparams));
+       /* cd is ready for reencryption */
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd2, CRYPT_LUKS2, NULL));
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd2, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Reencryption already running.");
+       rparams.flags = 0;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd2, NULL, PASSPHRASE, strlen(PASSPHRASE), 21, 9, "aes", "xts-plain64", &rparams), "Reencryption already running.");
+       FAIL_(crypt_reencrypt(cd2, NULL), "Invalid reencryption context.");
+       OK_(crypt_persistent_flags_get(cd, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, CRYPT_REQUIREMENT_ONLINE_REENCRYPT);
+       OK_(crypt_persistent_flags_get(cd2, CRYPT_FLAGS_REQUIREMENTS, &getflags));
+       EQ_(getflags & CRYPT_REQUIREMENT_ONLINE_REENCRYPT, CRYPT_REQUIREMENT_ONLINE_REENCRYPT);
+       EQ_(crypt_reencrypt_status(cd, NULL), CRYPT_REENCRYPT_CLEAN);
+       EQ_(crypt_reencrypt_status(cd2, NULL), CRYPT_REENCRYPT_CLEAN);
+       FAIL_(crypt_activate_by_passphrase(cd2, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), "Reencryption already in progress.");
+       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), "Reencryption already in progress.");
+       OK_(crypt_reencrypt(cd, NULL));
+       CRYPT_FREE(cd);
+       CRYPT_FREE(cd2);
+
+       /* Partial device reencryption parameter */
+       params2.sector_size = 512;
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+
+       rparams.device_size = 2;
+       rparams.max_hotzone_size = 1;
+       rparams.resilience = "none";
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), 2);
+
+       /* interrupt reencryption after 'test_progress_steps' */
+       test_progress_steps = 1;
+       OK_(crypt_reencrypt(cd, &test_progress));
+       EQ_(crypt_reencrypt_status(cd, NULL), CRYPT_REENCRYPT_CLEAN);
+
+       NOTFAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), "Could not activate device in reencryption.");
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(cad.size, 2);
+       EQ_(cad.offset, r_header_size);
+       /* TODO: this should work in future releases unless reencryption process is running */
+       FAIL_(crypt_resize(cd, CDEVICE_1, 1), "Device in reencryption.");
+       FAIL_(crypt_resize(cd, CDEVICE_1, 0), "Device in reencryption.");
+
+       rparams.max_hotzone_size = 0;
+       rparams.device_size = 3;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), "Invalid device size.");
+       crypt_deactivate(cd, CDEVICE_1);
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), "Invalid device size.");
+       rparams.device_size = 2;
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       NOTFAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), "Failed to initialize reencryption.");
+       OK_(crypt_reencrypt(cd, NULL));
+       EQ_(crypt_reencrypt_status(cd, NULL), CRYPT_REENCRYPT_NONE);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 1, PASSPHRASE, strlen(PASSPHRASE), 0), 1);
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       /* after reencryption use whole device again */
+       EQ_(cad.size, 16);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+
+       /* Reencrypt device with wrong size */
+       EQ_(crypt_keyslot_add_by_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 0);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 1, PASSPHRASE, strlen(PASSPHRASE), 0), 1);
+       OK_(crypt_resize(cd, CDEVICE_1, 7));
+       rparams.device_size = 0;
+       rparams.flags = 0;
+       params2.sector_size = 4096;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 1, 0, "aes", "xts-plain64", &rparams), "Active device size is not aligned to new sector size.");
+       rparams.device_size = 8;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 1, 0, "aes", "xts-plain64", &rparams), "Reduced reencryption size does not match active device.");
+       /* FIXME: allow after resize in reencryption is supported */
+       //NOTFAIL_(crypt_activate_by_passphrase(cd, NULL, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), CRYPT_ACTIVATE_ALLOW_UNBOUND_KEY | CRYPT_ACTIVATE_KEYRING_KEY), "Failed to load keys.");
+       // OK_(crypt_resize(cd, CDEVICE_1, 8));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       params2.sector_size = 512;
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_init(&cd2, DMDIR H_DEVICE));
+       OK_(crypt_set_data_offset(cd2, r_header_size - 8));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       OK_(crypt_set_pbkdf_type(cd2, &pbkdf));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_format(cd2, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_volume_key(cd2, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       EQ_(crypt_keyslot_add_by_key(cd2, 1, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       EQ_(crypt_activate_by_passphrase(cd2, CDEVICE_2, 0, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), 2);
+       EQ_(crypt_reencrypt_init_by_passphrase(cd2, NULL, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), 2);
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       /* reference wrong device in active device name */
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_2, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), "Wrong device.");
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd2, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), "Wrong device.");
+       EQ_(crypt_reencrypt_init_by_passphrase(cd2, CDEVICE_2, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), 2);
+       FAIL_(crypt_set_data_device(cd2, DMDIR L_DEVICE_OK), "Device in reencryption.");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd);
+       CRYPT_FREE(cd2);
+
+       /* data shift related tests */
+       params2.sector_size = 512;
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       memset(&rparams, 0, sizeof(rparams));
+       rparams.direction = CRYPT_REENCRYPT_BACKWARD;
+       rparams.resilience = "datashift";
+       rparams.data_shift = 8;
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY;
+       rparams.luks2 = &params2;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), 2);
+       EQ_(crypt_reencrypt_status(cd, &retparams), CRYPT_REENCRYPT_CLEAN);
+       EQ_(retparams.data_shift, 8);
+       EQ_(retparams.mode, CRYPT_REENCRYPT_REENCRYPT);
+       OK_(strcmp(retparams.resilience, "datashift"));
+       EQ_(crypt_get_data_offset(cd), 32776);
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), 2);
+       OK_(crypt_reencrypt(cd, NULL));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 1, PASSPHRASE, strlen(PASSPHRASE), 0), 1);
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(cad.size, 8);
+       EQ_(crypt_get_data_offset(cd), 32776);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       rparams.flags = 0;
+       EQ_(crypt_keyslot_add_by_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 0);
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 1, 0, "aes", "xts-plain64", &rparams), "Device is too small.");
+       CRYPT_FREE(cd);
+       // BUG: We need reencrypt abort flag
+       /* it fails, but it's already initialized and we have no way to abort yet */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 1, NULL, 64, PASSPHRASE, strlen(PASSPHRASE)), 1);
+       EQ_(crypt_keyslot_add_by_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 0);
+       rparams.direction = CRYPT_REENCRYPT_FORWARD;
+       rparams.resilience = "datashift";
+       rparams.data_shift = 8;
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 1, 0, "aes", "xts-plain64", &rparams), 2);
+       EQ_(crypt_reencrypt_status(cd, &retparams), CRYPT_REENCRYPT_CLEAN);
+       EQ_(retparams.data_shift, 8);
+       EQ_(retparams.mode, CRYPT_REENCRYPT_REENCRYPT);
+       OK_(strcmp(retparams.resilience, "datashift"));
+       EQ_(crypt_get_data_offset(cd), 32760);
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 1, 0, "aes", "xts-plain64", &rparams), 2);
+       OK_(crypt_reencrypt(cd, NULL));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(cad.size, 24);
+       EQ_(crypt_get_data_offset(cd), 32760);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       /* data shift with online device */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 0, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 0);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       rparams.direction = CRYPT_REENCRYPT_BACKWARD;
+       rparams.resilience = "datashift";
+       rparams.data_shift = 8;
+       rparams.flags = 0;
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, PASSPHRASE, strlen(PASSPHRASE), 0), 0);
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), "Active device too large.");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       NOTFAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), "Failed to activate device in reencryption.");
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(cad.size, 8);
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 0, 1, "aes", "xts-plain64", &rparams), 2);
+       OK_(crypt_reencrypt(cd, NULL));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+
+       /* encryption with datashift and moved segment (limit values for data shift) */
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, 12*1024*2));
+
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+
+       memset(&rparams, 0, sizeof(rparams));
+       params2.sector_size = 512;
+       params2.data_device = DMDIR L_DEVICE_OK;
+       rparams.mode = CRYPT_REENCRYPT_ENCRYPT;
+       rparams.direction = CRYPT_REENCRYPT_BACKWARD;
+       rparams.resilience = "datashift";
+       rparams.data_shift = 8192;
+       rparams.luks2 = &params2;
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY | CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT;
+       OK_(crypt_set_data_offset(cd, 8192));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "xts-plain64", NULL, NULL, 64, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 30, NULL, 64, PASSPHRASE, strlen(PASSPHRASE)), 30);
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), CRYPT_ANY_SLOT, 30, "aes", "xts-plain64", &rparams), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_header_restore(cd, CRYPT_LUKS2, DMDIR H_DEVICE));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_reencrypt_status(cd, &retparams), CRYPT_REENCRYPT_CLEAN);
+       EQ_(retparams.mode, CRYPT_REENCRYPT_ENCRYPT);
+       OK_(strcmp(retparams.resilience, "datashift"));
+       EQ_(retparams.data_shift, 8192);
+       EQ_(retparams.flags & CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT, CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT);
+       EQ_(crypt_get_data_offset(cd), 8192);
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), CRYPT_ANY_SLOT, 30, NULL, NULL, &rparams), 0);
+       OK_(crypt_reencrypt(cd, NULL));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, 12*1024*2+1));
+
+       /* encryption with datashift and moved segment (data shift + 1 sector) */
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY | CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT;
+       OK_(crypt_set_data_offset(cd, 8192));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "xts-plain64", NULL, NULL, 64, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 30, NULL, 64, PASSPHRASE, strlen(PASSPHRASE)), 30);
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), CRYPT_ANY_SLOT, 30, "aes", "xts-plain64", &rparams), 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_header_restore(cd, CRYPT_LUKS2, DMDIR H_DEVICE));
+       EQ_(crypt_get_data_offset(cd), 8192);
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       EQ_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), CRYPT_ANY_SLOT, 30, NULL, NULL, &rparams), 0);
+       OK_(crypt_reencrypt(cd, NULL));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, 12*1024*2));
+
+       OK_(crypt_init(&cd, DMDIR H_DEVICE));
+
+       /* encryption with datashift and moved segment (data shift + data offset > device size) */
+       memset(&rparams, 0, sizeof(rparams));
+       params2.sector_size = 512;
+       params2.data_device = DMDIR L_DEVICE_OK;
+       rparams.mode = CRYPT_REENCRYPT_ENCRYPT;
+       rparams.direction = CRYPT_REENCRYPT_BACKWARD;
+       rparams.resilience = "datashift";
+       rparams.data_shift = 8200;
+       rparams.luks2 = &params2;
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY | CRYPT_REENCRYPT_MOVE_FIRST_SEGMENT;
+       OK_(crypt_set_data_offset(cd, 8200));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "xts-plain64", NULL, NULL, 64, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 30, NULL, 64, PASSPHRASE, strlen(PASSPHRASE)), 30);
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), CRYPT_ANY_SLOT, 30, "aes", "xts-plain64", &rparams), "Data device is too small");
+       EQ_(crypt_reencrypt_status(cd, NULL), CRYPT_REENCRYPT_NONE);
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_header_size + 1));
+
+       /* decryption backward  */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       params2.data_device = NULL;
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 6);
+       memset(&rparams, 0, sizeof(rparams));
+       rparams.mode = CRYPT_REENCRYPT_DECRYPT;
+       rparams.direction = CRYPT_REENCRYPT_BACKWARD;
+       rparams.resilience = "none";
+       rparams.max_hotzone_size = 2048;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 6, CRYPT_ANY_SLOT, NULL, NULL, &rparams));
+       OK_(crypt_reencrypt(cd, NULL));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), r_header_size);
+       EQ_(crypt_get_volume_key_size(cd), 0);
+       OK_(strcmp(crypt_get_cipher(cd), "cipher_null"));
+       CRYPT_FREE(cd);
+
+       /* decryption forward */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       params2.data_device = NULL;
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 6);
+       memset(&rparams, 0, sizeof(rparams));
+       rparams.mode = CRYPT_REENCRYPT_DECRYPT;
+       rparams.direction = CRYPT_REENCRYPT_FORWARD;
+       rparams.resilience = "none";
+       rparams.max_hotzone_size = 2048;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 6, CRYPT_ANY_SLOT, NULL, NULL, &rparams));
+       OK_(crypt_reencrypt(cd, NULL));
+       CRYPT_FREE(cd);
+
+       /* decryption with data shift */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       params2.data_device = NULL;
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 6);
+       remove(BACKUP_FILE);
+       OK_(crypt_header_backup(cd, CRYPT_LUKS2, BACKUP_FILE));
+       CRYPT_FREE(cd);
+       // FIXME: we need write flock
+       OK_(chmod(BACKUP_FILE, S_IRUSR|S_IWUSR));
+       OK_(crypt_init_data_device(&cd, BACKUP_FILE, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), r_header_size);
+       memset(&rparams, 0, sizeof(rparams));
+       rparams.mode = CRYPT_REENCRYPT_DECRYPT;
+       rparams.direction = CRYPT_REENCRYPT_FORWARD;
+       rparams.resilience = "datashift";
+       rparams.data_shift = r_header_size;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 6, CRYPT_ANY_SLOT, NULL, NULL, &rparams));
+       EQ_(crypt_get_data_offset(cd), 0);
+       OK_(crypt_reencrypt(cd, NULL));
+       remove(BACKUP_FILE);
+       CRYPT_FREE(cd);
+
+       /* online decryption with data shift (future feature) */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       params2.data_device = NULL;
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 6);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_2, 6, PASSPHRASE, strlen(PASSPHRASE), 0), 6);
+       OK_(t_device_size(DMDIR CDEVICE_2, &r_size_1));
+       EQ_(r_size_1, 512);
+       // create placeholder device to block automatic deactivation after decryption
+       OK_(_system("dmsetup create " CDEVICE_1 " --table \"0 1 linear " DMDIR CDEVICE_2 " 0\"", 1));
+       remove(BACKUP_FILE);
+       OK_(crypt_header_backup(cd, CRYPT_LUKS2, BACKUP_FILE));
+       CRYPT_FREE(cd);
+       // FIXME: we need write flock
+       OK_(chmod(BACKUP_FILE, S_IRUSR|S_IWUSR));
+       OK_(crypt_init_data_device(&cd, BACKUP_FILE, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       EQ_(crypt_get_data_offset(cd), r_header_size);
+       memset(&rparams, 0, sizeof(rparams));
+       rparams.mode = CRYPT_REENCRYPT_DECRYPT;
+       rparams.direction = CRYPT_REENCRYPT_FORWARD;
+       rparams.resilience = "datashift";
+       rparams.data_shift = r_header_size;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_2, PASSPHRASE, strlen(PASSPHRASE), 6, CRYPT_ANY_SLOT, NULL, NULL, &rparams));
+       EQ_(crypt_get_data_offset(cd), 0);
+       OK_(crypt_reencrypt(cd, NULL));
+       remove(BACKUP_FILE);
+       OK_(t_device_size(DMDIR CDEVICE_2, &r_size_1));
+       EQ_(r_size_1, 512);
+       OK_(_system("dmsetup remove " DM_RETRY CDEVICE_1 DM_NOSTDERR, 0));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+       OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_header_size));
+       OK_(create_dmdevice_over_loop(L_DEVICE_WRONG, r_header_size));
+
+       /* check detached header misuse (mismatching keys in table and mda) */
+       OK_(crypt_init(&cd, IMAGE_EMPTY_SMALL));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       params2.data_device = DMDIR L_DEVICE_WRONG;
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 6);
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 6, PASSPHRASE, strlen(PASSPHRASE), 0), 6);
+       /* activate second device using same header */
+       OK_(crypt_init_data_device(&cd2, IMAGE_EMPTY_SMALL, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd2, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_pbkdf_type(cd2, &pbkdf));
+       EQ_(crypt_activate_by_passphrase(cd2, CDEVICE_2, 6, PASSPHRASE, strlen(PASSPHRASE), 0), 6);
+       CRYPT_FREE(cd2);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+
+       memset(&rparams, 0, sizeof(rparams));
+       rparams.resilience = "none";
+       rparams.max_hotzone_size = 16*2048;
+       rparams.luks2 = &params2;
+
+       OK_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 6, 1, "aes", "cbc-essiv:sha256", &rparams));
+       OK_(crypt_reencrypt(cd, NULL));
+
+       OK_(crypt_init_data_device(&cd2, IMAGE_EMPTY_SMALL, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd2, CRYPT_LUKS2, NULL));
+       OK_(crypt_set_pbkdf_type(cd2, &pbkdf));
+       EQ_(crypt_keyslot_add_by_key(cd2, 2, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 2);
+       rparams.flags = CRYPT_REENCRYPT_INITIALIZE_ONLY;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd2, CDEVICE_2, PASSPHRASE, strlen(PASSPHRASE), 1, 2, "aes", "cbc-essiv:sha256", &rparams), "Mismatching parameters in device table.");
+       OK_(crypt_reencrypt_init_by_passphrase(cd2, NULL, PASSPHRASE, strlen(PASSPHRASE), 1, 2, "aes", "cbc-essiv:sha256", &rparams));
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd2, CDEVICE_2, PASSPHRASE, strlen(PASSPHRASE), 1, 2, "aes", "cbc-essiv:sha256", &rparams), "Mismatching parameters in device table.");
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd);
+       CRYPT_FREE(cd2);
+
+       /* check detached header misuse (mismatching progress data in active device and mda) */
+       OK_(crypt_init(&cd, IMAGE_EMPTY_SMALL));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       params2.data_device = DMDIR L_DEVICE_WRONG;
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 6);
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 32, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       rparams.flags = 0;
+       rparams.max_hotzone_size = 8;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 6, 1, "aes", "cbc-essiv:sha256", &rparams));
+       /* reencrypt 8 srectors of device */
+       test_progress_steps = 1;
+       OK_(crypt_reencrypt(cd, &test_progress));
+
+       /* activate another data device with same LUKS2 header (this is wrong, but we can't detect such mistake) */
+       OK_(crypt_init_data_device(&cd2, IMAGE_EMPTY_SMALL, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd2, CRYPT_LUKS2, NULL));
+       NOTFAIL_(crypt_activate_by_passphrase(cd2, CDEVICE_2, CRYPT_ANY_SLOT, PASSPHRASE, strlen(PASSPHRASE), 0), "Failed to activate device in reencryption.");
+       CRYPT_FREE(cd2);
+
+       /* reencrypt yet another 8 sectors of first device */
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, NULL, PASSPHRASE, strlen(PASSPHRASE), 6, 1, "aes", "cbc-essiv:sha256", &rparams));
+       test_progress_steps = 1;
+       OK_(crypt_reencrypt(cd, &test_progress));
+
+       /* Now active mapping for second data device does not match its metadata */
+       OK_(crypt_init_data_device(&cd2, IMAGE_EMPTY_SMALL, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd2, CRYPT_LUKS2, NULL));
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       FAIL_(crypt_reencrypt_init_by_passphrase(cd2, CDEVICE_2, PASSPHRASE, strlen(PASSPHRASE), 6, 1, "aes", "cbc-essiv:sha256", &rparams), "Mismatching device table.");
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd2);
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+       OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_header_size + 16));
+
+       /* Test LUKS2 reencryption honors flags device was activate with */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       params2.sector_size = 512;
+       params2.data_device = NULL;
+       OK_(crypt_format(cd, CRYPT_LUKS2, "aes", "cbc-essiv:sha256", NULL, NULL, 32, &params2));
+       EQ_(crypt_keyslot_add_by_volume_key(cd, 6, NULL, 32, PASSPHRASE, strlen(PASSPHRASE)), 6);
+       OK_(crypt_volume_key_keyring(cd, 0)); /* disable keyring */
+       EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 6, PASSPHRASE, strlen(PASSPHRASE), CRYPT_ACTIVATE_ALLOW_DISCARDS), 6);
+       OK_(crypt_volume_key_keyring(cd, 1));
+       rparams.mode = CRYPT_REENCRYPT_REENCRYPT;
+       rparams.direction = CRYPT_REENCRYPT_FORWARD,
+       rparams.resilience = "none",
+       rparams.max_hotzone_size = 8;
+       rparams.luks2 = &params2;
+       rparams.flags = 0;
+       EQ_(crypt_keyslot_add_by_key(cd, 1, NULL, 64, PASSPHRASE, strlen(PASSPHRASE), CRYPT_VOLUME_KEY_NO_SEGMENT), 1);
+       OK_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 6, 1, "aes", "xts-plain64", &rparams));
+       test_progress_steps = 1;
+       OK_(crypt_reencrypt(cd, &test_progress));
+       EQ_(crypt_reencrypt_status(cd, NULL), CRYPT_REENCRYPT_CLEAN);
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(cad.flags & CRYPT_ACTIVATE_ALLOW_DISCARDS, CRYPT_ACTIVATE_ALLOW_DISCARDS);
+       EQ_(cad.flags & CRYPT_ACTIVATE_KEYRING_KEY, 0);
+       CRYPT_FREE(cd);
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       rparams.flags = CRYPT_REENCRYPT_RESUME_ONLY;
+       OK_(crypt_reencrypt_init_by_passphrase(cd, CDEVICE_1, PASSPHRASE, strlen(PASSPHRASE), 6, 1, "aes", "xts-plain64", &rparams));
+       OK_(crypt_reencrypt(cd, NULL));
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(cad.flags & CRYPT_ACTIVATE_ALLOW_DISCARDS, CRYPT_ACTIVATE_ALLOW_DISCARDS);
+       EQ_(cad.flags & CRYPT_ACTIVATE_KEYRING_KEY, 0);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+
+       _cleanup_dmdevices();
+#endif
+}
+
+static void Luks2Repair(void)
+{
+       char rollback[256];
+
+       snprintf(rollback, sizeof(rollback),
+                "dd if=" IMAGE_PV_LUKS2_SEC ".bcp of=%s bs=1M 2>/dev/null",
+                DEVICE_6);
+
+       OK_(crypt_init(&cd, DEVICE_6));
+
+       FAIL_(crypt_load(cd, CRYPT_LUKS, NULL), "Ambiguous signature detected");
+       FAIL_(crypt_repair(cd, CRYPT_LUKS1, NULL), "Not a LUKS2 device");
+
+       /* check explicit LUKS2 repair works */
+       OK_(crypt_repair(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DEVICE_6));
+
+       /* rollback */
+       OK_(_system(rollback, 1));
+       FAIL_(crypt_load(cd, CRYPT_LUKS, NULL), "Ambiguous signature detected");
+
+       /* check repair with type detection works */
+       OK_(crypt_repair(cd, CRYPT_LUKS, NULL));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       CRYPT_FREE(cd);
+
+       /* repeat with locking disabled (must not have any effect) */
+       OK_(_system(rollback, 1));
+       OK_(crypt_init(&cd, DEVICE_6));
+       OK_(crypt_metadata_locking(cd, 0));
+
+       FAIL_(crypt_load(cd, CRYPT_LUKS, NULL), "Ambiguous signature detected");
+       FAIL_(crypt_repair(cd, CRYPT_LUKS1, NULL), "Not a LUKS2 device");
+
+       /* check explicit LUKS2 repair works */
+       OK_(crypt_repair(cd, CRYPT_LUKS2, NULL));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       CRYPT_FREE(cd);
+       OK_(crypt_init(&cd, DEVICE_6));
+
+       /* rollback */
+       OK_(_system(rollback, 1));
+       FAIL_(crypt_load(cd, CRYPT_LUKS, NULL), "Ambiguous signature detected");
+
+       /* check repair with type detection works */
+       OK_(crypt_repair(cd, CRYPT_LUKS, NULL));
+       OK_(crypt_load(cd, CRYPT_LUKS2, NULL));
+       CRYPT_FREE(cd);
+}
+
+static void int_handler(int sig __attribute__((__unused__)))
+{
+       _quit++;
+}
+
+int main(int argc, char *argv[])
+{
+       struct sigaction sa = { .sa_handler = int_handler };
+       int i;
+
+       if (getuid() != 0) {
+               printf("You must be root to run this test.\n");
+               exit(77);
+       }
+#ifndef NO_CRYPTSETUP_PATH
+       if (getenv("CRYPTSETUP_PATH")) {
+               printf("Cannot run this test with CRYPTSETUP_PATH set.\n");
+               exit(77);
+       }
+#endif
+       for (i = 1; i < argc; i++) {
+               if (!strcmp("-v", argv[i]) || !strcmp("--verbose", argv[i]))
+                       _verbose = 1;
+               else if (!strcmp("--debug", argv[i]))
+                       _debug = _verbose = 1;
+       }
+
+       /* Handle interrupt properly */
+       sigaction(SIGINT, &sa, NULL);
+       sigaction(SIGTERM, &sa, NULL);
+
+       register_cleanup(_cleanup);
+
+       _cleanup();
+       if (_setup()) {
+               printf("Cannot set test devices.\n");
+               _cleanup();
+               exit(77);
+       }
+
+       crypt_set_debug_level(_debug ? CRYPT_DEBUG_JSON : CRYPT_DEBUG_NONE);
+
+       RUN_(AddDeviceLuks2, "Format and use LUKS2 device");
+       RUN_(Luks2MetadataSize, "LUKS2 metadata settings");
+       RUN_(Luks2HeaderLoad, "LUKS2 header load");
+       RUN_(Luks2HeaderRestore, "LUKS2 header restore");
+       RUN_(Luks2HeaderBackup, "LUKS2 header backup");
+       RUN_(ResizeDeviceLuks2, "LUKS2 device resize tests");
+       RUN_(UseLuks2Device, "Use pre-formated LUKS2 device");
+       RUN_(SuspendDevice, "LUKS2 Suspend/Resume");
+       RUN_(UseTempVolumes, "Format and use temporary encrypted device");
+       RUN_(Tokens, "General tokens API");
+       RUN_(TokenActivationByKeyring, "Builtin kernel keyring token");
+       RUN_(LuksConvert, "LUKS1 <-> LUKS2 conversions");
+       RUN_(Pbkdf, "Default PBKDF manipulation routines");
+       RUN_(Luks2KeyslotParams, "Add a new keyslot with different encryption");
+       RUN_(Luks2KeyslotAdd, "Add a new keyslot by unused key");
+       RUN_(Luks2ActivateByKeyring, "LUKS2 activation by passphrase in keyring");
+       RUN_(Luks2Requirements, "LUKS2 requirements flags");
+       RUN_(Luks2Integrity, "LUKS2 with data integrity");
+       RUN_(Luks2Refresh, "Active device table refresh");
+       RUN_(Luks2Flags, "LUKS2 persistent flags");
+       RUN_(Luks2Reencryption, "LUKS2 reencryption");
+       RUN_(Luks2Repair, "LUKS2 repair"); // test disables metadata locking. Run always last!
+
+       _cleanup();
+       return 0;
+}
index 7fd85c2..81501eb 100644 (file)
@@ -1,8 +1,9 @@
 /*
  * cryptsetup library API check functions
  *
- * Copyright (C) 2009-2013 Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2014, Milan Broz
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ * Copyright (C) 2016-2020 Ondrej Kozina
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <linux/fs.h>
 #include <errno.h>
-#include <assert.h>
 #include <signal.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <libdevmapper.h>
+#include <inttypes.h>
+#include <sys/types.h>
 
+#include "api_test.h"
 #include "luks.h"
 #include "libcryptsetup.h"
-#include "utils_loop.h"
 
 #define DMDIR "/dev/mapper/"
 
@@ -57,6 +55,7 @@
 #define EVL_HEADER_2 "evil_hdr-payload_overwrite"
 #define EVL_HEADER_3 "evil_hdr-stripes_payload_dmg"
 #define EVL_HEADER_4 "evil_hdr-small_luks_device"
+#define EVL_HEADER_5 "evil_hdr-keyslot_overlap"
 #define VALID_HEADER "valid_header_file"
 #define BACKUP_FILE "csetup_backup_file"
 #define IMAGE1 "compatimage.img"
@@ -69,6 +68,7 @@
 #define KEY2 "0123456789abcdef"
 
 #define PASSPHRASE "blabla"
+#define PASSPHRASE1 "albalb"
 
 #define DEVICE_TEST_UUID "12345678-1234-1234-1234-123456789abc"
 
 #define DEVICE_CHAR "/dev/zero"
 #define THE_LFILE_TEMPLATE "cryptsetup-tstlp.XXXXXX"
 
-#define SECTOR_SHIFT 9L
-#define SECTOR_SIZE 512
-#define TST_LOOP_FILE_SIZE (((1<<20)*50)>>SECTOR_SHIFT)
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#define DIV_ROUND_UP_MODULO(n,d) (DIV_ROUND_UP(n,d)*(d))
 #define LUKS_PHDR_SIZE_B 1024
 
-static int _debug   = 0;
-static int _verbose = 1;
 static int _fips_mode = 0;
 
-static int _quit = 0;
-
-static char global_log[4096];
-static int global_lines = 0;
-
 static char *DEVICE_1 = NULL;
 static char *DEVICE_2 = NULL;
 static char *DEVICE_3 = NULL;
-static char *THE_LOOP_DEV = NULL;
 
 static char *tmp_file_1 = NULL;
 static char *test_loop_file = NULL;
-static uint64_t t_dev_offset = 0;
 
-static int _system(const char*, int);
+struct crypt_device *cd = NULL, *cd2 = NULL;
 
 // Helpers
 
-static int device_size(const char *device, uint64_t *size)
-{
-       int devfd, r = 0;
-
-       devfd = open(device, O_RDONLY);
-       if(devfd == -1)
-               return -EINVAL;
-
-       if (ioctl(devfd, BLKGETSIZE64, size) < 0)
-               r = -EINVAL;
-       close(devfd);
-       return r;
-}
-
-static int fips_mode(void)
-{
-       int fd;
-       char buf = 0;
-
-       if (access("/etc/system-fips", F_OK))
-               return 0;
-
-       fd = open("/proc/sys/crypto/fips_enabled", O_RDONLY);
-
-       if (fd < 0)
-               return 0;
-
-       if (read(fd, &buf, 1) != 1)
-               buf = '0';
-
-       close(fd);
-
-       return (buf == '1');
-}
-
 static int get_luks_offsets(int metadata_device,
                            size_t keylength,
                            unsigned int alignpayload_sec,
@@ -151,14 +102,18 @@ static int get_luks_offsets(int metadata_device,
        uint64_t current_sector;
        uint32_t sectors_per_stripes_set;
 
-       if (!keylength)
+       if (!keylength) {
+               if (r_header_size)
+                   *r_header_size = 0;
+               if (r_payload_offset)
+                   *r_payload_offset = 0;
                return -1;
+       }
 
        sectors_per_stripes_set = DIV_ROUND_UP(keylength*LUKS_STRIPES, SECTOR_SIZE);
-       printf("sectors_per_stripes %" PRIu32 "\n", sectors_per_stripes_set);
        current_sector = DIV_ROUND_UP_MODULO(DIV_ROUND_UP(LUKS_PHDR_SIZE_B, SECTOR_SIZE),
                        LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE);
-       for(i=0;i < (LUKS_NUMKEYS - 1);i++)
+       for (i=0; i < (LUKS_NUMKEYS - 1); i++)
                current_sector = DIV_ROUND_UP_MODULO(current_sector + sectors_per_stripes_set,
                                LUKS_ALIGN_KEYSLOTS / SECTOR_SIZE);
        if (r_header_size)
@@ -178,170 +133,41 @@ static int get_luks_offsets(int metadata_device,
        return 0;
 }
 
-/*
- * Creates dm-linear target over the test loop device. Offset is held in
- * global variables so that size can be tested whether it fits into remaining
- * size of the loop device or not
- */
-static int create_dmdevice_over_loop(const char *dm_name, const uint64_t size)
-{
-       char cmd[128];
-       int r;
-       uint64_t r_size;
-
-       if(device_size(THE_LOOP_DEV, &r_size) < 0 || r_size <= t_dev_offset || !size) 
-               return -1;
-       if ((r_size - t_dev_offset) < size) {
-               printf("No enough space on backing loop device\n.");
-               return -2;
-       }
-       snprintf(cmd, sizeof(cmd),
-                "dmsetup create %s --table \"0 %" PRIu64 " linear %s %" PRIu64 "\"",
-                dm_name, size, THE_LOOP_DEV, t_dev_offset);
-       if  (!(r = _system(cmd, 1))) {
-               t_dev_offset += size;
-       }
-       return r;
-}
-
-// TODO some utility to remove dmdevice over the loop file
-
-// Get key from kernel dm mapping table using dm-ioctl
-static int _get_key_dm(const char *name, char *buffer, unsigned int buffer_size)
-{
-       struct dm_task *dmt;
-       struct dm_info dmi;
-       uint64_t start, length;
-       char *target_type, *key, *params;
-       void *next = NULL;
-       int r = -EINVAL;
-
-       if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
-               goto out;
-       if (!dm_task_set_name(dmt, name))
-               goto out;
-       if (!dm_task_run(dmt))
-               goto out;
-       if (!dm_task_get_info(dmt, &dmi))
-               goto out;
-       if (!dmi.exists)
-               goto out;
-
-       next = dm_get_next_target(dmt, next, &start, &length, &target_type, &params);
-       if (!target_type || strcmp(target_type, "crypt") != 0)
-               goto out;
-
-       (void)strsep(&params, " "); /* rcipher */
-       key = strsep(&params, " ");
-
-       if (buffer_size <= strlen(key))
-               goto out;
-
-       strncpy(buffer, key, buffer_size);
-       r = 0;
-out:
-       if (dmt)
-               dm_task_destroy(dmt);
-
-       return r;
-}
-
-static int _prepare_keyfile(const char *name, const char *passphrase, int size)
-{
-       int fd, r;
-
-       fd = open(name, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR|S_IWUSR);
-       if (fd != -1) {
-               r = write(fd, passphrase, size);
-               close(fd);
-       } else
-               r = 0;
-
-       return r == size ? 0 : 1;
-}
-
 static void _remove_keyfiles(void)
 {
        remove(KEYFILE1);
        remove(KEYFILE2);
 }
 
-// Decode key from its hex representation
-static int crypt_decode_key(char *key, const char *hex, unsigned int size)
-{
-       char buffer[3];
-       char *endp;
-       unsigned int i;
-
-       buffer[2] = '\0';
-
-       for (i = 0; i < size; i++) {
-               buffer[0] = *hex++;
-               buffer[1] = *hex++;
-
-               key[i] = (unsigned char)strtoul(buffer, &endp, 16);
-
-               if (endp != &buffer[2])
-                       return -1;
-       }
-
-       if (*hex != '\0')
-               return -1;
+#if HAVE_DECL_DM_TASK_RETRY_REMOVE
+#define DM_RETRY "--retry "
+#else
+#define DM_RETRY ""
+#endif
 
-       return 0;
-}
+#define DM_NOSTDERR " 2>/dev/null"
 
-static void cmdLineLog(int level, const char *msg)
+static void _cleanup_dmdevices(void)
 {
-       strncat(global_log, msg, sizeof(global_log) - strlen(global_log));
-       global_lines++;
-}
+       struct stat st;
 
-static void new_log(int level, const char *msg, void *usrptr)
-{
-       if (_debug)
-               printf("LOG: %s", msg);
-       cmdLineLog(level, msg);
-}
+       if (!stat(DMDIR H_DEVICE, &st))
+               _system("dmsetup remove " DM_RETRY H_DEVICE DM_NOSTDERR, 0);
 
-static void reset_log(void)
-{
-       memset(global_log, 0, sizeof(global_log));
-       global_lines = 0;
-}
+       if (!stat(DMDIR H_DEVICE_WRONG, &st))
+               _system("dmsetup remove " DM_RETRY H_DEVICE_WRONG DM_NOSTDERR, 0);
 
-static int _system(const char *command, int warn)
-{
-       int r;
-       if (_debug)
-               printf("Running system: %s\n", command);
-       if ((r=system(command)) < 0 && warn)
-               printf("System command failed: %s", command);
-       return r;
-}
+       if (!stat(DMDIR L_DEVICE_0S, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_0S DM_NOSTDERR, 0);
 
-static void _cleanup_dmdevices(void)
-{
-       struct stat st;
+       if (!stat(DMDIR L_DEVICE_1S, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_1S DM_NOSTDERR, 0);
 
-       if (!stat(DMDIR H_DEVICE, &st)) {
-               _system("dmsetup remove " H_DEVICE, 0);
-       }
-       if (!stat(DMDIR H_DEVICE_WRONG, &st)) {
-               _system("dmsetup remove " H_DEVICE_WRONG, 0);
-       }
-       if (!stat(DMDIR L_DEVICE_0S, &st)) {
-               _system("dmsetup remove " L_DEVICE_0S, 0);
-       }
-       if (!stat(DMDIR L_DEVICE_1S, &st)) {
-               _system("dmsetup remove " L_DEVICE_1S, 0);
-       }
-       if (!stat(DMDIR L_DEVICE_WRONG, &st)) {
-               _system("dmsetup remove " L_DEVICE_WRONG, 0);
-       }
-       if (!stat(DMDIR L_DEVICE_OK, &st)) {
-               _system("dmsetup remove " L_DEVICE_OK, 0);
-       }
+       if (!stat(DMDIR L_DEVICE_WRONG, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_WRONG DM_NOSTDERR, 0);
+
+       if (!stat(DMDIR L_DEVICE_OK, &st))
+               _system("dmsetup remove " DM_RETRY L_DEVICE_OK DM_NOSTDERR, 0);
 
        t_dev_offset = 0;
 }
@@ -350,44 +176,50 @@ static void _cleanup(void)
 {
        struct stat st;
 
+       CRYPT_FREE(cd);
+       CRYPT_FREE(cd2);
+
        //_system("udevadm settle", 0);
 
        if (!stat(DMDIR CDEVICE_1, &st))
-               _system("dmsetup remove " CDEVICE_1, 0);
+               _system("dmsetup remove " DM_RETRY CDEVICE_1 DM_NOSTDERR, 0);
 
        if (!stat(DMDIR CDEVICE_2, &st))
-               _system("dmsetup remove " CDEVICE_2, 0);
+               _system("dmsetup remove " DM_RETRY CDEVICE_2 DM_NOSTDERR, 0);
 
        if (!stat(DEVICE_EMPTY, &st))
-               _system("dmsetup remove " DEVICE_EMPTY_name, 0);
+               _system("dmsetup remove " DM_RETRY DEVICE_EMPTY_name DM_NOSTDERR, 0);
 
        if (!stat(DEVICE_ERROR, &st))
-               _system("dmsetup remove " DEVICE_ERROR_name, 0);
+               _system("dmsetup remove " DM_RETRY DEVICE_ERROR_name DM_NOSTDERR, 0);
 
        _cleanup_dmdevices();
 
-       if (crypt_loop_device(THE_LOOP_DEV))
-               crypt_loop_detach(THE_LOOP_DEV);
+       if (loop_device(THE_LOOP_DEV))
+               loop_detach(THE_LOOP_DEV);
 
-       if (crypt_loop_device(DEVICE_1))
-               crypt_loop_detach(DEVICE_1);
+       if (loop_device(DEVICE_1))
+               loop_detach(DEVICE_1);
 
-       if (crypt_loop_device(DEVICE_2))
-               crypt_loop_detach(DEVICE_2);
+       if (loop_device(DEVICE_2))
+               loop_detach(DEVICE_2);
 
-       if (crypt_loop_device(DEVICE_3))
-               crypt_loop_detach(DEVICE_3);
+       if (loop_device(DEVICE_3))
+               loop_detach(DEVICE_3);
 
        _system("rm -f " IMAGE_EMPTY, 0);
        _system("rm -f " IMAGE1, 0);
 
-       remove(test_loop_file);
-       remove(tmp_file_1);
+       if (test_loop_file)
+               remove(test_loop_file);
+       if (tmp_file_1)
+               remove(tmp_file_1);
 
        remove(EVL_HEADER_1);
        remove(EVL_HEADER_2);
        remove(EVL_HEADER_3);
        remove(EVL_HEADER_4);
+       remove(EVL_HEADER_5);
        remove(VALID_HEADER);
        remove(BACKUP_FILE);
 
@@ -417,16 +249,8 @@ static int _setup(void)
        if (_system(cmd, 1))
                return 1;
 
-       if (!THE_LOOP_DEV)
-               THE_LOOP_DEV = crypt_loop_get_device();
-       if (!THE_LOOP_DEV) {
-               printf("Cannot find free loop device.\n");
-               return 1;
-       }
-       if (crypt_loop_device(THE_LOOP_DEV)) {
-               fd = crypt_loop_attach(THE_LOOP_DEV, test_loop_file, 0, 0, &ro);
-               close(fd);
-       }
+       fd = loop_attach(&THE_LOOP_DEV, test_loop_file, 0, 0, &ro);
+       close(fd);
 
        tmp_file_1 = strdup(THE_LFILE_TEMPLATE);
        if ((fd=mkstemp(tmp_file_1)) == -1) {
@@ -441,49 +265,32 @@ static int _setup(void)
 
        _system("dmsetup create " DEVICE_EMPTY_name " --table \"0 10000 zero\"", 1);
        _system("dmsetup create " DEVICE_ERROR_name " --table \"0 10000 error\"", 1);
-       if (!DEVICE_1)
-               DEVICE_1 = crypt_loop_get_device();
-       if (!DEVICE_1) {
-               printf("Cannot find free loop device.\n");
-               return 1;
-       }
-       if (crypt_loop_device(DEVICE_1)) {
-               _system(" [ ! -e " IMAGE1 " ] && bzip2 -dk " IMAGE1 ".bz2", 1);
-               fd = crypt_loop_attach(DEVICE_1, IMAGE1, 0, 0, &ro);
-               close(fd);
-       }
-       if (!DEVICE_2)
-               DEVICE_2 = crypt_loop_get_device();
-       if (!DEVICE_2) {
-               printf("Cannot find free loop device.\n");
-               return 1;
-       }
-       if (crypt_loop_device(DEVICE_2)) {
-               _system("dd if=/dev/zero of=" IMAGE_EMPTY " bs=1M count=4 2>/dev/null", 1);
-               fd = crypt_loop_attach(DEVICE_2, IMAGE_EMPTY, 0, 0, &ro);
-               close(fd);
-       }
-       if (!DEVICE_3)
-               DEVICE_3 = crypt_loop_get_device();
-       if (!DEVICE_3) {
-               printf("Cannot find free loop device.\n");
-               return 1;
-       }
+
+       _system(" [ ! -e " IMAGE1 " ] && xz -dk " IMAGE1 ".xz", 1);
+       fd = loop_attach(&DEVICE_1, IMAGE1, 0, 0, &ro);
+       close(fd);
+
+       _system("dd if=/dev/zero of=" IMAGE_EMPTY " bs=1M count=10 2>/dev/null", 1);
+       fd = loop_attach(&DEVICE_2, IMAGE_EMPTY, 0, 0, &ro);
+       close(fd);
+
        /* Keymaterial offset is less than 8 sectors */
-       _system(" [ ! -e " EVL_HEADER_1 " ] && bzip2 -dk " EVL_HEADER_1 ".bz2", 1);
+       _system(" [ ! -e " EVL_HEADER_1 " ] && xz -dk " EVL_HEADER_1 ".xz", 1);
        /* keymaterial offset aims into payload area */
-       _system(" [ ! -e " EVL_HEADER_2 " ] && bzip2 -dk " EVL_HEADER_2 ".bz2", 1);
-       /* keymaterial offset is valid, number of stripes causes payload area to be overwriten */
-       _system(" [ ! -e " EVL_HEADER_3 " ] && bzip2 -dk " EVL_HEADER_3 ".bz2", 1);
+       _system(" [ ! -e " EVL_HEADER_2 " ] && xz -dk " EVL_HEADER_2 ".xz", 1);
+       /* keymaterial offset is valid, number of stripes causes payload area to be overwritten */
+       _system(" [ ! -e " EVL_HEADER_3 " ] && xz -dk " EVL_HEADER_3 ".xz", 1);
        /* luks device header for data and header on same device. payloadOffset is greater than
         * device size (crypt_load() test) */
-       _system(" [ ! -e " EVL_HEADER_4 " ] && bzip2 -dk " EVL_HEADER_4 ".bz2", 1);
+       _system(" [ ! -e " EVL_HEADER_4 " ] && xz -dk " EVL_HEADER_4 ".xz", 1);
+        /* two keyslots with same offset (overlapping keyslots) */
+       _system(" [ ! -e " EVL_HEADER_5 " ] && xz -dk " EVL_HEADER_5 ".xz", 1);
        /* valid header: payloadOffset=4096, key_size=32,
         * volume_key = bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a */
-       _system(" [ ! -e " VALID_HEADER " ] && bzip2 -dk " VALID_HEADER ".bz2", 1);
+       _system(" [ ! -e " VALID_HEADER " ] && xz -dk " VALID_HEADER ".xz", 1);
 
        /* Prepare tcrypt images */
-       _system(" [ ! -d tcrypt-images ] && tar xjf tcrypt-images.tar.bz2 2>/dev/null", 1);
+       _system("tar xJf tcrypt-images.tar.xz 2>/dev/null", 1);
 
        _system("modprobe dm-crypt", 0);
        _system("modprobe dm-verity", 0);
@@ -492,75 +299,14 @@ static int _setup(void)
        if (_debug)
                printf("FIPS MODE: %d\n", _fips_mode);
 
-       return 0;
-}
-
-static void check_ok(int status, int line, const char *func)
-{
-       char buf[256];
-
-       if (status) {
-               crypt_get_error(buf, sizeof(buf));
-               printf("FAIL line %d [%s]: code %d, %s\n", line, func, status, buf);
-               _cleanup();
-               exit(-1);
-       }
-}
-
-static void check_ko(int status, int line, const char *func)
-{
-       char buf[256];
-
-       memset(buf, 0, sizeof(buf));
-       crypt_get_error(buf, sizeof(buf));
-       if (status >= 0) {
-               printf("FAIL line %d [%s]: code %d, %s\n", line, func, status, buf);
-               _cleanup();
-               exit(-1);
-       } else if (_verbose)
-               printf("   => errno %d, errmsg: %s\n", status, buf);
-}
-
-static void check_equal(int line, const char *func, int64_t x, int64_t y)
-{
-       printf("FAIL line %d [%s]: expected equal values differs: %"
-               PRIi64 " != %" PRIi64 "\n", line, func, x, y);
-       _cleanup();
-       exit(-1);
-}
+       /* Use default log callback */
+       crypt_set_log_callback(NULL, &global_log_callback, NULL);
 
-static void xlog(const char *msg, const char *tst, const char *func, int line, const char *txt)
-{
-       if (_verbose) {
-               if (txt)
-                       printf(" [%s,%s:%d] %s [%s]\n", msg, func, line, tst, txt);
-               else
-                       printf(" [%s,%s:%d] %s\n", msg, func, line, tst);
-       }
-       if (_quit) {
-               if (_verbose)
-                       printf("Interrupted by a signal.\n");
-               _cleanup();
-               exit(-1);
-       }
+       return 0;
 }
 
-/* crypt_device context must be "cd" to parse error properly here */
-#define OK_(x)         do { xlog("(success)", #x, __FUNCTION__, __LINE__, NULL); \
-                            check_ok((x), __LINE__, __FUNCTION__); \
-                       } while(0)
-#define FAIL_(x, y)    do { xlog("(fail)   ", #x, __FUNCTION__, __LINE__, y); \
-                            check_ko((x), __LINE__, __FUNCTION__); \
-                       } while(0)
-#define EQ_(x, y)      do { int64_t _x = (x), _y = (y); \
-                            xlog("(equal)  ", #x " == " #y, __FUNCTION__, __LINE__, NULL); \
-                            if (_x != _y) check_equal(__LINE__, __FUNCTION__, _x, _y); \
-                       } while(0)
-#define RUN_(x, y)             do { printf("%s: %s\n", #x, (y)); x(); } while (0)
-
 static void AddDevicePlain(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_plain params = {
                .hash = "sha1",
                .skip = 0,
@@ -584,7 +330,7 @@ static void AddDevicePlain(void)
        FAIL_(crypt_init(&cd, DEVICE_WRONG), "nonexistent device name ");
        FAIL_(crypt_init(&cd, DEVICE_CHAR), "character device as backing device");
        OK_(crypt_init(&cd, tmp_file_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // test crypt_format, crypt_get_cipher, crypt_get_cipher_mode, crypt_get_volume_key_size
        OK_(crypt_init(&cd,DEVICE_1));
@@ -604,7 +350,7 @@ static void AddDevicePlain(void)
        // crypt_set_uuid()
        FAIL_(crypt_set_uuid(cd,DEVICE_1_UUID),"can't set uuid to plain device");
 
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // default is "plain" hash - no password hash
        OK_(crypt_init(&cd, DEVICE_1));
@@ -613,10 +359,10 @@ static void AddDevicePlain(void)
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // test boundaries in offset parameter
-       device_size(DEVICE_1,&size);
+       t_device_size(DEVICE_1,&size);
        params.hash = NULL;
        // zero sectors length
        params.offset = size >> SECTOR_SHIFT;
@@ -628,17 +374,17 @@ static void AddDevicePlain(void)
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
        // data part of crypt device is of 1 sector size
        params.offset = (size >> SECTOR_SHIFT) - 1;
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init(&cd, DEVICE_1));
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
        OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        snprintf(path, sizeof(path), "%s/%s", crypt_get_dir(), CDEVICE_1);
-       if (device_size(path, &r_size) >= 0)
+       if (t_device_size(path, &r_size) >= 0)
                EQ_(r_size>>SECTOR_SHIFT, 1);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // size > device_size
        params.offset = 0;
@@ -647,7 +393,7 @@ static void AddDevicePlain(void)
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
        FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0),"Device too small");
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // offset == device_size (autodetect size)
        params.offset = (size >> SECTOR_SHIFT);
@@ -656,7 +402,7 @@ static void AddDevicePlain(void)
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
        FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0),"Device too small");
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // offset == device_size (user defined size)
        params.offset = (size >> SECTOR_SHIFT);
@@ -665,7 +411,7 @@ static void AddDevicePlain(void)
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
        FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0),"Device too small");
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // offset+size > device_size
        params.offset = 42;
@@ -674,7 +420,7 @@ static void AddDevicePlain(void)
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
        FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0),"Offset and size are beyond device real size");
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // offset+size == device_size
        params.offset = 42;
@@ -683,11 +429,11 @@ static void AddDevicePlain(void)
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
        OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
-       if (!device_size(path, &r_size))
+       if (!t_device_size(path, &r_size))
                EQ_((r_size >> SECTOR_SHIFT),params.size);
        OK_(crypt_deactivate(cd,CDEVICE_1));
 
-       crypt_free(cd);
+       CRYPT_FREE(cd);
        params.hash = "sha1";
        params.offset = 0;
        params.size = 0;
@@ -709,13 +455,19 @@ static void AddDevicePlain(void)
        close(fd);
        OK_(crypt_deactivate(cd, CDEVICE_1));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // crypt_init_by_name_and_header
        OK_(crypt_init(&cd,DEVICE_1));
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       // init with detached header is not supported
+       OK_(crypt_init_data_device(&cd, DEVICE_2, DEVICE_1));
+       FAIL_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params),
+             "can't use plain with separate metadata device");
+       CRYPT_FREE(cd);
 
        FAIL_(crypt_init_by_name_and_header(&cd, CDEVICE_1, H_DEVICE),"can't init plain device by header device");
        OK_(crypt_init_by_name(&cd, CDEVICE_1));
@@ -725,7 +477,7 @@ static void AddDevicePlain(void)
        EQ_(params.skip, crypt_get_iv_offset(cd));
        EQ_(params.offset, crypt_get_data_offset(cd));
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init(&cd,DEVICE_1));
        OK_(crypt_format(cd,CRYPT_PLAIN,cipher,cipher_mode,NULL,NULL,key_size,&params));
@@ -734,6 +486,7 @@ static void AddDevicePlain(void)
 
        // crypt_set_data_device
        FAIL_(crypt_set_data_device(cd,H_DEVICE),"can't set data device for plain device");
+       NULL_(crypt_get_metadata_device_name(cd));
 
        // crypt_get_type
        OK_(strcmp(crypt_get_type(cd),CRYPT_PLAIN));
@@ -743,7 +496,7 @@ static void AddDevicePlain(void)
 
        // crypt_resize()
        OK_(crypt_resize(cd,CDEVICE_1,size>>SECTOR_SHIFT)); // same size
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size, size);
 
        // size overlaps
@@ -752,14 +505,14 @@ static void AddDevicePlain(void)
 
        // resize ok
        OK_(crypt_resize(cd,CDEVICE_1, 123));
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size>>SECTOR_SHIFT, 123);
        OK_(crypt_resize(cd,CDEVICE_1,0)); // full size (autodetect)
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size, size);
        OK_(crypt_deactivate(cd,CDEVICE_1));
        EQ_(crypt_status(cd,CDEVICE_1),CRYPT_INACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // offset tests
        OK_(crypt_init(&cd,DEVICE_1));
@@ -767,32 +520,32 @@ static void AddDevicePlain(void)
        params.size = (size>>SECTOR_SHIFT) - params.offset - 10;
        OK_(crypt_format(cd,CRYPT_PLAIN,cipher,cipher_mode,NULL,NULL,key_size,&params));
        OK_(crypt_activate_by_volume_key(cd,CDEVICE_1,key,key_size,0));
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size>>SECTOR_SHIFT, params.size);
        // resize to fill remaining capacity
        OK_(crypt_resize(cd,CDEVICE_1,params.size + 10));
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size>>SECTOR_SHIFT, params.size + 10);
 
        // 1 sector beyond real size
        FAIL_(crypt_resize(cd,CDEVICE_1,params.size + 11), "new device size overlaps backing device"); // with respect to offset
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size>>SECTOR_SHIFT, params.size + 10);
        EQ_(crypt_status(cd,CDEVICE_1),CRYPT_ACTIVE);
        fd = open(path, O_RDONLY);
+       NOTFAIL_(fd, "Bad loop device.");
        close(fd);
-       OK_(fd < 0);
 
        // resize to minimal size
        OK_(crypt_resize(cd,CDEVICE_1, 1)); // minimal device size
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size>>SECTOR_SHIFT, 1);
        // use size of backing device (autodetect with respect to offset)
        OK_(crypt_resize(cd,CDEVICE_1,0));
-       if (!device_size(path,&r_size))
+       if (!t_device_size(path,&r_size))
                EQ_(r_size>>SECTOR_SHIFT, (size >> SECTOR_SHIFT)- 42);
        OK_(crypt_deactivate(cd,CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        params.size = 0;
        params.offset = 0;
@@ -807,16 +560,14 @@ static void AddDevicePlain(void)
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
 
        // retrieve volume key check
-       if (!_fips_mode) {
-               memset(key2, 0, key_size);
-               key_size--;
-               // small buffer
-               FAIL_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key2, &key_size, passphrase, strlen(passphrase)), "small buffer");
-               key_size++;
-               OK_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key2, &key_size, passphrase, strlen(passphrase)));
-
-               OK_(memcmp(key, key2, key_size));
-       }
+       memset(key2, 0, key_size);
+       key_size--;
+       // small buffer
+       FAIL_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key2, &key_size, passphrase, strlen(passphrase)), "small buffer");
+       key_size++;
+       OK_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key2, &key_size, passphrase, strlen(passphrase)));
+       OK_(memcmp(key, key2, key_size));
+
        OK_(strcmp(cipher, crypt_get_cipher(cd)));
        OK_(strcmp(cipher_mode, crypt_get_cipher_mode(cd)));
        EQ_((int)key_size, crypt_get_volume_key_size(cd));
@@ -824,17 +575,20 @@ static void AddDevicePlain(void)
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
        // now with keyfile
-       OK_(_prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
-       OK_(_prepare_keyfile(KEYFILE2, KEY2, strlen(KEY2)));
+       OK_(prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
+       OK_(prepare_keyfile(KEYFILE2, KEY2, strlen(KEY2)));
        FAIL_(crypt_activate_by_keyfile(cd, NULL, CRYPT_ANY_SLOT, KEYFILE1, 0, 0), "cannot verify key with plain");
        EQ_(0, crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
        FAIL_(crypt_activate_by_keyfile_offset(cd, NULL, CRYPT_ANY_SLOT, KEYFILE1, 0, strlen(KEY1) + 1, 0), "cannot seek");
+       FAIL_(crypt_activate_by_keyfile_device_offset(cd, NULL, CRYPT_ANY_SLOT, KEYFILE1, 0, strlen(KEY1) + 1, 0), "cannot seek");
        EQ_(0, crypt_activate_by_keyfile_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0, 0));
        OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(0, crypt_activate_by_keyfile_device_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0, 0));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
        _remove_keyfiles();
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init(&cd,DEVICE_1));
        OK_(crypt_format(cd,CRYPT_PLAIN,cipher,cipher_mode,NULL,NULL,key_size,&params));
@@ -847,33 +601,19 @@ static void AddDevicePlain(void)
        EQ_(crypt_keyslot_status(cd, 0), CRYPT_SLOT_INVALID);
        _remove_keyfiles();
 
-       crypt_free(cd);
-}
-
-#define CALLBACK_ERROR "calback_error xyz"
-static int pass_callback_err(const char *msg, char *buf, size_t length, void *usrptr)
-{
-       struct crypt_device *cd = usrptr;
-
-       assert(cd);
-       assert(length);
-       assert(msg);
-
-       crypt_log(cd, CRYPT_LOG_ERROR, CALLBACK_ERROR);
-       return -EINVAL;
+       CRYPT_FREE(cd);
 }
 
-static int pass_callback_ok(const char *msg, char *buf, size_t length, void *usrptr)
+static int new_messages = 0;
+static void new_log(int level, const char *msg, void *usrptr)
 {
-       assert(length);
-       assert(msg);
-       strcpy(buf, PASSPHRASE);
-       return strlen(buf);
+       if (level == CRYPT_LOG_ERROR)
+               new_messages++;
+       global_log_callback(level, msg, usrptr);
 }
 
 static void CallbacksTest(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_plain params = {
                .hash = "sha1",
                .skip = 0,
@@ -884,50 +624,24 @@ static void CallbacksTest(void)
        const char *cipher = "aes";
        const char *cipher_mode = "cbc-essiv:sha256";
        const char *passphrase = PASSPHRASE;
-       char buf1[256] = {0}, buf2[256] = {0};
 
        OK_(crypt_init(&cd, DEVICE_1));
+       new_messages = 0;
        crypt_set_log_callback(cd, &new_log, NULL);
-       //crypt_set_log_callback(cd, NULL, NULL);
-
+       EQ_(new_messages, 0);
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, NULL, key_size, &params));
-
        OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       EQ_(new_messages, 0);
+       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, passphrase, strlen(passphrase), 0), "already exists");
+       EQ_(new_messages, 1);
+       crypt_set_log_callback(cd, NULL, NULL);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-
-       reset_log();
-       crypt_set_password_callback(cd, pass_callback_err, cd);
-       FAIL_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, NULL, 0, 0), "callback fails");
-       EQ_(strncmp(global_log, CALLBACK_ERROR, strlen(CALLBACK_ERROR)), 0);
-
-       crypt_set_password_callback(cd, pass_callback_ok, NULL);
-       OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, NULL, 0, 0));
-       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
-       OK_(crypt_deactivate(cd, CDEVICE_1));
-
-       // Check error reporting.
-       // This must fail and create error message
-       crypt_deactivate(cd, CDEVICE_1);
-
-       // Here context must be the same
-       crypt_get_error(buf1, sizeof(buf1));
-       crypt_last_error(cd, buf2, sizeof(buf2));
-       OK_(!*buf1);
-       OK_(!*buf2);
-       OK_(strcmp(buf1, buf2));
-
-       crypt_get_error(buf1, sizeof(buf1));
-       crypt_last_error(cd, buf2, sizeof(buf2));
-       OK_(*buf1);
-       OK_(*buf2);
-
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 }
 
 static void UseLuksDevice(void)
 {
-       struct crypt_device *cd;
        char key[128];
        size_t key_size;
 
@@ -948,25 +662,26 @@ static void UseLuksDevice(void)
        EQ_((int)key_size, crypt_get_volume_key_size(cd));
        EQ_(1032, crypt_get_data_offset(cd));
 
-       if (!_fips_mode) {
-               EQ_(0, crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, KEY1, strlen(KEY1)));
-               OK_(crypt_volume_key_verify(cd, key, key_size));
-               OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
-               OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
-               EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
-               OK_(crypt_deactivate(cd, CDEVICE_1));
+       EQ_(0, crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, KEY1, strlen(KEY1)));
+       OK_(crypt_volume_key_verify(cd, key, key_size));
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(crypt_deactivate(cd, CDEVICE_1));
 
-               key[1] = ~key[1];
-               FAIL_(crypt_volume_key_verify(cd, key, key_size), "key mismatch");
-               FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "key mismatch");
-       }
-       crypt_free(cd);
+       key[1] = ~key[1];
+       FAIL_(crypt_volume_key_verify(cd, key, key_size), "key mismatch");
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "key mismatch");
+
+       CRYPT_FREE(cd);
 }
 
 static void SuspendDevice(void)
 {
+       struct crypt_active_device cad;
+       char key[128];
+       size_t key_size;
        int suspend_status;
-       struct crypt_device *cd;
 
        OK_(crypt_init(&cd, DEVICE_1));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
@@ -976,67 +691,85 @@ static void SuspendDevice(void)
        if (suspend_status == -ENOTSUP) {
                printf("WARNING: Suspend/Resume not supported, skipping test.\n");
                OK_(crypt_deactivate(cd, CDEVICE_1));
-               crypt_free(cd);
+               CRYPT_FREE(cd);
                return;
        }
 
        OK_(suspend_status);
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(CRYPT_ACTIVATE_SUSPENDED, cad.flags & CRYPT_ACTIVATE_SUSPENDED);
+
        FAIL_(crypt_suspend(cd, CDEVICE_1), "already suspended");
 
        FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)-1), "wrong key");
        OK_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)));
        FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)), "not suspended");
 
-       OK_(_prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
+       OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
+       EQ_(0, cad.flags & CRYPT_ACTIVATE_SUSPENDED);
+
+       OK_(prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
        OK_(crypt_suspend(cd, CDEVICE_1));
        FAIL_(crypt_resume_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1 "blah", 0), "wrong keyfile");
        FAIL_(crypt_resume_by_keyfile_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 1, 0), "wrong key");
-       OK_(crypt_resume_by_keyfile_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
+       FAIL_(crypt_resume_by_keyfile_device_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 1, 0), "wrong key");
+       OK_(crypt_resume_by_keyfile_device_offset(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
        FAIL_(crypt_resume_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0), "not suspended");
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        /* create LUKS device with detached header */
        OK_(crypt_init(&cd, DEVICE_1));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
        OK_(crypt_set_data_device(cd, DEVICE_2));
        OK_(crypt_activate_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1), 0));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        /* Should be able to suspend but not resume if not header specified */
        OK_(crypt_init_by_name(&cd, CDEVICE_1));
        OK_(crypt_suspend(cd, CDEVICE_1));
        FAIL_(crypt_suspend(cd, CDEVICE_1), "already suspended");
        FAIL_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)-1), "no header");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DEVICE_1));
        OK_(crypt_resume_by_passphrase(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEY1, strlen(KEY1)));
 
+       /* Resume by volume key */
+       OK_(crypt_suspend(cd, CDEVICE_1));
+       key_size = sizeof(key);
+       memset(key, 0, key_size);
+       FAIL_(crypt_resume_by_volume_key(cd, CDEVICE_1, key, key_size), "wrong key");
+       OK_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, KEY1, strlen(KEY1)));
+       OK_(crypt_resume_by_volume_key(cd, CDEVICE_1, key, key_size));
+
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        _remove_keyfiles();
 }
 
 static void AddDeviceLuks(void)
 {
-       struct crypt_device *cd;
+       enum { OFFSET_1M = 2048 , OFFSET_2M = 4096, OFFSET_4M = 8192, OFFSET_8M = 16384 };
        struct crypt_params_luks1 params = {
                .hash = "sha512",
-               .data_alignment = 2048, // 4M, data offset will be 4096
+               .data_alignment = OFFSET_1M, // 4M, data offset will be 4096
                .data_device = DEVICE_2
        };
-       char key[128], key2[128];
+       char key[128], key2[128], key3[128];
 
        const char *passphrase = "blabla", *passphrase2 = "nsdkFI&Y#.sd";
        const char *mk_hex = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+       const char *mk_hex2 = "bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1e";
        size_t key_size = strlen(mk_hex) / 2;
        const char *cipher = "aes";
        const char *cipher_mode = "cbc-essiv:sha256";
        uint64_t r_payload_offset, r_header_size, r_size_1;
+       struct crypt_pbkdf_type pbkdf;
 
        crypt_decode_key(key, mk_hex, key_size);
+       crypt_decode_key(key3, mk_hex2, key_size);
 
        // init test devices
        OK_(get_luks_offsets(1, key_size, 0, 0, &r_header_size, &r_payload_offset));
@@ -1047,13 +780,13 @@ static void AddDeviceLuks(void)
        OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG));
        params.data_alignment = 0;
        FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params), "Not enough space for keyslots material");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // test payload_offset = 0 for encrypted device with external header device
        OK_(crypt_init(&cd, DMDIR H_DEVICE));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        EQ_(crypt_get_data_offset(cd), 0);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        params.data_alignment = 0;
        params.data_device = NULL;
@@ -1062,12 +795,37 @@ static void AddDeviceLuks(void)
        OK_(crypt_init(&cd, DEVICE_2));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        OK_(!(crypt_get_data_offset(cd) > 0));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       // set_data_offset has priority, alignment must be 0 or must be compatible
+       params.data_alignment = 0;
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_set_data_offset(cd, OFFSET_8M));
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_(crypt_get_data_offset(cd), OFFSET_8M);
+       CRYPT_FREE(cd);
+
+       // Load gets the value from metadata
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_set_data_offset(cd, OFFSET_2M));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       EQ_(crypt_get_data_offset(cd), OFFSET_8M);
+       CRYPT_FREE(cd);
+
+       params.data_alignment = OFFSET_4M;
+       OK_(crypt_init(&cd, DEVICE_2));
+       FAIL_(crypt_set_data_offset(cd, OFFSET_2M + 1), "Not aligned to 4096"); // must be aligned to 4k
+       OK_(crypt_set_data_offset(cd, OFFSET_2M));
+       FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params), "Alignment not compatible");
+       OK_(crypt_set_data_offset(cd, OFFSET_4M));
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
+       EQ_(crypt_get_data_offset(cd), OFFSET_4M);
+       CRYPT_FREE(cd);
 
        /*
         * test limit values for backing device size
         */
-       params.data_alignment = 4096;
+       params.data_alignment = OFFSET_2M;
        OK_(get_luks_offsets(0, key_size, params.data_alignment, 0, NULL, &r_payload_offset));
        OK_(create_dmdevice_over_loop(L_DEVICE_0S, r_payload_offset));
        OK_(create_dmdevice_over_loop(L_DEVICE_1S, r_payload_offset + 1));
@@ -1077,13 +835,13 @@ static void AddDeviceLuks(void)
        // 1 sector less than required
        OK_(crypt_init(&cd, DMDIR L_DEVICE_WRONG));
        FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params), "Device too small");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // 0 sectors for encrypted area
        OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Encrypted area too small");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // 1 sector for encrypted area
        OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
@@ -1091,20 +849,20 @@ static void AddDeviceLuks(void)
        EQ_(crypt_get_data_offset(cd), params.data_alignment);
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
-       OK_(device_size(DMDIR CDEVICE_1, &r_size_1));
+       OK_(t_device_size(DMDIR CDEVICE_1, &r_size_1));
        EQ_(r_size_1, SECTOR_SIZE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
        // restrict format only to empty context
-       FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params), "Context is already formated");
-       FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, NULL), "Context is already formated");
+       FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params), "Context is already formatted");
+       FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, NULL), "Context is already formatted");
        // change data device to wrong one
        OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_0S));
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Device too small");
        OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_1S));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        params.data_alignment = 0;
        params.data_device = DEVICE_2;
@@ -1114,43 +872,43 @@ static void AddDeviceLuks(void)
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        EQ_(crypt_keyslot_add_by_volume_key(cd, 7, key, key_size, passphrase, strlen(passphrase)), 7);
        EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 7, passphrase, strlen(passphrase) ,0), 7);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
        OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DMDIR H_DEVICE));
-       FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params), "Context is already formated");
+       FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params), "Context is already formatted");
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
        // check active status without header
        OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, NULL));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
-       OK_(!!crypt_get_type(cd));
+       NULL_(crypt_get_type(cd));
        OK_(strcmp(cipher, crypt_get_cipher(cd)));
        OK_(strcmp(cipher_mode, crypt_get_cipher_mode(cd)));
        EQ_((int)key_size, crypt_get_volume_key_size(cd));
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
-       params.data_alignment = 2048;
+       params.data_alignment = OFFSET_1M;
        params.data_device = NULL;
 
        // test uuid mismatch and _init_by_name_and_header
        OK_(crypt_init(&cd, DMDIR L_DEVICE_1S));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
        params.data_alignment = 0;
        params.data_device = DEVICE_2;
        OK_(crypt_init(&cd, DMDIR H_DEVICE));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
        // there we've got uuid mismatch
        OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, DMDIR H_DEVICE));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
-       OK_(!!crypt_get_type(cd));
+       NULL_(crypt_get_type(cd));
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Device is active");
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, key, key_size, 0), "Device is active");
        EQ_(crypt_status(cd, CDEVICE_2), CRYPT_INACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        params.data_device = NULL;
 
@@ -1172,8 +930,19 @@ static void AddDeviceLuks(void)
 
        crypt_set_iteration_time(cd, 1);
        EQ_(1, crypt_keyslot_add_by_volume_key(cd, 1, key, key_size, KEY1, strlen(KEY1)));
-       OK_(_prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
-       OK_(_prepare_keyfile(KEYFILE2, KEY2, strlen(KEY2)));
+
+       // PBKDF info (in LUKS1 slots are the same)
+       FAIL_(crypt_keyslot_get_pbkdf(cd, 1, NULL), "PBKDF struct required");
+       OK_(crypt_keyslot_get_pbkdf(cd, 1, &pbkdf));
+       OK_(strcmp(pbkdf.type, CRYPT_KDF_PBKDF2));
+       OK_(strcmp(pbkdf.hash, params.hash));
+       OK_(pbkdf.iterations < 1000); /* set by minimum iterations above */
+       EQ_(0, pbkdf.max_memory_kb);
+       EQ_(0, pbkdf.parallel_threads);
+       FAIL_(crypt_keyslot_get_pbkdf(cd, 2, &pbkdf), "Keyslot 2 is inactive.");
+
+       OK_(prepare_keyfile(KEYFILE1, KEY1, strlen(KEY1)));
+       OK_(prepare_keyfile(KEYFILE2, KEY2, strlen(KEY2)));
        EQ_(2, crypt_keyslot_add_by_keyfile(cd, 2, KEYFILE1, 0, KEYFILE2, 0));
        FAIL_(crypt_keyslot_add_by_keyfile_offset(cd, 3, KEYFILE1, 0, 1, KEYFILE2, 0, 1), "wrong key");
        EQ_(3, crypt_keyslot_add_by_keyfile_offset(cd, 3, KEYFILE1, 0, 0, KEYFILE2, 0, 1));
@@ -1212,23 +981,20 @@ static void AddDeviceLuks(void)
        EQ_(7, crypt_activate_by_passphrase(cd, NULL, 7, passphrase2, strlen(passphrase2), 0));
        EQ_(6, crypt_keyslot_change_by_passphrase(cd, CRYPT_ANY_SLOT, 6, passphrase2, strlen(passphrase2), passphrase, strlen(passphrase)));
 
-       if (!_fips_mode) {
-               EQ_(6, crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key2, &key_size, passphrase, strlen(passphrase)));
-               OK_(crypt_volume_key_verify(cd, key2, key_size));
+       EQ_(6, crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key2, &key_size, passphrase, strlen(passphrase)));
+       OK_(crypt_volume_key_verify(cd, key2, key_size));
+
+       OK_(memcmp(key, key2, key_size));
 
-               OK_(memcmp(key, key2, key_size));
-       }
        OK_(strcmp(cipher, crypt_get_cipher(cd)));
        OK_(strcmp(cipher_mode, crypt_get_cipher_mode(cd)));
        EQ_((int)key_size, crypt_get_volume_key_size(cd));
-       EQ_(4096, crypt_get_data_offset(cd));
+       EQ_(OFFSET_2M, crypt_get_data_offset(cd));
        OK_(strcmp(DEVICE_2, crypt_get_device_name(cd)));
 
        reset_log();
-       crypt_set_log_callback(cd, &new_log, NULL);
        OK_(crypt_dump(cd));
        OK_(!(global_lines != 0));
-       crypt_set_log_callback(cd, NULL, NULL);
        reset_log();
 
        FAIL_(crypt_set_uuid(cd, "blah"), "wrong UUID format");
@@ -1236,13 +1002,24 @@ static void AddDeviceLuks(void)
        OK_(strcmp(DEVICE_TEST_UUID, crypt_get_uuid(cd)));
 
        FAIL_(crypt_deactivate(cd, CDEVICE_2), "not active");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       // No benchmark PBKDF2
+       pbkdf.flags = CRYPT_PBKDF_NO_BENCHMARK;
+       pbkdf.hash = "sha256";
+       pbkdf.iterations = 1000;
+       pbkdf.time_ms = 0;
+
+       OK_(crypt_init(&cd, DEVICE_2));
+       OK_(crypt_set_pbkdf_type(cd, &pbkdf));
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
+       CRYPT_FREE(cd);
+
        _cleanup_dmdevices();
 }
 
 static void UseTempVolumes(void)
 {
-       struct crypt_device *cd;
        char tmp[256];
 
        // Tepmporary device without keyslot but with on-disk LUKS header
@@ -1251,14 +1028,14 @@ static void UseTempVolumes(void)
        OK_(crypt_format(cd, CRYPT_LUKS1, "aes", "cbc-essiv:sha256", NULL, NULL, 16, NULL));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0));
        EQ_(crypt_status(cd, CDEVICE_2), CRYPT_ACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init_by_name(&cd, CDEVICE_2));
        OK_(crypt_deactivate(cd, CDEVICE_2));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // Dirty checks: device without UUID
-       // we should be able to remove it but not manuipulate with it
+       // we should be able to remove it but not manipulate with it
        snprintf(tmp, sizeof(tmp), "dmsetup create %s --table \""
                "0 100 crypt aes-cbc-essiv:sha256 deadbabedeadbabedeadbabedeadbabe 0 "
                "%s 2048\"", CDEVICE_2, DEVICE_2);
@@ -1266,7 +1043,7 @@ static void UseTempVolumes(void)
        OK_(crypt_init_by_name(&cd, CDEVICE_2));
        OK_(crypt_deactivate(cd, CDEVICE_2));
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0), "No known device type");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // Dirty checks: device with UUID but LUKS header key fingerprint must fail)
        snprintf(tmp, sizeof(tmp), "dmsetup create %s --table \""
@@ -1277,29 +1054,28 @@ static void UseTempVolumes(void)
        OK_(crypt_init_by_name(&cd, CDEVICE_2));
        OK_(crypt_deactivate(cd, CDEVICE_2));
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0), "wrong volume key");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // No slots
        OK_(crypt_init(&cd, DEVICE_2));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, NULL, 0, 0), "volume key is lost");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // Plain device
        OK_(crypt_init(&cd, DEVICE_2));
        OK_(crypt_format(cd, CRYPT_PLAIN, "aes", "cbc-essiv:sha256", NULL, NULL, 16, NULL));
        FAIL_(crypt_activate_by_volume_key(cd, NULL, "xxx", 3, 0), "cannot verify key with plain");
        FAIL_(crypt_volume_key_verify(cd, "xxx", 3), "cannot verify key with plain");
-       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, "xxx", 3, 0), "wrong key lenght");
+       FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_2, "xxx", 3, 0), "wrong key length");
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_2, "volumekeyvolumek", 16, 0));
        EQ_(crypt_status(cd, CDEVICE_2), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_2));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 }
 
 static void LuksHeaderRestore(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_luks1 params = {
                .hash = "sha512",
                .data_alignment = 2048, // 4M, data offset will be 4096
@@ -1331,7 +1107,7 @@ static void LuksHeaderRestore(void)
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, VALID_HEADER), "Cannot restore header over PLAIN type device");
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // invalid headers
        OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
@@ -1340,6 +1116,7 @@ static void LuksHeaderRestore(void)
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_2), "Header corrupted");
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_3), "Header corrupted");
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_4), "Header too small");
+       FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_5), "Header corrupted");
        OK_(crypt_header_restore(cd, CRYPT_LUKS1, VALID_HEADER));
        // wipe valid luks header
        snprintf(cmd, sizeof(cmd), "dd if=/dev/zero of=" DMDIR L_DEVICE_OK " bs=512 count=%" PRIu64 " 2>/dev/null", r_payload_offset);
@@ -1348,17 +1125,18 @@ static void LuksHeaderRestore(void)
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_2), "Header corrupted");
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_3), "Header corrupted");
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_4), "Header too small");
+       FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, EVL_HEADER_5), "Header corrupted");
        OK_(crypt_header_restore(cd, CRYPT_LUKS1, VALID_HEADER));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // volume key_size mismatch
        OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
        memcpy(key2, key, key_size / 2);
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key2, key_size / 2, &params));
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, VALID_HEADER), "Volume keysize mismatch");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // payload offset mismatch
        params.data_alignment = 8192;
@@ -1366,14 +1144,25 @@ static void LuksHeaderRestore(void)
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        FAIL_(crypt_header_restore(cd, CRYPT_LUKS1, VALID_HEADER), "Payload offset mismatch");
        //_system("dmsetup table;sleep 1",1);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       /* check crypt_header_restore() properly loads crypt_device context */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_wipe(cd, NULL, CRYPT_WIPE_ZERO, 0, 1*1024*1024, 1*1024*1024, 0, NULL, NULL));
+       OK_(crypt_header_restore(cd, CRYPT_LUKS1, VALID_HEADER));
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
+       /* same test, any LUKS */
+       OK_(crypt_wipe(cd, NULL, CRYPT_WIPE_ZERO, 0, 1*1024*1024, 1*1024*1024, 0, NULL, NULL));
+       OK_(crypt_header_restore(cd, CRYPT_LUKS, VALID_HEADER));
+       OK_(crypt_activate_by_volume_key(cd, NULL, key, key_size, 0));
+
+       CRYPT_FREE(cd);
 
        _cleanup_dmdevices();
 }
 
 static void LuksHeaderLoad(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_luks1 params = {
                .hash = "sha512",
                .data_alignment = 2048,
@@ -1391,6 +1180,7 @@ static void LuksHeaderLoad(void)
        const char *cipher = "aes";
        const char *cipher_mode = "cbc-essiv:sha256";
        uint64_t r_payload_offset, r_header_size;
+       uint64_t mdata_size, keyslots_size;
 
        crypt_decode_key(key, mk_hex, key_size);
 
@@ -1416,55 +1206,78 @@ static void LuksHeaderLoad(void)
        params.data_device = DMDIR L_DEVICE_OK;
        OK_(crypt_init(&cd, DMDIR H_DEVICE));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
        OK_(crypt_init(&cd, DMDIR H_DEVICE));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
        OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_OK));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       OK_(!crypt_get_metadata_device_name(cd));
+       EQ_(strcmp(DMDIR H_DEVICE, crypt_get_metadata_device_name(cd)), 0);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       // repeat with init with two devices
+       OK_(crypt_init_data_device(&cd, DMDIR H_DEVICE, DMDIR L_DEVICE_OK));
+       OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
+       CRYPT_FREE(cd);
+       OK_(crypt_init_data_device(&cd, DMDIR H_DEVICE, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
+       OK_(!crypt_get_metadata_device_name(cd));
+       EQ_(strcmp(DMDIR H_DEVICE, crypt_get_metadata_device_name(cd)), 0);
+       CRYPT_FREE(cd);
 
        // bad header: device too small (payloadOffset > device_size)
        OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG));
        FAIL_(crypt_load(cd, CRYPT_LUKS1, NULL), "Device too small");
-       OK_(!!crypt_get_type(cd));
-       crypt_free(cd);
+       NULL_(crypt_get_type(cd));
+       CRYPT_FREE(cd);
 
        // 0 secs for encrypted data area
        params.data_alignment = 2048;
        params.data_device = NULL;
        OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
-       crypt_free(cd);
+       FAIL_(crypt_set_metadata_size(cd, 0x004000, 0x004000), "Wrong context type");
+       OK_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size));
+       EQ_(mdata_size, LUKS_ALIGN_KEYSLOTS);
+       EQ_(keyslots_size, r_header_size * SECTOR_SIZE - mdata_size);
+       CRYPT_FREE(cd);
        // load should be ok
        OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
        FAIL_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0), "Device too small");
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_INACTIVE);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // damaged header
        OK_(_system("dd if=/dev/zero of=" DMDIR L_DEVICE_OK " bs=512 count=8 2>/dev/null", 1));
        OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
        FAIL_(crypt_load(cd, CRYPT_LUKS1, NULL), "Header not found");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // plain device
        OK_(crypt_init(&cd, DMDIR H_DEVICE));
        FAIL_(crypt_load(cd, CRYPT_PLAIN, NULL), "Can't load nonLUKS device type");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
        OK_(crypt_init(&cd, DMDIR H_DEVICE));
        OK_(crypt_format(cd, CRYPT_PLAIN, cipher, cipher_mode, NULL, key, key_size, &pl_params));
        FAIL_(crypt_load(cd, CRYPT_LUKS1, NULL), "Can't load over nonLUKS device type");
-       crypt_free(cd);
+       FAIL_(crypt_set_metadata_size(cd, 0x004000, 0x004000), "Wrong context type");
+       FAIL_(crypt_get_metadata_size(cd, &mdata_size, &keyslots_size), "Wrong context type");
+       CRYPT_FREE(cd);
+
+       /* check load sets proper device type */
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_0S));
+       OK_(crypt_load(cd, CRYPT_LUKS, NULL));
+       EQ_(strcmp(CRYPT_LUKS1, crypt_get_type(cd)), 0);
+       CRYPT_FREE(cd);
 
        _cleanup_dmdevices();
 }
 
 static void LuksHeaderBackup(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_luks1 params = {
                .hash = "sha512",
                .data_alignment = 2048,
@@ -1493,7 +1306,7 @@ static void LuksHeaderBackup(void)
        EQ_(crypt_keyslot_add_by_volume_key(cd, 0, key, key_size, passphrase, strlen(passphrase)), 0);
        OK_(crypt_header_backup(cd, CRYPT_LUKS1, BACKUP_FILE));
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // restore header from backup
        OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
@@ -1502,7 +1315,7 @@ static void LuksHeaderBackup(void)
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // exercise luksOpen using backup header in file
        OK_(crypt_init(&cd, BACKUP_FILE));
@@ -1511,7 +1324,7 @@ static void LuksHeaderBackup(void)
        EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, passphrase, strlen(passphrase), 0), 0);
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init(&cd, BACKUP_FILE));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
@@ -1519,19 +1332,19 @@ static void LuksHeaderBackup(void)
        EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 7, passphrase, strlen(passphrase), 0), 7);
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // exercise luksOpen using backup header on block device
-       fd = crypt_loop_attach(DEVICE_3, BACKUP_FILE, 0, 0, &ro);
+       fd = loop_attach(&DEVICE_3, BACKUP_FILE, 0, 0, &ro);
+       NOTFAIL_(fd, "Bad loop device.");
        close(fd);
-       OK_(fd < 0);
        OK_(crypt_init(&cd, DEVICE_3));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
        OK_(crypt_set_data_device(cd, DMDIR L_DEVICE_OK));
        EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 0, passphrase, strlen(passphrase), 0), 0);
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init(&cd, DEVICE_3));
        OK_(crypt_load(cd, CRYPT_LUKS1, NULL));
@@ -1539,14 +1352,13 @@ static void LuksHeaderBackup(void)
        EQ_(crypt_activate_by_passphrase(cd, CDEVICE_1, 7, passphrase, strlen(passphrase), 0), 7);
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        _cleanup_dmdevices();
 }
 
 static void ResizeDeviceLuks(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_luks1 params = {
                .hash = "sha512",
                .data_alignment = 2048,
@@ -1567,24 +1379,25 @@ static void ResizeDeviceLuks(void)
        OK_(create_dmdevice_over_loop(H_DEVICE, r_header_size));
        OK_(create_dmdevice_over_loop(L_DEVICE_OK, r_payload_offset + 1000));
        OK_(create_dmdevice_over_loop(L_DEVICE_0S, 1000));
+       OK_(create_dmdevice_over_loop(L_DEVICE_WRONG, r_payload_offset + 1000));
 
        // test header and encrypted payload all in one device
        OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        OK_(crypt_resize(cd, CDEVICE_1, 42));
-       if (!device_size(DMDIR CDEVICE_1, &r_size))
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
                EQ_(42, r_size >> SECTOR_SHIFT);
        // autodetect encrypted device area size
        OK_(crypt_resize(cd, CDEVICE_1, 0));
-       if (!device_size(DMDIR CDEVICE_1, &r_size))
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
                EQ_(1000, r_size >> SECTOR_SHIFT);
        FAIL_(crypt_resize(cd, CDEVICE_1, 1001), "Device too small");
-       if (!device_size(DMDIR CDEVICE_1, &r_size))
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
                EQ_(1000, r_size >> SECTOR_SHIFT);
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        params.data_alignment = 0;
        params.data_device = DMDIR L_DEVICE_0S;
@@ -1593,25 +1406,46 @@ static void ResizeDeviceLuks(void)
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
        OK_(crypt_resize(cd, CDEVICE_1, 666));
-       if (!device_size(DMDIR CDEVICE_1, &r_size))
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
                EQ_(666, r_size >> SECTOR_SHIFT);
        // autodetect encrypted device size
        OK_(crypt_resize(cd, CDEVICE_1, 0));
-       if (!device_size(DMDIR CDEVICE_1, &r_size))
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
                EQ_(1000, r_size >> SECTOR_SHIFT);
        FAIL_(crypt_resize(cd, CDEVICE_1, 1001), "Device too small");
-       if (!device_size(DMDIR CDEVICE_1, &r_size))
+       if (!t_device_size(DMDIR CDEVICE_1, &r_size))
                EQ_(1000, r_size >> SECTOR_SHIFT);
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
+       OK_(crypt_load(cd, NULL, NULL));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
+
+       /* do not allow resize of other device */
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_WRONG));
+       OK_(crypt_format(cd2, CRYPT_LUKS1, cipher, cipher_mode, crypt_get_uuid(cd), key, key_size, &params));
+       OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, key_size, 0));
+       FAIL_(crypt_resize(cd2, CDEVICE_1, 1), "Device got resized by wrong device context.");
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd2);
+
+       OK_(crypt_init(&cd2, DMDIR L_DEVICE_WRONG));
+       OK_(crypt_format(cd2, CRYPT_PLAIN, cipher, cipher_mode, NULL, key, key_size, NULL));
+       OK_(crypt_activate_by_volume_key(cd2, CDEVICE_2, key, key_size, 0));
+       FAIL_(crypt_resize(cd2, CDEVICE_1, 1), "Device got resized by wrong device context.");
+       OK_(crypt_deactivate(cd2, CDEVICE_2));
+       CRYPT_FREE(cd2);
+
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
 
        _cleanup_dmdevices();
 }
 
 static void HashDevicePlain(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_plain params = {
                .hash = NULL,
                .skip = 0,
@@ -1626,7 +1460,7 @@ static void HashDevicePlain(void)
        OK_(crypt_format(cd, CRYPT_PLAIN, "aes", "cbc-essiv:sha256", NULL, NULL, 16, &params));
 
        // hash PLAIN, short key
-       OK_(_prepare_keyfile(KEYFILE1, "tooshort", 8));
+       OK_(prepare_keyfile(KEYFILE1, "tooshort", 8));
        FAIL_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 16, 0), "not enough data in keyfile");
        _remove_keyfiles();
 
@@ -1635,16 +1469,16 @@ static void HashDevicePlain(void)
        mk_hex = "caffeecaffeecaffeecaffeecaffee88";
        key_size = 16;
        crypt_decode_key(key, mk_hex, key_size);
-       OK_(_prepare_keyfile(KEYFILE1, key, key_size));
+       OK_(prepare_keyfile(KEYFILE1, key, key_size));
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, key_size, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        OK_(strcmp(key, mk_hex));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
        // Limit plain key
        mk_hex = "caffeecaffeecaffeecaffeeca000000";
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, key_size - 3, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        OK_(strcmp(key, mk_hex));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
@@ -1655,21 +1489,37 @@ static void HashDevicePlain(void)
        mk_hex = "caffeecaffeecaffeecaffeecaffee88babebabe";
        key_size = 16;
        crypt_decode_key(key, mk_hex, key_size);
-       OK_(_prepare_keyfile(KEYFILE1, key, strlen(mk_hex) / 2));
+       OK_(prepare_keyfile(KEYFILE1, key, strlen(mk_hex) / 2));
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, key_size, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        FAIL_(strcmp(key, mk_hex), "only key length used");
        OK_(strncmp(key, mk_hex, key_size));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
-
        // Now without explicit limit
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        FAIL_(strcmp(key, mk_hex), "only key length used");
        OK_(strncmp(key, mk_hex, key_size));
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       _remove_keyfiles();
+
+       // Handling of legacy "plain" hash (no hash)
+       params.hash = "plain";
+       //         0 1 2 3 4 5 6 7 8 9 a b c d e f
+       mk_hex = "aabbcaffeecaffeecaffeecaffeecaff";
+       key_size = 16;
+       crypt_decode_key(key, mk_hex, key_size);
+       OK_(prepare_keyfile(KEYFILE1, key, strlen(mk_hex) / 2));
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_format(cd, CRYPT_PLAIN, "aes", "cbc-essiv:sha256", NULL, NULL, 16, &params));
+       OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, key_size, 0));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(strcmp(key, mk_hex));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
 
        _remove_keyfiles();
 
@@ -1682,15 +1532,15 @@ static void HashDevicePlain(void)
        mk_hex = "c62e4615bd39e222572f3a1bf7c2132e";
        keystr = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
        key_size = strlen(keystr); // 32
-       OK_(_prepare_keyfile(KEYFILE1, keystr, strlen(keystr)));
+       OK_(prepare_keyfile(KEYFILE1, keystr, strlen(keystr)));
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, key_size, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        OK_(strcmp(key, mk_hex));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
        // Read full keyfile
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        OK_(strcmp(key, mk_hex));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
@@ -1698,15 +1548,15 @@ static void HashDevicePlain(void)
 
        // Limit keyfile read
        keystr = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxAAAAAAAA";
-       OK_(_prepare_keyfile(KEYFILE1, keystr, strlen(keystr)));
+       OK_(prepare_keyfile(KEYFILE1, keystr, strlen(keystr)));
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, key_size, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        OK_(strcmp(key, mk_hex));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
        // Full keyfile
        OK_(crypt_activate_by_keyfile(cd, CDEVICE_1, CRYPT_ANY_SLOT, KEYFILE1, 0, 0));
-       OK_(_get_key_dm(CDEVICE_1, key, sizeof(key)));
+       OK_(get_key_dm(CDEVICE_1, key, sizeof(key)));
        OK_(strcmp(key, "0e49cb34a1dee1df33f6505e4de44a66"));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
@@ -1714,15 +1564,15 @@ static void HashDevicePlain(void)
 
        // FIXME: add keyfile="-" tests somehow
 
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 }
 
 static void VerityTest(void)
 {
-       struct crypt_device *cd;
        const char *salt_hex =  "20c28ffc129c12360ba6ceea2b6cf04e89c2b41cfe6b8439eb53c1897f50df7b";
        const char *root_hex =  "ab018b003a967fc782effb293b6dccb60b4f40c06bf80d16391acf686d28b5d6";
-       char salt[256], root_hash[256];
+       char salt[256], root_hash[256], root_hash_out[256];
+       size_t root_hash_out_size = 256;
        struct crypt_active_device cad;
        struct crypt_params_verity params = {
                .data_device = DEVICE_EMPTY,
@@ -1741,11 +1591,11 @@ static void VerityTest(void)
        /* block size */
        params.data_block_size = 333;
        FAIL_(crypt_format(cd, CRYPT_VERITY, NULL, NULL, NULL, NULL, 0, &params),
-               "Unsupppored block size.");
+               "Unsupported block size.");
        params.data_block_size = 4096;
        params.hash_block_size = 333;
        FAIL_(crypt_format(cd, CRYPT_VERITY, NULL, NULL, NULL, NULL, 0, &params),
-               "Unsupppored block size.");
+               "Unsupported block size.");
        params.hash_block_size = 4096;
 
        /* salt size */
@@ -1765,7 +1615,13 @@ static void VerityTest(void)
        params.hash_name = "sha256";
 
        OK_(crypt_format(cd, CRYPT_VERITY, NULL, NULL, NULL, NULL, 0, &params));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       params.data_device = NULL;
+       OK_(crypt_init_data_device(&cd, DEVICE_2, DEVICE_EMPTY));
+       OK_(crypt_format(cd, CRYPT_VERITY, NULL, NULL, NULL, NULL, 0, &params));
+       EQ_(strcmp(DEVICE_2, crypt_get_metadata_device_name(cd)), 0);
+       CRYPT_FREE(cd);
 
        /* Verify */
        OK_(crypt_init(&cd, DEVICE_2));
@@ -1795,19 +1651,25 @@ static void VerityTest(void)
        if (crypt_activate_by_volume_key(cd, CDEVICE_1, root_hash, 32,
            CRYPT_ACTIVATE_READONLY) == -ENOTSUP) {
                printf("WARNING: kernel dm-verity not supported, skipping test.\n");
-               crypt_free(cd);
+               CRYPT_FREE(cd);
                return;
        }
        OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
        EQ_(CRYPT_ACTIVATE_READONLY, cad.flags);
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       memset(root_hash_out, 0, root_hash_out_size);
+       OK_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, root_hash_out, &root_hash_out_size, NULL, 0));
+       EQ_(32, root_hash_out_size);
+       OK_(memcmp(root_hash, root_hash_out, root_hash_out_size));
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
        /* hash fail */
        root_hash[1] = ~root_hash[1];
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, root_hash, 32, CRYPT_ACTIVATE_READONLY));
+       /* Be sure there was some read activity to mark device corrupted. */
+       _system("blkid " DMDIR CDEVICE_1, 0);
        OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
        EQ_(CRYPT_ACTIVATE_READONLY|CRYPT_ACTIVATE_CORRUPTED, cad.flags);
        OK_(crypt_deactivate(cd, CDEVICE_1));
@@ -1816,16 +1678,16 @@ static void VerityTest(void)
        /* data fail */
        OK_(crypt_set_data_device(cd, DEVICE_1));
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, root_hash, 32, CRYPT_ACTIVATE_READONLY));
+       _system("blkid " DMDIR CDEVICE_1, 0);
        OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
        EQ_(CRYPT_ACTIVATE_READONLY|CRYPT_ACTIVATE_CORRUPTED, cad.flags);
        OK_(crypt_deactivate(cd, CDEVICE_1));
 
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 }
 
 static void TcryptTest(void)
 {
-       struct crypt_device *cd = NULL;
        struct crypt_active_device cad;
        const char *passphrase = "aaaaaaaaaaaa";
        const char *kf1 = "tcrypt-images/keyfile1";
@@ -1870,24 +1732,22 @@ static void TcryptTest(void)
        EQ_(256, crypt_get_data_offset(cd));
 
        memset(key, 0, key_size);
-       if (!_fips_mode) {
-               key_size--;
-               // small buffer
-               FAIL_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, NULL, 0), "small buffer");
-               key_size++;
-               OK_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, NULL, 0));
-               OK_(memcmp(key, key_def, key_size));
-       }
+
+       key_size--;
+       // small buffer
+       FAIL_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, NULL, 0), "small buffer");
+       key_size++;
+       OK_(crypt_volume_key_get(cd, CRYPT_ANY_SLOT, key, &key_size, NULL, 0));
+       OK_(memcmp(key, key_def, key_size));
 
        reset_log();
-       crypt_set_log_callback(cd, &new_log, NULL);
        OK_(crypt_dump(cd));
        OK_(!(global_lines != 0));
-       crypt_set_log_callback(cd, NULL, NULL);
        reset_log();
 
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, NULL, 0, CRYPT_ACTIVATE_READONLY));
-       crypt_free(cd);
+       NULL_(crypt_get_metadata_device_name(cd));
+       CRYPT_FREE(cd);
 
        OK_(crypt_init_by_name_and_header(&cd, CDEVICE_1, NULL));
        EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
@@ -1908,14 +1768,28 @@ static void TcryptTest(void)
        EQ_(72, cad.size);
 
        OK_(crypt_deactivate(cd, CDEVICE_1));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
+
+       // init with detached header is not supported
+       OK_(crypt_init_data_device(&cd, tcrypt_dev2, DEVICE_2));
+       FAIL_(crypt_load(cd, CRYPT_TCRYPT, &params), "can't use tcrypt with separate metadata device");
+       CRYPT_FREE(cd);
+
+       // Following test uses non-FIPS algorithms in the cipher chain
+       if(_fips_mode)
+               return;
 
        OK_(crypt_init(&cd, tcrypt_dev2));
        params.keyfiles = NULL;
        params.keyfiles_count = 0;
-       OK_(crypt_load(cd, CRYPT_TCRYPT, &params));
+       r = crypt_load(cd, CRYPT_TCRYPT, &params);
+       if (r < 0) {
+               printf("WARNING: cannot use non-AES encryption, skipping test.\n");
+               CRYPT_FREE(cd);
+               return;
+       }
        OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, NULL, 0, CRYPT_ACTIVATE_READONLY));
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        // Deactivate the whole chain
        EQ_(crypt_status(NULL, CDEVICE_1 "_1"), CRYPT_BUSY);
@@ -1923,10 +1797,62 @@ static void TcryptTest(void)
        EQ_(crypt_status(NULL, CDEVICE_1 "_1"), CRYPT_INACTIVE);
 }
 
+static void IntegrityTest(void)
+{
+       struct crypt_params_integrity params = {
+               .tag_size = 4,
+               .integrity = "crc32c",
+               .sector_size = 4096,
+       }, ip = {};
+       int ret;
+
+       // FIXME: this should be more detailed
+
+       OK_(crypt_init(&cd,DEVICE_1));
+       FAIL_(crypt_format(cd,CRYPT_INTEGRITY,NULL,NULL,NULL,NULL,0,NULL), "params field required");
+       ret = crypt_format(cd,CRYPT_INTEGRITY,NULL,NULL,NULL,NULL,0,&params);
+       if (ret < 0) {
+               printf("WARNING: cannot format integrity device, skipping test.\n");
+               CRYPT_FREE(cd);
+               return;
+       }
+       OK_(crypt_get_integrity_info(cd, &ip));
+       EQ_(ip.tag_size, params.tag_size);
+       EQ_(ip.sector_size, params.sector_size);
+       EQ_(crypt_get_sector_size(cd), params.sector_size);
+       EQ_(ip.interleave_sectors, params.interleave_sectors);
+       EQ_(ip.journal_size, params.journal_size);
+       EQ_(ip.journal_watermark, params.journal_watermark);
+       OK_(strcmp(ip.integrity,params.integrity));
+       FAIL_(crypt_set_uuid(cd,DEVICE_1_UUID),"can't set uuid to integrity device");
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DEVICE_1));
+       OK_(crypt_load(cd, CRYPT_INTEGRITY, NULL));
+       CRYPT_FREE(cd);
+
+       OK_(crypt_init(&cd, DEVICE_1));
+       //params.tag_size = 8;
+       //FAIL_(crypt_load(cd, CRYPT_INTEGRITY, &params), "tag size mismatch");
+       params.tag_size = 4;
+       OK_(crypt_load(cd, CRYPT_INTEGRITY, &params));
+       OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, NULL, 0, 0));
+       EQ_(crypt_status(cd, CDEVICE_1), CRYPT_ACTIVE);
+       CRYPT_FREE(cd);
+
+       memset(&ip, 0, sizeof(ip));
+       OK_(crypt_init_by_name(&cd, CDEVICE_1));
+       OK_(crypt_get_integrity_info(cd, &ip));
+       EQ_(ip.tag_size, params.tag_size);
+       OK_(strcmp(ip.integrity,params.integrity));
+       OK_(strcmp(CRYPT_INTEGRITY,crypt_get_type(cd)));
+       OK_(crypt_deactivate(cd, CDEVICE_1));
+       CRYPT_FREE(cd);
+}
+
 // Check that gcrypt is properly initialised in format
 static void NonFIPSAlg(void)
 {
-       struct crypt_device *cd;
        struct crypt_params_luks1 params = {0};
        char key[128] = "";
        size_t key_size = 128 / 8;
@@ -1939,23 +1865,23 @@ static void NonFIPSAlg(void)
        OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params));
        FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params),
              "Already formatted.");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        params.hash = "whirlpool";
        OK_(crypt_init(&cd, DEVICE_2));
        ret = crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params);
        if (ret < 0) {
                printf("WARNING: whirlpool not supported, skipping test.\n");
-               crypt_free(cd);
+               CRYPT_FREE(cd);
                return;
        }
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 
        params.hash = "md5";
        OK_(crypt_init(&cd, DEVICE_2));
        FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, &params),
              "MD5 unsupported, too short");
-       crypt_free(cd);
+       CRYPT_FREE(cd);
 }
 
 static void int_handler(int sig __attribute__((__unused__)))
@@ -1970,9 +1896,14 @@ int main(int argc, char *argv[])
 
        if (getuid() != 0) {
                printf("You must be root to run this test.\n");
-               exit(0);
+               exit(77);
        }
-
+#ifndef NO_CRYPTSETUP_PATH
+       if (getenv("CRYPTSETUP_PATH")) {
+               printf("Cannot run this test with CRYPTSETUP_PATH set.\n");
+               exit(77);
+       }
+#endif
        for (i = 1; i < argc; i++) {
                if (!strcmp("-v", argv[i]) || !strcmp("--verbose", argv[i]))
                        _verbose = 1;
@@ -1984,27 +1915,33 @@ int main(int argc, char *argv[])
        sigaction(SIGINT, &sa, NULL);
        sigaction(SIGTERM, &sa, NULL);
 
+       register_cleanup(_cleanup);
+
        _cleanup();
-       if (_setup())
-               goto out;
+       if (_setup()) {
+               printf("Cannot set test devices.\n");
+               _cleanup();
+               exit(77);
+       }
 
        crypt_set_debug_level(_debug ? CRYPT_DEBUG_ALL : CRYPT_DEBUG_NONE);
 
        RUN_(NonFIPSAlg, "Crypto is properly initialised in format"); //must be the first!
-       RUN_(AddDevicePlain, "plain device API creation exercise");
-       RUN_(HashDevicePlain, "plain device API hash test");
+       RUN_(AddDevicePlain, "A plain device API creation");
+       RUN_(HashDevicePlain, "A plain device API hash");
        RUN_(AddDeviceLuks, "Format and use LUKS device");
-       RUN_(LuksHeaderLoad, "test header load");
-       RUN_(LuksHeaderRestore, "test LUKS header restore");
-       RUN_(LuksHeaderBackup, "test LUKS header backup");
-       RUN_(ResizeDeviceLuks, "Luks device resize tests");
+       RUN_(LuksHeaderLoad, "Header load");
+       RUN_(LuksHeaderRestore, "LUKS header restore");
+       RUN_(LuksHeaderBackup, "LUKS header backup");
+       RUN_(ResizeDeviceLuks, "LUKS device resize");
        RUN_(UseLuksDevice, "Use pre-formated LUKS device");
-       RUN_(SuspendDevice, "Suspend/Resume test");
+       RUN_(SuspendDevice, "Suspend/Resume");
        RUN_(UseTempVolumes, "Format and use temporary encrypted device");
-       RUN_(CallbacksTest, "API callbacks test");
-       RUN_(VerityTest, "DM verity test");
-       RUN_(TcryptTest, "Tcrypt API test");
-out:
+       RUN_(CallbacksTest, "API callbacks");
+       RUN_(VerityTest, "DM verity");
+       RUN_(TcryptTest, "Tcrypt API");
+       RUN_(IntegrityTest, "Integrity API");
+
        _cleanup();
        return 0;
 }
diff --git a/tests/api_test.h b/tests/api_test.h
new file mode 100644 (file)
index 0000000..d1d9b00
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * cryptsetup library API check functions
+ *
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ * Copyright (C) 2016-2020 Ondrej Kozina
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef API_TEST_H
+#define API_TEST_H
+
+#include <stdio.h>
+#include <stdint.h>
+
+extern char *THE_LOOP_DEV;
+extern int _debug;
+extern int global_lines;
+extern int _quit;
+extern int _verbose;
+extern uint64_t t_dev_offset;
+
+int t_device_size(const char *device, uint64_t *size);
+int t_dm_check_versions(void);
+int t_dm_crypt_keyring_support(void);
+int t_dm_crypt_cpu_switch_support(void);
+int t_dm_crypt_discard_support(void);
+
+int fips_mode(void);
+
+int create_dmdevice_over_loop(const char *dm_name, const uint64_t size);
+
+int get_key_dm(const char *name, char *buffer, unsigned int buffer_size);
+
+int prepare_keyfile(const char *name, const char *passphrase, int size);
+
+int crypt_decode_key(char *key, const char *hex, unsigned int size);
+
+void global_log_callback(int level, const char *msg, void *usrptr);
+
+void reset_log(void);
+
+int _system(const char *command, int warn);
+
+void register_cleanup(void (*cleanup)(void));
+
+void check_ok(int status, int line, const char *func);
+void check_ok_return(int status, int line, const char *func);
+void check_ko(int status, int line, const char *func);
+void check_equal(int line, const char *func, int64_t x, int64_t y);
+void check_null(int line, const char *func, const void *x);
+void check_notnull(int line, const char *func, const void *x);
+void xlog(const char *msg, const char *tst, const char *func, int line, const char *txt);
+
+/* crypt_device context must be "cd" to parse error properly here */
+#define OK_(x)         do { xlog("(success)", #x, __FUNCTION__, __LINE__, NULL); \
+                            check_ok((x), __LINE__, __FUNCTION__); \
+                       } while(0)
+#define NOTFAIL_(x, y) do { xlog("(notfail)", #x, __FUNCTION__, __LINE__, y); \
+                            check_ok_return((x), __LINE__, __FUNCTION__); \
+                       } while(0)
+#define FAIL_(x, y)    do { xlog("(fail)   ", #x, __FUNCTION__, __LINE__, y); \
+                            check_ko((x), __LINE__, __FUNCTION__); \
+                       } while(0)
+#define EQ_(x, y)      do { int64_t _x = (x), _y = (y); \
+                            xlog("(equal)  ", #x " == " #y, __FUNCTION__, __LINE__, NULL); \
+                            if (_x != _y) check_equal(__LINE__, __FUNCTION__, _x, _y); \
+                       } while(0)
+#define NULL_(x)       do { xlog("(null)   ", #x, __FUNCTION__, __LINE__, NULL); \
+                            check_null(__LINE__, __FUNCTION__, (x)); \
+                       } while(0)
+#define NOTNULL_(x)    do { xlog("(notnull)", #x, __FUNCTION__, __LINE__, NULL); \
+                            check_notnull(__LINE__, __FUNCTION__, (x)); \
+                       } while(0)
+#define RUN_(x, y)     do { reset_log(); \
+                            printf("%s: %s\n", #x, (y)); x(); \
+                       } while (0)
+
+#define CRYPT_FREE(x) do { crypt_free(x); x = NULL; } while (0)
+
+#define SECTOR_SHIFT 9L
+#define SECTOR_SIZE 512
+#define TST_LOOP_FILE_SIZE (((1<<20)*100)>>SECTOR_SHIFT)
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#define DIV_ROUND_UP_MODULO(n,d) (DIV_ROUND_UP(n,d)*(d))
+
+/* Device mapper backend - kernel support flags */
+#define T_DM_KEY_WIPE_SUPPORTED (1 << 0)       /* key wipe message */
+#define T_DM_LMK_SUPPORTED      (1 << 1)       /* lmk mode */
+#define T_DM_SECURE_SUPPORTED   (1 << 2)       /* wipe (secure) buffer flag */
+#define T_DM_PLAIN64_SUPPORTED  (1 << 3)       /* plain64 IV */
+#define T_DM_DISCARDS_SUPPORTED (1 << 4)       /* discards/TRIM option is supported */
+#define T_DM_VERITY_SUPPORTED   (1 << 5)       /* dm-verity target supported */
+#define T_DM_TCW_SUPPORTED      (1 << 6)       /* tcw (TCRYPT CBC with whitening) */
+#define T_DM_SAME_CPU_CRYPT_SUPPORTED (1 << 7) /* same_cpu_crypt */
+#define T_DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED (1 << 8) /* submit_from_crypt_cpus */
+#define T_DM_VERITY_ON_CORRUPTION_SUPPORTED (1 << 9) /* ignore/restart_on_corruption, ignore_zero_block */
+#define T_DM_VERITY_FEC_SUPPORTED (1 << 10) /* Forward Error Correction (FEC) */
+#define T_DM_KERNEL_KEYRING_SUPPORTED (1 << 11) /* dm-crypt allows loading kernel keyring keys */
+#define T_DM_INTEGRITY_SUPPORTED (1 << 12) /* dm-integrity target supported */
+//FIXME add T_DM_SECTOR_SIZE once we have version
+
+/* loop helpers */
+int loop_device(const char *loop);
+int loop_attach(char **loop, const char *file, int offset,
+                     int autoclear, int *readonly);
+int loop_detach(const char *loop);
+
+#endif
diff --git a/tests/bitlk-compat-test b/tests/bitlk-compat-test
new file mode 100755 (executable)
index 0000000..38efd0b
--- /dev/null
@@ -0,0 +1,120 @@
+#!/bin/bash
+
+# check bitlk images parsing
+
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+TST_DIR=bitlk-images
+MAP=bitlktst
+
+[ -z "$srcdir" ] && srcdir="."
+
+function remove_mapping()
+{
+       [ -b /dev/mapper/$MAP ] && dmsetup remove --retry $MAP
+}
+
+function fail()
+{
+       [ -n "$1" ] && echo "$1"
+       echo " [FAILED]"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       remove_mapping
+       exit 2
+}
+
+function skip()
+{
+       [ -n "$1" ] && echo "$1"
+       echo "Test skipped."
+       exit 77
+}
+
+function load_vars()
+{
+        local file=$(echo $1 | sed -e s/^$TST_DIR\\/// | sed -e s/\.img$//)
+        source <(grep = <(grep -A8 "\[$file\]" $TST_DIR/images.conf))
+}
+
+function check_dump()
+{
+        dump=$1
+        file=$2
+
+        # load variables for this image from config file
+        load_vars $file
+
+        # GUID
+        dump_guid=$(echo "$dump" | grep Version -A 1 | tail -1 | cut -d: -f2 | tr -d "\t\n ")
+        [ ! -z "$GUID" -a "$dump_guid" = "$GUID"  ] || fail " GUID check from dump failed."
+
+        # cipher
+        dump_cipher=$(echo "$dump" | grep "Cipher name" | cut -d: -f2 | tr -d "\t\n ")
+        dump_mode=$(echo "$dump" | grep "Cipher mode" | cut -d: -f2 | tr -d "\t\n ")
+        cipher=$(echo "$dump_cipher-$dump_mode")
+        [ ! -z "$CIPHER" -a "$cipher" = "$CIPHER" ] || fail " cipher check from dump failed."
+
+        if echo "$file" | grep -q -e "smart-card"; then
+                # smart card protected VMK GUID
+                dump_sc_vmk=$(echo "$dump" | grep "VMK protected with smart card" -B 1 | head -1 | cut -d: -f2 | tr -d "\t ")
+                [ ! -z "$SC_VMK_GUID" -a "$dump_sc_vmk" = "$SC_VMK_GUID" ] || fail " smart card protected VMK GUID check from dump failed."
+        else
+                # password protected VMK GUID
+                dump_pw_vmk=$(echo "$dump" | grep "VMK protected with passphrase" -B 1 | head -1 | cut -d: -f2 | tr -d "\t ")
+                [ ! -z "$PW_VMK_GUID" -a "$dump_pw_vmk" = "$PW_VMK_GUID" ] || fail " password protected VMK GUID check from dump failed."
+        fi
+
+        # recovery password protected VMK GUID
+        dump_rp_vmk=$(echo "$dump" | grep "VMK protected with recovery passphrase" -B 1 | head -1 | cut -d: -f2 | tr -d "\t ")
+        [ ! -z "$RP_VMK_GUID" -a "$dump_rp_vmk" = "$RP_VMK_GUID" ] || fail " recovery password protected VMK GUID check from dump failed."
+
+}
+
+export LANG=C
+[ ! -d $TST_DIR ] && tar xJSf $srcdir/bitlk-images.tar.xz --no-same-owner
+
+echo "HEADER CHECK"
+for file in $(ls $TST_DIR/bitlk-*) ; do
+       echo -n " $file"
+       out=$($CRYPTSETUP bitlkDump $file)
+        check_dump "$out" "$file"
+       echo " [OK]"
+done
+
+if [ $(id -u) != 0 ]; then
+       echo "WARNING: You must be root to run activation part of test, test skipped."
+       exit 0
+fi
+
+remove_mapping
+
+echo "ACTIVATION FS UUID CHECK"
+for file in $(ls $TST_DIR/bitlk-*) ; do
+       # load variables for this image from config file
+        load_vars $file
+
+       # test with both passphrase and recovery passphrase
+       for PASSPHRASE in $PW $RP ; do
+               echo -n " $file"
+               echo $PASSPHRASE | $CRYPTSETUP bitlkOpen -r $file --test-passphrase >/dev/null 2>&1
+               ret=$?
+               [ $ret -eq 1 ] && echo " [N/A]" && continue
+               echo $PASSPHRASE | $CRYPTSETUP bitlkOpen -r $file $MAP >/dev/null 2>&1
+               ret=$?
+               [ $ret -eq 1 ] && ( echo "$file" | grep -q -e "aes-cbc" ) && echo " [N/A]" && continue
+               [ $ret -eq 1 ] && ( echo "$file" | grep -q -e "aes-cbc-elephant" ) && echo " [N/A]" && continue
+               [ $ret -eq 1 ] && ( echo "$file" | grep -q -e "clearkey" ) && echo " [N/A]" && continue
+               [ $ret -eq 1 ] && ( echo "$file" | grep -q -e "eow" ) && echo " [N/A]" && continue
+               [ $ret -eq 1 ] && ( echo "$file" | grep -q -e "-4k.img" ) && echo " [N/A]" && continue
+               [ $ret -eq 0 ] || fail " failed to open $file ($ret)"
+               $CRYPTSETUP status $MAP >/dev/null || fail
+               $CRYPTSETUP status /dev/mapper/$MAP >/dev/null || fail
+               uuid=$(lsblk -n -o UUID /dev/mapper/$MAP)
+               sha256sum=$(sha256sum /dev/mapper/$MAP | cut -d" " -f1)
+               $CRYPTSETUP remove $MAP || fail
+               [ "$uuid" = "$UUID" ] || fail " UUID check failed."
+               [ "$sha256sum" = "$SHA256SUM" ] || fail " SHA256 sum check failed."
+               echo " [OK]"
+       done
+done
diff --git a/tests/bitlk-images.tar.xz b/tests/bitlk-images.tar.xz
new file mode 100644 (file)
index 0000000..e3f07d7
Binary files /dev/null and b/tests/bitlk-images.tar.xz differ
diff --git a/tests/blkid-luks2-pv.img.xz b/tests/blkid-luks2-pv.img.xz
new file mode 100644 (file)
index 0000000..c9d0e57
Binary files /dev/null and b/tests/blkid-luks2-pv.img.xz differ
diff --git a/tests/blockwise-compat b/tests/blockwise-compat
new file mode 100755 (executable)
index 0000000..a764020
--- /dev/null
@@ -0,0 +1,377 @@
+#!/bin/bash
+
+# set _FORCE_LOCAL environment variable to run blockwise unit tests even on local
+# nfs. Some tests will fail because nfs is eager to write for example 4095 bytes
+# in O_DIRECT mode.
+
+BW_UNIT=./unit-utils-io
+STRACE=strace
+MNT_DIR=./mnt_bwunit
+LOCAL_FILE=./blockwise_localfile
+
+# $1 path to scsi debug bdev
+scsi_debug_teardown() {
+       local _tries=15;
+
+       while [ -b "$1" -a $_tries -gt 0 ]; do
+               rmmod scsi_debug 2> /dev/null
+               if [ -b "$1" ]; then
+                       sleep .1
+                       _tries=$((_tries-1))
+               fi
+       done
+
+       test ! -b "$1" || rmmod scsi_debug
+}
+
+cleanup() {
+       if [ -d "$MNT_DIR" ] ; then
+           umount -f $MNT_DIR 2>/dev/null
+           rmdir $MNT_DIR 2>/dev/null
+       fi
+       rm -f $LOCAL_FILE 2> /dev/null
+       scsi_debug_teardown "$DEV" || exit 100
+}
+
+fail()
+{
+       if [ -n "$1" ] ; then echo "FAIL $1" ; else echo "FAIL" ; fi
+       cleanup
+       exit 100
+}
+
+fail_count()
+{
+       echo "$MSG[FAIL]"
+       FAILS=$((FAILS+1))
+}
+
+warn_count()
+{
+       echo "$MSG[WARNING]"
+       WARNS=$((WARNS+1))
+}
+
+skip()
+{
+       echo "TEST SKIPPED: $1"
+       cleanup
+       exit 0
+}
+
+add_device() {
+       modprobe scsi_debug $@ delay=0
+       if [ $? -ne 0 ] ; then
+               echo "This kernel seems to not support proper scsi_debug module, test skipped."
+               exit 77
+       fi
+       DEV=$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+       DEV="/dev/$DEV"
+       [ -b $DEV ] || fail "Cannot find $DEV."
+}
+
+falloc() {
+       dd if=/dev/zero of=$2 bs=1M count=$1 2> /dev/null
+}
+
+run_all_in_fs() {
+       for file in $(ls img_fs_*.img.xz) ; do
+           echo "Run tests in $file put on top block device."
+           xz -d -c $file | dd of=$DEV bs=1M 2>/dev/null || fail "bad image"
+           [ ! -d $MNT_DIR ] && mkdir $MNT_DIR
+           mount $DEV $MNT_DIR
+           if [ $? -ne 0 ]; then
+               echo "Mounting image $file failed, skipped."
+               continue;
+           fi
+           rm -rf $MNT_DIR/* 2>/dev/null
+           local tfile=$MNT_DIR/bwunit_tstfile
+           falloc $DEVSIZEMB $tfile || fail "enospc?"
+           local iobsize=$(stat -c "%o" $tfile)
+           test -n "$iobsize" -a $iobsize -gt 0 || fail
+           local oldbsize=$BSIZE
+           BSIZE=$iobsize
+           run_all $tfile
+           BSIZE=$oldbsize
+           umount $MNT_DIR
+       done
+}
+
+trunc_file() {
+       test $1 -eq 0 || truncate -c -s $1 $2 2>/dev/null || dd if=/dev/zero of=$2 bs=$1 count=1 2>/dev/null || fail "Failed to truncate test file $2."
+}
+
+RUN() {
+       local _res=$1
+       shift
+       local _dev=$1
+       shift
+       local _fn=$1
+       shift
+       local _type="bdev"
+       local _fsize=0
+
+       test -b $_dev || {
+               _type="file"
+               _fsize=$(stat -c "%s" $_dev)
+       }
+
+        case "$_res" in
+        P)
+               MSG="Testing $_fn on $_type with params $@ [expecting TRUE]..."
+               $BW_UNIT $_dev $_fn $@
+               if [ $? -ne 0 ]; then
+                       if [ $_type = "file" ]; then
+                               warn_count
+                       else
+                               fail_count
+                       fi
+                       trunc_file $_fsize $_dev
+                       test -z "$STRACE" || $STRACE -o ./$BW_UNIT-fail-$FAILS-should-pass.log $BW_UNIT $_dev $_fn $@ 2> /dev/null
+               else
+                       MSG="$MSG[OK]"
+               fi
+                ;;
+        F)
+               MSG="Testing $_fn on $_type with params $@ [expecting FALSE]..."
+               $BW_UNIT $_dev $_fn $@ 2> /dev/null
+               if [ $? -eq 0 ]; then
+                       if [ $_type = "file" ]; then
+                               warn_count
+                       else
+                               fail_count
+                       fi
+                       trunc_file $_fsize $_dev
+                       test -z "$STRACE" || $STRACE -o ./$BW_UNIT-fail-$FAILS-should-fail.log $BW_UNIT $_dev $_fn $@ 2> /dev/null
+               else
+                       MSG="$MSG[OK]"
+               fi
+                ;;
+        *)
+                fail "Internal test error"
+                ;;
+        esac
+
+       trunc_file $_fsize $_dev
+}
+
+run_all() {
+       if [ -b "$1" ]; then
+               BD_FAIL="F"
+       else
+               BD_FAIL="P"
+       fi
+
+       # buffer io support only blocksize aligned ios
+       # device/file fn_name length
+       RUN "P" $1 read_buffer $BSIZE
+       RUN "P" $1 read_buffer $((2*BSIZE))
+       RUN "F" $1 read_buffer $((BSIZE-1))
+       RUN "F" $1 read_buffer $((BSIZE+1))
+       RUN "P" $1 read_buffer 0
+
+       RUN "P" $1 write_buffer $BSIZE
+       RUN "P" $1 write_buffer $((2*BSIZE))
+
+       RUN "F" $1 write_buffer $((BSIZE-1))
+       RUN "F" $1 write_buffer $((BSIZE+1))
+       RUN "F" $1 write_buffer 0
+
+       # basic blockwise functions
+       # device/file fn_name length bsize
+       RUN "P" $1 read_blockwise 0 $BSIZE
+       RUN "P" $1 read_blockwise $((BSIZE)) $BSIZE
+       RUN "P" $1 read_blockwise $((BSIZE-1)) $BSIZE
+       RUN "P" $1 read_blockwise $((BSIZE+1)) $BSIZE
+       RUN "P" $1 read_blockwise $((DEVSIZE)) $BSIZE
+       RUN "P" $1 read_blockwise $((DEVSIZE-1)) $BSIZE
+       RUN "F" $1 read_blockwise $((DEVSIZE+1)) $BSIZE
+
+       RUN "P" $1 write_blockwise 0 $BSIZE
+       RUN "P" $1 write_blockwise $((BSIZE)) $BSIZE
+       RUN "P" $1 write_blockwise $((BSIZE-1)) $BSIZE
+       RUN "P" $1 write_blockwise $((BSIZE+1)) $BSIZE
+       RUN "P" $1 write_blockwise $((DEVSIZE)) $BSIZE
+       RUN "P" $1 write_blockwise $((DEVSIZE-1)) $BSIZE
+       RUN "$BD_FAIL" $1 write_blockwise $((DEVSIZE+1)) $BSIZE
+
+       # seek variant blockwise functions
+       # device/file fn_name length bsize offset
+       RUN "P" $1 read_lseek_blockwise 0 $BSIZE 0
+       RUN "P" $1 read_lseek_blockwise 0 $BSIZE 1
+       RUN "P" $1 read_lseek_blockwise 0 $BSIZE $((DEVSIZE))
+       # length = 0 is significant here
+       RUN "P" $1 read_lseek_blockwise 0 $BSIZE $((DEVSIZE+1))
+
+       # beginning of device
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE 0
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE 1
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE $((BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE $((BSIZE/2))
+
+       # somewhere in the 'middle'
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE $BSIZE
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE $((BSIZE+1))
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE $((2*BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE $((BSIZE+BSIZE/2-1))
+
+       # cross-sector tests
+       RUN "P" $1 read_lseek_blockwise 2 $BSIZE $((BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+1)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+2)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise 2 $BSIZE $((2*BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+1)) $BSIZE $((2*BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+2)) $BSIZE $((2*BSIZE-1))
+
+       # including one whole sector
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+2)) $BSIZE $((BSIZE))
+       RUN "P" $1 read_lseek_blockwise $((2*BSIZE)) $BSIZE $((BSIZE+1))
+       RUN "P" $1 read_lseek_blockwise $((2*BSIZE)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+2)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((2*BSIZE)) $BSIZE $((BSIZE+1))
+       RUN "P" $1 read_lseek_blockwise $((3*BSIZE-2)) $BSIZE $((BSIZE+1))
+
+       # hiting exactly the sector boundary
+       RUN "P" $1 read_lseek_blockwise $((BSIZE-1)) $BSIZE 1
+       RUN "P" $1 read_lseek_blockwise $((BSIZE-1)) $BSIZE $((BSIZE+1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+1)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+1)) $BSIZE $((2*BSIZE-1))
+
+       # device end
+       RUN "P" $1 read_lseek_blockwise 1 $BSIZE $((DEVSIZE-1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE-1)) $BSIZE $((DEVSIZE-BSIZE+1))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE)) $BSIZE $((DEVSIZE-BSIZE))
+       RUN "P" $1 read_lseek_blockwise $((BSIZE+1)) $BSIZE $((DEVSIZE-BSIZE-1))
+
+       # this must fail on both device and file
+       RUN "F" $1 read_lseek_blockwise 1 $BSIZE $((DEVSIZE))
+       RUN "F" $1 read_lseek_blockwise $((BSIZE-1)) $BSIZE $((DEVSIZE-BSIZE+2))
+       RUN "F" $1 read_lseek_blockwise $((BSIZE)) $BSIZE $((DEVSIZE-BSIZE+1))
+       RUN "F" $1 read_lseek_blockwise $((BSIZE+1)) $BSIZE $((DEVSIZE-BSIZE))
+
+       RUN "P" $1 write_lseek_blockwise 0 $BSIZE 0
+       # TODO: this may pass but must not write a byte (write(0) is undefined).
+       #       Test it with underlying dm-error or phony read/write syscalls.
+       #       Skipping read is optimization.
+       # HINT: currently it performs useless write and read as well
+       RUN "P" $1 write_lseek_blockwise 0 $BSIZE 1
+       RUN "P" $1 write_lseek_blockwise 0 $BSIZE $BSIZE
+
+       # beginning of device
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE 0
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE 1
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE $((BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE $((BSIZE/2))
+
+       # somewhere in the 'middle'
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE $BSIZE
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE $((BSIZE+1))
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE $((2*BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE $((BSIZE+BSIZE/2-1))
+
+       # cross-sector tests
+       RUN "P" $1 write_lseek_blockwise 2 $BSIZE $((BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+2)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise 2 $BSIZE $((2*BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((2*BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+2)) $BSIZE $((2*BSIZE-1))
+
+       # including one whole sector
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+2)) $BSIZE $((BSIZE))
+       RUN "P" $1 write_lseek_blockwise $((2*BSIZE)) $BSIZE $((BSIZE+1))
+       RUN "P" $1 write_lseek_blockwise $((2*BSIZE)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+2)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((2*BSIZE)) $BSIZE $((BSIZE+1))
+       RUN "P" $1 write_lseek_blockwise $((3*BSIZE-2)) $BSIZE $((BSIZE+1))
+
+       # hiting exactly the sector boundary
+       RUN "P" $1 write_lseek_blockwise $((BSIZE-1)) $BSIZE 1
+       RUN "P" $1 write_lseek_blockwise $((BSIZE-1)) $BSIZE $((BSIZE+1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((BSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((2*BSIZE-1))
+
+       # device end
+       RUN "P" $1 write_lseek_blockwise 1 $BSIZE $((DEVSIZE-1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE-1)) $BSIZE $((DEVSIZE-BSIZE+1))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE)) $BSIZE $((DEVSIZE-BSIZE))
+       RUN "P" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((DEVSIZE-BSIZE-1))
+
+       # this must fail on device, but pass on file (which is unfortunate and maybe design mistake)
+       RUN "$BD_FAIL" $1 write_lseek_blockwise 1 $BSIZE $((DEVSIZE))
+       RUN "$BD_FAIL" $1 write_lseek_blockwise $((BSIZE-1)) $BSIZE $((DEVSIZE-BSIZE+2))
+       RUN "$BD_FAIL" $1 write_lseek_blockwise $((BSIZE)) $BSIZE $((DEVSIZE-BSIZE+1))
+       RUN "$BD_FAIL" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((DEVSIZE-BSIZE))
+}
+
+[ -n "$CRYPTSETUP_PATH" ] && skip "Cannot run this test with CRYPTSETUP_PATH set."
+
+which $STRACE > /dev/null 2>&1 || unset STRACE
+test -x $BW_UNIT || skip "Run \"make `basename $BW_UNIT`\" first"
+
+FAILS=0
+WARNS=0
+DEVSIZEMB=2
+DEVSIZE=$((DEVSIZEMB*1024*1024))
+
+PAGE_SIZE=$(getconf PAGE_SIZE)
+echo "System PAGE_SIZE=$PAGE_SIZE"
+
+echo "Run tests in local filesystem"
+falloc $DEVSIZEMB $LOCAL_FILE || fail "Failed to create file in local filesystem."
+BSIZE=$(stat -c "%o" $LOCAL_FILE)
+if [ $BSIZE -gt $((512*1024)) ]; then
+       echo "Detected file block size: $BSIZE bytes"
+       echo "Tuning it down to system page size ($PAGE_SIZE bytes)"
+       BSIZE=$PAGE_SIZE
+fi
+run_all $LOCAL_FILE
+
+[ $(id -u) -eq 0 ] || {
+       echo "WARNING: You must be root to run remaining tests."
+       test $FAILS -eq 0 || fail "($FAILS wrong result(s) in total)"
+       cleanup
+       exit 0
+}
+
+DEVBSIZE=512
+BSIZE=$DEVBSIZE
+EXP=0
+DEVSIZEMBIMG=32
+
+echo "# Create classic 512B drive"
+echo "# (logical_block_size=$DEVBSIZE, physical_block_size=$((DEVBSIZE*(1<<EXP))))"
+add_device dev_size_mb=$DEVSIZEMB sector_size=$DEVBSIZE physblk_exp=$EXP num_tgts=1
+run_all $DEV
+cleanup
+add_device dev_size_mb=$DEVSIZEMBIMG sector_size=$DEVBSIZE physblk_exp=$EXP num_tgts=1
+run_all_in_fs
+cleanup
+
+EXP=3
+echo "# Create desktop-class 4K drive"
+echo "# (logical_block_size=$DEVBSIZE, physical_block_size=$((DEVBSIZE*(1<<EXP))))"
+add_device dev_size_mb=$DEVSIZEMB physblk_exp=$EXP sector_size=$DEVBSIZE num_tgts=1
+run_all $DEV
+BSIZE=$((DEVBSIZE*(1<<EXP)))
+run_all $DEV
+cleanup
+
+add_device dev_size_mb=$DEVSIZEMBIMG physblk_exp=$EXP sector_size=$DEVBSIZE num_tgts=1
+run_all_in_fs
+cleanup
+
+DEVBSIZE=4096
+BSIZE=$DEVBSIZE
+EXP=0
+echo "# Create enterprise-class 4K drive"
+echo "# (logical_block_size=$DEVBSIZE, physical_block_size=$((DEVBSIZE*(1<<EXP))))"
+add_device dev_size_mb=$DEVSIZEMB physblk_exp=$EXP sector_size=$DEVBSIZE num_tgts=1
+run_all $DEV
+cleanup
+add_device dev_size_mb=$DEVSIZEMBIMG sector_size=$DEVBSIZE physblk_exp=$EXP num_tgts=1
+run_all_in_fs
+cleanup
+
+test $WARNS -eq 0 || echo "(WARNING: $WARNS suspicious result(s) in total)"
+test $FAILS -eq 0 || fail "($FAILS wrong result(s) in total)"
index 5247fd3..a61453e 100755 (executable)
@@ -1,10 +1,11 @@
 #!/bin/bash
 
 PS4='$LINENO:'
-CRYPTSETUP=../src/cryptsetup
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 
-CRYPTSETUP_VALGRIND=../src/.libs/cryptsetup
-CRYPTSETUP_LIB_VALGRIND=../lib/.libs
+CRYPTSETUP_VALGRIND=../.libs/cryptsetup
+CRYPTSETUP_LIB_VALGRIND=../.libs
 
 DEV_NAME=dummy
 DEV_NAME2=dummy2
@@ -22,6 +23,9 @@ PWD1="93R4P4pIqAH8"
 PWD2="mymJeD8ivEhE"
 PWD3="ocMakf3fAcQO"
 PWDW="rUkL4RUryBom"
+VK_FILE="compattest_vkfile"
+
+FAST_PBKDF_OPT="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
 
 LUKS_HEADER="S0-5 S6-7 S8-39 S40-71 S72-103 S104-107 S108-111 R112-131 R132-163 S164-167 S168-207 A0-591"
 KEY_SLOT0="S208-211 S212-215 R216-247 A248-251 A251-255"
@@ -43,11 +47,13 @@ LOOPDEV=$(losetup -f 2>/dev/null)
 
 function remove_mapping()
 {
-       [ -b /dev/mapper/$DEV_NAME3 ] && dmsetup remove $DEV_NAME3
-       [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove $DEV_NAME2
-       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
+       [ -b /dev/mapper/$DEV_NAME3 ] && dmsetup remove --retry $DEV_NAME3 >/dev/null 2>&1
+       [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2 >/dev/null 2>&1
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME >/dev/null 2>&1
        losetup -d $LOOPDEV >/dev/null 2>&1
-       rm -f $ORIG_IMG $IMG $IMG10 $KEY1 $KEY2 $KEY5 $KEYE $HEADER_IMG >/dev/null 2>&1
+       rm -f $ORIG_IMG $IMG $IMG10 $KEY1 $KEY2 $KEY5 $KEYE $HEADER_IMG $VK_FILE missing-file >/dev/null 2>&1
+       rmmod scsi_debug 2> /dev/null
+       scsi_debug_teardown $DEV
 }
 
 function force_uevent()
@@ -60,28 +66,40 @@ function fail()
 {
        [ -n "$1" ] && echo "$1"
        remove_mapping
-       echo "FAILED"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        exit 2
 }
 
+function fips_mode()
+{
+       [ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ]
+}
+
 function can_fail_fips()
 {
         # Ignore this fail if running in FIPS mode
-        [ -z "$FIPS_MODE" -o "$FIPS_MODE" -eq 0 ] && fail $1
+       fips_mode || fail $1
 }
 
 function skip()
 {
        [ -n "$1" ] && echo "$1"
        remove_mapping
-       exit 0
+       [ -z "$2" ] && exit $2
+       exit 77
 }
 
 function prepare()
 {
-       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME >/dev/null 2>&1
 
        case "$2" in
+       file)
+               remove_mapping
+               dd if=/dev/zero of=$IMG bs=1k count=10000 >/dev/null 2>&1
+               sync
+               ;;
        wipe)
                remove_mapping
                dd if=/dev/zero of=$IMG bs=1k count=10000 >/dev/null 2>&1
@@ -90,24 +108,26 @@ function prepare()
                ;;
        new)
                remove_mapping
-               bzip2 -cd compatimage.img.bz2 > $IMG
+               xz -cd compatimage.img.xz > $IMG
                # FIXME: switch to internal loop (no losetup at all)
                echo "bad" | $CRYPTSETUP luksOpen --key-slot 0 --test-passphrase $IMG 2>&1 | \
                        grep "autoclear flag" && skip "WARNING: Too old kernel, test skipped."
                losetup $LOOPDEV $IMG
-               bzip2 -cd compatv10image.img.bz2 > $IMG10
+               xz -cd compatv10image.img.xz > $IMG10
                ;;
        reuse | *)
                if [ ! -e $IMG ]; then
-                       bzip2 -cd compatimage.img.bz2 > $IMG
+                       xz -cd compatimage.img.xz > $IMG
                        losetup $LOOPDEV $IMG
                fi
-               [ ! -e $IMG10 ] && bzip2 -cd compatv10image.img.bz2 > $IMG10
+               [ ! -e $IMG10 ] && xz -cd compatv10image.img.xz > $IMG10
                ;;
        esac
 
        if [ ! -e $KEY1 ]; then
-               dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1
+               #dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1
+                echo -n $'\x48\xc6\x74\x4f\x41\x4e\x50\xc0\x79\xc2\x2d\x5b\x5f\x68\x84\x17' >$KEY1
+                echo -n $'\x9c\x03\x5e\x1b\x4d\x0f\x9a\x75\xb3\x90\x70\x32\x0a\xf8\xae\xc4'>>$KEY1
        fi
 
        if [ ! -e $KEY2 ]; then
@@ -139,6 +159,34 @@ function check_exists()
        check $1
 }
 
+# $1 path to scsi debug bdev
+scsi_debug_teardown() {
+       local _tries=15;
+
+       while [ -b "$1" -a $_tries -gt 0 ]; do
+               rmmod scsi_debug 2> /dev/null
+               if [ -b "$1" ]; then
+                       sleep .1
+                       _tries=$((_tries-1))
+               fi
+       done
+
+       test ! -b "$1" || rmmod scsi_debug 2> /dev/null
+}
+
+function add_scsi_device() {
+       scsi_debug_teardown $DEV
+        modprobe scsi_debug $@ delay=0
+        if [ $? -ne 0 ] ; then
+                echo "This kernel seems to not support proper scsi_debug module, test skipped."
+                exit 77
+        fi
+
+        sleep 1
+        DEV="/dev/"$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+        [ -b $DEV ] || fail "Cannot find $DEV."
+}
+
 function valgrind_setup()
 {
        which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
@@ -151,13 +199,92 @@ function valgrind_run()
        INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
 }
 
-[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
-[ -z "$LOOPDEV" ] && skip "WARNING: Cannot find free loop device, test skipped."
+export LANG=C
 
 [ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
 
-# LUKS tests
+# LUKS non-root-tests
+if [ $(id -u) != 0 ]; then
+       $CRYPTSETUP benchmark -c aes-xts-plain64 >/dev/null 2>&1 || \
+               skip "WARNING: Cannot run test without kernel userspace crypto API, test skipped."
+fi
+
+prepare "Image in file tests (root capabilities not required)" file
+echo "[1] format"
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $IMG $FAST_PBKDF_OPT || fail
+echo "[2] open"
+echo $PWD0 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksOpen should return EPERM exit code"
+echo $PWD1 | $CRYPTSETUP luksOpen $IMG --test-passphrase || fail
+# test detached header --test-passphrase
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --header $HEADER_IMG $IMG || fail
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $HEADER_IMG || fail
+rm -f $HEADER_IMG
+echo "[3] add key"
+echo $PWD1 | $CRYPTSETUP luksAddKey $IMG $FAST_PBKDF_OPT 2>/dev/null && fail
+echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $IMG $FAST_PBKDF_OPT || fail
+echo -e "$PWD0\n$PWD1" | $CRYPTSETUP luksAddKey $IMG $FAST_PBKDF_OPT 2>/dev/null && fail
+echo "[4] change key"
+echo -e "$PWD1\n$PWD0\n" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT $IMG || fail
+echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT $IMG 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksChangeKey should return EPERM exit code"
+echo "[5] remove key"
+# delete active keys PWD0, PWD2
+echo $PWD1 | $CRYPTSETUP luksRemoveKey $IMG 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksRemove should return EPERM exit code"
+echo $PWD0 | $CRYPTSETUP luksRemoveKey $IMG || fail
+echo $PWD2 | $CRYPTSETUP luksRemoveKey $IMG || fail
+# check if keys were deleted
+echo $PWD0 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
+[ $? -ne 1 ] && fail "luksOpen should return ENOENT exit code"
+echo $PWD2 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
+[ $? -ne 1 ] && fail "luksOpen should return ENOENT exit code"
+echo "[6] kill slot"
+# format new luks device with active keys PWD1, PWD2
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $IMG $FAST_PBKDF_OPT || fail
+echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $IMG $FAST_PBKDF_OPT || fail
+# deactivate keys by killing slots
+$CRYPTSETUP luksDump $IMG | grep -q "Key Slot 0: ENABLED" || fail
+$CRYPTSETUP luksDump $IMG | grep -q "Key Slot 1: ENABLED" || fail
+$CRYPTSETUP luksDump $IMG | grep -q "Key Slot 2: DISABLED" || fail
+echo $PWD1 | $CRYPTSETUP -q luksKillSlot $IMG 0 2>/dev/null && fail
+echo $PWD2 | $CRYPTSETUP -q luksKillSlot $IMG 0 || fail
+$CRYPTSETUP luksDump $IMG | grep -q "Key Slot 0: DISABLED" || fail
+echo $PWD1 | $CRYPTSETUP -q luksKillSlot $IMG 1 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksKill should return EPERM exit code"
+echo $PWD2 | $CRYPTSETUP -q luksKillSlot $IMG 1 || fail
+$CRYPTSETUP luksDump $IMG | grep -q "Key Slot 1: DISABLED" || fail
+# check if keys were deactivated
+echo $PWD1 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
+echo $PWD2 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
+echo "[7] header backup"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $IMG $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksHeaderBackup $IMG --header-backup-file $HEADER_IMG || fail
+echo $PWD1 | $CRYPTSETUP luksRemoveKey $IMG || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $IMG --test-passphrase 2>/dev/null && fail
+echo "[8] header restore"
+$CRYPTSETUP luksHeaderRestore -q $IMG --header-backup-file $HEADER_IMG || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $IMG --test-passphrase || fail
+echo "[9] luksDump"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --uuid $TEST_UUID $IMG $KEY1 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $IMG -d $KEY1 || fail
+$CRYPTSETUP luksDump $IMG | grep -q "Key Slot 0: ENABLED" || fail
+$CRYPTSETUP luksDump $IMG | grep -q $TEST_UUID || fail
+echo $PWDW | $CRYPTSETUP luksDump $IMG --dump-master-key 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksDump $IMG --dump-master-key | grep -q "MK dump:" || fail
+$CRYPTSETUP luksDump -q $IMG --dump-master-key -d $KEY1 | grep -q "MK dump:" || fail
+echo $PWD1 | $CRYPTSETUP luksDump -q $IMG --dump-master-key --master-key-file $VK_FILE >/dev/null || fail
+echo $PWD1 | $CRYPTSETUP luksDump -q $IMG --dump-master-key --master-key-file $VK_FILE 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --master-key-file $VK_FILE $IMG || fail
+
+echo "[10] uuid"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --uuid $TEST_UUID $IMG || fail
+$CRYPTSETUP -q luksUUID $IMG | grep -q $TEST_UUID || fail
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+[ -z "$LOOPDEV" ] && skip "WARNING: Cannot find free loop device, test skipped."
 
+# LUKS root-tests
 prepare        "[1] open - compat image - acceptance check" new
 echo $PWD0 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
 check_exists
@@ -193,11 +320,11 @@ check
 
 # All headers items and first key material section must change
 prepare "[3] format" wipe
-echo $PWD1 | $CRYPTSETUP -i 1000 -c aes-cbc-essiv:sha256 -s 128 luksFormat $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -i 1000 -c aes-cbc-essiv:sha256 -s 128 luksFormat --type luks1 $LOOPDEV || fail
 check "$LUKS_HEADER $KEY_SLOT0 $KEY_MATERIAL0"
 
 prepare "[4] format using hash sha512" wipe
-echo $PWD1 | $CRYPTSETUP -i 1000 -h sha512 -c aes-cbc-essiv:sha256 -s 128 luksFormat $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -i 1000 -h sha512 -c aes-cbc-essiv:sha256 -s 128 luksFormat --type luks1 $LOOPDEV || fail
 check "$LUKS_HEADER $KEY_SLOT0 $KEY_MATERIAL0"
 
 prepare "[5] open"
@@ -229,7 +356,7 @@ echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
 
 # Key Slot 1 and key material section 1 must change, the rest must not
 prepare "[9] add key test for key files"
-echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV $KEY1 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV $KEY1 || fail
 check "$KEY_SLOT1 $KEY_MATERIAL1"
 $CRYPTSETUP -d $KEY1 luksOpen $LOOPDEV $DEV_NAME || fail
 
@@ -242,20 +369,20 @@ $CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV $DEV_NAME || fail
 
 # Delete last slot
 prepare "[11] delete last key" wipe
-echo $PWD1 | $CRYPTSETUP luksFormat $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $LOOPDEV $FAST_PBKDF_OPT || fail
 echo $PWD1 | $CRYPTSETUP luksKillSlot $LOOPDEV 0 || fail
 echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
 
 # Format test for ESSIV, and some other parameters.
 prepare "[12] parameter variation test" wipe
-$CRYPTSETUP -q -i 1000 -c aes-cbc-essiv:sha256 -s 128 luksFormat $LOOPDEV $KEY1 || fail
+$CRYPTSETUP -q -i 1000 -c aes-cbc-essiv:sha256 -s 128 luksFormat --type luks1 $LOOPDEV $KEY1 || fail
 check "$LUKS_HEADER $KEY_SLOT0 $KEY_MATERIAL0"
 $CRYPTSETUP -d $KEY1 luksOpen $LOOPDEV $DEV_NAME || fail
 
 prepare        "[13] open/close - stacked devices" wipe
-echo $PWD1 | $CRYPTSETUP -q luksFormat $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $LOOPDEV $FAST_PBKDF_OPT || fail
 echo $PWD1 | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
-echo $PWD1 | $CRYPTSETUP -q luksFormat /dev/mapper/$DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 /dev/mapper/$DEV_NAME || fail
 echo $PWD1 | $CRYPTSETUP -q luksOpen /dev/mapper/$DEV_NAME $DEV_NAME2 || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME2 || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
@@ -263,33 +390,33 @@ $CRYPTSETUP -q luksClose  $DEV_NAME || fail
 prepare        "[14] format/open - passphrase on stdin & new line" wipe
 # stdin defined by "-" must take even newline
 #echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksFormat $LOOPDEV - || fail
-echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q --key-file=- luksFormat $LOOPDEV || fail
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP $FAST_PBKDF_OPT -q --key-file=- luksFormat --type luks1 $LOOPDEV || fail
 echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q --key-file=- luksOpen $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
 echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
 # now also try --key-file
-echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksFormat $LOOPDEV --key-file=- || fail
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP $FAST_PBKDF_OPT -q luksFormat --type luks1 $LOOPDEV --key-file=- || fail
 echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q --key-file=- luksOpen $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
 # process newline if from stdin
-echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksFormat $LOOPDEV || fail
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP $FAST_PBKDF_OPT -q luksFormat --type luks1 $LOOPDEV || fail
 echo "$PWD1" | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
 
 prepare "[15] UUID - use and report provided UUID" wipe
-echo $PWD1 | $CRYPTSETUP -q luksFormat --uuid blah $LOOPDEV 2>/dev/null && fail
-echo $PWD1 | $CRYPTSETUP -q luksFormat --uuid $TEST_UUID $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --uuid blah $LOOPDEV 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --uuid $TEST_UUID $LOOPDEV || fail
 tst=$($CRYPTSETUP -q luksUUID $LOOPDEV)
 [ "$tst"x = "$TEST_UUID"x ] || fail
-echo $PWD1 | $CRYPTSETUP -q luksFormat $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV || fail
 $CRYPTSETUP -q luksUUID --uuid $TEST_UUID $LOOPDEV || fail
 tst=$($CRYPTSETUP -q luksUUID $LOOPDEV)
 [ "$tst"x = "$TEST_UUID"x ] || fail
 
 prepare "[16] luksFormat" wipe
-echo $PWD1 | $CRYPTSETUP -q luksFormat --master-key-file /dev/urandom $LOOPDEV || fail
-echo $PWD1 | $CRYPTSETUP -q luksFormat --master-key-file /dev/urandom $LOOPDEV -d $KEY1 || fail
-$CRYPTSETUP -q luksFormat --master-key-file /dev/urandom -s 256 --uuid $TEST_UUID $LOOPDEV $KEY1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --master-key-file /dev/urandom $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --master-key-file /dev/urandom $LOOPDEV -d $KEY1 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --master-key-file /dev/urandom -s 256 --uuid $TEST_UUID $LOOPDEV $KEY1 || fail
 $CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
 # open by UUID
@@ -298,52 +425,82 @@ $CRYPTSETUP luksOpen -d $KEY1 UUID=X$TEST_UUID $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP luksOpen -d $KEY1 UUID=$TEST_UUID $DEV_NAME || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
 # empty keyfile
-$CRYPTSETUP -q luksFormat $LOOPDEV $KEYE || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEYE || fail
 $CRYPTSETUP luksOpen -d $KEYE $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
 # open by volume key
-echo $PWD1 | $CRYPTSETUP -q luksFormat -s 256 --master-key-file $KEY1 $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT -s 256 --master-key-file $KEY1 $LOOPDEV || fail
 $CRYPTSETUP luksOpen --master-key-file /dev/urandom $LOOPDEV $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP luksOpen --master-key-file $KEY1 $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP -q luksClose  $DEV_NAME || fail
+# unsupported pe-keyslot encryption
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT -s 128 --keyslot-cipher "aes-cbc-plain" $LOOPDEV 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT -s 128 --keyslot-key-size 256 $LOOPDEV 2>/dev/null && fail
 
 prepare "[17] AddKey volume key, passphrase and keyfile" wipe
 # masterkey
-echo $PWD1 | $CRYPTSETUP -q luksFormat $LOOPDEV --master-key-file /dev/zero --key-slot 3 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --master-key-file /dev/zero --key-slot 3 || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 3: ENABLED" || fail
-echo $PWD2 | $CRYPTSETUP luksAddKey $LOOPDEV --master-key-file /dev/zero --key-slot 4 || fail
+echo $PWD2 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --master-key-file /dev/zero --key-slot 4 || fail
+echo $PWD2 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 4 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 4: ENABLED" || fail
-echo $PWD3 | $CRYPTSETUP luksAddKey $LOOPDEV --master-key-file /dev/null --key-slot 5 2>/dev/null && fail
-$CRYPTSETUP luksAddKey $LOOPDEV --master-key-file /dev/zero --key-slot 5 $KEY1 || fail
+echo $PWD3 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --master-key-file /dev/null --key-slot 5 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --master-key-file /dev/zero --key-slot 5 $KEY1 || fail
+$CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 5 -d $KEY1 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: ENABLED" || fail
 
+# special "-" handling
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEY1 --key-slot 3 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d $KEY1 - || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV -d - --test-passphrase || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d - $KEY2 || fail
+$CRYPTSETUP luksOpen $LOOPDEV -d $KEY2 --test-passphrase || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV -d - -d $KEY1 --test-passphrase 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV -d $KEY1 -d $KEY1 --test-passphrase 2>/dev/null && fail
+
 # [0]PWD1 [1]PWD2 [2]$KEY1/1 [3]$KEY1 [4]$KEY2
-$CRYPTSETUP -q luksFormat $LOOPDEV $KEY1 --key-slot 3 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEY1 --key-slot 3 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 3: ENABLED" || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 --key-slot 3 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 --key-slot 3 2>/dev/null && fail
 # keyfile/keyfile
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 --key-slot 4 || fail
+$CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 --key-slot 4 || fail
+$CRYPTSETUP luksOpen $LOOPDEV -d $KEY2 --test-passphrase --key-slot 4 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 4: ENABLED" || fail
 # passphrase/keyfile
-echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 --key-slot 0 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d $KEY1 --key-slot 0 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 0: ENABLED" || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 0 || fail
 # passphrase/passphrase
-echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksAddKey $LOOPDEV --key-slot 1 || fail
+echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --key-slot 1 || fail
+echo $PWD2 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 1 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: ENABLED" || fail
 # keyfile/passphrase
-echo -e "$PWD2\n" | $CRYPTSETUP luksAddKey $LOOPDEV $KEY1 --key-slot 2 --new-keyfile-size 1 || fail
+echo -e "$PWD2\n" | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV $KEY1 --key-slot 2 --new-keyfile-size 3 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 2: ENABLED" || fail
 
 prepare "[18] RemoveKey passphrase and keyfile" reuse
 $CRYPTSETUP luksRemoveKey $LOOPDEV $KEY1 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 3: DISABLED" || fail
 $CRYPTSETUP luksRemoveKey $LOOPDEV $KEY1 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY2 $KEY1 --key-slot 3 2>/dev/null || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 3: ENABLED" || fail
 $CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 --keyfile-size 1 2>/dev/null && fail
 $CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 4: DISABLED" || fail
+# if password or keyfile is provided, batch mode must not suppress it
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 2>/dev/null && fail
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 -q 2>/dev/null && fail
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 --key-file=- 2>/dev/null && fail
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 --key-file=- -q 2>/dev/null && fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 2: ENABLED" || fail
 # kill slot using passphrase from 1
 echo $PWD2 | $CRYPTSETUP luksKillSlot $LOOPDEV 2 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 2: DISABLED" || fail
+# kill slot with redirected stdin
+$CRYPTSETUP luksKillSlot $LOOPDEV 3 </dev/null 2>/dev/null || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 3: DISABLED" || fail
 # remove key0 / slot 0
 echo $PWD1 | $CRYPTSETUP luksRemoveKey $LOOPDEV || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 0: DISABLED" || fail
@@ -361,6 +518,16 @@ $CRYPTSETUP -q resize  $DEV_NAME --size 100 || fail
 $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
 $CRYPTSETUP -q resize  $DEV_NAME || fail
 $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "19997 sectors" || fail
+$CRYPTSETUP -q resize  $DEV_NAME --device-size 1M || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "2048 sectors" || fail
+$CRYPTSETUP -q resize  $DEV_NAME --device-size 512k --size 1023 >/dev/null 2>&1 && fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "2048 sectors" || fail
+$CRYPTSETUP -q resize  $DEV_NAME --device-size 513 >/dev/null 2>&1 && fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "2048 sectors" || fail
+# Resize underlying loop device as well
+truncate -s 16M $IMG || fail
+$CRYPTSETUP -q resize  $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "32765 sectors" || fail
 $CRYPTSETUP -q remove  $DEV_NAME || fail
 $CRYPTSETUP -q status  $DEV_NAME >/dev/null && fail
 echo $PWD1 | $CRYPTSETUP create $DEV_NAME --hash sha1 $LOOPDEV || fail
@@ -370,6 +537,30 @@ $CRYPTSETUP -q remove  $DEV_NAME || fail
 echo $PWD1 | $CRYPTSETUP -q create $DEV_NAME --hash sha1 --size 100 $LOOPDEV || fail
 $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
 $CRYPTSETUP -q remove  $DEV_NAME || fail
+# 4k sector resize (if kernel supports it)
+echo $PWD1 | $CRYPTSETUP -q open --type plain $LOOPDEV $DEV_NAME --sector-size 4096 --size 8  >/dev/null 2>&1
+if [ $? -eq 0 ] ; then
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "8 sectors" || fail
+       $CRYPTSETUP -q resize  $DEV_NAME --size 16 || fail
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "16 sectors" || fail
+       $CRYPTSETUP -q resize  $DEV_NAME --size 9 2>/dev/null && fail
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "16 sectors" || fail
+       $CRYPTSETUP -q resize  $DEV_NAME --device-size 4608 2>/dev/null && fail
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "16 sectors" || fail
+       $CRYPTSETUP -q remove  $DEV_NAME || fail
+fi
+# Resize not aligned to logical block size
+add_scsi_device dev_size_mb=32 sector_size=4096
+echo $PWD1 | $CRYPTSETUP create $DEV_NAME --hash sha1 $DEV || fail
+OLD_SIZE=$($CRYPTSETUP status $DEV_NAME | grep "^ \+size:" | sed 's/.* \([0-9]\+\) .*/\1/')
+$CRYPTSETUP resize $DEV_NAME -b 7 2> /dev/null && fail
+dmsetup info $DEV_NAME | grep -q SUSPENDED && fail
+NEW_SIZE=$($CRYPTSETUP status $DEV_NAME | grep "^ \+size:" | sed 's/.* \([0-9]\+\) .*/\1/')
+test $OLD_SIZE -eq $NEW_SIZE || fail
+$CRYPTSETUP close $DEV_NAME || fail
+# Add check for unaligned plain crypt activation
+echo $PWD1 | $CRYPTSETUP create $DEV_NAME --hash sha1 $DEV -b 7 2>/dev/null && fail
+$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 && fail
 # verify is ignored on non-tty input
 echo $PWD1 | $CRYPTSETUP create $DEV_NAME $LOOPDEV --hash sha1 --verify-passphrase 2>/dev/null || fail
 $CRYPTSETUP -q remove  $DEV_NAME || fail
@@ -387,59 +578,61 @@ prepare "[20] Disallow open/create if already mapped." wipe
 $CRYPTSETUP create $DEV_NAME $LOOPDEV -d $KEY1 || fail
 $CRYPTSETUP create $DEV_NAME $LOOPDEV -d $KEY1 2>/dev/null && fail
 $CRYPTSETUP create $DEV_NAME2 $LOOPDEV -d $KEY1 2>/dev/null && fail
-echo $PWD1 | $CRYPTSETUP -q luksFormat $LOOPDEV 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $LOOPDEV 2>/dev/null && fail
 $CRYPTSETUP remove  $DEV_NAME || fail
-echo $PWD1 | $CRYPTSETUP -q luksFormat $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $LOOPDEV || fail
 echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
 echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME2 2>/dev/null && fail
 $CRYPTSETUP  luksClose  $DEV_NAME || fail
 
 prepare "[21] luksDump" wipe
-echo $PWD1 | $CRYPTSETUP -q luksFormat --uuid $TEST_UUID $LOOPDEV $KEY1 || fail
-echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT --uuid $TEST_UUID $LOOPDEV $KEY1 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d $KEY1 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 0: ENABLED" || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q $TEST_UUID || fail
 echo $PWDW | $CRYPTSETUP luksDump $LOOPDEV --dump-master-key 2>/dev/null && fail
-echo $PWD1 | $CRYPTSETUP luksDump $LOOPDEV --dump-master-key | grep -q "MK dump:" || can_fail_fips
-$CRYPTSETUP luksDump -q $LOOPDEV --dump-master-key -d $KEY1 | grep -q "MK dump:" || can_fail_fips
+echo $PWD1 | $CRYPTSETUP luksDump $LOOPDEV --dump-master-key | grep -q "MK dump:" || fail
+$CRYPTSETUP luksDump -q $LOOPDEV --dump-master-key -d $KEY1 | grep -q "MK dump:" || fail
+echo $PWD1 | $CRYPTSETUP luksDump -q $LOOPDEV --dump-master-key --master-key-file $VK_FILE > /dev/null || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --master-key-file $VK_FILE $LOOPDEV || fail
 
 prepare "[22] remove disappeared device" wipe
 dmsetup create $DEV_NAME --table "0 5000 linear $LOOPDEV 2" || fail
-echo $PWD1 | $CRYPTSETUP -q -i 0 luksFormat /dev/mapper/$DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP -q $FAST_PBKDF_OPT luksFormat --type luks1 /dev/mapper/$DEV_NAME || fail
 echo $PWD1 | $CRYPTSETUP -q luksOpen /dev/mapper/$DEV_NAME $DEV_NAME2 || fail
 # underlying device now returns error but node is still present
 dmsetup load $DEV_NAME --table "0 5000 error" || fail
 dmsetup resume $DEV_NAME || fail
 $CRYPTSETUP -q luksClose $DEV_NAME2 || fail
-dmsetup remove $DEV_NAME || fail
+dmsetup remove --retry $DEV_NAME || fail
 
 prepare "[23] ChangeKey passphrase and keyfile" wipe
 # [0]$KEY1 [1]key0
-$CRYPTSETUP -q luksFormat $LOOPDEV $KEY1 --key-slot 0 || fail
-echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 --key-slot 1 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $LOOPDEV $KEY1 $FAST_PBKDF_OPT --key-slot 0 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 --key-slot 1 || fail
 # keyfile [0] / keyfile [0]
-$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 --key-slot 0 || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 --key-slot 0 || fail
 # passphrase [1] / passphrase [1]
-echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksChangeKey $LOOPDEV --key-slot 1 || fail
+echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT --key-slot 1 || fail
 # keyfile [0] / keyfile [new]
-$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY2 $KEY1 || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY2 $KEY1 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 0: DISABLED" || fail
 # passphrase [1] / passphrase [new]
-echo -e "$PWD2\n$PWD1\n" | $CRYPTSETUP luksChangeKey $LOOPDEV || fail
+echo -e "$PWD2\n$PWD1\n" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT $LOOPDEV || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: DISABLED" || fail
 # use all slots
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -i 1 || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -i 1 || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -i 1 || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -i 1 || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -i 1 || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -i 1 || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
 # still allows replace
-$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 || fail
-$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 2>/dev/null && fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 2>/dev/null && fail
 
 prepare "[24] Keyfile limit" wipe
-$CRYPTSETUP -q luksFormat -i1 $LOOPDEV $KEY1 --key-slot 0 -l 13 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEY1 --key-slot 0 -l 13 || fail
 $CRYPTSETUP --key-file=$KEY1 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP --key-file=$KEY1 -l 0 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP --key-file=$KEY1 -l -1 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
@@ -448,33 +641,42 @@ $CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset 1 luksOpen $LOOPDEV $DEV_NAM
 $CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset -1 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP --key-file=$KEY1 -l 13 luksOpen $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP luksClose  $DEV_NAME || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 2>/dev/null && fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -l 14 2>/dev/null && fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -l -1 2>/dev/null && fail
-$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -i1 -l 13 --new-keyfile-size 12 || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT -l 14 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT -l -1 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT -l 13 --new-keyfile-size 12 || fail
 $CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 2>/dev/null && fail
 $CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 -l 12 || fail
-$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 2>/dev/null && fail
-$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 -l 14 2>/dev/null && fail
-$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 -i1 -l 13 || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT 2>/dev/null && fail
+$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT -l 14 2>/dev/null && fail
+$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT -l 13 || fail
 # -l is ignored for stdin if _only_ passphrase is used
-echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV -d $KEY2 -i1 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV -d $KEY2 $FAST_PBKDF_OPT || fail
 # this is stupid, but expected
 echo $PWD1 | $CRYPTSETUP luksRemoveKey $LOOPDEV -l 11 2>/dev/null && fail
 echo $PWDW"0" | $CRYPTSETUP luksRemoveKey $LOOPDEV -l 12 2>/dev/null && fail
 echo -e "$PWD1\n" | $CRYPTSETUP luksRemoveKey $LOOPDEV -d- -l 12 || fail
 # offset
-$CRYPTSETUP -q luksFormat -i1 $LOOPDEV $KEY1 --key-slot 0 -l 13 --keyfile-offset 16 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEY1 --key-slot 0 -l 13 --keyfile-offset 16 || fail
 $CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset 15 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset 16 luksOpen $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP luksClose  $DEV_NAME || fail
-$CRYPTSETUP luksAddKey $LOOPDEV -i1 -d $KEY1 -l 13 --keyfile-offset 16 $KEY2 --new-keyfile-offset 1 || fail
+$CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 -l 13 --keyfile-offset 16 $KEY2 --new-keyfile-offset 1 || fail
 $CRYPTSETUP --key-file=$KEY2 --keyfile-offset 11 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP --key-file=$KEY2 --keyfile-offset 1 luksOpen $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP luksClose  $DEV_NAME || fail
-$CRYPTSETUP luksChangeKey $LOOPDEV -i1 -d $KEY2 --keyfile-offset 1 $KEY2 --new-keyfile-offset 0 || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY2 --keyfile-offset 1 $KEY2 --new-keyfile-offset 0 || fail
 $CRYPTSETUP luksOpen -d $KEY2 $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP luksClose $DEV_NAME || fail
+# large device with keyfile
+echo -e '0 10000000 error'\\n'10000000 1000000 zero' | dmsetup create $DEV_NAME2 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV /dev/mapper/$DEV_NAME2 -l 13 --keyfile-offset 5120000000 || fail
+$CRYPTSETUP --key-file=/dev/mapper/$DEV_NAME2 -l 13 --keyfile-offset 5119999999 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=/dev/mapper/$DEV_NAME2 -l 13 --keyfile-offset 5120000000 luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP luksClose $DEV_NAME || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d /dev/mapper/$DEV_NAME2 \
+  --keyfile-offset 5120000000 -l 13 /dev/mapper/$DEV_NAME2 --new-keyfile-offset 5120000001 --new-keyfile-size 15 || fail
+dmsetup remove --retry $DEV_NAME2
 
 prepare "[25] Create shared segments" wipe
 echo $PWD1 | $CRYPTSETUP create $DEV_NAME $LOOPDEV  --hash sha1 --offset   0 --size 256 || fail
@@ -491,48 +693,56 @@ $CRYPTSETUP luksResume $DEV_NAME 2>/dev/null && fail
 $CRYPTSETUP -q remove  $DEV_NAME || fail
 $CRYPTSETUP luksSuspend $DEV_NAME 2>/dev/null && fail
 # LUKS
-echo $PWD1 | $CRYPTSETUP -q luksFormat $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV || fail
 echo $PWD1 | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP luksSuspend $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep -q "(suspended)" || fail
 $CRYPTSETUP -q resize  $DEV_NAME 2>/dev/null && fail
-echo $PWDW | $CRYPTSETUP luksResume $DEV_NAME -T 1 2>/dev/null && fail
+echo $PWDW | $CRYPTSETUP luksResume $DEV_NAME 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksResume should return EPERM exit code"
 echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME  || fail
 $CRYPTSETUP -q luksClose $DEV_NAME || fail
 
 prepare "[27] luksOpen with specified key slot number" wipe
 # first, let's try passphrase option
-echo $PWD3 | $CRYPTSETUP luksFormat -S 5 $LOOPDEV || fail
+echo $PWD3 | $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF_OPT -S 5 $LOOPDEV || fail
 check $LUKS_HEADER $KEY_SLOT5 $KEY_MATERIAL5
-echo $PWD3 | $CRYPTSETUP luksOpen -S 4 $LOOPDEV $DEV_NAME && fail
+echo $PWD3 | $CRYPTSETUP luksOpen -S 4 $LOOPDEV $DEV_NAME 2>/dev/null && fail
 [ -b /dev/mapper/$DEV_NAME ] && fail
 echo $PWD3 | $CRYPTSETUP luksOpen -S 5 $LOOPDEV $DEV_NAME || fail
 check_exists
 $CRYPTSETUP luksClose $DEV_NAME || fail
-echo -e "$PWD3\n$PWD1" | $CRYPTSETUP luksAddKey -S 0 $LOOPDEV || fail
+echo -e "$PWD3\n$PWD1" | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 0 $LOOPDEV || fail
 check $LUKS_HEADER $KEY_SLOT0 $KEY_MATERIAL0
-echo $PWD3 | $CRYPTSETUP luksOpen -S 0 $LOOPDEV $DEV_NAME && fail
+echo $PWD3 | $CRYPTSETUP luksOpen -S 0 $LOOPDEV $DEV_NAME 2>/dev/null && fail
 [ -b /dev/mapper/$DEV_NAME ] && fail
-echo $PWD1 | $CRYPTSETUP luksOpen -S 5 $LOOPDEV $DEV_NAME && fail
+echo $PWD1 | $CRYPTSETUP luksOpen -S 5 $LOOPDEV $DEV_NAME 2>/dev/null && fail
 [ -b /dev/mapper/$DEV_NAME ] && fail
 # second, try it with keyfiles
-$CRYPTSETUP luksFormat -q -S 5 -d $KEY5 $LOOPDEV || fail
+$CRYPTSETUP luksFormat --type luks1 -q -S 5 -d $KEY5 $LOOPDEV || fail
 check $LUKS_HEADER $KEY_SLOT5 $KEY_MATERIAL5
-$CRYPTSETUP luksAddKey -S 1 -d $KEY5 $LOOPDEV $KEY1 || fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 1 -d $KEY5 $LOOPDEV $KEY1 || fail
 check $LUKS_HEADER $KEY_SLOT1 $KEY_MATERIAL1
 $CRYPTSETUP luksOpen -S 5 -d $KEY5 $LOOPDEV $DEV_NAME || fail
 check_exists
 $CRYPTSETUP luksClose $DEV_NAME || fail
-$CRYPTSETUP luksOpen -S 1 -d $KEY5 $LOOPDEV $DEV_NAME && fail
+$CRYPTSETUP luksOpen -S 1 -d $KEY5 $LOOPDEV $DEV_NAME 2>/dev/null && fail
 [ -b /dev/mapper/$DEV_NAME ] && fail
-$CRYPTSETUP luksOpen -S 5 -d $KEY1 $LOOPDEV $DEV_NAME && fail
+$CRYPTSETUP luksOpen -S 5 -d $KEY1 $LOOPDEV $DEV_NAME 2>/dev/null && fail
 [ -b /dev/mapper/$DEV_NAME ] && fail
 
 prepare "[28] Detached LUKS header" wipe
-dd if=/dev/zero of=$HEADER_IMG bs=1M count=4 >/dev/null 2>&1
-echo $PWD1 | $CRYPTSETUP luksFormat -i1 $LOOPDEV --header $HEADER_IMG || fail
-echo $PWD1 | $CRYPTSETUP luksFormat -i1 $LOOPDEV --header $HEADER_IMG --align-payload 1 >/dev/null 2>&1 && fail
-echo $PWD1 | $CRYPTSETUP luksFormat -i1 $LOOPDEV --header $HEADER_IMG --align-payload 8192 || fail
-echo $PWD1 | $CRYPTSETUP luksFormat -i1 $LOOPDEV --header $HEADER_IMG --align-payload 0 || fail
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG || fail
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG --align-payload 1 >/dev/null 2>&1 && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG --align-payload 8192 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG --align-payload 0 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG --align-payload 8192 --offset 8192 >/dev/null 2>&1 && fail
+truncate -s 4096 $HEADER_IMG
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG -S7 >/dev/null 2>&1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG --offset 80000 >/dev/null 2>&1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG --offset 8192 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV --header $HEADER_IMG --offset 0 || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV-missing --header $HEADER_IMG $DEV_NAME 2>/dev/null && fail
 echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --header $HEADER_IMG $DEV_NAME || fail
 $CRYPTSETUP -q resize  $DEV_NAME --size 100 --header $HEADER_IMG || fail
 $CRYPTSETUP -q status  $DEV_NAME --header $HEADER_IMG | grep "size:" | grep -q "100 sectors" || fail
@@ -540,14 +750,18 @@ $CRYPTSETUP -q status  $DEV_NAME | grep "type:" | grep -q "n/a" || fail
 $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
 $CRYPTSETUP luksSuspend $DEV_NAME --header $HEADER_IMG || fail
 echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME --header $HEADER_IMG || fail
+$CRYPTSETUP luksSuspend $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME && fail
+echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME --header $HEADER_IMG || fail
 $CRYPTSETUP luksClose $DEV_NAME || fail
-echo $PWD1 | $CRYPTSETUP luksAddKey -S 5 _fakedev_ --header $HEADER_IMG $KEY5 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 5 _fakedev_ --header $HEADER_IMG $KEY5 || fail
 $CRYPTSETUP luksDump _fakedev_ --header $HEADER_IMG | grep -q "Key Slot 5: ENABLED" || fail
 $CRYPTSETUP luksKillSlot -q _fakedev_ --header $HEADER_IMG 5 || fail
 $CRYPTSETUP luksDump _fakedev_ --header $HEADER_IMG | grep -q "Key Slot 5: DISABLED" || fail
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $HEADER_IMG || fail
 
 prepare "[29] Repair metadata" wipe
-$CRYPTSETUP -q luksFormat -i1 $LOOPDEV $KEY1 --key-slot 0 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEY1 --key-slot 0 || fail
 # second sector overwrite should corrupt keyslot 6+7
 dd if=/dev/urandom of=$LOOPDEV bs=512 seek=1 count=1 >/dev/null 2>&1
 $CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV $DEV_NAME >/dev/null 2>&1 && fail
@@ -556,13 +770,242 @@ $CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV $DEV_NAME || fail
 $CRYPTSETUP luksClose $DEV_NAME || fail
 
 prepare "[30] LUKS erase" wipe
-$CRYPTSETUP -q luksFormat -i1 $LOOPDEV $KEY5 --key-slot 5 || fail
-$CRYPTSETUP luksAddKey -S 1 -d $KEY5 $LOOPDEV $KEY1 || fail
+$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEY5 --key-slot 5 || fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 1 -d $KEY5 $LOOPDEV $KEY1 || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: ENABLED" || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: ENABLED" || fail
 $CRYPTSETUP luksErase -q $LOOPDEV || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: DISABLED" || fail
 $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: DISABLED" || fail
 
+prepare "[31] Deferred removal of device" wipe
+echo $PWD1 | $CRYPTSETUP open --type plain --hash sha256 $LOOPDEV $DEV_NAME || fail
+echo $PWD2 | $CRYPTSETUP open --type plain --hash sha256 /dev/mapper/$DEV_NAME $DEV_NAME2 || fail
+$CRYPTSETUP close $DEV_NAME >/dev/null 2>&1 && fail
+$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail
+$CRYPTSETUP close --deferred $DEV_NAME >/dev/null 2>&1
+if [ $? -eq 0 ] ; then
+  dmsetup info $DEV_NAME | grep -q "DEFERRED REMOVE" || fail
+  $CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail
+  $CRYPTSETUP close $DEV_NAME2 || fail
+  $CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 && fail
+else
+  $CRYPTSETUP close $DEV_NAME2 >/dev/null 2>&1
+  $CRYPTSETUP close $DEV_NAME >/dev/null 2>&1
+fi
+
+# Interactive tests
+# Do not remove sleep 0.1 below, the password query flushes TTY buffer (so the code is racy).
+which expect >/dev/null 2>&1 || skip "WARNING: expect tool missing, interactive test will be skipped." 0
+
+prepare "[32] Interactive password retry from terminal." new
+EXPECT_DEV=$(losetup $LOOPDEV | sed -e "s/.*(\(.*\))/\1/")
+
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP luksOpen -v -T 2 $LOOPDEV $DEV_NAME
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0 x\n"
+expect timeout abort "No key available with this passphrase."
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Key slot 0 unlocked."
+expect timeout abort "Command successful."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+check_exists
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+
+prepare "[33] Interactive unsuccessful password retry from terminal." new
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP luksOpen -v -T 2 $LOOPDEV $DEV_NAME
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0 x\n"
+expect timeout abort "No key available with this passphrase."
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0 y\n"
+expect timeout abort "No key available with this passphrase."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+
+prepare "[34] Interactive kill of last key slot." new
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP luksKillSlot -v $LOOPDEV 0
+expect timeout abort "Are you sure? (Type 'yes' in capital letters):"
+send "YES\n"
+expect timeout abort "Enter any remaining passphrase:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksKillSlot -v $LOOPDEV 0
+expect timeout abort "Keyslot 0 is not active."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+
+prepare "[35] Interactive format of device." wipe
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF_OPT -v $LOOPDEV
+expect timeout abort "Are you sure? (Type 'yes' in capital letters):"
+send "YES\n"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Verify passphrase:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksOpen -v $LOOPDEV --test-passphrase
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+
+prepare "[36] Interactive unsuccessful format of device." new
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP erase -v $LOOPDEV
+expect timeout abort "Are you sure? (Type 'yes' in capital letters):"
+send "YES\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF_OPT -v $LOOPDEV
+expect timeout abort "Are you sure? (Type 'yes' in capital letters):"
+send "YES\n"
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Verify passphrase:"
+sleep 0.1
+send "$PWD0 x\n"
+expect timeout abort "Passphrases do not match."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksOpen -v $LOOPDEV -T 1 --test-passphrase
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "No usable keyslot is available."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+
+prepare "[37] Interactive add key." new
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP luksAddKey -S 2 $FAST_PBKDF_OPT -v $LOOPDEV
+expect timeout abort "Enter any existing passphrase:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Enter new passphrase for key slot:"
+sleep 0.1
+send "$PWD1\n"
+expect timeout abort "Verify passphrase:"
+sleep 0.1
+send "$PWD1\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksOpen $FAST_PBKDF_OPT -v $LOOPDEV --test-passphrase
+expect timeout abort "Enter passphrase"
+sleep 0.1
+send "$PWD1\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksKillSlot -v $LOOPDEV 1
+expect timeout abort "Keyslot 1 is not active."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksKillSlot -v $LOOPDEV 2
+expect timeout abort "Enter any remaining passphrase:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Key slot 2 removed."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+
+prepare "[38] Interactive change key." new
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT -v $LOOPDEV
+expect timeout abort "Enter passphrase to be changed:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Enter new passphrase:"
+sleep 0.1
+send "$PWD1\n"
+expect timeout abort "Verify passphrase:"
+sleep 0.1
+send "$PWD1\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksOpen -v $LOOPDEV --test-passphrase
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD1\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+
+prepare "[39] Interactive suspend and resume." new
+echo $PWD0 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+expect - >/dev/null <<EOF
+proc abort {} { send_error "Timeout. "; exit 2 }
+set timeout 10
+eval spawn $CRYPTSETUP luksSuspend -v $DEV_NAME
+expect timeout abort "Command successful."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksResume -v -T 3  $DEV_NAME
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0 x\n"
+expect timeout abort "No key available with this passphrase."
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD1\n"
+expect timeout abort "No key available with this passphrase."
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0 y\n"
+expect timeout abort "No key available with this passphrase."
+expect timeout abort eof
+eval spawn $CRYPTSETUP luksResume -v $DEV_NAME
+expect timeout abort "Enter passphrase for $EXPECT_DEV:"
+sleep 0.1
+send "$PWD0\n"
+expect timeout abort "Command successful."
+expect timeout abort eof
+exit
+EOF
+[ $? -eq 0 ] || fail "Expect script failed."
+$CRYPTSETUP remove $DEV_NAME || fail
+
 remove_mapping
 exit 0
diff --git a/tests/compat-test2 b/tests/compat-test2
new file mode 100755 (executable)
index 0000000..fd8d6f0
--- /dev/null
@@ -0,0 +1,1021 @@
+#!/bin/bash
+
+PS4='$LINENO:'
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+
+CRYPTSETUP_VALGRIND=../.libs/cryptsetup
+CRYPTSETUP_LIB_VALGRIND=../.libs
+
+DEV_NAME=dummy
+DEV_NAME2=dummy2
+DEV_NAME3=dummy3
+ORIG_IMG=luks-test-orig
+IMG=luks-test
+IMG10=luks-test-v10
+HEADER_IMG=luks-header
+HEADER_KEYU=luks2_keyslot_unassigned.img
+HEADER_LUKS2_PV=blkid-luks2-pv.img
+KEY1=key1
+KEY2=key2
+KEY5=key5
+KEYE=keye
+PWD0="compatkey"
+PWD1="93R4P4pIqAH8"
+PWD2="mymJeD8ivEhE"
+PWD3="ocMakf3fAcQO"
+PWD4="Qx3qn46vq0v"
+PWDW="rUkL4RUryBom"
+TEST_KEYRING_NAME="compattest2_keyring"
+TEST_TOKEN0="compattest2_desc0"
+TEST_TOKEN1="compattest2_desc1"
+VK_FILE="compattest2_vkfile"
+IMPORT_TOKEN="{\"type\":\"some_type\",\"keyslots\":[],\"base64_data\":\"zxI7vKB1Qwl4VPB4D-N-OgcC14hPCG0IDu8O7eCqaQ\"}"
+TOKEN_FILE0=test-token-file0
+TOKEN_FILE1=test-token-file1
+KEY_FILE0=test-key-file0
+KEY_FILE1=test-key-file1
+
+FAST_PBKDF_OPT="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
+
+TEST_UUID="12345678-1234-1234-1234-123456789abc"
+
+LOOPDEV=$(losetup -f 2>/dev/null)
+[ -f /etc/system-fips ] && FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/null)
+
+function remove_mapping()
+{
+       [ -b /dev/mapper/$DEV_NAME3 ] && dmsetup remove --retry $DEV_NAME3
+       [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
+       losetup -d $LOOPDEV >/dev/null 2>&1
+       rm -f $ORIG_IMG $IMG $IMG10 $KEY1 $KEY2 $KEY5 $KEYE $HEADER_IMG $HEADER_KEYU $VK_FILE $HEADER_LUKS2_PV missing-file $TOKEN_FILE0 $TOKEN_FILE1 test_image_* $KEY_FILE0 $KEY_FILE1 >/dev/null 2>&1
+
+       # unlink whole test keyring
+       [ -n "$TEST_KEYRING" ] && keyctl unlink $TEST_KEYRING "@u" >/dev/null
+       unset TEST_KEYRING
+
+       rmmod scsi_debug 2> /dev/null
+       scsi_debug_teardown $DEV
+}
+
+function force_uevent()
+{
+       DNAME=$(echo $LOOPDEV | cut -f3 -d /)
+       echo "change" >/sys/block/$DNAME/uevent
+}
+
+function fail()
+{
+       [ -n "$1" ] && echo "$1"
+       remove_mapping
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       exit 2
+}
+
+function fips_mode()
+{
+       [ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ]
+}
+
+function can_fail_fips()
+{
+        # Ignore this fail if running in FIPS mode
+       fips_mode || fail $1
+}
+
+function skip()
+{
+       [ -n "$1" ] && echo "$1"
+       remove_mapping
+       exit 77
+}
+
+function prepare()
+{
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
+
+       case "$2" in
+       wipe)
+               remove_mapping
+               dd if=/dev/zero of=$IMG bs=1M count=40 >/dev/null 2>&1
+               sync
+               losetup $LOOPDEV $IMG
+               ;;
+       new)
+               remove_mapping
+               xz -cd compatimage.img.xz > $IMG
+               xz -dk $HEADER_KEYU.xz
+               # FIXME: switch to internal loop (no losetup at all)
+               echo "bad" | $CRYPTSETUP luksOpen --key-slot 0 --test-passphrase $IMG 2>&1 | \
+                       grep "autoclear flag" && skip "WARNING: Too old kernel, test skipped."
+               losetup $LOOPDEV $IMG
+               xz -cd compatv10image.img.xz > $IMG10
+               ;;
+       reuse | *)
+               if [ ! -e $IMG ]; then
+                       xz -cd compatimage.img.xz > $IMG
+                       losetup $LOOPDEV $IMG
+               fi
+               [ ! -e $IMG10 ] && xz -cd compatv10image.img.xz > $IMG10
+               ;;
+       esac
+
+       if [ ! -e $KEY1 ]; then
+               #dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1
+               echo -n $'\x48\xc6\x74\x4f\x41\x4e\x50\xc0\x79\xc2\x2d\x5b\x5f\x68\x84\x17' >$KEY1
+               echo -n $'\x9c\x03\x5e\x1b\x4d\x0f\x9a\x75\xb3\x90\x70\x32\x0a\xf8\xae\xc4'>>$KEY1
+       fi
+
+       if [ ! -e $KEY2 ]; then
+               dd if=/dev/urandom of=$KEY2 count=1 bs=16 >/dev/null 2>&1
+       fi
+
+       if [ ! -e $KEY5 ]; then
+               dd if=/dev/urandom of=$KEY5 count=1 bs=16 >/dev/null 2>&1
+       fi
+
+       if [ ! -e $KEYE ]; then
+               touch $KEYE
+       fi
+
+       cp $IMG $ORIG_IMG
+       [ -n "$1" ] && echo "CASE: $1"
+}
+
+function check_exists()
+{
+       [ -b /dev/mapper/$DEV_NAME ] || fail
+}
+
+function valgrind_setup()
+{
+       which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
+       [ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptsetup executable."
+       export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
+}
+
+function valgrind_run()
+{
+       INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
+}
+
+function dm_crypt_keyring_support()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+       VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
+
+       test -d /proc/sys/kernel/keys || return 1
+
+       [ $VER_MAJ -gt 1 ] && return 0
+       [ $VER_MAJ -eq 1 -a $VER_MIN -gt 18 ] && return 0
+       [ $VER_MAJ -eq 1 -a $VER_MIN -eq 18 -a $VER_PTC -ge 1 ] && return 0
+       return 1
+}
+
+function dm_crypt_keyring_flawed()
+{
+       dm_crypt_keyring_support && return 1;
+
+       [ $VER_MAJ -gt 1 ] && return 0
+       [ $VER_MAJ -eq 1 -a $VER_MIN -ge 15 ] && return 0
+       return 1
+}
+
+function dm_crypt_keyring_new_kernel()
+{
+       KER_STR=$(uname -r)
+       [ -z "$KER_STR" ] && fail "Failed to parse kernel version."
+       KER_MAJ=$(echo $KER_STR | cut -f 1 -d.)
+       KER_MIN=$(echo $KER_STR | cut -f 2 -d.)
+
+       [ $KER_MAJ -ge 5 ] && return 0
+       [ $KER_MAJ -eq 4 -a $KER_MIN -ge 15 ] && return 0
+       return 1
+}
+
+function dm_crypt_sector_size_support()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+       VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
+
+       if [ $VER_MIN -ge 17 -o \( $VER_MIN -eq 14 -a $VER_PTC -ge 5 \) ]; then
+               return 0
+       fi
+
+       return 1
+}
+
+function test_and_prepare_keyring() {
+       which keyctl > /dev/null 2>&1 || skip "Cannot find keyctl, test skipped"
+       keyctl list "@s" > /dev/null || skip "Current session keyring is unreachable, test skipped"
+       TEST_KEYRING=$(keyctl newring $TEST_KEYRING_NAME "@u" 2> /dev/null)
+       test -n "$TEST_KEYRING" || skip "Failed to create keyring in user keyring"
+       keyctl search "@s" keyring "$TEST_KEYRING" > /dev/null 2>&1 || keyctl link "@u" "@s" > /dev/null 2>&1
+       load_key user test_key test_data "$TEST_KEYRING" || skip "Kernel keyring service is useless on this system, test skipped."
+}
+
+# $1 type
+# $2 description
+# $3 payload
+# $4 keyring
+function load_key()
+{
+       keyctl add $@ >/dev/null
+}
+
+function setup_luks2_env() {
+       echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 $FAST_PBKDF_OPT $LOOPDEV || fail
+       $CRYPTSETUP luksDump $LOOPDEV >/dev/null || fail
+       echo $PWD1 | $CRYPTSETUP open $LOOPDEV $DEV_NAME || fail
+       HAVE_KEYRING=$($CRYPTSETUP status $DEV_NAME | grep "keyring")
+       if [ -n "$HAVE_KEYRING" ]; then
+               HAVE_KEYRING=1
+       else
+               HAVE_KEYRING=0
+       fi
+       $CRYPTSETUP close $DEV_NAME || fail
+}
+
+# $1 path to scsi debug bdev
+scsi_debug_teardown() {
+       local _tries=15;
+
+       while [ -b "$1" -a $_tries -gt 0 ]; do
+               rmmod scsi_debug 2> /dev/null
+               if [ -b "$1" ]; then
+                       sleep .1
+                       _tries=$((_tries-1))
+               fi
+       done
+
+       test ! -b "$1" || rmmod scsi_debug 2> /dev/null
+}
+
+function add_scsi_device() {
+       scsi_debug_teardown $DEV
+        modprobe scsi_debug $@ delay=0
+        if [ $? -ne 0 ] ; then
+                echo "This kernel seems to not support proper scsi_debug module, test skipped."
+                exit 77
+        fi
+
+        sleep 1
+        DEV="/dev/"$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+        [ -b $DEV ] || fail "Cannot find $DEV."
+}
+
+export LANG=C
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+[ -z "$LOOPDEV" ] && skip "WARNING: Cannot find free loop device, test skipped."
+
+prepare "[0] Detect LUKS2 environment" wipe
+setup_luks2_env
+
+[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
+
+prepare "[1] Data offset" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --offset 1 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --offset 16385 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --offset 32 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --align-payload 16384 --offset 16384 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --offset 16384 || fail
+$CRYPTSETUP -q luksDump  $LOOPDEV | grep -q "offset: $((512 * 16384)) \[bytes\]" || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size 1024 --offset 16384 >/dev/null || fail
+$CRYPTSETUP -q luksDump  $LOOPDEV | grep -q "offset: $((512 * 16384)) \[bytes\]" || fail
+truncate -s 4096 $HEADER_IMG
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG -q --offset 80000 >/dev/null 2>&1 || fail
+
+prepare "[2] Sector size and old payload alignment" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size  511 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size  256 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size 8192 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size  512 || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --align-payload 5 || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size  512 --align-payload 5 || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size 2048 --align-payload 32 >/dev/null || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size 4096 >/dev/null || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size 2048 --align-payload 32768 >/dev/null || fail
+$CRYPTSETUP -q luksDump  $LOOPDEV | grep -q "offset: $((512 * 32768)) \[bytes\]" || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size 2048 >/dev/null || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -q --sector-size 4096 --align-payload 32768 >/dev/null || fail
+$CRYPTSETUP -q luksDump  $LOOPDEV | grep -q "offset: $((512 * 32768)) \[bytes\]" || fail
+
+prepare "[3] format" wipe
+echo $PWD1 | $CRYPTSETUP -q $FAST_PBKDF_OPT -c aes-cbc-essiv:sha256 -s 128 luksFormat --type luks2 $LOOPDEV || fail
+prepare "[4] format using hash sha512" wipe
+echo $PWD1 | $CRYPTSETUP $FAST_PBKDF_OPT -h sha512 -c aes-cbc-essiv:sha256 -s 128 luksFormat --type luks2 $LOOPDEV || fail
+$CRYPTSETUP -q luksDump  $LOOPDEV | grep "0: pbkdf2" -A2 | grep "Hash:" | grep -qe sha512 || fail
+
+prepare "[5] open"
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME --test-passphrase || fail
+echo $PWDW | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME --test-passphrase 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksOpen should return EPERM exit code"
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+check_exists
+
+# Key Slot 1 and key material section 1 must change, the rest must not.
+prepare "[6] add key"
+echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT || fail
+echo $PWD2 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+
+# Unsuccessful Key Delete - nothing may change
+prepare "[7] unsuccessful delete"
+echo $PWDW | $CRYPTSETUP luksKillSlot $LOOPDEV 1 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksKillSlot should return EPERM exit code"
+#FIXME
+#$CRYPTSETUP -q luksKillSlot $LOOPDEV 8 2>/dev/null && fail
+#$CRYPTSETUP -q luksKillSlot $LOOPDEV 7 2>/dev/null && fail
+
+# Delete Key Test
+# Key Slot 1 and key material section 1 must change, the rest must not
+prepare "[8] successful delete"
+$CRYPTSETUP -q luksKillSlot $LOOPDEV 1 || fail
+echo $PWD2 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME 2> /dev/null && fail
+[ $? -ne 2 ] && fail "luksOpen should return EPERM exit code"
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+
+# Key Slot 1 and key material section 1 must change, the rest must not
+prepare "[9] add key test for key files"
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV $KEY1 || fail
+$CRYPTSETUP -d $KEY1 luksOpen $LOOPDEV $DEV_NAME || fail
+
+# Key Slot 1 and key material section 1 must change, the rest must not
+prepare "[10] delete key test with key1 as remaining key"
+$CRYPTSETUP -d $KEY1 luksKillSlot $LOOPDEV 0 || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV $DEV_NAME || fail
+
+# Delete last slot
+prepare "[11] delete last key" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 $LOOPDEV $FAST_PBKDF_OPT || fail
+echo $PWD1 | $CRYPTSETUP luksKillSlot $LOOPDEV 0 || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+
+# Format test for ESSIV, and some other parameters.
+prepare "[12] parameter variation test" wipe
+$CRYPTSETUP -q $FAST_PBKDF_OPT -c aes-cbc-essiv:sha256 -s 128 luksFormat --type luks2 $LOOPDEV $KEY1 || fail
+$CRYPTSETUP -d $KEY1 luksOpen $LOOPDEV $DEV_NAME || fail
+
+prepare        "[13] open/close - stacked devices" wipe
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 $LOOPDEV $FAST_PBKDF_OPT || fail
+echo $PWD1 | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 /dev/mapper/$DEV_NAME $FAST_PBKDF_OPT || fail
+echo $PWD1 | $CRYPTSETUP -q luksOpen /dev/mapper/$DEV_NAME $DEV_NAME2 || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME2 || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+
+prepare        "[14] format/open - passphrase on stdin & new line" wipe
+# stdin defined by "-" must take even newline
+#echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksFormat $LOOPDEV - || fail
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP $FAST_PBKDF_OPT -q --key-file=- luksFormat --type luks2 $LOOPDEV || fail
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q --key-file=- luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+# now also try --key-file
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP $FAST_PBKDF_OPT -q luksFormat --type luks2 $LOOPDEV --key-file=- || fail
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP -q --key-file=- luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+# process newline if from stdin
+echo -n -e "$PWD1\n$PWD2" | $CRYPTSETUP $FAST_PBKDF_OPT -q luksFormat --type luks2 $LOOPDEV || fail
+echo "$PWD1" | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+
+prepare "[15] UUID - use and report provided UUID" wipe
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --uuid blah --type luks2 $LOOPDEV 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --uuid $TEST_UUID --type luks2 $LOOPDEV || fail
+tst=$($CRYPTSETUP -q luksUUID $LOOPDEV)
+[ "$tst"x = "$TEST_UUID"x ] || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV || fail
+$CRYPTSETUP -q luksUUID --uuid $TEST_UUID $LOOPDEV || fail
+tst=$($CRYPTSETUP -q luksUUID $LOOPDEV)
+[ "$tst"x = "$TEST_UUID"x ] || fail
+
+prepare "[16] luksFormat" wipe
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --master-key-file /dev/urandom --type luks2 $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --master-key-file /dev/urandom --type luks2 $LOOPDEV -d $KEY1 || fail
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --master-key-file /dev/urandom -s 256 --uuid $TEST_UUID --type luks2 $LOOPDEV $KEY1 || fail
+$CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+# open by UUID
+force_uevent # some systems do not update loop by-uuid
+$CRYPTSETUP luksOpen -d $KEY1 UUID=X$TEST_UUID $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP luksOpen -d $KEY1 UUID=$TEST_UUID $DEV_NAME || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+# empty keyfile
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEYE || fail
+$CRYPTSETUP luksOpen -d $KEYE $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+# open by volume key
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT -s 256 --master-key-file $KEY1 --type luks2 $LOOPDEV || fail
+$CRYPTSETUP luksOpen --master-key-file /dev/urandom $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP luksOpen --master-key-file $KEY1 $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP -q luksClose  $DEV_NAME || fail
+
+prepare "[17] AddKey volume key, passphrase and keyfile" wipe
+# masterkey
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --master-key-file /dev/zero --key-slot 3 || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "3: luks2" || fail
+echo $PWD2 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --master-key-file /dev/zero --key-slot 4 || fail
+echo $PWD2 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 4 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "4: luks2" || fail
+echo $PWD3 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --master-key-file /dev/null --key-slot 5 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --master-key-file /dev/zero --key-slot 5 $KEY1 || fail
+$CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 5 -d $KEY1 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "5: luks2" || fail
+
+# special "-" handling
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEY1 --key-slot 3 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d $KEY1 - || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV -d - --test-passphrase || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d - $KEY2 || fail
+$CRYPTSETUP luksOpen $LOOPDEV -d $KEY2 --test-passphrase || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV -d - -d $KEY1 --test-passphrase 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV -d $KEY1 -d $KEY1 --test-passphrase 2>/dev/null && fail
+
+# [0]PWD1 [1]PWD2 [2]$KEY1/1 [3]$KEY1 [4]$KEY2
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEY1 --key-slot 3 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "3: luks2" || fail
+$CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 --key-slot 3 2>/dev/null && fail
+# keyfile/keyfile
+$CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 --key-slot 4 || fail
+$CRYPTSETUP luksOpen $LOOPDEV -d $KEY2 --test-passphrase --key-slot 4 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "4: luks2" || fail
+# passphrase/keyfile
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d $KEY1 --key-slot 0 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "0: luks2" || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 0 || fail
+# passphrase/passphrase
+echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --key-slot 1 || fail
+echo $PWD2 | $CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 1 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" || fail
+# keyfile/passphrase
+echo -e "$PWD2\n" | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV $KEY1 --key-slot 2 --new-keyfile-size 3 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "2: luks2" || fail
+
+prepare "[18] RemoveKey passphrase and keyfile" reuse
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "3: luks2" || fail
+$CRYPTSETUP luksRemoveKey $LOOPDEV $KEY1 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "3: luks2" && fail
+$CRYPTSETUP luksRemoveKey $LOOPDEV $KEY1 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksRemoveKey should return EPERM exit code"
+$CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 --keyfile-size 1 2>/dev/null && fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "4: luks2" || fail
+$CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "4: luks2" && fail
+# if password or keyfile is provided, batch mode must not suppress it
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 2>/dev/null && fail
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 -q 2>/dev/null && fail
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 --key-file=- 2>/dev/null && fail
+echo "badpw" | $CRYPTSETUP luksKillSlot $LOOPDEV 2 --key-file=- -q 2>/dev/null && fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "2: luks2" || fail
+# kill slot using passphrase from 1
+echo $PWD2 | $CRYPTSETUP luksKillSlot $LOOPDEV 2 2>/dev/null || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "2: luks2" && fail
+# remove key0 / slot 0
+echo $PWD1 | $CRYPTSETUP luksRemoveKey $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "0: luks2" && fail
+# last keyslot, in batch mode no passphrase needed...
+$CRYPTSETUP luksKillSlot -q $LOOPDEV 1 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" && fail
+
+prepare "[19] create & status & resize" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+if dm_crypt_keyring_support; then
+       echo | $CRYPTSETUP -q resize --size 100 $DEV_NAME 2>/dev/null && fail
+fi
+echo $PWD1 | $CRYPTSETUP -q resize --size 100 $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
+echo $PWD1 | $CRYPTSETUP -q resize --device-size 51200 $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
+echo $PWD1 | $CRYPTSETUP -q resize --device-size 1M $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "2048 sectors" || fail
+echo $PWD1 | $CRYPTSETUP -q resize --device-size 512k --size 1024 $DEV_NAME > /dev/null 2>&1 && fail
+echo $PWD1 | $CRYPTSETUP -q resize --device-size 4097 $DEV_NAME > /dev/null 2>&1 && fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "2048 sectors" || fail
+$CRYPTSETUP close $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP luksOpen --disable-keyring $LOOPDEV $DEV_NAME || fail
+echo | $CRYPTSETUP -q resize --size 100 $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
+$CRYPTSETUP close $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+if dm_crypt_keyring_support; then
+       $CRYPTSETUP -q resize --disable-keyring --size 100 $DEV_NAME 2>/dev/null && fail
+fi
+if dm_crypt_sector_size_support; then
+       $CRYPTSETUP close $DEV_NAME || fail
+       echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 --sector-size 4096 $LOOPDEV > /dev/null || fail
+       echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+       echo $PWD1 | $CRYPTSETUP -q resize --device-size 1M $DEV_NAME || fail
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "2048 sectors" || fail
+       echo $PWD1 | $CRYPTSETUP -q resize --device-size 2049s $DEV_NAME > /dev/null 2>&1 && fail
+       echo $PWD1 | $CRYPTSETUP -q resize --size 2049 $DEV_NAME > /dev/null 2>&1 && fail
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "2048 sectors" || fail
+fi
+$CRYPTSETUP close $DEV_NAME || fail
+# Resize not aligned to logical block size
+add_scsi_device dev_size_mb=32 sector_size=4096
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 $FAST_PBKDF_OPT $DEV || fail
+echo $PWD1 | $CRYPTSETUP open $DEV $DEV_NAME || fail
+OLD_SIZE=$($CRYPTSETUP status $DEV_NAME | grep "^ \+size:" | sed 's/.* \([0-9]\+\) .*/\1/')
+echo $PWD1 | $CRYPTSETUP resize $DEV_NAME -b 7 2> /dev/null && fail
+dmsetup info $DEV_NAME | grep -q SUSPENDED && fail
+NEW_SIZE=$($CRYPTSETUP status $DEV_NAME | grep "^ \+size:" | sed 's/.* \([0-9]\+\) .*/\1/')
+test $OLD_SIZE -eq $NEW_SIZE || fail
+$CRYPTSETUP close $DEV_NAME || fail
+
+prepare "[20] Disallow open/create if already mapped." wipe
+$CRYPTSETUP create $DEV_NAME $LOOPDEV -d $KEY1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV 2>/dev/null && fail
+$CRYPTSETUP remove  $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME2 2>/dev/null && fail
+$CRYPTSETUP  luksClose  $DEV_NAME || fail
+
+prepare "[21] luksDump" wipe
+echo $PWD1 | $CRYPTSETUP -q luksFormat --key-size 256 $FAST_PBKDF_OPT --uuid $TEST_UUID --type luks2 $LOOPDEV $KEY1 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -d $KEY1 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "0: luks2" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q $TEST_UUID || fail
+echo $PWDW | $CRYPTSETUP luksDump $LOOPDEV --dump-master-key 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksDump $LOOPDEV --dump-master-key | grep -q "MK dump:" || fail
+$CRYPTSETUP luksDump -q $LOOPDEV --dump-master-key -d $KEY1 | grep -q "MK dump:" || fail
+echo $PWD1 | $CRYPTSETUP luksDump -q $LOOPDEV --dump-master-key --master-key-file $VK_FILE >/dev/null || fail
+echo $PWD1 | $CRYPTSETUP luksDump -q $LOOPDEV --dump-master-key --master-key-file $VK_FILE 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --master-key-file $VK_FILE $LOOPDEV || fail
+# Use volume key file without keyslots
+$CRYPTSETUP luksErase -q $LOOPDEV || fail
+$CRYPTSETUP luksOpen --master-key-file $VK_FILE --key-size 256 --test-passphrase $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --master-key-file $VK_FILE --key-size 256 $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP luksOpen --test-passphrase $LOOPDEV || fail
+
+prepare "[22] remove disappeared device" wipe
+dmsetup create $DEV_NAME --table "0 39998 linear $LOOPDEV 2" || fail
+echo $PWD1 | $CRYPTSETUP -q $FAST_PBKDF_OPT luksFormat --type luks2 /dev/mapper/$DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP -q luksOpen /dev/mapper/$DEV_NAME $DEV_NAME2 || fail
+# underlying device now returns error but node is still present
+dmsetup load $DEV_NAME --table "0 40000 error" || fail
+dmsetup resume $DEV_NAME || fail
+$CRYPTSETUP -q luksClose $DEV_NAME2 || fail
+dmsetup remove --retry $DEV_NAME || fail
+
+prepare "[23] ChangeKey passphrase and keyfile" wipe
+# [0]$KEY1 [1]key0
+$CRYPTSETUP -q luksFormat --type luks2 $LOOPDEV $KEY1 $FAST_PBKDF_OPT --key-slot 0 || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 --key-slot 1 || fail
+# keyfile [0] / keyfile [0]
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 --key-slot 0 || fail
+# passphrase [1] / passphrase [1]
+echo -e "$PWD1\n$PWD2\n" | $CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT --key-slot 1 || fail
+# keyfile [0] / keyfile [new]
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY2 $KEY1 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "0: luks2" && fail
+# passphrase [1] / passphrase [new]
+echo -e "$PWD2\n$PWD1\n" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" && fail
+# use all slots
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT || fail
+# still allows replace
+#FIXME
+#$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 || fail
+#$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 $KEY2 2>/dev/null && fail
+
+prepare "[24] Keyfile limit" wipe
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEY1 --key-slot 0 -l 13 || fail
+$CRYPTSETUP --key-file=$KEY1 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY1 -l 0 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY1 -l -1 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY1 -l 14 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset 1 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset -1 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY1 -l 13 luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP luksClose  $DEV_NAME || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -l 14 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 -l -1 2>/dev/null && fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT -l 13 --new-keyfile-size 12 || fail
+$CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 2>/dev/null && fail
+$CRYPTSETUP luksRemoveKey $LOOPDEV $KEY2 -l 12 || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksChangeKey should return EPERM exit code"
+$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 -l 14 2>/dev/null && fail
+$CRYPTSETUP luksChangeKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT -l 13 || fail
+# -l is ignored for stdin if _only_ passphrase is used
+echo $PWD1 | $CRYPTSETUP luksAddKey $LOOPDEV -d $KEY2 $FAST_PBKDF_OPT || fail
+# this is stupid, but expected
+echo $PWD1 | $CRYPTSETUP luksRemoveKey $LOOPDEV -l 11 2>/dev/null && fail
+echo $PWDW"0" | $CRYPTSETUP luksRemoveKey $LOOPDEV -l 12 2>/dev/null && fail
+echo -e "$PWD1\n" | $CRYPTSETUP luksRemoveKey $LOOPDEV -d- -l 12 || fail
+# offset
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEY1 --key-slot 0 -l 13 --keyfile-offset 16 || fail
+$CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset 15 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY1 -l 13 --keyfile-offset 16 luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP luksClose  $DEV_NAME || fail
+$CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY1 -l 13 --keyfile-offset 16 $KEY2 --new-keyfile-offset 1 || fail
+$CRYPTSETUP --key-file=$KEY2 --keyfile-offset 11 luksOpen $LOOPDEV $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP --key-file=$KEY2 --keyfile-offset 1 luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP luksClose  $DEV_NAME || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY2 --keyfile-offset 1 $KEY2 --new-keyfile-offset 0 || fail
+$CRYPTSETUP luksOpen -d $KEY2 $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP luksClose $DEV_NAME || fail
+
+prepare "[26] Suspend/Resume" wipe
+# LUKS
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV || fail
+echo $PWD1 | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP luksSuspend $DEV_NAME || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep -q "(suspended)" || fail
+$CRYPTSETUP -q resize  $DEV_NAME 2>/dev/null && fail
+echo $PWDW | $CRYPTSETUP luksResume $DEV_NAME 2>/dev/null && fail
+[ $? -ne 2 ] && fail "luksResume should return EPERM exit code"
+echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME  || fail
+$CRYPTSETUP -q luksClose $DEV_NAME || fail
+
+prepare "[27] luksOpen with specified key slot number" wipe
+# first, let's try passphrase option
+echo $PWD3 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT -S 5 --type luks2 $LOOPDEV || fail
+echo $PWD3 | $CRYPTSETUP luksOpen -S 4 $LOOPDEV $DEV_NAME 2>/dev/null && fail
+[ -b /dev/mapper/$DEV_NAME ] && fail
+echo $PWD3 | $CRYPTSETUP luksOpen -S 5 $LOOPDEV $DEV_NAME || fail
+check_exists
+$CRYPTSETUP luksClose $DEV_NAME || fail
+echo -e "$PWD3\n$PWD1" | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 0 $LOOPDEV || fail
+echo $PWD3 | $CRYPTSETUP luksOpen -S 0 $LOOPDEV $DEV_NAME 2>/dev/null && fail
+[ -b /dev/mapper/$DEV_NAME ] && fail
+echo $PWD1 | $CRYPTSETUP luksOpen -S 5 $LOOPDEV $DEV_NAME 2>/dev/null && fail
+[ -b /dev/mapper/$DEV_NAME ] && fail
+# second, try it with keyfiles
+$CRYPTSETUP -q luksFormat -q -S 5 $FAST_PBKDF_OPT -d $KEY5 --type luks2 $LOOPDEV || fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 1 -d $KEY5 $LOOPDEV $KEY1 || fail
+$CRYPTSETUP luksOpen -S 5 -d $KEY5 $LOOPDEV $DEV_NAME || fail
+check_exists
+$CRYPTSETUP luksClose $DEV_NAME || fail
+$CRYPTSETUP luksOpen -S 1 -d $KEY5 $LOOPDEV $DEV_NAME 2>/dev/null && fail
+[ -b /dev/mapper/$DEV_NAME ] && fail
+$CRYPTSETUP luksOpen -S 5 -d $KEY1 $LOOPDEV $DEV_NAME 2>/dev/null && fail
+[ -b /dev/mapper/$DEV_NAME ] && fail
+# test keyslot not assigned to segment is unable to unlock volume
+# otoh it should be allowed to test for proper passphrase
+prepare "" new
+echo $PWD1 | $CRYPTSETUP open -S1 --test-passphrase $HEADER_KEYU || fail
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $HEADER_KEYU || fail
+echo $PWD1 | $CRYPTSETUP open -S1 $HEADER_KEYU $DEV_NAME 2>/dev/null && fail
+[ -b /dev/mapper/$DEV_NAME ] && fail
+echo $PWD1 | $CRYPTSETUP open $HEADER_KEYU $DEV_NAME 2>/dev/null && fail
+[ -b /dev/mapper/$DEV_NAME ] && fail
+echo $PWD0 | $CRYPTSETUP open -S1 --test-passphrase $HEADER_KEYU $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP luksKillSlot -q $HEADER_KEYU 0
+$CRYPTSETUP luksDump $HEADER_KEYU | grep -q "0: luks2" && fail
+echo $PWD1 | $CRYPTSETUP open -S1 --test-passphrase $HEADER_KEYU || fail
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $HEADER_KEYU || fail
+echo $PWD1 | $CRYPTSETUP open -S1 $HEADER_KEYU $DEV_NAME 2>/dev/null && fail
+
+prepare "[28] Detached LUKS header" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG || fail
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG --align-payload 1 >/dev/null 2>&1 && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG --align-payload 8192 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG --align-payload 4096 >/dev/null || fail
+$CRYPTSETUP luksDump $HEADER_IMG | grep -e "0: crypt" -A1 | grep -qe $((4096*512)) || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG --align-payload 0 || fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV-missing --header $HEADER_IMG $DEV_NAME 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksOpen $LOOPDEV --header $HEADER_IMG $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP -q resize  $DEV_NAME --size 100 --header $HEADER_IMG || fail
+$CRYPTSETUP -q status  $DEV_NAME --header $HEADER_IMG | grep "size:" | grep -q "100 sectors" || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "type:" | grep -q "n/a" || fail
+$CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
+$CRYPTSETUP luksSuspend $DEV_NAME --header $HEADER_IMG || fail
+echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME --header $HEADER_IMG || fail
+$CRYPTSETUP luksSuspend $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME && fail
+echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME --header $HEADER_IMG || fail
+$CRYPTSETUP luksClose $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 5 _fakedev_ --header $HEADER_IMG $KEY5 || fail
+$CRYPTSETUP luksDump _fakedev_ --header $HEADER_IMG | grep -q "5: luks2" || fail
+$CRYPTSETUP luksKillSlot -q _fakedev_ --header $HEADER_IMG 5 || fail
+$CRYPTSETUP luksDump _fakedev_ --header $HEADER_IMG | grep -q "5: luks2" && fail
+echo $PWD1 | $CRYPTSETUP open --test-passphrase $HEADER_IMG || fail
+
+prepare "[29] Repair metadata" wipe
+xz -dk $HEADER_LUKS2_PV.xz
+$CRYPTSETUP isLuks --disable-locks $HEADER_LUKS2_PV && fail
+$CRYPTSETUP isLuks $HEADER_LUKS2_PV && fail
+$CRYPTSETUP isLuks --disable-locks --type luks2 $HEADER_LUKS2_PV && fail
+$CRYPTSETUP isLuks --type luks2 $HEADER_LUKS2_PV && fail
+$CRYPTSETUP -q repair $HEADER_LUKS2_PV || fail
+$CRYPTSETUP isLuks $HEADER_LUKS2_PV || fail
+$CRYPTSETUP isLuks --type luks2 $HEADER_LUKS2_PV || fail
+$CRYPTSETUP isLuks --type luks1 $HEADER_LUKS2_PV && fail
+
+prepare "[30] LUKS erase" wipe
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEY5 --key-slot 5 || fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 1 -d $KEY5 $LOOPDEV $KEY1 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "5: luks2" || fail
+$CRYPTSETUP luksErase -q $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" && fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "5: luks2" && fail
+
+prepare "[31] LUKS convert" wipe
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks1 $LOOPDEV $KEY5 --key-slot 5 || fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 1 -d $KEY5 $LOOPDEV $KEY1 || fail
+$CRYPTSETUP -q convert --type luks1 $LOOPDEV >/dev/null 2>&1 && fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: ENABLED" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: ENABLED" || fail
+$CRYPTSETUP -q convert --type luks2 $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "5: luks2" || fail
+$CRYPTSETUP -q convert --type luks1 $LOOPDEV || fail
+# hash test
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 --sector-size 512 $LOOPDEV $KEY5 -S 0 --hash sha1 || fail
+$CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 1 -d $KEY5 $LOOPDEV $KEY1 --hash sha256 || fail
+$CRYPTSETUP -q convert --type luks1 $LOOPDEV >/dev/null 2>&1 && fail
+$CRYPTSETUP -q luksKillSlot $LOOPDEV 1 || fail
+$CRYPTSETUP -q convert --type luks1 $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 0: ENABLED" || fail
+$CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 0 -d $KEY5 || fail
+# sector size test
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 --sector-size 1024 $LOOPDEV $KEY5 || fail
+$CRYPTSETUP -q convert --type luks1 $LOOPDEV >/dev/null 2>&1 && fail
+
+# create LUKS1 with data offset not aligned to 4KiB
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks1 $LOOPDEV $KEY5 --align-payload 4097 || fail
+$CRYPTSETUP -q convert --type luks2 $LOOPDEV || fail
+$CRYPTSETUP isLuks --type luks2 $LOOPDEV || fail
+$CRYPTSETUP luksOpen $LOOPDEV --test-passphrase --key-slot 0 -d $KEY5 || fail
+
+if dm_crypt_keyring_flawed; then
+       prepare "[32a] LUKS2 keyring dm-crypt bug" wipe
+       echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG || fail
+       echo $PWD1 | $CRYPTSETUP open $LOOPDEV --header $HEADER_IMG $DEV_NAME || fail
+       $CRYPTSETUP -q status $DEV_NAME | grep "key location:" | grep -q "dm-crypt" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       # key must not load in kernel key even when dm-crypt module is missing
+       if rmmod dm-crypt > /dev/null 2>&1; then
+               echo $PWD1 | $CRYPTSETUP open $LOOPDEV --header $HEADER_IMG $DEV_NAME || fail
+               $CRYPTSETUP -q status $DEV_NAME | grep "key location:" | grep -q "dm-crypt" || fail
+               $CRYPTSETUP close $DEV_NAME || fail
+       fi
+fi
+
+if dm_crypt_keyring_support && dm_crypt_keyring_new_kernel; then
+       prepare "[32] LUKS2 key in keyring" wipe
+       echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --header $HEADER_IMG || fail
+
+       # check keyring support detection works as expected
+       rmmod dm-crypt > /dev/null 2>&1 || true
+       echo $PWD1 | $CRYPTSETUP open $LOOPDEV --header $HEADER_IMG $DEV_NAME || fail
+       $CRYPTSETUP -q status $DEV_NAME | grep "key location:" | grep -q "keyring" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+
+       echo $PWD1 | $CRYPTSETUP open  $LOOPDEV --disable-keyring --header $HEADER_IMG $DEV_NAME || fail
+       $CRYPTSETUP -q status $DEV_NAME | grep "key location:" | grep -q "dm-crypt" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+
+       echo $PWD1 | $CRYPTSETUP open $LOOPDEV --disable-keyring --header $HEADER_IMG $DEV_NAME || fail
+       $CRYPTSETUP luksSuspend $DEV_NAME || fail
+       echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME --header $HEADER_IMG || fail
+       $CRYPTSETUP -q status $DEV_NAME | grep "key location:" | grep -q "keyring" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+
+       echo $PWD1 | $CRYPTSETUP open $LOOPDEV --header $HEADER_IMG $DEV_NAME || fail
+       $CRYPTSETUP luksSuspend $DEV_NAME || fail
+       echo $PWD1 | $CRYPTSETUP luksResume --disable-keyring $DEV_NAME --header $HEADER_IMG || fail
+       $CRYPTSETUP -q status $DEV_NAME | grep "key location:" | grep -q "dm-crypt" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+fi
+
+# FIXME: candidate for non-root tests
+prepare "[33] tokens" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV || fail
+if [ $HAVE_KEYRING -gt 0 -a -d /proc/sys/kernel/keys ]; then
+
+       test_and_prepare_keyring
+
+       $CRYPTSETUP token add $LOOPDEV --key-description $TEST_TOKEN0 --token-id 3 || fail
+       $CRYPTSETUP luksDump $LOOPDEV | grep -q -e "3: luks2-keyring" || fail
+       # keyslot 5 is inactive
+       $CRYPTSETUP token add $LOOPDEV --key-description $TEST_TOKEN1 --key-slot 5 2> /dev/null && fail
+       # key description is not reachable
+       $CRYPTSETUP open --token-only $LOOPDEV --test-passphrase && fail
+       # wrong passphrase
+       load_key user $TEST_TOKEN0 "blabla" "$TEST_KEYRING" || fail "Cannot load 32 byte user key type"
+       $CRYPTSETUP open --token-only $LOOPDEV --test-passphrase 2>/dev/null && fail
+       load_key user $TEST_TOKEN0 $PWD1 "$TEST_KEYRING" || fail "Cannot load 32 byte user key type"
+       $CRYPTSETUP open --token-only $LOOPDEV --test-passphrase || fail
+       $CRYPTSETUP open --token-only $LOOPDEV $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME > /dev/null || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       $CRYPTSETUP token remove --token-id 3 $LOOPDEV || fail
+       $CRYPTSETUP luksDump $LOOPDEV | grep -q -e "3: luks2-keyring" && fail
+
+       # test we can remove keyslot with token
+       echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey -S4 $FAST_PBKDF_OPT $LOOPDEV || fail
+       $CRYPTSETUP token add $LOOPDEV --key-description $TEST_TOKEN1 --key-slot 4 || fail
+       $CRYPTSETUP -q luksKillSlot $LOOPDEV 4 || fail
+fi
+echo -n "$IMPORT_TOKEN" | $CRYPTSETUP token import $LOOPDEV --token-id 10 || fail
+echo -n "$IMPORT_TOKEN" | $CRYPTSETUP token import $LOOPDEV --token-id 11 --json-file - || fail
+echo -n "$IMPORT_TOKEN" > $TOKEN_FILE0
+$CRYPTSETUP token import $LOOPDEV --token-id 12 --json-file $TOKEN_FILE0 || fail
+$CRYPTSETUP token import $LOOPDEV --token-id 12 --json-file $TOKEN_FILE0 2>/dev/null && fail
+$CRYPTSETUP token export $LOOPDEV --token-id 10 | diff --from-file - $TOKEN_FILE0 || fail
+$CRYPTSETUP token export $LOOPDEV --token-id 11 | diff --from-file - $TOKEN_FILE0 || fail
+$CRYPTSETUP token export $LOOPDEV --token-id 12 | diff --from-file - $TOKEN_FILE0 || fail
+$CRYPTSETUP token export $LOOPDEV --token-id 12 --json-file $TOKEN_FILE1 || fail
+diff $TOKEN_FILE0 $TOKEN_FILE1 || fail
+$CRYPTSETUP token export $LOOPDEV --token-id 12 > $TOKEN_FILE1 || fail
+diff $TOKEN_FILE0 $TOKEN_FILE1 || fail
+
+prepare "[34] LUKS keyslot priority" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV -S 1 || fail
+echo -e "$PWD1\n$PWD2" | $CRYPTSETUP luksAddKey $LOOPDEV $FAST_PBKDF_OPT -S 5 || fail
+$CRYPTSETUP config $LOOPDEV -S 0 --priority prefer && fail
+$CRYPTSETUP config $LOOPDEV -S 1 --priority bla >/dev/null 2>&1 && fail
+$CRYPTSETUP config $LOOPDEV -S 1 --priority ignore || fail
+echo $PWD1 | $CRYPTSETUP open $LOOPDEV --test-passphrase 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP open $LOOPDEV --test-passphrase -S 1 || fail
+echo $PWD2 | $CRYPTSETUP open $LOOPDEV --test-passphrase || fail
+$CRYPTSETUP config $LOOPDEV -S 1 --priority normal || fail
+echo $PWD1 | $CRYPTSETUP open $LOOPDEV --test-passphrase || fail
+$CRYPTSETUP config $LOOPDEV -S 1 --priority ignore || fail
+echo $PWD1 | $CRYPTSETUP open $LOOPDEV --test-passphrase 2>/dev/null && fail
+
+prepare "[35] LUKS label and subsystem" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Subsystem:" | grep -q "(no subsystem)" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Label:" | grep -q "(no label)" || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --subsystem SatelliteTwo --label TheLabel || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Subsystem:" | grep -q "SatelliteTwo" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Label:" | grep -q "TheLabel" || fail
+$CRYPTSETUP config $LOOPDEV --subsystem SatelliteThree
+$CRYPTSETUP luksDump $LOOPDEV | grep "Subsystem:" | grep -q "SatelliteThree" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Label:" | grep -q "(no label)" || fail
+$CRYPTSETUP config $LOOPDEV --subsystem SatelliteThree --label TheLabel
+$CRYPTSETUP luksDump $LOOPDEV | grep "Subsystem:" | grep -q "SatelliteThree" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Label:" | grep -q "TheLabel" || fail
+
+prepare "[36] LUKS PBKDF setting" wipe
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 --pbkdf bla $LOOPDEV >/dev/null 2>&1 && fail
+# Force setting, no benchmark. PBKDF2 has 1000 iterations as a minimum
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 --pbkdf pbkdf2   --pbkdf-force-iterations 999 $LOOPDEV 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --pbkdf pbkdf2   --pbkdf-force-iterations 1234 $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Iterations:" | grep -q "1234" || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --pbkdf argon2id --pbkdf-force-iterations 3 $LOOPDEV 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --pbkdf argon2id --pbkdf-force-iterations 4 --pbkdf-memory 100000 $LOOPDEV || can_fail_fips
+$CRYPTSETUP luksDump $LOOPDEV | grep "PBKDF:" | grep -q "argon2id" || can_fail_fips
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --pbkdf argon2i  --pbkdf-force-iterations 4 \
+       --pbkdf-memory 1234 --pbkdf-parallel 1 $LOOPDEV || can_fail_fips
+$CRYPTSETUP luksDump $LOOPDEV | grep "PBKDF:" | grep -q "argon2i" || can_fail_fips
+$CRYPTSETUP luksDump $LOOPDEV | grep "Time cost:" | grep -q "4" || can_fail_fips
+$CRYPTSETUP luksDump $LOOPDEV | grep "Memory:" | grep -q "1234" || can_fail_fips
+$CRYPTSETUP luksDump $LOOPDEV | grep "Threads:" | grep -q "1" || can_fail_fips
+# Benchmark
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --pbkdf argon2i -i 500 --pbkdf-memory 1234 --pbkdf-parallel 1 $LOOPDEV || can_fail_fips
+[ 0"$($CRYPTSETUP luksDump $LOOPDEV | grep "Time cost:" | cut -d: -f 2 | sed -e 's/\ //g')" -gt 0 ] || can_fail_fips
+[ 0"$($CRYPTSETUP luksDump $LOOPDEV | grep "Memory:" | cut -d: -f 2 | sed -e 's/\ //g')" -gt 0 ] || can_fail_fips
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --pbkdf pbkdf2 -i 500 $LOOPDEV || fail
+[ 0"$($CRYPTSETUP luksDump $LOOPDEV | grep -m1 "Iterations:" | cut -d' ' -f 2 | sed -e 's/\ //g')" -gt 1000 ] || fail
+
+prepare "[37] LUKS Keyslot convert" wipe
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks1 $LOOPDEV $KEY5 --key-slot 5 || fail
+$CRYPTSETUP -q luksConvertKey $LOOPDEV --key-file $KEY5 2>/dev/null && fail
+$CRYPTSETUP -q convert --type luks2 $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "5: luks2" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "PBKDF:" | grep -q "pbkdf2" || fail
+$CRYPTSETUP -q luksConvertKey $LOOPDEV -S 5 --key-file $KEY5 --pbkdf argon2i -i1 --pbkdf-memory 32 || can_fail_fips
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "5: luks2" || can_fail_fips
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV -S 1 --key-file $KEY5 || fail
+$CRYPTSETUP -q luksKillSlot $LOOPDEV 5 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "PBKDF:" | grep -q "pbkdf2" || fail
+echo $PWD1 | $CRYPTSETUP -q luksConvertKey $LOOPDEV -S 1 --pbkdf argon2i -i1 --pbkdf-memory 32 || can_fail_fips
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "1: luks2" || can_fail_fips
+echo $PWD3 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT -S 21 --unbound -s 16 $LOOPDEV || fail
+echo $PWD3 | $CRYPTSETUP luksConvertKey --pbkdf-force-iterations 1001 --pbkdf pbkdf2 -S 21 $LOOPDEV || fail
+
+prepare "[38] luksAddKey unbound tests" wipe
+$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEY5 --key-slot 5 || fail
+# unbound key may have arbitrary size
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --unbound -s 16 $LOOPDEV || fail
+echo $PWD2 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --unbound -s 32 -S 2 $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "2: luks2 (unbound)" || fail
+dd if=/dev/urandom of=$KEY_FILE0 bs=64 count=1 > /dev/null 2>&1 || fail
+echo $PWD3 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --unbound -s 512 -S 3 --master-key-file $KEY_FILE0 $LOOPDEV || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "3: luks2 (unbound)" || fail
+# unbound key size is required
+echo $PWD1 | $CRYPTSETUP -q luksAddKey --unbound $LOOPDEV 2>/dev/null && fail
+echo $PWD3 | $CRYPTSETUP -q luksAddKey --unbound --master-key-file /dev/urandom $LOOPDEV 2> /dev/null && fail
+# do not allow to replace keyslot by unbound slot
+echo $PWD1 | $CRYPTSETUP -q luksAddKey -S5 --unbound -s 32 $LOOPDEV 2>/dev/null && fail
+echo $PWD2 | $CRYPTSETUP -q open $LOOPDEV $DEV_NAME 2> /dev/null && fail
+echo $PWD2 | $CRYPTSETUP -q open $LOOPDEV --test-passphrase || fail
+echo $PWD2 | $CRYPTSETUP -q open -S2 $LOOPDEV $DEV_NAME 2> /dev/null && fail
+echo $PWD2 | $CRYPTSETUP -q open -S2 $LOOPDEV --test-passphrase || fail
+echo $PWD1 | $CRYPTSETUP -q open $LOOPDEV $DEV_NAME 2> /dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q open $LOOPDEV --test-passphrase || fail
+# check we're able to change passphrase for unbound keyslot
+echo -e "$PWD2\n$PWD3" | $CRYPTSETUP luksChangeKey $FAST_PBKDF_OPT -S 2 $LOOPDEV || fail
+echo $PWD3 | $CRYPTSETUP open --test-passphrase $FAST_PBKDF_OPT -S 2 $LOOPDEV || fail
+echo $PWD3 | $CRYPTSETUP -q open -S 2 $LOOPDEV $DEV_NAME 2> /dev/null && fail
+# do not allow adding keyslot by unbound keyslot
+echo -e "$PWD3\n$PWD1" | $CRYPTSETUP -q luksAddKey $LOOPDEV 2> /dev/null && fail
+# check adding keyslot works when there's unbound keyslot
+echo $PWD1 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT $LOOPDEV --key-file $KEY5 -S8 || fail
+echo $PWD1 | $CRYPTSETUP open $LOOPDEV $DEV_NAME || fail
+$CRYPTSETUP close $DEV_NAME || fail
+$CRYPTSETUP luksKillSlot -q $LOOPDEV 2
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "2: luks2 (unbound)" && fail
+echo $PWD3 | $CRYPTSETUP luksDump --unbound --master-key-file $KEY_FILE1 $LOOPDEV 2> /dev/null && fail
+echo $PWD3 | $CRYPTSETUP luksDump --unbound 2> /dev/null $LOOPDEV 2> /dev/null && fail
+echo $PWD3 | $CRYPTSETUP luksDump --unbound --master-key-file $KEY_FILE1 -S3 $LOOPDEV > /dev/null || fail
+diff $KEY_FILE0 $KEY_FILE1 || fail
+echo $PWD3 | $CRYPTSETUP luksDump --unbound --master-key-file $KEY_FILE1 -S3 $LOOPDEV 2> /dev/null && fail
+diff $KEY_FILE0 $KEY_FILE1 || fail
+rm $KEY_FILE1 || fail
+echo $PWD3 | $CRYPTSETUP luksDump --unbound --master-key-file $KEY_FILE1 -S3 $LOOPDEV | grep -q "Unbound Key:" && fail
+echo $PWD3 | $CRYPTSETUP luksDump --unbound -S3 $LOOPDEV | grep -q "Unbound Key:" || fail
+$CRYPTSETUP luksKillSlot -q $LOOPDEV 3 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep -q "3: luks2 (unbound)" && fail
+
+prepare "[39] LUKS2 metadata variants" wipe
+tar xJf luks2_mda_images.tar.xz
+echo -n "$IMPORT_TOKEN" > $TOKEN_FILE0
+for mda in 16 32 64 128 256 512 1024 2048 4096 ; do
+       echo -n "[$mda KiB]"
+       echo $PWD4 | $CRYPTSETUP open test_image_$mda $DEV_NAME || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       echo -e "$PWD4\n$PWD3" | $CRYPTSETUP luksAddKey -S9 $FAST_PBKDF_OPT test_image_$mda || fail
+       echo $PWD4 | $CRYPTSETUP open --test-passphrase test_image_$mda || fail
+       echo $PWD3 | $CRYPTSETUP open -S9 --test-passphrase test_image_$mda || fail
+       echo -n "$IMPORT_TOKEN" | $CRYPTSETUP token import test_image_$mda --token-id 10 || fail
+       $CRYPTSETUP token export test_image_$mda --token-id 10 | diff --from-file - $TOKEN_FILE0 || fail
+       echo -n "[OK]"
+done
+echo
+
+prepare "[40] LUKS2 metadata areas" wipe
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV 2> /dev/null || fail
+DEFAULT_OFFSET=$($CRYPTSETUP luksDump $LOOPDEV | grep "offset: " | cut -f 2 -d ' ')
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks1 $LOOPDEV --key-size 256 --luks2-metadata-size=128k --luks2-keyslots-size=128k 2> /dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --luks2-metadata-size=128k --luks2-keyslots-size=127k 2> /dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --luks2-metadata-size=127k --luks2-keyslots-size=128k 2> /dev/null && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --luks2-metadata-size=128k --luks2-keyslots-size=128M >/dev/null 2>&1 && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --luks2-metadata-size=128k --luks2-keyslots-size=128k >/dev/null || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Metadata area:" | grep -q "131072 \[bytes\]" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Keyslots area:" | grep -q "131072 \[bytes\]" || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --luks2-metadata-size=128k || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Metadata area:" | grep -q "131072 \[bytes\]" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Keyslots area:" | grep -q "$((DEFAULT_OFFSET-2*131072)) \[bytes\]" || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --luks2-keyslots-size=128k >/dev/null || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Metadata area:" | grep -q "16384 \[bytes\]" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Keyslots area:" | grep -q "131072 \[bytes\]" || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --offset 16384 || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Metadata area:" | grep -q "16384 \[bytes\]" || fail
+$CRYPTSETUP luksDump $LOOPDEV | grep "Keyslots area:" | grep -q "8355840 \[bytes\]" || fail
+# data offset vs area size
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --offset 64 --luks2-keyslots-size=8192 >/dev/null 2>&1 && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --offset $((256+56)) >/dev/null 2>&1 && fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV --key-size 256 --offset $((256+64)) >/dev/null || fail
+
+prepare "[41] Per-keyslot encryption parameters" wipe
+KEYSLOT_CIPHER="aes-cbc-plain64"
+$CRYPTSETUP -q luksFormat --type luks2 $LOOPDEV $KEY1 $FAST_PBKDF_OPT --key-slot 0 --keyslot-cipher $KEYSLOT_CIPHER --keyslot-key-size 128 || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep "Cipher:"    | sed -e 's/[[:space:]]\+Cipher:\ \+//g')" = $KEYSLOT_CIPHER ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep "Cipher key:"| sed -e 's/[[:space:]]\+Cipher\ key:\ \+//g')" = "128 bits" ] || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT --key-slot 1 --keyslot-cipher $KEYSLOT_CIPHER --keyslot-key-size 128 || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "1: luks2" | grep "Cipher:"    | sed -e 's/[[:space:]]\+Cipher:\ \+//g')" = $KEYSLOT_CIPHER ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "1: luks2" | grep "Cipher key:"| sed -e 's/[[:space:]]\+Cipher\ key:\ \+//g')" = "128 bits" ] || fail
+$CRYPTSETUP luksAddKey $LOOPDEV -d $KEY1 $KEY2 $FAST_PBKDF_OPT --key-slot 2 || fail
+$CRYPTSETUP luksChangeKey $LOOPDEV $FAST_PBKDF_OPT -d $KEY2 $KEY1 --key-slot 2 --keyslot-cipher $KEYSLOT_CIPHER --keyslot-key-size 128 || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "2: luks2" | grep "Cipher:"    | sed -e 's/[[:space:]]\+Cipher:\ \+//g')" = $KEYSLOT_CIPHER ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "2: luks2" | grep "Cipher key:"| sed -e 's/[[:space:]]\+Cipher\ key:\ \+//g')" = "128 bits" ] || fail
+# unbound keyslot
+echo $PWD3 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --key-slot 21 --unbound -s 32 --keyslot-cipher $KEYSLOT_CIPHER --keyslot-key-size 128 $LOOPDEV || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "21: luks2" | grep "Cipher:"    | sed -e 's/[[:space:]]\+Cipher:\ \+//g')" = $KEYSLOT_CIPHER ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "21: luks2" | grep "Cipher key:"| sed -e 's/[[:space:]]\+Cipher\ key:\ \+//g')" = "128 bits" ] || fail
+echo $PWD3 | $CRYPTSETUP luksAddKey $FAST_PBKDF_OPT --key-slot 22 --unbound -s 32 $LOOPDEV || fail
+echo $PWD3 | $CRYPTSETUP luksConvertKey --key-slot 22 $LOOPDEV --keyslot-cipher $KEYSLOT_CIPHER --keyslot-key-size 128 $LOOPDEV || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "22: luks2" | grep "Cipher:"    | sed -e 's/[[:space:]]\+Cipher:\ \+//g')" = $KEYSLOT_CIPHER ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "22: luks2" | grep "Cipher key:"| sed -e 's/[[:space:]]\+Cipher\ key:\ \+//g')" = "128 bits" ] || fail
+
+remove_mapping
+exit 0
diff --git a/tests/compatimage.img.bz2 b/tests/compatimage.img.bz2
deleted file mode 100644 (file)
index b351cc6..0000000
Binary files a/tests/compatimage.img.bz2 and /dev/null differ
diff --git a/tests/compatimage.img.xz b/tests/compatimage.img.xz
new file mode 100644 (file)
index 0000000..37fe163
Binary files /dev/null and b/tests/compatimage.img.xz differ
diff --git a/tests/compatimage2.img.xz b/tests/compatimage2.img.xz
new file mode 100644 (file)
index 0000000..ceaeafc
Binary files /dev/null and b/tests/compatimage2.img.xz differ
diff --git a/tests/compatv10image.img.bz2 b/tests/compatv10image.img.bz2
deleted file mode 100644 (file)
index be6aeca..0000000
Binary files a/tests/compatv10image.img.bz2 and /dev/null differ
diff --git a/tests/compatv10image.img.xz b/tests/compatv10image.img.xz
new file mode 100644 (file)
index 0000000..2203626
Binary files /dev/null and b/tests/compatv10image.img.xz differ
diff --git a/tests/conversion_imgs.tar.xz b/tests/conversion_imgs.tar.xz
new file mode 100644 (file)
index 0000000..cdeb961
Binary files /dev/null and b/tests/conversion_imgs.tar.xz differ
diff --git a/tests/crypto-vectors.c b/tests/crypto-vectors.c
new file mode 100644 (file)
index 0000000..a8f3797
--- /dev/null
@@ -0,0 +1,1194 @@
+/*
+ * cryptsetup crypto backend test vectors
+ *
+ * Copyright (C) 2018-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include "crypto_backend.h"
+
+#ifndef ARRAY_SIZE
+# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
+static void printhex(const char *s, const char *buf, size_t len)
+{
+       size_t i;
+
+       printf("%s: ", s);
+       for (i = 0; i < len; i++)
+               printf(" %02x", (unsigned char)buf[i]);
+       printf("\n");
+       fflush(stdout);
+}
+
+/*
+ * KDF tests
+ */
+struct kdf_test_vector {
+       const char *type;
+       const char *hash;
+       unsigned int hash_block_length;
+       unsigned int iterations;
+       unsigned int memory;
+       unsigned int parallelism;
+       const char *password;
+       unsigned int password_length;
+       const char *salt;
+       unsigned int salt_length;
+//     const char *key;
+//     unsigned int key_length;
+//     const char *ad;
+//     unsigned int ad_length;
+       const char *output;
+       unsigned int output_length;
+};
+
+static struct kdf_test_vector kdf_test_vectors[] = {
+       /* Argon2 RFC (without key and ad values) */
+       {
+               "argon2i", NULL, 0, 3, 32, 4,
+               "\x01\x01\x01\x01\x01\x01\x01\x01"
+               "\x01\x01\x01\x01\x01\x01\x01\x01"
+               "\x01\x01\x01\x01\x01\x01\x01\x01"
+               "\x01\x01\x01\x01\x01\x01\x01\x01", 32,
+               "\x02\x02\x02\x02\x02\x02\x02\x02"
+               "\x02\x02\x02\x02\x02\x02\x02\x02", 16,
+//             "\x03\x03\x03\x03\x03\x03\x03\x03", 8,
+//             "\x04\x04\x04\x04\x04\x04\x04\x04"
+//             "\x04\x04\x04\x04", 12,
+               "\xa9\xa7\x51\x0e\x6d\xb4\xd5\x88"
+               "\xba\x34\x14\xcd\x0e\x09\x4d\x48"
+               "\x0d\x68\x3f\x97\xb9\xcc\xb6\x12"
+               "\xa5\x44\xfe\x8e\xf6\x5b\xa8\xe0", 32
+//             "\xc8\x14\xd9\xd1\xdc\x7f\x37\xaa"
+//             "\x13\xf0\xd7\x7f\x24\x94\xbd\xa1"
+//             "\xc8\xde\x6b\x01\x6d\xd3\x88\xd2"
+//             "\x99\x52\xa4\xc4\x67\x2b\x6c\xe8", 32
+       },
+       {
+               "argon2id", NULL, 0, 3, 32, 4,
+               "\x01\x01\x01\x01\x01\x01\x01\x01"
+               "\x01\x01\x01\x01\x01\x01\x01\x01"
+               "\x01\x01\x01\x01\x01\x01\x01\x01"
+               "\x01\x01\x01\x01\x01\x01\x01\x01", 32,
+               "\x02\x02\x02\x02\x02\x02\x02\x02"
+               "\x02\x02\x02\x02\x02\x02\x02\x02", 16,
+//             "\x03\x03\x03\x03\x03\x03\x03\x03", 8,
+//             "\x04\x04\x04\x04\x04\x04\x04\x04"
+//             "\x04\x04\x04\x04", 12,
+               "\x03\xaa\xb9\x65\xc1\x20\x01\xc9"
+               "\xd7\xd0\xd2\xde\x33\x19\x2c\x04"
+               "\x94\xb6\x84\xbb\x14\x81\x96\xd7"
+               "\x3c\x1d\xf1\xac\xaf\x6d\x0c\x2e", 32
+//             "\x0d\x64\x0d\xf5\x8d\x78\x76\x6c"
+//             "\x08\xc0\x37\xa3\x4a\x8b\x53\xc9"
+//             "\xd0\x1e\xf0\x45\x2d\x75\xb6\x5e"
+//             "\xb5\x25\x20\xe9\x6b\x01\xe6\x59", 32
+       },
+       /* RFC 3962 */
+       {
+               "pbkdf2", "sha1", 64, 1, 0, 0,
+               "password", 8,
+               "ATHENA.MIT.EDUraeburn", 21,
+               "\xcd\xed\xb5\x28\x1b\xb2\xf8\x01"
+               "\x56\x5a\x11\x22\xb2\x56\x35\x15"
+               "\x0a\xd1\xf7\xa0\x4b\xb9\xf3\xa3"
+               "\x33\xec\xc0\xe2\xe1\xf7\x08\x37", 32
+       }, {
+               "pbkdf2", "sha1", 64, 2, 0, 0,
+               "password", 8,
+               "ATHENA.MIT.EDUraeburn", 21,
+               "\x01\xdb\xee\x7f\x4a\x9e\x24\x3e"
+               "\x98\x8b\x62\xc7\x3c\xda\x93\x5d"
+               "\xa0\x53\x78\xb9\x32\x44\xec\x8f"
+               "\x48\xa9\x9e\x61\xad\x79\x9d\x86", 32
+       }, {
+               "pbkdf2", "sha1", 64, 1200, 0, 0,
+               "password", 8,
+               "ATHENA.MIT.EDUraeburn", 21,
+               "\x5c\x08\xeb\x61\xfd\xf7\x1e\x4e"
+               "\x4e\xc3\xcf\x6b\xa1\xf5\x51\x2b"
+               "\xa7\xe5\x2d\xdb\xc5\xe5\x14\x2f"
+               "\x70\x8a\x31\xe2\xe6\x2b\x1e\x13", 32
+       }, {
+               "pbkdf2", "sha1", 64, 5, 0, 0,
+               "password", 8,
+               "\0224VxxV4\022", 8, // "\x1234567878563412
+               "\xd1\xda\xa7\x86\x15\xf2\x87\xe6"
+               "\xa1\xc8\xb1\x20\xd7\x06\x2a\x49"
+               "\x3f\x98\xd2\x03\xe6\xbe\x49\xa6"
+               "\xad\xf4\xfa\x57\x4b\x6e\x64\xee", 32
+       }, {
+               "pbkdf2", "sha1", 64, 1200, 0, 0,
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 64,
+               "pass phrase equals block size", 29,
+               "\x13\x9c\x30\xc0\x96\x6b\xc3\x2b"
+               "\xa5\x5f\xdb\xf2\x12\x53\x0a\xc9"
+               "\xc5\xec\x59\xf1\xa4\x52\xf5\xcc"
+               "\x9a\xd9\x40\xfe\xa0\x59\x8e\xd1", 32
+       }, {
+               "pbkdf2", "sha1", 64, 1200, 0, 0,
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 65,
+               "pass phrase exceeds block size", 30,
+               "\x9c\xca\xd6\xd4\x68\x77\x0c\xd5"
+               "\x1b\x10\xe6\xa6\x87\x21\xbe\x61"
+               "\x1a\x8b\x4d\x28\x26\x01\xdb\x3b"
+               "\x36\xbe\x92\x46\x91\x5e\xc8\x2a", 32
+       }, {
+               "pbkdf2", "sha1", 64, 50, 0, 0,
+               "\360\235\204\236", 4, // g-clef ("\xf09d849e)
+               "EXAMPLE.COMpianist", 18,
+               "\x6b\x9c\xf2\x6d\x45\x45\x5a\x43"
+               "\xa5\xb8\xbb\x27\x6a\x40\x3b\x39"
+               "\xe7\xfe\x37\xa0\xc4\x1e\x02\xc2"
+               "\x81\xff\x30\x69\xe1\xe9\x4f\x52", 32
+       }, {
+       /* RFC-6070 */
+               "pbkdf2", "sha1", 64, 1, 0, 0,
+               "password", 8,
+               "salt", 4,
+               "\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9"
+               "\xb5\x24\xaf\x60\x12\x06\x2f\xe0\x37\xa6", 20
+       }, {
+               "pbkdf2", "sha1", 64, 2, 0, 0,
+               "password", 8,
+               "salt", 4,
+               "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e"
+               "\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57", 20
+       }, {
+               "pbkdf2", "sha1", 64, 4096, 0, 0,
+               "password", 8,
+               "salt", 4,
+               "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad"
+               "\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1", 20
+       }, {
+               "pbkdf2", "sha1", 64, 16777216, 0, 0,
+               "password", 8,
+               "salt", 4,
+               "\xee\xfe\x3d\x61\xcd\x4d\xa4\xe4\xe9\x94"
+               "\x5b\x3d\x6b\xa2\x15\x8c\x26\x34\xe9\x84", 20
+       }, {
+               "pbkdf2", "sha1", 64, 4096, 0, 0,
+               "passwordPASSWORDpassword", 24,
+               "saltSALTsaltSALTsaltSALTsaltSALTsalt", 36,
+               "\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8"
+               "\xd8\x36\x62\xc0\xe4\x4a\x8b\x29\x1a\x96"
+               "\x4c\xf2\xf0\x70\x38", 25
+       }, {
+               "pbkdf2", "sha1", 64, 4096, 0, 0,
+               "pass\0word", 9,
+               "sa\0lt", 5,
+               "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37"
+               "\xd7\xf0\x34\x25\xe0\xc3", 16
+       }, {
+       /* empty password test */
+               "pbkdf2", "sha1", 64, 2, 0, 0,
+               "", 0,
+               "salt", 4,
+               "\x13\x3a\x4c\xe8\x37\xb4\xd2\x52\x1e\xe2"
+               "\xbf\x03\xe1\x1c\x71\xca\x79\x4e\x07\x97", 20
+       }, {
+       /* Password exceeds block size test */
+               "pbkdf2", "sha256", 64, 1200, 0, 0,
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 65,
+               "pass phrase exceeds block size", 30,
+               "\x22\x34\x4b\xc4\xb6\xe3\x26\x75"
+               "\xa8\x09\x0f\x3e\xa8\x0b\xe0\x1d"
+               "\x5f\x95\x12\x6a\x2c\xdd\xc3\xfa"
+               "\xcc\x4a\x5e\x6d\xca\x04\xec\x58", 32
+       }, {
+               "pbkdf2", "sha512", 128, 1200, 0, 0,
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 129,
+               "pass phrase exceeds block size", 30,
+               "\x0f\xb2\xed\x2c\x0e\x6e\xfb\x7d"
+               "\x7d\x8e\xdd\x58\x01\xb4\x59\x72"
+               "\x99\x92\x16\x30\x5e\xa4\x36\x8d"
+               "\x76\x14\x80\xf3\xe3\x7a\x22\xb9", 32
+       }, {
+               "pbkdf2", "whirlpool", 64, 1200, 0, 0,
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+               "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 65,
+               "pass phrase exceeds block size", 30,
+               "\x9c\x1c\x74\xf5\x88\x26\xe7\x6a"
+               "\x53\x58\xf4\x0c\x39\xe7\x80\x89"
+               "\x07\xc0\x31\x19\x9a\x50\xa2\x48"
+               "\xf1\xd9\xfe\x78\x64\xe5\x84\x50", 32
+       }
+};
+
+/*
+ * Hash tests
+ */
+struct hash_test_vector {
+       const char *data;
+       unsigned int data_length;
+       struct {
+               const char *name;
+               unsigned int length;
+               const char *out;
+       } out[6];
+};
+
+static struct hash_test_vector hash_test_vectors[] = {
+{
+       "", 0, {
+       { "crc32",      4, "\x00\x00\x00\x00" },
+       { "sha1",      20, "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09" },
+       { "sha256",    32, "\xe3\xb0\xc4\x42\x98\xfc\x1c\x14\x9a\xfb\xf4\xc8\x99\x6f\xb9\x24"
+                          "\x27\xae\x41\xe4\x64\x9b\x93\x4c\xa4\x95\x99\x1b\x78\x52\xb8\x55" },
+       { "sha512",    64, "\xcf\x83\xe1\x35\x7e\xef\xb8\xbd\xf1\x54\x28\x50\xd6\x6d\x80\x07"
+                          "\xd6\x20\xe4\x05\x0b\x57\x15\xdc\x83\xf4\xa9\x21\xd3\x6c\xe9\xce"
+                          "\x47\xd0\xd1\x3c\x5d\x85\xf2\xb0\xff\x83\x18\xd2\x87\x7e\xec\x2f"
+                          "\x63\xb9\x31\xbd\x47\x41\x7a\x81\xa5\x38\x32\x7a\xf9\x27\xda\x3e" },
+       { "ripemd160", 20, "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31" },
+       { "whirlpool", 64, "\x19\xfa\x61\xd7\x55\x22\xa4\x66\x9b\x44\xe3\x9c\x1d\x2e\x17\x26"
+                          "\xc5\x30\x23\x21\x30\xd4\x07\xf8\x9a\xfe\xe0\x96\x49\x97\xf7\xa7"
+                          "\x3e\x83\xbe\x69\x8b\x28\x8f\xeb\xcf\x88\xe3\xe0\x3c\x4f\x07\x57"
+                          "\xea\x89\x64\xe5\x9b\x63\xd9\x37\x08\xb1\x38\xcc\x42\xa6\x6e\xb3" },
+}},{
+       "a", 1, {
+       { "crc32",      4, "\xe8\xb7\xbe\x43" },
+       { "sha1",      20, "\x86\xf7\xe4\x37\xfa\xa5\xa7\xfc\xe1\x5d\x1d\xdc\xb9\xea\xea\xea\x37\x76\x67\xb8" },
+       { "sha256",    32, "\xca\x97\x81\x12\xca\x1b\xbd\xca\xfa\xc2\x31\xb3\x9a\x23\xdc\x4d"
+                          "\xa7\x86\xef\xf8\x14\x7c\x4e\x72\xb9\x80\x77\x85\xaf\xee\x48\xbb" },
+       { "sha512",    64, "\x1f\x40\xfc\x92\xda\x24\x16\x94\x75\x09\x79\xee\x6c\xf5\x82\xf2"
+                          "\xd5\xd7\xd2\x8e\x18\x33\x5d\xe0\x5a\xbc\x54\xd0\x56\x0e\x0f\x53"
+                          "\x02\x86\x0c\x65\x2b\xf0\x8d\x56\x02\x52\xaa\x5e\x74\x21\x05\x46"
+                          "\xf3\x69\xfb\xbb\xce\x8c\x12\xcf\xc7\x95\x7b\x26\x52\xfe\x9a\x75" },
+       { "ripemd160", 20, "\x0b\xdc\x9d\x2d\x25\x6b\x3e\xe9\xda\xae\x34\x7b\xe6\xf4\xdc\x83\x5a\x46\x7f\xfe" },
+       { "whirlpool", 64, "\x8a\xca\x26\x02\x79\x2a\xec\x6f\x11\xa6\x72\x06\x53\x1f\xb7\xd7"
+                          "\xf0\xdf\xf5\x94\x13\x14\x5e\x69\x73\xc4\x50\x01\xd0\x08\x7b\x42"
+                          "\xd1\x1b\xc6\x45\x41\x3a\xef\xf6\x3a\x42\x39\x1a\x39\x14\x5a\x59"
+                          "\x1a\x92\x20\x0d\x56\x01\x95\xe5\x3b\x47\x85\x84\xfd\xae\x23\x1a" },
+}},{
+       "abc", 3, {
+       { "crc32",      4, "\x35\x24\x41\xc2" },
+       { "sha1",      20, "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d" },
+       { "sha256",    32, "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23"
+                          "\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad" },
+       { "sha512",    64, "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41\x31"
+                          "\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a"
+                          "\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3\xfe\xeb\xbd"
+                          "\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f" },
+       { "ripemd160", 20, "\x8e\xb2\x08\xf7\xe0\x5d\x98\x7a\x9b\x04\x4a\x8e\x98\xc6\xb0\x87\xf1\x5a\x0b\xfc" },
+       { "whirlpool", 64, "\x4e\x24\x48\xa4\xc6\xf4\x86\xbb\x16\xb6\x56\x2c\x73\xb4\x02\x0b"
+                          "\xf3\x04\x3e\x3a\x73\x1b\xce\x72\x1a\xe1\xb3\x03\xd9\x7e\x6d\x4c"
+                          "\x71\x81\xee\xbd\xb6\xc5\x7e\x27\x7d\x0e\x34\x95\x71\x14\xcb\xd6"
+                          "\xc7\x97\xfc\x9d\x95\xd8\xb5\x82\xd2\x25\x29\x20\x76\xd4\xee\xf5" },
+}},{
+       "abcdefghijklmnopqrstuvwxyz", 26, {
+       { "crc32",      4, "\x4c\x27\x50\xbd" },
+       { "sha1",      20, "\x32\xd1\x0c\x7b\x8c\xf9\x65\x70\xca\x04\xce\x37\xf2\xa1\x9d\x84\x24\x0d\x3a\x89" },
+       { "sha256",    32, "\x71\xc4\x80\xdf\x93\xd6\xae\x2f\x1e\xfa\xd1\x44\x7c\x66\xc9\x52"
+                          "\x5e\x31\x62\x18\xcf\x51\xfc\x8d\x9e\xd8\x32\xf2\xda\xf1\x8b\x73" },
+       { "sha512",    64, "\x4d\xbf\xf8\x6c\xc2\xca\x1b\xae\x1e\x16\x46\x8a\x05\xcb\x98\x81"
+                          "\xc9\x7f\x17\x53\xbc\xe3\x61\x90\x34\x89\x8f\xaa\x1a\xab\xe4\x29"
+                          "\x95\x5a\x1b\xf8\xec\x48\x3d\x74\x21\xfe\x3c\x16\x46\x61\x3a\x59"
+                          "\xed\x54\x41\xfb\x0f\x32\x13\x89\xf7\x7f\x48\xa8\x79\xc7\xb1\xf1" },
+       { "ripemd160", 20, "\xf7\x1c\x27\x10\x9c\x69\x2c\x1b\x56\xbb\xdc\xeb\x5b\x9d\x28\x65\xb3\x70\x8d\xbc" },
+       { "whirlpool", 64, "\xf1\xd7\x54\x66\x26\x36\xff\xe9\x2c\x82\xeb\xb9\x21\x2a\x48\x4a"
+                          "\x8d\x38\x63\x1e\xad\x42\x38\xf5\x44\x2e\xe1\x3b\x80\x54\xe4\x1b"
+                          "\x08\xbf\x2a\x92\x51\xc3\x0b\x6a\x0b\x8a\xae\x86\x17\x7a\xb4\xa6"
+                          "\xf6\x8f\x67\x3e\x72\x07\x86\x5d\x5d\x98\x19\xa3\xdb\xa4\xeb\x3b" },
+}},{
+       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 62, {
+       { "crc32",      4, "\x1f\xc2\xe6\xd2" },
+       { "sha1",      20, "\x76\x1c\x45\x7b\xf7\x3b\x14\xd2\x7e\x9e\x92\x65\xc4\x6f\x4b\x4d\xda\x11\xf9\x40" },
+       { "sha256",    32, "\xdb\x4b\xfc\xbd\x4d\xa0\xcd\x85\xa6\x0c\x3c\x37\xd3\xfb\xd8\x80"
+                          "\x5c\x77\xf1\x5f\xc6\xb1\xfd\xfe\x61\x4e\xe0\xa7\xc8\xfd\xb4\xc0" },
+       { "sha512",    64, "\x1e\x07\xbe\x23\xc2\x6a\x86\xea\x37\xea\x81\x0c\x8e\xc7\x80\x93"
+                          "\x52\x51\x5a\x97\x0e\x92\x53\xc2\x6f\x53\x6c\xfc\x7a\x99\x96\xc4"
+                          "\x5c\x83\x70\x58\x3e\x0a\x78\xfa\x4a\x90\x04\x1d\x71\xa4\xce\xab"
+                          "\x74\x23\xf1\x9c\x71\xb9\xd5\xa3\xe0\x12\x49\xf0\xbe\xbd\x58\x94" },
+       { "ripemd160", 20, "\xb0\xe2\x0b\x6e\x31\x16\x64\x02\x86\xed\x3a\x87\xa5\x71\x30\x79\xb2\x1f\x51\x89" },
+       { "whirlpool", 64, "\xdc\x37\xe0\x08\xcf\x9e\xe6\x9b\xf1\x1f\x00\xed\x9a\xba\x26\x90"
+                          "\x1d\xd7\xc2\x8c\xde\xc0\x66\xcc\x6a\xf4\x2e\x40\xf8\x2f\x3a\x1e"
+                          "\x08\xeb\xa2\x66\x29\x12\x9d\x8f\xb7\xcb\x57\x21\x1b\x92\x81\xa6"
+                          "\x55\x17\xcc\x87\x9d\x7b\x96\x21\x42\xc6\x5f\x5a\x7a\xf0\x14\x67" },
+}},{
+       "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56, {
+       { "crc32",      4, "\x17\x1a\x3f\x5f" },
+       { "sha1",      20, "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1" },
+       { "sha256",    32, "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39"
+                          "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" },
+       { "sha512",    64, "\x20\x4a\x8f\xc6\xdd\xa8\x2f\x0a\x0c\xed\x7b\xeb\x8e\x08\xa4\x16"
+                          "\x57\xc1\x6e\xf4\x68\xb2\x28\xa8\x27\x9b\xe3\x31\xa7\x03\xc3\x35"
+                          "\x96\xfd\x15\xc1\x3b\x1b\x07\xf9\xaa\x1d\x3b\xea\x57\x78\x9c\xa0"
+                          "\x31\xad\x85\xc7\xa7\x1d\xd7\x03\x54\xec\x63\x12\x38\xca\x34\x45" },
+       { "ripemd160", 20, "\x12\xa0\x53\x38\x4a\x9c\x0c\x88\xe4\x05\xa0\x6c\x27\xdc\xf4\x9a\xda\x62\xeb\x2b" },
+       { "whirlpool", 64, "\x52\x6b\x23\x94\xd8\x56\x83\xe2\x4b\x29\xac\xd0\xfd\x37\xf7\xd5"
+                          "\x02\x7f\x61\x36\x6a\x14\x07\x26\x2d\xc2\xa6\xa3\x45\xd9\xe2\x40"
+                          "\xc0\x17\xc1\x83\x3d\xb1\xe6\xdb\x6a\x46\xbd\x44\x4b\x0c\x69\x52"
+                          "\x0c\x85\x6e\x7c\x6e\x9c\x36\x6d\x15\x0a\x7d\xa3\xae\xb1\x60\xd1" },
+}},{
+       "message digest", 14, {
+       { "crc32",      4, "\x20\x15\x9d\x7f" },
+       { "sha1",      20, "\xc1\x22\x52\xce\xda\x8b\xe8\x99\x4d\x5f\xa0\x29\x0a\x47\x23\x1c\x1d\x16\xaa\xe3" },
+       { "sha256",    32, "\xf7\x84\x6f\x55\xcf\x23\xe1\x4e\xeb\xea\xb5\xb4\xe1\x55\x0c\xad"
+                          "\x5b\x50\x9e\x33\x48\xfb\xc4\xef\xa3\xa1\x41\x3d\x39\x3c\xb6\x50" },
+       { "sha512",    64, "\x10\x7d\xbf\x38\x9d\x9e\x9f\x71\xa3\xa9\x5f\x6c\x05\x5b\x92\x51"
+                          "\xbc\x52\x68\xc2\xbe\x16\xd6\xc1\x34\x92\xea\x45\xb0\x19\x9f\x33"
+                          "\x09\xe1\x64\x55\xab\x1e\x96\x11\x8e\x8a\x90\x5d\x55\x97\xb7\x20"
+                          "\x38\xdd\xb3\x72\xa8\x98\x26\x04\x6d\xe6\x66\x87\xbb\x42\x0e\x7c" },
+       { "ripemd160", 20, "\x5d\x06\x89\xef\x49\xd2\xfa\xe5\x72\xb8\x81\xb1\x23\xa8\x5f\xfa\x21\x59\x5f\x36" },
+       { "whirlpool", 64, "\x37\x8c\x84\xa4\x12\x6e\x2d\xc6\xe5\x6d\xcc\x74\x58\x37\x7a\xac"
+                          "\x83\x8d\x00\x03\x22\x30\xf5\x3c\xe1\xf5\x70\x0c\x0f\xfb\x4d\x3b"
+                          "\x84\x21\x55\x76\x59\xef\x55\xc1\x06\xb4\xb5\x2a\xc5\xa4\xaa\xa6"
+                          "\x92\xed\x92\x00\x52\x83\x8f\x33\x62\xe8\x6d\xbd\x37\xa8\x90\x3e" },
+}}};
+
+/*
+ * HMAC tests
+ */
+// RFC 4231 - HMAC test vectors for SHA-256, SHA-512
+// RFC 2202 - HMAC test vectors for SHA-1
+
+struct hmac_test_vector {
+       const char *key;
+       unsigned int key_length;
+       const char *data;
+       unsigned int data_length;
+       struct {
+               const char *name;
+               unsigned int length;
+               const char *out;
+       } out[3];
+};
+
+static struct hmac_test_vector hmac_test_vectors[] = {
+{
+       "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", 20,
+       "\x48\x69\x20\x54\x68\x65\x72\x65", 8, /* "Hi There" */ {
+       { "sha1",   20, "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00" },
+       { "sha256", 32, "\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf\x0b\xf1\x2b"
+                       "\x88\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9\x37\x6c\x2e\x32\xcf\xf7" },
+       { "sha512", 64, "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c\xb0"
+                       "\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1\x7c\xde"
+                       "\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae\xa3\xf4\xe4"
+                       "\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20\x3a\x12\x68\x54" },
+}},{
+       "\x4a\x65\x66\x65", 4, /* "Jefe" */
+       "\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61\x20\x77\x61\x6e\x74\x20"
+       "\x66\x6f\x72\x20\x6e\x6f\x74\x68\x69\x6e\x67\x3f", 28, /* "what do ya want for nothing?" */ {
+       { "sha1",   20, "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79" },
+       { "sha256", 32, "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08\x95\x75\xc7"
+                       "\x5a\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec\x58\xb9\x64\xec\x38\x43" },
+       { "sha512", 64, "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0\xa3"
+                       "\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25\x05\x54"
+                       "\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd"
+                       "\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a\x38\xbc\xe7\x37" },
+}},{
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 20,
+       "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
+       "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
+       "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", 50, {
+       { "sha1",   20, "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3" },
+       { "sha256", 32, "\x77\x3e\xa9\x1e\x36\x80\x0e\x46\x85\x4d\xb8\xeb\xd0\x91\x81\xa7"
+                       "\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63\x55\x14\xce\xd5\x65\xfe" },
+       { "sha512", 64, "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b\xe9"
+                       "\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27\x9d\x39"
+                       "\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e\x67\xc8\x07"
+                       "\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59\xe1\x32\x92\xfb" },
+}},{
+       "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", 25,
+       "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
+       "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
+       "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", 50, {
+       { "sha1",   20, "\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda" },
+       { "sha256", 32, "\x82\x55\x8a\x38\x9a\x44\x3c\x0e\xa4\xcc\x81\x98\x99\xf2\x08\x3a"
+                       "\x85\xf0\xfa\xa3\xe5\x78\xf8\x07\x7a\x2e\x3f\xf4\x67\x29\x66\x5b" },
+       { "sha512", 64, "\xb0\xba\x46\x56\x37\x45\x8c\x69\x90\xe5\xa8\xc5\xf6\x1d\x4a\xf7"
+                       "\xe5\x76\xd9\x7f\xf9\x4b\x87\x2d\xe7\x6f\x80\x50\x36\x1e\xe3\xdb"
+                       "\xa9\x1c\xa5\xc1\x1a\xa2\x5e\xb4\xd6\x79\x27\x5c\xc5\x78\x80\x63"
+                       "\xa5\xf1\x97\x41\x12\x0c\x4f\x2d\xe2\xad\xeb\xeb\x10\xa2\x98\xdd" },
+}},{
+       // Long key
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 131,
+       "\x54\x65\x73\x74\x20\x55\x73\x69\x6e\x67\x20\x4c\x61\x72\x67\x65"
+       "\x72\x20\x54\x68\x61\x6e\x20\x42\x6c\x6f\x63\x6b\x2d\x53\x69\x7a"
+       "\x65\x20\x4b\x65\x79\x20\x2d\x20\x48\x61\x73\x68\x20\x4b\x65\x79"
+       "\x20\x46\x69\x72\x73\x74", 54, /* "Test Using Larger Than Block-Size Key - Hash Key First" */ {
+       { "sha1",   20, "\x90\xd0\xda\xce\x1c\x1b\xdc\x95\x73\x39\x30\x78\x03\x16\x03\x35\xbd\xe6\xdf\x2b" },
+       { "sha256", 32, "\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb\xf5\xb7\x7f"
+                       "\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46\x04\x0f\x0e\xe3\x7f\x54" },
+       { "sha512", 64, "\x80\xb2\x42\x63\xc7\xc1\xa3\xeb\xb7\x14\x93\xc1\xdd\x7b\xe8\xb4"
+                       "\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1\x12\x1b\x01\x37\x83\xf8\xf3\x52"
+                       "\x6b\x56\xd0\x37\xe0\x5f\x25\x98\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52"
+                       "\x95\xe6\x4f\x73\xf6\x3f\x0a\xec\x8b\x91\x5a\x98\x5d\x78\x65\x98" },
+}},{
+       // Long key and long data
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+       "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", 131,
+       "\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x20\x75"
+       "\x73\x69\x6e\x67\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68"
+       "\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65\x20\x6b\x65"
+       "\x79\x20\x61\x6e\x64\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74"
+       "\x68\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65\x20\x64"
+       "\x61\x74\x61\x2e\x20\x54\x68\x65\x20\x6b\x65\x79\x20\x6e\x65\x65"
+       "\x64\x73\x20\x74\x6f\x20\x62\x65\x20\x68\x61\x73\x68\x65\x64\x20"
+       "\x62\x65\x66\x6f\x72\x65\x20\x62\x65\x69\x6e\x67\x20\x75\x73\x65"
+       "\x64\x20\x62\x79\x20\x74\x68\x65\x20\x48\x4d\x41\x43\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d\x2e", 152, {
+       { "sha1",   20, "\x21\x7e\x44\xbb\x08\xb6\xe0\x6a\x2d\x6c\x30\xf3\xcb\x9f\x53\x7f\x97\xc6\x33\x56" },
+       { "sha256", 32, "\x9b\x09\xff\xa7\x1b\x94\x2f\xcb\x27\x63\x5f\xbc\xd5\xb0\xe9\x44"
+                       "\xbf\xdc\x63\x64\x4f\x07\x13\x93\x8a\x7f\x51\x53\x5c\x3a\x35\xe2" },
+       { "sha512", 64, "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd"
+                       "\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44"
+                       "\xb6\x02\x2c\xac\x3c\x49\x82\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15"
+                       "\x13\x46\x76\xfb\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58" },
+}}};
+
+/*
+ * Block cipher tests
+ */
+struct cipher_test_vector {
+       const char *key;
+       unsigned int key_length;
+       const char *iv;
+       unsigned int iv_length;
+       const char *plaintext;
+       unsigned int data_length;
+       struct {
+               const char *name;
+               const char *mode;
+               const char *ciphertext;
+       } out[2];
+};
+
+static struct cipher_test_vector cipher_test_vectors[] = {
+{ // NIST SP 800-38A
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       NULL, 0,
+       "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+       "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+       "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+       "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10", 64, {
+       {
+               "aes", "ecb",
+               "\x3a\xd7\x7b\xb4\x0d\x7a\x36\x60\xa8\x9e\xca\xf3\x24\x66\xef\x97"
+               "\xf5\xd3\xd5\x85\x03\xb9\x69\x9d\xe7\x85\x89\x5a\x96\xfd\xba\xaf"
+               "\x43\xb1\xcd\x7f\x59\x8e\xce\x23\x88\x1b\x00\xe3\xed\x03\x06\x88"
+               "\x7b\x0c\x78\x5e\x27\xe8\xad\x3f\x82\x23\x20\x71\x04\x72\x5d\xd4"
+       },{
+               "serpent", "ecb",
+               "\xf7\xa7\x21\xe6\xc7\x56\xb6\x55\xcb\xdf\x53\x3f\xc3\xb3\x1a\xc4"
+               "\x4b\xc6\x04\x29\x3a\x81\xa6\xa6\xe4\xcb\xa7\x8d\x1a\x32\xa2\x9e"
+               "\xcf\xc2\x8e\x50\x97\xdd\x6b\x49\xa9\x38\xb1\x51\x5e\xbc\x5a\xac"
+               "\xfe\xd2\xc4\x95\x92\xf9\x1c\x0c\x9f\x17\xcd\x86\x38\x65\x29\xeb"
+       },
+}},{ // NIST SP 800-38A
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16,
+       "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+       "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+       "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+       "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10", 64, {
+       {
+               "aes", "cbc",
+               "\x76\x49\xab\xac\x81\x19\xb2\x46\xce\xe9\x8e\x9b\x12\xe9\x19\x7d"
+               "\x50\x86\xcb\x9b\x50\x72\x19\xee\x95\xdb\x11\x3a\x91\x76\x78\xb2"
+               "\x73\xbe\xd6\xb8\xe3\xc1\x74\x3b\x71\x16\xe6\x9e\x22\x22\x95\x16"
+               "\x3f\xf1\xca\xa1\x68\x1f\xac\x09\x12\x0e\xca\x30\x75\x86\xe1\xa7"
+       },{
+               "serpent", "cbc",
+               "\xdd\x73\x69\x1a\xb5\x66\xb6\x38\xe3\xb9\x62\x36\xc8\xc8\xa1\xdd"
+               "\xa9\xb5\xd9\xdb\x20\xfb\x8b\x82\x51\x40\xbf\xe6\x4d\xf2\x1c\xa8"
+               "\x5f\x48\xbc\x29\xff\x62\x27\xda\x09\x7c\xaa\x22\x75\x6f\x43\xff"
+               "\x31\xd8\x3e\x83\x4d\x92\x48\xeb\x49\x1c\xf8\x26\x80\x4e\xb9\x02"
+       },
+}},{ // NIST SP 800-38A
+       "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
+       "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4", 32,
+       NULL, 0,
+       "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+       "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+       "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+       "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10", 64, {
+       {
+               "aes", "ecb",
+               "\xf3\xee\xd1\xbd\xb5\xd2\xa0\x3c\x06\x4b\x5a\x7e\x3d\xb1\x81\xf8"
+               "\x59\x1c\xcb\x10\xd4\x10\xed\x26\xdc\x5b\xa7\x4a\x31\x36\x28\x70"
+               "\xb6\xed\x21\xb9\x9c\xa6\xf4\xf9\xf1\x53\xe7\xb1\xbe\xaf\xed\x1d"
+               "\x23\x30\x4b\x7a\x39\xf9\xf3\xff\x06\x7d\x8d\x8f\x9e\x24\xec\xc7"
+       },{
+               "serpent", "ecb",
+               "\x78\xe5\x84\x8e\xd9\xd5\xde\x2d\x4d\xb0\x2f\x53\x61\x6a\xfd\xf2"
+               "\x50\x5d\xf1\x68\x92\x40\x8e\xf6\x9c\x3b\x9e\xa6\x67\xd9\xdd\xb8"
+               "\xb9\x5f\xc8\x20\x76\x52\x1d\xce\x60\xe4\xfc\xac\xe3\xd3\x91\x51"
+               "\x09\x22\x62\xde\x62\x6d\xc5\x7b\x4c\x87\x0c\x65\xe7\x1f\xc7\x13"
+       },
+}},{ // NIST SP 800-38A
+       "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
+       "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4", 32,
+       "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16,
+       "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+       "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+       "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+       "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10", 64, {
+       {
+               "aes", "cbc",
+               "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6"
+               "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d\x67\x9f\x77\x7b\xc6\x70\x2c\x7d"
+               "\x39\xf2\x33\x69\xa9\xd9\xba\xcf\xa5\x30\xe2\x63\x04\x23\x14\x61"
+               "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc\xda\x6c\x19\x07\x8c\x6a\x9d\x1b"
+       },{
+               "serpent", "cbc",
+               "\xb8\x93\xc8\xde\xc5\xc8\x5f\x03\x01\xac\x32\x74\xdf\xc6\x71\x9d"
+               "\x37\x61\xc5\xf8\x34\x4d\xe9\x10\x91\xd3\x87\x80\x42\xcc\x70\x95"
+               "\x40\x95\xa3\x2c\xdb\x38\xe2\x6f\x03\x91\xf5\xd3\x51\x7e\x52\xb0"
+               "\x8a\x1c\x2d\x7f\x04\x59\x13\x93\x31\xa9\x82\xc9\x4e\xd9\x11\x0c"
+       },
+}},{ // CAVS XTSGenAES128,101
+       "\xb7\xb9\x3f\x51\x6a\xef\x29\x5e\xff\x3a\x29\xd8\x37\xcf\x1f\x13"
+       "\x53\x47\xe8\xa2\x1d\xae\x61\x6f\xf5\x06\x2b\x2e\x8d\x78\xce\x5e", 32,
+       "\x87\x3e\xde\xa6\x53\xb6\x43\xbd\x8b\xcf\x51\x40\x31\x97\xed\x14", 16,
+       "\x23\x6f\x8a\x5b\x58\xdd\x55\xf6\x19\x4e\xd7\x0c\x4a\xc1\xa1\x7f"
+       "\x1f\xe6\x0e\xc9\xa6\xc4\x54\xd0\x87\xcc\xb7\x7d\x6b\x63\x8c\x47", 32, {
+       {
+               "aes", "xts",
+               "\x22\xe6\xa3\xc6\x37\x9d\xcf\x75\x99\xb0\x52\xb5\xa7\x49\xc7\xf7"
+               "\x8a\xd8\xa1\x1b\x9f\x1a\xa9\x43\x0c\xf3\xae\xf4\x45\x68\x2e\x19"
+       },{
+               "serpent", "xts",
+               "\x6d\xa2\xa4\x2b\x18\x71\x57\xdc\x03\xaf\x8b\x82\x28\x66\x3d\xf1"
+               "\x70\x8b\x75\x98\xd2\xdd\xbf\x72\x9e\xb3\xb4\xc2\x3f\x18\xdf\xa1"
+       },
+}},{ // CAVS XTSGenAES256,101
+       "\x26\x6c\x33\x6b\x3b\x01\x48\x9f\x32\x67\xf5\x28\x35\xfd\x92\xf6"
+       "\x74\x37\x4b\x88\xb4\xe1\xeb\xd2\xd3\x6a\x5f\x45\x75\x81\xd9\xd0"
+       "\x42\xc3\xee\xf7\xb0\xb7\xe5\x13\x7b\x08\x64\x96\xb4\xd9\xe6\xac"
+       "\x65\x8d\x71\x96\xa2\x3f\x23\xf0\x36\x17\x2f\xdb\x8f\xae\xe5\x27", 64,
+       "\x06\xb2\x09\xa7\xa2\x2f\x48\x6e\xcb\xfa\xdb\x0f\x31\x37\xba\x42", 16,
+       "\xca\x7d\x65\xef\x8d\x3d\xfa\xd3\x45\xb6\x1c\xcd\xdc\xa1\xad\x81"
+       "\xde\x83\x0b\x9e\x86\xc7\xb4\x26\xd7\x6c\xb7\xdb\x76\x68\x52\xd9"
+       "\x81\xc6\xb2\x14\x09\x39\x9d\x78\xf4\x2c\xc0\xb3\x3a\x7b\xbb\x06", 48, {
+       {
+               "aes", "xts",
+               "\xc7\x32\x56\x87\x0c\xc2\xf4\xdd\x57\xac\xc7\x4b\x54\x56\xdb\xd7"
+               "\x76\x91\x2a\x12\x8b\xc1\xf7\x7d\x72\xcd\xeb\xbf\x27\x00\x44\xb7"
+               "\xa4\x3c\xee\xd2\x90\x25\xe1\xe8\xbe\x21\x1f\xa3\xc3\xed\x00\x2d"
+       },{
+               "serpent", "xts",
+               "\x37\xe4\xc0\xa9\xf1\x49\xe5\x3e\x73\xb9\x1f\xec\xdc\xe0\xbd\xc5"
+               "\x31\xd7\xef\x08\x65\x20\xe3\xad\xd9\x84\x60\xdc\x61\x6f\x26\x86"
+               "\xb8\xd5\x29\x4b\x04\x41\x52\x59\x05\x00\xb0\xc2\x9b\x30\xda\x48"
+       },
+}},{
+       "\xa5\x28\x24\x34\x1a\x3c\xd8\xf7\x05\x91\x8f\xee\x85\x1f\x35\x7f"
+       "\x80\x3d\xfc\x9b\x94\xf6\xfc\x9e\x19\x09\x00\xa9\x04\x31\x4f\x11", 32,
+       "\xa1\xba\x49\x95\xff\x34\x6d\xb8\xcd\x87\x5d\x5e\xfd\xea\x85\xdb"
+       "\x8a\x7b\x5e\xb2\x5d\x57\xdd\x62\xac\xa9\x8c\x41\x42\x94\x75\xb7", 32,
+       "\x69\xb4\xe8\x8c\x37\xe8\x67\x82\xf1\xec\x5d\x04\xe5\x14\x91\x13"
+       "\xdf\xf2\x87\x1b\x69\x81\x1d\x71\x70\x9e\x9c\x3b\xde\x49\x70\x11"
+       "\xa0\xa3\xdb\x0d\x54\x4f\x66\x69\xd7\xdb\x80\xa7\x70\x92\x68\xce"
+       "\x81\x04\x2c\xc6\xab\xae\xe5\x60\x15\xe9\x6f\xef\xaa\x8f\xa7\xa7"
+       "\x63\x8f\xf2\xf0\x77\xf1\xa8\xea\xe1\xb7\x1f\x9e\xab\x9e\x4b\x3f"
+       "\x07\x87\x5b\x6f\xcd\xa8\xaf\xb9\xfa\x70\x0b\x52\xb8\xa8\xa7\x9e"
+       "\x07\x5f\xa6\x0e\xb3\x9b\x79\x13\x79\xc3\x3e\x8d\x1c\x2c\x68\xc8"
+       "\x51\x1d\x3c\x7b\x7d\x79\x77\x2a\x56\x65\xc5\x54\x23\x28\xb0\x03", 128, {
+       {
+               "xchacha12,aes", "adiantum",
+               "\x9e\x16\xab\xed\x4b\xa7\x42\x5a\xc6\xfb\x4e\x76\xff\xbe\x03\xa0"
+               "\x0f\xe3\xad\xba\xe4\x98\x2b\x0e\x21\x48\xa0\xb8\x65\x48\x27\x48"
+               "\x84\x54\x54\xb2\x9a\x94\x7b\xe6\x4b\x29\xe9\xcf\x05\x91\x80\x1a"
+               "\x3a\xf3\x41\x96\x85\x1d\x9f\x74\x51\x56\x63\xfa\x7c\x28\x85\x49"
+               "\xf7\x2f\xf9\xf2\x18\x46\xf5\x33\x80\xa3\x3c\xce\xb2\x57\x93\xf5"
+               "\xae\xbd\xa9\xf5\x7b\x30\xc4\x93\x66\xe0\x30\x77\x16\xe4\xa0\x31"
+               "\xba\x70\xbc\x68\x13\xf5\xb0\x9a\xc1\xfc\x7e\xfe\x55\x80\x5c\x48"
+               "\x74\xa6\xaa\xa3\xac\xdc\xc2\xf5\x8d\xde\x34\x86\x78\x60\x75\x8d",
+       },{
+               "xchacha20,aes", "adiantum",
+               "\xb1\x8b\xa0\x05\x77\xa8\x4d\x59\x1b\x8e\x21\xfc\x3a\x49\xfa\xd4"
+               "\xeb\x36\xf3\xc4\xdf\xdc\xae\x67\x07\x3f\x70\x0e\xe9\x66\xf5\x0c"
+               "\x30\x4d\x66\xc9\xa4\x2f\x73\x9c\x13\xc8\x49\x44\xcc\x0a\x90\x9d"
+               "\x7c\xdd\x19\x3f\xea\x72\x8d\x58\xab\xe7\x09\x2c\xec\xb5\x44\xd2"
+               "\xca\xa6\x2d\x7a\x5c\x9c\x2b\x15\xec\x2a\xa6\x69\x91\xf9\xf3\x13"
+               "\xf7\x72\xc1\xc1\x40\xd5\xe1\x94\xf4\x29\xa1\x3e\x25\x02\xa8\x3e"
+               "\x94\xc1\x91\x14\xa1\x14\xcb\xbe\x67\x4c\xb9\x38\xfe\xa7\xaa\x32"
+               "\x29\x62\x0d\xb2\xf6\x3c\x58\x57\xc1\xd5\x5a\xbb\xd6\xa6\x2a\xe5"
+       },
+}}};
+
+/*
+ * Cipher IV tests
+ */
+struct cipher_iv_test_vector {
+       const char *cipher_name;
+       const char *cipher_mode;
+       const char *key;
+       unsigned int key_length;
+       const char *iv_name;
+       uint64_t iv_offset;
+       unsigned int data_length;
+       const char in_sha256[32];
+       struct {
+               size_t sector_size;
+               const char out_sha256[32];
+       } out[4];
+};
+
+static struct cipher_iv_test_vector cipher_iv_test_vectors[] = {
+{
+       "aes", "cbc",
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "null", 0, 8192,
+       "\x9f\x1d\xcb\xc3\x5c\x35\x0d\x60\x27\xf9\x8b\xe0\xf5\xc8\xb4\x3b"
+       "\x42\xca\x52\xb7\x60\x44\x59\xc0\xc4\x2b\xe3\xaa\x88\x91\x3d\x47", {
+       {
+               512,
+               "\xfd\x05\xd0\x4d\x51\xb9\xd4\x87\xa4\x57\x9a\x62\x07\x39\xc9\x4a"
+               "\x00\x90\x3e\xaf\xe8\xb2\xac\x12\xca\xeb\x58\xf9\x48\xf6\xef\x08"
+       },{
+               1024,
+               "\x55\x87\x5c\xde\x86\x6a\x8b\xab\x08\xbe\x5b\x38\x17\x53\xdf\xe5"
+               "\x7e\xb9\x5f\x59\xaf\x07\xa4\xca\x6a\x24\xd1\x12\xa9\x15\x25\xf4"
+       },{
+               2048,
+               "\x55\x5b\x8e\x74\x90\x9d\x0d\x4b\x74\x8c\x16\x7e\x29\xcf\xa9\xa3"
+               "\xf3\x42\x8b\x62\xda\x2d\x8c\xda\xc9\x32\xc8\x78\xe2\x7e\xd2\x70"
+       },{
+               4096,
+               "\xc6\x45\xba\xe0\x40\x3a\x96\x09\x5e\x46\x0d\x19\x9d\x58\x4b\x93"
+               "\x78\xc5\x3f\xa4\x2e\x9e\xb0\x19\x04\x4b\x73\x26\xf4\xa6\xb5\xc3"
+       },
+}},
+{
+       "aes", "cbc",
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "plain", UINT32_MAX-1, 8192,
+       "\x9f\x1d\xcb\xc3\x5c\x35\x0d\x60\x27\xf9\x8b\xe0\xf5\xc8\xb4\x3b"
+       "\x42\xca\x52\xb7\x60\x44\x59\xc0\xc4\x2b\xe3\xaa\x88\x91\x3d\x47", {
+       {
+               512,
+               "\x4e\xa0\x9e\x5b\xf2\x27\x88\xdb\xe9\x05\xfb\x34\xa1\x88\x3b\xa3"
+               "\xda\x3e\x98\x50\x5d\x52\x68\x72\xc8\xac\x21\x88\x77\x35\x67\xad"
+       },{
+               1024,
+               "\x0e\x4d\xba\x93\xef\x44\x06\x3b\xac\x92\x29\x97\xde\x75\xe7\x18"
+               "\x26\x06\x5c\x8f\x23\xf2\xf8\xe5\xee\xfe\xf7\x9a\xdf\xc7\xd4\x2d"
+       },{
+               2048,
+               "\x6f\xd7\x56\x23\x51\x65\x20\x8f\xd2\x11\x35\xe1\xd2\x05\x40\xc3"
+               "\xd3\x18\xc1\xed\xf0\x1c\xbe\x0e\xdd\xd5\xca\x39\x21\xe0\xe4\x68"
+       },{
+               4096,
+               "\x80\xaa\x75\x69\x39\x29\x8f\x93\xbd\x09\x51\x96\x9b\x7d\x0f\xd0"
+               "\xf5\xb5\xdf\xf4\x48\x8c\x21\x26\x2e\xa7\x5c\x52\x75\xaa\xfc\xe3"
+       },
+}},
+{
+       "aes", "cbc",
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "plain64", UINT32_MAX-1, 8192,
+       "\x9f\x1d\xcb\xc3\x5c\x35\x0d\x60\x27\xf9\x8b\xe0\xf5\xc8\xb4\x3b"
+       "\x42\xca\x52\xb7\x60\x44\x59\xc0\xc4\x2b\xe3\xaa\x88\x91\x3d\x47", {
+       {
+               512,
+               "\x60\xe5\xc9\xf8\xcd\x48\x06\x3c\x96\x11\xc8\xbf\x1e\x67\x60\x21"
+               "\x0c\x1f\x1a\x8b\x03\x00\x0d\xc1\x39\xc9\x27\xb8\xa8\x73\x17\x69"
+       },{
+               1024,
+               "\x25\xc1\x6b\x78\x8a\x22\x72\xb5\x5c\xfb\x3f\xe9\x16\x8b\x89\x96"
+               "\xfa\x80\xed\xf4\x83\xab\x1c\x79\xd2\xc7\x44\x27\x89\x99\xbb\x83"
+       },{
+               2048,
+               "\xb3\x42\x15\xd7\x86\xf6\xdf\x45\x49\x78\x18\x73\xa8\x7f\x3e\xb3"
+               "\x0b\xb8\x64\x91\x7c\xf1\x5a\x5b\x6d\x20\xbc\x0b\xe2\xab\x9b\xe6"
+       },{
+               4096,
+               "\x6b\x45\x5c\x24\x97\xb4\x87\x49\x99\x16\x69\x59\x72\x6b\xd7\xc9"
+               "\xc9\x90\xec\x7f\x3b\xfb\xe9\xea\x9d\xb4\x39\x62\x4d\x22\xe5\x43"
+       },
+}},
+{
+       "aes", "cbc",
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "plain64be", UINT32_MAX-1, 8192,
+       "\x9f\x1d\xcb\xc3\x5c\x35\x0d\x60\x27\xf9\x8b\xe0\xf5\xc8\xb4\x3b"
+       "\x42\xca\x52\xb7\x60\x44\x59\xc0\xc4\x2b\xe3\xaa\x88\x91\x3d\x47", {
+       {
+               512,
+               "\x7f\xf9\xdb\xe1\xf6\x8c\x4d\xb4\x33\x9d\x61\x7b\x67\x5c\xef\x69"
+               "\xea\x94\x32\x3d\xa7\x70\x01\xe0\x06\x4c\xf8\x56\x64\xd0\xb7\xdf"
+       },{
+               1024,
+               "\x8e\x33\x0b\xa2\x45\x78\x5a\x3d\x5e\xf7\x74\xf9\x75\xb5\xbd\x06"
+               "\x38\x78\x74\x4f\xd8\xec\x11\x96\xf7\x92\x2b\xb1\x9a\xc2\xc3\xef"
+       },{
+               2048,
+               "\xad\x94\xcb\x8d\x96\x47\x10\x5c\x54\xce\x74\xca\xc8\xa3\xbd\x3e"
+               "\xdf\xa7\xf5\x14\x2a\x77\x4c\x50\xb8\x01\x46\xc3\x89\x50\xa7\x46"
+       },{
+               4096,
+               "\x3b\xdb\xbe\x01\x09\xd9\xda\xf7\x77\x85\xe2\x30\xaf\x21\xe7\x70"
+               "\x51\x2c\x6b\xcc\x75\x40\x7e\x8d\xdc\x90\xab\xaf\x6d\x2e\x0b\x49"
+       },
+}},
+{
+       "aes", "cbc",
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "essiv:sha256", 0, 8192,
+       "\x9f\x1d\xcb\xc3\x5c\x35\x0d\x60\x27\xf9\x8b\xe0\xf5\xc8\xb4\x3b"
+       "\x42\xca\x52\xb7\x60\x44\x59\xc0\xc4\x2b\xe3\xaa\x88\x91\x3d\x47", {
+       {
+               512,
+               "\xa5\x3e\x74\xc4\x1a\x5c\xf3\x6b\x63\x49\xd5\xd9\xbb\x7a\x89\x5a"
+               "\xd5\x3e\x76\x6f\x4c\x2d\x0b\xd3\x8b\x5e\x0e\x91\xa3\x8c\x2a\xde"
+       },{
+               1024,
+               "\x41\x6b\xc6\x75\x2e\x99\x76\xa1\x83\xea\xd5\x97\x64\x0e\x24\x8c"
+               "\x91\x17\x03\x38\xe7\xd8\x66\x64\xaa\xd7\x27\x50\x2a\xd3\x0b\xe6"
+       },{
+               2048,
+               "\x84\xdc\x45\xd3\x61\x03\xa8\x51\x85\x5b\xef\xf8\x92\x6b\x12\x06"
+               "\x2c\xfe\x75\x3e\xcf\x28\xd1\x8b\x4d\xcb\x88\x9e\x31\xb0\x0b\x92"
+       },{
+               4096,
+               "\xbb\x1b\xa3\xa9\x41\xbf\x17\xd8\x76\x19\x08\x8e\x3f\x50\xed\xfd"
+               "\x57\x1d\xd2\xc2\x8a\x32\x01\xb9\xd9\x8a\xcc\x0d\xa0\x65\x8b\x6d"
+       },
+}},
+{
+       "aes", "cbc",
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "benbi", 0, 8192,
+       "\x9f\x1d\xcb\xc3\x5c\x35\x0d\x60\x27\xf9\x8b\xe0\xf5\xc8\xb4\x3b"
+       "\x42\xca\x52\xb7\x60\x44\x59\xc0\xc4\x2b\xe3\xaa\x88\x91\x3d\x47", {
+       {
+               512,
+               "\x3c\xe3\x94\xe3\x6d\x68\x5b\xdb\x5a\x8d\x71\xbf\xd3\xa6\x68\xb9"
+               "\x1f\x33\x0f\x97\xe2\xd6\xe8\xe2\xe1\xfc\x7e\x80\x28\xf1\x73\xbd"
+       },{
+               1024,
+               "\x0f\x27\xa7\xae\x31\x9e\x71\x02\x12\x16\x44\x5f\xbb\xc6\xcb\x78"
+               "\xd4\x84\x49\xe0\x88\x85\x04\xbf\x6d\xea\x60\x76\x98\x34\x0a\x7e"
+       },{
+               2048,
+               "\xb0\x9a\xe5\x31\x5f\x2e\x9d\x13\x04\x08\x2a\x02\x71\x3d\xdb\x5d"
+               "\xb2\xc9\x68\x5b\xdc\xd1\x38\xc2\x96\xb3\x3b\x72\xda\x9d\xcb\xe6"
+       },{
+               4096,
+               "\xaa\x74\x7d\xd6\x73\xa7\x77\xe1\x7f\xb9\x76\xf7\x5c\xcf\xc0\xb7"
+               "\xfa\x7b\xed\x15\xc2\x32\x7c\x27\xbb\x35\xfc\xfe\x12\xee\x14\x2d"
+       },
+}},
+{
+       "aes", "cbc",
+       "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c", 16,
+       "eboiv", 0, 8192,
+       "\x9f\x1d\xcb\xc3\x5c\x35\x0d\x60\x27\xf9\x8b\xe0\xf5\xc8\xb4\x3b"
+       "\x42\xca\x52\xb7\x60\x44\x59\xc0\xc4\x2b\xe3\xaa\x88\x91\x3d\x47", {
+       {
+               512,
+               "\x04\x4e\x92\x9f\x79\x66\xfe\x93\x1b\xa5\xb8\x02\xfe\x7e\xf9\x26"
+               "\x7b\x64\x39\xe7\xb3\xca\xc4\x6e\xca\x27\xa0\x2f\xe2\xea\x91\x16"
+       },{
+               1024,
+               "\xb0\x4a\xa4\xb5\xd6\x45\x7a\x86\xe9\x43\x3d\xd6\x01\xf7\x68\x8e"
+               "\xe6\x81\x8d\x50\x55\x18\x8e\x4b\xb6\xa7\x89\xdf\xe2\x4b\x94\xe2"
+       },{
+               2048,
+               "\xd4\x00\x1f\x26\x18\xd1\x6d\xd5\xc4\xbf\x4a\x13\x30\xae\xd7\x4b"
+               "\x33\x1e\xd5\xe8\x43\x2d\x95\x84\x67\x39\x04\x51\x5f\x1f\x49\xe4"
+       },{
+               4096,
+               "\xd1\xd7\x4f\x70\x9a\xa0\x22\x27\x60\xdb\x40\x5a\x84\xce\x89\x2c"
+               "\x4f\x98\x55\xd2\x2d\xd1\xea\x9e\x47\xae\x8a\x83\xb5\x90\xbb\x49"
+       },
+}}};
+
+static int pbkdf_test_vectors(void)
+{
+       char result[256];
+       unsigned int i;
+       const struct kdf_test_vector *vec;
+
+       for (i = 0; i < (sizeof(kdf_test_vectors) / sizeof(*kdf_test_vectors)); i++) {
+               crypt_backend_memzero(result, sizeof(result));
+               vec = &kdf_test_vectors[i];
+               printf("PBKDF vector %02d %s ", i, vec->type);
+               if (vec->hash && crypt_hmac_size(vec->hash) < 0) {
+                       printf("[%s N/A]\n", vec->hash);
+                       continue;
+               }
+               if (crypt_pbkdf(vec->type, vec->hash,
+                   vec->password, vec->password_length,
+                   vec->salt, vec->salt_length,
+                   result, vec->output_length,
+                   vec->iterations, vec->memory, vec->parallelism) < 0) {
+                       printf("[%s-%s N/A]\n", vec->type, vec->hash);
+                       continue;
+               }
+               if (memcmp(result, vec->output, vec->output_length)) {
+                       printf("[FAILED]\n");
+                       printhex(" got", result, vec->output_length);
+                       printhex("want", vec->output, vec->output_length);
+                       return EXIT_FAILURE;
+               }
+               printf("[OK]\n");
+       }
+       return EXIT_SUCCESS;
+}
+
+static int crc32_test(const struct hash_test_vector *vector, unsigned int i)
+{
+       uint32_t crc32;
+
+       if (vector->out[i].length != sizeof(uint32_t))
+               return EXIT_FAILURE;
+
+       crc32 = crypt_crc32(~0, (const unsigned char*)vector->data, vector->data_length) ^ ~0;
+
+       if ((unsigned char)vector->out[i].out[0] != ((crc32 >> 24) & 0xFF) ||
+           (unsigned char)vector->out[i].out[1] != ((crc32 >> 16) & 0xFF) ||
+           (unsigned char)vector->out[i].out[2] != ((crc32 >>  8) & 0xFF) ||
+           (unsigned char)vector->out[i].out[3] != ((crc32 >>  0) & 0xFF)) {
+               printf("[FAILED]\n");
+               printhex(" got", (const char *)&crc32, sizeof(crc32));
+               printhex("want", vector->out[i].out, vector->out[i].length);
+               return EXIT_FAILURE;
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static int hash_test(void)
+{
+       const struct hash_test_vector *vector;
+       unsigned int i, j;
+       int r;
+       struct crypt_hash *h;
+       char result[64];
+
+       for (i = 0; i < ARRAY_SIZE(hash_test_vectors); i++) {
+               vector = &hash_test_vectors[i];
+               printf("Hash vector %02d: ", i);
+
+               for (j = 0; j < ARRAY_SIZE(vector->out); j++) {
+
+                       // CRC32 vector test is special
+                       if (!strcmp("crc32", vector->out[j].name)) {
+                               if (crc32_test(vector, j) < 0)
+                                       return EXIT_FAILURE;
+                               printf("[%s]", vector->out[j].name);
+                               continue;
+                       }
+
+                       if (crypt_hash_size(vector->out[j].name) < 0) {
+                               printf("[%s N/A]", vector->out[j].name);
+                               continue;
+                       }
+
+                       if (crypt_hash_size(vector->out[j].name) != (int)vector->out[j].length)
+                               return EXIT_FAILURE;
+
+                       if (sizeof(result) < vector->out[j].length)
+                               return EXIT_FAILURE;
+
+                       crypt_backend_memzero(result, sizeof(result));
+                       printf("[%s]", vector->out[j].name);
+
+                       if (crypt_hash_init(&h, vector->out[j].name)) {
+                               printf("[%s N/A (init)]", vector->out[j].name);
+                               continue;
+                       }
+
+                       r = crypt_hash_write(h, vector->data, vector->data_length);
+                       if (!r)
+                               r = crypt_hash_final(h, result, vector->out[j].length);
+
+                       crypt_hash_destroy(h);
+
+                       if (r)
+                               return EXIT_FAILURE;
+
+                       if (memcmp(result, vector->out[j].out, vector->out[j].length)) {
+                               printf("[FAILED]\n");
+                               printhex(" got", result, vector->out[j].length);
+                               printhex("want", vector->out[j].out, vector->out[j].length);
+                               return EXIT_FAILURE;
+                       }
+               }
+               printf("\n");
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static int hmac_test(void)
+{
+       const struct hmac_test_vector *vector;
+       struct crypt_hmac *hmac;
+       unsigned int i, j;
+       int r;
+       char result[64];
+
+       for (i = 0; i < ARRAY_SIZE(hmac_test_vectors); i++) {
+               vector = &hmac_test_vectors[i];
+               printf("HMAC vector %02d: ", i);
+
+               for(j = 0; j < ARRAY_SIZE(vector->out); j++) {
+
+                       if (crypt_hmac_size(vector->out[j].name) < 0) {
+                               printf("[%s N/A]", vector->out[j].name);
+                               continue;
+                       }
+
+                       if (crypt_hmac_size(vector->out[j].name) != (int)vector->out[j].length)
+                               return EXIT_FAILURE;
+
+                       if (sizeof(result) < vector->out[j].length)
+                               return EXIT_FAILURE;
+
+                       crypt_backend_memzero(result, sizeof(result));
+                       printf("[%s]", vector->out[j].name);
+
+                       if (crypt_hmac_init(&hmac, vector->out[j].name, vector->key, vector->key_length))
+                               return EXIT_FAILURE;
+
+                       r = crypt_hmac_write(hmac, vector->data, vector->data_length);
+                       if (!r)
+                               r = crypt_hmac_final(hmac, result, vector->out[j].length);
+
+                       crypt_hmac_destroy(hmac);
+
+                       if (r)
+                               return EXIT_FAILURE;
+
+                       if (memcmp(result, vector->out[j].out, vector->out[j].length)) {
+                               printf("[FAILED]\n");
+                               printhex(" got", result, vector->out[j].length);
+                               printhex("want", vector->out[j].out, vector->out[j].length);
+                               return EXIT_FAILURE;
+                       }
+               }
+               printf("\n");
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static int cipher_test(void)
+{
+       const struct cipher_test_vector *vector;
+       struct crypt_cipher *cipher;
+       unsigned int i, j;
+       char result[256];
+       int r;
+
+       for (i = 0; i < ARRAY_SIZE(cipher_test_vectors); i++) {
+               vector = &cipher_test_vectors[i];
+               printf("CIPHER vector %02d: ", i);
+
+               for (j = 0; j < ARRAY_SIZE(vector->out); j++) {
+                       if (vector->iv_length &&
+                           crypt_cipher_ivsize(vector->out[j].name, vector->out[j].mode) != (int)vector->iv_length)
+                               return EXIT_FAILURE;
+                       if (vector->data_length > sizeof(result))
+                               return EXIT_FAILURE;
+
+                       r = crypt_cipher_init(&cipher, vector->out[j].name, vector->out[j].mode,
+                                             vector->key, vector->key_length);
+                       if (r == -ENOENT || r == -ENOTSUP) {
+                               printf("[%s-%s N/A]", vector->out[j].name, vector->out[j].mode);
+                               continue;
+                       } else {
+                               printf("[%s-%s,%dbits]", vector->out[j].name, vector->out[j].mode, vector->key_length * 8);
+                               if (r)
+                                       return EXIT_FAILURE;
+                       }
+
+                       crypt_backend_memzero(result, sizeof(result));
+                       if (crypt_cipher_encrypt(cipher, vector->plaintext, result, vector->data_length,
+                                                vector->iv, vector->iv_length)) {
+                               crypt_cipher_destroy(cipher);
+                               return EXIT_FAILURE;
+                       }
+
+                       if (memcmp(vector->out[j].ciphertext, result, vector->data_length)) {
+                               printf("[ENCRYPTION FAILED]\n");
+                               printhex(" got", result, vector->data_length);
+                               printhex("want", vector->out[j].ciphertext, vector->data_length);
+                               crypt_cipher_destroy(cipher);
+                               return EXIT_FAILURE;
+                       }
+
+                       crypt_backend_memzero(result, sizeof(result));
+                       if (crypt_cipher_decrypt(cipher, vector->out[j].ciphertext, result, vector->data_length,
+                                                vector->iv, vector->iv_length)) {
+                               crypt_cipher_destroy(cipher);
+                               return EXIT_FAILURE;
+                       }
+
+                       if (memcmp(vector->plaintext, result, vector->data_length)) {
+                               printf("[DECRYPTION FAILED]\n");
+                               printhex(" got", result, vector->data_length);
+                               printhex("want", vector->plaintext, vector->data_length);
+                               crypt_cipher_destroy(cipher);
+                               return EXIT_FAILURE;
+                       }
+
+                       crypt_cipher_destroy(cipher);
+               }
+               printf("\n");
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static void get_sha256(const char *in, size_t length, char out[32])
+{
+       struct crypt_hash *h;
+
+       crypt_backend_memzero(out, 32);
+       if (crypt_hash_init(&h, "sha256"))
+               return;
+
+       if (!crypt_hash_write(h, in, length))
+               crypt_hash_final(h, out, 32);
+
+       crypt_hash_destroy(h);
+}
+
+static int cipher_iv_test(void)
+{
+       const struct cipher_iv_test_vector *vector;
+       struct crypt_storage *storage;
+       unsigned int i, j;
+       char mode_iv[256];
+       char result[8192], hash[32];
+       int r;
+
+       for (i = 0; i < ARRAY_SIZE(cipher_iv_test_vectors); i++) {
+               vector = &cipher_iv_test_vectors[i];
+               printf("IV vector %02d: [%s-%s-%s]", i, vector->cipher_name, vector->cipher_mode, vector->iv_name);
+
+               for (j = 0; j < ARRAY_SIZE(vector->out); j++) {
+                       if (vector->data_length > sizeof(result))
+                               return EXIT_FAILURE;
+
+                       snprintf(mode_iv, sizeof(mode_iv)-2, "%s-%s", vector->cipher_mode, vector->iv_name);
+                       r = crypt_storage_init(&storage, vector->out[j].sector_size, vector->cipher_name, mode_iv,
+                                              vector->key, vector->key_length);
+                       if (r == -ENOENT || r == -ENOTSUP) {
+                               printf("[N/A]");
+                               continue;
+                       } else {
+                               printf("[%i]", (int)vector->out[j].sector_size);
+                               if (r)
+                                       return EXIT_FAILURE;
+                       }
+
+                       crypt_backend_memzero(result, sizeof(result));
+                       if (crypt_storage_encrypt(storage, vector->iv_offset, vector->data_length, result)) {
+                               crypt_storage_destroy(storage);
+                               return EXIT_FAILURE;
+                       }
+
+                       get_sha256(result, vector->data_length, hash);
+                       if (memcmp(vector->out[j].out_sha256, hash, sizeof(hash))) {
+                               printf("[ENCRYPTION FAILED]\n");
+                               printhex(" got", hash, sizeof(hash));
+                               printhex("want", vector->out[j].out_sha256, sizeof(vector->out[j].out_sha256));
+                               crypt_storage_destroy(storage);
+                               return EXIT_FAILURE;
+                       }
+
+                       if (crypt_storage_decrypt(storage, vector->iv_offset, vector->data_length, result)) {
+                               crypt_storage_destroy(storage);
+                               return EXIT_FAILURE;
+                       }
+
+                       get_sha256(result, vector->data_length, hash);
+                       if (memcmp(vector->in_sha256, hash, sizeof(hash))) {
+                               printf("[DECRYPTION FAILED]\n");
+                               printhex(" got", hash, sizeof(hash));
+                               printhex("want", vector->in_sha256, sizeof(vector->in_sha256));
+                               crypt_storage_destroy(storage);
+                               return EXIT_FAILURE;
+                       }
+
+                       crypt_storage_destroy(storage);
+               }
+               printf("\n");
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static void __attribute__((noreturn)) exit_test(const char *msg, int r)
+{
+       if (msg)
+               printf("%s\n", msg);
+       crypt_backend_destroy();
+       exit(r);
+}
+
+int main(__attribute__ ((unused)) int argc, __attribute__ ((unused))char *argv[])
+{
+       setvbuf(stdout, NULL, _IONBF, 0);
+
+       if (getenv("CRYPTSETUP_PATH")) {
+               printf("Cannot run this test with CRYPTSETUP_PATH set.\n");
+               exit(77);
+       }
+
+       if (crypt_backend_init())
+               exit_test("Crypto backend init error.", EXIT_FAILURE);
+
+       printf("Test vectors using %s crypto backend.\n", crypt_backend_version());
+
+       if (pbkdf_test_vectors())
+               exit_test("PBKDF test failed.", EXIT_FAILURE);
+
+       if (hash_test())
+               exit_test("HASH test failed.", EXIT_FAILURE);
+
+       if (hmac_test())
+               exit_test("HMAC test failed.", EXIT_FAILURE);
+
+       if (cipher_test())
+               exit_test("CIPHER test failed.", EXIT_FAILURE);
+
+       if (cipher_iv_test())
+               exit_test("IV test failed.", EXIT_FAILURE);
+
+       exit_test(NULL, EXIT_SUCCESS);
+}
index 3370ace..b2530f7 100644 (file)
@@ -1,4 +1,4 @@
-# Supresion file for valgrind
+# Suppresion file for valgrind
 
 # known problem in libgcrypt
 {
index 1a6c8d2..0898b45 100755 (executable)
@@ -1,13 +1,17 @@
 #!/bin/bash
 
-CRYPTSETUP="../src/cryptsetup"
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 MNT_DIR="./mnt_luks"
 DEV_NAME="dummy"
+DEV_NAME2="ymmud"
 PWD1="93R4P4pIqAH8"
 PWD2="mymJeD8ivEhE"
+FAST_PBKDF_OPT="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
+SKIP_COUNT=0
 
 cleanup() {
-       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
        udevadm settle >/dev/null 2>&1
        if [ -d "$MNT_DIR" ] ; then
            umount -f $MNT_DIR 2>/dev/null
@@ -18,7 +22,9 @@ cleanup() {
 
 fail()
 {
-       if [ -n "$1" ] ; then echo "FAIL $1" ; else echo "FAIL" ; fi
+       [ -n "$1" ] && echo "FAIL $1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        cleanup
        exit 100
 }
@@ -27,14 +33,56 @@ skip()
 {
        echo "TEST SKIPPED: $1"
        cleanup
-       exit 0
+       exit 77
 }
 
-format() # key_bits expected [forced]
+function dm_crypt_features()
 {
-       dd if=/dev/zero of=$DEV bs=1M count=5 >/dev/null 2>&1
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
 
-       echo $PWD1 | $CRYPTSETUP luksFormat $DEV -q -i1 -c aes-cbc-essiv:sha256
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+       VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
+
+       [ $VER_MAJ -lt 1 ] && return
+       [ $VER_MAJ -gt 1 ] && {
+               DM_PERF_CPU=1
+               DM_SECTOR_SIZE=1
+               test -d /proc/sys/kernel/keys && DM_KEYRING=1
+               return
+       }
+
+       [ $VER_MIN -lt 14 ] && return
+       DM_PERF_CPU=1
+       if [ $VER_MIN -ge 17 -o \( $VER_MIN -eq 14 -a $VER_PTC -ge 5 \) ]; then
+               DM_SECTOR_SIZE=1
+       fi
+       if [ $VER_MIN -gt 18 -o \( $VER_MIN -eq 18 -a $VER_PTC -ge 1 \) ]; then
+                test -d /proc/sys/kernel/keys && DM_KEYRING=1
+       fi
+}
+
+function dm_crypt_keyring_support()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+
+       # run the test with dm-crypt v1.15.0+ on purpose
+       # the fix is in dm-crypt v1.18.1+
+       [ $VER_MAJ -gt 1 ] && return 0
+       [ $VER_MAJ -lt 1 ] && return 1
+       [ $VER_MIN -ge 15 ]
+}
+
+format() # format
+{
+       dd if=/dev/zero of=$DEV bs=1M count=32 >/dev/null 2>&1
+
+       echo $PWD1 | $CRYPTSETUP luksFormat --type $1 $DEV -q  $FAST_PBKDF_OPT -c aes-cbc-essiv:sha256
        [ $? -ne 0 ] && fail "Format failed."
 
        # test some operation, just in case
@@ -45,32 +93,54 @@ format() # key_bits expected [forced]
        [ $? -ne 0 ] && fail "Keyslot removal failed."
 }
 
+check_sector_size() # $1 expected sector size
+{
+       $CRYPTSETUP status $DEV_NAME | grep "sector size" | grep -q $1 || fail
+       if [ $S -gt 512 ]; then
+               dmsetup table $DEV_NAME | grep -q "sector_size:$1" || fail
+       fi
+}
+
 if [ $(id -u) != 0 ]; then
-       echo "WARNING: You must be root to run this test, test skipped."
-       exit 0
+       skip "You must be root to run this test, test skipped."
 fi
 
+dm_crypt_features
+
 [ ! -d $MNT_DIR ] && mkdir $MNT_DIR
 
 echo "[1] Using tmpfs for image"
 DEV="$MNT_DIR/test.img"
 mount -t tmpfs none $MNT_DIR || skip "Mounting tmpfs not available."
-format
+format luks1
 
-echo "[2] Kernel dmcrypt performace options"
-echo -e "$PWD1" | $CRYPTSETUP open --type plain $DEV $DEV_NAME --perf-same_cpu_crypt >/dev/null 2>&1
-if [ $? -ne 0 ] ; then
+echo "[2] Kernel dmcrypt performance options"
+if [ -z "$DM_PERF_CPU" ]; then
        echo "TEST SKIPPED: dmcrypt options not available"
+       SKIP_COUNT=$((SKIP_COUNT+1))
 else
-       $CRYPTSETUP close $DEV_NAME || fail
        # plain
-       echo -e "$PWD1" | $CRYPTSETUP open --type plain $DEV $DEV_NAME --perf-same_cpu_crypt --perf-submit_from_crypt_cpus || fail
+       echo -e "$PWD1" | $CRYPTSETUP open -q --type plain --hash sha256 $DEV $DEV_NAME --perf-same_cpu_crypt --perf-submit_from_crypt_cpus || fail
        $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
        $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus || fail
        $CRYPTSETUP close $DEV_NAME || fail
-       echo -e "$PWD1" | $CRYPTSETUP open --type plain $DEV $DEV_NAME --perf-same_cpu_crypt --allow-discards || fail
+       echo -e "$PWD1" | $CRYPTSETUP open -q --type plain --hash sha256 $DEV $DEV_NAME --perf-same_cpu_crypt --allow-discards || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       echo -e "$PWD1" | $CRYPTSETUP open -q --type plain --hash sha256 $DEV $DEV_NAME || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh --hash sha256 -q $DEV_NAME --perf-same_cpu_crypt --allow-discards || fail
+       # Hash affects volume key for plain device. Check we can detect it
+       echo -e "$PWD1" | $CRYPTSETUP refresh -q $DEV_NAME --hash sha512 --perf-same_cpu_crypt --allow-discards 2>/dev/null && fail
        $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
        $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh --hash sha256 -q $DEV_NAME --allow-discards || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt && fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh --hash sha256 -q $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards && fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt && fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh --hash sha256 $DEV $DEV_NAME2 2>/dev/null && fail
        $CRYPTSETUP close $DEV_NAME || fail
        # LUKS
        echo -e "$PWD1" | $CRYPTSETUP open --type luks1 $DEV $DEV_NAME --perf-same_cpu_crypt --perf-submit_from_crypt_cpus || fail
@@ -81,6 +151,115 @@ else
        $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
        $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
        $CRYPTSETUP close $DEV_NAME || fail
+       echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV_NAME --allow-discards || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt && fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV_NAME --allow-discards --perf-same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards && fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt && fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME2 2>/dev/null && fail
+       $CRYPTSETUP close $DEV_NAME || fail
+
+       format luks2
+       echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME --perf-same_cpu_crypt --perf-submit_from_crypt_cpus --persistent || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       # Stored in metadata
+       echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME --perf-same_cpu_crypt --allow-discards --persistent || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+
+       echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME --persistent || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt && fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards && fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME --perf-same_cpu_crypt --perf-submit_from_crypt_cpus --persistent || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME --perf-same_cpu_crypt --allow-discards --persistent || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME --perf-submit_from_crypt_cpus || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus || fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus && fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME --persistent || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q same_cpu_crypt && fail
+       $CRYPTSETUP status $DEV_NAME | grep -q discards && fail
+       $CRYPTSETUP status $DEV_NAME | grep -q submit_from_crypt_cpus && fail
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME --disable-keyring || fail
+       $CRYPTSETUP status $DEV_NAME | grep -q keyring && fail
+       if [ -n "$DM_KEYRING" ]; then
+               echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME || fail
+               $CRYPTSETUP status $DEV_NAME | grep -q keyring || fail
+       fi
+       echo -e "$PWD1" | $CRYPTSETUP refresh $DEV $DEV_NAME2 2>/dev/null && fail
+       $CRYPTSETUP close $DEV_NAME || fail
+fi
+
+echo "[3] Kernel dmcrypt sector size options"
+echo -e "$PWD1" | $CRYPTSETUP open --type plain --hash sha256 $DEV $DEV_NAME --sector-size 4096 >/dev/null 2>&1
+ret=$?
+[ -z "$DM_SECTOR_SIZE" -a $ret -eq 0 ] && fail "cryptsetup activated device with --sector-size option on incompatible kernel!"
+if [ $ret -ne 0 ] ; then
+       SKIP_COUNT=$((SKIP_COUNT+1))
+       if [ $SKIP_COUNT -ge 2 ]; then
+               skip "dmcrypt sector-size option not available"
+       fi
+       echo "TEST SKIPPED: dmcrypt sector-size option not available"
+else
+       $CRYPTSETUP close $DEV_NAME || fail
+
+       echo -n "PLAIN sector size:"
+       echo -e "$PWD1" | $CRYPTSETUP open --type plain --hash sha256 $DEV $DEV_NAME --sector-size 1234 >/dev/null 2>&1 && fail
+       for S in 512 1024 2048 4096; do
+               echo -n "[$S]"
+               echo -e "$PWD1" | $CRYPTSETUP open -q --type plain --hash sha256 $DEV $DEV_NAME --sector-size $S || fail
+               check_sector_size $S
+               $CRYPTSETUP close $DEV_NAME || fail
+       done
+
+       echo -e "$PWD1" | $CRYPTSETUP open --type plain --hash sha256 $DEV $DEV_NAME --iv-large-sectors >/dev/null 2>&1 && fail
+       for S in 1024 2048 4096; do
+               echo -n "[$S/IV]"
+               echo -e "$PWD1" | $CRYPTSETUP open -q --type plain --hash sha256 $DEV $DEV_NAME --sector-size $S --iv-large-sectors || fail
+               check_sector_size $S
+               dmsetup table $DEV_NAME | grep -q "iv_large_sectors" || fail
+               $CRYPTSETUP close $DEV_NAME || fail
+       done
+       echo
+
+       echo -n "LUKS2 sector size:"
+       echo -e "$PWD1" | $CRYPTSETUP luksFormat --type luks2 -$DEV --sector-size 1234 >/dev/null 2>&1 && fail
+       for S in 512 1024 2048 4096; do
+               echo -n "[$S]"
+               echo -e "$PWD1" | $CRYPTSETUP -q luksFormat --type luks2 --pbkdf pbkdf2 --pbkdf-force-iterations 1000 $DEV --sector-size $S || fail
+               echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME || fail
+               check_sector_size $S
+               $CRYPTSETUP close $DEV_NAME || fail
+       done
+       echo
 fi
 
 cleanup
index d4b1b37..827b319 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * cryptsetup file differ check (rewritten Clemens' fileDiffer in Python)
  *
- * Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
index a8c4bc6..8a838e6 100755 (executable)
@@ -1,12 +1,13 @@
 #!/bin/bash
 
-CRYPTSETUP="../src/cryptsetup"
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 DEV_NAME="discard-t3st"
 DEV=""
 PWD1="93R4P4pIqAH8"
 
 cleanup() {
-       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
        udevadm settle >/dev/null 2>&1
        rmmod scsi_debug 2>/dev/null
        sleep 2
@@ -14,16 +15,17 @@ cleanup() {
 
 fail()
 {
-       echo "FAILED"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        cleanup
        exit 100
 }
 
 add_device() {
-       modprobe scsi_debug $@
+       modprobe scsi_debug $@ delay=0
        if [ $? -ne 0 ] ; then
                echo "This kernel seems to not support proper scsi_debug module, test skipped."
-               exit 0
+               exit 77
        fi
 
        sleep 2
@@ -36,6 +38,8 @@ add_device() {
 function check_version()
 {
        VER_STR=$(dmsetup targets | grep crypt | cut -f 2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
        VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
        VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
 
@@ -47,14 +51,14 @@ function check_version()
 
 if [ $(id -u) != 0 ]; then
        echo "WARNING: You must be root to run this test, test skipped."
-       exit 0
+       exit 77
 fi
 
-modprobe --dry-run scsi_debug || exit 0
+modprobe --dry-run scsi_debug || exit 77
 modprobe dm-crypt >/dev/null 2>&1
 if ! check_version ; then
        echo "Probably old kernel, test skipped."
-       exit 0
+       exit 77
 fi
 
 add_device dev_size_mb=16 sector_size=512 num_tgts=1 lbpu=1
@@ -63,7 +67,7 @@ add_device dev_size_mb=16 sector_size=512 num_tgts=1 lbpu=1
 # for now just check that flag is enabled
 
 echo "[1] Allowing discards for LUKS device"
-echo $PWD1 | $CRYPTSETUP luksFormat $DEV -q -i1 || fail
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $DEV -q -i1 || fail
 echo $PWD1 | $CRYPTSETUP luksOpen $DEV $DEV_NAME --allow-discards || fail
 $CRYPTSETUP status $DEV_NAME | grep flags | grep discards >/dev/null || fail
 $CRYPTSETUP resize $DEV_NAME --size 100 || fail
@@ -72,7 +76,7 @@ dmsetup table $DEV_NAME | grep allow_discards >/dev/null || fail
 $CRYPTSETUP luksClose $DEV_NAME || fail
 
 echo "[2] Allowing discards for plain device"
-echo $PWD1 | $CRYPTSETUP create $DEV_NAME $DEV --hash sha1 --allow-discards || fail
+echo $PWD1 | $CRYPTSETUP create -q $DEV_NAME $DEV --hash sha1 --allow-discards || fail
 $CRYPTSETUP status $DEV_NAME | grep flags | grep discards >/dev/null || fail
 $CRYPTSETUP resize $DEV_NAME --size 100 || fail
 $CRYPTSETUP status $DEV_NAME | grep flags | grep discards >/dev/null || fail
diff --git a/tests/evil_hdr-keyslot_overlap.xz b/tests/evil_hdr-keyslot_overlap.xz
new file mode 100644 (file)
index 0000000..6d56368
Binary files /dev/null and b/tests/evil_hdr-keyslot_overlap.xz differ
diff --git a/tests/evil_hdr-luks_hdr_damage.bz2 b/tests/evil_hdr-luks_hdr_damage.bz2
deleted file mode 100644 (file)
index b4970be..0000000
Binary files a/tests/evil_hdr-luks_hdr_damage.bz2 and /dev/null differ
diff --git a/tests/evil_hdr-luks_hdr_damage.xz b/tests/evil_hdr-luks_hdr_damage.xz
new file mode 100644 (file)
index 0000000..b0b5254
Binary files /dev/null and b/tests/evil_hdr-luks_hdr_damage.xz differ
diff --git a/tests/evil_hdr-payload_overwrite.bz2 b/tests/evil_hdr-payload_overwrite.bz2
deleted file mode 100644 (file)
index c27a78c..0000000
Binary files a/tests/evil_hdr-payload_overwrite.bz2 and /dev/null differ
diff --git a/tests/evil_hdr-payload_overwrite.xz b/tests/evil_hdr-payload_overwrite.xz
new file mode 100644 (file)
index 0000000..b9e0e68
Binary files /dev/null and b/tests/evil_hdr-payload_overwrite.xz differ
diff --git a/tests/evil_hdr-small_luks_device.bz2 b/tests/evil_hdr-small_luks_device.bz2
deleted file mode 100644 (file)
index 4d77530..0000000
Binary files a/tests/evil_hdr-small_luks_device.bz2 and /dev/null differ
diff --git a/tests/evil_hdr-small_luks_device.xz b/tests/evil_hdr-small_luks_device.xz
new file mode 100644 (file)
index 0000000..700392d
Binary files /dev/null and b/tests/evil_hdr-small_luks_device.xz differ
diff --git a/tests/evil_hdr-stripes_payload_dmg.bz2 b/tests/evil_hdr-stripes_payload_dmg.bz2
deleted file mode 100644 (file)
index d1b7daa..0000000
Binary files a/tests/evil_hdr-stripes_payload_dmg.bz2 and /dev/null differ
diff --git a/tests/evil_hdr-stripes_payload_dmg.xz b/tests/evil_hdr-stripes_payload_dmg.xz
new file mode 100644 (file)
index 0000000..dc91556
Binary files /dev/null and b/tests/evil_hdr-stripes_payload_dmg.xz differ
diff --git a/tests/generators/generate-luks2-area-in-json-hdr-space-json0.img.sh b/tests/generators/generate-luks2-area-in-json-hdr-space-json0.img.sh
new file mode 100755 (executable)
index 0000000..3938f7b
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with one area accessing luks
+# header space
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # make area 7 access the luks2 header space
+       OFFS=$((2*LUKS2_HDR_SIZE*512-1))
+       LEN=1
+       json_str=$(jq -c --arg off $OFFS --arg len $LEN \
+                  '.keyslots."0".area.offset = $off | .keyslots."0".area.size = $len' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c --arg off $OFFS --arg len $LEN \
+           'if (.keyslots."0".area.offset != $off) or (.keyslots."0".area.size != $len)
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-argon2-leftover-params.img.sh b/tests/generators/generate-luks2-argon2-leftover-params.img.sh
new file mode 100755 (executable)
index 0000000..7f003a0
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with luks2 keyslot kdf object
+# having left over params.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # add keyslot 1 to second digest
+       obj_len=$(jq -c -M '.keyslots."1".kdf | length' $TMPDIR/json0)
+       json_str=$(jq -r -c -M '.keyslots."1".kdf.type = "pbkdf2" | .keyslots."1".kdf.iterations = 1001 | .keyslots."1".kdf.hash = "sha256"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_obj_len=$(jq -c -M '.keyslots."1".kdf | length' $TMPDIR/json_res0)
+       test $((obj_len+2)) -eq $new_obj_len || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-correct-full-json0.img.sh b/tests/generators/generate-luks2-correct-full-json0.img.sh
new file mode 100755 (executable)
index 0000000..f32f84b
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate header with correct json of maximal size in primary slot.
+# Secondary header is broken on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+PATTERN="\"config\":{"
+KEY="\"config_key\":\""
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json0
+       json_len=${#json_str}
+       pindex=$(strindex $json_str $PATTERN)
+       test $pindex -gt 0 || exit 2
+
+       offset=${#PATTERN}
+       offset=$((offset+pindex))
+       key_len=${#KEY}
+       remain=$((LUKS2_JSON_SIZE*512-json_len-key_len-2)) # -2: closing '"' and terminating '\0'
+       if [ ${json_str:offset:1} = "}" ]; then
+               format_str="%s%s%s"
+       else
+               format_str="%s%s,%s"
+               remain=$((remain-1)) # also count with separating ','
+       fi
+       test $remain -gt 0 || exit 2
+
+       fill=$(repeat_str "X" $remain)"\""
+
+       printf $format_str $KEY $fill ${json_str:$offset} | _dd of=$TMPDIR/json0 bs=1 seek=$offset conv=notrunc
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       #json_str_res0=$(< $TMPDIR/json_res0)
+       read -r json_str_res0 < $TMPDIR/json_res0
+       test ${#json_str_res0} -eq $((LUKS2_JSON_SIZE*512-1)) || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-corrupted-hdr0-with-correct-chks.img.sh b/tests/generators/generate-luks2-corrupted-hdr0-with-correct-chks.img.sh
new file mode 100755 (executable)
index 0000000..3d4f729
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate header with malformed json but correct checksum in primary header
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json0
+       json_len=${#json_str}
+       json_len=$((json_len-1)) # to replace json closing '}'
+       json_new_str="${json_str:0:json_len},\""
+
+       while [ ${#json_new_str} -le $((LUKS2_JSON_SIZE*512)) ]; do
+               json_new_str=$json_new_str"all_work_and_no_play_makes_Jack_a_dull_boy_"
+       done
+
+       printf "%s" $json_new_str | _dd of=$TMPDIR/json0 bs=512 count=$LUKS2_JSON_SIZE
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+}
+
+function check()
+{
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       read -r json_str_res0 < $TMPDIR/json_res0
+       test ${#json_str_res0} -eq $((LUKS2_JSON_SIZE*512)) || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-corrupted-hdr1-with-correct-chks.img.sh b/tests/generators/generate-luks2-corrupted-hdr1-with-correct-chks.img.sh
new file mode 100755 (executable)
index 0000000..026393c
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate header with malformed json but correct checksum in secondary header
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json1 $TGT_IMG $TMPDIR/json1
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json1
+       json_len=${#json_str}
+       json_len=$((json_len-1)) # to replace json closing '}'
+       json_new_str="${json_str:0:json_len},\""
+
+       while [ ${#json_new_str} -le $((LUKS2_JSON_SIZE*512)) ]; do
+               json_new_str=$json_new_str"all_work_and_no_play_makes_Jack_a_dull_boy_"
+       done
+
+       printf "%s" $json_new_str | _dd of=$TMPDIR/json1 bs=512 count=$LUKS2_JSON_SIZE
+
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json1 $TMPDIR/area1
+       erase_checksum $TMPDIR/area1
+       chks1=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks1 $TMPDIR/area1
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       chks_res1=$(read_sha256_checksum $TMPDIR/hdr_res1)
+       test "$chks1" = "$chks_res1" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1
+       read -r json_str_res1 < $TMPDIR/json_res1
+       test ${#json_str_res1} -eq $((LUKS2_JSON_SIZE*512)) || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-checksum-both-hdrs.img.sh b/tests/generators/generate-luks2-invalid-checksum-both-hdrs.img.sh
new file mode 100755 (executable)
index 0000000..be98722
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate header with bad checksum in both binary headerer
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       chks0=$(echo "Arbitrary chosen string: D'oh!" | calc_sha256_checksum_stdin)
+       chks1=$(echo "D'oh!: arbitrary chosen string" | calc_sha256_checksum_stdin)
+       write_checksum $chks0 $TGT_IMG
+       write_checksum $chks1 $TMPDIR/hdr1
+       write_luks2_bin_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       chks_res1=$(read_sha256_checksum $TMPDIR/hdr1)
+       test "$chks0" = "$chks_res0" || exit 2
+       test "$chks1" = "$chks_res1" || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-checksum-hdr0.img.sh b/tests/generators/generate-luks2-invalid-checksum-hdr0.img.sh
new file mode 100755 (executable)
index 0000000..ac75ccb
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate header with bad checksum in primary binary header
+#
+
+# 1 full target dir
+# 2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+}
+
+function generate()
+{
+       chks=$(echo "Arbitrary chosen string: D'oh!" | calc_sha256_checksum_stdin)
+       write_checksum $chks $TGT_IMG
+}
+
+function check()
+{
+       chks_res=$(read_sha256_checksum $TGT_IMG)
+       test "$chks" = "$chks_res" || exit 2
+}
+
+#function cleanup()
+#{
+#}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+#cleanup
diff --git a/tests/generators/generate-luks2-invalid-checksum-hdr1.img.sh b/tests/generators/generate-luks2-invalid-checksum-hdr1.img.sh
new file mode 100755 (executable)
index 0000000..f0ca01a
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate header with bad checksum in secondary binary header
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       chks=$(echo "Arbitrary chosen string: D'oh!" | calc_sha256_checksum_stdin)
+       write_checksum $chks $TMPDIR/hdr1
+       write_luks2_bin_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       chks_res=$(read_sha256_checksum $TMPDIR/hdr1)
+       test "$chks" = "$chks_res" || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-json-size-c0.img.sh b/tests/generators/generate-luks2-invalid-json-size-c0.img.sh
new file mode 100755 (executable)
index 0000000..2866b0b
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with invalid json_size in config section
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       JS=$(((LUKS2_HDR_SIZE-LUKS2_BIN_HDR_SIZE)*512+4096))
+       json_str=$(jq -c --arg js $JS '.config.json_size = ($js | tostring)' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c --arg js $JS 'if .config.json_size != ($js | tostring )
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-json-size-c1.img.sh b/tests/generators/generate-luks2-invalid-json-size-c1.img.sh
new file mode 100755 (executable)
index 0000000..dcab9bc
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with invalid json_size in config section
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       JS=$(((LUKS2_HDR_SIZE-LUKS2_BIN_HDR_SIZE)*512-4096))
+       json_str=$(jq -c --arg js $JS '.config.json_size = ($js | tostring)' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c --arg js $JS 'if .config.json_size != ($js | tostring )
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-json-size-c2.img.sh b/tests/generators/generate-luks2-invalid-json-size-c2.img.sh
new file mode 100755 (executable)
index 0000000..6de411a
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with config json size mismatching
+# value in binary header
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       JS=$(((LUKS2_HDR_SIZE-LUKS2_BIN_HDR_SIZE)*512))
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_32K
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+
+       json_str=$(jq -c '.' $TMPDIR/json0)
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0
+       local str_res1=$(head -c 4 $TMPDIR/hdr_res0)
+       test "$str_res1" = "LUKS" || exit 2
+
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 4 $TMPDIR/hdr_res1)
+       test "$str_res1" = "SKUL" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c --arg js $JS 'if .config.json_size != ( $js | tostring )
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-keyslots-size-c0.img.sh b/tests/generators/generate-luks2-invalid-keyslots-size-c0.img.sh
new file mode 100755 (executable)
index 0000000..c4f002f
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with too large keyslots_size set in config section
+# (iow config.keyslots_size = data_offset - keyslots_offset + 512)
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # make area 7 being included in area 6
+       OFFS=$((2*LUKS2_HDR_SIZE*512))
+       json_str=$(jq -c --arg off $OFFS '.config.keyslots_size = (.segments."0".offset | tonumber - ($off | tonumber) + 4096 | tostring)' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       # [.keyslots[].area.offset | tonumber] | max | tostring ---> max offset in keyslot areas
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c --arg off $OFFS 'if .config.keyslots_size != ( .segments."0".offset | tonumber - ($off | tonumber) + 4096 | tostring )
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-keyslots-size-c1.img.sh b/tests/generators/generate-luks2-invalid-keyslots-size-c1.img.sh
new file mode 100755 (executable)
index 0000000..eff2064
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with unaligned keyslots_size config section
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       json_str=$(jq -c '.config.keyslots_size = (.config.keyslots_size | tonumber - 1 | tostring)' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if (.config.keyslots_size | tonumber % 4096) == 0
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-keyslots-size-c2.img.sh b/tests/generators/generate-luks2-invalid-keyslots-size-c2.img.sh
new file mode 100755 (executable)
index 0000000..f70f39f
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with keyslots_size less than sum of all keyslots area
+# in json
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       json_str=$(jq '.config.keyslots_size = ([.keyslots[].area.size] | map(tonumber) | add - 4096 | tostring )' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .config.keyslots_size != ([.keyslots[].area.size ] | map(tonumber) | add - 4096 | tostring)
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-object-type-json0.img.sh b/tests/generators/generate-luks2-invalid-object-type-json0.img.sh
new file mode 100755 (executable)
index 0000000..1063864
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with well-formed json format
+# where top level value is not of type object.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json0
+       json_str="[$json_str]" # make top level value an array
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       printf "%s" "$json_str" | _dd of=$TMPDIR/json0 bs=1 conv=notrunc
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       read -r json_str_res0 < $TMPDIR/json_res0
+       test "$json_str" = "$json_str_res0" || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-invalid-opening-char-json0.img.sh b/tests/generators/generate-luks2-invalid-opening-char-json0.img.sh
new file mode 100755 (executable)
index 0000000..996d997
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with well-formed json prefixed
+# with useless whitespace.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json0
+       json_str=" $json_str" # add useless opening whitespace
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       printf "%s" "$json_str" | _dd of=$TMPDIR/json0 bs=1 conv=notrunc
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       IFS= read -r json_str_res0 < $TMPDIR/json_res0
+       test "$json_str" = "$json_str_res0" || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-keyslot-missing-digest.img.sh b/tests/generators/generate-luks2-keyslot-missing-digest.img.sh
new file mode 100755 (executable)
index 0000000..1914581
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with luks2 keyslot not assigned
+# to any digest.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str_orig < $TMPDIR/json0
+       arr_len=$(jq -c -M '.digests."0".keyslots | length' $TMPDIR/json0)
+       # remove first element from digests."0".keyslots array
+       json_str=$(jq -r -c -M 'del(.digests."0".keyslots[0])' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_arr_len=$(jq -c -M '.digests."0".keyslots | length' $TMPDIR/json_res0)
+       test $((arr_len-1)) -eq $new_arr_len || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-keyslot-too-many-digests.img.sh b/tests/generators/generate-luks2-keyslot-too-many-digests.img.sh
new file mode 100755 (executable)
index 0000000..5e1d6ef
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with luks2 keyslot assigned
+# to more than 1 digest.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # add keyslot 1 to second digest
+       json_str=$(jq -r -c -M '.digests."1" = .digests."0" | .digests."1".keyslots = ["1"]' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_arr_len=$(jq -c -M '.digests."1".keyslots | length' $TMPDIR/json_res0)
+       test 1 -eq $new_arr_len || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-128k-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-128k-secondary.img.sh
new file mode 100755 (executable)
index 0000000..ca6b0c8
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate secondary header with one of allowed json area
+# size values. Test whether auto-recovery code is able
+# to validate secondary header with non-default json area
+# size.
+#
+# primary header is corrupted on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 128 KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_128K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-128k.img.sh b/tests/generators/generate-luks2-metadata-size-128k.img.sh
new file mode 100755 (executable)
index 0000000..fe76598
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 128KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_128K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-16k-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-16k-secondary.img.sh
new file mode 100755 (executable)
index 0000000..14a6613
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate secondary header with one of allowed json area
+# size values. Test whether auto-recovery code is able
+# to validate secondary header with non-default json area
+# size.
+#
+# primary header is corrupted on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 16 KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-1m-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-1m-secondary.img.sh
new file mode 100755 (executable)
index 0000000..fdcd715
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate secondary header with one of allowed json area
+# size values. Test whether auto-recovery code is able
+# to validate secondary header with non-default json area
+# size.
+#
+# primary header is corrupted on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 1 MiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_1M
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-1m.img.sh b/tests/generators/generate-luks2-metadata-size-1m.img.sh
new file mode 100755 (executable)
index 0000000..25722dd
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 1 MiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_1M
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-256k-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-256k-secondary.img.sh
new file mode 100755 (executable)
index 0000000..0ed66e1
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate secondary header with one of allowed json area
+# size values. Test whether auto-recovery code is able
+# to validate secondary header with non-default json area
+# size.
+#
+# primary header is corrupted on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 256 KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_256K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-256k.img.sh b/tests/generators/generate-luks2-metadata-size-256k.img.sh
new file mode 100755 (executable)
index 0000000..aa5df05
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 256KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_256K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-2m-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-2m-secondary.img.sh
new file mode 100755 (executable)
index 0000000..4773c94
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 2 MiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_2M
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-2m.img.sh b/tests/generators/generate-luks2-metadata-size-2m.img.sh
new file mode 100755 (executable)
index 0000000..ae9bc30
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 2 MiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_2M
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-32k-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-32k-secondary.img.sh
new file mode 100755 (executable)
index 0000000..af18f43
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate secondary header with one of allowed json area
+# size values. Test whether auto-recovery code is able
+# to validate secondary header with non-default json area
+# size.
+#
+# primary header is corrupted on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 32 KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_32K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-32k.img.sh b/tests/generators/generate-luks2-metadata-size-32k.img.sh
new file mode 100755 (executable)
index 0000000..40c921e
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with non-default metadata json_size.
+# There's only limited set of values allowed as json size in
+# config section of LUKS2 metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 32KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_32K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-4m-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-4m-secondary.img.sh
new file mode 100755 (executable)
index 0000000..332d67e
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 4 MiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_4M
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-4m.img.sh b/tests/generators/generate-luks2-metadata-size-4m.img.sh
new file mode 100755 (executable)
index 0000000..21715fb
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 4 MiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_4M
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-512k-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-512k-secondary.img.sh
new file mode 100755 (executable)
index 0000000..581dea0
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate secondary header with one of allowed json area
+# size values. Test whether auto-recovery code is able
+# to validate secondary header with non-default json area
+# size.
+#
+# primary header is corrupted on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 512 KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_512K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-512k.img.sh b/tests/generators/generate-luks2-metadata-size-512k.img.sh
new file mode 100755 (executable)
index 0000000..8b196e6
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 512KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_512K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-64k-inv-area-c0.img.sh b/tests/generators/generate-luks2-metadata-size-64k-inv-area-c0.img.sh
new file mode 100755 (executable)
index 0000000..16e2078
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with non-default metadata json_size
+# and keyslots area trespassing in json area.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 64KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_64K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024-1))
+       # overlap in json area by exactly one byte
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024-1))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-64k-inv-area-c1.img.sh b/tests/generators/generate-luks2-metadata-size-64k-inv-area-c1.img.sh
new file mode 100755 (executable)
index 0000000..7ff670b
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with non-default metadata json_size
+# and keyslot area overflowing out of keyslots area.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 64KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_64K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                        --arg mda $((2*TEST_MDA_SIZE_BYTES)) \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .keyslots."7".area.offset = ( ((.config.keyslots_size | tonumber) + ($mda | tonumber) - (.keyslots."7".area.size | tonumber) + 1) | tostring ) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+# .keyslots.7.area.offset = ( ((.config.keyslots_size | tonumber) + ($mda | tonumber) - (.keyslots.7.area.size | tonumber) + 1) | tostring ) |
+       jq -c --arg mda $((2*TEST_MDA_SIZE_BYTES)) --arg jsize $JSON_SIZE \
+               'if (.keyslots."7".area.offset != ( ((.config.keyslots_size | tonumber) + ($mda | tonumber) - (.keyslots."7".area.size | tonumber) + 1) | tostring )) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-64k-inv-keyslots-size-c0.img.sh b/tests/generators/generate-luks2-metadata-size-64k-inv-keyslots-size-c0.img.sh
new file mode 100755 (executable)
index 0000000..8f3d8d7
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size where keyslots size
+# overflows in data area (segment offset)
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 64KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_64K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                        --arg mda $((2*TEST_MDA_SIZE_BYTES)) \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .config.keyslots_size = (((($off | tonumber) - ($mda | tonumber) + 4096)) | tostring ) |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE --arg off $DATA_OFFSET --arg mda $((2*TEST_MDA_SIZE_BYTES)) \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize) or
+                   (.config.keyslots_size != (((($off | tonumber) - ($mda | tonumber) + 4096)) | tostring ))
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-64k-secondary.img.sh b/tests/generators/generate-luks2-metadata-size-64k-secondary.img.sh
new file mode 100755 (executable)
index 0000000..1b246cc
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate secondary header with one of allowed json area
+# size values. Test whether auto-recovery code is able
+# to validate secondary header with non-default json area
+# size.
+#
+# primary header is corrupted on purpose.
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 64 KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_64K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       write_bin_hdr_offset $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area0
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr_res0 $TEST_MDA_SIZE
+       local str_res0=$(head -c 6 $TMPDIR/hdr_res0)
+       test "$str_res0" = "VACUUM" || exit 2
+       read_luks2_json1 $TGT_IMG $TMPDIR/json_res1 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res1 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-metadata-size-64k.img.sh b/tests/generators/generate-luks2-metadata-size-64k.img.sh
new file mode 100755 (executable)
index 0000000..4e320f2
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary with predefined json_size. There's only limited
+# set of values allowed as json size in config section of LUKS2
+# metadata
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # 64KiB metadata
+       TEST_MDA_SIZE=$LUKS2_HDR_SIZE_64K
+
+       TEST_MDA_SIZE_BYTES=$((TEST_MDA_SIZE*512))
+       TEST_JSN_SIZE=$((TEST_MDA_SIZE-LUKS2_BIN_HDR_SIZE))
+       KEYSLOTS_OFFSET=$((TEST_MDA_SIZE*1024))
+       JSON_DIFF=$(((TEST_MDA_SIZE-LUKS2_HDR_SIZE)*1024))
+       JSON_SIZE=$((TEST_JSN_SIZE*512))
+       DATA_OFFSET=16777216
+
+       json_str=$(jq -c --arg jdiff $JSON_DIFF --arg jsize $JSON_SIZE --arg off $DATA_OFFSET \
+                  '.keyslots[].area.offset |= ( . | tonumber + ($jdiff | tonumber) | tostring) |
+                   .config.json_size = $jsize |
+                   .segments."0".offset = $off' $TMPDIR/json0)
+       test -n "$json_str" || exit 2
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0 $TEST_JSN_SIZE
+
+       write_bin_hdr_size $TMPDIR/hdr0 $TEST_MDA_SIZE_BYTES
+       write_bin_hdr_size $TMPDIR/hdr1 $TEST_MDA_SIZE_BYTES
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0 $TEST_JSN_SIZE
+       merge_bin_hdr_with_json $TMPDIR/hdr1 $TMPDIR/json0 $TMPDIR/area1 $TEST_JSN_SIZE
+
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+
+       erase_checksum $TMPDIR/area1
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area1)
+       write_checksum $chks0 $TMPDIR/area1
+
+       kill_bin_hdr $TMPDIR/area1
+
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG $TEST_MDA_SIZE
+       write_luks2_hdr1 $TMPDIR/area1 $TGT_IMG $TEST_MDA_SIZE
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1 $TEST_MDA_SIZE
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0 $TEST_JSN_SIZE
+       jq -c --arg koff $KEYSLOTS_OFFSET --arg jsize $JSON_SIZE \
+               'if ([.keyslots[].area.offset] | map(tonumber) | min | tostring != $koff) or
+                   (.config.json_size != $jsize)
+               then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-missing-keyslot-referenced-in-digest.img.sh b/tests/generators/generate-luks2-missing-keyslot-referenced-in-digest.img.sh
new file mode 100755 (executable)
index 0000000..d6ebe3d
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with missing keyslot object referenced
+# in digest object
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str_orig < $TMPDIR/json0
+       arr_len=$(jq -c -M '.digests."0".keyslots | length' $TMPDIR/json0)
+       # add missing keyslot reference in keyslots array of digest '0'
+       json_str=$(jq -r -c -M 'def arr: ["digests", "0", "keyslots"];
+              def missks: getpath(["keyslots"]) | keys | max | tonumber + 1 | tostring;
+              setpath(arr; getpath(arr) + [ missks ])' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_arr_len=$(jq -c -M '.digests."0".keyslots | length' $TMPDIR/json_res0)
+       test $((arr_len+1)) -eq $new_arr_len || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-missing-keyslot-referenced-in-token.img.sh b/tests/generators/generate-luks2-missing-keyslot-referenced-in-token.img.sh
new file mode 100755 (executable)
index 0000000..85798e5
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with missing keyslot object referenced
+# in token object
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str_orig < $TMPDIR/json0
+       # add missing keyslot reference in keyslots array of token '0'
+       json_str=$(jq -r -c -M 'def missks: getpath(["keyslots"]) | keys | max | tonumber + 1 | tostring;
+             .tokens += {"0":{"type":"dummy","keyslots":[ "0", missks ]}}' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_arr_len=$(jq -c -M '.tokens."0".keyslots | length' $TMPDIR/json_res0)
+       test $new_arr_len -eq 2 || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-missing-segment-referenced-in-digest.img.sh b/tests/generators/generate-luks2-missing-segment-referenced-in-digest.img.sh
new file mode 100755 (executable)
index 0000000..333462b
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with missing segment object referenced
+# in digest object
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str_orig < $TMPDIR/json0
+       arr_len=$(jq -c -M '.digests."0".segments | length' $TMPDIR/json0)
+       # add missing keyslot reference in keyslots array of digest '0'
+       json_str=$(jq -c 'def arr: ["digests", "0", "segments"];
+              def missseg: getpath(["segments"]) | keys | max | tonumber + 1 | tostring;
+              setpath(arr; getpath(arr) + [ missseg ])' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_arr_len=$(jq -c -M '.digests."0".segments | length' $TMPDIR/json_res0)
+       test $((arr_len+1)) -eq $new_arr_len || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-missing-trailing-null-byte-json0.img.sh b/tests/generators/generate-luks2-missing-trailing-null-byte-json0.img.sh
new file mode 100755 (executable)
index 0000000..916cff7
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with well-formed json but missing
+# trailing null byte.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+PATTERN="\"config\":{"
+KEY="\"config_key\":\""
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json0
+       json_len=${#json_str}
+       pindex=$(strindex $json_str $PATTERN)
+       test $pindex -gt 0 || exit 2
+
+       offset=${#PATTERN}
+       offset=$((offset+pindex))
+       key_len=${#KEY}
+       remain=$((LUKS2_JSON_SIZE*512-key_len-json_len-1)) # -1: closing '"'
+       if [ ${json_str:offset:1} = "}" ]; then
+               format_str="%s%s%s"
+       else
+               format_str="%s%s,%s"
+               remain=$((remain-1)) # also count with separating ','
+       fi
+       test $remain -gt 0 || exit 2
+
+       fill=$(repeat_str "X" $remain)
+       fill=$(repeat_str "X" $remain)"\""
+
+       printf $format_str $KEY $fill ${json_str:$offset} | _dd of=$TMPDIR/json0 bs=1 seek=$offset conv=notrunc
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       read -r json_str_res0 < $TMPDIR/json_res0
+       test ${#json_str_res0} -eq $((LUKS2_JSON_SIZE*512)) || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-non-null-byte-beyond-json0.img.sh b/tests/generators/generate-luks2-non-null-byte-beyond-json0.img.sh
new file mode 100755 (executable)
index 0000000..fbd8cd6
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with json area concluded with illegal
+# byte beyond terminating '}' character.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json0
+       json_str="$json_str"X # add illegal 'X' beyond json format
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       printf '%s' $json_str | _dd of=$TMPDIR/json0 bs=1 conv=notrunc
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       read -r json_str_res0 < $TMPDIR/json_res0
+       local len=${#json_str_res0}
+       len=$((len-1))
+       test ${json_str_res0:len:1} = "X" || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-non-null-bytes-beyond-json0.img.sh b/tests/generators/generate-luks2-non-null-bytes-beyond-json0.img.sh
new file mode 100755 (executable)
index 0000000..7d46628
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with json area containing illegal bytes
+# beyond well-formed json format.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+QUOTE="[Homer J. Simpson]: Keep looking shocked and move slowly towards the cake."
+SPACE=20
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       read -r json_str < $TMPDIR/json0
+       json_len_orig=${#json_str}
+       json_len=$((json_len_orig+${#QUOTE}+SPACE))
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       printf '%s' "$QUOTE" | _dd of=$TMPDIR/json0 seek=$((json_len_orig+SPACE)) bs=1 conv=notrunc
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+
+       _dd if=$TMPDIR/json_res0 of=$TMPDIR/quote skip=$((json_len_orig+SPACE)) count=${#QUOTE} bs=1
+       json_str_res0=$(head -c ${#QUOTE} $TMPDIR/quote)
+       test "$json_str_res0" = "$QUOTE" || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-overlapping-areas-c0-json0.img.sh b/tests/generators/generate-luks2-overlapping-areas-c0-json0.img.sh
new file mode 100755 (executable)
index 0000000..c319ca3
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with two exactly same areas in terms of 'offset' and 'length'.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # copy area 6 offset and length into area 7
+       json_str=$(jq -c '.keyslots."7".area.offset = .keyslots."6".area.offset |
+              .keyslots."7".area.size = .keyslots."6".area.size' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if (.keyslots."6".area.offset != .keyslots."7".area.offset) or (.keyslots."6".area.size != .keyslots."7".area.size)
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-overlapping-areas-c1-json0.img.sh b/tests/generators/generate-luks2-overlapping-areas-c1-json0.img.sh
new file mode 100755 (executable)
index 0000000..39f0c6a
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with one area included within another one (in terms of 'offset' + 'length')
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # make area 7 being included in area 6
+       json_str=$(jq -c '.keyslots."7".area.offset = (.keyslots."6".area.offset | tonumber + 1 | tostring ) |
+              .keyslots."7".area.size = ( .keyslots."6".area.size | tonumber - 1 | tostring)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if (.keyslots."7".area.offset != (.keyslots."6".area.offset | tonumber + 1 | tostring)) or
+                 (.keyslots."7".area.size != (.keyslots."6".area.size | tonumber - 1 | tostring)) or
+                 (.keyslots."7".area.size | tonumber <= 0)
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-overlapping-areas-c2-json0.img.sh b/tests/generators/generate-luks2-overlapping-areas-c2-json0.img.sh
new file mode 100755 (executable)
index 0000000..4c02008
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with one area slightly cross the boundary of another one
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # make area 7 being included in area 6
+       json_str=$(jq -c '.keyslots."7".area.offset = ([ .keyslots."6".area.offset, .keyslots."6".area.size ] | map(tonumber) | add - 1 | tostring)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .keyslots."7".area.offset != ([.keyslots."6".area.offset, .keyslots."6".area.size ] | map(tonumber) | add - 1 | tostring)
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-pbkdf2-leftover-params-0.img.sh b/tests/generators/generate-luks2-pbkdf2-leftover-params-0.img.sh
new file mode 100755 (executable)
index 0000000..1517ed6
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with luks2 keyslot kdf object
+# having left over params.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # add keyslot 1 to second digest
+       obj_len=$(jq -c -M '.keyslots."2".kdf | length' $TMPDIR/json0)
+       json_str=$(jq -r -c -M '.keyslots."2".kdf.type = "argon2i" | .keyslots."2".kdf.iterations = 1001 | .keyslots."2".kdf.hash = "sha256"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_obj_len=$(jq -c -M '.keyslots."2".kdf | length' $TMPDIR/json_res0)
+       test $((obj_len+2)) -eq $new_obj_len || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-pbkdf2-leftover-params-1.img.sh b/tests/generators/generate-luks2-pbkdf2-leftover-params-1.img.sh
new file mode 100755 (executable)
index 0000000..c6aa5bf
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with luks2 keyslot kdf object
+# having left over params.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # add keyslot 1 to second digest
+       obj_len=$(jq -c -M '.keyslots."2".kdf | length' $TMPDIR/json0)
+       json_str=$(jq -r -c -M '.keyslots."2".kdf.type = "argon2id" | .keyslots."2".kdf.iterations = 1001 | .keyslots."2".kdf.hash = "sha256"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       chks_res0=$(read_sha256_checksum $TGT_IMG)
+       test "$chks0" = "$chks_res0" || exit 2
+       new_obj_len=$(jq -c -M '.keyslots."2".kdf | length' $TMPDIR/json_res0)
+       test $((obj_len+2)) -eq $new_obj_len || exit 2
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-missing-encryption.img.sh b/tests/generators/generate-luks2-segment-crypt-missing-encryption.img.sh
new file mode 100755 (executable)
index 0000000..bcd648a
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment encryption field missing
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c 'del(.segments."0".encryption)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".encryption
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-missing-ivoffset.img.sh b/tests/generators/generate-luks2-segment-crypt-missing-ivoffset.img.sh
new file mode 100755 (executable)
index 0000000..e64feef
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment iv_tweak field missing
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c 'del(.segments."0".iv_tweak)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".iv_tweak
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-missing-sectorsize.img.sh b/tests/generators/generate-luks2-segment-crypt-missing-sectorsize.img.sh
new file mode 100755 (executable)
index 0000000..de757db
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment sector_size field missing
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c 'del(.segments."0".sector_size)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".sector_size
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-wrong-encryption.img.sh b/tests/generators/generate-luks2-segment-crypt-wrong-encryption.img.sh
new file mode 100755 (executable)
index 0000000..59c7345
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment wrong encryption field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".encryption = {}' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".encryption | type != "object"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-wrong-ivoffset.img.sh b/tests/generators/generate-luks2-segment-crypt-wrong-ivoffset.img.sh
new file mode 100755 (executable)
index 0000000..ca9461e
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment iv_tweak field missing
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".iv_tweak = "dynamic"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".iv_tweak != "dynamic"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-0.img.sh b/tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-0.img.sh
new file mode 100755 (executable)
index 0000000..4ca05eb
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment sector_size field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".sector_size = 1023' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".sector_size != 1023
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-1.img.sh b/tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-1.img.sh
new file mode 100755 (executable)
index 0000000..f8d251c
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment sector_size field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".sector_size = "4096"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".sector_size != "4096"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-2.img.sh b/tests/generators/generate-luks2-segment-crypt-wrong-sectorsize-2.img.sh
new file mode 100755 (executable)
index 0000000..87566ec
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment sector_size field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".sector_size = -1024' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".sector_size != -1024
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-missing-offset.img.sh b/tests/generators/generate-luks2-segment-missing-offset.img.sh
new file mode 100755 (executable)
index 0000000..6652288
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment offset field missing
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c 'del(.segments."0".offset)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".offset
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-missing-size.img.sh b/tests/generators/generate-luks2-segment-missing-size.img.sh
new file mode 100755 (executable)
index 0000000..616d8b3
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment size field missing
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c 'del(.segments."0".size)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".size
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-missing-type.img.sh b/tests/generators/generate-luks2-segment-missing-type.img.sh
new file mode 100755 (executable)
index 0000000..d0014a2
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment type field missing
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c 'del(.segments."0".type)' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".type
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-two.img.sh b/tests/generators/generate-luks2-segment-two.img.sh
new file mode 100755 (executable)
index 0000000..743bbbb
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with two segments
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".size = "512" | .segments."1" = {type:"some", offset: (.segments."0".offset | tonumber + 512 | tostring), size: "dynamic"}' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."1" | type != "object"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-unknown-type.img.sh b/tests/generators/generate-luks2-segment-unknown-type.img.sh
new file mode 100755 (executable)
index 0000000..a6ef8ad
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with generic (unknown) segment type.
+# It should pass the validation.
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0" = {type:"some_type", offset: .segments."0".offset, size: .segments."0".size, a_field:0}' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".type != "some_type"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-wrong-flags-element.img.sh b/tests/generators/generate-luks2-segment-wrong-flags-element.img.sh
new file mode 100755 (executable)
index 0000000..5359954
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment flags containing invalid type
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".flags = [ "hello", 1 ]' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".flags != [ "hello", 1  ]
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-wrong-flags.img.sh b/tests/generators/generate-luks2-segment-wrong-flags.img.sh
new file mode 100755 (executable)
index 0000000..3ceddbf
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment flags field of invalid type
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".flags = "hello"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".flags != "hello"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-wrong-offset.img.sh b/tests/generators/generate-luks2-segment-wrong-offset.img.sh
new file mode 100755 (executable)
index 0000000..9efc756
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment offset field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".offset = "-42"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".offset != "-42"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-wrong-size-0.img.sh b/tests/generators/generate-luks2-segment-wrong-size-0.img.sh
new file mode 100755 (executable)
index 0000000..58b12ef
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment size field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".size = 4096' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".size != 4096
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-wrong-size-1.img.sh b/tests/generators/generate-luks2-segment-wrong-size-1.img.sh
new file mode 100755 (executable)
index 0000000..8171445
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment size field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".size = "automatic"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".size != "automatic"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-wrong-size-2.img.sh b/tests/generators/generate-luks2-segment-wrong-size-2.img.sh
new file mode 100755 (executable)
index 0000000..f694cf7
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment size field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".size = "511"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".size != "511"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-segment-wrong-type.img.sh b/tests/generators/generate-luks2-segment-wrong-type.img.sh
new file mode 100755 (executable)
index 0000000..4f7fd64
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with wrong segment type field
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # remove mandatory encryption field
+       json_str=$(jq -c '.segments."0".type = 42' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".type != 42
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-uint64-max-segment-size.img.sh b/tests/generators/generate-luks2-uint64-max-segment-size.img.sh
new file mode 100755 (executable)
index 0000000..27d7fd2
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment size set to UINT64_MAX - 511
+# (512 sector aligned value)
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # UINT64_MAX - 511 (so that it's sector aligned)
+       json_str=$(jq -c '.segments."0".size = "18446744073709551104"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".size != "18446744073709551104"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-uint64-overflow-segment-size.img.sh b/tests/generators/generate-luks2-uint64-overflow-segment-size.img.sh
new file mode 100755 (executable)
index 0000000..01657d6
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment size set to UINT64_MAX + 1
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       json_str=$(jq -c '.segments."0".size = "18446744073709551616"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".size != "18446744073709551616"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/generate-luks2-uint64-signed-segment-size.img.sh b/tests/generators/generate-luks2-uint64-signed-segment-size.img.sh
new file mode 100755 (executable)
index 0000000..0a45a05
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. lib.sh
+
+#
+# *** Description ***
+#
+# generate primary header with segment size set to -512
+#
+# secondary header is corrupted on purpose as well
+#
+
+# $1 full target dir
+# $2 full source luks2 image
+
+function prepare()
+{
+       cp $SRC_IMG $TGT_IMG
+       test -d $TMPDIR || mkdir $TMPDIR
+       read_luks2_json0 $TGT_IMG $TMPDIR/json0
+       read_luks2_bin_hdr0 $TGT_IMG $TMPDIR/hdr0
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr1
+}
+
+function generate()
+{
+       # UINT64_MAX + 1 (it's 512 sector aligned)
+       json_str=$(jq -c '.segments."0".size = "-512"' $TMPDIR/json0)
+       test ${#json_str} -lt $((LUKS2_JSON_SIZE*512)) || exit 2
+
+       write_luks2_json "$json_str" $TMPDIR/json0
+
+       merge_bin_hdr_with_json $TMPDIR/hdr0 $TMPDIR/json0 $TMPDIR/area0
+       erase_checksum $TMPDIR/area0
+       chks0=$(calc_sha256_checksum_file $TMPDIR/area0)
+       write_checksum $chks0 $TMPDIR/area0
+       write_luks2_hdr0 $TMPDIR/area0 $TGT_IMG
+       kill_bin_hdr $TMPDIR/hdr1
+       write_luks2_hdr1 $TMPDIR/hdr1 $TGT_IMG
+}
+
+function check()
+{
+       read_luks2_bin_hdr1 $TGT_IMG $TMPDIR/hdr_res1
+       local str_res1=$(head -c 6 $TMPDIR/hdr_res1)
+       test "$str_res1" = "VACUUM" || exit 2
+
+       read_luks2_json0 $TGT_IMG $TMPDIR/json_res0
+       jq -c 'if .segments."0".size != "-512"
+              then error("Unexpected value in result json") else empty end' $TMPDIR/json_res0 || exit 5
+}
+
+function cleanup()
+{
+       rm -f $TMPDIR/*
+       rm -fd $TMPDIR
+}
+
+test $# -eq 2 || exit 1
+
+TGT_IMG=$1/$(test_img_name $0)
+SRC_IMG=$2
+
+prepare
+generate
+check
+cleanup
diff --git a/tests/generators/lib.sh b/tests/generators/lib.sh
new file mode 100644 (file)
index 0000000..9686148
--- /dev/null
@@ -0,0 +1,180 @@
+#!/bin/bash
+
+# all in 512 bytes blocks (including binary hdr (4KiB))
+LUKS2_HDR_SIZE=32              #  16 KiB
+LUKS2_HDR_SIZE_32K=64          #  32 KiB
+LUKS2_HDR_SIZE_64K=128         #  64 KiB
+LUKS2_HDR_SIZE_128K=256                # 128 KiB
+LUKS2_HDR_SIZE_256K=512                # 256 KiB
+LUKS2_HDR_SIZE_512K=1024       # 512 KiB
+LUKS2_HDR_SIZE_1M=2048         #   1 MiB
+LUKS2_HDR_SIZE_2M=4096         #   2 MiB
+LUKS2_HDR_SIZE_4M=8192         #   4 MiB
+
+LUKS2_BIN_HDR_SIZE=8           #   4 KiB
+LUKS2_JSON_SIZE=$((LUKS2_HDR_SIZE-LUKS2_BIN_HDR_SIZE))
+
+LUKS2_BIN_HDR_CHKS_OFFSET=0x1C0
+LUKS2_BIN_HDR_CHKS_LENGTH=64
+
+[ -z "$srcdir" ] && srcdir="."
+TMPDIR=$srcdir/tmp
+
+repeat_str() {
+       printf "$1"'%.0s' $(eval "echo {1.."$(($2))"}");
+}
+
+function strindex()
+{
+       local x="${1%%$2*}"
+       [[ $x = $1 ]] && echo -1 || echo ${#x}
+}
+
+function test_img_name()
+{
+       local str=$(basename $1)
+       str=${str#generate-}
+       str=${str%%.sh}
+       echo $str
+}
+
+# read primary bin hdr
+# 1:from 2:to
+function read_luks2_bin_hdr0()
+{
+       _dd if=$1 of=$2 bs=512 count=$LUKS2_BIN_HDR_SIZE
+}
+
+# read primary json area
+# 1:from 2:to 3:[json only size (defaults to 12KiB)]
+function read_luks2_json0()
+{
+       local _js=${4:-$LUKS2_JSON_SIZE}
+       local _js=$((_js*512/4096))
+       _dd if=$1 of=$2 bs=4096 skip=1 count=$_js
+}
+
+# read secondary bin hdr
+# 1:from 2:to 3:[metadata size (defaults to 16KiB)]
+function read_luks2_bin_hdr1()
+{
+       _dd if=$1 of=$2 skip=${3:-$LUKS2_HDR_SIZE} bs=512 count=$LUKS2_BIN_HDR_SIZE
+}
+
+# read secondary json area
+# 1:from 2:to 3:[json only size (defaults to 12KiB)]
+function read_luks2_json1()
+{
+       local _js=${3:-$LUKS2_JSON_SIZE}
+       _dd if=$1 of=$2 bs=512 skip=$((2*LUKS2_BIN_HDR_SIZE+_js)) count=$_js
+}
+
+# read primary metadata area (bin + json)
+# 1:from 2:to 3:[metadata size (defaults to 16KiB)]
+function read_luks2_hdr_area0()
+{
+       local _as=${3:-$LUKS2_HDR_SIZE}
+       local _as=$((_as*512))
+       _dd if=$1 of=$2 bs=$_as count=1
+}
+
+# read secondary metadata area (bin + json)
+# 1:from 2:to 3:[metadata size (defaults to 16KiB)]
+function read_luks2_hdr_area1()
+{
+       local _as=${3:-$LUKS2_HDR_SIZE}
+       local _as=$((_as*512))
+       _dd if=$1 of=$2 bs=$_as skip=1 count=1
+}
+
+# write secondary bin hdr
+# 1:from 2:to 3:[metadata size (defaults to 16KiB)]
+function write_luks2_bin_hdr1()
+{
+       _dd if=$1 of=$2 bs=512 seek=${3:-$LUKS2_HDR_SIZE} count=$LUKS2_BIN_HDR_SIZE conv=notrunc
+}
+
+# write primary metadata area (bin + json)
+# 1:from 2:to 3:[metadata size (defaults to 16KiB)]
+function write_luks2_hdr0()
+{
+       local _as=${3:-$LUKS2_HDR_SIZE}
+       local _as=$((_as*512))
+       _dd if=$1 of=$2 bs=$_as count=1 conv=notrunc
+}
+
+# write secondary metadata area (bin + json)
+# 1:from 2:to 3:[metadata size (defaults to 16KiB)]
+function write_luks2_hdr1()
+{
+       local _as=${3:-$LUKS2_HDR_SIZE}
+       local _as=$((_as*512))
+       _dd if=$1 of=$2 bs=$_as seek=1 count=1 conv=notrunc
+}
+
+# write json (includes padding)
+# 1:json_string 2:to 3:[json size (defaults to 12KiB)]
+function write_luks2_json()
+{
+       local _js=${3:-$LUKS2_JSON_SIZE}
+       local len=${#1}
+       echo -n -E "$1" > $2
+       truncate -s $((_js*512)) $2
+}
+
+function kill_bin_hdr()
+{
+       printf "VACUUM" | _dd of=$1 bs=1 conv=notrunc
+}
+
+function erase_checksum()
+{
+       _dd if=/dev/zero of=$1 bs=1 seek=$(printf %d $LUKS2_BIN_HDR_CHKS_OFFSET) count=$LUKS2_BIN_HDR_CHKS_LENGTH conv=notrunc
+}
+
+function read_sha256_checksum()
+{
+       _dd if=$1 bs=1 skip=$(printf %d $LUKS2_BIN_HDR_CHKS_OFFSET) count=32 | xxd -c 32 -p
+}
+
+# 1 - string with checksum
+function write_checksum()
+{
+       test $# -eq 2 || return 1
+       test $((${#1}/2)) -le $LUKS2_BIN_HDR_CHKS_LENGTH || { echo "too long"; return 1; }
+
+       echo $1 | xxd -r -p | _dd of=$2 bs=1 seek=$(printf %d $LUKS2_BIN_HDR_CHKS_OFFSET) conv=notrunc
+}
+
+function calc_sha256_checksum_file()
+{
+       sha256sum $1 | cut -d ' ' -f 1
+}
+
+function calc_sha256_checksum_stdin()
+{
+       sha256sum - | cut -d ' ' -f 1
+}
+
+# merge bin hdr with json to form metadata area
+# 1:bin_hdr 2:json 3:to 4:[json size (defaults to 12KiB)]
+function merge_bin_hdr_with_json()
+{
+       local _js=${4:-$LUKS2_JSON_SIZE}
+       local _js=$((_js*512/4096))
+       _dd if=$1 of=$3 bs=4096 count=1
+       _dd if=$2 of=$3 bs=4096 seek=1 count=$_js
+}
+
+function _dd()
+{
+       dd $@ status=none
+}
+
+function write_bin_hdr_size() {
+        printf '%016x' $2 | xxd -r -p -l 16 | _dd of=$1 bs=8 count=1 seek=1 conv=notrunc
+}
+
+function write_bin_hdr_offset() {
+        printf '%016x' $2 | xxd -r -p -l 16 | _dd of=$1 bs=8 count=1 seek=32 conv=notrunc
+}
diff --git a/tests/img_fs_ext4.img.bz2 b/tests/img_fs_ext4.img.bz2
deleted file mode 100644 (file)
index 5faa3e7..0000000
Binary files a/tests/img_fs_ext4.img.bz2 and /dev/null differ
diff --git a/tests/img_fs_ext4.img.xz b/tests/img_fs_ext4.img.xz
new file mode 100644 (file)
index 0000000..de688f0
Binary files /dev/null and b/tests/img_fs_ext4.img.xz differ
diff --git a/tests/img_fs_vfat.img.bz2 b/tests/img_fs_vfat.img.bz2
deleted file mode 100644 (file)
index a87683b..0000000
Binary files a/tests/img_fs_vfat.img.bz2 and /dev/null differ
diff --git a/tests/img_fs_vfat.img.xz b/tests/img_fs_vfat.img.xz
new file mode 100644 (file)
index 0000000..5ecfa67
Binary files /dev/null and b/tests/img_fs_vfat.img.xz differ
diff --git a/tests/img_fs_xfs.img.bz2 b/tests/img_fs_xfs.img.bz2
deleted file mode 100644 (file)
index 3e21a8a..0000000
Binary files a/tests/img_fs_xfs.img.bz2 and /dev/null differ
diff --git a/tests/img_fs_xfs.img.xz b/tests/img_fs_xfs.img.xz
new file mode 100644 (file)
index 0000000..a7034a7
Binary files /dev/null and b/tests/img_fs_xfs.img.xz differ
diff --git a/tests/integrity-compat-test b/tests/integrity-compat-test
new file mode 100755 (executable)
index 0000000..8607e85
--- /dev/null
@@ -0,0 +1,429 @@
+#!/bin/bash
+#
+# Test integritysetup compatibility.
+#
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+INTSETUP=$CRYPTSETUP_PATH/integritysetup
+
+INTSETUP_VALGRIND=../.libs/integritysetup
+INTSETUP_LIB_VALGRIND=../.libs
+
+DEV_NAME=dmc_test
+DEV_NAME_BIG=dmc_fake
+DEV_LOOP=""
+DEV=test123.img
+DEV2=test124.img
+KEY_FILE=key.img
+
+dmremove() { # device
+       udevadm settle >/dev/null 2>&1
+       dmsetup remove --retry $1 >/dev/null 2>&1
+}
+
+cleanup() {
+       [ -b /dev/mapper/$DEV_NAME ] && dmremove $DEV_NAME
+       [ -b /dev/mapper/$DEV_NAME_BIG ] && dmremove $DEV_NAME_BIG
+       [ -n "$DEV_LOOP" ] && losetup -d "$DEV_LOOP"
+       DEV_LOOP=""
+       rm -f $DEV $DEV2 $KEY_FILE >/dev/null 2>&1
+}
+
+fail()
+{
+       echo
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       cleanup
+       exit 100
+}
+
+skip()
+{
+       [ -n "$1" ] && echo "$1"
+       exit 77
+}
+
+function dm_integrity_features()
+{
+       VER_STR=$(dmsetup targets | grep integrity | cut -f2 -dv)
+       [ -z "$VER_STR" ] && skip "Cannot find dm-integrity target, test skipped."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+       VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
+
+       [ $VER_MAJ -lt 1 ] && return
+       [ $VER_MIN -gt 1 ] && {
+               DM_INTEGRITY_META=1
+               DM_INTEGRITY_RECALC=1
+       }
+       [ $VER_MIN -gt 2 ] && {
+               DM_INTEGRITY_BITMAP=1
+       }
+}
+
+add_device() {
+       cleanup
+       dd if=/dev/urandom of=$KEY_FILE bs=1 count=512 >/dev/null 2>&1
+       dd if=/dev/zero of=$DEV bs=1M count=32 >/dev/null 2>&1
+       dd if=/dev/zero of=$DEV2 bs=1M count=32 >/dev/null 2>&1
+       sync
+}
+
+status_check() # name value
+{
+       X=$($INTSETUP status $DEV_NAME | grep "$1" | sed 's/.*: //' | sed 's/^[[:space:]]*//')
+       if [ "$X" != "$2" ] ; then
+               echo "[status FAIL]"
+               echo " Expecting $1:$2 got \"$X\"."
+               fail
+       fi
+}
+
+dump_check() # name value
+{
+       X=$($INTSETUP dump $DEV | grep "$1" | cut -d' '  -f 2)
+       if [ "$X" != "$2" ] ; then
+               echo "[dump FAIL]"
+               echo " Expecting $1:$2 got \"$X\"."
+               fail
+       fi
+}
+
+kernel_param_check() # number value
+{
+       X=$(dmsetup table $DEV_NAME | cut -d " " -f $1)
+       if [ "$X" != $2 ] ; then
+               echo "[param_check FAIL]"
+               echo "Expecting $2 got \"$X\"."
+               fail
+       fi
+}
+
+function valgrind_setup()
+{
+    which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
+    [ ! -f $INTSETUP_VALGRIND ] && fail "Unable to get location of cryptsetup executable."
+    export LD_LIBRARY_PATH="$INTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
+}
+
+function valgrind_run()
+{
+    INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${INTSETUP_VALGRIND} "$@"
+}
+
+int_check_sum_only() # checksum
+{
+       VSUM=$(sha256sum /dev/mapper/$DEV_NAME | cut -d' ' -f 1)
+       if [ "$VSUM" = "$1" ] ; then
+               echo -n "[CHECKSUM OK]"
+       else
+               echo "[FAIL]"
+               echo " Expecting $1 got $VSUM."
+               fail
+       fi
+}
+
+int_check_sum() # alg checksum [keyfile keysize]
+{
+       if [ -n "$4" ] ; then
+               KEY_PARAMS="--integrity-key-file $3 --integrity-key-size $4"
+       else
+               KEY_PARAMS=""
+       fi
+
+       # Fill device with zeroes and reopen it
+       dd if=/dev/zero of=/dev/mapper/$DEV_NAME bs=1M oflag=direct >/dev/null 2>&1
+       dmremove $DEV_NAME
+
+       $INTSETUP open $DEV $DEV_NAME --integrity $1 $KEY_PARAMS || fail "Cannot activate device."
+
+       int_check_sum_only $2
+}
+
+intformat() # alg alg_out tagsize outtagsize sector_size csum [keyfile keysize]
+{
+       if [ -n "$8" ] ; then
+               KEY_PARAMS="--integrity-key-file $7 --integrity-key-size $8"
+       else
+               KEY_PARAMS=""
+       fi
+
+       if [ $3 -ne 0 ] ; then
+               TAG_PARAMS="--tag-size $3"
+       else
+               TAG_PARAMS=""
+       fi
+
+       echo -n "[INTEGRITY:$2:$4:$5]"
+       echo -n "[FORMAT]"
+       $INTSETUP format --integrity-legacy-padding -q --integrity $1 $TAG_PARAMS --sector-size $5 $KEY_PARAMS $DEV >/dev/null || fail "Cannot format device."
+       dump_check "tag_size" $4
+       dump_check "sector_size" $5
+       echo -n "[ACTIVATE]"
+       $INTSETUP open $DEV $DEV_NAME --integrity $1 $KEY_PARAMS || fail "Cannot activate device."
+       status_check "tag size" $4
+       status_check "integrity" $2
+       status_check "sector size" "$5 bytes"
+       int_check_sum $1 $6 $7 $8
+       echo -n "[REMOVE]"
+       $INTSETUP close $DEV_NAME || fail "Cannot deactivate device."
+       echo "[OK]"
+}
+
+int_error_detection() # mode alg tagsize outtagsize sector_size key_file key_size
+{
+       if [ "$1" == "B" ] ; then
+               INT_MODE="-B"
+       else
+               INT_MODE=""
+       fi
+       if [ -n "$7" ] ; then
+               KEY_PARAMS="--integrity-key-file $6 --integrity-key-size $7"
+       else
+               KEY_PARAMS=""
+       fi
+       if [ $3 -ne 0 ] ; then
+               TAG_PARAMS="--tag-size $3"
+       else
+               TAG_PARAMS=""
+       fi
+       dd if=/dev/zero of=$DEV bs=1M count=32 >/dev/null 2>&1
+
+       echo -n "[INTEGRITY:$1:$2:$4:$5]"
+       echo -n "[FORMAT]"
+       $INTSETUP format -q --integrity $2 $TAG_PARAMS --sector-size $5 $KEY_PARAMS $DEV $INT_MODE >/dev/null || fail "Cannot format device."
+       echo -n "[ACTIVATE]"
+       $INTSETUP open $DEV $DEV_NAME --integrity $2 --integrity-no-journal $KEY_PARAMS $INT_MODE || fail "Cannot activate device."
+
+       if [ -n "$6" -a -n "$7" ]; then
+               echo -n "[KEYED HASH]"
+               KEY_HEX=$(xxd -c 256 -l $7 -p $6)
+               [ -z "$KEY_HEX" ] && fail "Cannot decode key."
+               dmsetup table --showkeys $DEV_NAME | grep -q $KEY_HEX || fail "Key mismatch."
+       fi
+
+       echo -n "[WRITE DATA]"
+       echo -n "EXAMPLE TEXT" | dd of=/dev/mapper/$DEV_NAME >/dev/null 2>&1 || fail "Cannot write to device."
+       $INTSETUP close $DEV_NAME || fail "Cannot deactivate device."
+
+       # find offset of data area
+       ARR=($(dd if=$DEV bs=512 2>/dev/null | hexdump -C | grep 'EXAMPLE TEXT'))
+       OFF_HEX=${ARR[0]}
+       OFF_DEC=$((16#$OFF_HEX))
+
+       echo -n "[CORRUPT DATA:$OFF_DEC]"
+       echo -n "Z" | dd of=$DEV bs=1 seek=$OFF_DEC conv=notrunc >/dev/null 2>&1 || fail "Cannot write to device."
+
+       echo -n "[DETECT ERROR]"
+       $INTSETUP open $DEV $DEV_NAME --integrity $2 $KEY_PARAMS $INT_MODE || fail "Cannot activate device."
+       dd if=/dev/mapper/$DEV_NAME  >/dev/null 2>&1 && fail "Error detection failed."
+       echo -n "[REMOVE]"
+       $INTSETUP close $DEV_NAME || fail "Cannot deactivate device."
+       echo "[OK]"
+}
+
+int_journal() # 1 alg, 2 tagsize, 3 sector_size, 4 watermark, 5 commit_time, 6 journal_integrity, 7 key-file, 8 key-size, 9 journal_integrity_out
+{
+    echo -n "[INTEGRITY JOURNAL:$6:${4}%:${5}ms]"
+    echo -n "[FORMAT]"
+    ARGS="--integrity $1 --journal-watermark $4 --journal-commit-time $5 --journal-integrity $6 --journal-integrity-key-file $7 --journal-integrity-key-size $8"
+    $INTSETUP format -q --tag-size $2 --sector-size $3 $ARGS $DEV || fail "Cannot format device."
+
+    echo -n "[ACTIVATE]"
+
+    $INTSETUP open $DEV $DEV_NAME $ARGS || fail "Cannot activate device."
+
+    echo -n "[KEYED HASH]"
+    KEY_HEX=$(xxd -c 256 -l $8 -p $7)
+    [ -z "$KEY_HEX" ] && fail "Cannot decode key."
+    dmsetup table --showkeys $DEV_NAME | grep -q $KEY_HEX || fail "Key mismatch."
+
+    status_check "journal watermark" "${4}%"
+    status_check "journal commit time" "${5} ms"
+    status_check "journal integrity MAC" $9
+
+    echo -n "[REMOVE]"
+    $INTSETUP close $DEV_NAME || fail "Cannot deactivate device."
+    echo "[OK]"
+}
+
+
+int_journal_crypt() # crypt_alg crypt_alg_kernel crypt_key crypt_key_size
+{
+       echo -n "[JOURNAL CRYPT:$1:${4}B]"
+
+       echo -n "[FORMAT]"
+       ARGS="--journal-crypt $1 --journal-crypt-key-file $3 --journal-crypt-key-size $4"
+       $INTSETUP format -q $ARGS $DEV || fail "Cannot format device."
+
+       echo -n "[ACTIVATE]"
+       $INTSETUP open $DEV $DEV_NAME $ARGS || fail "Cannot activate device."
+
+       KEY_HEX=$(xxd -c 256 -l $4 -p $3)
+       [ -z "$KEY_HEX" ] && fail "Cannot decode key."
+       dmsetup table --showkeys $DEV_NAME | grep -q "journal_crypt:$2:$KEY_HEX" || fail "Key mismatch."
+
+       $INTSETUP close $DEV_NAME
+       echo "[OK]"
+}
+
+int_mode() # alg tag_size sector_size [keyfile keysize]
+{
+       if [ -n "$5" ] ; then
+               KEY_PARAMS="--integrity-key-file $4 --integrity-key-size $5"
+       else
+               KEY_PARAMS=""
+       fi
+
+       echo -n "[MODE TESTS:$1:$2:$3]"
+       ARGS="--tag-size $2 --sector-size $3"
+
+       $INTSETUP format -q $ARGS $KEY_PARAMS $DEV --integrity $1 || fail "Cannot format device."
+
+       echo -n "[JOURNALED WRITES]"
+       $INTSETUP open $DEV $DEV_NAME --integrity $1 $KEY_PARAMS || fail "Cannot activate device with journal."
+       status_check "mode" "read/write"
+       kernel_param_check 7 "J"
+
+       $INTSETUP close $DEV_NAME fail "Cannot deactivate device."
+
+       echo -n "[DIRECT WRITES]"
+       $INTSETUP open $DEV $DEV_NAME --integrity $1 $KEY_PARAMS --integrity-no-journal || fail "Cannot activate device without journal."
+       status_check "mode" "read/write"
+       status_check "journal" "not active"
+       kernel_param_check 7 "D"
+
+       $INTSETUP close $DEV_NAME fail "Cannot deactivate device."
+
+       echo -n "[RECOVERY MODE]"
+       $INTSETUP open $DEV $DEV_NAME --integrity $1 $KEY_PARAMS --integrity-recovery-mode || fail "Cannot activate device in recovery mode."
+       status_check "mode" "read/write recovery"
+       kernel_param_check 7 "R"
+
+       $INTSETUP close $DEV_NAME fail "Cannot deactivate device."
+
+       echo "[OK]"
+}
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+[ ! -x "$INTSETUP" ] && skip "Cannot find $INTSETUP, test skipped."
+which blockdev >/dev/null || skip "Cannot find blockdev utility, test skipped."
+
+[ -n "$VALG" ] && valgrind_setup && INTSETUP=valgrind_run
+which hexdump >/dev/null 2>&1 || skip "WARNING: hexdump tool required."
+modprobe dm-integrity >/dev/null 2>&1
+dm_integrity_features
+
+add_device
+intformat crc32c      crc32c          0  4  512 08f63eb27fb9ce2ce903b0a56429c68ce5e209253ba42154841ef045a53839d7
+intformat crc32       crc32           0  4  512 08f63eb27fb9ce2ce903b0a56429c68ce5e209253ba42154841ef045a53839d7
+intformat sha1        sha1            0 20  512 6eedd6344dab8875cd185fcd6565dfc869ab36bc57e577f40c685290b1fa7fe7
+intformat sha1        sha1           16 16 4096 e152ec88227b539cd9cafd8bdb587a1072d720cd6bcebe1398d4136c9e7f337b
+intformat sha256      sha256          0 32  512 8e5fe4119558e117bfc40e3b0f13ade3abe497b52604d4c7cca0cfd6c7f4cf11
+intformat hmac-sha256 hmac\(sha256\)  0 32  512 8e5fe4119558e117bfc40e3b0f13ade3abe497b52604d4c7cca0cfd6c7f4cf11 $KEY_FILE 32
+intformat sha256      sha256          0 32 4096 33f7dfa5163ca9f740383fb8b0919574e38a7b20a94a4170fde4238196b7c4b4
+intformat hmac-sha256 hmac\(sha256\)  0 32 4096 33f7dfa5163ca9f740383fb8b0919574e38a7b20a94a4170fde4238196b7c4b4 $KEY_FILE 32
+
+echo "Error detection tests:"
+int_error_detection J crc32c  0  4  512
+int_error_detection J crc32c  0  4  4096
+int_error_detection J crc32   0  4  512
+int_error_detection J crc32   0  4  4096
+int_error_detection J sha1    0 20 512
+int_error_detection J sha1   16 16 512
+int_error_detection J sha1    0 20 4096
+int_error_detection J sha256  0 32 512
+int_error_detection J sha256  0 32 4096
+
+which xxd >/dev/null 2>&1 || skip "WARNING: xxd tool required."
+int_error_detection J hmac-sha256  0 32 512 $KEY_FILE 32
+int_error_detection J hmac-sha256  0 32 4096 $KEY_FILE 32
+
+echo "Journal parameters tests:"
+# Watermark is calculated in kernel, so it can be rounded down/up
+int_journal crc32  4  512  66 1000 hmac-sha256 $KEY_FILE 32 hmac\(sha256\)
+int_journal sha256 32 4096 34 5000 hmac-sha1   $KEY_FILE 16 hmac\(sha1\)
+int_journal sha1   20 512  75 9999 hmac-sha256 $KEY_FILE 32 hmac\(sha256\)
+
+echo "Journal encryption tests:"
+int_journal_crypt cbc-aes cbc\(aes\) $KEY_FILE 32
+int_journal_crypt cbc-aes cbc\(aes\) $KEY_FILE 16
+int_journal_crypt ctr-aes ctr\(aes\) $KEY_FILE 32
+int_journal_crypt ctr-aes ctr\(aes\) $KEY_FILE 16
+
+echo "Mode tests:"
+int_mode crc32c      4  512
+int_mode crc32       4  512
+int_mode sha1        20 512
+int_mode sha256      32 512
+int_mode hmac-sha256 32 512  $KEY_FILE 32
+int_mode hmac-sha256 32 4096 $KEY_FILE 32
+
+echo -n "Recalculate tags in-kernel:"
+add_device
+if [ -n "$DM_INTEGRITY_RECALC" ] ; then
+       $INTSETUP format -q $DEV --no-wipe || fail "Cannot format device."
+       $INTSETUP open $DEV $DEV_NAME --integrity-recalculate || fail "Cannot activate device."
+       dd if=/dev/mapper/$DEV_NAME of=/dev/null bs=1M 2>/dev/null || fail "Cannot recalculate tags in-kernel"
+       int_check_sum_only 08f63eb27fb9ce2ce903b0a56429c68ce5e209253ba42154841ef045a53839d7
+       $INTSETUP close $DEV_NAME fail "Cannot deactivate device."
+       echo "[OK]"
+else
+       echo "[N/A]"
+fi
+
+echo -n "Separate metadata device:"
+if [ -n "$DM_INTEGRITY_META" ] ; then
+       add_device
+       $INTSETUP format -q $DEV --data-device $DEV2 || fail "Cannot format device."
+       $INTSETUP open $DEV --data-device $DEV2 $DEV_NAME || fail "Cannot activate device."
+       int_check_sum_only 83ee47245398adee79bd9c0a8bc57b821e92aba10f5f9ade8a5d1fae4d8c4302
+       $INTSETUP status $DEV_NAME | grep -q 'metadata device:' || fail
+       $INTSETUP close $DEV_NAME fail "Cannot deactivate device."
+       echo "[OK]"
+else
+       echo "[N/A]"
+fi
+
+echo -n "Bitmap mode parameters:"
+if [ -n "$DM_INTEGRITY_BITMAP" ] ; then
+       add_device
+       $INTSETUP format -q $DEV --integrity-bitmap-mode $DEV2 || fail "Cannot format device."
+       $INTSETUP open $DEV --integrity-bitmap-mode --bitmap-sectors-per-bit 65536 --bitmap-flush-time 5000 $DEV_NAME || fail "Cannot activate device."
+       $INTSETUP status $DEV_NAME | grep -q 'bitmap 512-byte sectors per bit: 65536' || fail
+       $INTSETUP status $DEV_NAME | grep -q 'bitmap flush interval: 5000 ms' || fail
+       $INTSETUP close $DEV_NAME fail "Cannot deactivate device."
+       echo "[OK]"
+       echo "Bitmap error detection tests:"
+       int_error_detection B crc32c      0  4 512
+       int_error_detection B crc32c      0  4 4096
+       int_error_detection B sha256      0 32 512
+       int_error_detection B sha256      0 32 4096
+       int_error_detection B hmac-sha256 0 32 512 $KEY_FILE 32
+       int_error_detection B hmac-sha256 0 32 4096 $KEY_FILE 32
+else
+       echo "[N/A]"
+fi
+
+echo -n "Big device:"
+add_device
+DEV_LOOP=$(losetup -f $DEV --show)
+if [ -n "$DEV_LOOP" ] ; then
+dmsetup create $DEV_NAME_BIG <<EOF
+0 16284 linear $DEV_LOOP 0
+16284 80000000000 zero
+EOF
+       [ ! -b /dev/mapper/$DEV_NAME_BIG ] && fail
+       $INTSETUP format -q -s 512 --no-wipe /dev/mapper/$DEV_NAME_BIG
+       $INTSETUP open /dev/mapper/$DEV_NAME_BIG $DEV_NAME || fail
+       D_SIZE=$($INTSETUP dump /dev/mapper/$DEV_NAME_BIG | grep provided_data_sectors | sed -e 's/.*provided_data_sectors\ \+//g')
+       A_SIZE=$(blockdev --getsz /dev/mapper/$DEV_NAME)
+       # Compare strings (to avoid 64bit integers), not integers
+       [ -n "$A_SIZE" -a "$D_SIZE" != "$A_SIZE" ] && fail
+       echo "[OK]"
+else
+       echo "[N/A]"
+fi
+
+cleanup
diff --git a/tests/keyring-compat-test b/tests/keyring-compat-test
new file mode 100755 (executable)
index 0000000..7a49936
--- /dev/null
@@ -0,0 +1,211 @@
+#!/bin/bash
+
+CIPHER_XTS_PLAIN="aes-xts-plain64"
+CIPHER_CBC_ESSIV="aes-cbc-essiv:sha256"
+CIPHER_CBC_TCW="serpent-cbc-tcw"
+# TODO: mode with LMK
+
+TEST_KEYRING_NAME="keyringtest_keyring"
+
+LOGON_KEY_16_OK="dmtst:lkey_16"
+LOGON_KEY_32_OK="dmtst:lkey_32"
+LOGON_KEY_64_OK="dmtst:lkey_64"
+
+HEXKEY_16="be21aa8c733229347bd4e681891e213d";
+HEXKEY_32="bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+HEXKEY_64="34f95b96abff946b64f1339ff8653cc77c38697c93b797a496f3786e86eed7781850d5112bbae17d209b8310a8f3a034f1cd297667bc0cd1438fad28d87ef6a1"
+
+DEVSIZEMB=16
+DEVSECTORS=$((DEVSIZEMB*1024*1024/512))
+NAME=testcryptdev
+CHKS_DMCRYPT=vk_in_dmcrypt.chk
+CHKS_KEYRING=vk_in_keyring.chk
+
+PWD="aaa"
+
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+
+[ -f /etc/system-fips ] && FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/null)
+
+function remove_mapping()
+{
+       [ -b /dev/mapper/$NAME ] && dmsetup remove --retry $NAME
+
+       # unlink whole test keyring
+       [ -n "$TEST_KEYRING" ] && keyctl unlink $TEST_KEYRING "@u" >/dev/null
+
+       rmmod scsi_debug 2>/dev/null
+
+       rm -f $CHKS_DMCRYPT $CHKS_KEYRING
+}
+
+function skip()
+{
+       [ -n "$1" ] && echo "$1"
+       remove_mapping
+       exit 77
+}
+
+function fail()
+{
+       [ -n "$1" ] && echo "$1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       remove_mapping
+       exit 2
+}
+
+# $1 hexbyte key
+# $2 type
+# $3 description
+# $4 keyring
+function load_key()
+{
+       local tmp="$1"
+       shift
+       echo -n "$tmp" | xxd -r -p | keyctl padd $@ >/dev/null
+}
+
+function dm_crypt_keyring_support()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+
+       # run the test with dm-crypt v1.15.0+ on purpose
+       # the fix is in dm-crypt v1.18.1+
+       [ $VER_MAJ -gt 1 ] && return 0
+       [ $VER_MAJ -lt 1 ] && return 1
+       [ $VER_MIN -ge 15 ]
+}
+
+function test_and_prepare_keyring() {
+       keyctl list "@s" > /dev/null || skip "Current session keyring is unreachable, test skipped"
+       TEST_KEYRING=$(keyctl newring $TEST_KEYRING_NAME "@u" 2> /dev/null)
+       test -n "$TEST_KEYRING" || skip "Failed to create keyring in user keyring"
+       keyctl search "@s" keyring "$TEST_KEYRING" > /dev/null 2>&1 || keyctl link "@u" "@s" > /dev/null 2>&1
+       load_key "$HEXKEY_16" user test_key "$TEST_KEYRING" || skip "Kernel keyring service is useless on this system, test skipped."
+}
+
+function fips_mode()
+{
+        [ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ]
+}
+
+add_device() {
+       modprobe scsi_debug $@ delay=0
+       if [ $? -ne 0 ] ; then
+               echo "This kernel seems to not support proper scsi_debug module, test skipped."
+               exit 77
+       fi
+
+       sleep 2
+       DEV=$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+
+       DEV="/dev/$DEV"
+       [ -b $DEV ] || fail "Cannot find $DEV."
+}
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+which dmsetup >/dev/null 2>&1 || skip "Cannot find dmsetup, test skipped"
+which keyctl >/dev/null 2>&1 || skip "Cannot find keyctl, test skipped"
+which xxd >/dev/null 2>&1 || skip "Cannot find xxd, test skipped"
+which sha1sum > /dev/null 2>&1 || skip "Cannot find sha1sum, test skipped"
+modprobe dm-crypt || fail "dm-crypt failed to load"
+dm_crypt_keyring_support || skip "dm-crypt doesn't support kernel keyring, test skipped."
+
+test_and_prepare_keyring
+
+add_device dev_size_mb=$DEVSIZEMB
+
+dd if=/dev/urandom of=$DEV bs=1M count=$DEVSIZEMB oflag=direct > /dev/null 2>&1 || fail
+
+#test aes cipher with xts mode, plain IV
+echo -n "Testing $CIPHER_XTS_PLAIN..."
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_XTS_PLAIN $HEXKEY_32 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_DMCRYPT || fail
+dmsetup remove --retry $NAME || fail
+load_key "$HEXKEY_32" logon  $LOGON_KEY_32_OK "$TEST_KEYRING" || fail "Cannot load 32 byte logon key type"
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_XTS_PLAIN :32:logon:$LOGON_KEY_32_OK 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_KEYRING || fail
+dmsetup remove --retry $NAME || fail
+diff $CHKS_DMCRYPT $CHKS_KEYRING || fail "Plaintext checksums mismatch (corruption)"
+# same test using message
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_XTS_PLAIN $HEXKEY_32 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_DMCRYPT || fail
+dmsetup remove --retry $NAME || fail
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_XTS_PLAIN $HEXKEY_32 0 $DEV 0" || fail
+dmsetup suspend $NAME || fail
+dmsetup message $NAME 0 key wipe || fail
+dmsetup message $NAME 0 "key set :32:logon:$LOGON_KEY_32_OK" || fail
+dmsetup resume $NAME || fail
+sha1sum /dev/mapper/$NAME > $CHKS_KEYRING || fail
+dmsetup remove --retry $NAME || fail
+diff $CHKS_DMCRYPT $CHKS_KEYRING || fail "Plaintext checksums mismatch (corruption)"
+echo "OK"
+
+#test aes cipher, xts mode, essiv IV
+echo -n "Testing $CIPHER_CBC_ESSIV..."
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_ESSIV $HEXKEY_16 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_DMCRYPT || fail
+dmsetup remove --retry $NAME || fail
+load_key "$HEXKEY_16" logon  $LOGON_KEY_16_OK "$TEST_KEYRING" || fail "Cannot load 16 byte logon key type"
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_ESSIV :16:logon:$LOGON_KEY_16_OK 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_KEYRING || fail
+dmsetup remove --retry $NAME || fail
+diff $CHKS_DMCRYPT $CHKS_KEYRING || fail "Plaintext checksums mismatch (corruption)"
+# same test using message
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_ESSIV $HEXKEY_16 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_DMCRYPT || fail
+dmsetup remove --retry $NAME || fail
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_ESSIV $HEXKEY_16 0 $DEV 0" || fail
+dmsetup suspend $NAME || fail
+dmsetup message $NAME 0 key wipe || fail
+dmsetup message $NAME 0 "key set :16:logon:$LOGON_KEY_16_OK" || fail
+dmsetup resume $NAME || fail
+sha1sum /dev/mapper/$NAME > $CHKS_KEYRING || fail
+dmsetup remove --retry $NAME || fail
+diff $CHKS_DMCRYPT $CHKS_KEYRING || fail "Plaintext checksums mismatch (corruption)"
+echo "OK"
+
+#test serpent cipher, cbc mode, tcw IV
+fips_mode || {
+echo -n "Testing $CIPHER_CBC_TCW..."
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_TCW $HEXKEY_64 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_DMCRYPT || fail
+dmsetup remove --retry $NAME || fail
+load_key "$HEXKEY_64" logon  $LOGON_KEY_64_OK "$TEST_KEYRING" || fail "Cannot load 16 byte logon key type"
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_TCW :64:logon:$LOGON_KEY_64_OK 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_KEYRING || fail
+dmsetup remove --retry $NAME || fail
+diff $CHKS_DMCRYPT $CHKS_KEYRING || fail "Plaintext checksum mismatch (corruption)"
+# same test using message
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_TCW $HEXKEY_64 0 $DEV 0" || fail
+sha1sum /dev/mapper/$NAME > $CHKS_DMCRYPT || fail
+dmsetup remove --retry $NAME || fail
+dmsetup create $NAME --table "0 $DEVSECTORS crypt $CIPHER_CBC_TCW $HEXKEY_64 0 $DEV 0" || fail
+dmsetup suspend $NAME || fail
+dmsetup message $NAME 0 key wipe || fail
+dmsetup message $NAME 0 "key set :64:logon:$LOGON_KEY_64_OK" || fail
+dmsetup resume $NAME || fail
+sha1sum /dev/mapper/$NAME > $CHKS_KEYRING || fail
+dmsetup remove --retry $NAME || fail
+diff $CHKS_DMCRYPT $CHKS_KEYRING || fail "Plaintext checksums mismatch (corruption)"
+echo "OK"
+}
+
+echo -n "Test LUKS2 key refresh..."
+echo $PWD | $CRYPTSETUP luksFormat --type luks2 --luks2-metadata-size 16k --luks2-keyslots-size 4064k --pbkdf pbkdf2 --pbkdf-force-iterations 1000 --force-password $DEV || fail
+echo $PWD | $CRYPTSETUP open $DEV $NAME || fail
+$CRYPTSETUP status $NAME | grep -q -i "location:.*keyring" || skip "LUKS2 can't use keyring. Test skipped."
+dd if=/dev/mapper/$NAME bs=1M iflag=direct status=none | sha1sum > $CHKS_KEYRING || fail
+echo $PWD | $CRYPTSETUP refresh $NAME --disable-keyring || fail
+$CRYPTSETUP status $NAME | grep -q -i "location:.*keyring" && fail "Key is still in keyring"
+dd if=/dev/mapper/$NAME bs=1M iflag=direct status=none | sha1sum > $CHKS_DMCRYPT || fail
+diff $CHKS_DMCRYPT $CHKS_KEYRING || fail "Plaintext checksum mismatch (corruption)"
+echo "OK"
+
+remove_mapping
diff --git a/tests/keyring-test b/tests/keyring-test
new file mode 100755 (executable)
index 0000000..3ed3aff
--- /dev/null
@@ -0,0 +1,238 @@
+#!/bin/bash
+
+DEV_ZERO="dmtst-zero"
+DEV_CRYPT="dmtst-crypt"
+
+CIPHER="aes-xts-plain64"
+
+TEST_KEYRING_NAME="keyringtest_keyring"
+
+USER_KEY_32_OK="dmtst:ukey_32_ok"
+USER_KEY_32_WRONG="dmtst:ukey_32_wrong_size"
+
+LOGON_KEY_32_OK="dmtst:lkey_32_ok"
+LOGON_KEY_32_WRONG="dmtst:lkey_32_wrong_size"
+
+PAYLOAD_32="bb21158c733229347bd4e681891e213d"
+PAYLOAD_31="bb21158c733229347bd4e681891e213"
+
+HEXKEY_32="bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a1a";
+HEXKEY_32_BAD="bb21158c733229347bd4e68189XXXX3d94c685be6a5b84818afe7a78a6de7a1a"
+HEXKEY_31="bb21158c733229347bd4e681891e213d94c685be6a5b84818afe7a78a6de7a"
+
+function remove_mapping()
+{
+       [ -b /dev/mapper/$DEV_CRYPT ] && dmsetup remove --retry $DEV_CRYPT
+       [ -b /dev/mapper/$DEV_ZERO ] && dmsetup remove --retry $DEV_ZERO
+
+       # unlink whole test keyring
+       [ -n "$TEST_KEYRING" ] && keyctl unlink $TEST_KEYRING "@u" >/dev/null
+}
+
+function skip()
+{
+       [ -n "$1" ] && echo "$1"
+       remove_mapping
+       exit 77
+}
+
+function fail()
+{
+       [ -n "$1" ] && echo "$1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       remove_mapping
+       exit 2
+}
+
+# $1 type
+# $2 description
+# $3 payload
+# $4 keyring
+function load_key()
+{
+       keyctl add $@ >/dev/null
+}
+
+function dm_crypt_keyring_support()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+
+       [ $VER_MAJ -gt 1 ] && return 0
+       [ $VER_MAJ -lt 1 ] && return 1
+       [ $VER_MIN -ge 15 ]
+}
+
+function test_and_prepare_keyring() {
+       keyctl list "@s" > /dev/null || skip "Current session keyring is unreachable, test skipped"
+       TEST_KEYRING=$(keyctl newring $TEST_KEYRING_NAME "@u" 2> /dev/null)
+       test -n "$TEST_KEYRING" || skip "Failed to create keyring in user keyring"
+       keyctl search "@s" keyring "$TEST_KEYRING" > /dev/null 2>&1 || keyctl link "@u" "@s" > /dev/null 2>&1
+       load_key user test_key test_data "$TEST_KEYRING" || skip "Kernel keyring service is useless on this system, test skipped."
+}
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+which dmsetup >/dev/null 2>&1 || skip "Cannot find dmsetup, test skipped"
+which keyctl >/dev/null 2>&1 || skip "Cannot find keyctl, test skipped"
+modprobe dm-crypt || fail "dm-crypt failed to load"
+dm_crypt_keyring_support || skip "dm-crypt doesn't support kernel keyring, test skipped."
+
+test_and_prepare_keyring
+
+load_key logon $LOGON_KEY_32_OK $PAYLOAD_32 "$TEST_KEYRING" || fail "Cannot load 32 byte logon key type"
+load_key user $USER_KEY_32_OK $PAYLOAD_32 "$TEST_KEYRING" || fail "Cannot load 32 byte user key type"
+load_key logon $LOGON_KEY_32_WRONG $PAYLOAD_31 "$TEST_KEYRING" || fail "Cannot load 31 byte logon key type"
+load_key user $USER_KEY_32_WRONG $PAYLOAD_31 "$TEST_KEYRING" || fail "Cannot load 31 byte user key type"
+
+dmsetup create $DEV_ZERO --table "0 100 zero" || fail
+
+echo "[1] Valid keyring keys"
+
+# load logon type kernel key
+KEY=":32:logon:$LOGON_KEY_32_OK"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $KEY 0 /dev/mapper/$DEV_ZERO 0" || fail
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER $KEY 0" || fail
+dmsetup remove --retry $DEV_CRYPT || fail
+
+# load user type kernel key
+KEY=":32:user:$USER_KEY_32_OK"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $KEY 0 /dev/mapper/$DEV_ZERO 0" || fail
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER $KEY 0" || fail
+dmsetup remove --retry $DEV_CRYPT || fail
+
+# load logon type kernel key...
+KEY=":32:logon:$LOGON_KEY_32_OK"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $KEY 0 /dev/mapper/$DEV_ZERO 0" || fail
+dmsetup suspend $DEV_CRYPT || fail
+dmsetup message $DEV_CRYPT 0 "key wipe" || fail
+# ...replace the key with hexkey...
+dmsetup message $DEV_CRYPT 0 "key set $HEXKEY_32" || fail
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER $HEXKEY_32 0" || fail
+dmsetup resume $DEV_CRYPT || fail
+dmsetup suspend $DEV_CRYPT || fail
+# ...and replace it again with user type kernel key...
+dmsetup message $DEV_CRYPT 0 "key set :32:user:$USER_KEY_32_OK" || fail
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER :32:user:$USER_KEY_32_OK 0" || fail
+dmsetup message $DEV_CRYPT 0 "key set $HEXKEY_32" || fail
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER $HEXKEY_32 0" || fail
+dmsetup resume $DEV_CRYPT || fail
+dmsetup remove --retry $DEV_CRYPT || fail
+
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $HEXKEY_32 0 /dev/mapper/$DEV_ZERO 0" || fail
+dmsetup suspend $DEV_CRYPT || fail
+dmsetup message $DEV_CRYPT 0 "key wipe" || fail
+dmsetup message $DEV_CRYPT 0 "key set :32:user:$USER_KEY_32_OK" || fail
+dmsetup resume $DEV_CRYPT || fail
+dmsetup suspend $DEV_CRYPT || fail
+dmsetup message $DEV_CRYPT 0 "key set :32:logon:$LOGON_KEY_32_OK" || fail
+dmsetup resume $DEV_CRYPT || fail
+dmsetup remove --retry $DEV_CRYPT || fail
+
+echo "[2] message ioctl"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $HEXKEY_32 0 /dev/mapper/$DEV_ZERO 0" || fail
+dmsetup suspend $DEV_CRYPT || fail
+dmsetup message $DEV_CRYPT 0 "key set :32:logon:$LOGON_KEY_32_WRONG" 2> /dev/null && fail
+# old key should be intact and valid
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER $HEXKEY_32 0" || fail
+dmsetup resume $DEV_CRYPT || fail
+dmsetup suspend $DEV_CRYPT || fail
+# now the key gets destroyed by invalid input
+dmsetup message $DEV_CRYPT 0 "key set $HEXKEY_32_BAD" 2> /dev/null && fail
+dmsetup resume $DEV_CRYPT 2> /dev/null && fail
+# hmm... see the output. don't like it
+# dmsetup table --showkeys $DEV_CRYPT
+
+dmsetup message $DEV_CRYPT 0 "key set :32:user:$USER_KEY_32_OK" || fail
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER :32:user:$USER_KEY_32_OK 0" || fail
+dmsetup message $DEV_CRYPT 0 "key set :31:logon:$LOGON_KEY_32_OK" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set :" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set ::::" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set :0:logon:$LOGON_KEY_32_OK" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set :32" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set :32:" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set :32:logon" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set :32:logo" 2> /dev/null && fail
+dmsetup message $DEV_CRYPT 0 "key set :32:logon:" 2> /dev/null && fail
+dmsetup table --showkeys $DEV_CRYPT | grep -q "crypt $CIPHER :32:user:$USER_KEY_32_OK 0" || fail
+dmsetup message $DEV_CRYPT 0 "key set :32:user:$USER_KEY_32_OK" || fail
+dmsetup resume $DEV_CRYPT || fail
+dmsetup remove --retry $DEV_CRYPT || fail
+
+echo "[3] bOrked keys"
+# declare the key having 32 bytes but load key which has in fact 31 bytes only
+KEY=":32:logon:$LOGON_KEY_32_WRONG"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $KEY 0 /dev/mapper/$DEV_ZERO 0" 2> /dev/null && fail "dm-crypt accepted wrong key size"
+
+# declare the key having 31 bytes (incompatible with cipher) and load key with 32 bytes in real
+KEY=":31:logon:$LOGON_KEY_32_WRONG"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $KEY 0 /dev/mapper/$DEV_ZERO 0" 2> /dev/null && fail "dm-crypt accepted wrong key size"
+
+# declare the key being user type but try to load logon one
+KEY=":32:user:$LOGON_KEY_32"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $KEY 0 /dev/mapper/$DEV_ZERO 0" 2> /dev/null  && fail "dm-crypt accepted key description for invalid key type"
+
+# now the other way
+KEY=":32:logon:$USER_KEY_32"
+dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $KEY 0 /dev/mapper/$DEV_ZERO 0" 2> /dev/null  && fail "dm-crypt accepted key description for invalid key type"
+
+BORKED_KEYS=":\ 32:logon:$LOGON_KEY_32_OK
+: 32:logon:$LOGON_KEY_32_OK
+:+32:logon:$LOGON_KEY_32_OK
+:-32:logon:$LOGON_KEY_32_OK
+:32 :logon:$LOGON_KEY_32_OK
+:32\ :logon:$LOGON_KEY_32_OK
+:32_:logon:$LOGON_KEY_32_OK
+:32+:logon:$LOGON_KEY_32_OK
+:30+2:logon:$LOGON_KEY_32_OK
+:32+0:logon:$LOGON_KEY_32_OK
+:32: logon:$LOGON_KEY_32_OK
+:32:\ logon:$LOGON_KEY_32_OK
+:32:logonA:$LOGON_KEY_32_OK
+:32:logo:$LOGON_KEY_32_OK
+:32:llogon:$LOGON_KEY_32_OK
+:32xlogon:$LOGON_KEY_32_OK
+:32logon:$LOGON_KEY_32_OK
+:32:logonx$LOGON_KEY_32_OK
+:32:logon$LOGON_KEY_32_OK
+: 32:user:$USER_KEY_32_OK
+:\ 32:user:$USER_KEY_32_OK
+:+32:user:$USER_KEY_32_OK
+:-32:user:$USER_KEY_32_OK
+:32 :user:$USER_KEY_32_OK
+:32\ :user:$USER_KEY_32_OK
+:32_:user:$USER_KEY_32_OK
+:32+:user:$USER_KEY_32_OK
+:30+2:user:$USER_KEY_32_OK
+:32+0:user:$USER_KEY_32_OK
+:32: user:$USER_KEY_32_OK
+:32:\ user:$USER_KEY_32_OK
+:32:userA:$USER_KEY_32_OK
+:32:use:$USER_KEY_32_OK
+:32:uuser:$USER_KEY_32_OK
+:32xuser:$USER_KEY_32_OK
+:32user:$USER_KEY_32_OK
+:32:userx$USER_KEY_32_OK
+:32:user$USER_KEY_32_OK
+:32:userlogon:$USER_KEY_32_OK
+:32:userlogon:$LOGON_KEY_32_OK
+:32:logonuser:$USER_KEY_32_OK
+:32:logonuser:$LOGON_KEY_32_OK
+:32:logon:user:$USER_KEY_32_OK
+:32:logon:user:$LOGON_KEY_32_OK
+:32:user:logon:$USER_KEY_32_OK
+:32:user:logon:$LOGON_KEY_32_OK"
+
+# TODO: add tests with whitespace in key description (not possible with current libdevmapper)
+
+IFS="
+"
+
+for key in $BORKED_KEYS; do
+       dmsetup create $DEV_CRYPT --table "0 100 crypt $CIPHER $key 0 /dev/mapper/$DEV_ZERO 0" 2> /dev/null && fail "dm-crypt accepted seriously borked key string"
+done
+
+remove_mapping
index 5b26b42..9c69192 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/bash
 
-CRYPTSETUP=../src/cryptsetup
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 
 # try to validate using loop-AES losetup/kernel if available
 LOSETUP_AES=/losetup-aes.old
@@ -15,7 +16,7 @@ LOOPDEV=$(losetup -f 2>/dev/null)
 
 function dmremove() { # device
        udevadm settle >/dev/null 2>&1
-       dmsetup remove $1 >/dev/null 2>&1
+       dmsetup remove --retry $1 >/dev/null 2>&1
 }
 
 function remove_mapping()
@@ -28,15 +29,16 @@ function remove_mapping()
 
 function fail()
 {
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        remove_mapping
-       echo "FAILED"
        exit 2
 }
 
 function skip()
 {
        [ -n "$1" ] && echo "$1"
-       exit 0
+       exit 77
 }
 
 function prepare()
@@ -87,7 +89,7 @@ function get_expsum() # $offset
        esac
 }
 
-function check_sum() # $key $keysize $offset
+function check_sum() # $key $keysize $offset [stdin|keyfile]
 {
        # Fill device with zeroes and reopen it
        dd if=/dev/zero of=/dev/mapper/$DEV_NAME bs=1k $LOOP_DD_PARAM >/dev/null 2>&1
@@ -95,14 +97,18 @@ function check_sum() # $key $keysize $offset
        dmremove $DEV_NAME
 
        EXPSUM=$(get_expsum $3)
-       $CRYPTSETUP loopaesOpen $LOOPDEV $DEV_NAME -s $2 --key-file $1 $(get_offset_params $3) >/dev/null 2>&1
+       if [ "$4" == "stdin" ] ; then
+               cat $1 | $CRYPTSETUP loopaesOpen $LOOPDEV $DEV_NAME -s $2 --key-file - $(get_offset_params $3) >/dev/null 2>&1
+       else
+               $CRYPTSETUP loopaesOpen $LOOPDEV $DEV_NAME -s $2 --key-file $1 $(get_offset_params $3) >/dev/null 2>&1
+       fi
        ret=$?
        VSUM=$(sha256sum /dev/mapper/$DEV_NAME | cut -d' ' -f 1)
        if [ $ret -eq 0 -a "$VSUM" = "$EXPSUM" ] ; then
-               echo -n "[OK]"
+               echo -n "[$4:OK]"
        else
-               echo "[FAIL]"
-               echo " Expecting $EXPSUM got $VSUM."
+               echo "[$4:FAIL]"
+               [ "$VSUM" != "$EXPSUM" ] && echo " Expecting $EXPSUM got $VSUM."
                fail
        fi
 }
@@ -121,7 +127,7 @@ function check_sum_losetup() # $key $alg
                echo "[OK]"
        else
                echo "[FAIL]"
-               echo " Expecting $EXPSUM got $VSUM (loop-AES)."
+               [ "$VSUM" != "$EXPSUM" ] && echo " Expecting $EXPSUM got $VSUM (loop-AES)."
                fail
        fi
        losetup -d $LOOPDEV >/dev/null 2>&1
@@ -140,7 +146,7 @@ function check_version()
 
 [ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
 [ -z "$LOOPDEV" ] && skip "Cannot find free loop device, test skipped."
-which uuencode >/dev/null || skip "WARNING: test require uuencode binary, test skipped."
+which uuencode >/dev/null 2>&1 || skip "WARNING: test require uuencode binary, test skipped."
 check_version || skip "Probably old kernel, test skipped."
 
 # loop-AES tests
@@ -157,7 +163,9 @@ for key_size in $KEY_SIZES ; do
                        2>/dev/null
                [ $? -ne 0 ] && echo "[SKIPPED]" && continue
                check_exists
-               check_sum $key $key_size $offset
+               check_sum $key $key_size $offset keyfile
+               $CRYPTSETUP loopaesClose $DEV_NAME || fail
+               check_sum $key $key_size $offset stdin
                $CRYPTSETUP loopaesClose $DEV_NAME || fail
                check_sum_losetup $key AES$key_size $offset
         done
index 6e6d620..311a559 100755 (executable)
@@ -6,20 +6,25 @@
 # that you are not using old gcrypt with flawed whirlpool
 # (see cryptsetup debug output)
 
-CRYPTSETUP=../src/cryptsetup
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 TST_DIR=luks1-images
 MAP=luks1tst
 KEYFILE=keyfile1
 
+[ -z "$srcdir" ] && srcdir="."
+
 function remove_mapping()
 {
-       [ -b /dev/mapper/$MAP ] && dmsetup remove $MAP
+       [ -b /dev/mapper/$MAP ] && dmsetup remove --retry $MAP
 }
 
 function fail()
 {
        [ -n "$1" ] && echo "$1"
        echo " [FAILED]"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        remove_mapping
        exit 2
 }
@@ -28,7 +33,7 @@ function skip()
 {
        [ -n "$1" ] && echo "$1"
        echo "Test skipped."
-       exit 0
+       exit 77
 }
 
 function test_one()
@@ -44,7 +49,7 @@ function test_required()
        $CRYPTSETUP benchmark -h whirlpool | grep "N/A" && skip
 
        echo "REQUIRED CIPHERS TEST"
-       echo "#  Algorithm | Key |  Encryption |  Decryption"
+       echo "#     Algorithm | Key |  Encryption |  Decryption"
 
        test_one aes-xts 256
        test_one twofish-xts 256
@@ -55,14 +60,29 @@ function test_required()
 
 export LANG=C
 
+test_required
+[ ! -d $TST_DIR ] && tar xJf $srcdir/luks1-images.tar.xz --no-same-owner
+
+echo "PASSPHRASE CHECK"
+for file in $(ls $TST_DIR/luks1_*) ; do
+       echo -n " $file"
+       $CRYPTSETUP luksOpen -d $TST_DIR/$KEYFILE $file --test-passphrase 2>/dev/null
+       ret=$?
+       # ignore missing whirlpool (pwd failed is exit code 2)
+       [ $ret -eq 1 ] && (echo $file | grep -q -e "whirlpool") && echo " [N/A]" && continue
+       # ignore flawed whirlpool (pwd failed is exit code 2)
+       [ $ret -eq 2 ] && (echo $file | grep -q -e "whirlpool") && \
+               ($CRYPTSETUP luksDump $file --debug | grep -q -e "flawed whirlpool") && \
+               echo " [IGNORED (flawed Whirlpool library)]" && continue
+       [ $ret -ne 0 ] && fail
+       echo " [OK]"
+done
+
 if [ $(id -u) != 0 ]; then
        echo "WARNING: You must be root to run activation part of test, test skipped."
        exit 0
 fi
 
-test_required
-[ ! -d $TST_DIR ] && tar xjf luks1-images.tar.bz2
-
 echo "ACTIVATION FS UUID CHECK"
 for file in $(ls $TST_DIR/luks1_*) ; do
        echo -n " $file"
@@ -70,6 +90,10 @@ for file in $(ls $TST_DIR/luks1_*) ; do
        ret=$?
        # ignore missing whirlpool (pwd failed is exit code 2)
        [ $ret -eq 1 ] && (echo $file | grep -q -e "whirlpool") && echo " [N/A]" && continue
+       # ignore flawed whirlpool (pwd failed is exit code 2)
+       [ $ret -eq 2 ] && (echo $file | grep -q -e "whirlpool") && \
+               ($CRYPTSETUP luksDump $file --debug | grep -q -e "flawed whirlpool") && \
+               echo " [IGNORED (flawed Whirlpool library)]" && continue
        [ $ret -ne 0 ] && fail
        $CRYPTSETUP status $MAP >/dev/null || fail
        $CRYPTSETUP status /dev/mapper/$MAP >/dev/null || fail
diff --git a/tests/luks1-images.tar.bz2 b/tests/luks1-images.tar.bz2
deleted file mode 100644 (file)
index 86de8a5..0000000
Binary files a/tests/luks1-images.tar.bz2 and /dev/null differ
diff --git a/tests/luks1-images.tar.xz b/tests/luks1-images.tar.xz
new file mode 100644 (file)
index 0000000..dd099c6
Binary files /dev/null and b/tests/luks1-images.tar.xz differ
diff --git a/tests/luks2-integrity-test b/tests/luks2-integrity-test
new file mode 100755 (executable)
index 0000000..0ba4b67
--- /dev/null
@@ -0,0 +1,166 @@
+#!/bin/bash
+#
+# Test cryptsetup/authenticated encryption compatibility.
+#
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+DEV_NAME=dmi_test
+DEV=mode-test.img
+PWD1=nHjJHjI23JK
+KEY_FILE=key.img
+FAST_PBKDF_OPT="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
+
+dmremove() { # device
+       udevadm settle >/dev/null 2>&1
+       dmsetup remove $1 >/dev/null 2>&1
+}
+
+cleanup() {
+       [ -b /dev/mapper/$DEV_NAME ] && dmremove $DEV_NAME
+       [ -b /dev/mapper/"$DEV_NAME"_dif ] && dmremove "$DEV_NAME"_dif
+       rm -f $DEV $KEY_FILE >/dev/null 2>&1
+}
+
+fail()
+{
+       echo
+       [ -n "$1" ] && echo "FAIL: $1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       cleanup
+       exit 100
+}
+
+skip()
+{
+       [ -n "$1" ] && echo "$1"
+       exit 77
+}
+
+add_device() {
+       cleanup
+       dd if=/dev/urandom of=$KEY_FILE bs=1 count=512 >/dev/null 2>&1
+       dd if=/dev/zero of=$DEV bs=1M count=32 >/dev/null 2>&1
+       sync
+}
+
+status_check() # name value
+{
+       #$CRYPTSETUP status $DEV_NAME
+       X=$($CRYPTSETUP status $DEV_NAME | grep -m1 "$1" | sed -e 's/.*:[ \t]\+//' | cut -d' ' -f1)
+       if [ "$X" != "$2" ] ; then
+               echo "[status FAIL]"
+               echo " Expecting $1:$2 got \"$X\"."
+               fail
+       fi
+}
+
+dump_check() # name value
+{
+       #$CRYPTSETUP luksDump $DEV
+       X=$($CRYPTSETUP luksDump $DEV | grep -m1 "$1" | sed -e 's/.*:[ \t]\+//' | cut -d' ' -f1)
+       if [ "$X" != "$2" ] ; then
+               echo "[dump FAIL]"
+               echo " Expecting $1:$2 got \"$X\"."
+               fail
+       fi
+}
+
+int_check_sum() # alg checksum
+{
+       VSUM=$(sha256sum /dev/mapper/$DEV_NAME | cut -d' ' -f 1)
+       if [ "$VSUM" = "$2" ] ; then
+               echo -n "[CHECKSUM]"
+       else
+               echo "[FAIL]"
+               echo " Expecting $2 got $VSUM."
+               fail
+       fi
+}
+
+int_error_detection() # alg int sector_size
+{
+       # FIXME: this is just a trivial failure
+       echo -n "[DETECT_CORRUPTION]"
+       echo -n "XXXXX" | dd of=$DEV bs=1M seek=28 count=1 conv=notrunc >/dev/null 2>&1 || fail "Cannot write to device."
+       $CRYPTSETUP open -d $KEY_FILE $DEV $DEV_NAME || fail "Cannot activate device."
+       dd if=/dev/mapper/$DEV_NAME  of=/dev/null >/dev/null 2>&1 && fail "Error detection failed."
+       $CRYPTSETUP close $DEV_NAME || fail "Cannot deactivate device."
+}
+
+intformat() # alg integrity integrity_out key_size int_key_size sector_size csum
+{
+       echo -n "[$1:$2:$4:$6]"
+       echo -n "[FORMAT]"
+       $CRYPTSETUP luksFormat --type luks2 -q -c $1 --integrity $2 --sector-size $6 -s $4 \
+               $FAST_PBKDF_OPT -d $KEY_FILE $DEV --offset 8192 --integrity-legacy-padding >/dev/null 2>&1
+       if [ $? -ne 0 ] ; then
+               echo "[N/A]"
+               return
+       fi
+       dump_check "cipher" $1
+       dump_check "sector" $6
+       dump_check "integrity" $3
+       dump_check "Key:" $(($4 + $5))
+       echo -n "[ACTIVATE]"
+       $CRYPTSETUP open -d $KEY_FILE $DEV $DEV_NAME || fail "Cannot activate device."
+       status_check "cipher" $1
+       status_check "sector size" $6
+       status_check "integrity:" $3
+       status_check "keysize:" $(($4 + $5))
+       [ $5 -gt 0 ] && status_check "integrity keysize:" $5
+       int_check_sum $1 $7
+       echo -n "[REMOVE]"
+       $CRYPTSETUP close $DEV_NAME || fail "Cannot deactivate device."
+       int_error_detection
+       echo "[OK]"
+}
+
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
+modprobe dm-integrity >/dev/null 2>&1
+dmsetup targets | grep integrity >/dev/null 2>&1 || skip "Cannot find dm-integrity target, test skipped."
+
+add_device
+
+intformat aes-cbc-essiv:sha256 hmac-sha256 hmac\(sha256\) 128 256  512 ee501705a084cd0ab6f4a28014bcf62b8bfa3434de00b82743c50b3abf06232c
+intformat aes-xts-plain64      hmac-sha256 hmac\(sha256\) 256 256  512 ee501705a084cd0ab6f4a28014bcf62b8bfa3434de00b82743c50b3abf06232c
+intformat aes-xts-random       hmac-sha256 hmac\(sha256\) 256 256  512 492c2d1cc9e222a850c399bfef4ed5a86bf5afc59e54f0f0c7ba8e2a64548323
+intformat aes-cbc-essiv:sha256 hmac-sha256 hmac\(sha256\) 256 256  512 ee501705a084cd0ab6f4a28014bcf62b8bfa3434de00b82743c50b3abf06232c
+intformat aes-xts-plain64      hmac-sha256 hmac\(sha256\) 512 256  512 ee501705a084cd0ab6f4a28014bcf62b8bfa3434de00b82743c50b3abf06232c
+intformat aes-xts-random       hmac-sha256 hmac\(sha256\) 512 256  512 492c2d1cc9e222a850c399bfef4ed5a86bf5afc59e54f0f0c7ba8e2a64548323
+intformat aes-cbc-essiv:sha256 hmac-sha256 hmac\(sha256\) 128 256 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+intformat aes-xts-plain64      hmac-sha256 hmac\(sha256\) 256 256 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+intformat aes-xts-random       hmac-sha256 hmac\(sha256\) 256 256 4096 8c0463f5ac09613674bdf40b0ff6f985edbc3de04e51fdc688873cb333ef3cda
+intformat aes-cbc-essiv:sha256 hmac-sha256 hmac\(sha256\) 256 256 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+intformat aes-xts-plain64      hmac-sha256 hmac\(sha256\) 512 256 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+intformat aes-xts-random       hmac-sha256 hmac\(sha256\) 512 256 4096 8c0463f5ac09613674bdf40b0ff6f985edbc3de04e51fdc688873cb333ef3cda
+
+intformat aes-cbc-essiv:sha256 hmac-sha512 hmac\(sha512\) 256 512 4096 9873d864fccb866521e79c9f0f75ad0c578d6bd7620399bbf4779e698c6e92fd
+intformat aes-xts-essiv:sha256 hmac-sha512 hmac\(sha512\) 512 512 4096 9873d864fccb866521e79c9f0f75ad0c578d6bd7620399bbf4779e698c6e92fd
+intformat aes-xts-plain64      hmac-sha512 hmac\(sha512\) 512 512 4096 9873d864fccb866521e79c9f0f75ad0c578d6bd7620399bbf4779e698c6e92fd
+intformat aes-xts-random       hmac-sha512 hmac\(sha512\) 512 512 4096 621f6c03f7361c2bf8f10059ae822339223f8471c750b0cf8584fba7134bd4a2
+
+intformat aes-xts-plain64 hmac-sha1 hmac\(sha1\) 512 160 4096 7370c66a92708fb71b186931468be6aa9b26f4f88373b00b1c57360b9ee1304e
+intformat aes-xts-random  hmac-sha1 hmac\(sha1\) 512 160 4096 8c0463f5ac09613674bdf40b0ff6f985edbc3de04e51fdc688873cb333ef3cda
+
+intformat aes-gcm-random aead aead 128 0  512 5f6f3f6be03c74d9aaaeaf40dd310c99a20e2786045f78a1fc6a0b189d231f57
+intformat aes-gcm-random aead aead 128 0 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+intformat aes-gcm-random aead aead 256 0  512 5f6f3f6be03c74d9aaaeaf40dd310c99a20e2786045f78a1fc6a0b189d231f57
+intformat aes-gcm-random aead aead 256 0 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+
+intformat aes-ccm-random aead aead 152 0  512 288e5e9bc5be6c0bd2a74abbb72c7944da83198b5e3041dcf159e7ae250dafa8
+intformat aes-ccm-random aead aead 152 0 4096 7370c66a92708fb71b186931468be6aa9b26f4f88373b00b1c57360b9ee1304e
+intformat aes-ccm-random aead aead 280 0  512 288e5e9bc5be6c0bd2a74abbb72c7944da83198b5e3041dcf159e7ae250dafa8
+intformat aes-ccm-random aead aead 280 0 4096 7370c66a92708fb71b186931468be6aa9b26f4f88373b00b1c57360b9ee1304e
+
+intformat chacha20-plain64 poly1305 poly1305 256 0  512 3f82eae753ff52a689ddc559c691bbdff838361bbe9a3ce8c7212e16e51b5dbe
+intformat chacha20-random  poly1305 poly1305 256 0  512 5f6f3f6be03c74d9aaaeaf40dd310c99a20e2786045f78a1fc6a0b189d231f57
+intformat chacha20-plain64 poly1305 poly1305 256 0 4096 7370c66a92708fb71b186931468be6aa9b26f4f88373b00b1c57360b9ee1304e
+intformat chacha20-random  poly1305 poly1305 256 0 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+
+intformat aegis128-random  aead aead 128 0  512 ee501705a084cd0ab6f4a28014bcf62b8bfa3434de00b82743c50b3abf06232c
+intformat aegis128-random  aead aead 128 0 4096 358d6beceddf593aff6b22c31684e0df9c226330aff5812e060950215217d21b
+
+cleanup
diff --git a/tests/luks2-reencryption-test b/tests/luks2-reencryption-test
new file mode 100755 (executable)
index 0000000..e0529c9
--- /dev/null
@@ -0,0 +1,1370 @@
+#!/bin/bash
+
+PS4='$LINENO:'
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+
+CRYPTSETUP_VALGRIND=../.libs/cryptsetup
+CRYPTSETUP_LIB_VALGRIND=../.libs
+
+FAST_PBKDF2="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
+FAST_PBKDF_ARGON="--pbkdf-force-iterations 4 --pbkdf-memory 32 --pbkdf-parallel 1"
+DEFAULT_ARGON="argon2i"
+
+DEV=""
+OVRDEV="123reenc321"
+DEVBIG="reenc2134"
+DEV_NAME=reenc9768
+DEV_NAME2=reenc97682
+IMG=reenc-data
+IMG_HDR=/tmp/$IMG.hdr
+KEY1=key1
+PWD1="93R4P4pIqAH8"
+PWD2="1cND4319812f"
+PWD3="1-9Qu5Ejfnqv"
+
+[ -f /etc/system-fips ] && FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/null)
+
+function dm_crypt_features()
+{
+       VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+       VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
+
+       [ $VER_MAJ -lt 1 ] && return
+       [ $VER_MAJ -gt 1 ] && {
+               DM_PERF_CPU=1
+               DM_SECTOR_SIZE=1
+               return
+       }
+
+       [ $VER_MIN -lt 14 ] && return
+       DM_PERF_CPU=1
+       if [ $VER_MIN -ge 17 -o \( $VER_MIN -eq 14 -a $VER_PTC -ge 5 \) ]; then
+               DM_SECTOR_SIZE=1
+       fi
+}
+
+function dm_delay_features()
+{
+       local _ver_str=$(dmsetup targets | grep delay | cut -f2 -dv)
+       [ -z "$_ver_str" ] && return 1
+       return 0
+}
+
+# $1 path to scsi debug bdev
+scsi_debug_teardown() {
+       local _tries=15;
+
+       while [ -b "$1" -a $_tries -gt 0 ]; do
+               rmmod scsi_debug 2> /dev/null
+               if [ -b "$1" ]; then
+                       sleep .1
+                       _tries=$((_tries-1))
+               fi
+       done
+
+       test ! -b "$1" || rmmod scsi_debug 2> /dev/null
+}
+
+function remove_mapping()
+{
+       [ -b /dev/mapper/$DEV_NAME ] && {
+               dmsetup resume $DEV_NAME
+               dmsetup remove --retry $DEV_NAME
+       }
+       [ -b /dev/mapper/$DEV_NAME2 ] && {
+               dmsetup resume $DEV_NAME2
+               dmsetup remove --retry $DEV_NAME2
+       }
+       [ -b /dev/mapper/$DEV_NAME-overlay ] && {
+               dmsetup resume $DEV_NAME-overlay
+               dmsetup remove --retry $DEV_NAME-overlay
+       }
+       [ -b /dev/mapper/$DEV_NAME-hotzone-forward ] && {
+               dmsetup resume $DEV_NAME-hotzone-forward
+               dmsetup remove --retry $DEV_NAME-hotzone-forward
+       }
+       [ -b /dev/mapper/$DEV_NAME-hotzone-backward ] && {
+               dmsetup resume $DEV_NAME-hotzone-backward
+               dmsetup remove --retry $DEV_NAME-hotzone-backward
+       }
+       [ -b /dev/mapper/$OVRDEV ] && dmsetup remove --retry $OVRDEV 2>/dev/null
+       [ -b /dev/mapper/$OVRDEV-err ] && dmsetup remove --retry $OVRDEV-err 2>/dev/null
+       [ -n "$LOOPDEV" ] && losetup -d $LOOPDEV
+       unset LOOPDEV
+       rm -f $IMG $IMG_HDR $KEY1 $DEVBIG >/dev/null 2>&1
+       rmmod scsi_debug 2> /dev/null
+       scsi_debug_teardown $DEV
+}
+
+function fail()
+{
+       local frame=0
+       [ -n "$1" ] && echo "$1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       remove_mapping
+       exit 2
+}
+
+function skip()
+{
+       [ -n "$1" ] && echo "$1"
+       exit 77
+}
+
+function fips_mode()
+{
+       [ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ]
+}
+
+function add_scsi_device() {
+       scsi_debug_teardown $DEV
+        modprobe scsi_debug $@ delay=0
+        if [ $? -ne 0 ] ; then
+                echo "This kernel seems to not support proper scsi_debug module, test skipped."
+                exit 77
+        fi
+
+        sleep 1
+        DEV="/dev/"$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+        [ -b $DEV ] || fail "Cannot find $DEV."
+}
+
+function open_crypt() # $1 pwd, $2 hdr
+{
+       if [ -n "$2" ] ; then
+               echo "$1" | $CRYPTSETUP luksOpen $DEV $DEV_NAME --header $2 || fail
+       elif [ -n "$1" ] ; then
+               echo "$1" | $CRYPTSETUP luksOpen $DEV $DEV_NAME || fail
+       else
+               $CRYPTSETUP luksOpen -d $KEY1 $DEV $DEV_NAME || fail
+       fi
+}
+
+function wipe_dev() # $1 dev
+{
+       if [ -b $1 ] ; then
+               blkdiscard --zeroout $1 2>/dev/null || dd if=/dev/zero of=$1 bs=1M conv=notrunc >/dev/null 2>&1
+       else
+               local size=$(stat --printf="%s" $1)
+               truncate -s 0 $1
+               truncate -s $size $1
+       fi
+}
+
+function wipe() # $1 pass, $2 hdr
+{
+       open_crypt $1 $2
+       wipe_dev /dev/mapper/$DEV_NAME
+       udevadm settle >/dev/null 2>&1
+       $CRYPTSETUP luksClose $DEV_NAME || fail
+}
+
+function prepare() # $1 dev1_siz
+{
+       remove_mapping
+
+       if [ ! -e $KEY1 ]; then
+               dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1
+       fi
+
+       add_scsi_device $@
+}
+
+function preparebig() # $1 dev1_siz
+{
+       remove_mapping
+
+       if [ ! -e $KEY1 ]; then
+               dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1
+       fi
+
+       truncate -s "$1"M $DEVBIG
+       LOOPDEV=$(losetup -f)
+       losetup -f $DEVBIG || fail
+       DEV=$LOOPDEV
+}
+
+function check_hash_dev() # $1 dev, $2 hash
+{
+       HASH=$(sha256sum $1 | cut -d' ' -f 1)
+       [ $HASH != "$2" ] && fail "HASH differs (expected: $2) (result $HASH)"
+}
+
+function check_hash() # $1 pwd, $2 hash, $3 hdr
+{
+       open_crypt $1 $3
+       check_hash_dev /dev/mapper/$DEV_NAME $2
+       $CRYPTSETUP remove $DEV_NAME || fail
+}
+
+function check_hash_head() # $1 pwd, $2 len, $3 hash, $4 hdr
+{
+       open_crypt $1 $4
+       if [ -n "$4" ]; then
+               echo $1 | $CRYPTSETUP resize $DEV_NAME --size $2 --header $4 || fail
+       else
+               echo $1 | $CRYPTSETUP resize $DEV_NAME --size $2 || fail
+       fi
+       check_hash_dev /dev/mapper/$DEV_NAME $3
+       $CRYPTSETUP remove $DEV_NAME || fail
+}
+
+function resize_file() # $1 dev, $2 shrink bytes
+{
+       local size=$(stat --printf="%s" $1)
+       truncate -s $(($size + $2)) $1
+       losetup -c $LOOPDEV
+}
+
+function error_writes() { # $1 dmdev, $2 data dev, $3 offset, $4 size
+       local _dev_size=$(blockdev --getsz /dev/mapper/$1)
+       local _offset=$(($3+$4))
+       local _size=$((_dev_size-_offset))
+       local _err=$1-err
+       local _table=
+       dmsetup create $_err --table "0 $_dev_size error" || fail
+
+       if [ $3 -ne 0 ]; then
+               _table="0 $3 linear $2 0\n"
+       fi
+
+       _table=$_table"$3 $4 delay $2 $3 0 /dev/mapper/$_err $3 0"
+
+       if [ $_size -ne 0 ]; then
+               _table="$_table\n$_offset $_size linear $2 $_offset"
+       fi
+
+       echo -e "$_table" | dmsetup load $1 || fail
+       dmsetup resume $1 || fail
+       blockdev --setra 0 /dev/mapper/$1
+       blockdev --setra 0 /dev/mapper/$_err
+}
+
+function fix_writes() { # $1 dmdev, $2 data dev
+       local _dev_size=$(blockdev --getsz /dev/mapper/$1)
+       dmsetup load $1 --table "0 $_dev_size linear $2 0" || fail
+       dmsetup resume $1 || fail
+       dmsetup remove --retry $1-err 2>/dev/null || fail
+}
+
+function prepare_linear_dev() {
+       local _sizemb=$1
+       shift
+
+       if [ "$_sizemb" -gt 32 ]; then
+               preparebig $_sizemb
+       else
+               prepare dev_size_mb=$_sizemb $@
+       fi
+
+       dmsetup create $OVRDEV --table "0 $((_sizemb*1024*2)) linear $DEV 0" || fail
+
+       OLD_DEV=$DEV
+       DEV=/dev/mapper/$OVRDEV
+}
+
+function get_error_offsets() # $1 devsize, $2 minimal offset, $3 sector_size [512 if ommited], $4 max offset
+{
+       local _devsize=$(($1*1024*2))
+       local _sector_size=${3:-512}
+       local _max_offset=${4:-$_devsize}
+       _sector_size=$((_sector_size/512))
+
+       # 8 sectors minimal size (4096)
+       ERRLENGTH=$((($RANDOM%56)+8))
+       ERRLENGTH=$(($ERRLENGTH-($ERRLENGTH%$_sector_size)))
+
+       ERROFFSET=$(($2+((2*$RANDOM)%($_max_offset-$2-$ERRLENGTH))))
+       ERROFFSET=$(($ERROFFSET-($ERROFFSET%$_sector_size)))
+}
+
+function reencrypt_recover() { # $1 sector size, $2 resilience, $3 digest, [$4 header]
+       echo -n "resilience mode: $2 ..."
+       local _hdr=""
+       test -z "$4" || _hdr="--header $4"
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV $_hdr --hotzone-size 1M --resilience $2 --sector-size $1 -q $FAST_PBKDF_ARGON 2>/dev/null && fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       echo $PWD1 | $CRYPTSETUP -q repair $DEV $_hdr || fail
+
+       check_hash $PWD1 $3 $4
+
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV $_hdr --resilience $2 --sector-size $1 -q $FAST_PBKDF_ARGON || fail
+       check_hash $PWD1 $3 $4
+
+       echo "[OK]"
+}
+
+function reencrypt_recover_online() { # $1 sector size, $2 resilience, $3 digest, [$4 header]
+       echo -n "resilience mode: $2 ..."
+       local _hdr=""
+       test -z "$4" || _hdr="--header $4"
+
+       echo $PWD1 | $CRYPTSETUP open $DEV $_hdr $DEV_NAME || fail
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt --active-name $DEV_NAME $_hdr --hotzone-size 1M --resilience $2 --sector-size $1 -q $FAST_PBKDF_ARGON 2>/dev/null && fail
+       $CRYPTSETUP status $DEV_NAME $_hdr | grep -q "reencryption:  in-progress" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       # recovery during activation
+       echo $PWD1 | $CRYPTSETUP open $DEV $_hdr $DEV_NAME || fail
+       check_hash_dev /dev/mapper/$DEV_NAME $3
+
+       $CRYPTSETUP luksDump ${4:-$DEV} | grep -q "online-reencrypt"
+       if [ $? -eq 0 ]; then
+               $CRYPTSETUP status $DEV_NAME $_hdr | grep -q "reencryption:  in-progress" || fail
+               echo $PWD1 | $CRYPTSETUP reencrypt --active-name $DEV_NAME $_hdr --resilience $2 --resume-only -q || fail
+               check_hash_dev /dev/mapper/$DEV_NAME $3
+       fi
+
+       $CRYPTSETUP close $DEV_NAME || fail
+       echo "[OK]"
+}
+
+function encrypt_recover() { # $1 sector size, $2 reduce size, $3 digest, $4 device size in sectors, $5 origin digest
+       wipe_dev $DEV
+       check_hash_dev $DEV $5
+
+       echo -n "resilience mode: datashift ..."
+
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --reduce-device-size $2 --sector-size $1 -q $FAST_PBKDF_ARGON --init-only >/dev/null 2>&1 || fail
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q >/dev/null 2>&1 && fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       echo $PWD1 | $CRYPTSETUP -q repair $DEV || fail
+
+       $CRYPTSETUP luksDump $DEV | grep -q "online-reencrypt"
+       if [ $? -eq 0 ]; then
+               check_hash $PWD1 $3
+               echo $PWD1 | $CRYPTSETUP reencrypt $DEV --sector-size $1 -q $FAST_PBKDF_ARGON || fail
+       fi
+
+       check_hash_head $PWD1 $4 $3
+
+       echo "[OK]"
+}
+
+function encrypt_recover_online() { # $1 sector size, $2 reduce size, $3 digest, $4 device size in sectors, $5 origin digest
+       wipe_dev $DEV
+       check_hash_dev $DEV $5
+
+       echo -n "resilience mode: datashift ..."
+
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --reduce-device-size $2 --sector-size $1 -q $FAST_PBKDF_ARGON --init-only > /dev/null || fail
+       echo $PWD1 | $CRYPTSETUP open $DEV $DEV_NAME || fail
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q >/dev/null 2>&1 && fail
+       $CRYPTSETUP status $DEV_NAME | grep -q "reencryption:  in-progress" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       # recovery in activation
+       echo $PWD1 | $CRYPTSETUP open $DEV $DEV_NAME || fail
+
+       $CRYPTSETUP luksDump $DEV | grep -q "online-reencrypt"
+       if [ $? -eq 0 ]; then
+               $CRYPTSETUP status $DEV_NAME | grep -q "reencryption:  in-progress" || fail
+               check_hash_dev /dev/mapper/$DEV_NAME $3
+               echo $PWD1 | $CRYPTSETUP reencrypt --resume-only --active-name $DEV_NAME -q || fail
+       fi
+
+       $CRYPTSETUP close $DEV_NAME || fail
+       check_hash_head $PWD1 $4 $3
+
+       echo "[OK]"
+}
+
+function encrypt_recover_detached() { # $1 sector size, $2 resilience, $3 digest, $4 hdr
+       wipe_dev $DEV
+       check_hash_dev $DEV $3
+
+       echo -n "resilience mode: $2 ..."
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --hotzone-size 1M --header $4 --resilience $2 --sector-size $1 -q $FAST_PBKDF_ARGON 2>/dev/null && fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       echo $PWD1 | $CRYPTSETUP repair $DEV --header $4 || fail
+
+       check_hash $PWD1 $3 $4
+
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV --header $4 --resilience $2 --sector-size $1 -q $FAST_PBKDF_ARGON || fail
+       check_hash $PWD1 $3 $4
+
+       echo "[OK]"
+}
+
+function encrypt_recover_detached_online() { # $1 sector size, $2 resilience, $3 digest, $4 hdr
+       wipe_dev $DEV
+       check_hash_dev $DEV $3
+
+       echo -n "resilience mode: $2 ..."
+
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --hotzone-size 1M --header $4 --resilience $2 --sector-size $1 -q $FAST_PBKDF_ARGON --init-only || fail
+       echo $PWD1 | $CRYPTSETUP open $DEV --header $4 $DEV_NAME || fail
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $DEV --header $4 --hotzone-size 1M  2>/dev/null && fail
+       $CRYPTSETUP status $DEV_NAME --header $4 | grep -q "reencryption:  in-progress" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       echo $PWD1 | $CRYPTSETUP open $DEV --header $4 $DEV_NAME || fail
+       check_hash_dev /dev/mapper/$DEV_NAME $3
+
+       $CRYPTSETUP luksDump $4 | grep -q "online-reencrypt"
+       if [ $? -eq 0 ]; then
+               $CRYPTSETUP status $DEV_NAME --header $4 | grep -q "reencryption:  in-progress" || fail
+               echo $PWD1 | $CRYPTSETUP reencrypt --active-name $DEV_NAME --resume-only --header $4 --resilience $2 -q || fail
+               check_hash_dev /dev/mapper/$DEV_NAME $3
+       fi
+
+       $CRYPTSETUP close $DEV_NAME || fail
+
+       echo "[OK]"
+}
+
+function decrypt_recover_detached() { # $1 sector size, $2 resilience, $3 digest, $4 hdr
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size $1 --header $4 $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1 $4
+       check_hash $PWD1 $3 $4
+
+       echo -n "resilience mode: $2 ..."
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV --decrypt --hotzone-size 1M --header $4 --resilience $2 -q 2>/dev/null && fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       echo $PWD1 | $CRYPTSETUP repair $DEV --header $4 || fail
+
+       $CRYPTSETUP luksDump $4 | grep -q "online-reencrypt"
+       if [ $? -eq 0 ]; then
+               check_hash $PWD1 $3 $4
+               echo $PWD1 | $CRYPTSETUP reencrypt $DEV --resume-only --header $4 --resilience $2 -q || fail
+       fi
+
+       check_hash_dev $DEV $3
+
+       echo "[OK]"
+}
+
+function decrypt_recover_detached_online() { # $1 sector size, $2 resilience, $3 digest, $4 hdr
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size $1 --header $4 $FAST_PBKDF_ARGON $DEV || fail
+       echo $PWD1 | $CRYPTSETUP open $DEV --header $4 $DEV_NAME || fail
+       wipe_dev /dev/mapper/$DEV_NAME
+       check_hash_dev /dev/mapper/$DEV_NAME $3
+
+       echo -n "resilience mode: $2 ..."
+
+       error_writes $OVRDEV $OLD_DEV $ERROFFSET $ERRLENGTH
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV --decrypt --hotzone-size 1M --header $4 --resilience $2 -q 2>/dev/null && fail
+       $CRYPTSETUP status $DEV_NAME --header $4 | grep -q "reencryption:  in-progress" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       fix_writes $OVRDEV $OLD_DEV
+
+       # recovery during activation
+       echo $PWD1 | $CRYPTSETUP open $DEV --header $4 $DEV_NAME || fail
+
+       $CRYPTSETUP luksDump $4 | grep -q "online-reencrypt"
+       if [ $? -eq 0 ]; then
+               $CRYPTSETUP status $DEV_NAME --header $4 | grep -q "reencryption:  in-progress" || fail
+               check_hash_dev /dev/mapper/$DEV_NAME $3
+               echo $PWD1 | $CRYPTSETUP reencrypt $DEV --header $4 --resilience $2 -q || fail
+       fi
+
+       $CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 && fail
+       check_hash_dev $DEV $3
+
+       echo "[OK]"
+}
+
+# sector size (bytes)
+# reenc dev size (sectors)
+# reenc dev digest
+# resilience
+# orig size
+# orig size digest
+# hdr (optional)
+function reencrypt_offline_fixed_size() {
+       local _esz=$(($1>>9))
+       local _hdr=""
+       test -z "$7" || _hdr="--header $7"
+
+       # reencrypt with fixed device size
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV  $_hdr --sector-size $1 --device-size $2s --resilience $4 || fail
+       check_hash_head $PWD1 $2 $3 $7
+       wipe $PWD1 $7
+
+       # try to reencrypt device size + 1 encryption sector size
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --sector-size $1 --init-only || fail
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --device-size $(($5+_esz))s --resilience $4 2>/dev/null && fail
+       check_hash $PWD1 $6 $7
+
+       # misaligned reencryption size
+       if [ $_esz -gt 1 ]; then
+               echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --device-size $(($2+_esz-1))s --resilience $4 2>/dev/null && fail
+               $CRYPTSETUP luksDump ${7:-$DEV} | grep -q "2: crypt" || fail
+               $CRYPTSETUP luksDump ${7:-$DEV} | grep -q "3: crypt" && fail
+               check_hash $PWD1 $6 $7
+       fi
+}
+
+# sector size (bytes)
+# reenc dev size (sectors)
+# reenc dev digest
+# resilience
+# orig size
+# orig size digest
+# hdr
+function encrypt_offline_fixed_size() {
+       local _esz=$(($1>>9))
+
+       # reencrypt with fixed device size
+       wipe_dev $DEV
+       echo $PWD1 | $CRYPTSETUP reencrypt --encrypt -q $FAST_PBKDF_ARGON $DEV --header $7 --sector-size $1 --device-size $2s --resilience $4 || fail
+       check_hash_head $PWD1 $2 $3 $7
+
+       # try to reencrypt device size + 1 encryption sector size
+       wipe_dev $DEV
+       echo $PWD1 | $CRYPTSETUP reencrypt --encrypt -q $FAST_PBKDF_ARGON $DEV --header $7 --sector-size $1 --init-only || fail
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV  --header $7 --device-size $(($5+_esz))s --resilience $4 2>/dev/null && fail
+       check_hash $PWD1 $6 $7
+
+       # misaligned reencryption size
+       if [ $_esz -gt 1 ]; then
+               echo $PWD1 | $CRYPTSETUP reencrypt --encrypt -q $FAST_PBKDF_ARGON $DEV --header $7 --sector-size $1 --init-only || fail
+               echo $PWD1 | $CRYPTSETUP reencrypt -q $DEV --header $7 --device-size $(($2+_esz-1))s --resilience $4 2>/dev/null && fail
+               $CRYPTSETUP luksDump $7 | grep -q "2: crypt" || fail
+               $CRYPTSETUP luksDump $7 | grep -q "3: crypt" && fail
+               check_hash $PWD1 $6 $7
+       fi
+}
+
+# sector size (bytes)
+# reenc dev size (sectors)
+# reenc dev digest
+# resilience
+# orig size
+# orig size digest
+# hdr
+function decrypt_offline_fixed_size() {
+       local _esz=$(($1>>9))
+
+       # decrypt with fixed device size
+       echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 -q $FAST_PBKDF_ARGON $DEV --header $7 --sector-size $1 || fail
+       wipe $PWD1 $7
+       echo $PWD1 | $CRYPTSETUP reencrypt --decrypt -q $DEV --header $7 --device-size $2s --resilience $4 || fail
+
+       dmsetup load $OVRDEV --table "0 $2 linear $OLD_DEV 0" || fail
+       dmsetup resume $OVRDEV || fail
+       check_hash_dev $DEV $3
+       dmsetup load $OVRDEV --table "0 $5 linear $OLD_DEV 0" || fail
+       dmsetup resume $OVRDEV || fail
+
+       # try to decrypt device size + 1 encryption sector size
+       echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 -q $FAST_PBKDF_ARGON $DEV --header $7 --sector-size $1 || fail
+       wipe $PWD1 $7
+       echo $PWD1 | $CRYPTSETUP reencrypt --decrypt -q $FAST_PBKDF_ARGON $DEV --header $7 --init-only || fail
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV --header $7 --device-size $(($5+_esz))s --resilience $4 2>/dev/null && fail
+       check_hash $PWD1 $6 $7
+
+       # misaligned reencryption size
+       if [ $_esz -gt 1 ]; then
+               echo $PWD1 | $CRYPTSETUP reencrypt -q $DEV --header $7 --device-size $(($2+_esz-1))s --resilience $4 2>/dev/null && fail
+               $CRYPTSETUP luksDump $7 | grep -q "2: linear\|2: crypt" || fail
+               $CRYPTSETUP luksDump $7 | grep -q "3: crypt\|3: linear" && fail
+               check_hash $PWD1 $6 $7
+       fi
+}
+
+# sector size (bytes)
+# reenc dev size (sectors)
+# reenc dev digest
+# resilience
+# orig size
+# orig size digest
+# hdr (optional)
+function reencrypt_online_fixed_size() {
+       local _esz=$(($1>>9))
+       local _hdr=""
+       test -z "$7" || _hdr="--header $7"
+
+       if [ -z "$_hdr" ]; then
+               echo $PWD1 | $CRYPTSETUP -q luksFormat --sector-size 512 --type luks2 --offset 16384 $FAST_PBKDF_ARGON $DEV || fail
+       else
+               echo $PWD1 | $CRYPTSETUP -q luksFormat --sector-size 512 --type luks2 $_hdr $FAST_PBKDF_ARGON $DEV || fail
+       fi
+       wipe $PWD1 $7
+
+       # reencrypt with fixed device size
+       echo $PWD1 | $CRYPTSETUP open $DEV $_hdr $DEV_NAME || fail
+       echo $PWD1 | $CRYPTSETUP resize $DEV_NAME $_hdr --size $2 || fail
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --sector-size $1 --resilience $4 || fail
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "$2 sectors" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       check_hash_head $PWD1 $2 $3 $7
+       wipe $PWD1 $7
+
+       # active device != requested reencryption size
+       echo $PWD1 | $CRYPTSETUP open $DEV $_hdr $DEV_NAME || fail
+       echo $PWD1 | $CRYPTSETUP resize $DEV_NAME $_hdr --size $2 || fail
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --sector-size $1 --init-only || fail
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --device-size $(($2-_esz))s --resilience $4 2>/dev/null && fail
+       echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --device-size $2s --resilience $4 || fail
+       $CRYPTSETUP -q status  $DEV_NAME | grep "size:" | grep -q "$2 sectors" || fail
+       $CRYPTSETUP close $DEV_NAME || fail
+       check_hash_head $PWD1 $2 $3 $7
+
+       # misaligned reencryption size
+       if [ $_esz -gt 1 ]; then
+               if [ -z "$_hdr" ]; then
+                       echo $PWD1 | $CRYPTSETUP -q luksFormat --sector-size 512 --type luks2 --offset 16384 $FAST_PBKDF_ARGON $DEV || fail
+               else
+                       echo $PWD1 | $CRYPTSETUP -q luksFormat --sector-size 512 --type luks2 $_hdr $FAST_PBKDF_ARGON $DEV || fail
+               fi
+               wipe $PWD1 $7
+               check_hash $PWD1 $6 $7
+
+               echo $PWD1 | $CRYPTSETUP open $DEV $_hdr $DEV_NAME || fail
+               echo $PWD1 | $CRYPTSETUP resize $DEV_NAME $_hdr --size $(($2+_esz-1)) || fail
+               echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --sector-size $1 --init-only || fail
+               echo $PWD1 | $CRYPTSETUP reencrypt -q $FAST_PBKDF_ARGON $DEV $_hdr --resilience $4 2>/dev/null && fail
+               $CRYPTSETUP close $DEV_NAME || fail
+               check_hash $PWD1 $6 $7
+       fi
+}
+
+function valgrind_setup()
+{
+       which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
+       [ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptsetup executable."
+       export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
+}
+
+function valgrind_run()
+{
+       INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
+}
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+[ ! -x "$CRYPTSETUP" ] && skip "Cannot find $CRYPTSETUP, test skipped."
+fips_mode && skip "This test cannot be run in FIPS mode."
+modprobe --dry-run scsi_debug || exit 77
+modprobe dm-crypt || fail "dm-crypt failed to load"
+modprobe dm-delay > /dev/null 2>&1
+dm_crypt_features
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       TEST_SECTORS="512 4096"
+else
+       TEST_SECTORS="512"
+fi
+
+modinfo scsi_debug -p | grep -q opt_xferlen_exp && OPT_XFERLEN_EXP="opt_xferlen_exp=6"
+
+export LANG=C
+
+[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
+
+# REENCRYPTION tests
+
+# 28 MiBs of zeros (32MiBs - 4MiB LUKS2 header)
+HASH1=f8280c81b347b01405277bf9e8bf0685ae8be863ff104797c65b7169f8203fd2
+# 1 MiB of zeros
+HASH2=30e14955ebf1352266dc2ff8067e68104607e750abb9d3b36582b8af909fcb58
+# 256 MiBs of zeros
+HASH3=a6d72ac7690f53be6ae46ba88506bd97302a093f7108472bd9efc3cefda06484
+# 64 MiBs of zeroes
+HASH4=3b6a07d0d404fab4e23b6d34bc6696a6a312dd92821332385e5af7c01c421351
+# 56 MiBs of zeroes
+HASH5=8afcb7e7189ce4d112fd245eaa60c3cfcf5a5d5e1d6bf4eb85941d73ef8cfbd5
+# 43 MiBs of zeroes
+HASH6=39f7c6d38af574fe2c90ef400dfaba8ef8edccd11bdac998a3f8143a86837331
+# 31 MiBs of zeroes
+HASH7=18a393d1a505e22ccf3e29effe3005ea8627e4c36b7cca0e53f58121f49b67e1
+# 60 MiBs of zeroes
+HASH8=cf5ac69ca412f9b3b1a8b8de27d368c5c05ed4b1b6aa40e6c38d9cbf23711342
+
+echo "[1] Reencryption"
+echo -n "[512 sector]"
+prepare dev_size_mb=32
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 -c aes-cbc-essiv:sha256 --offset 8192 $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 256 -c twofish-cbc-essiv:sha256 --resilience journal $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q --resilience none $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 128 -c aes-cbc-essiv:sha256 --resilience checksum $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+# simple test --active-name can consume absolute path to mapping
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -c aes-xts-plain64 --init-only $FAST_PBKDF_ARGON || fail
+echo $PWD1 | $CRYPTSETUP open $DEV $DEV_NAME || fail
+echo $PWD1 | $CRYPTSETUP reencrypt --active-name /dev/mapper/$DEV_NAME --resilience none -q || fail
+echo $PWD1 | $CRYPTSETUP close $DEV_NAME || fail
+echo -n "[OK][4096 sector]"
+prepare sector_size=4096 dev_size_mb=32
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 -c aes-cbc-essiv:sha256 --offset 8192 $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 256 -c twofish-cbc-essiv:sha256 --resilience journal $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q --resilience none $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 128 -c aes-cbc-essiv:sha256 --resilience checksum $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q $FAST_PBKDF_ARGON --sector-size 4096 || fail
+       check_hash $PWD1 $HASH1
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 256 -c twofish-cbc-essiv:sha256 --resilience journal --sector-size 2048 $FAST_PBKDF_ARGON || fail
+       check_hash $PWD1 $HASH1
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q --resilience none $FAST_PBKDF_ARGON --sector-size 1024 || fail
+       check_hash $PWD1 $HASH1
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 128 -c aes-cbc-essiv:sha256 --resilience checksum --sector-size 512 $FAST_PBKDF_ARGON || fail
+       check_hash $PWD1 $HASH1
+fi
+echo -n "[OK][4096/512 sector]"
+prepare sector_size=512 physblk_exp=3 dev_size_mb=32
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 -c aes-cbc-essiv:sha256 --offset 8192 $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 256 -c twofish-cbc-essiv:sha256 --resilience journal $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q --resilience none $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 128 -c aes-cbc-essiv:sha256 --resilience checksum $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH1
+echo "[OK]"
+
+# reencrypt minimal device size (FIXME: change data device size to single encryption sector size)
+# temporary small device size is default luks2 hdr size + 1MiB
+echo -n "[small device reencryption]"
+prepare dev_size_mb=5
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 -c aes-cbc-essiv:sha256 --offset 8192 $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH2
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH2
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 256 -c twofish-cbc-essiv:sha256 --resilience journal $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH2
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q --resilience none $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH2
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 128 -c aes-cbc-essiv:sha256 --resilience checksum $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH2
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q $FAST_PBKDF_ARGON --sector-size 4096 || fail
+       check_hash $PWD1 $HASH2
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 256 -c twofish-cbc-essiv:sha256 --resilience journal --sector-size 2048 $FAST_PBKDF_ARGON || fail
+       check_hash $PWD1 $HASH2
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q --resilience none $FAST_PBKDF_ARGON --sector-size 1024 || fail
+       check_hash $PWD1 $HASH2
+       echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -s 128 -c aes-cbc-essiv:sha256 --resilience checksum --sector-size 512 $FAST_PBKDF_ARGON || fail
+       check_hash $PWD1 $HASH2
+fi
+echo "[OK]"
+
+echo "[2] Encryption with data shift"
+# well, movin' zeroes :-)
+preparebig 64
+wipe_dev $DEV
+check_hash_dev $DEV $HASH4
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt -c aes-cbc-essiv:sha256 -s 128 --reduce-device-size 8M -q $FAST_PBKDF_ARGON || fail
+check_hash_head $PWD1 $((56*1024*2)) $HASH5
+wipe_dev $DEV
+check_hash_dev $DEV $HASH4
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt -c twofish-cbc-essiv:sha256 -s 128 --reduce-device-size 21M -q $FAST_PBKDF_ARGON || fail
+check_hash_head $PWD1 $((43*1024*2)) $HASH6
+wipe_dev $DEV
+# offset 21504 equals 10,5MiBs, equals --reduce-device-size 21M from test above (30M is ignored here, we'll reduce it to 21M in cryptsetup anyway)
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt -c twofish-cbc-essiv:sha256 -s 128 --offset 21504 --reduce-device-size 30M -q $FAST_PBKDF_ARGON > /dev/null || fail
+check_hash_head $PWD1 $((43*1024*2)) $HASH6
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --reduce-device-size 33M -q $FAST_PBKDF_ARGON || fail
+check_hash_head $PWD1 $((31*1024*2)) $HASH7
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --reduce-device-size 64M -q $FAST_PBKDF_ARGON > /dev/null 2>&1 && fail
+echo $PWD1 | $CRYPTSETUP reencrypt --encrypt --reduce-device-size 8M --init-only -q $FAST_PBKDF_ARGON $DEV || fail
+resize_file $DEVBIG -512
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV 2> /dev/null && fail
+resize_file $DEVBIG 512
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt -c aes-cbc-essiv:sha256 -s 128 --offset 32760 --reduce-device-size 8M -q $FAST_PBKDF_ARGON --init-only >/dev/null 2>&1 && fail
+# data offset at 21MiB
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --header $IMG_HDR --offset 43008 --reduce-device-size 21M -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH6 $IMG_HDR
+$CRYPTSETUP luksHeaderRestore --header-backup-file $IMG_HDR $DEV -q || fail
+check_hash $PWD1 $HASH6
+
+# Device activation after encryption initialization
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --init-only -c aes-cbc-essiv:sha256 -s 128 -S11 --reduce-device-size 8M -q $FAST_PBKDF_ARGON $DEV_NAME >/dev/null || fail
+$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
+check_hash_dev /dev/mapper/$DEV_NAME $HASH5
+echo $PWD1 | $CRYPTSETUP reencrypt --resume-only $DEV -q || fail
+check_hash_dev /dev/mapper/$DEV_NAME $HASH5
+
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt -c aes-cbc-essiv:sha256 -s 128 --reduce-device-size 8M -q $FAST_PBKDF_ARGON $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP close $DEV_NAME
+check_hash_head $PWD1 $((56*1024*2)) $HASH5
+
+# Device activation using key file
+wipe_dev $DEV
+echo -n $PWD1 > $KEY1
+$CRYPTSETUP reencrypt $DEV --encrypt --init-only -c aes-cbc-essiv:sha256 -s 128 --reduce-device-size 8M --key-file $KEY1 -q $FAST_PBKDF_ARGON $DEV_NAME >/dev/null || fail
+$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
+$CRYPTSETUP close $DEV_NAME
+echo $PWD1 | $CRYPTSETUP open $DEV --test-passphrase || fail
+
+echo "[3] Encryption with detached header"
+preparebig 256
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt --encrypt -c aes-cbc-essiv:sha256 -s 128 --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt --encrypt --resilience journal --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt --encrypt -c twofish-cbc-essiv:sha256 -s 128 --resilience none --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt --encrypt -c serpent-xts-plain --resilience checksum --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+
+# Device activation after encryption initialization
+wipe_dev $DEV
+echo $PWD1 | $CRYPTSETUP reencrypt --encrypt --init-only -c aes-cbc-essiv:sha256 -s 128 --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV $DEV_NAME >/dev/null || fail
+$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
+check_hash_dev /dev/mapper/$DEV_NAME $HASH3
+echo $PWD1 | $CRYPTSETUP reencrypt --resume-only --header $IMG_HDR --active-name $DEV_NAME -q || fail
+check_hash_dev /dev/mapper/$DEV_NAME $HASH3
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt -c aes-cbc-essiv:sha256 -s 128 --reduce-device-size 8M -q $FAST_PBKDF_ARGON $DEV_NAME 2>/dev/null && fail
+$CRYPTSETUP close $DEV_NAME
+check_hash $PWD1 $HASH3 $IMG_HDR
+
+# Device activation using key file
+wipe_dev $DEV
+echo -n $PWD1 > $KEY1
+$CRYPTSETUP reencrypt $DEV --encrypt --init-only -c aes-cbc-essiv:sha256 -s 128 --header $IMG_HDR --key-file $KEY1 -q $FAST_PBKDF_ARGON $DEV_NAME >/dev/null || fail
+$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
+$CRYPTSETUP close $DEV_NAME
+echo $PWD1 | $CRYPTSETUP open --header $IMG_HDR $DEV --test-passphrase || fail
+
+echo "[4] Reencryption with detached header"
+wipe $PWD1 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt -c aes-cbc-essiv:sha256 -s 128 --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt --resilience journal --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt -c twofish-cbc-essiv:sha256 -s 128 --resilience none --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt -c serpent-xts-plain --resilience checksum --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+check_hash $PWD1 $HASH3 $IMG_HDR
+# trivial check for detached header misuse
+dd if=/dev/zero of=$IMG bs=4k count=1 >/dev/null 2>&1
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 -c aes-cbc-essiv:sha256 -s 128 --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+echo $PWD1 | $CRYPTSETUP open $IMG $DEV_NAME --header $IMG_HDR || fail
+echo $PWD1 | $CRYPTSETUP open $DEV $DEV_NAME2 --header $IMG_HDR || fail
+echo $PWD1 | $CRYPTSETUP reencrypt --active-name $DEV_NAME --header $IMG_HDR -q || fail
+# key description mismatch in active device
+echo $PWD1 | $CRYPTSETUP reencrypt --active-name $DEV_NAME2 --header $IMG_HDR >/dev/null 2>&1 && fail
+# also check it can abort initialization in this case
+$CRYPTSETUP luksDump $IMG_HDR | grep -q "online-reencrypt" && fail
+$CRYPTSETUP close $DEV_NAME || fail
+$CRYPTSETUP close $DEV_NAME2 || fail
+
+echo "[5] Decryption with detached header"
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 -c aes-cbc-essiv:sha256 -s 128 --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt -q --decrypt --header $IMG_HDR $DEV || fail
+check_hash_dev $DEV $HASH3
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt -q --decrypt --resilience journal --header $IMG_HDR $DEV || fail
+check_hash_dev $DEV $HASH3
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 -c twofish-cbc-essiv:sha256 -s 128 --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt -q --decrypt --resilience none --header $IMG_HDR $DEV || fail
+check_hash_dev $DEV $HASH3
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 -c serpent-xts-plain --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1 $IMG_HDR
+echo $PWD1 | $CRYPTSETUP reencrypt -q --decrypt --resilience checksum --header $IMG_HDR $DEV || fail
+check_hash_dev $DEV $HASH3
+
+# check deferred remove works as expected after decryption
+echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 -c serpent-xts-plain --header $IMG_HDR -q $FAST_PBKDF_ARGON $DEV || fail
+open_crypt $PWD1 $IMG_HDR
+dmsetup create $DEV_NAME2 --table "0 1 linear /dev/mapper/$DEV_NAME 0" || fail
+echo $PWD1 | $CRYPTSETUP reencrypt -q --decrypt --resilience checksum --header $IMG_HDR --active-name $DEV_NAME || fail
+$CRYPTSETUP status $DEV_NAME >/dev/null || fail
+dmsetup remove --retry $DEV_NAME2
+$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 && fail
+
+if ! dm_delay_features; then
+       echo "dm-delay target is missing, skipping recovery tests."
+       remove_mapping
+       exit 0
+fi
+
+echo "[6] Reencryption recovery"
+# (check opt-io size optimization in reencryption code does not affect recovery)
+# device with opt-io size 32k
+prepare_linear_dev 32 opt_blks=64 $OPT_XFERLEN_EXP
+OFFSET=8192
+
+echo "sector size 512->512"
+
+get_error_offsets 32 $OFFSET
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH1
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+reencrypt_recover 512 checksum $HASH1
+reencrypt_recover 512 journal $HASH1
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 512->4096"
+
+       get_error_offsets 32 $OFFSET 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1
+       check_hash $PWD1 $HASH1
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover 4096 checksum $HASH1
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1
+       check_hash $PWD1 $HASH1
+       reencrypt_recover 4096 journal $HASH1
+
+       echo "sector size 4096->4096"
+
+       get_error_offsets 32 $OFFSET 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 --sector-size 4096 -c aes-cbc-essiv:sha256 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1
+       check_hash $PWD1 $HASH1
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover 4096 checksum $HASH1
+       reencrypt_recover 4096 journal $HASH1
+fi
+
+echo "[7] Reencryption recovery (online i/o error)"
+
+echo "sector size 512->512"
+
+get_error_offsets 32 $OFFSET
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH1
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+reencrypt_recover_online 512 checksum $HASH1
+reencrypt_recover_online 512 journal $HASH1
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 512->4096"
+
+       get_error_offsets 32 $OFFSET 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1
+       check_hash $PWD1 $HASH1
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover_online 4096 checksum $HASH1
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1
+       check_hash $PWD1 $HASH1
+       reencrypt_recover_online 4096 journal $HASH1
+
+       echo "sector size 4096->4096"
+
+       get_error_offsets 32 $OFFSET 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 --sector-size 4096 -c aes-cbc-essiv:sha256 --offset $OFFSET $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1
+       check_hash $PWD1 $HASH1
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover_online 4096 checksum $HASH1
+       reencrypt_recover_online 4096 journal $HASH1
+fi
+
+echo "[8] Reencryption with detached header recovery"
+prepare_linear_dev 31 opt_blks=64 $OPT_XFERLEN_EXP
+
+echo "sector size 512->512"
+
+get_error_offsets 31 0
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1 $IMG_HDR
+check_hash $PWD1 $HASH7 $IMG_HDR
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+reencrypt_recover 512 checksum $HASH7 $IMG_HDR
+reencrypt_recover 512 journal $HASH7 $IMG_HDR
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 512->4096"
+
+       get_error_offsets 31 0 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1 $IMG_HDR
+       check_hash $PWD1 $HASH7 $IMG_HDR
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover 4096 checksum $HASH7 $IMG_HDR
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1 $IMG_HDR
+       check_hash $PWD1 $HASH7 $IMG_HDR
+       reencrypt_recover 4096 journal $HASH7 $IMG_HDR
+
+       echo "sector size 4096->4096"
+
+       get_error_offsets 31 0 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 4096 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1 $IMG_HDR
+       check_hash $PWD1 $HASH7 $IMG_HDR
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover 4096 checksum $HASH7 $IMG_HDR
+       reencrypt_recover 4096 journal $HASH7 $IMG_HDR
+fi
+
+echo "[9] Reencryption with detached header recovery (online i/o error)"
+
+echo "sector size 512->512"
+
+get_error_offsets 31 0
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1 $IMG_HDR
+check_hash $PWD1 $HASH7 $IMG_HDR
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+reencrypt_recover_online 512 checksum $HASH7 $IMG_HDR
+reencrypt_recover_online 512 journal $HASH7 $IMG_HDR
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 512->4096"
+
+       get_error_offsets 31 0 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1 $IMG_HDR
+       check_hash $PWD1 $HASH7 $IMG_HDR
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover_online 4096 checksum $HASH7 $IMG_HDR
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 512 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1 $IMG_HDR
+       check_hash $PWD1 $HASH7 $IMG_HDR
+       reencrypt_recover_online 4096 journal $HASH7 $IMG_HDR
+
+       echo "sector size 4096->4096"
+
+       get_error_offsets 31 0 4096
+       echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --sector-size 4096 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+       wipe $PWD1 $IMG_HDR
+       check_hash $PWD1 $HASH7 $IMG_HDR
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       reencrypt_recover_online 4096 checksum $HASH7 $IMG_HDR
+       reencrypt_recover_online 4096 journal $HASH7 $IMG_HDR
+fi
+
+echo "[10] Encryption recovery"
+prepare_linear_dev 64
+OFFSET=$((2*1024*2))
+
+echo "sector size 512"
+
+get_error_offsets 64 $OFFSET 512 $((62*1024*2))
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+encrypt_recover 512 4M $HASH8 $((60*1024*2)) $HASH4
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 4096"
+
+       get_error_offsets 64 $OFFSET 4096 $((62*1024*2))
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       encrypt_recover 4096 4M $HASH8 $((60*1024*2)) $HASH4
+fi
+
+echo "[11] Encryption recovery (online i/o error)"
+
+echo "sector size 512"
+
+get_error_offsets 64 $OFFSET 512 $((62*1024*2))
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+encrypt_recover_online 512 4M $HASH8 $((60*1024*2)) $HASH4
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 4096"
+
+       get_error_offsets 64 $OFFSET 4096 $((62*1024*2))
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       encrypt_recover_online 4096 4M $HASH8 $((60*1024*2)) $HASH4
+fi
+
+echo "[12] Encryption with detached header recovery"
+prepare_linear_dev 31 opt_blks=64 $OPT_XFERLEN_EXP
+
+get_error_offsets 31 0
+
+echo "sector size 512"
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+encrypt_recover_detached 512 checksum $HASH7 $IMG_HDR
+encrypt_recover_detached 512 journal $HASH7 $IMG_HDR
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       get_error_offsets 31 0 4096
+
+       echo "sector size 4096"
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       encrypt_recover_detached 4096 checksum $HASH7 $IMG_HDR
+       encrypt_recover_detached 4096 journal $HASH7 $IMG_HDR
+fi
+
+echo "[13] Encryption with detached header recovery (online i/o error)"
+
+get_error_offsets 31 0
+
+echo "sector size 512"
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+encrypt_recover_detached_online 512 checksum $HASH7 $IMG_HDR
+encrypt_recover_detached_online 512 journal $HASH7 $IMG_HDR
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       get_error_offsets 31 0 4096
+
+       echo "sector size 4096"
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       encrypt_recover_detached_online 4096 checksum $HASH7 $IMG_HDR
+       encrypt_recover_detached_online 4096 journal $HASH7 $IMG_HDR
+fi
+
+echo "[14] Decryption with detached header recovery"
+
+echo "sector size 512"
+
+# TODO: What should decryption do when it finishes decryption during recovery (with open)
+get_error_offsets 31 2049
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+decrypt_recover_detached 512 journal $HASH7 $IMG_HDR
+decrypt_recover_detached 512 checksum $HASH7 $IMG_HDR
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 4096"
+
+       # TODO: What should decryption do when it finishes decryption during recovery (with open)
+       get_error_offsets 31 2048 4096
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       decrypt_recover_detached 4096 checksum $HASH7 $IMG_HDR
+       decrypt_recover_detached 4096 journal $HASH7 $IMG_HDR
+fi
+
+echo "[15] Decryption with detached header recovery (online i/o error)"
+
+echo "sector size 512"
+
+# TODO: What should decryption do when it finishes decryption during recovery (with open)
+get_error_offsets 31 2049
+
+echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+decrypt_recover_detached_online 512 journal $HASH7 $IMG_HDR
+decrypt_recover_detached_online 512 checksum $HASH7 $IMG_HDR
+
+if [ -n "$DM_SECTOR_SIZE" ]; then
+       echo "sector size 4096"
+
+       # TODO: What should decryption do when it finishes decryption during recovery (with open)
+       get_error_offsets 31 2048 4096
+
+       echo "ERR writes to sectors [$ERROFFSET,$(($ERROFFSET+$ERRLENGTH-1))]"
+       decrypt_recover_detached_online 4096 checksum $HASH7 $IMG_HDR
+       decrypt_recover_detached_online 4096 journal $HASH7 $IMG_HDR
+fi
+
+echo "[16] Offline reencryption with fixed device size."
+preparebig 68
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --offset 16384 $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH8
+
+for test_ss in $TEST_SECTORS; do
+printf "sector size %4s: " $test_ss
+for test_res in checksum journal none; do
+       echo -n "[$test_res]"
+       reencrypt_offline_fixed_size $test_ss 2048              $HASH2 $test_res $((60*1024*2)) $HASH8
+       reencrypt_offline_fixed_size $test_ss $((28*1024*2))    $HASH1 $test_res $((60*1024*2)) $HASH8
+       reencrypt_offline_fixed_size $test_ss $((31*1024*2))    $HASH7 $test_res $((60*1024*2)) $HASH8
+       echo -n "[OK]"
+done
+echo ""
+done
+
+echo "[17] Online reencryption with fixed device size."
+for test_ss in $TEST_SECTORS; do
+printf "sector size %4s: " $test_ss
+for test_res in checksum journal none; do
+       echo -n "[$test_res]"
+       reencrypt_online_fixed_size $test_ss 2048               $HASH2 $test_res $((60*1024*2)) $HASH8
+       reencrypt_online_fixed_size $test_ss $((28*1024*2))     $HASH1 $test_res $((60*1024*2)) $HASH8
+       reencrypt_online_fixed_size $test_ss $((31*1024*2))     $HASH7 $test_res $((60*1024*2)) $HASH8
+       echo -n "[OK]"
+done
+echo ""
+done
+
+echo "[18] Offline reencryption with fixed device size (detached header)."
+preparebig 60
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --header $IMG_HDR $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1 $IMG_HDR
+check_hash $PWD1 $HASH8 $IMG_HDR
+
+for test_ss in $TEST_SECTORS; do
+printf "sector size %4s: " $test_ss
+for test_res in checksum journal none; do
+       echo -n "[$test_res]"
+       reencrypt_offline_fixed_size $test_ss 2048              $HASH2 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       reencrypt_offline_fixed_size $test_ss $((28*1024*2))    $HASH1 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       reencrypt_offline_fixed_size $test_ss $((31*1024*2))    $HASH7 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       echo -n "[OK]"
+done
+echo ""
+done
+
+echo "[19] Online reencryption with fixed device size (detached header)."
+for test_ss in $TEST_SECTORS; do
+printf "sector size %4s: " $test_ss
+for test_res in checksum journal none; do
+       echo -n "[$test_res]"
+       reencrypt_online_fixed_size $test_ss 2048               $HASH2 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       reencrypt_online_fixed_size $test_ss $((28*1024*2))     $HASH1 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       reencrypt_online_fixed_size $test_ss $((31*1024*2))     $HASH7 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       echo -n "[OK]"
+done
+echo ""
+done
+
+echo "[20] Offline encryption with fixed device size (detached header)."
+for test_ss in $TEST_SECTORS; do
+printf "sector size %4s: " $test_ss
+for test_res in checksum journal none; do
+       echo -n "[$test_res]"
+       encrypt_offline_fixed_size $test_ss 2048                $HASH2 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       encrypt_offline_fixed_size $test_ss $((28*1024*2))      $HASH1 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       encrypt_offline_fixed_size $test_ss $((31*1024*2))      $HASH7 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       echo -n "[OK]"
+done
+echo ""
+done
+
+echo "[21] Offline decryption with fixed device size (detached header)."
+prepare_linear_dev 60
+for test_ss in $TEST_SECTORS; do
+printf "sector size %4s: " $test_ss
+for test_res in checksum journal none; do
+       echo -n "[$test_res]"
+       decrypt_offline_fixed_size $test_ss 2048                $HASH2 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       decrypt_offline_fixed_size $test_ss $((28*1024*2))      $HASH1 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       decrypt_offline_fixed_size $test_ss $((31*1024*2))      $HASH7 $test_res $((60*1024*2)) $HASH8 $IMG_HDR
+       echo -n "[OK]"
+done
+echo ""
+done
+
+echo "[22] Multi-keyslot device reencryption"
+prepare dev_size_mb=17
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 --offset 32768 $FAST_PBKDF_ARGON $DEV || fail
+echo -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF2 $DEV || fail
+echo -e "$PWD1\n$PWD3" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON $DEV || fail
+wipe $PWD1
+check_hash $PWD1 $HASH2
+
+echo -e "$PWD1\n$PWD2\n$PWD3" | $CRYPTSETUP reencrypt $DEV -q || fail
+check_hash $PWD1 $HASH2
+check_hash $PWD2 $HASH2
+check_hash $PWD3 $HASH2
+
+# check at least pbkdf type is preserved
+$CRYPTSETUP luksDump $DEV | grep -e "3: luks2" -A5 | grep -q "argon2" || fail
+$CRYPTSETUP luksDump $DEV | grep -e "4: luks2" -A5 | grep -q "pbkdf2" || fail
+$CRYPTSETUP luksDump $DEV | grep -e "5: luks2" -A5 | grep -q "argon2" || fail
+
+echo $PWD1 | $CRYPTSETUP -q luksAddKey $FAST_PBKDF2 $DEV $KEY1 || fail
+
+# with more keyslots, specific has to be selected
+$CRYPTSETUP reencrypt $DEV -d $KEY1 -q 2>/dev/null && fail
+$CRYPTSETUP reencrypt $DEV -d $KEY1 -q -S0 || fail
+open_crypt
+check_hash_dev /dev/mapper/$DEV_NAME $HASH2
+$CRYPTSETUP close $DEV_NAME
+
+# there should be single keyslot now
+$CRYPTSETUP reencrypt $DEV -d $KEY1 -q || fail
+echo $PWD1 | $CRYPTSETUP -q luksAddKey $FAST_PBKDF2 $DEV -S1 -d $KEY1 || fail
+
+echo $PWD3 | $CRYPTSETUP -q luksAddKey $FAST_PBKDF2 $DEV -S2 --unbound --key-size 32 || fail
+echo $PWD3 | $CRYPTSETUP -q luksAddKey $FAST_PBKDF2 $DEV -S22 --unbound --key-size 32 || fail
+echo $PWD3 | $CRYPTSETUP -q luksAddKey $FAST_PBKDF2 $DEV -S23 --unbound --key-size 32 || fail
+
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -S1 -q || fail
+$CRYPTSETUP open --test-passphrase -d $KEY1 $DEV 2>/dev/null && fail
+echo $PWD3 | $CRYPTSETUP open --test-passphrase -S2 $DEV || fail
+echo $PWD3 | $CRYPTSETUP open --test-passphrase -S22 $DEV || fail
+check_hash $PWD1 $HASH2
+
+# fill 31 keyslots
+COUNT=27
+while [ $COUNT -gt 0 ]; do
+       echo -e "$PWD1\n$PWD1" | $CRYPTSETUP luksAddKey $DEV -q $FAST_PBKDF_ARGON || fail
+       COUNT=$((COUNT-1))
+done
+
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -S0 -q 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksKillSlot $DEV 30 || fail
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV -q -S0 || fail
+
+COUNT=14
+while [ $COUNT -gt 0 ]; do
+       echo -e "$PWD1\n$PWD1" | $CRYPTSETUP luksAddKey $DEV -q $FAST_PBKDF_ARGON || fail
+       COUNT=$((COUNT-1))
+done
+
+echo -e "$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1" | $CRYPTSETUP reencrypt $DEV -q 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP luksKillSlot $DEV 1 || fail
+# one wrong passphrase
+echo -e "$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD2" | $CRYPTSETUP reencrypt $DEV -q 2>/dev/null && fail
+echo $PWD1 | $CRYPTSETUP reencrypt $DEV --resume-only -q 2>/dev/null && fail
+echo -e "$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1\n$PWD1" | $CRYPTSETUP reencrypt $DEV -q  || fail
+
+remove_mapping
+exit 0
diff --git a/tests/luks2-validation-test b/tests/luks2-validation-test
new file mode 100755 (executable)
index 0000000..52945ba
--- /dev/null
@@ -0,0 +1,233 @@
+#!/bin/bash
+
+#turn on debug mode by following env. variable _DEBUG=1
+
+PS4='$LINENO:'
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+
+CRYPTSETUP_VALGRIND=../.libs/cryptsetup
+CRYPTSETUP_LIB_VALGRIND=../.libs
+
+START_DIR=$(pwd)
+
+IMG=luks2-backend.img
+ORIG_IMG=luks2_valid_hdr.img
+TST_IMGS=$START_DIR/luks2-images
+
+GEN_DIR=generators
+
+FAILS=0
+
+[ -z "$srcdir" ] && srcdir="."
+
+function remove_mapping()
+{
+       rm -rf $IMG $TST_IMGS >/dev/null 2>&1
+}
+
+function fail()
+{
+       [ -n "$1" ] && echo "$1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       cd $START_DIR
+       remove_mapping
+       exit 2
+}
+
+fail_count()
+{
+       echo "$1"
+       FAILS=$((FAILS+1))
+}
+
+function skip()
+{
+       [ -n "$1" ] && echo "$1"
+       exit 77
+}
+
+function prepare() # $1 dev1_size
+{
+       remove_mapping
+
+       test -d $TST_IMGS || mkdir $TST_IMGS
+
+       test -e $ORIG_IMG || xz -dkc $srcdir/$ORIG_IMG.xz >$ORIG_IMG
+       cp $ORIG_IMG $TST_IMGS
+       cp $ORIG_IMG $IMG
+}
+
+function test_load()
+{
+       local _debug=
+
+       test -z "$_DEBUG" || _debug="--debug"
+
+       case "$1" in
+       R)
+               if [ -n "$_debug" ]; then
+                       $CRYPTSETUP luksDump $_debug $IMG
+               else
+                       $CRYPTSETUP luksDump $_debug $IMG > /dev/null 2>&1
+               fi
+               test $? -eq 0 || return 1
+               ;;
+       F)
+               if [ -n "$_debug" ]; then
+                       $CRYPTSETUP luksDump $_debug $IMG
+               else
+                       $CRYPTSETUP luksDump $_debug $IMG > /dev/null 2>&1
+               fi
+               test $? -ne 0 || return 1
+               ;;
+       *)
+               fail "Internal test error"
+               ;;
+       esac
+}
+
+function RUN()
+{
+       echo -n "Test image: $1..."
+       cp $TST_IMGS/$1 $IMG || fail "Missing test image"
+       test_load $2 "$3"
+       if [ $? -ne 0 ]; then
+               fail_count "$3"
+       else
+               echo "OK"
+       fi
+}
+
+function valgrind_setup()
+{
+       which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
+       [ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptsetup executable."
+       export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
+}
+
+function valgrind_run()
+{
+       INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${CRYPTSETUP_VALGRIND} "$@"
+}
+
+[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
+
+which jq >/dev/null 2>&1 || skip "Cannot find jq, test skipped."
+
+prepare
+
+echo "[0] Generating test headers"
+cd $srcdir/$GEN_DIR
+for scr in ./generate-*.sh; do
+       echo -n "$(basename $scr)..."
+       $scr $TST_IMGS $TST_IMGS/$ORIG_IMG || fail "Header generator $scr failed: '$?'"
+       echo "done"
+done
+cd $START_DIR
+
+echo "[1] Test basic auto-recovery"
+RUN luks2-invalid-checksum-hdr0.img "R" "Failed to recover from trivial header corruption at offset 0"
+# TODO: check epoch is incresed after recovery
+# TODO: check only sectors related to corrupted hdr at offset 0 are written (dmstats tool/differ.c)
+
+RUN luks2-invalid-checksum-hdr1.img "R" "Failed to recover from trivial header corruption at offset 16384"
+# TODO: check epoch is incresed after recovery
+# TODO: check only sectors related to corrupted hdr at offset 16384 are written (dmstats tool/differ.c)
+
+RUN luks2-invalid-checksum-both-hdrs.img "F" "Failed to recognise corrupted header beyond repair"
+
+echo "[2] Test ability to auto-correct mallformed json area"
+RUN luks2-corrupted-hdr0-with-correct-chks.img "R" "Failed to auto correct malformed json area at offset 512"
+# TODO: check epoch is incresed after recovery
+# TODO: check only sectors related to corrupted hdr at offset 0 are written (dmstats tool/differ.c)
+
+RUN luks2-corrupted-hdr1-with-correct-chks.img "R" "Failed to auto correct malformed json area at offset 16896"
+# TODO: check epoch is incresed after recovery
+# TODO: check only sectors related to corrupted hdr at offset 16384 are written (dmstats tool/differ.c)
+
+RUN luks2-correct-full-json0.img "R" "Failed to parse full and correct json area"
+# TODO: detect noop (norecovery, epoch untouched)
+# TODO: check epoch is NOT incresed after recovery of secondary header
+
+# these tests auto-correct json in-memory only. It'll get fixed on-disk after write operation
+RUN luks2-argon2-leftover-params.img   "R" "Failed to repair keyslot with old argon2 parameters."
+RUN luks2-pbkdf2-leftover-params-0.img "R" "Failed to repair keyslot with old pbkdf2 parameters."
+RUN luks2-pbkdf2-leftover-params-1.img "R" "Failed to repair keyslot with old pbkdf2 parameters."
+
+# Secondary header is always broken in following tests
+echo "[3] Test LUKS2 json area restrictions"
+RUN luks2-non-null-byte-beyond-json0.img               "F" "Failed to detect illegal data right beyond json data string"
+RUN luks2-non-null-bytes-beyond-json0.img              "F" "Failed to detect illegal data in json area"
+RUN luks2-missing-trailing-null-byte-json0.img         "F" "Failed to detect missing terminal null byte"
+RUN luks2-invalid-opening-char-json0.img               "F" "Failed to detect invalid opening character in json area"
+RUN luks2-invalid-object-type-json0.img                        "F" "Failed to detect invalid json object type"
+RUN luks2-overlapping-areas-c0-json0.img               "F" "Failed to detect two exactly same area specifications"
+RUN luks2-overlapping-areas-c1-json0.img               "F" "Failed to detect two intersecting area specifications"
+RUN luks2-overlapping-areas-c2-json0.img               "F" "Failed to detect two slightly intersecting area specifications"
+RUN luks2-area-in-json-hdr-space-json0.img             "F" "Failed to detect area referencing LUKS2 header space"
+RUN luks2-missing-keyslot-referenced-in-digest.img     "F" "Failed to detect missing keyslot referenced in digest"
+RUN luks2-missing-segment-referenced-in-digest.img     "F" "Failed to detect missing segment referenced in digest"
+RUN luks2-missing-keyslot-referenced-in-token.img      "F" "Failed to detect missing keyslots referenced in token"
+RUN luks2-keyslot-missing-digest.img                   "F" "Failed to detect missing keyslot digest."
+RUN luks2-keyslot-too-many-digests.img                 "F" "Failed to detect keyslot has too many digests."
+
+echo "[4] Test integers value limits"
+RUN luks2-uint64-max-segment-size.img                  "R" "Validation rejected correct value"
+RUN luks2-uint64-overflow-segment-size.img             "F" "Failed to detect uint64_t overflow"
+RUN luks2-uint64-signed-segment-size.img               "F" "Failed to detect negative value"
+
+echo "[5] Test segments validation"
+RUN luks2-segment-missing-type.img                     "F" "Failed to detect missing type field"
+RUN luks2-segment-wrong-type.img                       "F" "Failed to detect invalid type field"
+RUN luks2-segment-missing-offset.img                   "F" "Failed to detect missing offset field"
+RUN luks2-segment-wrong-offset.img                     "F" "Failed to detect invalid offset field"
+RUN luks2-segment-missing-size.img                     "F" "Failed to detect missing size field"
+RUN luks2-segment-wrong-size-0.img                     "F" "Failed to detect invalid size field"
+RUN luks2-segment-wrong-size-1.img                     "F" "Failed to detect invalid size field"
+RUN luks2-segment-wrong-size-2.img                     "F" "Failed to detect invalid size field"
+RUN luks2-segment-crypt-missing-encryption.img         "F" "Failed to detect missing encryption field"
+RUN luks2-segment-crypt-wrong-encryption.img           "F" "Failed to detect invalid encryption field"
+RUN luks2-segment-crypt-missing-ivoffset.img           "F" "Failed to detect missing iv_tweak field"
+RUN luks2-segment-crypt-wrong-ivoffset.img             "F" "Failed to detect invalid iv_tweak field"
+RUN luks2-segment-crypt-missing-sectorsize.img         "F" "Failed to detect missing sector_size field"
+RUN luks2-segment-crypt-wrong-sectorsize-0.img         "F" "Failed to detect invalid sector_size field"
+RUN luks2-segment-crypt-wrong-sectorsize-1.img         "F" "Failed to detect invalid sector_size field"
+RUN luks2-segment-crypt-wrong-sectorsize-2.img         "F" "Failed to detect invalid sector_size field"
+RUN luks2-segment-unknown-type.img                     "R" "Validation rejected segment with all mandatory fields correct"
+RUN luks2-segment-two.img                              "R" "Validation rejected two valid segments"
+RUN luks2-segment-wrong-flags.img                      "F" "Failed to detect invalid flags field"
+RUN luks2-segment-wrong-flags-element.img              "F" "Failed to detect invalid flags content"
+
+echo "[6] Test metadata size and keyslots size (config section)"
+RUN luks2-invalid-keyslots-size-c0.img                 "F" "Failed to detect too large keyslots_size in config section"
+RUN luks2-invalid-keyslots-size-c1.img                 "F" "Failed to detect unaligned keyslots_size in config section"
+RUN luks2-invalid-keyslots-size-c2.img                 "F" "Failed to detect too small keyslots_size config section"
+RUN luks2-invalid-json-size-c0.img                     "F" "Failed to detect invalid json_size config section"
+RUN luks2-invalid-json-size-c1.img                     "F" "Failed to detect invalid json_size config section"
+RUN luks2-invalid-json-size-c2.img                     "F" "Failed to detect mismatching json size in config and binary hdr"
+RUN luks2-metadata-size-32k.img                                "R" "Valid 32KiB metadata size failed to validate"
+RUN luks2-metadata-size-64k.img                                "R" "Valid 64KiB metadata size failed to validate"
+RUN luks2-metadata-size-64k-inv-area-c0.img            "F" "Failed to detect keyslot area trespassing in json area"
+RUN luks2-metadata-size-64k-inv-area-c1.img            "F" "Failed to detect keyslot area overflowing keyslots area"
+RUN luks2-metadata-size-64k-inv-keyslots-size-c0.img   "F" "Failed to detect keyslots size overflowing in data area"
+RUN luks2-metadata-size-128k.img                       "R" "Valid 128KiB metadata size failed to validate"
+RUN luks2-metadata-size-256k.img                       "R" "Valid 256KiB metadata size failed to validate"
+RUN luks2-metadata-size-512k.img                       "R" "Valid 512KiB metadata size failed to validate"
+RUN luks2-metadata-size-1m.img                         "R" "Valid 1MiB metadata size failed to validate"
+RUN luks2-metadata-size-2m.img                         "R" "Valid 2MiB metadata size failed to validate"
+RUN luks2-metadata-size-4m.img                         "R" "Valid 4MiB metadata size failed to validate"
+RUN luks2-metadata-size-16k-secondary.img              "R" "Valid 16KiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-32k-secondary.img              "R" "Valid 32KiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-64k-secondary.img              "R" "Valid 64KiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-128k-secondary.img             "R" "Valid 128KiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-256k-secondary.img             "R" "Valid 256KiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-512k-secondary.img             "R" "Valid 512KiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-1m-secondary.img               "R" "Valid 1MiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-2m-secondary.img               "R" "Valid 2MiB metadata size in secondary hdr failed to validate"
+RUN luks2-metadata-size-4m-secondary.img               "R" "Valid 4MiB metadata size in secondary hdr failed to validate"
+
+remove_mapping
+
+test $FAILS -eq 0 || fail "($FAILS wrong result(s) in total)"
diff --git a/tests/luks2_header_requirements.xz b/tests/luks2_header_requirements.xz
new file mode 100644 (file)
index 0000000..eaaa73c
Binary files /dev/null and b/tests/luks2_header_requirements.xz differ
diff --git a/tests/luks2_header_requirements_free.xz b/tests/luks2_header_requirements_free.xz
new file mode 100644 (file)
index 0000000..7617ee6
Binary files /dev/null and b/tests/luks2_header_requirements_free.xz differ
diff --git a/tests/luks2_keyslot_unassigned.img.xz b/tests/luks2_keyslot_unassigned.img.xz
new file mode 100644 (file)
index 0000000..726cdd7
Binary files /dev/null and b/tests/luks2_keyslot_unassigned.img.xz differ
diff --git a/tests/luks2_mda_images.tar.xz b/tests/luks2_mda_images.tar.xz
new file mode 100644 (file)
index 0000000..a27f5c7
Binary files /dev/null and b/tests/luks2_mda_images.tar.xz differ
diff --git a/tests/luks2_valid_hdr.img.xz b/tests/luks2_valid_hdr.img.xz
new file mode 100644 (file)
index 0000000..4e03a20
Binary files /dev/null and b/tests/luks2_valid_hdr.img.xz differ
index fcc460d..d16482f 100755 (executable)
@@ -2,10 +2,12 @@
 #
 # Test mode compatibility, check input + kernel and cryptsetup cipher status
 #
-CRYPTSETUP=../src/cryptsetup
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 DEV_NAME=dmc_test
 HEADER_IMG=mode-test.img
 PASSWORD=3xrododenron
+PASSWORD1=$PASSWORD
 
 # cipher-chainmode-ivopts:ivmode
 CIPHERS="aes twofish serpent"
@@ -16,14 +18,14 @@ LOOPDEV=$(losetup -f 2>/dev/null)
 
 dmremove() { # device
        udevadm settle >/dev/null 2>&1
-       dmsetup remove $1 >/dev/null 2>&1
+       dmsetup remove --retry $1 >/dev/null 2>&1
 }
 
 cleanup() {
        for dev in $(dmsetup status --target crypt | sed s/\:\ .*// | grep "^$DEV_NAME"_); do
                dmremove $dev
+               sleep 2
        done
-       sleep 2
        [ -b /dev/mapper/$DEV_NAME ] && dmremove $DEV_NAME
        losetup -d $LOOPDEV >/dev/null 2>&1
        rm -f $HEADER_IMG >/dev/null 2>&1
@@ -32,6 +34,8 @@ cleanup() {
 fail()
 {
        [ -n "$1" ] && echo "$1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        cleanup
        exit 100
 }
@@ -39,10 +43,11 @@ fail()
 skip()
 {
        [ -n "$1" ] && echo "$1"
-       exit 0
+       exit 77
 }
 
 add_device() {
+       cleanup
        dd if=/dev/zero of=$HEADER_IMG bs=1M count=6 >/dev/null 2>&1
        sync
        losetup $LOOPDEV $HEADER_IMG >/dev/null 2>&1
@@ -72,7 +77,7 @@ dmcrypt_check() # device outstring
        dmremove $1
 }
 
-dmcrypt_check_sum() # cipher device outstring
+dmcrypt_check_sum() # cipher device
 {
        EXPSUM="c036cbb7553a909f8b8877d4461924307f27ecb66cff928eeeafd569c3887e29"
        # Fill device with zeroes and reopen it
@@ -98,28 +103,35 @@ dmcrypt()
 {
        OUT=$2
        [ -z "$OUT" ] && OUT=$1
-       printf "%-25s" "$1"
+       printf "%-31s" "$1"
 
-       echo $PASSWORD | $CRYPTSETUP create -h sha256 -c $1 -s 256 "$DEV_NAME"_"$1" /dev/mapper/$DEV_NAME >/dev/null 2>&1
+       echo $PASSWORD | $CRYPTSETUP create -h sha256 -c $1 -s 256 "$DEV_NAME"_tstdev /dev/mapper/$DEV_NAME >/dev/null 2>&1
        if [ $? -eq 0 ] ; then
                echo -n -e "PLAIN:"
-               dmcrypt_check "$DEV_NAME"_"$1" $OUT
+               dmcrypt_check "$DEV_NAME"_tstdev $OUT
        else
                echo -n "[n/a]"
        fi
 
-       echo $PASSWORD | $CRYPTSETUP luksFormat -i 1 -c $1 -s 256 /dev/mapper/$DEV_NAME >/dev/null 2>&1
+       echo $PASSWORD | $CRYPTSETUP luksFormat --type luks1 -i 1 -c $1 -s 256 /dev/mapper/$DEV_NAME >/dev/null 2>&1
        if [ $? -eq 0 ] ; then
-               echo -n -e " LUKS:"
-               echo $PASSWORD | $CRYPTSETUP luksOpen /dev/mapper/$DEV_NAME "$DEV_NAME"_"$1" >/dev/null 2>&1
-               dmcrypt_check "$DEV_NAME"_"$1" $OUT
+               echo -n -e " LUKS1:"
+               echo $PASSWORD | $CRYPTSETUP luksOpen /dev/mapper/$DEV_NAME "$DEV_NAME"_tstdev >/dev/null 2>&1 || fail
+               dmcrypt_check "$DEV_NAME"_tstdev $OUT
+       fi
+
+       echo $PASSWORD | $CRYPTSETUP luksFormat --type luks2 --pbkdf pbkdf2 -i 1 -c $1 -s 256 --offset 8192 /dev/mapper/$DEV_NAME >/dev/null 2>&1
+       if [ $? -eq 0 ] ; then
+               echo -n -e " LUKS2:"
+               echo $PASSWORD | $CRYPTSETUP luksOpen /dev/mapper/$DEV_NAME "$DEV_NAME"_tstdev >/dev/null 2>&1 || fail
+               dmcrypt_check "$DEV_NAME"_tstdev $OUT
        fi
 
        # repeated device creation must return the same checksum
-       echo $PASSWORD | $CRYPTSETUP create -h sha256 -c $1 -s 256 "$DEV_NAME"_"$1" /dev/mapper/$DEV_NAME >/dev/null 2>&1
+       echo $PASSWORD | $CRYPTSETUP create -h sha256 -c $1 -s 256 "$DEV_NAME"_tstdev /dev/mapper/$DEV_NAME >/dev/null 2>&1
        if [ $? -eq 0 ] ; then
                echo -n -e " CHECKSUM:"
-               dmcrypt_check_sum "$1" "$DEV_NAME"_"$1"
+               dmcrypt_check_sum "$1" "$DEV_NAME"_tstdev
        fi
        echo
 }
@@ -134,10 +146,12 @@ dmcrypt aes aes-cbc-plain
 dmcrypt aes-plain aes-cbc-plain
 
 # empty cipher
+PASSWORD=""
 dmcrypt null cipher_null-ecb
-dmcrypt cipher_null cipher_null-cbc-plain
+dmcrypt cipher_null cipher_null-ecb
 dmcrypt cipher_null-ecb
 
+PASSWORD=$PASSWORD1
 # codebook doesn't support IV at all
 for cipher in $CIPHERS ; do
        dmcrypt "$cipher-ecb"
@@ -151,4 +165,7 @@ for cipher in $CIPHERS ; do
        done
 done
 
+dmcrypt xchacha12,aes-adiantum-plain64
+dmcrypt xchacha20,aes-adiantum-plain64
+
 cleanup
index a03af50..0fb58b3 100755 (executable)
@@ -2,7 +2,8 @@
 
 # check hash processing in create command
 
-CRYPTSETUP=../src/cryptsetup
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 DEV_NAME=dmc_test
 KEY_FILE=keyfile
 
@@ -10,7 +11,7 @@ DEV2=$DEV_NAME"_x"
 
 dmremove() { # device
        udevadm settle >/dev/null 2>&1
-       dmsetup remove $1 >/dev/null 2>&1
+       dmsetup remove --retry $1 >/dev/null 2>&1
 }
 
 cleanup() {
@@ -23,7 +24,9 @@ cleanup() {
 function fail()
 {
         echo " $1 [FAILED]"
-        cleanup 2
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       cleanup 2
 }
 
 crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
@@ -72,7 +75,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
        esac
 
        # ignore these cases, not all libs/kernel supports it
-       if [ "$1" == "ripemd160" -o $2 -gt 256 ] ; then
+       if [ "$1" != "sha1" -a "$1" != "sha256" ] || [ $2 -gt 256 ] ; then
                if [ $ret -ne 0 ] ; then
                        echo " [N/A] ($ret, SKIPPED)"
                        return
@@ -94,7 +97,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit] [offset]
 
 if [ $(id -u) != 0 ]; then
        echo "WARNING: You must be root to run this test, test skipped."
-       exit 0
+       exit 77
 fi
 
 dmsetup create $DEV_NAME --table "0 10240 zero" >/dev/null 2>&1
@@ -131,6 +134,7 @@ echo -n -e "0123456789abcdef\n\x01\x00\x03\xff\xff\r\xff\xff\n\r" \
           "2352j3rkjhadcfasc823rqaw7e1 3dq sdq3d 2dkjqw3h2=====" >$KEY_FILE
 KEY_FILE_HEX="303132333435363738396162636465660a010003ffff0dffff0a0d20323335326a33726b6a686164636661736338323372716177376531203364712073647133"
 
+
 # ignore hash if keyfile is specified
 crypt_key ripemd160 256 file $KEY_FILE ${KEY_FILE_HEX:0:64}
 crypt_key sha256    256 file $KEY_FILE ${KEY_FILE_HEX:0:64}
@@ -168,4 +172,19 @@ crypt_key sha256    128 pwd "0123456789abcdef" 9f9f5111f7b27a781f1f1ddde5ebc2dd
 crypt_key sha256    128 pwd "0123456789abcdef" 1be2e452b46d7a0d9656bbb1f768e824  4
 crypt_key sha256    128 pwd "0123"             1be2e452b46d7a0d9656bbb1f768e824  4
 
+# Test list of various hash algorithms
+crypt_key sha1        256 pwd "0123456789abcdef" fe5567e8d769550852182cdf69d74bb16dff8e295e4b6077d6d3fc73e7fe33b0
+crypt_key sha224      256 pwd "0123456789abcdef" 7330215f6741fd2bacbd3658681a70f65e2e90a02887989018974ce83775a568
+crypt_key sha256      256 pwd "0123456789abcdef" 9f9f5111f7b27a781f1f1ddde5ebc2dd2b796bfc7365c9c28b548e564176929f
+crypt_key sha384      256 pwd "0123456789abcdef" fc6304023487cb6f85ac80e47817760c6b153c02da46c6429649e963b031e525
+crypt_key sha512      256 pwd "0123456789abcdef" 1c043fbe4bca7c7920dae536c680fd44c15d71ec12cd82a2a9491b0043b57f4d
+crypt_key ripemd160   256 pwd "0123456789abcdef" edf4e38018cd71dd489b9c1e54b32054eb42dfad9fdcc22d629d756391a24982
+crypt_key whirlpool   256 pwd "0123456789abcdef" b21fc274d47d79ba45f94d67077f0846f75a7acc1a4dc560eacca300179cc142
+crypt_key sha3-224    256 pwd "0123456789abcdef" bbb7d56cc80a8c80e907f7d9240edc0be264aa173266b30918bc1065d59a9388
+crypt_key sha3-256    256 pwd "0123456789abcdef" a5df4caae9fdb5dbacf667075b709a2f30a115c43168af332062b42d4b0da01f
+crypt_key sha3-384    256 pwd "0123456789abcdef" 56f351f754c418892eab4009e5f85c8d5436a591014503563e9395b895526413
+crypt_key sha3-512    256 pwd "0123456789abcdef" 59d06155d25dffdb982729de8dce9d7855ca094d8bab8124b347c40668477056
+crypt_key sm3         256 pwd "0123456789abcdef" a34fdd8e843802b31a262dce5b1f501bed68ef81520de14b39657aecffaf8a86
+crypt_key stribog512  256 pwd "0123456789abcdef" ab1284a64c2325c0ad52494e696df9aa9b92e701605a9a1258b58be08e8240ea
+
 cleanup 0
index a3f9e4a..263da0d 100755 (executable)
@@ -1,11 +1,14 @@
 #!/bin/bash
 
-CRYPTSETUP=../src/cryptsetup
-REENC=../src/cryptsetup-reencrypt
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+REENC=$CRYPTSETUP_PATH/cryptsetup-reencrypt
+FAST_PBKDF="--pbkdf-force-iterations 1000"
 
 DEV_NAME=reenc9768
 DEV_NAME2=reenc1273
 IMG=reenc-data
+IMG_HDR=$IMG.hdr
 ORIG_IMG=reenc-data-orig
 KEY1=key1
 PWD1="93R4P4pIqAH8"
@@ -23,10 +26,10 @@ function del_scsi_device()
 
 function remove_mapping()
 {
-       [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove $DEV_NAME2
-       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
+       [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
        [ ! -z "$LOOPDEV1" ] && losetup -d $LOOPDEV1 >/dev/null 2>&1
-       rm -f $IMG $ORIG_IMG $KEY1 >/dev/null 2>&1
+       rm -f $IMG $IMG_HDR $ORIG_IMG $KEY1 >/dev/null 2>&1
        umount $MNT_DIR > /dev/null 2>&1
        rmdir $MNT_DIR > /dev/null 2>&1
        LOOPDEV1=""
@@ -36,7 +39,8 @@ function remove_mapping()
 function fail()
 {
        [ -n "$1" ] && echo "$1"
-       echo "FAILED"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        cd $START_DIR
        remove_mapping
        exit 2
@@ -45,15 +49,15 @@ function fail()
 function skip()
 {
        [ -n "$1" ] && echo "$1"
-       exit 0
+       exit 77
 }
 
 function add_scsi_device() {
        del_scsi_device
-        modprobe scsi_debug $@
+        modprobe scsi_debug $@ delay=0
         if [ $? -ne 0 ] ; then
                 echo "This kernel seems to not support proper scsi_debug module, test skipped."
-                exit 0
+                exit 77
         fi
 
         sleep 2
@@ -61,9 +65,11 @@ function add_scsi_device() {
         [ -b $SCSI_DEV ] || fail "Cannot find $SCSI_DEV."
 }
 
-function open_crypt()
+function open_crypt() # $1 pwd, $2 hdr
 {
-       if [ -n "$1" ] ; then
+       if [ -n "$2" ] ; then
+               echo "$1" | $CRYPTSETUP luksOpen $LOOPDEV1 $DEV_NAME --header $2 || fail
+       elif [ -n "$1" ] ; then
                echo "$1" | $CRYPTSETUP luksOpen $LOOPDEV1 $DEV_NAME || fail
        else
                $CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV1 $DEV_NAME || fail
@@ -103,9 +109,9 @@ function check_hash_dev() # $1 dev, $2 hash
        [ $HASH != "$2" ] && fail "HASH differs ($HASH)"
 }
 
-function check_hash() # $1 pwd, $2 hash
+function check_hash() # $1 pwd, $2 hash, $3 hdr
 {
-       open_crypt $1
+       open_crypt $1 $3
        check_hash_dev /dev/mapper/$DEV_NAME $2
        $CRYPTSETUP remove $DEV_NAME || fail
 }
@@ -126,7 +132,7 @@ function rollback()
        losetup $LOOPDEV1 $IMG
 }
 
-function check_slot() #space separeted list of ENABLED key slots
+function check_slot() #space separated list of ENABLED key slots
 {
        local _KS0=DISABLED
        local _KS1=$_KS0 _KS2=$_KS0 _KS3=$_KS0 _KS4=$_KS0 _KS5=$_KS0 _KS6=$_KS0 _KS7=$_KS0
@@ -154,13 +160,13 @@ function check_slot() #space separeted list of ENABLED key slots
 function simple_scsi_reenc()
 {
        echo -n "$1"
-       echo $PWD1 | $CRYPTSETUP luksFormat -i1 $SCSI_DEV || fail
+       echo $PWD1 | $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF $SCSI_DEV || fail
 
        echo $PWD1 | $CRYPTSETUP luksOpen $SCSI_DEV $DEV_NAME || fail
        HASH=$(sha256sum /dev/mapper/$DEV_NAME | cut -d' ' -f 1)
        $CRYPTSETUP luksClose $DEV_NAME || fail
 
-       echo $PWD1 | $REENC -q -i 1 $SCSI_DEV || fail
+       echo $PWD1 | $REENC -q $FAST_PBKDF $SCSI_DEV || fail
 
        echo $PWD1 | $CRYPTSETUP luksOpen $SCSI_DEV $DEV_NAME || fail
        check_hash_dev /dev/mapper/$DEV_NAME $HASH
@@ -175,7 +181,14 @@ function mount_and_test() {
        }
        rm $MNT_DIR/* 2>/dev/null
        cd $MNT_DIR
-       echo $PWD2 | $START_DIR/$REENC $LOOPDEV1 -q --use-fsync --use-directio --write-log || return 1
+
+       if [ "${REENC:0:1}" != "/" ] ; then
+               MNT_REENC=$START_DIR/$REENC
+       else
+               MNT_REENC=$REENC
+       fi
+
+       echo $PWD2 | $MNT_REENC $LOOPDEV1 -q --use-fsync --use-directio --write-log $FAST_PBKDF || return 1
        cd $START_DIR
        umount $MNT_DIR
        echo -n [OK]
@@ -189,10 +202,10 @@ function test_logging_tmpfs() {
 
 function test_logging() {
        echo -n "$1:"
-       for img in $(ls img_fs*img.bz2) ; do
+       for img in $(ls img_fs*img.xz) ; do
                wipefs -a $SCSI_DEV > /dev/null
-               echo -n "[${img%.img.bz2}]"
-               bzip2 -d -c $img | dd of=$SCSI_DEV >/dev/null 2>&1
+               echo -n "[${img%.img.xz}]"
+               xz -d -c $img | dd of=$SCSI_DEV bs=4k >/dev/null 2>&1
                mount_and_test $SCSI_DEV || return 1
        done
        echo
@@ -200,7 +213,7 @@ function test_logging() {
 
 [ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
 [ ! -x "$REENC" ] && skip "Cannot find $REENC, test skipped."
-which wipefs >/dev/null ||  skip "Cannot find wipefs, test skipped."
+which wipefs >/dev/null 2>&1 ||  skip "Cannot find wipefs, test skipped."
 
 # REENCRYPTION tests
 
@@ -208,39 +221,46 @@ HASH1=b69dae56a14d1a8314ed40664c4033ea0a550eea2673e04df42a66ac6b9faf2c
 HASH2=d85ef2a08aeac2812a648deb875485a6e3848fc3d43ce4aa380937f08199f86b
 HASH3=e4e5749032a5163c45125eccf3e8598ba5ed840df442c97e1d5ad4ad84359605
 HASH4=2daeb1f36095b44b318410b3f4e8b5d989dcc7bb023d1426c492dab0a3053e74
+HASH5=5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
 
 echo "[1] Reencryption"
 prepare 8192
-echo $PWD1 | $CRYPTSETUP -q luksFormat -s 128 -c aes-cbc-plain -i 1 --align-payload 4096 $LOOPDEV1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -s 128 -c aes-cbc-plain $FAST_PBKDF --align-payload 4096 $LOOPDEV1 || fail
 wipe $PWD1
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q
+echo $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q -s 256
+echo $PWD1 | $REENC $LOOPDEV1 -q -s 256 $FAST_PBKDF
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q -s 256 -c aes-xts-plain64 -h sha256
+echo $PWD1 | $REENC $LOOPDEV1 -q -s 256 -c aes-xts-plain64 -h sha256 $FAST_PBKDF
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q --use-directio
+echo $PWD1 | $REENC $LOOPDEV1 -q --use-directio $FAST_PBKDF
 check_hash $PWD1 $HASH1
+echo $PWD1 | $REENC $LOOPDEV1 -q --master-key-file /dev/urandom $FAST_PBKDF
+check_hash $PWD1 $HASH1
+echo $PWD1 | $REENC $LOOPDEV1 -q -s 512 --master-key-file /dev/urandom $FAST_PBKDF
+check_hash $PWD1 $HASH1
+$CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail
 
 echo "[2] Reencryption with data shift"
-echo $PWD1 | $CRYPTSETUP -q luksFormat -c aes-cbc-essiv:sha256 -s 128 -i 1 --align-payload 2048 $LOOPDEV1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -c aes-cbc-essiv:sha256 -s 128 $FAST_PBKDF --align-payload 2048 $LOOPDEV1 || fail
 wipe $PWD1
-echo $PWD1 | $REENC $LOOPDEV1 -q -s 256 --reduce-device-size 1024S || fail
+echo $PWD1 | $REENC $LOOPDEV1 -q -s 256 --reduce-device-size 1024S $FAST_PBKDF || fail
 check_hash $PWD1 $HASH2
-echo $PWD1 | $REENC $LOOPDEV1 -q -i 1 || fail
+echo $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF || fail
 check_hash $PWD1 $HASH2
+$CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail
 
 echo "[3] Reencryption with keyfile"
-echo $PWD1 | $CRYPTSETUP -q luksFormat -d $KEY1 -c aes-cbc-essiv:sha256 -s 128 -i 1 --align-payload 4096 $LOOPDEV1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -d $KEY1 -c aes-cbc-essiv:sha256 -s 128 $FAST_PBKDF --align-payload 4096 $LOOPDEV1 || fail
 wipe
 check_hash "" $HASH1
-echo $PWD1 | $CRYPTSETUP -q luksAddKey -d $KEY1 $LOOPDEV1 || fail
-$REENC $LOOPDEV1 -d $KEY1 -i 1 -q 2>/dev/null && fail
-$REENC $LOOPDEV1 -d $KEY1 -S 0 -i 1 -q || fail
+echo $PWD1 | $CRYPTSETUP -q luksAddKey -d $KEY1 $LOOPDEV1 $FAST_PBKDF || fail
+$REENC $LOOPDEV1 -d $KEY1 $FAST_PBKDF -q 2>/dev/null && fail
+$REENC $LOOPDEV1 -d $KEY1 -S 0 $FAST_PBKDF -q || fail
 check_hash "" $HASH1
 check_slot 0 || fail "Only keyslot 0 expected to be enabled"
-$REENC $LOOPDEV1 -d $KEY1 -i 1 -q || fail
+$REENC $LOOPDEV1 -d $KEY1 $FAST_PBKDF -q || fail
 # FIXME echo $PWD1 | $REENC ...
 
 echo "[4] Encryption of not yet encrypted device"
@@ -250,39 +270,58 @@ SIZE=$(blockdev --getsz $LOOPDEV1)
 wipe_dev $LOOPDEV1
 dmsetup create $DEV_NAME2 --table "0 $(($SIZE - $OFFSET)) linear $LOOPDEV1 0" || fail
 check_hash_dev /dev/mapper/$DEV_NAME2 $HASH3
-dmsetup remove $DEV_NAME2 || fail
-echo $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --reduce-device-size "$OFFSET"S -q
+dmsetup remove --retry $DEV_NAME2 || fail
+echo $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF || fail
 check_hash $PWD1 $HASH3
+$CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail
+# 64MiB + 1 KiB
+prepare 65537
+OFFSET=131072
+SIZE=$(blockdev --getsz $LOOPDEV1)
+wipe_dev $LOOPDEV1
+dmsetup create $DEV_NAME2 --table "0 $(($SIZE - $OFFSET)) linear $LOOPDEV1 0" || fail
+check_hash_dev /dev/mapper/$DEV_NAME2 $HASH5
+dmsetup remove --retry $DEV_NAME2 || fail
+echo $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF || fail
+check_hash $PWD1 $HASH5
+$CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail
+prepare 8192
+OFFSET=4096
+echo fake | $REENC $LOOPDEV1 -d $KEY1 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF || fail
+$CRYPTSETUP open --test-passphrase $LOOPDEV1 -d $KEY1 || fail
+wipe_dev $LOOPDEV1
 
 echo "[5] Reencryption using specific keyslot"
-echo $PWD2 | $CRYPTSETUP -q luksFormat -i 1 $LOOPDEV1 || fail
-echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey -i 1 -S 1 $LOOPDEV1 || fail
-echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey -i 1 -S 2 $LOOPDEV1 || fail
-echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey -i 1 -S 3 $LOOPDEV1 || fail
-echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey -i 1 -S 4 $LOOPDEV1 || fail
-echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey -i 1 -S 5 $LOOPDEV1 || fail
-echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey -i 1 -S 6 $LOOPDEV1 || fail
-echo -e "$PWD2\n$PWD3" | $CRYPTSETUP -q luksAddKey -i 1 -S 7 $LOOPDEV1 || fail
+echo $PWD2 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 1 $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 2 $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 3 $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 4 $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 5 $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 6 $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD3" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 7 $LOOPDEV1 || fail
 backup_orig
-echo $PWD2 | $REENC -i 1 -S 0 -q $LOOPDEV1 || fail
+echo $PWD2 | $REENC $FAST_PBKDF -S 0 -q $LOOPDEV1 || fail
 check_slot 0 || fail "Only keyslot 0 expected to be enabled"
 wipe $PWD2
 rollback
-echo $PWD1 | $REENC -i 1 -S 1 -q $LOOPDEV1 || fail
+echo $PWD1 | $REENC $FAST_PBKDF -S 1 -q $LOOPDEV1 || fail
 check_slot 1 || fail "Only keyslot 1 expected to be enabled"
 wipe $PWD1
 rollback
-echo $PWD2 | $REENC -i 1 -S 6 -q $LOOPDEV1 || fail
+echo $PWD2 | $REENC $FAST_PBKDF -S 6 -q $LOOPDEV1 || fail
 check_slot 6 || fail "Only keyslot 6 expected to be enabled"
 wipe $PWD2
 rollback
-echo $PWD3 | $REENC -i 1 -S 7 -q $LOOPDEV1 || fail
+echo $PWD3 | $REENC $FAST_PBKDF -S 7 -q $LOOPDEV1 || fail
 check_slot 7 || fail "Only keyslot 7 expected to be enabled"
 wipe $PWD3
 rollback
+echo $PWD3 | $REENC $FAST_PBKDF -S 8 -q $LOOPDEV1 2>/dev/null && fail
+$CRYPTSETUP luksDump $LOOPDEV1 > /dev/null || fail
 
 echo "[6] Reencryption using all active keyslots"
-echo -e "$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD3" | $REENC -q $LOOPDEV1 || fail
+echo -e "$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD3" | $REENC -q $LOOPDEV1 $FAST_PBKDF || fail
 check_slot 0 1 2 3 4 5 6 7 || fail "All keyslots expected to be enabled"
 
 echo "[7] Reencryption of block devices with different block size"
@@ -295,34 +334,64 @@ simple_scsi_reenc "[4096/512 sector]"
 echo "[OK]"
 
 echo "[8] Header only reencryption (hash and iteration time)"
-echo $PWD1 | $CRYPTSETUP -q luksFormat --hash sha1 $LOOPDEV1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 --hash sha1 $FAST_PBKDF $LOOPDEV1 || fail
 wipe $PWD1
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key --hash sha256 --iter-time 1
+echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key --pbkdf-force-iterations 999 2>/dev/null && fail
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key --hash sha512
+echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key --hash sha256 --pbkdf-force-iterations 1001
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key --iter-time 1
+[ "$($CRYPTSETUP luksDump $LOOPDEV1 | grep -A1 -m1 "Key Slot 0" | grep Iterations: | sed -e 's/[[:space:]]\+Iterations:\ \+//g')" -eq 1001 ] || fail
+[ "$($CRYPTSETUP luksDump $LOOPDEV1 | grep -m1 "Hash spec:" | cut -f2)" = "sha256" ] || fail
+echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key --hash sha512 $FAST_PBKDF
 check_hash $PWD1 $HASH1
+[ "$($CRYPTSETUP luksDump $LOOPDEV1 | grep -A1 -m1 "Key Slot 0" | grep Iterations: | sed -e 's/[[:space:]]\+Iterations:\ \+//g')" -eq 1000 ] || fail
+echo $PWD1 | $REENC $LOOPDEV1 -q --keep-key $FAST_PBKDF
+check_hash $PWD1 $HASH1
+$CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail
 
 echo "[9] Test log I/Os on various underlaying block devices"
 prepare 8192
-echo $PWD2 | $CRYPTSETUP -q luksFormat -i 1 $LOOPDEV1 || fail
-add_scsi_device sector_size=512 dev_size_mb=25
+echo $PWD2 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || fail
+add_scsi_device sector_size=512 dev_size_mb=32
 test_logging "[512 sector]" || fail
-add_scsi_device sector_size=4096 dev_size_mb=25
+add_scsi_device sector_size=4096 dev_size_mb=32
 test_logging "[4096 sector]" || fail
-add_scsi_device sector_size=512 dev_size_mb=25 physblk_exp=3
+add_scsi_device sector_size=512 dev_size_mb=32 physblk_exp=3
 test_logging "[4096/512 sector]" || fail
 test_logging_tmpfs || fail
 
 echo "[10] Removal of encryption"
 prepare 8192
-echo $PWD1 | $CRYPTSETUP -q luksFormat -i 1 $LOOPDEV1 || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH1
+echo $PWD1 | $REENC $LOOPDEV1 -q --decrypt || fail
+check_hash_dev $LOOPDEV1 $HASH4
+
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -S5 $FAST_PBKDF $LOOPDEV1 || fail
 wipe $PWD1
 check_hash $PWD1 $HASH1
-echo $PWD1 | $REENC $LOOPDEV1 -q --decrypt
+echo $PWD1 | $REENC $LOOPDEV1 -q --decrypt || fail
 check_hash_dev $LOOPDEV1 $HASH4
 
+echo "[11] Detached header - adding encryption/reencryption/decryption"
+prepare 8192
+check_hash_dev $IMG $HASH4
+echo $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --header $IMG_HDR --new --type luks1
+check_hash $PWD1 $HASH4 $IMG_HDR
+echo $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --header $IMG_HDR
+check_hash $PWD1 $HASH4 $IMG_HDR
+echo $PWD1 | $REENC $LOOPDEV1 -q --header $IMG_HDR --decrypt
+check_hash_dev $IMG $HASH4
+# existing header of zero size
+cat /dev/null >$IMG_HDR
+echo $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF --header $IMG_HDR --new --type luks1
+check_hash $PWD1 $HASH4 $IMG_HDR
+$CRYPTSETUP isLuks $LOOPDEV1 && fail
+$CRYPTSETUP isLuks $IMG_HDR || fail
+
 remove_mapping
 exit 0
diff --git a/tests/reencryption-compat-test2 b/tests/reencryption-compat-test2
new file mode 100755 (executable)
index 0000000..4ec26fa
--- /dev/null
@@ -0,0 +1,473 @@
+#!/bin/bash
+
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
+REENC=$CRYPTSETUP_PATH/cryptsetup-reencrypt
+FAST_PBKDF_ARGON="--pbkdf-force-iterations 4 --pbkdf-memory 32 --pbkdf-parallel 1"
+FAST_PBKDF_PBKDF2="--pbkdf-force-iterations 1000 --pbkdf pbkdf2"
+DEFAULT_ARGON="argon2i"
+
+DEV_NAME=reenc9768
+DEV_NAME2=reenc1273
+IMG=reenc-data
+IMG_HDR=$IMG.hdr
+ORIG_IMG=reenc-data-orig
+KEY1=key1
+PWD1="93R4P4pIqAH8"
+PWD2="1cND4319812f"
+PWD3="1-9Qu5Ejfnqv"
+
+MNT_DIR=./mnt_luks
+START_DIR=$(pwd)
+[ -f /etc/system-fips ] && FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/null)
+
+function fips_mode()
+{
+       [ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ]
+}
+
+function dm_crypt_features()
+{
+       local VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
+
+       local VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       local VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+
+       [ $VER_MAJ -lt 1 ] && return
+       [ $VER_MAJ -eq 1 -a $VER_MIN -lt 11 ] && return
+       ALLOW_DISCARDS=--allow-discards
+       [ $VER_MAJ -eq 1 -a $VER_MIN -lt 14 ] && return
+       PERF_CPU=--perf-same_cpu_crypt
+}
+
+function del_scsi_device()
+{
+       rmmod scsi_debug 2>/dev/null
+       sleep 2
+}
+
+function remove_mapping()
+{
+       [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
+       rm -f $IMG $IMG_HDR $ORIG_IMG $KEY1 >/dev/null 2>&1
+       umount $MNT_DIR > /dev/null 2>&1
+       rmdir $MNT_DIR > /dev/null 2>&1
+       del_scsi_device
+}
+
+function fail()
+{
+       [ -n "$1" ] && echo "$1"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
+       cd $START_DIR
+       remove_mapping
+       exit 2
+}
+
+function skip()
+{
+       [ -n "$1" ] && echo "$1"
+       exit 77
+}
+
+function add_scsi_device() {
+       del_scsi_device
+        modprobe scsi_debug $@ delay=0
+        if [ $? -ne 0 ] ; then
+                echo "This kernel seems to not support proper scsi_debug module, test skipped."
+                exit 77
+        fi
+
+        sleep 2
+        SCSI_DEV="/dev/"$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d /)
+        [ -b $SCSI_DEV ] || fail "Cannot find $SCSI_DEV."
+}
+
+function open_crypt() # $1 pwd, $2 hdr
+{
+       if [ -n "$2" ] ; then
+               echo "$1" | $CRYPTSETUP luksOpen $IMG $DEV_NAME --header $2 || fail
+       elif [ -n "$1" ] ; then
+               echo "$1" | $CRYPTSETUP luksOpen $IMG $DEV_NAME || fail
+       else
+               $CRYPTSETUP luksOpen -d $KEY1 $IMG $DEV_NAME || fail
+       fi
+}
+
+function wipe_dev() # $1 dev
+{
+       dd if=/dev/zero of=$1 bs=256k conv=notrunc >/dev/null 2>&1
+}
+
+function wipe() # $1 pass
+{
+       open_crypt $1
+       wipe_dev /dev/mapper/$DEV_NAME
+       udevadm settle >/dev/null 2>&1
+       $CRYPTSETUP luksClose $DEV_NAME || fail
+}
+
+function prepare() # $1 dev1_siz
+{
+       remove_mapping
+
+       dd if=/dev/zero of=$IMG      bs=1k count=$1 >/dev/null 2>&1
+
+       if [ ! -e $KEY1 ]; then
+               dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1
+       fi
+}
+
+function check_hash_dev() # $1 dev, $2 hash, $3 size
+{
+       if [ -n "$3" ]; then
+               HASH=$(head -c $3 $1 | sha256sum | cut -d' ' -f 1)
+       else
+               HASH=$(sha256sum $1 | cut -d' ' -f 1)
+       fi
+       [ $HASH != "$2" ] && fail "HASH differs ($HASH)"
+}
+
+function check_hash() # $1 pwd, $2 hash, $3 hdr
+{
+       open_crypt $1 $3
+       check_hash_dev /dev/mapper/$DEV_NAME $2
+       $CRYPTSETUP remove $DEV_NAME || fail
+}
+
+function backup_orig()
+{
+       sync
+       cp $IMG $ORIG_IMG
+}
+
+function rollback()
+{
+       sync
+       cp $ORIG_IMG $IMG
+}
+
+function check_slot() #space separated list of active key slots
+{
+       local _out=$($CRYPTSETUP luksDump $IMG | grep -e ": luks2" | sed -e 's/[[:space:]]*\([0-9]\+\):.*/\1/g')
+
+       local _req
+       local _hdr
+       local _j
+
+       for _i in $*; do
+               _j=$((_i))
+               _req="$_req $_j"
+       done
+
+       for _i in $_out; do
+               _j=$((_i))
+               _hdr="$_hdr $_j"
+       done
+
+       test "$_req" = "$_hdr"
+}
+
+function simple_scsi_reenc()
+{
+       echo -n "$1"
+       echo $PWD1 | $CRYPTSETUP luksFormat --type luks2 $FAST_PBKDF_ARGON $SCSI_DEV || fail
+
+       echo $PWD1 | $CRYPTSETUP luksOpen $SCSI_DEV $DEV_NAME || fail
+       HASH=$(sha256sum /dev/mapper/$DEV_NAME | cut -d' ' -f 1)
+       $CRYPTSETUP luksClose $DEV_NAME || fail
+
+       echo $PWD1 | $REENC -q $FAST_PBKDF_ARGON $SCSI_DEV || fail
+
+       echo $PWD1 | $CRYPTSETUP luksOpen $SCSI_DEV $DEV_NAME || fail
+       check_hash_dev /dev/mapper/$DEV_NAME $HASH
+       $CRYPTSETUP luksClose $DEV_NAME || fail
+}
+
+function mount_and_test() {
+       test -d $MNT_DIR || mkdir -p $MNT_DIR
+       mount $@ $MNT_DIR 2>/dev/null || {
+               echo -n "failed to mount [SKIP]"
+               return 0
+       }
+       rm $MNT_DIR/* 2>/dev/null
+       cd $MNT_DIR
+
+       if [ "${REENC:0:1}" != "/" ] ; then
+               MNT_REENC=$START_DIR/$REENC
+       else
+               MNT_REENC=$REENC
+       fi
+       echo $PWD2 | $MNT_REENC $START_DIR/$IMG -q --use-fsync --use-directio --write-log $FAST_PBKDF_ARGON || return 1
+       cd $START_DIR
+       umount $MNT_DIR
+       echo -n [OK]
+}
+
+function test_logging_tmpfs() {
+       echo -n "[tmpfs]"
+       mount_and_test -t tmpfs none -o size=$[25*1024*1024] || return 1
+       echo
+}
+
+function test_logging() {
+       echo -n "$1:"
+       for img in $(ls img_fs*img.xz) ; do
+               wipefs -a $SCSI_DEV > /dev/null
+               echo -n "[${img%.img.xz}]"
+               xz -d -c $img | dd of=$SCSI_DEV bs=4k >/dev/null 2>&1
+               mount_and_test $SCSI_DEV || return 1
+       done
+       echo
+}
+
+[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
+[ ! -x "$REENC" ] && skip "Cannot find $REENC, test skipped."
+which wipefs >/dev/null ||  skip "Cannot find wipefs, test skipped."
+fips_mode && skip "This test cannot be run in FIPS mode."
+
+# REENCRYPTION tests
+
+HASH1=b69dae56a14d1a8314ed40664c4033ea0a550eea2673e04df42a66ac6b9faf2c
+HASH4=2daeb1f36095b44b318410b3f4e8b5d989dcc7bb023d1426c492dab0a3053e74
+HASH5=bb9f8df61474d25e71fa00722318cd387396ca1736605e1248821cc0de3d3af8
+HASH6=4d9cbaf3aa0935a8c113f139691b3daf9c94c8d6c278aedc8eec66a4b9f6c8ae
+HASH7=5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
+
+echo "[1] Reencryption"
+prepare 8192
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 -c aes-cbc-plain $FAST_PBKDF_ARGON --offset 8192 $IMG || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q $FAST_PBKDF_ARGON
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q -s 256 $FAST_PBKDF_ARGON
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q -s 256 -c aes-xts-plain64 -h sha256 $FAST_PBKDF_ARGON
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --use-directio $FAST_PBKDF_ARGON
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --master-key-file /dev/urandom $FAST_PBKDF_ARGON
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q -s 512 --master-key-file /dev/urandom $FAST_PBKDF_ARGON
+check_hash $PWD1 $HASH5
+$CRYPTSETUP luksDump $IMG | grep -q "luks2" > /dev/null || fail
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -s 128 --luks2-metadata-size 128k -c aes-cbc-plain $FAST_PBKDF_ARGON --offset 8192 $IMG > /dev/null || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q $FAST_PBKDF_ARGON > /dev/null || fail
+check_hash $PWD1 $HASH5
+MDA_SIZE=$($CRYPTSETUP luksDump $IMG | grep "Metadata area: " | cut -f 3 -d ' ')
+test "$MDA_SIZE" -eq 131072 || fail "Unexpected Metadata area size $MDA_SIZE"
+
+echo "[2] Reencryption with data shift"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -c aes-cbc-essiv:sha256 -s 128 $FAST_PBKDF_ARGON --offset 8192 $IMG || fail
+wipe $PWD1
+echo $PWD1 | $REENC $IMG -q -s 256 --reduce-device-size 1024S $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH6
+echo $PWD1 | $REENC $IMG -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH6
+$CRYPTSETUP luksDump $IMG | grep -q "luks2" > /dev/null || fail
+
+echo "[3] Reencryption with keyfile"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -d $KEY1 -c aes-cbc-essiv:sha256 -s 128 $FAST_PBKDF_ARGON --offset 8192 $IMG || fail
+wipe
+check_hash "" $HASH5
+echo $PWD1 | $CRYPTSETUP -q luksAddKey -d $KEY1 $IMG $FAST_PBKDF_ARGON || fail
+$REENC $IMG -d $KEY1 $FAST_PBKDF_ARGON -q 2>/dev/null && fail
+$REENC $IMG -d $KEY1 -S 0 $FAST_PBKDF_ARGON -q || fail
+check_hash "" $HASH5
+check_slot 0 || fail "Only keyslot 0 expected to be enabled"
+$REENC $IMG -d $KEY1 $FAST_PBKDF_ARGON -q || fail
+$CRYPTSETUP luksDump $IMG | grep -q "luks2" > /dev/null || fail
+# FIXME echo $PWD1 | $REENC ...
+
+echo "[4] Encryption of not yet encrypted device"
+# well, movin' zeroes :-)
+OFFSET=8192 # default LUKS2 header size
+prepare 8192
+check_hash_dev $IMG $HASH4
+echo $PWD1 | $REENC --type luks2 $IMG -c aes-cbc-essiv:sha256 -s 128 --new --reduce-device-size "$OFFSET"S -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH5
+$CRYPTSETUP luksDump $IMG | grep -q "luks2" > /dev/null || fail
+# 64MiB + 1 KiB
+prepare 65537
+OFFSET=131072
+check_hash_dev $IMG $HASH7 1024
+echo $PWD1 | $REENC --type luks2 $IMG -c aes-cbc-essiv:sha256 -s 128 --new --reduce-device-size "$OFFSET"S -q $FAST_PBKDF_ARGON || fail
+check_hash $PWD1 $HASH7
+$CRYPTSETUP --type luks2 luksDump $IMG > /dev/null || fail
+prepare 8192
+
+echo "[5] Reencryption using specific keyslot"
+echo $PWD2 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON -S 1 $IMG || fail
+echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON -S 2 $IMG || fail
+echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON -S 3 $IMG || fail
+echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON -S 4 $IMG || fail
+echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON -S 5 $IMG || fail
+echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON -S 6 $IMG || fail
+echo -e "$PWD2\n$PWD3" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF_ARGON -S 22 $IMG || fail
+backup_orig
+echo $PWD2 | $REENC $FAST_PBKDF_ARGON -S 0 -q $IMG || fail
+check_slot 0 || fail "Only keyslot 0 expected to be enabled"
+wipe $PWD2
+rollback
+echo $PWD1 | $REENC $FAST_PBKDF_ARGON -S 1 -q $IMG || fail
+check_slot 1 || fail "Only keyslot 1 expected to be enabled"
+wipe $PWD1
+rollback
+echo $PWD2 | $REENC $FAST_PBKDF_ARGON -S 6 -q $IMG || fail
+check_slot 6 || fail "Only keyslot 6 expected to be enabled"
+wipe $PWD2
+rollback
+echo $PWD3 | $REENC $FAST_PBKDF_ARGON -S 22 -q $IMG || fail
+check_slot 22 || fail "Only keyslot 22 expected to be enabled"
+wipe $PWD3
+rollback
+
+echo "[6] Reencryption using all active keyslots"
+echo -e "$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD1\n$PWD2\n$PWD3" | $REENC -q $IMG $FAST_PBKDF_ARGON || fail
+check_slot 0 1 2 3 4 5 6 22 || fail "All keyslots expected to be enabled"
+
+echo "[7] Reencryption of block devices with different block size"
+add_scsi_device sector_size=512 dev_size_mb=32
+simple_scsi_reenc "[512 sector]"
+add_scsi_device sector_size=4096 dev_size_mb=32
+simple_scsi_reenc "[4096 sector]"
+add_scsi_device sector_size=512 physblk_exp=3 dev_size_mb=32
+simple_scsi_reenc "[4096/512 sector]"
+echo "[OK]"
+
+echo "[8] Header only reencryption (hash and iteration time)"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --keep-key || fail
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --keep-key --pbkdf pbkdf2 --pbkdf-force-iterations 999 2>/dev/null && fail
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --keep-key --pbkdf-force-iterations 3 2>/dev/null && fail
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --keep-key --pbkdf-force-iterations 4 --pbkdf-memory 31 2>/dev/null && fail
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --keep-key --pbkdf pbkdf2 --pbkdf-force-iterations 1000 --hash sha512
+check_hash $PWD1 $HASH5
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep PBKDF: | sed -e 's/[[:space:]]\+PBKDF:\ \+//g')" = "pbkdf2" ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep Hash:  | sed -e 's/[[:space:]]\+Hash:\ \+//g')" = "sha512" ] || fail
+echo $PWD1 | $REENC $IMG -q --keep-key $FAST_PBKDF_ARGON
+check_hash $PWD1 $HASH5
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep PBKDF:      | sed -e 's/[[:space:]]\+PBKDF:\ \+//g')" = $DEFAULT_ARGON ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep "Time cost" | sed -e 's/[[:space:]]\+Time\ cost:\ \+//g')" -eq 4 ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep Memory      | sed -e 's/[[[:space:]]\+Memory:\ \+//g')" -eq 32 ] || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A8 -m1 "0: luks2" | grep Threads     | sed -e 's/[[[:space:]]\+Threads:\ \+//g')" -eq 1 ] || fail
+echo -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksAddKey -S21 $FAST_PBKDF_ARGON $IMG || fail
+echo $PWD2 | $REENC -S21 -q --keep-key --pbkdf pbkdf2 --pbkdf-force-iterations 1000 $IMG || fail
+check_hash $PWD2 $HASH5
+check_slot 21 || fail "Only keyslot 21 expected to be enabled"
+$CRYPTSETUP luksDump $IMG | grep -q "luks2" > /dev/null || fail
+
+echo "[9] Test log I/Os on various underlaying block devices"
+echo $PWD2 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+add_scsi_device sector_size=512 dev_size_mb=32
+test_logging "[512 sector]" || fail
+add_scsi_device sector_size=4096 dev_size_mb=32
+test_logging "[4096 sector]" || fail
+add_scsi_device sector_size=512 dev_size_mb=32 physblk_exp=3
+test_logging "[4096/512 sector]" || fail
+test_logging_tmpfs || fail
+
+echo "[10] Removal of encryption"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --decrypt || fail
+check_hash_dev $IMG $HASH4
+
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 -S5 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+echo $PWD1 | $REENC $IMG -q --decrypt || fail
+check_hash_dev $IMG $HASH4
+
+echo "[11] Reencryption with tokens"
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+echo -e "$PWD1\n$PWD2" | $CRYPTSETUP -q luksAddKey -S23 $FAST_PBKDF_ARGON $IMG || fail
+echo -e "$PWD1\n$PWD3" | $CRYPTSETUP -q luksAddKey -S1 $FAST_PBKDF_ARGON $IMG || fail
+echo -e "$PWD1\n$PWD3" | $CRYPTSETUP -q luksAddKey -S3 $FAST_PBKDF_ARGON $IMG || fai
+$CRYPTSETUP token add --key-description key-name0 --key-slot 23 --token-id 0 $IMG
+$CRYPTSETUP token add --key-description key-name2 --key-slot 1 --token-id 2 $IMG
+$CRYPTSETUP token add --key-description key-name31 --token-id 31 $IMG
+echo $PWD1 | $CRYPTSETUP -q luksKillSlot $IMG 3 || fail
+echo $PWD2 | $REENC $FAST_PBKDF_ARGON -S 23 -q $IMG || fail
+$CRYPTSETUP luksDump $IMG | grep "0: luks2-keyring" >/dev/null || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A2 -m1 "0: luks2-keyring" | grep Keyslot: | sed -e 's/[[[:space:]]\+Keyslot:\ \+//g')" -eq 23 ] || fail
+$CRYPTSETUP luksDump $IMG | grep "2: luks2-keyring" >/dev/null || fail
+$CRYPTSETUP luksDump $IMG | grep "31: luks2-keyring" >/dev/null || fail
+[ "$($CRYPTSETUP luksDump $IMG | grep -A2 -m1 "31: luks2-keyring" | grep Keyslot: | sed -e 's/[[[:space:]]\+Keyslot:\ \+//g')" -eq 23 ] || fail
+
+echo "[12] Reencryption with persistent flags"
+dm_crypt_features
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+echo $PWD1 | $CRYPTSETUP open $IMG $DEV_NAME $ALLOW_DISCARDS $PERF_CPU --persistent || fail
+$CRYPTSETUP close $DEV_NAME || fail
+echo $PWD1 | $REENC $FAST_PBKDF_ARGON -q $IMG || fail
+if [ -n "$PERF_CPU" ]; then
+       $CRYPTSETUP luksDump $IMG | grep -m1 Flags: | grep same-cpu-crypt > /dev/null || fail
+fi
+if [ -n "$ALLOW_DISCARDS" ]; then
+       $CRYPTSETUP luksDump $IMG | grep -m1 Flags: | grep allow-discards > /dev/null || fail
+fi
+
+echo "[13] Detached header - adding encryption/reencryption/decryption"
+prepare 8192
+check_hash_dev $IMG $HASH4
+echo $PWD1 | $REENC --type luks2 $IMG -q $FAST_PBKDF_ARGON --header $IMG_HDR --new
+check_hash $PWD1 $HASH4 $IMG_HDR
+echo $PWD1 | $REENC $IMG -q $FAST_PBKDF_ARGON --header $IMG_HDR
+check_hash $PWD1 $HASH4 $IMG_HDR
+echo $PWD1 | $REENC $IMG -q --header $IMG_HDR --decrypt
+check_hash_dev $IMG $HASH4
+# existing header of zero size
+cat /dev/null >$IMG_HDR
+echo $PWD1 | $REENC --type luks2 $IMG -q $FAST_PBKDF_ARGON --header $IMG_HDR --new
+check_hash $PWD1 $HASH4 $IMG_HDR
+$CRYPTSETUP isLuks $IMG && fail
+$CRYPTSETUP isLuks $IMG_HDR || fail
+$CRYPTSETUP luksDump $IMG_HDR | grep -q "0: luks2" || fail
+
+echo "[14] Reencryption with unbound keyslot"
+prepare 8192
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_ARGON $IMG --offset 8192 || fail
+echo $PWD2 | $CRYPTSETUP -q luksAddKey -S 3 --unbound --key-size 64 $FAST_PBKDF_ARGON $IMG || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+$CRYPTSETUP luksDump $IMG | grep -q "3: luks2 (unbound)" || fail
+echo $PWD2 | $REENC $IMG -q $FAST_PBKDF_ARGON 2>/dev/null && fail
+echo -e "$PWD1\n$PWD2" | $REENC $IMG -q $FAST_PBKDF_ARGON || fail
+$CRYPTSETUP luksDump $IMG | grep -q "3: luks2 (unbound)" || fail
+
+echo "[15] Reencryption after conversion"
+prepare 8192
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_PBKDF2 $IMG --offset 4096 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH1
+$CRYPTSETUP -q convert --type luks2 $IMG || fail
+echo $PWD1 | $REENC $IMG -q $FAST_PBKDF_PBKDF2 || fail
+check_hash $PWD1 $HASH1
+echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks2 $FAST_PBKDF_PBKDF2 $IMG --offset 8192 || fail
+wipe $PWD1
+check_hash $PWD1 $HASH5
+$CRYPTSETUP -q convert --type luks1 $IMG || fail
+echo $PWD1 | $REENC $IMG -q $FAST_PBKDF_PBKDF2 || fail
+check_hash $PWD1 $HASH5
+
+remove_mapping
+exit 0
index efb0e06..e706427 100755 (executable)
@@ -2,23 +2,30 @@
 
 # check tcrypt images parsing
 
-CRYPTSETUP=../src/cryptsetup
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
 TST_DIR=tcrypt-images
 MAP=tctst
 PASSWORD="aaaaaaaaaaaa"
 PASSWORD_HIDDEN="bbbbbbbbbbbb"
+PASSWORD_72C="aaaaaaaaaaaabbbbbbbbbbbbccccccccccccddddddddddddeeeeeeeeeeeeffffffffffff"
+PIM=1234
+
+[ -z "$srcdir" ] && srcdir="."
 
 function remove_mapping()
 {
-       [ -b /dev/mapper/$MAP ] && dmsetup remove $MAP
-       [ -b /dev/mapper/"$MAP"_1 ] && dmsetup remove "$MAP"_1
-       [ -b /dev/mapper/"$MAP"_2 ] && dmsetup remove "$MAP"_2
+       [ -b /dev/mapper/$MAP ] && dmsetup remove --retry $MAP
+       [ -b /dev/mapper/"$MAP"_1 ] && dmsetup remove --retry "$MAP"_1
+       [ -b /dev/mapper/"$MAP"_2 ] && dmsetup remove --retry "$MAP"_2
 }
 
 function fail()
 {
        [ -n "$1" ] && echo "$1"
        echo " [FAILED]"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        remove_mapping
        exit 2
 }
@@ -27,12 +34,32 @@ function skip()
 {
        [ -n "$1" ] && echo "$1"
        echo "Test skipped."
-       exit 0
+       exit 77
+}
+
+function test_one() # cipher mode keysize rm_pattern
+{
+       $CRYPTSETUP benchmark -c "$1-$2" -s "$3" >/dev/null 2>&1
+       if [ $? -ne 0 ] ; then
+               echo "$1-$2 [N/A]"
+               IMGS=$(ls $TST_DIR/[tv]c* | grep "$4")
+               [ -n "$IMGS" ] && rm $IMGS
+               #echo $IMGS
+       else
+               echo "$1-$2 [OK]"
+       fi
 }
 
-function test_one()
+function test_kdf() # hash
 {
-       $CRYPTSETUP benchmark -c "$1" -s "$2" | grep -v "#" || skip
+       $CRYPTSETUP benchmark -h "$1" >/dev/null 2>&1
+       if [ $? -ne 0 ] ; then
+               echo "pbkdf2-$1 [N/A]"
+               IMGS=$(ls $TST_DIR/[tv]c* | grep "$1")
+               [ -n "$IMGS" ] && rm $IMGS
+       else
+               echo "pbkdf2-$1 [OK]"
+       fi
 }
 
 function test_required()
@@ -40,39 +67,50 @@ function test_required()
        which lsblk >/dev/null 2>&1 || skip "WARNING: lsblk tool required."
 
        echo "REQUIRED KDF TEST"
-       $CRYPTSETUP benchmark -h ripemd160 | grep "N/A" && skip
-       $CRYPTSETUP benchmark -h whirlpool | grep "N/A" && skip
+       test_kdf sha256
+       test_kdf sha512
+       test_kdf ripemd160
+       test_kdf whirlpool
+       test_kdf stribog512
 
        echo "REQUIRED CIPHERS TEST"
-       echo "#  Algorithm | Key |  Encryption |  Decryption"
+       test_one aes cbc 256 cbc-aes
+       test_one aes lrw 384 lrw-aes
+       test_one aes xts 512 xts-aes
 
-       test_one aes-cbc 256
-       test_one aes-lrw 384
-       test_one aes-xts 512
+       test_one twofish ecb 256 twofish
+       test_one twofish cbc 256 cbc-twofish
+       test_one twofish lrw 384 lrw-twofish
+       test_one twofish xts 512 xts-twofish
 
-       test_one twofish-cbc 256
-       test_one twofish-lrw 384
-       test_one twofish-xts 512
+       test_one serpent ecb 256 serpent
+       test_one serpent cbc 256 cbc-serpent
+       test_one serpent lrw 384 lrw-serpent
+       test_one serpent xts 512 xts-serpent
 
-       test_one serpent-cbc 256
-       test_one serpent-lrw 384
-       test_one serpent-xts 512
+       test_one blowfish cbc 256 blowfish
 
-       test_one blowfish-cbc 256
+       test_one des3_ede cbc 192 des3_ede
+       test_one cast5 cbc 128 cast5
 
-       test_one des3_ede-cbc 192
-       test_one cast5 128
+       test_one camellia xts 512 camellia
+       test_one kuznyechik xts 512 kuznyechik
+
+       ls $TST_DIR/[tv]c* >/dev/null 2>&1 || skip "No remaining images."
 }
 
-test_required
 export LANG=C
-
-[ ! -d $TST_DIR ] && tar xjf tcrypt-images.tar.bz2
+[ ! -d $TST_DIR ] && tar xJf $srcdir/tcrypt-images.tar.xz --no-same-owner
+test_required
 
 echo "HEADER CHECK"
-for file in $(ls $TST_DIR/[tv]c_*) ; do
+for file in $(ls $TST_DIR/[tv]c_* $TST_DIR/vcpim_* $TST_DIR/sys_[tv]c_*) ; do
        echo -n " $file"
-       echo $PASSWORD | $CRYPTSETUP tcryptDump --veracrypt $file >/dev/null || fail
+       PIM_OPT=""
+       [[ $file =~ vcpim.* ]] && PIM_OPT="--veracrypt-pim $PIM"
+       SYS_OPT=""
+       [[ $file =~ sys_.* ]] && SYS_OPT="--tcrypt-system"
+       echo $PASSWORD | $CRYPTSETUP tcryptDump --veracrypt $SYS_OPT $PIM_OPT $file >/dev/null || fail
        echo " [OK]"
 done
 
@@ -86,7 +124,10 @@ done
 echo "HEADER KEYFILES CHECK"
 for file in $(ls $TST_DIR/[tv]ck_*) ; do
        echo -n " $file"
-       echo $PASSWORD | $CRYPTSETUP tcryptDump --veracrypt -d $TST_DIR/keyfile1 -d $TST_DIR/keyfile2 $file >/dev/null || fail
+       PWD=$PASSWORD
+       [[ $file =~ vck_1_nopw.* ]] && PWD=""
+       [[ $file =~ vck_1_pw72.* ]] && PWD=$PASSWORD_72C
+       echo $PWD | $CRYPTSETUP tcryptDump --veracrypt -d $TST_DIR/keyfile1 -d $TST_DIR/keyfile2 $file >/dev/null || fail
        echo " [OK]"
 done
 
@@ -97,9 +138,13 @@ if [ $(id -u) != 0 ]; then
 fi
 
 echo "ACTIVATION FS UUID CHECK"
-for file in $(ls $TST_DIR/[tv]c_*) ; do
+for file in $(ls $TST_DIR/[tv]c_* $TST_DIR/vcpim_* $TST_DIR/sys_[tv]c_*) ; do
        echo -n " $file"
-       out=$(echo $PASSWORD | $CRYPTSETUP tcryptOpen --veracrypt -r $file $MAP 2>&1)
+       PIM_OPT=""
+       [[ $file =~ vcpim.* ]] && PIM_OPT="--veracrypt-pim $PIM"
+       SYS_OPT=""
+       [[ $file =~ sys_.* ]] && SYS_OPT="--tcrypt-system"
+       out=$(echo $PASSWORD | $CRYPTSETUP tcryptOpen --veracrypt $SYS_OPT $PIM_OPT -r $file $MAP 2>&1)
        ret=$?
        [ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT legacy mode" ) && echo " [N/A]" && continue
        [ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT compatible mapping" ) && echo " [N/A]" && continue
diff --git a/tests/tcrypt-images.tar.bz2 b/tests/tcrypt-images.tar.bz2
deleted file mode 100644 (file)
index 4ca5473..0000000
Binary files a/tests/tcrypt-images.tar.bz2 and /dev/null differ
diff --git a/tests/tcrypt-images.tar.xz b/tests/tcrypt-images.tar.xz
new file mode 100644 (file)
index 0000000..1841870
Binary files /dev/null and b/tests/tcrypt-images.tar.xz differ
diff --git a/tests/test_utils.c b/tests/test_utils.c
new file mode 100644 (file)
index 0000000..0b00005
--- /dev/null
@@ -0,0 +1,622 @@
+/*
+ * cryptsetup library API test utilities
+ *
+ * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Milan Broz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <libdevmapper.h>
+#include <linux/fs.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#ifdef KERNEL_KEYRING
+# include <linux/keyctl.h>
+# include <sys/syscall.h>
+#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+# include <sys/sysmacros.h>
+#endif
+#include <linux/loop.h>
+
+#include "api_test.h"
+#include "libcryptsetup.h"
+
+static char last_error[256];
+static char global_log[4096];
+static uint32_t t_dm_crypt_flags = 0;
+
+char *THE_LOOP_DEV = NULL;
+int _debug   = 0;
+int global_lines = 0;
+int _quit = 0;
+int _verbose = 0;
+uint64_t t_dev_offset = 0;
+
+static void (*_cleanup)(void);
+
+void register_cleanup(void (*cleanup)(void))
+{
+       _cleanup = cleanup;
+}
+
+void check_ok(int status, int line, const char *func)
+{
+       if (status) {
+               printf("FAIL line %d [%s]: code %d, %s\n", line, func, status, last_error);
+               _cleanup();
+               exit(-1);
+       }
+}
+
+void check_ok_return(int status, int line, const char *func)
+{
+       if (status < 0) {
+               printf("FAIL line %d [%s]: code %d, %s\n", line, func, status, last_error);
+               _cleanup();
+               exit(-1);
+       }
+}
+
+void check_ko(int status, int line, const char *func)
+{
+       if (status >= 0) {
+               printf("FAIL line %d [%s]: code %d, %s\n", line, func, status, last_error);
+               _cleanup();
+               exit(-1);
+       } else if (_verbose)
+               printf("   => errno %d, errmsg: %s\n", status, last_error);
+}
+
+void check_equal(int line, const char *func, int64_t x, int64_t y)
+{
+       printf("FAIL line %d [%s]: expected equal values differs: %"
+               PRIi64 " != %" PRIi64 "\n", line, func, x, y);
+       _cleanup();
+       exit(-1);
+}
+
+void check_null(int line, const char *func, const void *x)
+{
+       if (x) {
+               printf("FAIL line %d [%s]: expected NULL value: %p\n", line, func, x);
+               _cleanup();
+               exit(-1);
+       }
+}
+
+void check_notnull(int line, const char *func, const void *x)
+{
+       if (!x) {
+               printf("FAIL line %d [%s]: expected not NULL value: %p\n", line, func, x);
+               _cleanup();
+               exit(-1);
+       }
+}
+
+void xlog(const char *msg, const char *tst, const char *func, int line, const char *txt)
+{
+       if (_verbose) {
+               if (txt)
+                       printf(" [%s,%s:%d] %s [%s]\n", msg, func, line, tst, txt);
+               else
+                       printf(" [%s,%s:%d] %s\n", msg, func, line, tst);
+       }
+       if (_quit) {
+               if (_verbose)
+                       printf("Interrupted by a signal.\n");
+               _cleanup();
+               exit(-1);
+       }
+}
+
+int t_device_size(const char *device, uint64_t *size)
+{
+       int devfd, r = 0;
+
+       devfd = open(device, O_RDONLY);
+       if(devfd == -1)
+               return -EINVAL;
+
+       if (ioctl(devfd, BLKGETSIZE64, size) < 0)
+               r = -EINVAL;
+       close(devfd);
+       return r;
+}
+
+int fips_mode(void)
+{
+       int fd;
+       char buf = 0;
+
+       fd = open("/proc/sys/crypto/fips_enabled", O_RDONLY);
+
+       if (fd < 0)
+               return 0;
+
+       if (read(fd, &buf, 1) != 1)
+               buf = '0';
+
+       close(fd);
+
+       return (buf == '1');
+}
+
+/*
+ * Creates dm-linear target over the test loop device. Offset is held in
+ * global variables so that size can be tested whether it fits into remaining
+ * size of the loop device or not
+ */
+int create_dmdevice_over_loop(const char *dm_name, const uint64_t size)
+{
+       char cmd[128];
+       int r;
+       uint64_t r_size;
+
+       if (t_device_size(THE_LOOP_DEV, &r_size) < 0 || r_size <= t_dev_offset || !size)
+               return -1;
+       if ((r_size - t_dev_offset) < size) {
+               printf("No enough space on backing loop device\n.");
+               return -2;
+       }
+       snprintf(cmd, sizeof(cmd),
+                "dmsetup create %s --table \"0 %" PRIu64 " linear %s %" PRIu64 "\"",
+                dm_name, size, THE_LOOP_DEV, t_dev_offset);
+       if (!(r = _system(cmd, 1)))
+               t_dev_offset += size;
+       return r;
+}
+
+// Get key from kernel dm mapping table using dm-ioctl
+int get_key_dm(const char *name, char *buffer, unsigned int buffer_size)
+{
+       struct dm_task *dmt;
+       struct dm_info dmi;
+       uint64_t start, length;
+       char *target_type, *key, *params;
+       void *next = NULL;
+       int r = -EINVAL;
+
+       if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
+               goto out;
+       if (!dm_task_set_name(dmt, name))
+               goto out;
+       if (!dm_task_run(dmt))
+               goto out;
+       if (!dm_task_get_info(dmt, &dmi))
+               goto out;
+       if (!dmi.exists)
+               goto out;
+
+       next = dm_get_next_target(dmt, next, &start, &length, &target_type, &params);
+       if (!target_type || strcmp(target_type, "crypt") != 0)
+               goto out;
+
+       (void)strsep(&params, " "); /* rcipher */
+       key = strsep(&params, " ");
+
+       if (buffer_size <= strlen(key))
+               goto out;
+
+       strncpy(buffer, key, buffer_size);
+       r = 0;
+out:
+       if (dmt)
+               dm_task_destroy(dmt);
+
+       return r;
+}
+
+int prepare_keyfile(const char *name, const char *passphrase, int size)
+{
+       int fd, r;
+
+       fd = open(name, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR|S_IWUSR);
+       if (fd != -1) {
+               r = write(fd, passphrase, size);
+               close(fd);
+       } else
+               r = 0;
+
+       return r == size ? 0 : 1;
+}
+
+// Decode key from its hex representation
+int crypt_decode_key(char *key, const char *hex, unsigned int size)
+{
+       char buffer[3];
+       char *endp;
+       unsigned int i;
+
+       buffer[2] = '\0';
+
+       for (i = 0; i < size; i++) {
+               buffer[0] = *hex++;
+               buffer[1] = *hex++;
+
+               key[i] = (unsigned char)strtoul(buffer, &endp, 16);
+
+               if (endp != &buffer[2])
+                       return -1;
+       }
+
+       if (*hex != '\0')
+               return -1;
+
+       return 0;
+}
+
+void global_log_callback(int level, const char *msg, void *usrptr)
+{
+       size_t len;
+
+       if (_debug) {
+               if (level == CRYPT_LOG_DEBUG)
+                       fprintf(stdout, "# %s", msg);
+               else
+                       fprintf(stdout, "%s", msg);
+       }
+
+       if (level <= CRYPT_LOG_DEBUG)
+               return;
+
+       strncat(global_log, msg, sizeof(global_log) - strlen(global_log));
+       global_lines++;
+       if (level == CRYPT_LOG_ERROR) {
+               len = strlen(msg);
+               if (len > sizeof(last_error))
+                       len = sizeof(last_error);
+               strncpy(last_error, msg, sizeof(last_error));
+               last_error[len-1] = '\0';
+       }
+}
+
+void reset_log(void)
+{
+       memset(global_log, 0, sizeof(global_log));
+       memset(last_error, 0, sizeof(last_error));
+       global_lines = 0;
+}
+
+int _system(const char *command, int warn)
+{
+       int r;
+       if (_debug)
+               printf("Running system: %s\n", command);
+       if ((r=system(command)) < 0 && warn)
+               printf("System command failed: %s", command);
+       return r;
+}
+
+static int keyring_check(void)
+{
+#ifdef KERNEL_KEYRING
+       return syscall(__NR_request_key, "logon", "dummy", NULL, 0) == -1l && errno != ENOSYS;
+#else
+       return 0;
+#endif
+}
+
+static int t_dm_satisfies_version(unsigned target_maj, unsigned target_min, unsigned target_patch,
+                                unsigned actual_maj, unsigned actual_min, unsigned actual_patch)
+{
+       if (actual_maj > target_maj)
+               return 1;
+       if (actual_maj == target_maj && actual_min > target_min)
+               return 1;
+       if (actual_maj == target_maj && actual_min == target_min && actual_patch >= target_patch)
+               return 1;
+       return 0;
+}
+
+static void t_dm_set_crypt_compat(const char *dm_version, unsigned crypt_maj,
+                                unsigned crypt_min, unsigned crypt_patch)
+{
+       unsigned dm_maj = 0, dm_min = 0, dm_patch = 0;
+
+       if (sscanf(dm_version, "%u.%u.%u", &dm_maj, &dm_min, &dm_patch) != 3) {
+               dm_maj = 0;
+               dm_min = 0;
+               dm_patch = 0;
+       }
+
+       if (t_dm_satisfies_version(1, 2, 0, crypt_maj, crypt_min, 0))
+               t_dm_crypt_flags |= T_DM_KEY_WIPE_SUPPORTED;
+
+       if (t_dm_satisfies_version(1, 10, 0, crypt_maj, crypt_min, 0))
+               t_dm_crypt_flags |= T_DM_LMK_SUPPORTED;
+
+       if (t_dm_satisfies_version(4, 20, 0, dm_maj, dm_min, 0))
+               t_dm_crypt_flags |= T_DM_SECURE_SUPPORTED;
+
+       if (t_dm_satisfies_version(1, 8, 0, crypt_maj, crypt_min, 0))
+               t_dm_crypt_flags |= T_DM_PLAIN64_SUPPORTED;
+
+       if (t_dm_satisfies_version(1, 11, 0, crypt_maj, crypt_min, 0))
+               t_dm_crypt_flags |= T_DM_DISCARDS_SUPPORTED;
+
+       if (t_dm_satisfies_version(1, 13, 0, crypt_maj, crypt_min, 0))
+               t_dm_crypt_flags |= T_DM_TCW_SUPPORTED;
+
+       if (t_dm_satisfies_version(1, 14, 0, crypt_maj, crypt_min, 0)) {
+               t_dm_crypt_flags |= T_DM_SAME_CPU_CRYPT_SUPPORTED;
+               t_dm_crypt_flags |= T_DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED;
+       }
+
+       if (t_dm_satisfies_version(1, 18, 1, crypt_maj, crypt_min, crypt_patch) && keyring_check())
+               t_dm_crypt_flags |= T_DM_KERNEL_KEYRING_SUPPORTED;
+}
+
+static void t_dm_set_verity_compat(const char *dm_version, unsigned verity_maj,
+                                  unsigned verity_min, unsigned verity_patch)
+{
+       if (verity_maj > 0)
+               t_dm_crypt_flags |= T_DM_VERITY_SUPPORTED;
+       else
+               return;
+       /*
+        * ignore_corruption, restart_on corruption is available since 1.2 (kernel 4.1)
+        * ignore_zero_blocks since 1.3 (kernel 4.5)
+        * (but some dm-verity targets 1.2 don't support it)
+        * FEC is added in 1.3 as well.
+        */
+       if (t_dm_satisfies_version(1, 3, 0, verity_maj, verity_min, 0)) {
+               t_dm_crypt_flags |= T_DM_VERITY_ON_CORRUPTION_SUPPORTED;
+               t_dm_crypt_flags |= T_DM_VERITY_FEC_SUPPORTED;
+       }
+}
+
+static void t_dm_set_integrity_compat(const char *dm_version, unsigned integrity_maj,
+                                     unsigned integrity_min, unsigned integrity_patch)
+{
+       if (integrity_maj > 0)
+               t_dm_crypt_flags |= T_DM_INTEGRITY_SUPPORTED;
+}
+
+int t_dm_check_versions(void)
+{
+       struct dm_task *dmt;
+       struct dm_versions *target, *last_target;
+       char dm_version[16];
+       int r = 1;
+
+       if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
+               goto out;
+
+       if (!dm_task_run(dmt))
+               goto out;
+
+       if (!dm_task_get_driver_version(dmt, dm_version, sizeof(dm_version)))
+               goto out;
+
+       target = dm_task_get_versions(dmt);
+       do {
+               last_target = target;
+               if (!strcmp("crypt", target->name)) {
+                       t_dm_set_crypt_compat(dm_version,
+                                            (unsigned)target->version[0],
+                                            (unsigned)target->version[1],
+                                            (unsigned)target->version[2]);
+               } else if (!strcmp("verity", target->name)) {
+                       t_dm_set_verity_compat(dm_version,
+                                            (unsigned)target->version[0],
+                                            (unsigned)target->version[1],
+                                            (unsigned)target->version[2]);
+               } else if (!strcmp("integrity", target->name)) {
+                       t_dm_set_integrity_compat(dm_version,
+                                            (unsigned)target->version[0],
+                                            (unsigned)target->version[1],
+                                            (unsigned)target->version[2]);
+               }
+               target = (struct dm_versions *)((char *) target + target->next);
+       } while (last_target != target);
+
+       r = 0;
+out:
+       if (dmt)
+               dm_task_destroy(dmt);
+
+       return r;
+}
+
+int t_dm_crypt_keyring_support(void)
+{
+       return t_dm_crypt_flags & T_DM_KERNEL_KEYRING_SUPPORTED;
+}
+
+int t_dm_crypt_cpu_switch_support(void)
+{
+       return t_dm_crypt_flags & (T_DM_SAME_CPU_CRYPT_SUPPORTED |
+                                  T_DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED);
+}
+
+int t_dm_crypt_discard_support(void)
+{
+       return t_dm_crypt_flags & T_DM_DISCARDS_SUPPORTED;
+}
+
+/* loop helpers */
+
+#define LOOP_DEV_MAJOR 7
+
+#ifndef LO_FLAGS_AUTOCLEAR
+#define LO_FLAGS_AUTOCLEAR 4
+#endif
+
+#ifndef LOOP_CTL_GET_FREE
+#define LOOP_CTL_GET_FREE 0x4C82
+#endif
+
+#ifndef LOOP_SET_CAPACITY
+#define LOOP_SET_CAPACITY 0x4C07
+#endif
+
+int loop_device(const char *loop)
+{
+       struct stat st;
+
+       if (!loop)
+               return 0;
+
+       if (stat(loop, &st) || !S_ISBLK(st.st_mode) ||
+           major(st.st_rdev) != LOOP_DEV_MAJOR)
+               return 0;
+
+       return 1;
+}
+
+static char *crypt_loop_get_device_old(void)
+{
+       char dev[20];
+       int i, loop_fd;
+       struct loop_info64 lo64 = {0};
+
+       for (i = 0; i < 256; i++) {
+               sprintf(dev, "/dev/loop%d", i);
+
+               loop_fd = open(dev, O_RDONLY);
+               if (loop_fd < 0)
+                       return NULL;
+
+               if (ioctl(loop_fd, LOOP_GET_STATUS64, &lo64) &&
+                   errno == ENXIO) {
+                       close(loop_fd);
+                       return strdup(dev);
+               }
+               close(loop_fd);
+       }
+
+       return NULL;
+}
+
+static char *crypt_loop_get_device(void)
+{
+       char dev[64];
+       int i, loop_fd;
+       struct stat st;
+
+       loop_fd = open("/dev/loop-control", O_RDONLY);
+       if (loop_fd < 0)
+               return crypt_loop_get_device_old();
+
+       i = ioctl(loop_fd, LOOP_CTL_GET_FREE);
+       if (i < 0) {
+               close(loop_fd);
+               return NULL;
+       }
+       close(loop_fd);
+
+       if (sprintf(dev, "/dev/loop%d", i) < 0)
+               return NULL;
+
+       if (stat(dev, &st) || !S_ISBLK(st.st_mode))
+               return NULL;
+
+       return strdup(dev);
+}
+
+int loop_attach(char **loop, const char *file, int offset,
+                     int autoclear, int *readonly)
+{
+       struct loop_info64 lo64 = {0};
+       char *lo_file_name;
+       int loop_fd = -1, file_fd = -1, r = 1;
+
+       *loop = NULL;
+
+       file_fd = open(file, (*readonly ? O_RDONLY : O_RDWR) | O_EXCL);
+       if (file_fd < 0 && (errno == EROFS || errno == EACCES) && !*readonly) {
+               *readonly = 1;
+               file_fd = open(file, O_RDONLY | O_EXCL);
+       }
+       if (file_fd < 0)
+               goto out;
+
+       while (loop_fd < 0)  {
+               *loop = crypt_loop_get_device();
+               if (!*loop)
+                       goto out;
+
+               loop_fd = open(*loop, *readonly ? O_RDONLY : O_RDWR);
+               if (loop_fd < 0)
+                       goto out;
+
+               if (ioctl(loop_fd, LOOP_SET_FD, file_fd) < 0) {
+                       if (errno != EBUSY)
+                               goto out;
+                       free(*loop);
+                       *loop = NULL;
+
+                       close(loop_fd);
+                       loop_fd = -1;
+               }
+       }
+
+       lo_file_name = (char*)lo64.lo_file_name;
+       lo_file_name[LO_NAME_SIZE-1] = '\0';
+       strncpy(lo_file_name, file, LO_NAME_SIZE-1);
+       lo64.lo_offset = offset;
+       if (autoclear)
+               lo64.lo_flags |= LO_FLAGS_AUTOCLEAR;
+
+       if (ioctl(loop_fd, LOOP_SET_STATUS64, &lo64) < 0) {
+               (void)ioctl(loop_fd, LOOP_CLR_FD, 0);
+               goto out;
+       }
+
+       /* Verify that autoclear is really set */
+       if (autoclear) {
+               memset(&lo64, 0, sizeof(lo64));
+               if (ioctl(loop_fd, LOOP_GET_STATUS64, &lo64) < 0 ||
+                  !(lo64.lo_flags & LO_FLAGS_AUTOCLEAR)) {
+               (void)ioctl(loop_fd, LOOP_CLR_FD, 0);
+                       goto out;
+               }
+       }
+
+       r = 0;
+out:
+       if (r && loop_fd >= 0)
+               close(loop_fd);
+       if (file_fd >= 0)
+               close(file_fd);
+       if (r && *loop) {
+               free(*loop);
+               *loop = NULL;
+       }
+       return r ? -1 : loop_fd;
+}
+
+int loop_detach(const char *loop)
+{
+       int loop_fd = -1, r = 1;
+
+       loop_fd = open(loop, O_RDONLY);
+       if (loop_fd < 0)
+                return 1;
+
+       if (!ioctl(loop_fd, LOOP_CLR_FD, 0))
+               r = 0;
+
+       close(loop_fd);
+       return r;
+}
diff --git a/tests/unit-utils-io.c b/tests/unit-utils-io.c
new file mode 100644 (file)
index 0000000..ff5be52
--- /dev/null
@@ -0,0 +1,346 @@
+/*
+ * simple unit test for utils_io.c (blockwise low level functions)
+ *
+ * Copyright (C) 2018-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "utils_io.h"
+
+enum fn_enum {
+       READ_BUFFER = 0,
+       WRITE_BUFFER,
+       READ_BLOCKWISE,
+       WRITE_BLOCKWISE,
+       READ_LSEEK_BLOCKWISE,
+       WRITE_LSEEK_BLOCKWISE
+} test_fn;
+
+char           *test_file;
+size_t         test_bsize;
+size_t         test_alignment;
+size_t         test_length;
+off_t          test_offset; //FIXME: check for proper 64bit support (and test it!)
+size_t         test_mem_alignment = 4096;
+
+static int test_read_buffer(void)
+{
+       void *buffer = NULL;
+       int fd = -1;
+       ssize_t ret = -EINVAL;
+
+       //printf("Entering test_read_buffer\n");
+
+       if (posix_memalign(&buffer, test_mem_alignment, test_length)) {
+               fprintf(stderr, "Failed to allocate aligned buffer.\n");
+               goto out;
+       }
+
+       fd = open(test_file, O_RDONLY | O_DIRECT);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open %s.\n", test_file);
+               goto out;
+       }
+
+       ret = read_buffer(fd, buffer, test_length);
+       if (ret < 0)
+               goto out;
+
+       ret = (size_t) ret == test_length ? 0 : -EIO;
+out:
+       if (fd >= 0)
+               close(fd);
+       free(buffer);
+       return ret;
+}
+
+static int test_write_buffer(void)
+{
+       void *buffer = NULL;
+       int fd = -1;
+       ssize_t ret = -EINVAL;
+
+       //printf("Entering test_write_buffer\n");
+
+       if (posix_memalign(&buffer, test_mem_alignment, test_length)) {
+               fprintf(stderr, "Failed to allocate aligned buffer.\n");
+               goto out;
+       }
+
+       fd = open(test_file, O_WRONLY | O_DIRECT);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open %s.\n", test_file);
+               goto out;
+       }
+
+       ret = write_buffer(fd, buffer, test_length);
+       if (ret < 0)
+               goto out;
+
+       return (size_t) ret == test_length ? 0 : -EIO;
+out:
+       if (fd >= 0)
+               close(fd);
+       free(buffer);
+       return ret;
+}
+
+static int test_read_blockwise(void)
+{
+       void *buffer = NULL;
+       int fd = -1;
+       ssize_t ret = -EINVAL;
+
+       //printf("Entering test_read_blockwise ");
+       //printf("test_bsize: %zu, test_length: %zu\n", test_bsize, test_length);
+
+       if (posix_memalign(&buffer, test_mem_alignment, test_length)) {
+               fprintf(stderr, "Failed to allocate aligned buffer.\n");
+               goto out;
+       }
+
+       fd = open(test_file, O_RDONLY | O_DIRECT);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open %s.\n", test_file);
+               goto out;
+       }
+
+
+       ret = read_blockwise(fd, test_bsize, test_mem_alignment, buffer, test_length);
+       if (ret < 0)
+               goto out;
+
+       ret = (size_t) ret == test_length ? 0 : -EIO;
+out:
+       if (fd >= 0)
+               close(fd);
+       free(buffer);
+       return ret;
+}
+
+static int test_write_blockwise(void)
+{
+       void *buffer = NULL;
+       int fd = -1;
+       ssize_t ret = -EINVAL;
+
+       //printf("Entering test_write_blockwise\n");
+
+       if (posix_memalign(&buffer, test_mem_alignment, test_length)) {
+               fprintf(stderr, "Failed to allocate aligned buffer.\n");
+               goto out;
+       }
+
+       fd = open(test_file, O_RDWR | O_DIRECT);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open %s.\n", test_file);
+               goto out;
+       }
+
+       ret = write_blockwise(fd, test_bsize, test_mem_alignment, buffer, test_length);
+       if (ret < 0)
+               goto out;
+
+       ret = (size_t) ret == test_length ? 0 : -EIO;
+out:
+       if (fd >= 0)
+               close(fd);
+       free(buffer);
+       return ret;
+}
+
+static int test_read_lseek_blockwise(void)
+{
+       void *buffer = NULL;
+       int fd = -1;
+       ssize_t ret = -EINVAL;
+
+       //printf("Entering test_read_lseek_blockwise\n");
+
+       if (posix_memalign(&buffer, test_mem_alignment, test_length)) {
+               fprintf(stderr, "Failed to allocate aligned buffer.\n");
+               goto out;
+       }
+
+       fd = open(test_file, O_RDONLY | O_DIRECT);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open %s.\n", test_file);
+               goto out;
+       }
+
+       ret = read_lseek_blockwise(fd, test_bsize, test_mem_alignment, buffer, test_length, test_offset);
+       if (ret < 0)
+               goto out;
+
+       ret = (size_t) ret == test_length ? 0 : -EIO;
+out:
+       if (fd >= 0)
+               close(fd);
+       free(buffer);
+       return ret;
+}
+
+static int test_write_lseek_blockwise(void)
+{
+       void *buffer = NULL;
+       int fd = -1;
+       ssize_t ret = -EINVAL;
+
+       //printf("Entering test_write_lseek_blockwise\n");
+
+       if (posix_memalign(&buffer, test_mem_alignment, test_length)) {
+               fprintf(stderr, "Failed to allocate aligned buffer.\n");
+               goto out;
+       }
+
+       fd = open(test_file, O_RDWR | O_DIRECT);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open %s.\n", test_file);
+               goto out;
+       }
+
+       ret = write_lseek_blockwise(fd, test_bsize, test_mem_alignment, buffer, test_length, test_offset);
+       if (ret < 0)
+               goto out;
+
+       ret = (size_t) ret == test_length ? 0 : -EIO;
+out:
+       if (fd >= 0)
+               close(fd);
+       free(buffer);
+       return ret;
+}
+
+static void usage(void)
+{
+       fprintf(stderr, "Use:\tunit-utils-io file/device blockwise_fn length  [bsize] [offset].\n");
+}
+
+static int parse_input_params(int argc, char **argv)
+{
+       struct stat st;
+       unsigned long offset;
+
+       if (argc < 4) {
+               usage();
+               return 1;
+       }
+
+       if (stat(argv[1], &st)) {
+               fprintf(stderr, "File/device %s is missing?\n", argv[1]);
+               return 1;
+       }
+       test_file = argv[1];
+       if (sscanf(argv[3], "%zu", &test_length) != 1)
+               return 1;
+       if (argc >= 5 && sscanf(argv[4], "%zu", &test_bsize) != 1)
+               return 1;
+       if (argc >= 6) {
+               if (sscanf(argv[5], "%ld", &offset) != 1)
+                       return 1;
+               test_offset = offset;
+       }
+
+       if (!strcmp(argv[2], "read_buffer"))
+               test_fn = READ_BUFFER;
+       else if (!strcmp(argv[2], "write_buffer"))
+               test_fn = WRITE_BUFFER;
+       else if (!strcmp(argv[2], "read_blockwise")) {
+               if (argc < 5) {
+                       usage();
+                       return 1;
+               }
+               test_fn = READ_BLOCKWISE;
+       } else if (!strcmp(argv[2], "write_blockwise")) {
+               if (argc < 5) {
+                       usage();
+                       return 1;
+               }
+               test_fn = WRITE_BLOCKWISE;
+       } else if (!strcmp(argv[2], "read_lseek_blockwise")) {
+               if (argc < 6) {
+                       usage();
+                       return 1;
+               }
+               test_fn = READ_LSEEK_BLOCKWISE;
+       } else if (!strcmp(argv[2], "write_lseek_blockwise")) {
+               if (argc < 6) {
+                       usage();
+                       return 1;
+               }
+               test_fn = WRITE_LSEEK_BLOCKWISE;
+       } else {
+               usage();
+               return 1;
+       }
+
+       /* printf("function '%s': length %zu", argv[2], test_length);
+       if (argc >= 5)
+               printf(", bsize %zu", test_bsize);
+       if (argc >= 6)
+               printf(", offset %llu", test_offset);
+       printf("\n"); */
+
+       return 0;
+}
+
+int main(int argc, char **argv)
+{
+       long ps;
+       int r = EXIT_FAILURE;
+
+       if (parse_input_params(argc, argv))
+               return r;
+
+       ps = sysconf(_SC_PAGESIZE);
+       if (ps > 0)
+               test_mem_alignment = (size_t)ps;
+
+       switch (test_fn) {
+       case READ_BUFFER:
+               r = test_read_buffer();
+               break;
+       case WRITE_BUFFER:
+               r = test_write_buffer();
+               break;
+       case READ_BLOCKWISE:
+               r = test_read_blockwise();
+               break;
+       case WRITE_BLOCKWISE:
+               r = test_write_blockwise();
+               break;
+       case READ_LSEEK_BLOCKWISE:
+               r = test_read_lseek_blockwise();
+               break;
+       case WRITE_LSEEK_BLOCKWISE:
+               r = test_write_lseek_blockwise();
+               break;
+       default :
+               fprintf(stderr, "Internal test error.\n");
+               return r;
+       }
+
+       return r == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
index 82a7e06..3dc0784 100755 (executable)
@@ -3,7 +3,7 @@ SUP="--suppressions=./cryptsetup-valg-supps"
 CHILD="--trace-children=yes --child-silent-after-fork=yes"
 MALLOC="--malloc-fill=aa"
 FREE="--free-fill=21"
-STACK="--max-stackframe=300000"
+STACK="--max-stackframe=2000000"
 EXTRAS="--read-var-info=yes --show-reachable=yes"
 LOGFILE="--log-file=./valglog.$(date +%s)_${INFOSTRING}"
 LEAKCHECK="--leak-check=full --track-origins=yes"
diff --git a/tests/valid_header_file.bz2 b/tests/valid_header_file.bz2
deleted file mode 100644 (file)
index 5a59428..0000000
Binary files a/tests/valid_header_file.bz2 and /dev/null differ
diff --git a/tests/valid_header_file.xz b/tests/valid_header_file.xz
new file mode 100644 (file)
index 0000000..4b443ae
Binary files /dev/null and b/tests/valid_header_file.xz differ
index e9c1101..4ce70f9 100755 (executable)
@@ -1,17 +1,25 @@
 #!/bin/bash
 
-VERITYSETUP=../src/veritysetup
+[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
+VERITYSETUP=$CRYPTSETUP_PATH/veritysetup
+VERITYSETUP_VALGRIND=../.libs/veritysetup
+VERITYSETUP_LIB_VALGRIND=../.libs
 
 DEV_NAME=verity3273
 DEV_OUT="$DEV_NAME.out"
 IMG=verity-data
 IMG_HASH=verity-hash
+IMG_TMP=tst-dev
+FEC_DEV=tst_fec123
+# If we need deterministic image creation
+DEV_SALT=9e7457222290f1bac0d42ad2de2d602a87bb871c22ab70ca040bad450578a436
+DEV_UUID=a60c98d2-ae9b-4865-bfcb-b4e3ace11033
 
 function remove_mapping()
 {
-       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME
+       [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove $DEV_NAME >/dev/null 2>&1
        [ ! -z "$LOOPDEV1" ] && losetup -d $LOOPDEV1 >/dev/null 2>&1
-       rm -f $IMG $IMG_HASH $DEV_OUT >/dev/null 2>&1
+       rm -f $IMG $IMG_HASH $DEV_OUT $FEC_DEV $IMG_TMP  >/dev/null 2>&1
        LOOPDEV1=""
        LOOPDEV2=""
 }
@@ -19,7 +27,8 @@ function remove_mapping()
 function fail()
 {
        [ -n "$1" ] && echo "$1"
-       echo "FAILED"
+       echo "FAILED backtrace:"
+       while caller $frame; do ((frame++)); done
        [ -f $DEV_OUT ] && cat $DEV_OUT
        remove_mapping
        exit 2
@@ -28,14 +37,14 @@ function fail()
 function skip()
 {
        [ -n "$1" ] && echo "$1"
-       exit 0
+       exit 77
 }
 
 function prepare() # $1 dev1_siz [$2 dev2_size]
 {
        remove_mapping
 
-       dd if=/dev/zero of=$IMG      bs=1k count=$1 >/dev/null 2>&1
+       dd if=/dev/zero of=$IMG bs=1k count=$1 >/dev/null 2>&1
        LOOPDEV1=$(losetup -f 2>/dev/null)
        [ -z "$LOOPDEV1" ] && fail "No free loop device"
        losetup $LOOPDEV1 $IMG
@@ -55,6 +64,19 @@ function check_exists()
        [ -b /dev/mapper/$DEV_NAME ] || fail
 }
 
+function check_version() # MAJ MIN
+{
+       VER_STR=$(dmsetup targets | grep verity | cut -f 3 -dv)
+       [ -z "$VER_STR" ] && fail "Failed to parse dm-verity version."
+
+       VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
+       VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
+
+       test $VER_MAJ -gt $1 && return 0
+       test $VER_MIN -ge $2 && return 0
+       return 1
+}
+
 function compare_out() # $1 what, $2 expected
 {
        OPT=$(grep -v "^#" $DEV_OUT | grep -i "$1" | sed -e s/.*\:\ // )
@@ -78,7 +100,7 @@ function check_root_hash() # $1 size, $2 hash, $3 salt, $4 version, $5 hash, [$6
        if [ $sb == yes ] ; then
                VERIFY_PARAMS=""
        else
-               FORMAT_PAFAMS="$FORMAT_PARAMS --no-superlock"
+               FORMAT_PARAMS="$FORMAT_PARAMS --no-superblock"
                VERIFY_PARAMS=$FORMAT_PARAMS
        fi
 
@@ -102,7 +124,7 @@ function check_root_hash() # $1 size, $2 hash, $3 salt, $4 version, $5 hash, [$6
        dmsetup status $DEV_NAME | grep "verity V" >/dev/null || fail
        echo -n "[in-kernel verify]"
 
-       $VERITYSETUP remove $DEV_NAME || fail
+       $VERITYSETUP close $DEV_NAME >/dev/null 2>&1 || fail
 
        case $fail in
        data)
@@ -126,22 +148,206 @@ function check_root_hash() # $1 size, $2 hash, $3 salt, $4 version, $5 hash, [$6
        dd if=/dev/mapper/$DEV_NAME of=/dev/null bs=$1 2>/dev/null
        dmsetup status $DEV_NAME | grep "verity V" >/dev/null && \
                fail "in-kernel check for $TXT corruption"
-       $VERITYSETUP remove $DEV_NAME || fail "deactivation"
+       $VERITYSETUP close $DEV_NAME >/dev/null 2>&1 || fail "deactivation"
        echo "[$TXT corruption]"
        done
        done
 }
 
+function corrupt_device() # $1 device, $2 device_size(in bytes), $3 #{corrupted_bytes}
+{
+       # Repeatable magic corruption :-)
+       CORRUPT=$3
+       RANDOM=43
+       while [ "$CORRUPT" -gt 0 ]; do
+               SEEK=$RANDOM
+               while [ $SEEK -ge $2 ] ; do SEEK=$RANDOM; done
+               echo -n -e "\x55" | dd of=$1 bs=1 count=1 seek=$SEEK conv=notrunc > /dev/null 2>&1
+               CORRUPT=$(($CORRUPT - 1))
+       done
+}
+
+# $1 data_device, $2 hash_device, $3 fec_device, $4 data/hash_block_size(in bytes),
+# $5 data_size(in blocks), $6 device_size(in blocks), $7 hash_offset(in bytes),
+# $8 fec_offset(in bytes), $9 fec_roots, ${10} corrupted_bytes, [${11} superblock(y/n), ${12} salt]
+function check_fec()
+{
+       INDEX=25
+       dd if=/dev/zero of=$1 bs=$4 count=$6 > /dev/null 2>&1
+
+       echo -n "Block_size: $4, Data_size: $(($4 * $5))B, FEC_roots: $9, Corrupted_bytes: ${10} "
+
+       PARAMS=" --data-block-size=$4 --hash-block-size=$4 "
+       if [ "$5" -ne "$6" ]; then
+               PARAMS="$PARAMS --data-blocks=$5"
+       fi
+
+       if [ "$7" -ne 0 ]; then
+               PARAMS="$PARAMS --hash-offset=$7"
+       fi
+
+       if [ "$8" -ne 0 ]; then
+               PARAMS="$PARAMS --fec-offset=$8"
+       fi
+
+       if [ "${11}" == "n" ]; then
+               INDEX=24
+               echo -n "[no-superblock]"
+               PARAMS="$PARAMS --no-superblock -s=${12}"
+       elif [ -n "${12}" ]; then
+               PARAMS="$PARAMS -s=${12}"
+       fi
+
+       if [[ "$1" == "$2" && "$1" == "$3" ]]; then
+               echo -n "[one_device_test]"
+               dd if=/dev/zero of=$IMG_TMP bs=$4 count=$5  > /dev/null 2>&1
+               ARR=(`sha256sum $IMG_TMP`)
+               HASH_ORIG=${ARR[0]}
+       else
+               ARR=(`sha256sum $1`)
+               HASH_ORIG=${ARR[0]}
+       fi
+
+       ARR=(`$VERITYSETUP format $1 $2 --fec-device=$3 $PARAMS`)
+       SALT=${ARR[$INDEX]}
+       ROOT_HASH=${ARR[$(($INDEX+3))]}
+
+       corrupt_device $1 $(($5 * $4)) ${10}
+
+       $VERITYSETUP create $DEV_NAME $1 $2 $ROOT_HASH --fec-device=$3 $PARAMS > /dev/null 2>&1
+       if [ "$?" -ne "0" ] ; then
+               echo "[N/A, test skipped]"
+               return 3
+       fi
+
+       udevadm settle
+
+       dd if=/dev/mapper/$DEV_NAME of=$IMG_TMP > /dev/null 2>&1
+       ARR=(`sha256sum $IMG_TMP`)
+
+       HASH_REPAIRED=${ARR[0]}
+
+       $VERITYSETUP close $DEV_NAME
+       rm $1 $2 $3 $IMG_TMP > /dev/null 2>&1
+
+       if [ "$HASH_ORIG" != "$HASH_REPAIRED" ]; then
+               echo -n "[correction failed]"
+               return 1
+       fi
+
+       echo "[file was repaired][OK]"
+}
+
+function check_option() # $1 size, $2 hash, $3 salt, $4 version, $5 hash, $6 CLI option, $7 status option
+{
+       DEV_PARAMS="$LOOPDEV1 $LOOPDEV2"
+       FORMAT_PARAMS="--format=$4 --data-block-size=$1 --hash-block-size=$1 --hash=$5 --salt=$3"
+
+       echo -n "Option $6 "
+       $VERITYSETUP format $DEV_PARAMS $FORMAT_PARAMS >/dev/null 2>&1 || fail
+       $VERITYSETUP create $DEV_NAME $DEV_PARAMS $2 $6 >/dev/null 2>&1 || fail
+       check_exists
+       $VERITYSETUP status $DEV_NAME 2>/dev/null | grep flags | grep -q $7 || fail
+       dmsetup table $DEV_NAME 2>/dev/null | grep -q $7 || fail
+       $VERITYSETUP close $DEV_NAME >/dev/null 2>&1 || fail
+       echo "[OK]"
+}
+
 function valgrind_setup()
 {
        which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
-       [ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptsetup executable."
-       #export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
+       [ ! -f $VERITYSETUP_VALGRIND ] && fail "Unable to get location of veritysetup executable."
+       export LD_LIBRARY_PATH="$VERITYSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
 }
 
 function valgrind_run()
 {
-       INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${VERITYSETUP} "$@"
+       INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.sh ${VERITYSETUP_VALGRIND} "$@"
+}
+
+function checkOffsetBug() # $1 size, $2 hash-offset, $3 data-blocks
+{
+       echo -n "Size :: $1 B | Hash-offset :: $2 blocks | Data-blocks :: $3 "
+       dd if=/dev/zero of=$IMG bs=1 count=0 seek=$1 >/dev/null 2>&1
+       $VERITYSETUP --data-blocks=$3 --hash-offset=$2 format $IMG $IMG >/dev/null 2>&1 || fail "Test [hash-offset greater than 2G] failed"
+       echo "[OK]"
+       remove_mapping
+}
+
+function checkOverlapBug() # $1 size, $2 hash-offset, $3 data-blocks, $4 block_size, $5 fec_offset
+{
+       echo -n "Device-size :: $1 B | "
+       [ $# -ge 3 ] && echo -n "Data-blocks :: $3 blocks| "
+       [ $# -lt 3 ] && echo -n "Data-blocks :: whole device | "
+       [ $# -ge 4 ] && echo -n "Block-size :: $4 B | "
+       [ $# -lt 4 ] && echo -n "Block-size :: 4096 B | "
+       echo -n "Hash-offset :: $2 B | "
+
+       dd if=/dev/zero of=$IMG bs=1 count=0 seek=$1 >/dev/null 2>&1
+       if [ -z $3 ] ; then
+               # veritysetup must fail
+               $VERITYSETUP --hash-offset=$2 format $IMG $IMG >/dev/null 2>&1 && fail "Test [overlap with option \"--data-blocks\" not entered] failed"
+       else
+               $VERITYSETUP --data-block-size=$4 --hash-block-size=$4 --data-blocks=$3 --hash-offset=$2 format $IMG $IMG >/dev/null 2>&1
+               RET=$?
+               [ "$3" -gt "$(($2 / $4))" ] && [ "$RET" -eq "0" ] && fail "Test [overlap - hash-offset in data area] failed"
+       fi
+
+       if [ $# -eq 5 ] ; then
+               echo -n "FEC-offset :: $5 B | "
+               PARAMS="--data-block-size=$4 --hash-block-size=$4 --data-blocks=$3 --fec-device=$IMG --fec-offset=$5"
+
+               # test data-fec area overlap
+               $VERITYSETUP format $IMG $IMG_HASH $PARAMS >/dev/null 2>&1
+               RET=$?
+               [ "$(($3*$4))" -gt "$5" ] && [ "$RET" -eq "0" ] && fail "Test [data/fec area overlap] failed"
+
+               HASH_SIZE=$(stat --printf="%s" $IMG_HASH)
+
+               # test hash-fec area overlap
+               $VERITYSETUP format $IMG $IMG $PARAMS --hash-offset=$2 >/dev/null 2>&1
+               RET=$?
+               [ "$(($2 + $HASH_SIZE))" -gt "$5" ] && [ "$RET" -eq "0" ] && fail "Test [hash/fec area overlap] failed"
+       fi
+
+       echo "[OK]"
+       remove_mapping
+}
+
+# $1 size, $2 block size, $3 roots, $4 hash offset, $5 fec offset,
+# $6 one dev(1 - one device, 2 - one device for data and hash, one device for fec data, 3 - three separate devices),
+# $7 #{corrupted bytes}
+function checkUserSpaceRepair()
+{
+       BS=512
+       COUNT=50000
+       dd if=/dev/zero of=$IMG bs=$BS count=$COUNT >/dev/null 2>&1
+       PARAMS="--data-block-size=$2 --hash-block-size=$2 --fec-roots=$3"
+       [ "$1" -gt 0 ] && PARAMS="$PARAMS --data-blocks=$1" && BS=$2 && COUNT=$1
+
+       # different parameters for different number of devices
+       [ "$6" -eq 1 ] && HASH_DEV=$IMG && FEC=$IMG && PARAMS="$PARAMS --hash-offset=$4 --fec-offset=$5" && echo -n "[One device]"
+       [ "$6" -eq 2 ] && HASH_DEV=$IMG && FEC=$FEC_DEV && PARAMS="$PARAMS --hash-offset=$4" && echo -n "[Two separate data/hash and fec devices]"
+       [ "$6" -eq 3 ] && HASH_DEV=$IMG_HASH && FEC=$FEC_DEV && echo -n "[Three separate devices]"
+
+       echo -n "[nroots::$3]"
+
+       ARR=(`$VERITYSETUP format $IMG $HASH_DEV --fec-device $FEC $PARAMS --salt=$DEV_SALT --uuid=$DEV_UUID`)
+       ROOT_HASH=${ARR[28]}
+
+       echo -n "[Errors can be corrected]"
+       corrupt_device $IMG $(($BS*$COUNT)) $7
+       $VERITYSETUP verify $IMG $HASH_DEV $ROOT_HASH --fec-device=$FEC $PARAMS >/dev/null 2>&1
+       RET=$?
+       [ "$RET" -ne 0 ] && fail "Device can be corrected, but it wasn't."
+       echo -n "[OK]"
+
+       echo -n "[Errors cannot be corrected]"
+       dd if=/dev/urandom of=$IMG bs=$BS count=$COUNT conv=notrunc >/dev/null 2>&1
+       $VERITYSETUP verify $IMG $HASH_DEV $ROOT_HASH --fec-device=$FEC $PARAMS >/dev/null 2>&1
+       RET=$?
+       [ "$RET" -eq 0 ] && fail "Device cannot be correct, but it didn't fail."
+       echo "[OK]"
 }
 
 [ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skipped."
@@ -181,5 +387,58 @@ check_root_hash 4096 ef29c902d87350f1da4bfa536e16cebc162a909bf89abe448b81ec500d4
 check_root_hash 1024 d0e9163ca8844aaa2e88fe5265a8c5d9ee494a99 $SALT 1 sha1 8388608
 check_root_hash 1024 73509e8e868be6b8ac939817a98a3d35121413b2 dadada 1 sha1 8388608
 
+if check_version 1 3; then
+       echo "Verity data corruption options test."
+       SALT=e48da609055204e89ae53b655ca2216dd983cf3cb829f34f63a297d106d53e2d
+       HASH=9de18652fe74edfb9b805aaed72ae2aa48f94333f1ba5c452ac33b1c39325174
+       prepare 8192 1024
+       check_option 512 $HASH $SALT 1 sha256 "--ignore-corruption" "ignore_corruption"
+       check_option 512 $HASH $SALT 1 sha256 "--restart-on-corruption" "restart_on_corruption"
+       check_option 512 $HASH $SALT 1 sha256 "--ignore-zero-blocks" "ignore_zero_blocks"
+       check_option 512 $HASH $SALT 1 sha256 "--ignore-corruption --ignore-zero-blocks" "ignore_corruption"
+       if check_version 1 4; then
+               check_option 512 $HASH $SALT 1 sha256 "--check-at-most-once" "check_at_most_once"
+       fi
+fi
+
+echo "Veritysetup [hash-offset bigger than 2G works] "
+checkOffsetBug 3000000000 2499997696 256
+checkOffsetBug 10000000000 8000000000 128
+
+echo "Veritysetup [overlap-detection] "
+checkOverlapBug 2097152 1433600
+checkOverlapBug 2097152 1433600 350 4096
+checkOverlapBug 2097152 1228800 350 4096 # data-hash overlap
+checkOverlapBug 2097152 0 350 4096 1228800 # data-fec overlap
+checkOverlapBug 10240000 256000 400 512 256512 # hash-fec overlap
+
+if check_version 1 3; then
+       echo "Veritysetup [FEC tests]"
+       for INDEX in  {1..4}; do
+         # in the first iteration check if we can use FEC (it can be compiled-out)
+         (check_fec $IMG $IMG $IMG 4096 30 150 163840 409600 $(($RANDOM % 23 + 2)) $(($INDEX * 4)) )
+         RET=$?
+         [ "$RET" -eq "3" ] && break
+         [ "$RET" -eq "0" ] || fail "FEC repair failed"
+
+         (check_fec $IMG $IMG_HASH $FEC_DEV 4096 30 30 0 0 $(($RANDOM % 23 + 2)) $(($INDEX * 4)) 'n' $SALT) || fail "FEC repair failed"
+         (check_fec $IMG $IMG_HASH $FEC_DEV 4096 35 35 0 0 $(($RANDOM % 23 + 2)) $(($INDEX * 4))) || fail "FEC repair failed"
+         (check_fec $IMG $IMG_HASH $FEC_DEV 512 2000 2000 0 0 $(($RANDOM % 23 + 2)) $(($INDEX * 4))) || fail "FEC repair failed"
+         (check_fec $IMG $IMG_HASH $FEC_DEV 1024 2000 2000 0 0 $(($RANDOM % 23 + 2)) $(($INDEX * 4))) || fail "FEC repair failed"
+         # this test should fail
+         (check_fec $IMG $IMG_HASH $FEC_DEV 4096 30 30 0 0 $(($RANDOM % 23 + 2)) $(($RANDOM % 200 + 200))) && fail "FEC repair must fail"
+         echo "[OK]"
+       done
+fi
+
+echo "Correction in userspace: "
+# checkUserSpaceRepair <#blocks> <block_size> <roots> <hash_offset> <fec_offset> <#devices> <#corrupted bytes>
+checkUserSpaceRepair -1  512  2 0       0       3 100
+checkUserSpaceRepair 400 512  2 256000  0       2 50
+checkUserSpaceRepair 500 512  2 2457600  4915200  1 1
+checkUserSpaceRepair -1  4096 2 0       0       3 10
+checkUserSpaceRepair 400 4096 2 2048000 0       2 1
+#checkUserSpaceRepair 500 4096 2 2457600 4915200 1 2 # FIXME
+
 remove_mapping
 exit 0